--- a/creator/data/creator.rss Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/data/creator.rss Wed Oct 13 14:32:52 2010 +0300
@@ -1009,7 +1009,7 @@
id = EAknMessageQueryContentId;
control = AVKON_MESSAGE_QUERY
{
- message = "Version 5.3.6 - 30th August 2010. Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.";
+ message = "Version 5.3.5 - 30th October 2009. Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.";
};
}
};
--- a/creator/inc/creator_browserelement.h Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/inc/creator_browserelement.h Wed Oct 13 14:32:52 2010 +0300
@@ -41,7 +41,7 @@
public:
static CCreatorBrowserElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
void ExecuteCommandL();
- void AsyncExecuteCommandL();
+
protected:
CCreatorBrowserElement(CCreatorEngine* aEngine);
TInt GetBrowserCommandL() const;
--- a/creator/inc/creator_calendarelement.h Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/inc/creator_calendarelement.h Wed Oct 13 14:32:52 2010 +0300
@@ -102,7 +102,6 @@
public:
static CCreatorCalendarElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
void ExecuteCommandL();
- void AsyncExecuteCommandL();
protected:
CCreatorCalendarElement(CCreatorEngine* aEngine);
--- a/creator/inc/creator_connectionmethodelement.h Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/inc/creator_connectionmethodelement.h Wed Oct 13 14:32:52 2010 +0300
@@ -90,7 +90,7 @@
public:
static CCreatorConnectionMethodElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
void ExecuteCommandL();
- void AsyncExecuteCommandL();
+
protected:
CCreatorConnectionMethodElement(CCreatorEngine* aEngine);
};
--- a/creator/inc/creator_contactelement.h Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/inc/creator_contactelement.h Wed Oct 13 14:32:52 2010 +0300
@@ -143,7 +143,6 @@
public:
static CCreatorContactElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
void ExecuteCommandL();
- void AsyncExecuteCommandL();
protected:
CCreatorContactElement(CCreatorEngine* aEngine);
};
@@ -155,7 +154,6 @@
{
public:
static CCreatorContactSetElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
- void AsyncExecuteCommand();
void ExecuteCommandL();
virtual void AddToCacheL();
protected:
@@ -169,7 +167,6 @@
{
public:
static CCreatorContactGroupElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
- void AsyncExecuteCommandL();
void ExecuteCommandL();
protected:
CCreatorContactGroupElement(CCreatorEngine* aEngine);
--- a/creator/inc/creator_fileelement.h Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/inc/creator_fileelement.h Wed Oct 13 14:32:52 2010 +0300
@@ -51,7 +51,6 @@
public:
static CCreatorFileElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
void ExecuteCommandL();
- void AsyncExecuteCommandL();
protected:
CCreatorFileElement(CCreatorEngine* aEngine);
@@ -64,4 +63,4 @@
TInt64 iTimeZone;
};
-#endif // CREATORFILEELEMENT_H_
+#endif // CREATORFILEELEMENT_H_
\ No newline at end of file
--- a/creator/inc/creator_impselement.h Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/inc/creator_impselement.h Wed Oct 13 14:32:52 2010 +0300
@@ -40,7 +40,7 @@
public:
static CCreatorImpsServerElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
void ExecuteCommandL();
- void AsyncExecuteCommandL();
+
protected:
CCreatorImpsServerElement(CCreatorEngine* aEngine);
};
--- a/creator/inc/creator_landmarkelement.h Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/inc/creator_landmarkelement.h Wed Oct 13 14:32:52 2010 +0300
@@ -47,7 +47,7 @@
public:
static CCreatorLandmarkElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
void ExecuteCommandL();
- void AsyncExecuteCommandL();
+
protected:
CCreatorLandmarkElement(CCreatorEngine* aEngine);
};
--- a/creator/inc/creator_logelement.h Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/inc/creator_logelement.h Wed Oct 13 14:32:52 2010 +0300
@@ -39,7 +39,7 @@
public:
static CCreatorLogElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
void ExecuteCommandL();
- void AsyncExecuteCommandL();
+
protected:
CCreatorLogElement(CCreatorEngine* aEngine);
TInt GetLogCommandL( const TDesC& aFileIdStr, TBool aRandom ) const;
--- a/creator/inc/creator_mailboxelement.h Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/inc/creator_mailboxelement.h Wed Oct 13 14:32:52 2010 +0300
@@ -115,7 +115,7 @@
public:
static CCreatorMailboxElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
void ExecuteCommandL();
- void AsyncExecuteCommandL();
+
protected:
CCreatorMailboxElement(CCreatorEngine* aEngine);
TBool SetTextParamL(const TDesC& aElemName, const TDesC& aElemContent, CMailboxesParameters* aParams, TBool aSetRandom );
--- a/creator/inc/creator_messageelement.h Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/inc/creator_messageelement.h Wed Oct 13 14:32:52 2010 +0300
@@ -58,7 +58,6 @@
public:
static CCreatorMessageElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
void ExecuteCommandL();
- void AsyncExecuteCommandL();
protected:
CCreatorMessageElement(CCreatorEngine* aEngine);
/*
--- a/creator/inc/creator_model.h Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/inc/creator_model.h Wed Oct 13 14:32:52 2010 +0300
@@ -180,24 +180,9 @@
const CCreatorRandomDataParser::TRandomDataType aRandomDataType);
void GenerateSourceImageFileL( const TTestDataPath aFileType, const TDesC& aFileName );
void GenereteSourceTextFileL( const TDesC& aFileName, TInt aSize );
-
- /**
- * CallBack for an asynchronous call of RunScriptL.
- * @param aObject TAny object.
- * @return KErrNone or error code.
- */
- static TInt AsyncRunScriptCB( TAny* aObject );
-
public:
void ExecuteOptionsMenuCommandL(TInt aCommand);
-
- /**
- * It starts asynchronous call of RunScriptL, because it can take a long time
- * @return None.
- */
- void AsyncRunScript();
-
void RunScriptL();
TInt RunScriptL(const TDesC& aScriptFile);
@@ -326,7 +311,6 @@
CImageEncoder* iEncoder;
CFrameImageData* iFrameImageData;
CBitmapScaler* iScaler;
- CAsyncCallBack iAsyncRunScript;
public:
--- a/creator/inc/creator_noteelement.h Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/inc/creator_noteelement.h Wed Oct 13 14:32:52 2010 +0300
@@ -32,7 +32,6 @@
public:
static CCreatorNoteElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
void ExecuteCommandL();
- void AsyncExecuteCommandL();
protected:
CCreatorNoteElement(CCreatorEngine* aEngine);
--- a/creator/inc/creator_scriptelement.h Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/inc/creator_scriptelement.h Wed Oct 13 14:32:52 2010 +0300
@@ -227,16 +227,12 @@
virtual void AddToCacheL();
virtual TBool IsCommandElement() const;
virtual void ExecuteCommandL();
-
- void AsyncExecuteCommand();
//virtual void SaveCommandResultsL();
//virtual void DiscardCommandResultsL();
virtual TBool IsRoot() const;
virtual RPointerArray<CCreatorModuleBaseParameters>& CommandParameters();
virtual const RPointerArray<CCreatorModuleBaseParameters>& CommandParameters() const;
- void AsyncExecuteCommandAndWaitL();
-
protected:
/**
@@ -290,11 +286,6 @@
*/
void IncreasePhoneNumL( const TDesC& aOriginal, TInt aDelta, HBufC* aIncreased ) const;
- static TInt ExecuteCommandCB( TAny *aPtr );
- virtual void AsyncExecuteCommandL();
- void StartNextLoop();
- void AsyncCommandFinished();
-
protected:
// Sub-element array
@@ -312,11 +303,6 @@
TBool iIsRoot;
CCreatorEngine* iEngine;
RPointerArray<CCreatorModuleBaseParameters> iParameters;
-
- CAsyncCallBack iAsyncCallback;
- CActiveSchedulerWait iWaiter;
- volatile TInt iAsyncOpError;
- TInt iLoopIndex;
};
/**
@@ -345,4 +331,19 @@
CCreatorCalendarElementBase(CCreatorEngine* aEngine);
};
+/**
+ * Message elements
+ */
+
+/**
+ * Base class for message elements
+ */
+class CCreatorMessageElementBase : public CCreatorScriptElement
+{
+public:
+ static CCreatorMessageElementBase* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC);
+protected:
+ CCreatorMessageElementBase(CCreatorEngine* aEngine);
+};
+
#endif /*CREATORSCRIPTELEMENT_H_*/
--- a/creator/rom/creator.iby Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/rom/creator.iby Wed Oct 13 14:32:52 2010 +0300
@@ -35,17 +35,12 @@
data=ZPRIVATE\20011383\3GPP-70kB.3gpp private\20011383\3GPP-70kB.3gpp
data=ZPRIVATE\20011383\AAC-100kB.aac private\20011383\AAC-100kB.aac
data=ZPRIVATE\20011383\AMR-20kB.amr private\20011383\AMR-20kB.amr
-data=ZPRIVATE\20011383\BMP-25kB.bmp private\20011383\BMP-25kB.bmp
data=ZPRIVATE\20011383\Deck-1kB.saveddeck private\20011383\Deck-1kB.saveddeck
data=ZPRIVATE\20011383\DOC-20kB.doc private\20011383\DOC-20kB.doc
-data=ZPRIVATE\20011383\GIF-2kB.gif private\20011383\GIF-2kB.gif
data=ZPRIVATE\20011383\HTML-20kB.html private\20011383\HTML-20kB.html
data=ZPRIVATE\20011383\JAD-1kB.jad private\20011383\JAD-1kB.jad
data=ZPRIVATE\20011383\JAR-10kB.jar private\20011383\JAR-10kB.jar
data=ZPRIVATE\20011383\JP2-65kB.jp2 private\20011383\JP2-65kB.jp2
-data=ZPRIVATE\20011383\JPEG-200kB.jpg private\20011383\JPEG-200kB.jpg
-data=ZPRIVATE\20011383\JPEG-25kB.jpg private\20011383\JPEG-25kB.jpg
-data=ZPRIVATE\20011383\JPEG-500kB.jpg private\20011383\JPEG-500kB.jpg
data=ZPRIVATE\20011383\MIDI-10kB.mid private\20011383\MIDI-10kB.mid
data=ZPRIVATE\20011383\MP3-250kB.mp3 private\20011383\MP3-250kB.mp3
data=ZPRIVATE\20011383\MP4-200kB.mp4 private\20011383\MP4-200kB.mp4
@@ -58,8 +53,6 @@
data=ZPRIVATE\20011383\SVG-15kB.svg private\20011383\SVG-15kB.svg
data=ZPRIVATE\20011383\SWF-15kB.swf private\20011383\SWF-15kB.swf
data=ZPRIVATE\20011383\TIF-25kB.tif private\20011383\TIF-25kB.tif
-data=ZPRIVATE\20011383\TXT-10kB.txt private\20011383\TXT-10kB.txt
-data=ZPRIVATE\20011383\TXT-70kB.txt private\20011383\TXT-70kB.txt
data=ZPRIVATE\20011383\VCF-1kB.vcf private\20011383\VCF-1kB.vcf
data=ZPRIVATE\20011383\VCS-1kB.vcs private\20011383\VCS-1kB.vcs
data=ZPRIVATE\20011383\WAV-20kB.wav private\20011383\WAV-20kB.wav
--- a/creator/sis/Creator_stub.pkg Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/sis/Creator_stub.pkg Wed Oct 13 14:32:52 2010 +0300
@@ -68,5 +68,3 @@
""-"z:\private\20011383\WAV-20kB.wav"
""-"z:\private\20011383\XLS-15kB.xls"
""-"z:\private\20011383\SISX-10kB.sisx"
-""-"z:\private\20011383\WMA-50kB.wma"
-""-"z:\private\20011383\WMV-200kB.wmv"
--- a/creator/src/creator_appui.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_appui.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -146,7 +146,7 @@
// run script
case ECmdCreateFromFile:
{
- iEngine->AsyncRunScript();
+ iEngine->RunScriptL();
}
break;
--- a/creator/src/creator_browserelement.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_browserelement.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -44,140 +44,6 @@
iIsCommandElement = ETrue;
}
-void CCreatorBrowserElement::AsyncExecuteCommandL()
- {
- const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
- TInt entryAmount = 1;
- if( amountAttr )
- {
- entryAmount = ConvertStrToIntL(amountAttr->Value());
- }
- // Get 'fields' element
- CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
- if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
- {
- // Get sub-elements
- const RPointerArray<CCreatorScriptElement>& fields = fieldsElement->SubElements();
- // Create browser entries, the amount of entries is defined by entryAmount:
- if( iLoopIndex < entryAmount )
- {
- CBrowserParameters* param = new (ELeave) CBrowserParameters;
- CleanupStack::PushL(param);
-
- for( TInt i = 0; i < fields.Count(); ++i )
- {
- CCreatorScriptElement* field = fields[i];
- TPtrC elemName = field->Name();
- TPtrC elemContent = field->Content();
- const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength);
- if( elemName == KName )
- {
- if( randomAttr || elemContent.Length() == 0)
- {
- elemContent.Set(iEngine->RandomString(CCreatorEngine::ECompany));
- }
- if( iName->Des() == KBookmark )
- {
- SetContentToTextParamL(param->iBookmarkName, elemContent);
- }
- else if( iName->Des() == KBookmarkFolder )
- {
- SetContentToTextParamL(param->iBookmarkFolderName, elemContent);
- }
- else if( iName->Des() == KSavedPage )
- {
- SetContentToTextParamL(param->iSavedDeckLinkName, elemContent);
- }
- else if( iName->Des() == KSavedPageFolder )
- {
- SetContentToTextParamL(param->iSavedDeckFolderName, elemContent);
- }
- }
-
- else if( elemName == KPath )
- {
- if( randomAttr || elemContent.Length() == 0)
- {
- SetContentToTextParamL(param->iSavedDeckLocalAddress, iEngine->TestDataPathL(CCreatorEngine::ESavedDeck_1kB));
- }
- else
- {
- SetContentToTextParamL(param->iSavedDeckLocalAddress, elemContent);
- }
- }
- else if( elemName == KUsername )
- {
- if( randomAttr || elemContent.Length() == 0)
- {
- // Set username and password to same string
- if( param->iBookmarkPassword && param->iBookmarkPassword->Length() > 0 )
- {
- SetContentToTextParamL(param->iBookmarkUsername, param->iBookmarkPassword->Des());
- }
- else
- {
- SetContentToTextParamL(param->iBookmarkUsername, iEngine->RandomString(CCreatorEngine::EFirstName));
- }
- }
- else
- {
- SetContentToTextParamL(param->iBookmarkUsername, elemContent);
- }
- }
- else if( elemName == KPassword )
- {
- if( randomAttr || elemContent.Length() == 0)
- {
- // Set username and password to same string
- if( param->iBookmarkUsername && param->iBookmarkUsername->Length() > 0 )
- {
- SetContentToTextParamL(param->iBookmarkPassword, param->iBookmarkUsername->Des());
- }
- else
- {
- SetContentToTextParamL(param->iBookmarkPassword, iEngine->RandomString(CCreatorEngine::EFirstName));
- }
- }
- else
- {
- SetContentToTextParamL(param->iBookmarkPassword, elemContent);
- }
- }
- else if( elemName == KUrl )
- {
- if( randomAttr || elemContent.Length() == 0)
- {
- TDesC* tmpUrl = iEngine->CreateHTTPUrlLC();
- if( tmpUrl )
- {
- SetContentToTextParamL(param->iBookmarkAddress, *tmpUrl );
- }
- CleanupStack::PopAndDestroy(); // tmpUrl
- }
- else
- {
- SetContentToTextParamL(param->iBookmarkAddress, elemContent);
- }
- }
- }
- iEngine->AppendToCommandArrayL(GetBrowserCommandL(), param);
- CleanupStack::Pop(); // param
- StartNextLoop();
- }
- else
- {
- // stop loop and signal end of the executing command
- AsyncCommandFinished();
- }
- }
- else
- {
- // No fields defined --> Add all fields with random values:
- iEngine->AppendToCommandArrayL(GetBrowserCommandL(), 0, entryAmount);
- // signal end of the executing command
- AsyncCommandFinished();
- }
- }
/*
*
@@ -193,14 +59,24 @@
}
// Get 'fields' element
CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
- if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
+ if( fieldsElement )
{
// Get sub-elements
const RPointerArray<CCreatorScriptElement>& fields = fieldsElement->SubElements();
// Create browser entries, the amount of entries is defined by entryAmount:
for( TInt cI = 0; cI < entryAmount; ++cI )
{
- CBrowserParameters* param = new (ELeave) CBrowserParameters;
+ CBrowserParameters* param = 0;
+
+ if( fields.Count() > 0 )
+ param = new (ELeave) CBrowserParameters;
+ else
+ {
+ // No fields defined --> Add all fields with random values:
+ addAll = ETrue;
+ break;
+ }
+
CleanupStack::PushL(param);
for( TInt i = 0; i < fields.Count(); ++i )
@@ -305,7 +181,6 @@
}
else
{
- // No fields defined --> Add all fields with random values:
addAll = ETrue;
}
--- a/creator/src/creator_calendarelement.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_calendarelement.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -488,125 +488,6 @@
}
}
-void CCreatorCalendarElement::AsyncExecuteCommandL()
- {
- LOGSTRING("Creator: CCreatorCalendarElement::AsyncExecuteCommandL");
- // Amount of calendar entries:
- const CCreatorScriptAttribute* calEntryAmountAttr = this->FindAttributeByName(KAmount);
- const CCreatorScriptAttribute* calEntryTypeAttr = this->FindAttributeByName(KType);
- TInt entryAmount = 1;
- if( calEntryAmountAttr )
- {
- entryAmount = ConvertStrToIntL(calEntryAmountAttr->Value());
- }
- if( calEntryTypeAttr == 0 )
- {
- LOGSTRING("ERROR in CCreatorCalendarElement::AsyncExecuteCommandL: Type attribute is missing.");
- User::Leave(KErrGeneral); // type is required attribute
- }
-
- // Find fields element:
- CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
-
- if( iLoopIndex < entryAmount )
- {
- CCalenderInterimParameters* param = new (ELeave) CCalenderInterimParameters;
- CleanupStack::PushL(param);
- if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeAppointment) == 0 )
- {
- if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
- {
- FillEntryParamsL(EAppointment, fieldsElement->SubElements(), param);
- iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAppointments, param);
- }
- else
- {
- iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAppointments, 0, entryAmount);
- CleanupStack::PopAndDestroy(param);
- // We can step out from the for-loop, because the amount is given to engine.
- // stop loop and signal end of the executing command
- AsyncCommandFinished();
- return;
- }
- }
- else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeEvent ) == 0 )
- {
- if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
- {
- FillEntryParamsL(EEvent, fieldsElement->SubElements(), param);
- iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryEvents, param);
- }
- else
- {
- iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryEvents, 0, entryAmount);
- CleanupStack::PopAndDestroy(param);
- // We can step out from the for-loop, because the amount is given to engine.
- // stop loop and signal end of the executing command
- AsyncCommandFinished();
- return;
- }
- }
- else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeReminder ) == 0 )
- {
- if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
- {
- FillEntryParamsL(EReminder, fieldsElement->SubElements(), param);
- iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryReminders, param);
- }
- else
- {
- iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryReminders, 0, entryAmount);
- CleanupStack::PopAndDestroy(param);
- // We can step out from the for-loop, because the amount is given to engine.
- // stop loop and signal end of the executing command
- AsyncCommandFinished();
- return;
- }
- }
- else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeAnniversary ) == 0 )
- {
- if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
- {
- FillEntryParamsL(EAnniversary, fieldsElement->SubElements(), param);
- iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAnniversaries, param);
- }
- else
- {
- iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAnniversaries, 0, entryAmount);
- CleanupStack::PopAndDestroy(param);
- // We can step out from the for-loop, because the amount is given to engine.
- // stop loop and signal end of the executing command
- AsyncCommandFinished();
- return;
- }
- }
- else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeTodo ) == 0 )
- {
- if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
- {
- FillEntryParamsL(ETodo, fieldsElement->SubElements(), param);
- iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryToDos, param);
- }
- else
- {
- iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryToDos, 0, entryAmount);
- CleanupStack::PopAndDestroy(param);
- // We can step out from the for-loop, because the amount is given to engine.
- // stop loop and signal end of the executing command
- AsyncCommandFinished();
- return;
- }
- }
- CleanupStack::Pop(); // param
- StartNextLoop();
- }
- else
- {
- // stop loop and signal end of the executing command
- AsyncCommandFinished();
- }
- }
-
void CCreatorCalendarElement::ExecuteCommandL()
{
LOGSTRING("Creator: CCreatorCalendarElement::ExecuteCommandL");
--- a/creator/src/creator_connectionmethodelement.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_connectionmethodelement.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -60,423 +60,6 @@
}
#if(!defined __SERIES60_30__ && !defined __SERIES60_31__)
-void CCreatorConnectionMethodElement::AsyncExecuteCommandL()
- {
- const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
- TInt cmAmount = 1;
- if( amountAttr )
- {
- cmAmount = ConvertStrToIntL(amountAttr->Value());
- }
- // Get 'fields' element
- CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
- if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
- {
- // Get sub-elements
- const RPointerArray<CCreatorScriptElement>& fields = fieldsElement->SubElements();
- // Create connection method entries, the amount of entries is defined by cmAmount:
- if( iLoopIndex < cmAmount )
- {
- CConnectionSettingsParameters* param = new (ELeave) CConnectionSettingsParameters;
- CleanupStack::PushL(param);
-
- for( TInt i = 0; i < fields.Count(); ++i )
- {
- CCreatorScriptElement* field = fields[i];
- TPtrC elemName = field->Name();
- TPtrC elemContent = field->Content();
- const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength);
- TBool useRandom = EFalse;
- if( randomAttr || elemContent.Length() == 0 )
- {
- useRandom = ETrue;
- }
-
- if( elemName == Kconnectionname )
- {
- if( useRandom )
- {
- param->SetRandomCMNameL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iConnectionName, elemContent);
- // reserve extra space for possible renaming
- TInt newLen = param->iConnectionName->Length() + KExtraSpace;
- param->iConnectionName = param->iConnectionName->ReAllocL(newLen);
- }
- }
- else if( elemName == Kstartpage )
- {
- if( useRandom )
- {
- param->SetRandomStartPageL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iStartPage, elemContent);
- }
- }
- else if( elemName == Kwapwspoption )
- {
- if( useRandom )
- {
- param->SetRandomWapWspOptionL(*iEngine);
- }
- else
- {
- if( CompareIgnoreCase(elemContent, Kconnectionless) == 0 )
- {
- param->iWapWspOption = ECmWapWspOptionConnectionless;
- }
- else if( CompareIgnoreCase(elemContent, Kconnectionoriented) == 0 )
- {
- param->iWapWspOption = ECmWapWspOptionConnectionOriented;
- }
- }
- }
- else if( elemName == Kprotocoltype )
- {
- if( useRandom )
- {
- param->SetRandomProtocolTypeL(*iEngine);
- }
- else
- {
- if( CompareIgnoreCase(elemContent, Kipv4) == 0 )
- {
- param->iProtocolType = RPacketContext::EPdpTypeIPv4;
- }
- else if( CompareIgnoreCase(elemContent, Kipv6) == 0 )
- {
- param->iProtocolType = RPacketContext::EPdpTypeIPv6;
- }
- }
- }
- else if( elemName == Kloginname )
- {
- if( useRandom )
- {
- param->SetRandomLoginNameL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iLoginName, elemContent);
- }
- }
- else if( elemName == Ksecureauthentication )
- {
- if( useRandom )
- {
- param->SetRandomSecureAuthenticationL(*iEngine);
- }
- else
- {
- param->iSecureAuthentication = ConvertStrToBooleanL(elemContent);
- }
- }
- else if( elemName == Kloginpass )
- {
- if( useRandom )
- {
- param->SetRandomLoginPassL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iLoginPass, elemContent);
- }
- }
- else if( elemName == Kpromptpassword )
- {
- if( useRandom )
- {
- param->SetRandomPromptPasswordL(*iEngine);
- }
- else
- {
- param->iPromptPassword = ConvertStrToBooleanL(elemContent);
- }
- }
- else if( elemName == Kgatewayaddress )
- {
- if( useRandom )
- {
- param->SetRandomGatewayAddressL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iGatewayAddress, elemContent);
- }
- }
- else if( elemName == Ksubnetmask )
- {
- if( useRandom )
- {
- param->SetRandomSubnetMaskL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iSubnetMask, elemContent);
- }
- }
- else if( elemName == Kdeviceipaddr )
- {
- if( useRandom )
- {
- param->SetRandomIPAddressL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iIPAddr, elemContent);
- }
- }
- else if( elemName == Kip4nameserver1 )
- {
- if( useRandom )
- {
- param->SetRandomIP4NameServer1L(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iIP4NameServer1, elemContent);
- }
- }
- else if( elemName == Kip4nameserver2 )
- {
- if( useRandom )
- {
- param->SetRandomIP4NameServer2L(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iIP4NameServer2, elemContent);
- }
- }
- else if( elemName == Kdatacalltelnumber )
- {
- if( useRandom )
- {
- param->SetRandomTelephoneNumberL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iDefaultTelNumber, elemContent);
- }
- }
- else if( elemName == Kdatacalltypeisdn )
- {
- if( useRandom )
- {
- param->SetRandomBearerTypeIsdnL(*iEngine);
- }
- else
- {
- if( CompareIgnoreCase(elemContent, Kanalogue) == 0 )
- param->iBearerCallTypeIsdn = CMManager::ECmCallTypeAnalogue;
- else if( CompareIgnoreCase( elemContent, Kisdnv110) == 0 )
- param->iBearerCallTypeIsdn = CMManager::ECmCallTypeISDNv110;
- else if( CompareIgnoreCase( elemContent, Kisdnv120) == 0 )
- param->iBearerCallTypeIsdn = CMManager::ECmCallTypeISDNv120;
- }
- }
- else if( elemName == Kbearertype )
- {
- if( useRandom )
- {
- param->iBearerType = KRandomBearerType;
- }
- else
- {
- if( CompareIgnoreCase(elemContent, Kwlan) == 0 )
- {
- param->iBearerType = KUidWlanBearerType;
- }
- else if( CompareIgnoreCase(elemContent, Kgprs) == 0 )
- {
- param->iBearerType = KUidPacketDataBearerType;
- }
- else if( CompareIgnoreCase(elemContent, Kdatacall) == 0 )
- {
- param->iBearerType = KUidCSDBearerType;
- }
- else if( CompareIgnoreCase(elemContent, Khsgsm) == 0 )
- {
- param->iBearerType = KUidHSCSDBearerType;
- }
- else if( CompareIgnoreCase(elemContent, Kembedded) == 0 )
- {
- param->iBearerType = KUidEmbeddedDestination;
- }
- else if( CompareIgnoreCase(elemContent, Kvpn) == 0 )
- {
- param->iBearerType = KPluginVPNBearerTypeUid;
- }
- else if( CompareIgnoreCase(elemContent, Klan) == 0 )
- {
- param->iBearerType = KUidLanBearerType;
- }
- }
- }
- else if( elemName == Kdatacalllinespeed )
- {
- if( useRandom )
- {
- param->SetRandomBearerSpeedL(*iEngine);
- }
- else
- {
- if( CompareIgnoreCase(elemContent, Kautomatic) == 0 )
- {
- param->iBearerSpeed = CMManager::ECmSpeedAutobaud;
- }
- else
- {
- TUint lineSpeed = ConvertStrToUintL(elemContent);
- if( lineSpeed == 9600 )
- param->iBearerSpeed = CMManager::ECmSpeed9600;
- else if( lineSpeed == 14400 )
- param->iBearerSpeed = CMManager::ECmSpeed14400;
- else if( lineSpeed == 19200 )
- param->iBearerSpeed = CMManager::ECmSpeed19200;
- else if( lineSpeed == 28800 )
- param->iBearerSpeed = CMManager::ECmSpeed28800;
- else if( lineSpeed == 38400 )
- param->iBearerSpeed = CMManager::ECmSpeed38400;
- else if( lineSpeed == 43200 )
- param->iBearerSpeed = CMManager::ECmSpeed43200;
- else if( lineSpeed == 56000 )
- param->iBearerSpeed = CMManager::ECmSpeed56000;
- }
- }
- }
- else if( elemName == Kuseproxy )
- {
- if( useRandom )
- {
- param->SetRandomUseProxyL(*iEngine);
- }
- else
- {
- param->iUseProxy = ConvertStrToBooleanL(elemContent);
- }
- }
- else if( elemName == Kproxyserveraddress )
- {
- if( useRandom )
- {
- param->SetRandomProxyAddressL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iProxyServerAddress, elemContent);
- }
- }
- else if( elemName == Kproxyportnumber )
- {
- if( useRandom )
- {
- param->SetRandomProxyPortL(*iEngine);
- }
- else
- {
- param->iProxyPortNumber = ConvertStrToUintL(elemContent);
- }
- }
- else if( elemName == Kip6nameserver1 )
- {
- if( useRandom )
- {
- param->SetRandomIPv6NameServer1L(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iIP6NameServer1, elemContent);
- }
- }
- else if( elemName == Kip6nameserver2 )
- {
- if( useRandom )
- {
- param->SetRandomIPv6NameServer2L(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iIP6NameServer2, elemContent);
- }
- }
- else if( elemName == Kdisabletextauth )
- {
- if( useRandom )
- {
- param->SetRandomDisableTextAuthL(*iEngine);
- }
- else
- {
- param->iDisableTextAuth = ConvertStrToBooleanL(elemContent);
- }
- }
- else if( elemName == Kwlanname )
- {
- if( useRandom )
- {
- param->SetRandomWLANNameL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iWLANName, elemContent);
- }
- }
- else if( elemName == Kwlanipaddr )
- {
- if( useRandom )
- {
- param->SetRandomWlanIpAddrL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iWlanIpAddr, elemContent);
- }
- }
- else if( elemName == Kwlansecmode )
- {
- if( useRandom )
- {
- param->SetRandomWLANSecurityModeL(*iEngine);
- }
- else
- {
- if( CompareIgnoreCase(elemContent, Kopen) == 0)
- param->iWLanSecMode = CMManager::EWlanSecModeOpen;
- else if( CompareIgnoreCase(elemContent, Kwep) == 0 )
- param->iWLanSecMode = CMManager::EWlanSecModeWep;
- else if( CompareIgnoreCase(elemContent, Ke802_1x) == 0 )
- param->iWLanSecMode = CMManager::EWlanSecMode802_1x;
- else if( CompareIgnoreCase(elemContent, Kwpa) == 0 )
- param->iWLanSecMode = CMManager::EWlanSecModeWpa;
- else if( CompareIgnoreCase(elemContent, Kwpa2) == 0 )
- param->iWLanSecMode = CMManager::EWlanSecModeWpa2;
- }
- }
- }
- iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryAccessPoints, param);
- CleanupStack::Pop(); // param
- StartNextLoop();
- }
- else
- {
- // stop loop and signal end of the executing command
- AsyncCommandFinished();
- }
- }
- else
- {
- // No fields defined so add random entries:
- iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryAccessPoints, 0, cmAmount);
- // signal end of the executing command
- AsyncCommandFinished();
- }
- }
-
void CCreatorConnectionMethodElement::ExecuteCommandL()
{
const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
--- a/creator/src/creator_contactelement.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_contactelement.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -171,173 +171,6 @@
}
#if(!defined __SERIES60_30__ && !defined __SERIES60_31__)
-void CCreatorContactElement::AsyncExecuteCommandL()
- {
- LOGSTRING("Creator: CCreatorContactElement::AsyncExecuteCommandL");
- // 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);
- if( iLoopIndex < contactAmount )
- {
- CVirtualPhonebookParameters* param = (CVirtualPhonebookParameters*) TCreatorFactory::CreatePhoneBookParametersL();
- CleanupStack::PushL(param);
- // Loop all the field elements
- if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
- {
-
- const RPointerArray<CCreatorScriptElement>& fieldList = fieldsElement->SubElements();
-
- if( fieldList.Count() == 0 )
- {
-
- }
- for( TInt i = 0; i < fieldList.Count(); ++i )
- {
- TPtrC fieldName = fieldList[i]->Name();
- 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() );
- }
- CCreatorContactField* field = 0;
- 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) )
- {
- if( rndLenAttr == 0 )
- {
- randomLenType = MCreatorRandomDataField::ERandomLengthDefault;
- }
- else
- {
- randomLenType = ResolveRandomDataTypeL(*rndLenAttr, rndLen);
- }
- }
- else
- {
- // Special handling for file id content:
- if( fieldName == KThumbnailId )
- {
- // Thumbnail data is copied to the contact entry, so we can use temporary file:
- CCreatorEngine::TTestDataPath id = (CCreatorEngine::TTestDataPath) iEngine->GetAttachmentIdL(content);
- content.Set(iEngine->TestDataPathL(id));
- }
- else if( fieldName == KRingToneId )
- {
- // Contact entry contains just a link to the sound file, so we must
- // copy the temporary file to a permanent location:
- CCreatorEngine::TTestDataPath id = (CCreatorEngine::TTestDataPath) iEngine->GetAttachmentIdL(content);
- TPtrC fullTargetPath(iEngine->CreateSoundFileL(id));
- content.Set(fullTargetPath);
- }
- }
- TInt amountValue = 1;
- if( amountAttr )
- {
- amountValue = ConvertStrToIntL(amountAttr->Value());
- }
- for( TInt k = 0; k < amountValue; ++k )
- {
- if ( increase &&
- ( fieldName.FindF( _L("number") ) > KErrNotFound ||
- fieldName.FindF( _L("phone") ) > KErrNotFound ) )
- {
- // increase phonenumber for each copy
- HBufC* incNum = HBufC::NewLC( content.Length() + 3 );
- if ( amountValue > 1 )
- {
- // amount defined in number field level
- IncreasePhoneNumL( content, k, incNum );
- }
- else
- {
- // amount defined in contact field level
- IncreasePhoneNumL( content, iLoopIndex, incNum );
- }
- field = CCreatorContactField::NewL( mapping.iFieldCode, *incNum );
- CleanupStack::PushL( field );
- field->SetRandomParametersL( randomLenType, rndLen );
- param->iContactFields.AppendL( field );
- CleanupStack::Pop( field );
- CleanupStack::PopAndDestroy( incNum );
- }
- else
- {
- field = CCreatorContactField::NewL(mapping.iFieldCode, content);
- CleanupStack::PushL(field);
- field->SetRandomParametersL(randomLenType, rndLen);
- 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 = 0;
- if(fieldMappingTbl[i].iDataType == EDataTypeText )
- {
- field = CCreatorContactField::NewL(fieldMappingTbl[i].iFieldCode, KNullDesC);
- }
- else if( fieldMappingTbl[i].iDataType == EDataTypeBinary )
- {
- field = CCreatorContactField::NewL(fieldMappingTbl[i].iFieldCode, KNullDesC8);
- }
- else if( fieldMappingTbl[i].iDataType == EDataTypeDateTime )
- {
- TDateTime dateTime(Time::NullTTime().DateTime());
- field = CCreatorContactField::NewL(fieldMappingTbl[i].iFieldCode, dateTime);
- }
- if( field )
- {
- CleanupStack::PushL(field);
- field->SetRandomParametersL(MCreatorRandomDataField::ERandomLengthDefault, 0);
- param->iContactFields.AppendL(field);
- CleanupStack::Pop(field);
- }
- }
- }
- iEngine->AppendToCommandArrayL(ECmdCreatePhoneBookEntryContacts, param);
- iParameters.AppendL(param); // Save the pointer to the parametes.
- CleanupStack::Pop(param);
- StartNextLoop();
- }
- else
- {
- // stop loop and signal end of the executing command
- AsyncCommandFinished();
- }
- }
-
void CCreatorContactElement::ExecuteCommandL()
{
LOGSTRING("Creator: CCreatorContactElement::ExecuteCommandL");
@@ -517,11 +350,6 @@
CCreatorContactElementBase(aEngine)
{ }
-void CCreatorContactSetElement::AsyncExecuteCommand()
- {
- AsyncCommandFinished();
- }
-
void CCreatorContactSetElement::ExecuteCommandL()
{ }
@@ -578,58 +406,6 @@
}
#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ )
-void CCreatorContactGroupElement::AsyncExecuteCommandL()
- {
- LOGSTRING("Creator: CCreatorContactGroupElement::AsyncExecuteCommandL");
- // 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());
- }
-
- if( iLoopIndex < groupAmount )
- {
- CCreatorScriptElement* membersElement = FindSubElement(KMembers);
-
- if( membersElement )
- {
- CVirtualPhonebookParameters* param = (CVirtualPhonebookParameters*) TCreatorFactory::CreatePhoneBookParametersL();
- CleanupStack::PushL(param);
-
- // Links to contact-sets:
- const RPointerArray<CCreatorScriptElement>& linkList = membersElement->SubElements();
- if( linkList.Count() > 0 )
- {
- for( TInt i = 0; i < linkList.Count(); ++i )
- {
- AppendContactSetReferenceL(*linkList[i], param->iLinkIds);
- }
- }
-
- if( groupNameAttr )
- {
- param->iGroupName->Des().Copy( groupNameAttr->Value() );
- }
- else
- {
- param->iGroupName->Des().Copy( iEngine->RandomString(CCreatorEngine::EGroupName) );
- }
- iEngine->AppendToCommandArrayL(ECmdCreatePhoneBookEntryGroups, param);
- CleanupStack::Pop(param);
- }
- StartNextLoop();
- }
- else
- {
- // stop loop and signal end of the executing command
- AsyncCommandFinished();
- }
- }
-
void CCreatorContactGroupElement::ExecuteCommandL()
{
LOGSTRING("Creator: CCreatorContactGroupElement::ExecuteCommandL");
--- a/creator/src/creator_fileelement.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_fileelement.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -62,97 +62,6 @@
/*
*
*/
-void CCreatorFileElement::AsyncExecuteCommandL()
- {
- const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
- TInt fileAmount = 1;
- if( amountAttr )
- {
- fileAmount = ConvertStrToIntL(amountAttr->Value());
- }
- // Get 'fields' element
- CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
- if( fieldsElement && fieldsElement->SubElements().Count() > 0)
- {
- // Get sub-elements
- const RPointerArray<CCreatorScriptElement>& fields = fieldsElement->SubElements();
- // Create files, the amount of files is defined by fileAmount:
- if( iLoopIndex < fileAmount )
- {
- CFilesParameters* param = new (ELeave) CFilesParameters;
- CleanupStack::PushL( param );
-
- for( TInt i = 0; i < fields.Count(); ++i )
- {
- CCreatorScriptElement* field = fields[i];
- TPtrC elemName = field->Name();
- TPtrC elemContent = field->Content();
-
- const CCreatorScriptAttribute* randomAttr = field->FindAttributeByName( KRandomLength );
-
- if( elemName == KType )
- {
- param->iFileCommand = GetFileCommandL(elemContent, randomAttr || elemContent.Length() == 0);
- }
- else if( elemName == KDirectory )
- {
- delete param->iFullFilePath;
- param->iFullFilePath = 0;
- if( randomAttr == 0 && elemContent.Length() > 0 )
- {
- param->iFullFilePath = elemContent.AllocL();
- }
- else
- {
- TFileName defaultPath;
- iEngine->SetDefaultPathForFileCommandL( param->iFileCommand, defaultPath );
- param->iFullFilePath = defaultPath.AllocL();
- }
- }
- else if ( elemName == KEncryption )
- {
- ParseDRMElementsL( field, param );
- }
- }
-
- if ( !param->iFileCommand )
- {
- param->iFileCommand = ECmdCreateFileEntryEmptyFolder;
- }
- iEngine->AppendToCommandArrayL( param->iFileCommand, param);
- CleanupStack::Pop( param );
- StartNextLoop();
- }
- else
- {
- AsyncCommandFinished();
- }
- }
- else
- {
- _LIT(KDummy, "");
- if( iLoopIndex < fileAmount )
- {
- CFilesParameters* param = new (ELeave) CFilesParameters;
- CleanupStack::PushL(param);
- delete param->iFullFilePath;
- param->iFullFilePath = 0;
- TFileName defaultPath;
- param->iFileCommand = GetFileCommandL(KDummy, ETrue);
- iEngine->SetDefaultPathForFileCommandL(param->iFileCommand, defaultPath);
- param->iFullFilePath = defaultPath.AllocL();
-
- iEngine->AppendToCommandArrayL(param->iFileCommand, param);
- CleanupStack::Pop(param);
- StartNextLoop();
- }
- else
- {
- AsyncCommandFinished();
- }
- }
- }
-
void CCreatorFileElement::ExecuteCommandL()
{
const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
--- a/creator/src/creator_impselement.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_impselement.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -45,110 +45,6 @@
iIsCommandElement = ETrue;
}
-void CCreatorImpsServerElement::AsyncExecuteCommandL()
- {
- const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
- TInt entryAmount = 1;
- if( amountAttr )
- {
- entryAmount = ConvertStrToIntL(amountAttr->Value());
- }
- // Get 'fields' element
- CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
- if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
- {
- // Get sub-elements
- const RPointerArray<CCreatorScriptElement>& fields = fieldsElement->SubElements();
- // Create note entries, the amount of entries is defined by entryAmount:
- if( iLoopIndex < entryAmount )
- {
- CIMPSParameters* param = new (ELeave) CIMPSParameters;
- CleanupStack::PushL(param);
-
- for( TInt i = 0; i < fields.Count(); ++i )
- {
- CCreatorScriptElement* field = fields[i];
- TPtrC elemName = field->Name();
- TPtrC elemContent = field->Content();
- const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength);
- TBool useRandom = EFalse;
- if( randomAttr || elemContent.Length() == 0 )
- {
- useRandom = ETrue;
- }
-
- if( elemName == KName )
- {
- if( useRandom )
- {
- param->SetRandomNameL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iServerName, elemContent);
- }
- }
- if( elemName == KUrl )
- {
- if( useRandom )
- {
- param->SetRandomUrlL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iServerURL, elemContent);
- }
- }
- if( elemName == KUsername )
- {
- if( useRandom )
- {
- param->SetRandomUsernameL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iServerUsername, elemContent);
- }
- }
- if( elemName == KPassword )
- {
- if( useRandom )
- {
- param->SetRandomPasswordL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iServerPassword, elemContent);
- }
- }
- if( elemName == KConnectionMethodName )
- {
- if( useRandom || CompareIgnoreCase(elemContent, creatorimps::KDefault) == 0 )
- {
- param->SetDefaultAccessPointL();
- }
- else
- {
- SetContentToTextParamL(param->iServerAccessPointName, elemContent);
- }
- }
- }
- iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryIMPSServers, param);
- CleanupStack::Pop(); // param
- StartNextLoop();
- }
- else
- {
- AsyncCommandFinished();
- }
- }
- else
- {
- iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryIMPSServers, 0, entryAmount);
- AsyncCommandFinished();
- }
- }
-
void CCreatorImpsServerElement::ExecuteCommandL()
{
const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
--- a/creator/src/creator_landmarkelement.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_landmarkelement.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -43,224 +43,6 @@
iIsCommandElement = ETrue;
}
-void CCreatorLandmarkElement::AsyncExecuteCommandL()
- {
- const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
- TInt lmAmount = 1;
- if( amountAttr )
- {
- lmAmount = ConvertStrToIntL(amountAttr->Value());
- }
- // Get 'fields' element
- CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
- if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
- {
- // Get sub-elements
- const RPointerArray<CCreatorScriptElement>& fields = fieldsElement->SubElements();
- // Create note entries, the amount of entries is defined by noteAmount:
- if( iLoopIndex < lmAmount )
- {
- CLandmarkParameters* param = new (ELeave) CLandmarkParameters;
- CleanupStack::PushL(param);
-
- for( TInt i = 0; i < fields.Count(); ++i )
- {
- CCreatorScriptElement* field = fields[i];
- TPtrC elemName = field->Name();
- TPtrC elemContent = field->Content();
- const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength);
- TBool useRandom = EFalse;
- if( randomAttr || elemContent.Length() == 0 )
- {
- useRandom = ETrue;
- }
-
- if( elemName == KName )
- {
- if( useRandom )
- {
- param->SetRandomNameL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iName, elemContent);
- }
- }
- else if( elemName == KCategory )
- {
- if( useRandom )
- {
- param->AddRandomCategoryL(*iEngine);
- }
- else
- {
- TPosLmItemId categoryId = CCreatorLandmarks::GetCategoryIdL(elemContent);
- if( categoryId > 0 )
- {
- param->iCategories.AppendL(categoryId);
- }
- }
- }
- else if( elemName == KDescription )
- {
- if( useRandom )
- {
- param->SetRandomDescriptionL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iDescription, elemContent);
- }
- }
- else if( elemName == KStreet )
- {
- if( useRandom )
- {
- param->SetRandomStreetL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iStreet, elemContent);
- }
- }
- else if( elemName == KPostalcode )
- {
- if( useRandom )
- {
- param->SetRandomPostCodeL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iPostCode, elemContent);
- }
- }
- else if( elemName == KCity )
- {
- if( useRandom )
- {
- param->SetRandomCityL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iCity, elemContent);
- }
- }
- else if( elemName == KState )
- {
- if( useRandom )
- {
- param->SetRandomStateL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iState, elemContent);
- }
- }
- else if( elemName == KCountry )
- {
- if( useRandom )
- {
- param->SetRandomCountryL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iCountry, elemContent);
- }
- }
- else if( elemName == KPhonenumber )
- {
- if( useRandom )
- {
- param->SetRandomPhoneNumberL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iPhonenumber, elemContent);
- }
- }
- else if( elemName == KUrl )
- {
- if( useRandom )
- {
- param->SetRandomUrlL(*iEngine);
- }
- else
- {
- SetContentToTextParamL(param->iUrl, elemContent);
- }
- }
- else if( elemName == KLatitude )
- {
- if( useRandom )
- {
- param->SetRandomLatitudeL(*iEngine);
- }
- else
- {
- ConvertStrToReal64L(elemContent, param->iLatitude);
- }
- }
- else if( elemName == KLongitude )
- {
- if( useRandom )
- {
- param->SetRandomLongitudeL(*iEngine);
- }
- else
- {
- ConvertStrToReal64L(elemContent, param->iLongitude);
- }
- }
- else if( elemName == KPositionaccuracy )
- {
- if( useRandom )
- {
- param->SetRandomPositionAccuracyL(*iEngine);
- }
- else
- {
- param->iPositionAccuracy = ConvertStrToIntL(elemContent);
- }
- }
- else if( elemName == KAltitude )
- {
- if( useRandom )
- {
- param->SetRandomAltitudeL(*iEngine);
- }
- else
- {
- ConvertStrToReal32L(elemContent, param->iAltitude);
- }
- }
- else if( elemName == KAltitudeaccuracy )
- {
- if( useRandom )
- {
- param->SetRandomAltitudeAccuracyL(*iEngine);
- }
- else
- {
- param->iAltitudeAccuracy = ConvertStrToIntL(elemContent);
- }
- }
- }
- iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryLandmarks, param);
- CleanupStack::Pop(); // param
- StartNextLoop();
- }
- else
- {
- AsyncCommandFinished();
- }
- }
- else
- {
- iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryLandmarks, 0, lmAmount);
- AsyncCommandFinished();
- }
- }
-
void CCreatorLandmarkElement::ExecuteCommandL()
{
const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
--- a/creator/src/creator_logelement.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_logelement.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -45,118 +45,6 @@
/*
*
*/
-
-void CCreatorLogElement::AsyncExecuteCommandL()
- {
- const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
- TInt logAmount = 1;
- if( amountAttr )
- {
- logAmount = ConvertStrToIntL(amountAttr->Value());
- }
- // Get 'fields' element
- CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
- if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
- {
- // Get sub-elements
- const RPointerArray<CCreatorScriptElement>& fields = fieldsElement->SubElements();
- // Create log entries, the amount of entries is defined by logAmount:
- if( iLoopIndex < logAmount )
- {
- TInt direction = -1;
- CLogsParameters* param = new (ELeave) CLogsParameters;
- CleanupStack::PushL(param);
-
- for( TInt i = 0; i < fields.Count(); ++i )
- {
- CCreatorScriptElement* field = fields[i];
- TPtrC elemName = field->Name();
- TPtrC elemContent = field->Content();
- const CCreatorScriptAttribute* randomAttr = field->FindAttributeByName(KRandomLength);
- const CCreatorScriptAttribute* increaseAttr = field->FindAttributeByName(KIncrease);
- TBool increase( EFalse );
- if ( increaseAttr )
- {
- increase = ConvertStrToBooleanL( increaseAttr->Value() );
- }
-
- if( elemName == KDirection )
- {
- direction = GetLogCommandL(elemContent, randomAttr || elemContent.Length() == 0);
- }
- else if( elemName == KDuration )
- {
- if( randomAttr || elemContent.Length() == 0 )
- {
- param->iDuration = iEngine->RandomNumber(7200);
- }
- else
- {
- param->iDuration = ConvertStrToIntL(elemContent);
- }
- }
- else if( elemName == KPhonenumber )
- {
- if( randomAttr || elemContent.Length() == 0 )
- {
- SetContentToTextParamL(param->iPhoneNumber, iEngine->RandomString(CCreatorEngine::EPhoneNumber));
- }
- else
- {
- if ( increase )
- {
- delete param->iPhoneNumber;
- param->iPhoneNumber = NULL;
- param->iPhoneNumber = HBufC::NewL( elemContent.Length() + 3 );
- IncreasePhoneNumL( elemContent, iLoopIndex, param->iPhoneNumber );
- }
- else
- {
- SetContentToTextParamL(param->iPhoneNumber, elemContent);
- }
- }
- }
- else if( elemName == KDatetime )
- {
- if( randomAttr || elemContent.Length() == 0 )
- {
- param->iEventTime = iEngine->RandomTime(iEngine->RandomDate(CCreatorEngine::EDatePast), CCreatorEngine::EDatePast);
- }
- else
- {
- param->iEventTime = ConvertToDateTimeL(elemContent);
- }
- }
- }
-
- if( direction == -1 )
- {
- direction = GetLogCommandL(KEmpty, ETrue);
- }
- iEngine->AppendToCommandArrayL(direction, param);
- CleanupStack::Pop(); // param
- StartNextLoop();
- }
- else
- {
- AsyncCommandFinished();
- }
- }
- else
- {
- if( iLoopIndex < logAmount )
- {
- iEngine->AppendToCommandArrayL(GetLogCommandL(KEmpty, ETrue), 0, 1);
- StartNextLoop();
- }
- else
- {
- AsyncCommandFinished();
- }
- }
- }
-
-
void CCreatorLogElement::ExecuteCommandL()
{
const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
--- a/creator/src/creator_mailboxelement.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_mailboxelement.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -433,74 +433,6 @@
return ETrue;
}
-void CCreatorMailboxElement::AsyncExecuteCommandL()
- {
- const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
- const CCreatorScriptAttribute* typeAttr = FindAttributeByName(KMailboxType);
- TInt amount = 1;
- if( amountAttr )
- {
- amount = ConvertStrToIntL(amountAttr->Value());
- }
-
- TMailboxType mailboxType = EMailboxPOP3;
-
- if( typeAttr && CompareIgnoreCase(typeAttr->Value(), Kimap4) == 0 )
- {
- mailboxType = EMailboxIMAP4;
- }
-
- // Get 'fields' element
- CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
- if( fieldsElement && fieldsElement->SubElements().Count() > 0)
- {
- // Get sub-elements
- const RPointerArray<CCreatorScriptElement>& fields = fieldsElement->SubElements();
- // Create mailbox entries, the amount of entries is defined by amount:
- if( iLoopIndex < amount )
- {
- CMailboxesParameters* param = new (ELeave) CMailboxesParameters;
- CleanupStack::PushL(param);
-
- param->iMailboxType = mailboxType;
-
- for( TInt i = 0; i < fields.Count(); ++i )
- {
- CCreatorScriptElement* field = fields[i];
- TPtrC elemName = field->Name();
- TPtrC elemContent = field->Content();
- const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength);
- TBool useRandom = EFalse;
- if( randomAttr || elemContent.Length() == 0 )
- {
- useRandom = ETrue;
- }
-
- if( SetTextParamL(elemName, elemContent, param, useRandom ) == EFalse &&
- SetBooleanParamL(elemName, elemContent, param, useRandom ) == EFalse &&
- SetIntegerParamL(elemName, elemContent, param, useRandom ) == EFalse &&
- SetEnumParamL(elemName, elemContent, param, useRandom ) )
- {
- LOGSTRING2("CCreatorMailboxElement::AsyncExecuteCommandL: Unknown mailbox field: %S", &elemName);
- }
- }
- iEngine->AppendToCommandArrayL(ECmdCreateMessagingEntryMailboxes, param);
- CleanupStack::Pop(); // param
- StartNextLoop();
- }
- else
- {
- AsyncCommandFinished();
- }
- }
- else
- {
- iEngine->AppendToCommandArrayL(ECmdCreateMessagingEntryMailboxes, 0, amount);
- AsyncCommandFinished();
- }
- }
-
-
void CCreatorMailboxElement::ExecuteCommandL()
{
const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
--- a/creator/src/creator_message.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_message.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -22,7 +22,6 @@
#include "creator_contactsetcache.h"
#include <apgcli.h>
#include <MuiuMsvUiServiceUtilities.h>
-#include <utf.h>
#if(!defined __SERIES60_30__ && !defined __SERIES60_31__)
#include <MVPbkFieldType.h>
@@ -791,8 +790,8 @@
waiter->StartAndWait();
CleanupStack::PopAndDestroy(waiter);
- HBufC8* tempBuf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( parameters.iMessageBodyText->Des() );
- CleanupStack::PushL(tempBuf);
+ HBufC8* tempBuf = HBufC8::NewLC( parameters.iMessageBodyText->Des().Length() );
+ tempBuf->Des().Copy( parameters.iMessageBodyText->Des() );
textFile.Write( tempBuf->Des() );
textFile.Close();
CleanupStack::PopAndDestroy(); //tempBuf
--- a/creator/src/creator_messageelement.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_messageelement.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -154,332 +154,6 @@
/*
*
*/
-void CCreatorMessageElement::AsyncExecuteCommandL()
- {
- LOGSTRING("Creator: CCreatorMessageElement::AsyncExecuteCommandL");
-
- // Find out the message type:
- const CCreatorScriptAttribute* msgTypeAttr = this->FindAttributeByName(KType);
- TPtrC msgType;
- if( msgTypeAttr )
- {
- msgType.Set(msgTypeAttr->Value());
- }
- else
- {
- LOGSTRING("ERROR in CCreatorMessageElement::AsyncExecuteCommandL: Type attribute is missing.");
- User::Leave(KErrGeneral); // type is required attribute
- }
-
- // Find out the amount of calendar entries:
- const CCreatorScriptAttribute* msgAmountAttr = this->FindAttributeByName(KAmount);
- TInt msgAmount = 1;
- if( msgAmountAttr )
- {
- msgAmount = ConvertStrToIntL(msgAmountAttr->Value());
- }
-
- // Get 'fields' element
- CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
- if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
- {
- // Get sub-elements (i.e the message field elements)
- const RPointerArray<CCreatorScriptElement>& fields = fieldsElement->SubElements();
-
- // Create message entries, the amount of entries is defined by msgAmount:
- if( iLoopIndex < msgAmount )
- {
- CMessagesParameters* param = new (ELeave) CMessagesParameters;
- CleanupStack::PushL(param);
-
- // Message type:
- if( msgTypeAttr )
- {
- SetMessageTypeL(*param, msgTypeAttr->Value());
- }
-
- // Loop all the message field elements:
- for( TInt i = 0; i < fields.Count(); ++i )
- {
- CCreatorScriptElement* field = fields[i];
- TPtrC elemName = field->Name();
- TPtrC elemContent = field->Content();
- const RPointerArray<CCreatorScriptElement>& contactReferences = field->SubElements();
- const CCreatorScriptAttribute* randomAttr = field->FindAttributeByName(KRandomLength);
- const CCreatorScriptAttribute* amountAttr = field->FindAttributeByName(KAmount);
- const CCreatorScriptAttribute* increaseAttr = field->FindAttributeByName(KIncrease);
- TBool increase( EFalse );
- if ( increaseAttr )
- {
- increase = ConvertStrToBooleanL( increaseAttr->Value() );
- }
- TInt fieldAmount = 1;
- if( amountAttr )
- {
- fieldAmount = ConvertStrToIntL(amountAttr->Value());
- }
-
- if( elemName == KTo )
- {
- // Recipient ('to'-field)
- for( TInt amountIndex = 0; amountIndex < fieldAmount; ++amountIndex )
- {
- if( (randomAttr || elemContent.Length() == 0 ) && contactReferences.Count() == 0 )
- {
- // Random content
- HBufC* toAddr = CreateMessageAddressLC(msgType);
- if( toAddr )
- {
- param->iRecipientAddressArray.AppendL(toAddr);
- CleanupStack::Pop(); // toAddr
- }
- }
- else
- {
- if( elemContent.Length() > 0 && contactReferences.Count() == 0)
- {
- // Explicit recipient given
- HBufC* recipient = HBufC::NewL( elemContent.Length() + 3 );
- CleanupStack::PushL(recipient);
- if ( increase )
- {
- IncreasePhoneNumL( elemContent, iLoopIndex, recipient );
- }
- else
- {
- recipient->Des().Copy(elemContent);
- }
- param->iRecipientAddressArray.AppendL(recipient);
- CleanupStack::Pop(); // recipient
- }
- else
- {
- // Recipients specified with contact-set-references (if any)
- for( TInt csI = 0; csI < contactReferences.Count(); ++csI )
- {
- CCreatorScriptElement* contactSetRef = contactReferences[csI];
- AppendContactSetReferenceL(*contactSetRef, param->iRecipientLinkIds);
- }
- }
- }
- }
- }
- else if( elemName == KFrom )
- {
- // Sender ('from'-field)
- // Amount attribute for sender is ignored, because there can be only one sender
- delete param->iSenderAddress;
- param->iSenderAddress = 0;
- if( (randomAttr || elemContent.Length() == 0 ) && contactReferences.Count() == 0 )
- {
- // Get random address
- param->iSenderAddress = CreateMessageAddressLC(msgType);
- CleanupStack::Pop(); // param->iSenderAddress
- }
- else
- {
- if( elemContent.Length() > 0 && contactReferences.Count() == 0)
- {
- // Explicit sender address given
- param->iSenderAddress = HBufC::NewL(elemContent.Length());
- if ( increase )
- {
- IncreasePhoneNumL( elemContent, iLoopIndex, param->iSenderAddress );
- }
- else
- {
- param->iSenderAddress->Des().Copy(elemContent);
- }
- }
- else
- {
- // Senders specified with contact-set-references (if any)
- for( TInt csI = 0; csI < contactReferences.Count(); ++csI )
- {
- CCreatorScriptElement* contactSetRef = contactReferences[csI];
- AppendContactSetReferenceL(*contactSetRef, param->iSenderLinkIds);
- }
- }
- }
- }
- else if( elemName == KFolder )
- {
- // Folder type
- if( CompareIgnoreCase(elemContent, KSent) == 0 )
- {
- param->iFolderType = ESent;
- }
- else if( CompareIgnoreCase(elemContent, KInbox) == 0 )
- {
- param->iFolderType = EInbox;
- }
- else if( CompareIgnoreCase(elemContent, KOutbox) == 0 )
- {
- param->iFolderType = EOutbox;
- }
- else if( CompareIgnoreCase(elemContent, KDraft) == 0 )
- {
- param->iFolderType = EDrafts;
- }
- }
- else if( elemName == KSubject )
- {
- // Message subject
- delete param->iMessageSubject;
- param->iMessageSubject = 0;
-
- if( randomAttr || elemContent.Length() == 0 )
- {
- // Random data should be used
- TPtrC temp = iEngine->RandomString(CCreatorEngine::EMessageSubject);
- param->iMessageSubject = HBufC::NewL(temp.Length());
- param->iMessageSubject->Des().Copy(temp);
- }
- else
- {
- param->iMessageSubject = HBufC::NewL(elemContent.Length());
- param->iMessageSubject->Des().Copy(elemContent);
- }
- }
- else if( elemName == KText )
- {
- // Body text
- delete param->iMessageBodyText;
- param->iMessageBodyText = 0;
-
- if( randomAttr || elemContent.Length() == 0 )
- {
- // Put random text:
- if( randomAttr && randomAttr->Value() != KDefault )
- {
- // Get the random length
- TInt len = GetRandomBodyLengthL(randomAttr->Value(), msgTypeAttr->Value());
- if( len != KUndef )
- {
- param->iMessageBodyText = iEngine->CreateRandomStringLC(len);
- CleanupStack::Pop(); // param->iMessageBodyText
- }
- }
- else
- {
- // Use default random data
- TPtrC temp = iEngine->RandomString(CCreatorEngine::EMessageText);
- param->iMessageBodyText = HBufC::NewL(temp.Length());
- param->iMessageBodyText->Des().Copy(temp);
- }
- }
- else
- {
- param->iMessageBodyText = HBufC::NewL(elemContent.Length());
- param->iMessageBodyText->Des().Copy(elemContent);
- }
- }
- else if( elemName == KAttachmentId )
- {
- // Attachment file id
- for( TInt amountIndex = 0; amountIndex < fieldAmount; ++amountIndex )
- {
- if( randomAttr || elemContent.Length() == 0)
- {
- //When type is AMS, attachement will be audio
- if(param->iMessageType == EAMS)
- {
- param->iAttachments->AppendL(CCreatorEngine::EMP3_250kB);
- }
- //Otherwise attachement can be any file
- else
- {
- //EJPEG_25kB is first (0) in the enum and LAST_FILE_ID is last in the enum, so real last item id is one before LAST_FILE_ID
- param->iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID-1) );
- }
- }
- else
- {
- //When user has been set attechment by it self, we trust user selection (not validating value, e.g. if message is SMS and there is attachement)
- TInt id = iEngine->GetAttachmentIdL(elemContent);
- if( id != KUndef )
- {
- param->iAttachments->AppendL( id );
- }
- }
- }
- }
- // Attachment file path handling
- //E.g. C:\data\others\DOC-20kB.doc
- else if( elemName == KAttachmentPath )
- {
- // Attachment file id
- for( TInt amountIndex = 0; amountIndex < fieldAmount; ++amountIndex )
- {
- //Path is random, getting one of the files (not even using path attribute, but id with random)
- if( randomAttr || elemContent.Length() == 0)
- {
- //EJPEG_25kB is first (0) in the enum and LAST_FILE_ID is last in the enum, so real last item id is one before LAST_FILE_ID
- param->iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID -1) );
- }
- //Otherwise adding attachement path as it is to paths.
- else
- {
- //Adding Attachement file path
- HBufC* elemData = elemContent.AllocLC();
- param->iAttachmentPaths.AppendL( elemData );
- CleanupStack::Pop(elemData);
- }
- }
- }
- else if ( elemName == KStatus )
- {
- if( CompareIgnoreCase( elemContent, KNew ) == 0 )
- {
- param->iCreateAsUnread = ETrue;
- }
- else if( CompareIgnoreCase( elemContent, KRead ) == 0 )
- {
- param->iCreateAsUnread = EFalse;
- }
- }
- }
- iEngine->AppendToCommandArrayL(ECmdCreateMessagingEntryMessagesViaScript, param);
- CleanupStack::Pop(); // param
- StartNextLoop();
- }
- else
- {
- AsyncCommandFinished();
- }
- }
- else
- {
- if( iLoopIndex < msgAmount )
- {
- TInt randMsg = 0;
- if( msgType == KSms )
- randMsg = iEngine->RandomNumber(ECmdCreateRandomEntrySMSInbox, ECmdCreateRandomEntrySMSSent);
- else if( msgType == KMms )
- randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryMMSInbox, ECmdCreateRandomEntryMMSSent);
- else if( msgType == KAms )
- randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryAMSInbox, ECmdCreateRandomEntryAMSSent);
- else if( msgType == KEmail )
- randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryEmailInbox, ECmdCreateRandomEntryEmailSent);
- else if( msgType == KSmart )
- randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryBIOInbox, ECmdCreateRandomEntryBIOSent);
- else if( msgType == KBt )
- randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryBTInbox, ECmdCreateRandomEntryBTSent);
- else if( msgType == KIr )
- randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryIRInbox, ECmdCreateRandomEntryIRSent);
-
- if( randMsg > 0 )
- {
- iEngine->AppendToCommandArrayL(randMsg, 0, 1);
- }
- StartNextLoop();
- }
- else
- {
- AsyncCommandFinished();
- }
- }
- }
void CCreatorMessageElement::ExecuteCommandL()
{
LOGSTRING("Creator: CCreatorMessageElement::ExecuteCommandL");
--- a/creator/src/creator_model.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_model.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -57,13 +57,10 @@
// ---------------------------------------------------------------------------
-CCreatorEngine::CCreatorEngine() :
- CActive(0),
- iAsyncRunScript( CActive::EPriorityStandard )
- {
- TCallBack asyncRunScriptCB( AsyncRunScriptCB, this );
- iAsyncRunScript.Set( asyncRunScriptCB );
- }
+CCreatorEngine::CCreatorEngine()
+:
+CActive(0)
+{}
// ---------------------------------------------------------------------------
@@ -699,25 +696,6 @@
iTimer.Cancel();
}
-// ----------------------------------------------------------------------------
-// CCreatorEngine::AsyncRunScript
-// CallBack for an asynchronous call of RunScriptL
-// ----------------------------------------------------------------------------
-//
-TInt CCreatorEngine::AsyncRunScriptCB( TAny* aObject )
- {
- TRAPD( err, static_cast<CCreatorEngine*>( aObject )->RunScriptL() );
- return err;
- }
-
-// ---------------------------------------------------------------------------
-
-void CCreatorEngine::AsyncRunScript()
- {
- LOGSTRING("Creator: CCreatorEngine::AsyncRunScript");
- iAsyncRunScript.CallBack();
- }
-
// ---------------------------------------------------------------------------
void CCreatorEngine::RunScriptL()
--- a/creator/src/creator_noteelement.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_noteelement.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -43,76 +43,6 @@
iIsCommandElement = ETrue;
}
-void CCreatorNoteElement::AsyncExecuteCommandL()
- {
- const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
- TInt noteAmount = 1;
- if( amountAttr )
- {
- noteAmount = ConvertStrToIntL(amountAttr->Value());
- }
- // Get 'fields' element
- CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
- if( fieldsElement && fieldsElement->SubElements().Count() > 0)
- {
- // Get sub-elements
- const RPointerArray<CCreatorScriptElement>& fields = fieldsElement->SubElements();
- // Create note entries, the amount of entries is defined by noteAmount:
- if( iLoopIndex < noteAmount )
- {
- CNotepadParameters* param = new (ELeave) CNotepadParameters;
- CleanupStack::PushL(param);
-
- for( TInt i = 0; i < fields.Count(); ++i )
- {
- CCreatorScriptElement* field = fields[i];
- TPtrC elemName = field->Name();
- TPtrC elemContent = field->Content();
- const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength);
- TBool useMax = EFalse;
- if( randomAttr && randomAttr->Value() == KMax )
- {
- useMax = ETrue;
- }
-
- if( elemName == KText )
- {
- if( randomAttr || elemContent.Length() == 0 )
- {
- if( useMax )
- {
- TDesC* temp = iEngine->CreateRandomStringLC(KNotepadFieldLength);
- SetContentToTextParamL(param->iNoteText, *temp);
- CleanupStack::PopAndDestroy(); // temp
- }
- else
- {
- SetContentToTextParamL(param->iNoteText, iEngine->RandomString(CCreatorEngine::EMessageText));
- }
- }
- else
- {
- SetContentToTextParamL(param->iNoteText, elemContent);
- }
- }
- }
- iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryNotes, param);
- CleanupStack::Pop(); // param
- StartNextLoop();
- }
- else
- {
- AsyncCommandFinished();
- }
- }
- else
- {
- iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryNotes, 0, noteAmount);
- // signal end of the executing command
- AsyncCommandFinished();
- }
- }
-
void CCreatorNoteElement::ExecuteCommandL()
{
const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount);
--- a/creator/src/creator_scriptelement.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_scriptelement.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -387,51 +387,6 @@
return iIsCommandElement;
}
-void CCreatorScriptElement::AsyncExecuteCommandAndWaitL()
- {
- iAsyncCallback.Cancel();
- iLoopIndex = 0;
- iAsyncOpError = KErrNone;
- // start async executing
- iAsyncCallback.CallBack();
- // wait until async executing is finished
- iWaiter.Start();
- User::LeaveIfError( iAsyncOpError );
- }
-
-TInt CCreatorScriptElement::ExecuteCommandCB( TAny* aPtr )
- {
- static_cast<CCreatorScriptElement*>( aPtr )->AsyncExecuteCommand();
- return KErrNone;
- }
-
-void CCreatorScriptElement::AsyncExecuteCommand()
- {
- TRAPD( err, AsyncExecuteCommandL() );
- if( err != KErrNone )
- {
- iAsyncOpError = err;
- iAsyncCallback.Cancel();
- iWaiter.AsyncStop();
- }
- }
-
-void CCreatorScriptElement::AsyncExecuteCommandL()
- {
- User::Panic(_L("CCreatorScriptElement::AsyncExecuteCommandL not written"), -1000);
- }
-
-void CCreatorScriptElement::StartNextLoop()
- {
- iLoopIndex++;
- iAsyncCallback.CallBack();
- }
-
-void CCreatorScriptElement::AsyncCommandFinished()
- {
- iWaiter.AsyncStop();
- }
-
void CCreatorScriptElement::ExecuteCommandL()
{
@@ -445,15 +400,12 @@
return EFalse;
}
-CCreatorScriptElement::CCreatorScriptElement(CCreatorEngine* aEngine) :
- iIsCommandElement(EFalse),
- iIsRoot(EFalse),
- iEngine(aEngine),
- iAsyncCallback( CActive::EPriorityLow )
- {
- TCallBack callback( ExecuteCommandCB, this);
- iAsyncCallback.Set( callback );
- }
+CCreatorScriptElement::CCreatorScriptElement(CCreatorEngine* aEngine)
+:
+iIsCommandElement(EFalse),
+iIsRoot(EFalse),
+iEngine(aEngine)
+ {}
void CCreatorScriptElement::ConstructL(const TDesC& aName, const TDesC& aContext)
{
@@ -741,3 +693,29 @@
iIsRoot=ETrue;
}
+
+CCreatorCalendarElementBase* CCreatorCalendarElementBase::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext)
+ {
+ CCreatorCalendarElementBase* self = new (ELeave) CCreatorCalendarElementBase(aEngine);
+ CleanupStack::PushL(self);
+ self->ConstructL(aName, aContext);
+ CleanupStack::Pop();
+ return self;
+ }
+CCreatorCalendarElementBase::CCreatorCalendarElementBase(CCreatorEngine* aEngine)
+:
+CCreatorScriptElement(aEngine)
+ { }
+
+CCreatorMessageElementBase* CCreatorMessageElementBase::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext)
+ {
+ CCreatorMessageElementBase* self = new (ELeave) CCreatorMessageElementBase(aEngine);
+ CleanupStack::PushL(self);
+ self->ConstructL(aName, aContext);
+ CleanupStack::Pop();
+ return self;
+ }
+CCreatorMessageElementBase::CCreatorMessageElementBase(CCreatorEngine* aEngine)
+:
+CCreatorScriptElement(aEngine)
+ { }
--- a/creator/src/creator_scriptparser.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/creator/src/creator_scriptparser.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -316,11 +316,7 @@
// Execute the command if this is a command element:
if( elementInfo.iElement->IsCommandElement() )
{
- #if(!defined __SERIES60_30__ && !defined __SERIES60_31__)
- elementInfo.iElement->AsyncExecuteCommandAndWaitL();
- #else
elementInfo.iElement->ExecuteCommandL();
- #endif
}
// Remove element from the stack:
--- a/group/bld.inf Wed Sep 15 12:13:45 2010 +0300
+++ b/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -25,5 +25,7 @@
#include "../loadgen/group/bld.inf"
#include "../perfmon/group/bld.inf"
#include "../screengrabber/group/bld.inf"
+#include "../stifui/avkon/group/bld.inf"
#include "../memspyui/group/bld.inf"
+#include "../htiui/group/bld.inf"
#include "../piprofilerui/group/bld.inf"
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/data/HtiAdmin.rss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,317 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource definitions for HtiAdmin
+*
+*/
+
+NAME HTIA
+
+// INCLUDES
+#include <eikon.rh>
+#include <eikon.rsg>
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <appinfo.rh>
+#include <data_caging_paths_strings.hrh>
+#include "HtiAdmin.hrh"
+
+
+// RESOURCE DEFINITIONS
+
+// ---------------------------------------------------------
+//
+// Define the resource file signature
+// This resource should be empty.
+//
+// ---------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE { }
+
+// ---------------------------------------------------------
+//
+// Default Document Name
+//
+// ---------------------------------------------------------
+//
+RESOURCE TBUF r_default_document_name { buf=""; }
+
+// ---------------------------------------------------------
+//
+// Define default menu and CBA key.
+//
+// ---------------------------------------------------------
+//
+RESOURCE EIK_APP_INFO
+ {
+ menubar = r_htiadmin_menubar;
+ cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
+ }
+
+
+// ---------------------------------------------------------
+//
+// r_htiadmin_menubar
+// Menubar for HtiAdmin example
+//
+// ---------------------------------------------------------
+//
+RESOURCE MENU_BAR r_htiadmin_menubar
+ {
+ titles =
+ {
+ MENU_TITLE {menu_pane = r_htiadmin_menu;}
+ };
+ }
+
+
+// ---------------------------------------------------------
+//
+// Options menu items
+//
+//
+// ---------------------------------------------------------
+
+RESOURCE MENU_PANE r_htiadmin_submenu_logs
+ {
+ items =
+ {
+ MENU_ITEM {command = EHtiAdminCreateLogFolder; txt = "Create c:\\logs\\hti";},
+ MENU_ITEM {command = EHtiAdminRemoveLogFolder; txt = "Remove c:\\logs\\hti";},
+ MENU_ITEM {command = EHtiAdminClearLogs; txt = "Clear";}
+ };
+ }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_priority
+ {
+ items =
+ {
+ MENU_ITEM {command = EHtiAdminPriorityBackground; flags = EEikMenuItemCheckBox; txt="Background"; },
+ MENU_ITEM {command = EHtiAdminPriorityForeground; flags = EEikMenuItemCheckBox; txt="Foreground"; },
+ MENU_ITEM {command = EHtiAdminPriorityHigh; flags = EEikMenuItemCheckBox; txt="High"; },
+ MENU_ITEM {command = EHtiAdminPriorityAbsoluteHigh; flags = EEikMenuItemCheckBox; txt="AbsoluteHigh"; }
+ };
+ }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_watchdog
+ {
+ items =
+ {
+ MENU_ITEM {command = EHtiAdminWatchDogEnable; flags = EEikMenuItemCheckBox; txt="Enable"; },
+ MENU_ITEM {command = EHtiAdminWatchDogDisable; flags = EEikMenuItemCheckBox; txt="Disable"; }
+ };
+ }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_console
+ {
+ items =
+ {
+ MENU_ITEM {command = EHtiAdminConsoleEnable; flags = EEikMenuItemCheckBox; txt="Enable"; },
+ MENU_ITEM {command = EHtiAdminConsoleDisable; flags = EEikMenuItemCheckBox; txt="Disable"; }
+ };
+ }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_error_dialogs
+ {
+ items =
+ {
+ MENU_ITEM {command = EHtiAdminErrorDialogsEnable; flags = EEikMenuItemCheckBox; txt="Enable"; },
+ MENU_ITEM {command = EHtiAdminErrorDialogsDisable; flags = EEikMenuItemCheckBox; txt="Disable"; }
+ };
+ }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_autostart
+ {
+ items =
+ {
+ MENU_ITEM {command = EHtiAdminAutoStartEnable; flags = EEikMenuItemCheckBox; txt="Enable"; },
+ MENU_ITEM {command = EHtiAdminAutoStartDisable; flags = EEikMenuItemCheckBox; txt="Disable"; }
+ };
+ }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_set_param
+ {
+ items =
+ {
+ MENU_ITEM {command = EHtiAdminHtiCfg; txt = "Hti.cfg";},
+ MENU_ITEM {command = EHtiAdminHtiBtCommCfg; txt = "HtiBtComm.cfg";},
+ MENU_ITEM {command = EHtiAdminHtiSerialCommCfg; txt = "HtiSerialComm.cfg";},
+ MENU_ITEM {command = EHtiAdminHtiIPCommCfg; txt = "HtiIPComm.cfg";}
+ };
+ }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_options
+ {
+ items =
+ {
+ MENU_ITEM {command = EHtiAdminSubComms; txt = "Comms";},
+ MENU_ITEM {command = EHtiAdminSubAutoStart; cascade = r_htiadmin_submenu_autostart; txt = "AutoStart";},
+ MENU_ITEM {command = EHtiAdminSubLogs; cascade = r_htiadmin_submenu_logs; txt = "Logs";},
+ MENU_ITEM {command = EHtiAdminSubPriority; cascade = r_htiadmin_submenu_priority; txt = "Priority";},
+ MENU_ITEM {command = EHtiAdminSubWatchDog; cascade = r_htiadmin_submenu_watchdog; txt = "Watchdog";},
+ MENU_ITEM {command = EHtiAdminSubConsole; cascade = r_htiadmin_submenu_console; txt = "Console";},
+ MENU_ITEM {command = EHtiAdminSubErrorDialogs; cascade = r_htiadmin_submenu_error_dialogs; txt = "Error dialogs";},
+ MENU_ITEM {command = EHtiAdminSubSetParam; cascade = r_htiadmin_submenu_set_param; txt = "Set parameter";}
+ };
+ }
+
+// ---------------------------------------------------------
+//
+// r_htiadmin_menu
+// Menu for "Options"
+//
+// ---------------------------------------------------------
+//
+RESOURCE MENU_PANE r_htiadmin_menu
+ {
+ items =
+ {
+ MENU_ITEM {command = EHtiAdminStart; txt = "Start";},
+ MENU_ITEM {command = EHtiAdminStop; txt = "Stop";},
+ MENU_ITEM {command = EHtiAdminSubOptions; cascade = r_htiadmin_submenu_options; txt = "Options";},
+ MENU_ITEM {command = EHtiAdminAbout; txt = "About";},
+ MENU_ITEM {command = EAknSoftkeyExit; txt = "Exit";}
+ };
+ }
+
+
+RESOURCE DIALOG r_numeric_query
+ {
+ flags = EGeneralQueryFlags;
+ buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+ items =
+ {
+ DLG_LINE
+ {
+ type = EAknCtQuery;
+ id = EGeneralQuery;
+ control = AVKON_DATA_QUERY
+ {
+ layout = EDataLayout;
+ control = EDWIN
+ {
+ flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+ default_input_mode = EAknEditorNumericInputMode;
+ };
+ };
+ }
+ };
+ }
+
+RESOURCE DIALOG r_text_query
+ {
+ flags = EGeneralQueryFlags;
+ buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+ items =
+ {
+ DLG_LINE
+ {
+ type = EAknCtQuery;
+ id = EGeneralQuery;
+ control = AVKON_DATA_QUERY
+ {
+ layout = EDataLayout;
+ control = EDWIN
+ {
+ flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+ default_input_mode = EAknEditorTextInputMode;
+ };
+ };
+ }
+ };
+ }
+
+RESOURCE AVKON_LIST_QUERY r_query_dialog
+{
+ flags = EGeneralQueryFlags;
+ softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
+ items =
+ {
+ AVKON_LIST_QUERY_DLG_LINE
+ {
+ control = AVKON_LIST_QUERY_CONTROL
+ {
+ listtype = EAknCtSinglePopupMenuListBox;
+ listbox = AVKON_LIST_QUERY_LIST
+ {
+ };
+ heading = "Select Option";
+ };
+ }
+ };
+}
+
+RESOURCE AVKON_LIST_QUERY r_select_iap_dialog
+{
+ flags = EGeneralQueryFlags;
+ softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
+ items =
+ {
+ AVKON_LIST_QUERY_DLG_LINE
+ {
+ control = AVKON_LIST_QUERY_CONTROL
+ {
+ listtype = EAknCtSinglePopupMenuListBox;
+ listbox = AVKON_LIST_QUERY_LIST
+ {
+ };
+ heading = "Select IAP";
+ };
+ }
+ };
+}
+
+// ---------------------------------------------------------
+//
+// r_htiadmin_about_dialog
+// About dialog
+//
+// ---------------------------------------------------------
+//
+RESOURCE DIALOG r_htiadmin_about_dialog
+ {
+ flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow;
+ buttons = R_AVKON_SOFTKEYS_OK_EMPTY;
+ items=
+ {
+ DLG_LINE
+ {
+ type = EAknCtPopupHeadingPane;
+ id = EAknMessageQueryHeaderId;
+ control = AVKON_HEADING
+ {
+ label = "About HTI Admin";
+ headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE;
+ };
+ },
+ DLG_LINE
+ {
+ type = EAknCtMessageQuery;
+ id = EAknMessageQueryContentId;
+ control = AVKON_MESSAGE_QUERY
+ {
+ };
+ }
+ };
+ }
+
+// ---------------------------------------------------------
+//
+// r_htiadmin_about_text
+// Text for the About dialog
+//
+// ---------------------------------------------------------
+//
+RESOURCE TBUF r_htiadmin_about_text { buf="Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved."; }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/data/HtiAdmin_reg.rss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: App registration resource definitions for HtiAdmin
+*
+*/
+
+
+// INCLUDES
+#include <appinfo.rh>
+#include <data_caging_paths_strings.hrh>
+
+// RESOURCE DEFINITIONS
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0x1020DEB5 // application UID
+
+RESOURCE APP_REGISTRATION_INFO
+ {
+ app_file = "HtiAdmin";
+ group_name = "RnD Tools";
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/group/HtiAdmin.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Project file for HtiAdmin
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET HtiAdmin.exe
+TARGETTYPE EXE
+
+UID 0x100039CE 0x1020DEB5
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
+
+EPOCSTACKSIZE 0x5000
+
+TARGETPATH PROGRAMS_DIR
+
+LANG SC
+
+USERINCLUDE ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH ../src
+SOURCE HtiAdmin.cpp
+SOURCE HtiAdminApplication.cpp
+SOURCE HtiAdminAppView.cpp
+SOURCE HtiAdminAppUi.cpp
+SOURCE HtiAdminDocument.cpp
+
+SOURCEPATH ../data
+
+START RESOURCE HtiAdmin.rss
+HEADER
+TARGETPATH APP_RESOURCE_DIR
+LANG SC
+END
+
+START RESOURCE HtiAdmin_reg.rss
+HEADER
+TARGETPATH /private/10003a3f/apps
+END
+
+LIBRARY apparc.lib
+LIBRARY avkon.lib
+LIBRARY cone.lib
+LIBRARY ecom.lib
+LIBRARY eikcoctl.lib
+LIBRARY eikcore.lib
+LIBRARY euser.lib
+LIBRARY gdi.lib
+LIBRARY hticfg.lib
+LIBRARY ws32.lib
+LIBRARY flogger.lib
+LIBRARY bafl.lib
+LIBRARY commdb.lib
+
+SMPSAFE
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: UI application to start/stop HtiFramework.exe
+*
+*/
+
+
+PRJ_MMPFILES
+
+HtiAdmin.mmp
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/inc/HtiAdmin.hrh Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Command ids
+*
+*/
+
+#ifndef __HTIADMIN_HRH__
+#define __HTIADMIN_HRH__
+
+/* HtiAdmin enumerate command codes */
+enum THtiAdminIds
+ {
+ EHtiAdminStart = 1,
+ EHtiAdminStop,
+ EHtiAdminAbout,
+ EHtiAdminSubOptions,
+
+ EHtiAdminSubComms,
+
+ EHtiAdminSubAutoStart,
+ EHtiAdminAutoStartEnable,
+ EHtiAdminAutoStartDisable,
+
+ EHtiAdminSubLogs,
+ EHtiAdminCreateLogFolder,
+ EHtiAdminRemoveLogFolder,
+ EHtiAdminClearLogs,
+
+ EHtiAdminSubPriority,
+ EHtiAdminPriorityBackground,
+ EHtiAdminPriorityForeground,
+ EHtiAdminPriorityHigh,
+ EHtiAdminPriorityAbsoluteHigh,
+
+ EHtiAdminSubWatchDog,
+ EHtiAdminWatchDogEnable,
+ EHtiAdminWatchDogDisable,
+
+ EHtiAdminSubConsole,
+ EHtiAdminConsoleEnable,
+ EHtiAdminConsoleDisable,
+
+ EHtiAdminSubErrorDialogs,
+ EHtiAdminErrorDialogsEnable,
+ EHtiAdminErrorDialogsDisable,
+
+ EHtiAdminSubSetParam,
+ EHtiAdminHtiCfg,
+ EHtiAdminHtiBtCommCfg,
+ EHtiAdminHtiSerialCommCfg,
+ EHtiAdminHtiIPCommCfg
+ };
+
+
+#endif // __HTIADMIN_HRH__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/inc/HtiAdmin.pan Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Panics definitions for HtiAdmin
+*
+*/
+
+
+#ifndef __HTIADMIN_PAN__
+#define __HTIADMIN_PAN__
+
+/** HtiAdmin application panic codes */
+enum THtiAdminPanics
+ {
+ EHtiAdminBasicUi = 1
+ // add further panics here
+ };
+
+inline void Panic(THtiAdminPanics aReason)
+ {
+ _LIT(applicationName,"HtiAdmin");
+ User::Panic(applicationName, aReason);
+ }
+
+#endif // __HTIADMIN_PAN__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/inc/HtiAdminAppUi.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AppUi class
+*
+*/
+
+
+#ifndef __HTIADMIN_APPUI_H__
+#define __HTIADMIN_APPUI_H__
+
+// INCLUDES
+#include <aknappui.h>
+
+// FORWARD DECLARATIONS
+class CHtiAdminAppView;
+class CHtiCfg;
+
+// CLASS DECLARATION
+
+/**
+* An instance of class CHtiAdminAppUi is the UserInterface part of the AVKON
+* application framework for the HtiAdmin application
+*/
+class CHtiAdminAppUi : public CAknAppUi
+ {
+ public:
+ /**
+ * Perform the second phase construction of a CHtiAdminAppUi object.
+ * This needs to be public due to the way the framework constructs the AppUi
+ */
+ void ConstructL();
+
+ /**
+ * Perform the first phase of two phase construction.
+ * This needs to be public due to the way the framework constructs the AppUi
+ */
+ CHtiAdminAppUi();
+
+
+ /**
+ * Destroy the object and release all memory objects.
+ */
+ ~CHtiAdminAppUi();
+
+ /**
+ * Tries to find the HTIFramework.exe process and open a handle to it.
+ * @param aPrs on return contains an open handle to the HTIFramework.exe
+ * process if process found and opened successfully
+ * @return ETrue if process found and opened successfully,
+ * otherwise EFalse
+ */
+ TBool OpenHtiProcess( RProcess& aPrs );
+
+ /**
+ * Updates the version text in the display.
+ */
+ void UpdateVersion();
+
+ /**
+ * Updates the HTI Framework process status in the display.
+ */
+ void UpdateStatusL();
+
+ /**
+ * Updates the HTI auto start status in the display.
+ */
+ void UpdateAutoStartStatus();
+
+ /**
+ * Updates the selected communication in the display.
+ */
+ void UpdateSelectedComm();
+
+ /**
+ * Kills the HtiWatchDog process if it is running.
+ */
+ void KillHtiWatchDogL();
+
+ /**
+ * Stops the timer issuing the periodical HTI Framework process
+ * status checks.
+ */
+ void KillTimer();
+
+ /**
+ * The method called by the periodic timer.
+ * @param aPtr pointer to this CHtiAdminAppUi instance
+ * @return zero if the callback function should not be called again,
+ * otherwise non-zero. Current implementation returns always ETrue.
+ */
+ static TInt TimerCallBackL( TAny* aPtr );
+
+ public: // from CAknAppUi
+ /**
+ * Handle user menu selections
+ * @param aCommand the enumerated code for the option selected
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Updates the HTI Framework status information and starts the
+ * periodical status polling when application comes to foreground -
+ * stops the polling when going to background.
+ * @param aForeground ETrue if the application is in the foreground,
+ * otherwise EFalse
+ */
+ void HandleForegroundEventL( TBool aForeground );
+
+ public: // from MEikMenuObserver
+ /**
+ * Used to initialize user menu content dynamically
+ * @param aResourceId the resource id of the menu pane being initialised
+ * @param aMenuPane the in-memory representation of the menu pane
+ */
+ void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane *aMenuPane );
+
+ private:
+ void ShowBTListQueryL();
+ void ShowIPListQueryL();
+ void ShowCommsListQueryL();
+ void ShowCommsDBListQueryL();
+ void HandleBtByAddress();
+ void HandleBtByName();
+ void HandleBtSearch();
+ void HandleIPConnect();
+ void HandleIPListen();
+
+ void StartTimer();
+
+ private:
+
+ // The application view
+ CHtiAdminAppView* iAppView;
+
+ // Timer triggering periodic checking of HTIFramework process status
+ CPeriodic* iPeriodic;
+
+ // For reading and writing HTI configuration files
+ CHtiCfg* iHtiCfg;
+ };
+
+#endif // __HTIADMIN_APPUI_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/inc/HtiAdminAppView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: App view displays 2 labels.
+*
+*/
+
+
+#ifndef __HTIADMIN_APPVIEW_H__
+#define __HTIADMIN_APPVIEW_H__
+
+// INCLUDES
+#include <coecntrl.h>
+
+// CONSTANTS
+const static TInt KMaxDisplayText = 64;
+
+// CLASS DECLARATION
+/**
+ An instance of the Application View object for the HtiAdmin
+ example application
+ */
+class CHtiAdminAppView : public CCoeControl
+ {
+public:
+
+/**
+ Create a CHtiAdminAppView object, which will draw itself to aRect
+ @param aRect the rectangle this view will be drawn to
+ @return a pointer to the created instance of CHtiAdminAppView
+ */
+ static CHtiAdminAppView* NewL(const TRect& aRect);
+
+/**
+ Create a CHtiAdminAppView object, which will draw itself to aRect
+ @param aRect the rectangle this view will be drawn to
+ @return a pointer to the created instance of CHtiAdminAppView
+ */
+ static CHtiAdminAppView* NewLC(const TRect& aRect);
+
+
+/**
+ Destroy the object and release all memory objects
+ */
+ ~CHtiAdminAppView();
+
+ /**
+ Set text for the labels in the view.
+ */
+ void SetCaption( const TDesC& aText );
+ void SetStatus( const TDesC& aText );
+ void SetVersionCaption( const TDesC& aText );
+ void SetVersion( const TDesC& aText );
+ void SetAutoStartCaption( const TDesC& aText );
+ void SetAutoStartStatus( const TDesC& aText );
+ void SetSelectedCommCaption( const TDesC& aText );
+ void SetSelectedComm( const TDesC& aText );
+ void SetCommDetails( const TDesC& aText );
+
+public: // from CCoeControl
+/**
+ Draw this CHtiAdminAppView to the screen
+ @param aRect the rectangle of this view that needs updating
+ */
+ void Draw( const TRect& aRect ) const;
+
+
+private:
+
+/**
+ Perform the second phase construction of a CHtiAdminAppView object
+ @param aRect the rectangle this view will be drawn to
+ */
+ void ConstructL( const TRect& aRect );
+
+/**
+ Perform the first phase of two phase construction
+ */
+ CHtiAdminAppView();
+
+private:
+ /**
+ text to show in the view
+ */
+ HBufC* iHtiCaption;
+ HBufC* iHtiStatus;
+ HBufC* iHtiVersionCaption;
+ HBufC* iHtiVersion;
+ HBufC* iHtiAutoStartCaption;
+ HBufC* iHtiAutoStartStatus;
+ HBufC* iHtiSelectedCommCaption;
+ HBufC* iHtiSelectedComm;
+ HBufC* iHtiCommDetails;
+ };
+
+
+#endif // __HTIADMIN_APPVIEW_H__
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/inc/HtiAdminApplication.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Application class
+*
+*/
+
+
+#ifndef __HTIADMIN_APPLICATION_H__
+#define __HTIADMIN_APPLICATION_H__
+
+// INCLUDES
+
+#include <aknapp.h>
+
+// CLASS DECLARATION
+/**
+ An instance of CHtiAdminApplication is the application part of the AVKON
+ application framework for the HtiAdmin example application
+ */
+class CHtiAdminApplication : public CAknApplication
+ {
+public: // from CAknApplication
+
+/**
+ Returns the application DLL UID value
+ @return the UID of this Application/Dll
+ */
+ TUid AppDllUid() const;
+
+protected: // from CAknApplication
+/**
+ Create a CApaDocument object and return a pointer to it
+ @return a pointer to the created document
+ */
+ CApaDocument* CreateDocumentL();
+ };
+
+#endif // __HTIADMIN_APPLICATION_H__
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/inc/HtiAdminDocument.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Document class
+*
+*/
+
+
+#ifndef __HTIADMIN_DOCUMENT_H__
+#define __HTIADMIN_DOCUMENT_H__
+
+// INCLUDES
+#include <AknDoc.h>
+
+// FORWARD DECLARATIONS
+class CHtiAdminAppUi;
+class CEikApplication;
+
+// CLASS DECLARATION
+/**
+ An instance of class CHtiAdminDocument is the Document part of the AVKON
+ application framework for the HtiAdmin example application
+ */
+class CHtiAdminDocument : public CAknDocument
+ {
+public:
+
+/**
+ Construct a CHtiAdminDocument for the AVKON application aApp
+ using two phase construction, and return a pointer to the created object
+
+ @param aApp application creating this document
+ @return a pointer to the created instance of CHtiAdminDocument
+ */
+ static CHtiAdminDocument* NewL(CEikApplication& aApp);
+
+/**
+ Construct a CHtiAdminDocument for the AVKON application aApp
+ using two phase construction, and return a pointer to the created object
+ @param aApp application creating this document
+
+ @return a pointer to the created instance of CHtiAdminDocument
+ */
+ static CHtiAdminDocument* NewLC(CEikApplication& aApp);
+
+/**
+Destroy the object and release all memory objects
+ */
+ ~CHtiAdminDocument();
+
+public: // from CAknDocument
+/**
+ Create a CHtiAdminAppUi object and return a pointer to it
+ @return a pointer to the created instance of the AppUi created
+ */
+ CEikAppUi* CreateAppUiL();
+
+private:
+
+/**
+ Perform the second phase construction of a CHtiAdminDocument object
+ */
+ void ConstructL();
+
+/**
+ Perform the first phase of two phase construction
+ @param aApp application creating this document
+ */
+ CHtiAdminDocument(CEikApplication& aApp);
+
+ };
+
+
+#endif // __HTIADMIN_DOCUMENT_H__
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/src/HtiAdmin.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of HtiAdmin main.
+*
+*/
+
+
+#include "HtiAdminApplication.h"
+#include <eikstart.h>
+
+
+LOCAL_C CApaApplication* NewApplication()
+ {
+ //HTI_LOG_TEXT("NewApplication");
+ return new CHtiAdminApplication;
+ }
+
+GLDEF_C TInt E32Main()
+ {
+ //HTI_LOG_TEXT("E32Main");
+ return EikStart::RunApplication(NewApplication);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/src/HtiAdminAppUi.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,1143 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AppUi implementation, all functions here
+*
+*/
+
+// INCLUDE FILES
+#include <avkon.hrh>
+#include <aknnotewrappers.h>
+#include <AknQueryDialog.h>
+#include <aknmessagequerydialog.h>
+#include <w32std.h>
+#include <eikmenup.h>
+#include <commdb.h>
+
+#include <HtiAdmin.rsg>
+#include <HtiCommPluginInterface.h> // for KHTICommInterfaceUid
+#include <HtiCfg.h>
+#include <HtiVersion.h>
+
+#include "HtiAdmin.pan"
+#include "HtiAdminAppUi.h"
+#include "HtiAdminAppView.h"
+#include "HtiAdmin.hrh"
+
+
+#ifdef __ENABLE_LOGGING__
+
+#include <flogger.h>
+
+_LIT(KLogFolder, "hti");
+_LIT(KLogFile, "htiadmin.txt");
+#define HTI_LOG_TEXT(a1) {_LIT(temp, a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);}
+#define HTI_LOG_FORMAT(a1,a2) {_LIT(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, (a2));}
+#define HTI_LOG_DES(a1) {RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, (a1));}
+
+#else // __ENABLE_LOGGING__
+
+#define HTI_LOG_TEXT(a1)
+#define HTI_LOG_FORMAT(a1,a2)
+#define HTI_LOG_DES(a1)
+
+#endif // __ENABLE_LOGGING__
+
+// CONSTANTS
+_LIT( KHtiWatchDogMatchPattern, "HtiWatchDog*" );
+_LIT( KHtiFrameworkExe, "HtiFramework.exe" );
+_LIT( KHtiMatchPattern, "HtiFramework*" );
+_LIT( KHtiFrameworkCaption, "HTI status: " );
+_LIT( KHtiAutoStartCaption, "AutoStart: " );
+_LIT( KHtiVersionCaption, "Version: " );
+_LIT( KHtiSelectedCommCaption, "Communication: " );
+_LIT( KHtiAdminStartParameter, "admin" );
+_LIT( KHtiAdminVersionFormat, "%u.%u.%u (%uwk%02u)" );
+_LIT( KHtiAdminAboutVersionFormat, "Version %u.%u.%u - " );
+const static TInt KTerminateReason = 1;
+
+
+const TInt32 KHTIImplUidSerial = {0x10210CCA};
+const TInt32 KHTIImplUidBluetooth = {0x200212CC};
+const TInt32 KHTIImplUidIPComm = {0x200212CE};
+
+// configuration file constants
+_LIT( KCfgFilePath, "\\");
+_LIT( KHtiCfg, "hti.cfg" );
+_LIT( KHtiBtCommCfg, "HTIBtComm.cfg" );
+_LIT( KHtiSerialCommCfg , "HTISerialComm.cfg" );
+_LIT( KHtiIPCommCfg, "HTIIPComm.cfg" );
+// hti.cfg
+_LIT8( KCommPlugin, "CommPlugin" );
+_LIT8( KPriority, "Priority" );
+_LIT8( KShowConsole, "ShowConsole" );
+_LIT8( KEnableHtiWatchDog, "EnableHtiWatchDog" );
+_LIT8( KEnableHtiAutoStart, "EnableHtiAutoStart" );
+_LIT8( KShowErrorDialogs, "ShowErrorDialogs" );
+// HtiBtComm.cfg
+_LIT8( KBtDeviceAddress, "BtDeviceAddress" );
+_LIT8( KBtDeviceName, "BtDeviceName" );
+// HtiSerialComm.cfg
+_LIT8( KCommPortNumber, "CommPort" );
+// HTIIPComm.cfg
+_LIT8( KLocalPort, "LocalPort" );
+_LIT8( KRemoteHost, "RemoteHost" );
+_LIT8( KRemotePort, "RemotePort" );
+_LIT8( KIAPName, "IAPName" );
+
+
+// ConstructL is called by the application framework
+void CHtiAdminAppUi::ConstructL()
+ {
+ BaseConstructL( EAknEnableSkin );
+ iAppView = CHtiAdminAppView::NewL( ClientRect() );
+ AddToStackL( iAppView );
+
+ iAppView->SetCaption( KHtiFrameworkCaption );
+ iAppView->SetVersionCaption( KHtiVersionCaption );
+ iAppView->SetAutoStartCaption( KHtiAutoStartCaption );
+ iAppView->SetSelectedCommCaption( KHtiSelectedCommCaption );
+ UpdateVersion();
+ UpdateStatusL();
+ StartTimer();
+ iHtiCfg = CHtiCfg::NewL();
+ UpdateAutoStartStatus(); // uses iHtiCfg
+ UpdateSelectedComm(); // uses iHtiCfg
+ }
+
+CHtiAdminAppUi::CHtiAdminAppUi()
+ {
+ iHtiCfg = NULL;
+ }
+
+CHtiAdminAppUi::~CHtiAdminAppUi()
+ {
+ KillTimer();
+ if ( iAppView )
+ {
+ RemoveFromStack( iAppView );
+ delete iAppView;
+ iAppView = NULL;
+ }
+
+ if ( iHtiCfg )
+ delete iHtiCfg;
+ }
+
+void CHtiAdminAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane)
+ {
+ HTI_LOG_FORMAT( "DynInitMenuPaneL 0x%x", aResourceId );
+
+ if ( aResourceId == R_HTIADMIN_MENU )
+ {
+ RProcess prs;
+ if ( OpenHtiProcess( prs ) )
+ {
+ if ( prs.ExitType() == EExitPending )
+ {
+ aMenuPane->SetItemDimmed( EHtiAdminStart, ETrue );
+ aMenuPane->SetItemDimmed( EHtiAdminSubOptions, ETrue );
+ prs.Close();
+ return;
+ }
+ }
+ aMenuPane->SetItemDimmed( EHtiAdminStop, ETrue );
+ prs.Close();
+ }
+
+ else if ( aResourceId == R_HTIADMIN_SUBMENU_OPTIONS )
+ {
+#if !defined(__ENABLE_LOGGING__)
+ aMenuPane->SetItemDimmed( EHtiAdminSubLogs, ETrue );
+#endif
+ }
+ else if ( aResourceId == R_HTIADMIN_SUBMENU_PRIORITY )
+ {
+ TInt priority = 3; // default value
+ TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ if ( !err )
+ {
+ TRAP( err, priority = iHtiCfg->GetParameterIntL( KPriority ) );
+ }
+
+ switch ( priority )
+ {
+ case 1:
+ aMenuPane->SetItemButtonState( EHtiAdminPriorityBackground, EEikMenuItemSymbolOn );
+ break;
+ case 2:
+ aMenuPane->SetItemButtonState( EHtiAdminPriorityForeground, EEikMenuItemSymbolOn );
+ break;
+ case 4:
+ aMenuPane->SetItemButtonState( EHtiAdminPriorityAbsoluteHigh, EEikMenuItemSymbolOn );
+ break;
+ default:
+ aMenuPane->SetItemButtonState( EHtiAdminPriorityHigh, EEikMenuItemSymbolOn );
+ break;
+ }
+ }
+
+ else if ( aResourceId == R_HTIADMIN_SUBMENU_AUTOSTART )
+ {
+#ifdef __WINS__
+ TInt value = 0; // default value for emulator
+#else
+ TInt value = 1; // default value for hardware
+#endif
+ TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ if ( !err )
+ {
+ TRAP( err, value = iHtiCfg->GetParameterIntL( KEnableHtiAutoStart ) );
+ }
+
+ if ( value )
+ aMenuPane->SetItemButtonState( EHtiAdminAutoStartEnable, EEikMenuItemSymbolOn );
+ else
+ aMenuPane->SetItemButtonState( EHtiAdminAutoStartDisable, EEikMenuItemSymbolOn );
+ }
+
+ else if ( aResourceId == R_HTIADMIN_SUBMENU_WATCHDOG )
+ {
+ TInt value = 0; // default value
+ TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ if ( !err )
+ {
+ TRAP( err, value = iHtiCfg->GetParameterIntL( KEnableHtiWatchDog ) );
+ }
+
+ if ( value )
+ aMenuPane->SetItemButtonState( EHtiAdminWatchDogEnable, EEikMenuItemSymbolOn );
+ else
+ aMenuPane->SetItemButtonState( EHtiAdminWatchDogDisable, EEikMenuItemSymbolOn );
+ }
+
+ else if ( aResourceId == R_HTIADMIN_SUBMENU_CONSOLE )
+ {
+ TInt value = 0; // default value
+ TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ if ( !err )
+ {
+ TRAP( err, value = iHtiCfg->GetParameterIntL( KShowConsole ) );
+ }
+
+ if ( value )
+ aMenuPane->SetItemButtonState( EHtiAdminConsoleEnable, EEikMenuItemSymbolOn );
+ else
+ aMenuPane->SetItemButtonState( EHtiAdminConsoleDisable, EEikMenuItemSymbolOn );
+ }
+
+ else if ( aResourceId == R_HTIADMIN_SUBMENU_ERROR_DIALOGS )
+ {
+ TInt value = 1; // default value
+ TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ if ( !err )
+ {
+ TRAP( err, value = iHtiCfg->GetParameterIntL( KShowErrorDialogs ) );
+ }
+
+ if ( value )
+ aMenuPane->SetItemButtonState( EHtiAdminErrorDialogsEnable, EEikMenuItemSymbolOn );
+ else
+ aMenuPane->SetItemButtonState( EHtiAdminErrorDialogsDisable, EEikMenuItemSymbolOn );
+ }
+ }
+
+
+// Helper function to get data from a dialog
+TInt ShowDialog(TInt aResourceId, const TDesC &aText, TDes8 &aValue)
+ {
+ TBuf<KMaxParameterValueLength> data;
+
+ CAknTextQueryDialog* dlg;
+ dlg = new (ELeave) CAknTextQueryDialog(data);
+ CleanupStack::PushL(dlg);
+ dlg->SetPromptL(aText);
+ dlg->SetMaxLength(KMaxParameterValueLength);
+ CleanupStack::Pop(); // dlg
+
+ if ( dlg->ExecuteLD( aResourceId ) )
+ {
+ aValue.Copy(data);
+ return KErrNone;
+ }
+
+ return KErrCancel;
+ }
+
+void CHtiAdminAppUi::ShowBTListQueryL()
+ {
+ TInt selectedOption( KErrNotFound );
+
+ CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(20);
+ CleanupStack::PushL(array);
+
+ array->AppendL(_L("By BT address"));
+ array->AppendL(_L("By BT Name"));
+ array->AppendL(_L("Search when starting"));
+
+ CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &selectedOption );
+ dlg->PrepareLC(R_QUERY_DIALOG);
+ dlg->SetItemTextArray(array);
+ dlg->SetOwnershipType(ELbmDoesNotOwnItemArray);
+ dlg->RunLD();
+
+ CleanupStack::PopAndDestroy(array);
+
+ if(selectedOption == 0)
+ {
+ HandleBtByAddress();
+ }
+ else if(selectedOption == 1)
+ {
+ HandleBtByName();
+ }
+ else if (selectedOption == 2)
+ {
+ HandleBtSearch();
+ }
+ }
+
+void CHtiAdminAppUi::ShowIPListQueryL()
+ {
+ TInt selectedOption( KErrNotFound );
+
+ CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(10);
+ CleanupStack::PushL(array);
+
+ array->AppendL(_L("Listen"));
+ array->AppendL(_L("Connect"));
+
+ CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &selectedOption );
+ dlg->PrepareLC(R_QUERY_DIALOG);
+ dlg->SetItemTextArray(array);
+ dlg->SetOwnershipType(ELbmDoesNotOwnItemArray);
+ dlg->RunLD();
+
+ CleanupStack::PopAndDestroy(array);
+
+ if(selectedOption == 0)
+ {
+ HandleIPListen();
+ }
+ else if(selectedOption == 1)
+ {
+ HandleIPConnect();
+ }
+ }
+
+void CleanupRArray( TAny* object )
+ {
+ ( ( RImplInfoPtrArray* ) object )->ResetAndDestroy();
+ }
+
+void CHtiAdminAppUi::ShowCommsListQueryL()
+ {
+ TInt selectedOption( KErrNotFound );
+
+ const TInt pluginNameArrayGranularity (15);
+ CDesCArrayFlat* pluginNameArray = new (ELeave) CDesCArrayFlat(pluginNameArrayGranularity);
+ CleanupStack::PushL(pluginNameArray);
+
+ RImplInfoPtrArray implInfoArray;
+ CleanupStack::PushL( TCleanupItem( CleanupRArray, &implInfoArray ) );
+
+ REComSession::ListImplementationsL( KHTICommInterfaceUid, implInfoArray );
+
+ for ( TInt i = 0; i < implInfoArray.Count(); ++i )
+ {
+ pluginNameArray->AppendL(implInfoArray[i]->DisplayName());
+ }
+
+ CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &selectedOption );
+
+ dlg->PrepareLC(R_QUERY_DIALOG);
+ dlg->SetHeaderTextL(_L("Select communication"));
+ dlg->SetItemTextArray(pluginNameArray);
+ dlg->SetOwnershipType(ELbmDoesNotOwnItemArray);
+
+ if(dlg->RunLD())
+ {
+ TInt32 uid = implInfoArray[selectedOption]->ImplementationUid().iUid;
+ switch(uid)
+ {
+ case KHTIImplUidSerial:
+ {
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KCommPlugin, _L8( "SERIAL" ) );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+ TBuf8<KMaxParameterValueLength> portNum;
+ if ( !ShowDialog( R_NUMERIC_QUERY, _L("Com port number:"), portNum ) )
+ {
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiSerialCommCfg ) );
+ iHtiCfg->SetParameterL( KCommPortNumber, portNum );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiSerialCommCfg );
+ }
+ UpdateSelectedComm();
+ }
+ break;
+
+ case KHTIImplUidBluetooth:
+ {
+ ShowBTListQueryL();
+ }
+ break;
+
+ case KHTIImplUidIPComm:
+ {
+ ShowIPListQueryL();
+ }
+ break;
+ default:
+ {
+ //Just save the conf info for other plugins
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KCommPlugin, implInfoArray[selectedOption]->DataType() );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ UpdateSelectedComm();
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy(2, pluginNameArray);
+ }
+
+void CHtiAdminAppUi::HandleBtByAddress()
+ {
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+ iHtiCfg->RemoveParameterL( KBtDeviceName );
+ iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+
+ TBuf8<KMaxParameterValueLength> address;
+ if ( !ShowDialog( R_TEXT_QUERY, _L("BT address:"), address) )
+ {
+ iHtiCfg->SetParameterL( KBtDeviceAddress, address);
+ }
+
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg);
+ UpdateSelectedComm();
+ }
+
+void CHtiAdminAppUi::HandleBtByName()
+ {
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+ iHtiCfg->RemoveParameterL( KBtDeviceName );
+ iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+
+ TBuf8<KMaxParameterValueLength> name;
+ if ( !ShowDialog( R_TEXT_QUERY, _L( "BT name:" ), name ) )
+ {
+ iHtiCfg->SetParameterL( KBtDeviceName, name );
+ }
+
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg );
+ UpdateSelectedComm();
+ }
+
+void CHtiAdminAppUi::HandleBtSearch()
+ {
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+ iHtiCfg->RemoveParameterL( KBtDeviceName );
+ iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg );
+ UpdateSelectedComm();
+ }
+
+void CHtiAdminAppUi::HandleIPListen()
+ {
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KCommPlugin, _L8("IPCOMM"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+ iHtiCfg->RemoveParameterL( KRemotePort );
+ iHtiCfg->RemoveParameterL( KRemoteHost );
+
+ TBuf8<KMaxParameterValueLength> localPort;
+ if ( !ShowDialog( R_TEXT_QUERY, _L( "Local port:" ), localPort ) )
+ {
+ iHtiCfg->SetParameterL( KLocalPort, localPort );
+ ShowCommsDBListQueryL();
+ }
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiIPCommCfg );
+ UpdateSelectedComm();
+ }
+
+void CHtiAdminAppUi::HandleIPConnect()
+ {
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KCommPlugin, _L8( "IPCOMM" ) );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+ iHtiCfg->RemoveParameterL( KLocalPort );
+ TBuf8<KMaxParameterValueLength> remoteHost;
+ TBuf8<KMaxParameterValueLength> remotePort;
+ if ( !ShowDialog( R_TEXT_QUERY, _L("Remote host:"), remoteHost ) )
+ {
+ iHtiCfg->SetParameterL( KRemoteHost, remoteHost );
+ if ( !ShowDialog( R_TEXT_QUERY, _L( "Remote port:" ), remotePort ) )
+ {
+ iHtiCfg->SetParameterL( KRemotePort, remotePort );
+ ShowCommsDBListQueryL();
+ }
+ }
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiIPCommCfg );
+ UpdateSelectedComm();
+ }
+
+
+// handle any menu commands
+void CHtiAdminAppUi::HandleCommandL(TInt aCommand)
+ {
+ TFileName cfgFile;
+
+ switch ( aCommand )
+ {
+ case EEikCmdExit:
+ case EAknSoftkeyExit:
+ Exit();
+ break;
+
+ case EHtiAdminStart:
+ {
+ HTI_LOG_TEXT( "Start" );
+ RProcess prs;
+ TInt err;
+ TBool isRunning = EFalse;
+ if ( OpenHtiProcess( prs ) )
+ {
+ if ( prs.ExitType() == EExitPending )
+ {
+ isRunning = ETrue;
+ _LIT(KText, "Already running");
+ iAppView->SetStatus( KText );
+ }
+ prs.Close();
+ }
+
+ if ( !isRunning )
+ {
+ HTI_LOG_TEXT( "create process" );
+ err = prs.Create( KHtiFrameworkExe, KHtiAdminStartParameter );
+ if ( err == KErrNone )
+ {
+ prs.Resume();
+ prs.Close();
+ UpdateStatusL();
+ HTI_LOG_TEXT("create done");
+ }
+ else
+ {
+ TBuf<64> msg;
+ msg.Format( _L("Error in starting: %d"), err );
+ iAppView->SetStatus( msg );
+ HTI_LOG_TEXT("create error");
+ }
+ }
+ }
+ break;
+
+ case EHtiAdminStop:
+ {
+ HTI_LOG_TEXT("Stop");
+
+ // kill the watchdog to prevent it from restarting HTI again
+ KillHtiWatchDogL();
+
+ RProcess prs;
+ if ( OpenHtiProcess( prs ) )
+ {
+ if ( prs.ExitType() == EExitPending )
+ {
+ HTI_LOG_TEXT("try to kill");
+ prs.Kill( KTerminateReason );
+ UpdateStatusL();
+ }
+ else
+ {
+ _LIT(KText, "Already stopped");
+ iAppView->SetStatus( KText );
+ }
+ prs.Close();
+ }
+ }
+ break;
+
+ case EHtiAdminAbout:
+ {
+ HTI_LOG_TEXT("About");
+ TDateSuffix suffix( KHtiVersionDay - 1 );
+ TMonthName month( ( TMonth ) ( KHtiVersionMonth - 1 ) );
+ TBuf<64> msgPart1;
+ msgPart1.Format( KHtiAdminAboutVersionFormat,
+ KHtiVersionMajor, KHtiVersionMinor, KHtiVersionBuild );
+ msgPart1.AppendNum( KHtiVersionDay );
+ msgPart1.Append( suffix );
+ msgPart1.Append( ' ' );
+ msgPart1.Append( month );
+ msgPart1.Append( ' ' );
+ msgPart1.AppendNum( KHtiVersionYear );
+ msgPart1.Append( '.' );
+ msgPart1.Append( ' ' );
+ HBufC* msgPart2 = iEikonEnv->AllocReadResourceLC( R_HTIADMIN_ABOUT_TEXT );
+ HBufC* fullMsg = HBufC::NewLC( msgPart1.Length() + msgPart2->Length() );
+ fullMsg->Des().Append( msgPart1 );
+ fullMsg->Des().Append( *msgPart2 );
+ CAknMessageQueryDialog* dialog = new ( ELeave ) CAknMessageQueryDialog;
+ dialog->PrepareLC( R_HTIADMIN_ABOUT_DIALOG );
+ dialog->SetMessageTextL( *fullMsg );
+ dialog->RunLD();
+ CleanupStack::PopAndDestroy( 2 ); // fullMsg, msgPart2
+ }
+ break;
+
+ case EHtiAdminSubOptions:
+ break;
+
+ case EHtiAdminSubLogs:
+ break;
+
+ case EHtiAdminCreateLogFolder:
+#ifdef __ENABLE_LOGGING__
+ {
+ TInt err = KErrNone;
+ RFs fs;
+ err = fs.Connect();
+ if ( err == KErrNone )
+ {
+ err = fs.MkDirAll(_L("c:\\logs\\hti\\"));
+ }
+ fs.Close();
+ }
+#endif
+ break;
+
+ case EHtiAdminRemoveLogFolder:
+#ifdef __ENABLE_LOGGING__
+ {
+ TInt err = KErrNone;
+ RFs fs;
+ err = fs.Connect();
+ if ( err == KErrNone )
+ {
+ CFileMan *fileman = CFileMan::NewL( fs );
+ fileman->RmDir( _L( "c:\\logs\\hti\\" ) );
+ delete fileman;
+ }
+ fs.Close();
+ }
+#endif
+ break;
+
+ case EHtiAdminClearLogs:
+#ifdef __ENABLE_LOGGING__
+ {
+ TInt err = KErrNone;
+ RFs fs;
+ err = fs.Connect();
+ if ( err == KErrNone )
+ {
+ CFileMan *fileman = CFileMan::NewL( fs );
+ fileman->Delete( _L( "c:\\logs\\hti\\*" ) );
+ fileman->Delete( _L( "c:\\HTI_*.log" ) );
+ delete fileman;
+ }
+ fs.Close();
+ }
+#endif
+ break;
+
+ case EHtiAdminSubComms:
+ {
+ ShowCommsListQueryL();
+ }
+ break;
+
+ case EHtiAdminSubPriority:
+ break;
+
+ case EHtiAdminPriorityBackground:
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KPriority, _L8("1"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ break;
+
+ case EHtiAdminPriorityForeground:
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KPriority, _L8("2"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ break;
+
+ case EHtiAdminPriorityHigh:
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KPriority, _L8("3"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ break;
+
+ case EHtiAdminPriorityAbsoluteHigh:
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KPriority, _L8("4"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ break;
+
+ case EHtiAdminSubAutoStart:
+ break;
+
+ case EHtiAdminAutoStartEnable:
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KEnableHtiAutoStart, _L8("1"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ UpdateAutoStartStatus();
+ break;
+
+ case EHtiAdminAutoStartDisable:
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KEnableHtiAutoStart, _L8("0"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ UpdateAutoStartStatus();
+ break;
+
+ case EHtiAdminSubWatchDog:
+ break;
+
+ case EHtiAdminWatchDogEnable:
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KEnableHtiWatchDog, _L8("1"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ break;
+
+ case EHtiAdminWatchDogDisable:
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KEnableHtiWatchDog, _L8("0"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ break;
+
+ case EHtiAdminSubConsole:
+ break;
+
+ case EHtiAdminConsoleEnable:
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KShowConsole, _L8("1"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ break;
+
+ case EHtiAdminConsoleDisable:
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KShowConsole, _L8("0"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ break;
+
+ case EHtiAdminErrorDialogsEnable:
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KShowErrorDialogs, _L8("1"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ break;
+
+ case EHtiAdminErrorDialogsDisable:
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KShowErrorDialogs, _L8("0"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ break;
+
+ case EHtiAdminSubSetParam:
+ break;
+
+ case EHtiAdminHtiCfg:
+ cfgFile = KHtiCfg;
+
+ case EHtiAdminHtiBtCommCfg:
+ if ( !cfgFile.Length() )
+ cfgFile = KHtiBtCommCfg;
+
+ case EHtiAdminHtiIPCommCfg:
+ if ( !cfgFile.Length() )
+ cfgFile = KHtiIPCommCfg;
+
+ case EHtiAdminHtiSerialCommCfg:
+ {
+ if ( !cfgFile.Length() )
+ cfgFile = KHtiSerialCommCfg;
+
+ TBuf8<KMaxParameterNameLength> parameterName;
+ if ( !ShowDialog( R_TEXT_QUERY, _L("Parameter name:"), parameterName) )
+ {
+ TBuf8<KMaxParameterValueLength> parameterValue;
+ if ( !ShowDialog( R_TEXT_QUERY, _L("Parameter value:"), parameterValue ) )
+ {
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, cfgFile ) );
+ iHtiCfg->SetParameterL( parameterName, parameterValue );
+ iHtiCfg->SaveCfgL( KCfgFilePath, cfgFile);
+ }
+ }
+ }
+ break;
+
+ default:
+ {
+ CAknErrorNote* dialog = new(ELeave)CAknErrorNote(ETrue);
+ dialog->ExecuteLD(_L("Unknown Command Recieved"));
+ }
+ break;
+ }
+ }
+
+void CHtiAdminAppUi::HandleForegroundEventL( TBool aForeground )
+ {
+ CAknAppUi::HandleForegroundEventL( aForeground );
+
+ if ( aForeground )
+ {
+ UpdateStatusL();
+ UpdateAutoStartStatus();
+ StartTimer();
+ }
+ else
+ {
+ KillTimer();
+ }
+ }
+
+TBool CHtiAdminAppUi::OpenHtiProcess( RProcess& aPrs )
+ {
+ HTI_LOG_TEXT( "OpenHtiProcess" );
+
+ TFullName processName;
+ TInt err;
+
+ TFindProcess finder( KHtiMatchPattern );
+ err = finder.Next( processName );
+ if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "try to open..." );
+ err = aPrs.Open( finder );
+ HTI_LOG_TEXT( "opened" );
+
+ if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "OpenHtiProcess OK" );
+ return ETrue;
+ }
+ else
+ {
+ HTI_LOG_TEXT( "Failed to open process" );
+ TBuf<64> msg;
+ msg.Format( _L( "Error: %d" ), err );
+ iAppView->SetStatus( msg );
+ }
+ }
+ else if ( err == KErrNotFound )
+ {
+ HTI_LOG_TEXT( "Not found" );
+ _LIT( KNotFound, "Stopped" );
+ iAppView->SetStatus( KNotFound );
+ }
+ else
+ {
+ TBuf<64> msg;
+ msg.Format( _L( "Error: %d" ), err );
+ iAppView->SetStatus( msg );
+ }
+
+ HTI_LOG_TEXT( "OpenHtiProcess NOK" );
+
+ return EFalse;
+ }
+
+
+void CHtiAdminAppUi::UpdateVersion()
+ {
+ HTI_LOG_TEXT( "UpdateVersion" );
+ TBuf<128> tmp;
+ tmp.Format( KHtiAdminVersionFormat, KHtiVersionMajor, KHtiVersionMinor,
+ KHtiVersionBuild, KHtiVersionYear, KHtiVersionWeek );
+ iAppView->SetVersion( tmp );
+ }
+
+
+void CHtiAdminAppUi::UpdateStatusL()
+ {
+ HTI_LOG_TEXT( "UpdateStatusL" );
+ RProcess prs;
+ if ( OpenHtiProcess( prs ) )
+ {
+ HTI_LOG_TEXT( "Update display" );
+ TExitType exT = prs.ExitType();
+
+ switch ( exT )
+ {
+ case EExitPending:
+ {
+ _LIT( KTxt, "Running" );
+ iAppView->SetStatus( KTxt );
+ }
+ break;
+
+ case EExitKill:
+ case EExitTerminate:
+ {
+ _LIT( KTxt, "Stopped" );
+ iAppView->SetStatus( KTxt );
+ }
+ break;
+
+ case EExitPanic:
+ {
+ _LIT( KTxt, "Panic" );
+ iAppView->SetStatus( KTxt );
+ }
+ break;
+ };
+ prs.Close();
+ }
+ }
+
+void CHtiAdminAppUi::UpdateAutoStartStatus()
+ {
+ HTI_LOG_TEXT( "UpdateAutoStartStatus" );
+ TInt value = KErrNotFound;
+ TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ if ( !err )
+ {
+ TRAP( err, value = iHtiCfg->GetParameterIntL(KEnableHtiAutoStart) );
+ }
+
+ if ( value == KErrNotFound )
+ {
+ // Use default values if not found from config.
+#ifdef __WINS__
+ value = 0;
+#else
+ value = 1;
+#endif
+ }
+
+ if ( value == 0 )
+ {
+ _LIT( KTxt, "Disabled" );
+ iAppView->SetAutoStartStatus( KTxt );
+ }
+ else if ( value == 1 )
+ {
+ _LIT( KTxt, "Enabled" );
+ iAppView->SetAutoStartStatus( KTxt );
+ }
+ else
+ {
+ _LIT( KTxt, "Unknown" );
+ iAppView->SetAutoStartStatus( KTxt );
+ }
+ }
+
+void CHtiAdminAppUi::UpdateSelectedComm()
+ {
+ HTI_LOG_TEXT( "UpdateSelectedComm" );
+ TBuf<64> commPlugin;
+ TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ if ( !err )
+ {
+ TBuf8<KMaxParameterValueLength> commValue;
+ TRAP( err, commValue = iHtiCfg->GetParameterL( KCommPlugin ) );
+ if ( err == KErrNone )
+ {
+ commPlugin.Copy( commValue );
+ }
+ }
+ // Use default if not found from config
+ if ( commPlugin.Length() == 0 )
+ {
+ commPlugin.Copy(KCommDefaultImplementation );
+ }
+ iAppView->SetSelectedComm( commPlugin );
+
+ if ( commPlugin.Compare( _L( "SERIAL" ) ) == 0 )
+ {
+ TInt portNum = 0;
+ TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiSerialCommCfg ) );
+ if ( err == KErrNone )
+ {
+ TRAP( err, portNum = iHtiCfg->GetParameterIntL( KCommPortNumber ) );
+ }
+ TBuf<16> portBuf;
+ portBuf.Copy( _L( "Port: " ) );
+ portBuf.AppendNum( portNum );
+ iAppView->SetCommDetails( portBuf );
+ }
+
+ else if ( commPlugin.Compare( _L( "BTSERIAL" ) ) == 0 )
+ {
+ TBuf<64> hostBuf;
+ TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+ if ( err == KErrNone )
+ {
+ TBuf8<KMaxParameterValueLength> hostValue;
+ TRAP( err, hostValue = iHtiCfg->GetParameterL( KBtDeviceAddress ) );
+ if ( err != KErrNone )
+ {
+ TRAP( err, hostValue = iHtiCfg->GetParameterL( KBtDeviceName ) );
+ }
+ if ( err == KErrNone )
+ {
+ hostBuf.Copy( hostValue );
+ }
+ }
+ if ( hostBuf.Length() > 0 )
+ {
+ hostBuf.Insert( 0, _L( "Host: " ) );
+ }
+ iAppView->SetCommDetails( hostBuf );
+ }
+
+ else if ( commPlugin.Compare( _L( "IPCOMM" ) ) == 0 )
+ {
+ TBuf<128> hostBuf;
+ TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+ if ( err == KErrNone )
+ {
+ TInt localPort = 0;
+ TRAP( err, localPort = iHtiCfg->GetParameterIntL( KLocalPort ) );
+ if ( err == KErrNone && localPort > 0 )
+ {
+ hostBuf.Copy( _L( "Listen: " ) );
+ hostBuf.AppendNum( localPort );
+ }
+ else
+ {
+ TBuf8<KMaxParameterValueLength> remoteHost;
+ TInt remotePort = 0;
+ TRAP( err, remoteHost = iHtiCfg->GetParameterL( KRemoteHost ) );
+ if ( err == KErrNone )
+ {
+ TRAP( err, remotePort = iHtiCfg->GetParameterIntL(
+ KRemotePort ) );
+ }
+ if ( err == KErrNone )
+ {
+ hostBuf.Copy( remoteHost );
+ hostBuf.Insert( 0, _L("Connect: " ) );
+ hostBuf.Append( ':' );
+ hostBuf.AppendNum( remotePort );
+ }
+ else
+ {
+ hostBuf.Copy( _L( "Invalid config!" ) );
+ }
+ }
+ }
+ iAppView->SetCommDetails( hostBuf );
+ }
+
+ else
+ {
+ iAppView->SetCommDetails( KNullDesC );
+ }
+ }
+
+void CHtiAdminAppUi::KillHtiWatchDogL()
+ {
+ TFullName processName;
+ TFindProcess finder( KHtiWatchDogMatchPattern );
+ TInt err = finder.Next( processName );
+ if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "HTI watchdog process found. Trying to open and kill it..." );
+ RProcess prs;
+ User::LeaveIfError( prs.Open( finder ) );
+ prs.Kill( KTerminateReason );
+ prs.Close();
+ HTI_LOG_TEXT( "HTI watchdog killed" );
+ }
+ }
+
+void CHtiAdminAppUi::StartTimer()
+ {
+ // start timer to watch the status
+ if ( !iPeriodic )
+ {
+ iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle );
+ iPeriodic->Start( 1 * 1000 * 1000,
+ 10 * 1000 * 1000,
+ TCallBack( TimerCallBackL, this ) );
+ }
+ }
+
+void CHtiAdminAppUi::KillTimer()
+ {
+ if ( iPeriodic )
+ {
+ iPeriodic->Cancel();
+ delete iPeriodic;
+ iPeriodic = NULL;
+ }
+ }
+
+TInt CHtiAdminAppUi::TimerCallBackL( TAny* aPtr )
+ {
+ ( (CHtiAdminAppUi*)aPtr )->UpdateStatusL();
+ return ETrue;
+ }
+
+void CHtiAdminAppUi::ShowCommsDBListQueryL()
+ {
+ TInt selectedOption( KErrNotFound );
+ TBuf<KMaxParameterValueLength> name;
+
+ CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(16);
+ CleanupStack::PushL(array);
+
+ // Get IAP names from the database
+ CCommsDatabase* db = CCommsDatabase::NewL(EDatabaseTypeIAP);;
+ CleanupStack::PushL(db);
+ db->ShowHiddenRecords();
+ CCommsDbTableView* view = db->OpenTableLC(TPtrC(IAP));
+ TInt res = view->GotoFirstRecord();
+
+ while(res == KErrNone)
+ {
+ view->ReadTextL(TPtrC(COMMDB_NAME), name);
+ array->InsertL(0, name);
+ res = view->GotoNextRecord();
+ }
+
+ CleanupStack::PopAndDestroy(view); //view
+ CleanupStack::PopAndDestroy(db); //db
+
+ // Show IAP selection dialog
+ CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog(&selectedOption);
+ dlg->PrepareLC(R_SELECT_IAP_DIALOG);
+ dlg->SetItemTextArray(array);
+ dlg->SetOwnershipType(ELbmDoesNotOwnItemArray);
+ dlg->RunLD();
+
+ if(selectedOption != KErrNotFound)
+ {
+ // Write selected IAP name to config file
+ name = array->MdcaPoint(selectedOption);
+ TBuf8<KMaxParameterValueLength> iapName;
+ iapName.Copy(name);
+ iHtiCfg->SetParameterL(KIAPName, iapName);
+ }
+ CleanupStack::PopAndDestroy(array);
+ }
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/src/HtiAdminAppView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AppView implementation, only displays two labels changed
+* from CHtiAdminAppUi class
+*
+*/
+
+
+#include <coemain.h>
+#include <AknUtils.h>
+#include <HtiAdmin.rsg>
+
+#include "HtiAdminAppView.h"
+#include "HtiAdminApplication.h" //logging
+
+// Standard construction sequence
+CHtiAdminAppView* CHtiAdminAppView::NewL(const TRect& aRect)
+ {
+ CHtiAdminAppView* self = CHtiAdminAppView::NewLC(aRect);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CHtiAdminAppView* CHtiAdminAppView::NewLC(const TRect& aRect)
+ {
+ CHtiAdminAppView* self = new (ELeave) CHtiAdminAppView;
+ CleanupStack::PushL(self);
+ self->ConstructL(aRect);
+ return self;
+ }
+
+CHtiAdminAppView::CHtiAdminAppView()
+ {
+ // no implementation required
+ }
+
+CHtiAdminAppView::~CHtiAdminAppView()
+ {
+ delete iHtiCaption;
+ delete iHtiStatus;
+ delete iHtiVersionCaption;
+ delete iHtiVersion;
+ delete iHtiAutoStartCaption;
+ delete iHtiAutoStartStatus;
+ delete iHtiSelectedCommCaption;
+ delete iHtiSelectedComm;
+ delete iHtiCommDetails;
+ }
+
+void CHtiAdminAppView::ConstructL(const TRect& aRect)
+ {
+ //HTI_LOG_TEXT("CHtiAdminAppView::ConstructL");
+
+ iHtiCaption = HBufC::NewL( KMaxDisplayText );
+ iHtiStatus = HBufC::NewL( KMaxDisplayText );
+ iHtiVersionCaption = HBufC::NewL( KMaxDisplayText );
+ iHtiVersion = HBufC::NewL( KMaxDisplayText );
+ iHtiAutoStartCaption = HBufC::NewL( KMaxDisplayText );
+ iHtiAutoStartStatus = HBufC::NewL( KMaxDisplayText );
+ iHtiSelectedCommCaption = HBufC::NewL( KMaxDisplayText );
+ iHtiSelectedComm = HBufC::NewL( KMaxDisplayText );
+ iHtiCommDetails = HBufC::NewL( KMaxDisplayText );
+
+ // Create a window for this application view
+ CreateWindowL();
+
+ // Set the windows size
+ SetRect(aRect);
+
+ // Activate the window, which makes it ready to be drawn
+ ActivateL();
+ }
+
+// Draw this application's view to the screen
+void CHtiAdminAppView::Draw(const TRect& /*aRect*/) const
+ {
+ // Get the standard graphics context
+ CWindowGc& gc = SystemGc();
+
+ // Gets the control's extent
+ TRect rect = Rect();
+
+ // Clears the screen
+ gc.Clear(rect);
+
+ //draw text
+ const CFont* f = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+ gc.UseFont( f );
+
+ TInt leftMargin = f->MaxNormalCharWidthInPixels() / 4;
+
+ TPoint dP( leftMargin, f->FontLineGap() );
+ gc.DrawText( *iHtiCaption, dP );
+ dP.iX += f->TextWidthInPixels( *iHtiCaption );
+ gc.DrawText( *iHtiStatus, dP );
+
+ dP.iX = leftMargin;
+ dP.iY += f->FontLineGap() * 1.5;
+ gc.DrawText( *iHtiVersionCaption, dP );
+ dP.iX += f->TextWidthInPixels( *iHtiVersionCaption );
+ gc.DrawText( *iHtiVersion, dP );
+
+ dP.iX = leftMargin;
+ dP.iY += f->FontLineGap() * 1.5;
+ gc.DrawText( *iHtiAutoStartCaption, dP );
+ dP.iX += f->TextWidthInPixels( *iHtiAutoStartCaption );
+ gc.DrawText( *iHtiAutoStartStatus, dP );
+
+ dP.iX = leftMargin;
+ dP.iY += f->FontLineGap() * 1.5;
+ gc.DrawText( *iHtiSelectedCommCaption, dP );
+ dP.iX += f->TextWidthInPixels( *iHtiSelectedCommCaption );
+ gc.DrawText( *iHtiSelectedComm, dP );
+ dP.iX = leftMargin;
+ dP.iY += f->FontLineGap();
+ gc.DrawText( *iHtiCommDetails, dP );
+ }
+
+void CHtiAdminAppView::SetCaption( const TDesC& aText )
+ {
+ iHtiCaption->Des().Copy( aText );
+ DrawDeferred();
+ }
+
+void CHtiAdminAppView::SetStatus( const TDesC& aText )
+ {
+ iHtiStatus->Des().Copy( aText );
+ DrawDeferred();
+ }
+
+void CHtiAdminAppView::SetVersionCaption( const TDesC& aText )
+ {
+ iHtiVersionCaption->Des().Copy( aText );
+ DrawDeferred();
+ }
+
+void CHtiAdminAppView::SetVersion( const TDesC& aText )
+ {
+ iHtiVersion->Des().Copy( aText );
+ DrawDeferred();
+ }
+
+void CHtiAdminAppView::SetAutoStartCaption( const TDesC& aText )
+ {
+ iHtiAutoStartCaption->Des().Copy( aText );
+ DrawDeferred();
+ }
+
+void CHtiAdminAppView::SetAutoStartStatus( const TDesC& aText )
+ {
+ iHtiAutoStartStatus->Des().Copy( aText );
+ DrawDeferred();
+ }
+
+void CHtiAdminAppView::SetSelectedCommCaption( const TDesC& aText )
+ {
+ iHtiSelectedCommCaption->Des().Copy( aText );
+ DrawDeferred();
+ }
+
+void CHtiAdminAppView::SetSelectedComm( const TDesC& aText )
+ {
+ iHtiSelectedComm->Des().Copy( aText );
+ DrawDeferred();
+ }
+
+void CHtiAdminAppView::SetCommDetails( const TDesC& aText )
+ {
+ iHtiCommDetails->Des().Copy( aText );
+ DrawDeferred();
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/src/HtiAdminApplication.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Application implemetation
+*
+*/
+
+
+#include "HtiAdminDocument.h"
+#include "HtiAdminApplication.h"
+
+// UID for the application, this should correspond to the uid defined in the mmp file
+static const TUid KUidHtiAdminApp = {0x1020DEB5};
+
+CApaDocument* CHtiAdminApplication::CreateDocumentL()
+ {
+ //HTI_LOG_TEXT("CreateDocumentL");
+ // Create an HtiAdmin document, and return a pointer to it
+ CApaDocument* document = CHtiAdminDocument::NewL(*this);
+ return document;
+ }
+
+TUid CHtiAdminApplication::AppDllUid() const
+ {
+ // Return the UID for the HtiAdmin application
+ return KUidHtiAdminApp;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/src/HtiAdminDocument.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AppDoc implemetation
+*
+*/
+
+
+#include "HtiAdminAppUi.h"
+#include "HtiAdminDocument.h"
+
+// Standard Symbian OS construction sequence
+CHtiAdminDocument* CHtiAdminDocument::NewL(CEikApplication& aApp)
+ {
+ CHtiAdminDocument* self = NewLC(aApp);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CHtiAdminDocument* CHtiAdminDocument::NewLC(CEikApplication& aApp)
+ {
+ CHtiAdminDocument* self = new (ELeave) CHtiAdminDocument(aApp);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+void CHtiAdminDocument::ConstructL()
+ {
+ // no implementation required
+ }
+
+CHtiAdminDocument::CHtiAdminDocument(CEikApplication& aApp) : CAknDocument(aApp)
+ {
+ // no implementation required
+ }
+
+CHtiAdminDocument::~CHtiAdminDocument()
+ {
+ // no implementation required
+ }
+
+CEikAppUi* CHtiAdminDocument::CreateAppUiL()
+ {
+ // Create the application user interface, and return a pointer to it,
+ // the framework takes ownership of this object
+ CEikAppUi* appUi = new (ELeave) CHtiAdminAppUi;
+ return appUi;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/HtiAdmin.pro Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,33 @@
+TEMPLATE = app
+TARGET = HtiAdmin
+DEPENDPATH += .
+INCLUDEPATH += .
+INCLUDEPATH += . /epoc32/include/mw/hb/hbcore /epoc32/include/mw/hb/hbwidgets /epoc32/include/mw/hb/hbtools
+LIBS += -lhbcore -lhbwidgets
+
+HEADERS += mainview.h
+SOURCES += main.cpp mainview.cpp
+
+symbian: {
+
+ LIBS += -lestor -lws32 -lPlatformEnv -limageconversion -leikcore -lfbscli -lapgrfx -lcommonengine -lgdi -lhticfg -lbafl -lecom -lcommdb
+
+
+ HEADERS += htienginewrapper.h chtiadminengine.h
+ SOURCES += htienginewrapper.cpp chtiadminengine.cpp
+ RSS_RULES += "group_name = \"RnD Tools\"";
+ TARGET.CAPABILITY = ALL -TCB
+ TARGET.UID2 = 0x100039CE
+
+ TARGET.UID3 = 0x1020DEB5
+
+
+ # TARGET.SID = 0x1020DEB5
+ TARGET.VID = 0x101FB657
+
+ # TARGET.EPOCHEAPSIZE = 0x020000 0x800000 // Min 128Kb, Max 16Mb
+ # TARGET.EPOCSTACKSIZE = 0x5000
+}else {
+ error("Only Symbian supported!")
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/chtiadminengine.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,903 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of HtiAdmin main.
+*
+*/
+
+#include <coecntrl.h>
+#include <w32std.h>
+#include <commdb.h>
+
+#include <HtiCfg.h>
+#include <HtiCommPluginInterface.h> // for KHTICommInterfaceUid
+
+
+#include "htienginewrapper.h"
+#include "chtiadminengine.h"
+
+
+#ifdef __ENABLE_LOGGING__
+
+#include <flogger.h>
+
+_LIT(KLogFolder, "hti");
+_LIT(KLogFile, "htiadmin.txt");
+#define HTI_LOG_TEXT(a1) {_LIT(temp, a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);}
+#define HTI_LOG_FORMAT(a1,a2) {_LIT(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, (a2));}
+#define HTI_LOG_DES(a1) {RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, (a1));}
+
+#else // __ENABLE_LOGGING__
+
+#define HTI_LOG_TEXT(a1)
+#define HTI_LOG_FORMAT(a1,a2)
+#define HTI_LOG_DES(a1)
+
+#endif // __ENABLE_LOGGING__
+
+// CONSTANTS
+_LIT( KHtiWatchDogMatchPattern, "HtiWatchDog*" );
+_LIT( KHtiFrameworkExe, "HtiFramework.exe" );
+_LIT( KHtiMatchPattern, "HtiFramework*" );
+_LIT( KHtiFrameworkCaption, "HTI status: " );
+_LIT( KHtiAutoStartCaption, "AutoStart: " );
+_LIT( KHtiVersionCaption, "Version: " );
+_LIT( KHtiSelectedCommCaption, "Communication: " );
+_LIT( KHtiAdminStartParameter, "admin" );
+_LIT( KHtiAdminVersionFormat, "%u.%u.%u (%uwk%02u)" );
+_LIT( KHtiAdminAboutVersionFormat, "Version %u.%u.%u - " );
+const static TInt KTerminateReason = 1;
+
+const TInt32 KHTIImplUidIsaComm = {0x1020DEBD};
+const TInt32 KHTIImplUidSerial = {0x10210CCA};
+const TInt32 KHTIImplUidBluetooth = {0x200212CC};
+const TInt32 KHTIImplUidIPComm = {0x200212CE};
+const TInt32 KHTIImplUidUsbSerialComm = {0x200212D0};
+const TInt32 KHTIImplUidTraceComm = {0x200212D8};
+
+// configuration file constants
+_LIT( KCfgFilePath, "\\");
+_LIT( KHtiCfg, "hti.cfg" );
+_LIT( KHtiBtCommCfg, "HTIBtComm.cfg" );
+_LIT( KHtiSerialCommCfg , "HTISerialComm.cfg" );
+_LIT( KHtiIPCommCfg, "HTIIPComm.cfg" );
+// hti.cfg
+_LIT8( KCommPlugin, "CommPlugin" );
+_LIT8( KPriority, "Priority" );
+_LIT8( KShowConsole, "ShowConsole" );
+_LIT8( KEnableHtiWatchDog, "EnableHtiWatchDog" );
+_LIT8( KEnableHtiAutoStart, "EnableHtiAutoStart" );
+_LIT8( KShowErrorDialogs, "ShowErrorDialogs" );
+// HtiBtComm.cfg
+_LIT8( KBtDeviceAddress, "BtDeviceAddress" );
+_LIT8( KBtDeviceName, "BtDeviceName" );
+// HtiSerialComm.cfg
+_LIT8( KCommPortNumber, "CommPort" );
+// HTIIPComm.cfg
+_LIT8( KLocalPort, "LocalPort" );
+_LIT8( KRemoteHost, "RemoteHost" );
+_LIT8( KRemotePort, "RemotePort" );
+_LIT8( KIAPName, "IAPName");
+
+
+// ---------------------------------------------------------------------------
+
+CHtiAdminEngine::CHtiAdminEngine()
+{
+ iIAPsArray = NULL;
+}
+
+// ---------------------------------------------------------------------------
+CHtiAdminEngine* CHtiAdminEngine::NewLC(HtiEngineWrapper *aEngineWrapper)
+ {
+ CHtiAdminEngine* self = new (ELeave) CHtiAdminEngine();
+ CleanupStack::PushL(self);
+ self->ConstructL(aEngineWrapper);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+CHtiAdminEngine* CHtiAdminEngine::NewL(HtiEngineWrapper *aEngineWrapper)
+ {
+ CHtiAdminEngine* self = CHtiAdminEngine::NewLC(aEngineWrapper);
+ CleanupStack::Pop(); // self;
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::ConstructL(HtiEngineWrapper *aEngineWrapper)
+ {
+ iEngineWrapper = aEngineWrapper;
+ iHtiCfg = CHtiCfg::NewL();
+
+ CheckStatusesL();
+ StartTimer();
+ }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::CheckStatusesL()
+ {
+ UpdateConsoleStatus();
+ UpdateWatchDogStatus();
+ UpdateAutoStartStatus();
+ UpdateSelectedComm();
+ UpdateStatusL();
+ }
+
+
+// ---------------------------------------------------------------------------
+CHtiAdminEngine::~CHtiAdminEngine()
+{
+ KillTimer();
+ delete iHtiCfg;
+ delete iPluginNameArray;
+ delete iPluginDataTypeArray;
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::StartHtiL()
+{
+
+ RProcess prs;
+ TInt err;
+ TBool isRunning = EFalse;
+ if ( OpenHtiProcess( prs ) )
+ {
+ if ( prs.ExitType() == EExitPending )
+ {
+ isRunning = ETrue;
+ iEngineWrapper->updateStatus(HtiEngineWrapper::Running);
+ }
+ prs.Close();
+ }
+
+ if ( !isRunning )
+ {
+ HTI_LOG_TEXT( "create process" );
+ err = prs.Create( KHtiFrameworkExe, KHtiAdminStartParameter );
+ if ( err == KErrNone )
+ {
+ prs.Resume();
+ prs.Close();
+ UpdateStatusL();
+ HTI_LOG_TEXT("create done");
+ }
+ else
+ {
+ iEngineWrapper->updateStatus(HtiEngineWrapper::Error);
+ HTI_LOG_TEXT("create error");
+ }
+ }
+
+}
+
+
+// ---------------------------------------------------------------------------
+
+void CHtiAdminEngine::StopHtiL()
+{
+ HTI_LOG_TEXT("Stop");
+
+ // kill the watchdog to prevent it from restarting HTI again
+ KillHtiWatchDogL();
+
+ RProcess prs;
+ if ( OpenHtiProcess( prs ) )
+ {
+ if ( prs.ExitType() == EExitPending )
+ {
+ HTI_LOG_TEXT("try to kill");
+ prs.Kill( KTerminateReason );
+ UpdateStatusL();
+ }
+ else
+ {
+ iEngineWrapper->updateStatus(HtiEngineWrapper::Stopped);
+ }
+ prs.Close();
+ }
+
+}
+
+// ---------------------------------------------------------------------------
+
+void CHtiAdminEngine::EnableBtByAddressL(const TDesC& aAddress)
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+ iHtiCfg->RemoveParameterL( KBtDeviceName );
+ iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+
+ TBuf8<KMaxParameterValueLength> value;
+ value.Copy(aAddress);
+ iHtiCfg->SetParameterL( KBtDeviceAddress, value);
+
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg);
+ UpdateSelectedComm();
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::EnableBtByNameL(const TDesC& aAddress)
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+ iHtiCfg->RemoveParameterL( KBtDeviceName );
+ iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+
+ TBuf8<KMaxParameterValueLength> value;
+ value.Copy(aAddress);
+ iHtiCfg->SetParameterL( KBtDeviceName, value);
+
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg );
+ UpdateSelectedComm();
+}
+
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::BtSearchL()
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+ iHtiCfg->RemoveParameterL( KBtDeviceName );
+ iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg );
+ UpdateSelectedComm();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::IPListenL(const TDesC& aPort, const TDesC& aIAP)
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KCommPlugin, _L8("IPCOMM"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+
+ TBuf8<KMaxParameterValueLength> port;
+ port.Copy(aPort);
+ iHtiCfg->SetParameterL( KLocalPort, port);
+
+ TBuf8<KMaxParameterValueLength> iap;
+ iap.Copy(aIAP);
+ iHtiCfg->SetParameterL(KIAPName, iap);
+
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiIPCommCfg );
+ UpdateSelectedComm();
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::IPConnectL(const TDesC& aHost, const TDesC& aPort, const TDesC& aIAP)
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KCommPlugin, _L8( "IPCOMM" ) );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+ iHtiCfg->RemoveParameterL( KLocalPort );
+
+ TBuf8<KMaxParameterValueLength> value;
+ value.Copy(aHost);
+ iHtiCfg->SetParameterL( KRemoteHost, value);
+
+ TBuf8<KMaxParameterValueLength> port;
+ port.Copy(aPort);
+ iHtiCfg->SetParameterL(KRemotePort, port);
+
+ TBuf8<KMaxParameterValueLength> iap;
+ iap.Copy(aIAP);
+ iHtiCfg->SetParameterL(KIAPName, iap);
+
+ iHtiCfg->SaveCfgL(KCfgFilePath, KHtiIPCommCfg);
+ UpdateSelectedComm();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::EnableSerialL(const TDesC& aComPortNumber)
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KCommPlugin, _L8( "SERIAL" ) );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+ TBuf8<KMaxParameterValueLength> value;
+ value.Copy(aComPortNumber);
+ iHtiCfg->SetParameterL( KCommPortNumber, value );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiSerialCommCfg );
+ UpdateSelectedComm();
+}
+
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::EnableOtherCommL(const TDesC& aSelectedPluginName)
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+
+ TInt namePosition;
+ iPluginNameArray->Find(aSelectedPluginName, namePosition);
+
+ //Save correct data type for selected plugin
+ iHtiCfg->SetParameterL( KCommPlugin, iPluginDataTypeArray->MdcaPoint(namePosition) );
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ UpdateSelectedComm();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetPriorityBackgroundL()
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KPriority, _L8("1"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetPriorityForegroundL()
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KPriority, _L8("2"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetPriorityHighL()
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KPriority, _L8("3"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetPriorityAbsoluteHighL()
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ iHtiCfg->SetParameterL( KPriority, _L8("4"));
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::AutoStartEnableL(TBool aEnableAutoStart)
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ if(aEnableAutoStart)
+ {
+ iHtiCfg->SetParameterL( KEnableHtiAutoStart, _L8("1"));
+ }
+ else
+ {
+ iHtiCfg->SetParameterL( KEnableHtiAutoStart, _L8("0"));
+ }
+
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ UpdateAutoStartStatus();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::WatchDogEnableL(TBool aEnableWDog)
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+
+ if(aEnableWDog)
+ {
+ iHtiCfg->SetParameterL( KEnableHtiWatchDog, _L8("1"));
+ }
+ else
+ {
+ iHtiCfg->SetParameterL( KEnableHtiWatchDog, _L8("0"));
+ }
+
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ UpdateWatchDogStatus();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::ConsoleEnableL(TBool aEnableConsole)
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+
+ if(aEnableConsole)
+ {
+ iHtiCfg->SetParameterL( KShowConsole, _L8("1"));
+ }
+ else
+ {
+ iHtiCfg->SetParameterL( KShowConsole, _L8("0"));
+ }
+
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+ UpdateConsoleStatus();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::ErrorDialogsEnableL(TBool aEnableErrorDialogs)
+{
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+
+ if(aEnableErrorDialogs)
+ {
+ iHtiCfg->SetParameterL( KShowErrorDialogs, _L8("1"));
+ }
+ else
+ {
+ iHtiCfg->SetParameterL( KShowErrorDialogs, _L8("0"));
+ }
+
+ iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetHtiCfgParamL(const TDesC& aParamName, const TDesC& aParamValue)
+{
+ SetCfgParamL(aParamName, aParamValue, KHtiCfg);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetBtCfgParamL(const TDesC& aParamName, const TDesC& aParamValue)
+{
+ SetCfgParamL(aParamName, aParamValue, KHtiBtCommCfg);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetSerialCfgParamL(const TDesC& aParamName, const TDesC& aParamValue)
+{
+ SetCfgParamL(aParamName, aParamValue, KHtiSerialCommCfg);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetIPCfgParamL(const TDesC& aParamName, const TDesC& aParamValue)
+{
+ SetCfgParamL(aParamName, aParamValue, KHtiIPCommCfg);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetCfgParamL(const TDesC& aParamName, const TDesC& aParamValue, const TDesC& aFileName)
+{
+ TBuf8<KMaxParameterNameLength> name;
+ name.Copy(aParamName);
+
+ TBuf8<KMaxParameterValueLength> value;
+ value.Copy(aParamValue);
+
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, aFileName ) );
+
+ iHtiCfg->SetParameterL( name, value );
+ iHtiCfg->SaveCfgL( KCfgFilePath, aFileName);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetHtiCfgParamL(const TDesC& aParamName, TDes& aParamValue)
+ {
+ GetCfgParamL(aParamName, aParamValue, KHtiCfg);
+ }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetBtCfgParamL(const TDesC& aParamName, TDes& aParamValue)
+ {
+ GetCfgParamL(aParamName, aParamValue, KHtiBtCommCfg);
+ }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetSerialCfgParamL(const TDesC& aParamName, TDes& aParamValue)
+ {
+ GetCfgParamL(aParamName, aParamValue, KHtiSerialCommCfg);
+ }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetIPCfgParamL(const TDesC& aParamName, TDes& aParamValue)
+ {
+ GetCfgParamL(aParamName, aParamValue, KHtiIPCommCfg);
+ }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetCfgParamL(const TDesC& aParamName, TDes& aParamValue, const TDesC& aFileName)
+ {
+ TBuf8<KMaxParameterNameLength> name;
+ name.Copy(aParamName);
+
+ TBuf<KMaxParameterValueLength> value;
+
+ TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, aFileName ) );
+ aParamValue.Copy(iHtiCfg->GetParameterL(name));
+ }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetSelectedComm(TDes& aPluginName)
+ {
+ TBuf8<KMaxParameterValueLength> commValue;
+ TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ if ( !err )
+ {
+ TRAP( err, commValue = iHtiCfg->GetParameterL( KCommPlugin ) );
+ }
+ // Use default if not found from config
+ if ( commValue.Length() == 0 )
+ {
+ commValue.Copy(KCommDefaultImplementation );
+ }
+ TInt typePosition;
+ iPluginDataTypeArray->Find(commValue, typePosition);
+ aPluginName.Copy(iPluginNameArray->MdcaPoint(typePosition));
+ }
+
+// ---------------------------------------------------------------------------
+TBool CHtiAdminEngine::OpenHtiProcess( RProcess& aPrs )
+{
+ HTI_LOG_TEXT( "OpenHtiProcess" );
+
+ TFullName processName;
+ TInt err;
+
+ TFindProcess finder( KHtiMatchPattern );
+ err = finder.Next( processName );
+ if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "try to open..." );
+ err = aPrs.Open( finder );
+ HTI_LOG_TEXT( "opened" );
+
+ if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "OpenHtiProcess OK" );
+ return ETrue;
+ }
+ else
+ {
+ iEngineWrapper->updateStatus(HtiEngineWrapper::Error);
+ }
+ }
+ else if ( err == KErrNotFound )
+ {
+ iEngineWrapper->updateStatus(HtiEngineWrapper::Stopped);
+ }
+ else
+ {
+ iEngineWrapper->updateStatus(HtiEngineWrapper::Error);
+ }
+
+ HTI_LOG_TEXT( "OpenHtiProcess NOK" );
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateStatusL()
+ {
+ HTI_LOG_TEXT( "UpdateStatusL" );
+ RProcess prs;
+ if ( OpenHtiProcess( prs ) )
+ {
+ HTI_LOG_TEXT( "Update display" );
+ TExitType exT = prs.ExitType();
+
+ switch ( exT )
+ {
+ case EExitPending:
+ {
+ iEngineWrapper->updateStatus(HtiEngineWrapper::Running);
+ }
+ break;
+
+ case EExitKill:
+ case EExitTerminate:
+ {
+ iEngineWrapper->updateStatus(HtiEngineWrapper::Stopped);
+ }
+ break;
+
+ case EExitPanic:
+ {
+ iEngineWrapper->updateStatus(HtiEngineWrapper::Panic);
+ }
+ break;
+ };
+ prs.Close();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::KillHtiWatchDogL()
+ {
+ TFullName processName;
+ TFindProcess finder( KHtiWatchDogMatchPattern );
+ TInt err = finder.Next( processName );
+ if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "HTI watchdog process found. Trying to open and kill it..." );
+ RProcess prs;
+ User::LeaveIfError( prs.Open( finder ) );
+ prs.Kill( KTerminateReason );
+ prs.Close();
+ HTI_LOG_TEXT( "HTI watchdog killed" );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::StartTimer()
+ {
+ // start timer to watch the status
+ if ( !iPeriodic )
+ {
+ iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle );
+ iPeriodic->Start( 1 * 1000 * 1000,
+ 10 * 1000 * 1000,
+ TCallBack( TimerCallBackL, this ) );
+ }
+ }
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::KillTimer()
+ {
+ if ( iPeriodic )
+ {
+ iPeriodic->Cancel();
+ delete iPeriodic;
+ iPeriodic = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+TInt CHtiAdminEngine::TimerCallBackL( TAny* aPtr )
+ {
+ ( (CHtiAdminEngine*)aPtr )->UpdateStatusL();
+ return ETrue;
+ }
+
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateAutoStartStatus()
+ {
+ HTI_LOG_TEXT( "UpdateAutoStartStatus" );
+ TInt value = KErrNotFound;
+ TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ if ( !err )
+ {
+ TRAP( err, value = iHtiCfg->GetParameterIntL(KEnableHtiAutoStart) );
+ }
+
+ if ( value == KErrNotFound )
+ {
+ // Use default values if not found from config.
+#ifdef __WINS__
+ value = 0;
+#else
+ value = 1;
+#endif
+ }
+
+ if ( value == 0 )
+ {
+ iEngineWrapper->updateAutostartStatus( HtiEngineWrapper::AutoStartDisabled );
+ }
+ else if ( value == 1 )
+ {
+ iEngineWrapper->updateAutostartStatus( HtiEngineWrapper::AutoStartEnabled );
+ }
+ else
+ {
+ iEngineWrapper->updateAutostartStatus( HtiEngineWrapper::AutoStartUnknown );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateConsoleStatus()
+ {
+ HTI_LOG_TEXT( "UpdateConsoleStatus" );
+ TInt value = KErrNotFound;
+ TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ if(!err)
+ {
+ TRAP( err, value = iHtiCfg->GetParameterIntL(KShowConsole) );
+ }
+
+ if ( value == KErrNotFound )
+ {
+ value = 0;
+ }
+
+ iEngineWrapper->updateConsoleStatus(value);
+ }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateWatchDogStatus()
+ {
+ HTI_LOG_TEXT( "UpdateWatchDogStatus" );
+ TInt value = KErrNotFound;
+ TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ if(!err)
+ {
+ TRAP( err, value = iHtiCfg->GetParameterIntL(KEnableHtiWatchDog) );
+ }
+
+ if ( value == KErrNotFound )
+ {
+ value = 0;
+ }
+
+ iEngineWrapper->updateWatchDogStatus(value);
+ }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateSelectedComm()
+ {
+ HTI_LOG_TEXT( "UpdateSelectedComm" );
+ TBuf<64> commPlugin;
+ TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+ if ( !err )
+ {
+ TBuf8<KMaxParameterValueLength> commValue;
+ TRAP( err, commValue = iHtiCfg->GetParameterL( KCommPlugin ) );
+ if ( err == KErrNone )
+ {
+ commPlugin.Copy( commValue );
+ }
+ }
+ // Use default if not found from config
+ if ( commPlugin.Length() == 0 )
+ {
+ commPlugin.Copy(KCommDefaultImplementation );
+ }
+ iEngineWrapper->updateSelectedComm( commPlugin );
+
+ if ( commPlugin.Compare( _L( "SERIAL" ) ) == 0 )
+ {
+ TInt portNum = 0;
+ TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiSerialCommCfg ) );
+ if ( err == KErrNone )
+ {
+ TRAP( err, portNum = iHtiCfg->GetParameterIntL( KCommPortNumber ) );
+ }
+ TBuf<16> portBuf;
+ portBuf.Copy( _L( "Port: " ) );
+ portBuf.AppendNum( portNum );
+ iEngineWrapper->updateCommDetails( portBuf );
+ }
+
+ else if ( commPlugin.Compare( _L( "BTSERIAL" ) ) == 0 )
+ {
+ TBuf<64> hostBuf;
+ TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+ if ( err == KErrNone )
+ {
+ TBuf8<KMaxParameterValueLength> hostValue;
+ TRAP( err, hostValue = iHtiCfg->GetParameterL( KBtDeviceAddress ) );
+ if ( err != KErrNone )
+ {
+ TRAP( err, hostValue = iHtiCfg->GetParameterL( KBtDeviceName ) );
+ }
+ if ( err == KErrNone )
+ {
+ hostBuf.Copy( hostValue );
+ }
+ }
+ if ( hostBuf.Length() > 0 )
+ {
+ hostBuf.Insert( 0, _L( "Host: " ) );
+ }
+ iEngineWrapper->updateCommDetails(hostBuf);
+ }
+
+ else if ( commPlugin.Compare( _L( "IPCOMM" ) ) == 0 )
+ {
+ TBuf<128> hostBuf;
+ TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+ if ( err == KErrNone )
+ {
+ TInt localPort = 0;
+ TRAP( err, localPort = iHtiCfg->GetParameterIntL( KLocalPort ) );
+ if ( err == KErrNone && localPort > 0 )
+ {
+ hostBuf.Copy( _L( "Listen: " ) );
+ hostBuf.AppendNum( localPort );
+ }
+ else
+ {
+ TBuf8<KMaxParameterValueLength> remoteHost;
+ TInt remotePort = 0;
+ TRAP( err, remoteHost = iHtiCfg->GetParameterL( KRemoteHost ) );
+ if ( err == KErrNone )
+ {
+ TRAP( err, remotePort = iHtiCfg->GetParameterIntL(
+ KRemotePort ) );
+ }
+ if ( err == KErrNone )
+ {
+ hostBuf.Copy( remoteHost );
+ hostBuf.Insert( 0, _L("Connect: " ) );
+ hostBuf.Append( ':' );
+ hostBuf.AppendNum( remotePort );
+ }
+ else
+ {
+ hostBuf.Copy( _L( "Invalid config!" ) );
+ }
+ }
+ }
+ iEngineWrapper->updateCommDetails(hostBuf);
+ }
+
+ else
+ {
+ iEngineWrapper->updateCommDetails(KNullDesC);
+ }
+ }
+
+// ---------------------------------------------------------------------------
+void CleanupRArray( TAny* object )
+ {
+ ( ( RImplInfoPtrArray* ) object )->ResetAndDestroy();
+ }
+
+// ---------------------------------------------------------------------------
+CDesCArray* CHtiAdminEngine::SearchCommPluginsL()
+ {
+ const TInt pluginNameArrayGranularity (15);
+ iPluginNameArray = new (ELeave) CDesCArrayFlat(pluginNameArrayGranularity);
+ iPluginDataTypeArray = new (ELeave) CDesC8ArrayFlat(pluginNameArrayGranularity);
+
+ RImplInfoPtrArray implInfoArray;
+ CleanupStack::PushL( TCleanupItem( CleanupRArray, &implInfoArray ) );
+
+ REComSession::ListImplementationsL( KHTICommInterfaceUid, implInfoArray );
+
+ for ( TInt i = 0; i < implInfoArray.Count(); ++i )
+ {
+ iPluginNameArray->AppendL(implInfoArray[i]->DisplayName());
+ iPluginDataTypeArray->AppendL(implInfoArray[i]->DataType());
+ }
+
+ CleanupStack::PopAndDestroy(); //implInfoArray
+
+ return iPluginNameArray;
+ }
+
+// ---------------------------------------------------------------------------
+CDesCArray* CHtiAdminEngine::SearchIAPsL()
+ {
+ if(iIAPsArray)
+ {
+ return iIAPsArray;
+ }
+
+ TBuf<KMaxParameterValueLength> name;
+ const TInt arrayGranularity (10);
+ iIAPsArray = new (ELeave) CDesCArrayFlat(arrayGranularity);
+
+ // Get IAP names from the database
+ CCommsDatabase* db = CCommsDatabase::NewL(EDatabaseTypeIAP);;
+ CleanupStack::PushL(db);
+ db->ShowHiddenRecords();
+ CCommsDbTableView* view = db->OpenTableLC(TPtrC(IAP));
+ TInt res = view->GotoFirstRecord();
+
+ while(res == KErrNone)
+ {
+ view->ReadTextL(TPtrC(COMMDB_NAME), name);
+ iIAPsArray->InsertL(0, name);
+ res = view->GotoNextRecord();
+ }
+
+ CleanupStack::PopAndDestroy(view); //view
+ CleanupStack::PopAndDestroy(db); //db
+
+ return iIAPsArray;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/chtiadminengine.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of HtiAdmin main.
+*
+*/
+
+#ifndef CHTIADMINENGINE_H
+#define CHTIADMINENGINE_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include <badesca.h>
+
+
+class HtiEngineWrapper;
+class CPeriodic;
+class CHtiCfg;
+
+
+class CHtiAdminEngine : public CBase
+ {
+ public:
+
+ /**
+ * Constructor
+ */
+ CHtiAdminEngine();
+
+ /**
+ * Destructor
+ */
+ ~CHtiAdminEngine();
+
+ /**
+ * Two-phased constructor.
+ */
+ static CHtiAdminEngine* NewL(HtiEngineWrapper *aEngineWrapper);
+
+ /**
+ * Two-phased constructor.
+ */
+ static CHtiAdminEngine* NewLC(HtiEngineWrapper *aEngineWrapper);
+
+ void StartHtiL();
+
+ void StopHtiL();
+
+ void EnableBtByAddressL(const TDesC& aAddress);
+
+ void EnableBtByNameL(const TDesC& aAddress);
+
+ void BtSearchL();
+
+ void IPListenL(const TDesC& aPort, const TDesC& aIAP);
+
+ void IPConnectL(const TDesC& aHost, const TDesC& aPort, const TDesC& aIAP);
+
+ void EnableSerialL(const TDesC& aComPortNumber);
+
+ void EnableOtherCommL(const TDesC& aSelectedPluginName);
+
+ void SetPriorityBackgroundL();
+
+ void SetPriorityForegroundL();
+
+ void SetPriorityHighL();
+
+ void SetPriorityAbsoluteHighL();
+
+ void AutoStartEnableL(TBool aEnableAutoStart);
+
+ void ConsoleEnableL(TBool aEnableConsole);
+
+ void ErrorDialogsEnableL(TBool aEnableErrorDialogs);
+
+ void SetHtiCfgParamL(const TDesC& aParamName, const TDesC& aParamValue);
+ void GetHtiCfgParamL(const TDesC& aParamName, TDes& aParamValue);
+
+ void SetBtCfgParamL(const TDesC& aParamName, const TDesC& aParamValue);
+ void GetBtCfgParamL(const TDesC& aParamName, TDes& aParamValue);
+
+ void SetSerialCfgParamL(const TDesC& aParamName, const TDesC& aParamValue);
+ void GetSerialCfgParamL(const TDesC& aParamName, TDes& aParamValue);
+
+ void SetIPCfgParamL(const TDesC& aParamName, const TDesC& aParamValue);
+ void GetIPCfgParamL(const TDesC& aParamName, TDes& aParamValue);
+
+ void GetSelectedComm(TDes& aPluginName);
+
+ void CheckStatusesL();
+
+ CDesCArray* SearchCommPluginsL();
+
+ CDesCArray* SearchIAPsL();
+
+ void CHtiAdminEngine::WatchDogEnableL(TBool aEnableWDog);
+
+ /**
+ * Kills the HtiWatchDog process if it is running.
+ */
+ void KillHtiWatchDogL();
+
+ /**
+ * Stops the timer issuing the periodical HTI Framework process
+ * status checks.
+ */
+ void KillTimer();
+
+ /**
+ * The method called by the periodic timer.
+ * @param aPtr pointer to this CHtiAdminAppUi instance
+ * @return zero if the callback function should not be called again,
+ * otherwise non-zero. Current implementation returns always ETrue.
+ */
+ static TInt TimerCallBackL( TAny* aPtr );
+
+ /**
+ * Tries to find the HTIFramework.exe process and open a handle to it.
+ * @param aPrs on return contains an open handle to the HTIFramework.exe
+ * process if process found and opened successfully
+ * @return ETrue if process found and opened successfully,
+ * otherwise EFalse
+ */
+ TBool OpenHtiProcess( RProcess& aPrs );
+
+ /**
+ * Updates the HTI Framework process status in the display.
+ */
+ void UpdateStatusL();
+
+ /**
+ * Updates the HTI auto start status in the display.
+ */
+ void UpdateAutoStartStatus();
+
+
+ void UpdateConsoleStatus();
+
+ void UpdateWatchDogStatus();
+
+ /**
+ * Updates the selected communication in the display.
+ */
+ void UpdateSelectedComm();
+
+ private:
+ void ConstructL(HtiEngineWrapper *aEngineWrapper);
+
+ void SetCfgParamL(const TDesC& aParamName, const TDesC& aParamValue, const TDesC& aFileName);
+ void GetCfgParamL(const TDesC& aParamName, TDes& aParamValue, const TDesC& aFileName);
+
+ void StartTimer();
+
+ private:
+ // Enginewrapper that is used for communicating between QT and Symbian
+ HtiEngineWrapper* iEngineWrapper;
+
+ // Timer triggering periodic checking of HTIFramework process status
+ CPeriodic* iPeriodic;
+
+ // For reading and writing HTI configuration files
+ CHtiCfg* iHtiCfg;
+
+ CDesCArrayFlat* iPluginNameArray;
+
+ CDesC8ArrayFlat* iPluginDataTypeArray;
+
+ CDesCArrayFlat* iIAPsArray;
+
+
+ };
+
+#endif //CHTIADMINENGINE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/htienginewrapper.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,563 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of HtiAdmin main.
+*
+*/
+
+
+#include "htienginewrapper.h"
+#include "chtiadminengine.h"
+
+#include <coecntrl.h>
+#include <QString>
+#include <qlocale.h>
+
+
+#include <HtiVersion.h>
+
+
+
+// ---------------------------------------------------------------------------
+
+HtiEngineWrapper::HtiEngineWrapper():
+ iEngine(0)
+{
+}
+// ---------------------------------------------------------------------------
+HtiEngineWrapper::~HtiEngineWrapper()
+{
+ delete iEngine;
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::init()
+{
+ TRAPD(error, iEngine = CHtiAdminEngine::NewL(this));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::startHti()
+{
+ TRAPD(error, iEngine->StartHtiL());
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::stopHti()
+{
+ TRAPD(error, iEngine->StopHtiL());
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::enableBtByAddress(QString& address)
+{
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedAddress(address.utf16());
+
+
+ TRAPD(error, iEngine->EnableBtByAddressL(convertedAddress));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::ipListen(QString& port, QString& iap)
+{
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedPort(port.utf16());
+ TBuf<64> convertedIAP(iap.utf16());
+
+ TRAPD(error, iEngine->IPListenL(convertedPort, convertedIAP));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::ipConnect(QString& host, QString& port, QString& iap)
+{
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedHostAddress(host.utf16());
+ TBuf<64> convertedPort(port.utf16());
+ TBuf<64> convertedIAP(iap.utf16());
+
+ TRAPD(error, iEngine->IPConnectL(convertedHostAddress, convertedPort, convertedIAP));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::enableBtByName(QString& address)
+ {
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedAddress(address.utf16());
+
+
+ TRAPD(error, iEngine->EnableBtByNameL(convertedAddress));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::btSearch()
+ {
+ TRAPD(error, iEngine->BtSearchL());
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::enableSerial(QString& commPort)
+{
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedText(commPort.utf16());
+
+ TRAPD(error, iEngine->EnableSerialL(convertedText));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::enableOtherComm(QString& pluginName)
+ {
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedText(pluginName.utf16());
+
+ TRAPD(error, iEngine->EnableOtherCommL(convertedText));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setPriorityBackground()
+ {
+ TRAPD(error, iEngine->SetPriorityBackgroundL());
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setPriorityForeground()
+ {
+ TRAPD(error, iEngine->SetPriorityForegroundL());
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setPriorityHigh()
+ {
+ TRAPD(error, iEngine->SetPriorityHighL());
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setPriorityAbsoluteHigh()
+ {
+ TRAPD(error, iEngine->SetPriorityAbsoluteHighL());
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::watchDogEnable(bool enable)
+ {
+ TRAPD(error, iEngine->WatchDogEnableL(enable));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::autoStartEnable(bool enable)
+ {
+ TRAPD(error, iEngine->AutoStartEnableL(enable));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::consoleEnable(bool enable)
+ {
+ TRAPD(error, iEngine->ConsoleEnableL(enable));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::errorDialogsEnable(bool enable)
+ {
+ TRAPD(error, iEngine->ErrorDialogsEnableL(enable));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setHtiCfgParam(QString& paramName, QString& paramValue)
+{
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedName(paramName.utf16());
+ TBuf<64> convertedValue(paramValue.utf16());
+
+ TRAPD(error, iEngine->SetHtiCfgParamL(convertedName, convertedValue));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getHtiCfgParam(QString& paramName, QString& paramValue)
+{
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedName(paramName.utf16());
+ TBuf<64> value;
+
+ TRAPD(error, iEngine->GetHtiCfgParamL(convertedName, value));
+
+ paramValue = QString((QChar*)value.Ptr(),value.Length());
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setBtCfgParam(QString& paramName, QString& paramValue)
+{
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedName(paramName.utf16());
+ TBuf<64> convertedValue(paramValue.utf16());
+
+ TRAPD(error, iEngine->SetBtCfgParamL(convertedName, convertedValue));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getBtCfgParam(QString& paramName, QString& paramValue)
+{
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedName(paramName.utf16());
+ TBuf<64> value;
+
+ TRAPD(error, iEngine->GetBtCfgParamL(convertedName, value));
+ paramValue = QString((QChar*)value.Ptr(),value.Length());
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setSerialCfgParam(QString& paramName, QString& paramValue)
+{
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedName(paramName.utf16());
+ TBuf<64> convertedValue(paramValue.utf16());
+
+ TRAPD(error, iEngine->SetSerialCfgParamL(convertedName, convertedValue));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getSerialCfgParam(QString& paramName, QString& paramValue)
+{
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedName(paramName.utf16());
+ TBuf<64> value;
+
+ TRAPD(error, iEngine->GetSerialCfgParamL(convertedName, value));
+ paramValue = QString((QChar*)value.Ptr(),value.Length());
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setIPCfgParam(QString& paramName, QString& paramValue)
+{
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedName(paramName.utf16());
+ TBuf<64> convertedValue(paramValue.utf16());
+
+ TRAPD(error, iEngine->SetIPCfgParamL(convertedName, convertedValue));
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getIPCfgParam(QString& paramName, QString& paramValue)
+{
+ // A conversion between a TBuf and QString is needed here.
+ TBuf<64> convertedName(paramName.utf16());
+ TBuf<64> value;
+
+ TRAPD(error, iEngine->GetIPCfgParamL(convertedName, value));
+ paramValue = QString((QChar*)value.Ptr(),value.Length());
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::getVersionIfo(QString& version)
+{
+ version= QString("%1.%2.%3 (%4 wk%5)")
+ .arg(KHtiVersionMajor).arg(KHtiVersionMinor).arg(KHtiVersionBuild)
+ .arg(KHtiVersionYear).arg(KHtiVersionWeek);
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::updateStatuses()
+{
+ TRAPD(error, iEngine->CheckStatusesL());
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::updateStatus(HtiStatus status)
+{
+ emit statusChanged(status);
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::updateSelectedComm(const TDesC& aText)
+{
+ iSelectedCommText = QString((QChar*)aText.Ptr(),aText.Length());
+
+ emit commSet(iSelectedCommText);
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::updateCommDetails(const TDesC& aText)
+{
+ iCommDetailsText = QString((QChar*)aText.Ptr(),aText.Length());
+
+ emit commDetails(iCommDetailsText);
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::updateAutostartStatus(AutoStartStatus status)
+{
+ emit autostartSet(status);
+}
+
+void HtiEngineWrapper::updateConsoleStatus(bool bEnabled)
+{
+ emit consoleSet(bEnabled);
+}
+
+void HtiEngineWrapper::updateWatchDogStatus(bool bEnabled)
+{
+ emit watchDogSet(bEnabled);
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::listCommPlugins()
+{
+ CDesCArray* pluginsArray = NULL;
+
+ TRAPD(error, pluginsArray = iEngine->SearchCommPluginsL());
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ for(TInt i = 0; i < pluginsArray->Count(); ++i)
+ {
+ TPtrC16 plugin (pluginsArray->MdcaPoint(i));
+ int len = pluginsArray->MdcaPoint(i).Length();
+
+ QString name ((QChar*)plugin.Ptr(), len);
+ iPluginNames << name;
+ }
+
+ emit commPluginsRetrieved(iPluginNames);
+
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::listIAPs(QStringList& list)
+{
+ CDesCArray* arrayIAPs = NULL;
+
+ TRAPD(error, arrayIAPs = iEngine->SearchIAPsL());
+
+ if (error != KErrNone) {
+ return false;
+ }
+ else {
+ for(TInt i = 0; i < arrayIAPs->Count(); ++i)
+ {
+ TPtrC16 iap (arrayIAPs->MdcaPoint(i));
+ int len = arrayIAPs->MdcaPoint(i).Length();
+
+ QString name ((QChar*)iap.Ptr(), len);
+ list << name;
+ }
+
+ return true;
+ }
+ return true;
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getSelectedComm(QString& commName)
+{
+ TBuf<64> pluginName;
+ iEngine->GetSelectedComm(pluginName);
+ commName = QString((QChar*)pluginName.Ptr(), pluginName.Length());
+ return true;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/htienginewrapper.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of HtiAdmin main.
+*
+*/
+
+#ifndef HTIENGINEWRAPPER_H
+#define HTIENGINEWRAPPER_H
+
+#include <e32cmn.h>
+#include <qobject.h>
+#include <qstringlist.h>
+
+class CHtiAdminEngine;
+class QString;
+
+
+
+
+/**
+ * class that is used for communicating between Symbian and Qt code.
+ */
+class HtiEngineWrapper : public QObject
+ {
+ Q_OBJECT
+public:
+ enum AutoStartStatus{
+ AutoStartDisabled,
+ AutoStartEnabled,
+ AutoStartUnknown
+ };
+
+ enum HtiStatus{
+ Running,
+ Stopped,
+ Panic,
+ Error
+ };
+
+ /**
+ * Constructor
+ */
+ HtiEngineWrapper();
+
+ /**
+ * Destructor
+ */
+ ~HtiEngineWrapper();
+
+
+ bool init();
+ bool stopHti();
+ bool startHti();
+ bool enableBtByAddress(QString& address);
+ bool enableBtByName(QString& address);
+ bool ipListen(QString& port, QString& iap);
+ bool ipConnect(QString& host, QString& port, QString& iap);
+ bool enableSerial(QString& commPort);
+ bool btSearch();
+ bool enableOtherComm(QString& pluginName);
+ bool setPriorityBackground();
+ bool setPriorityForeground();
+ bool setPriorityHigh();
+ bool setPriorityAbsoluteHigh();
+ bool watchDogEnable(bool enable);
+ bool autoStartEnable(bool enable);
+ bool consoleEnable(bool enable);
+ bool errorDialogsEnable(bool enable);
+ bool setHtiCfgParam(QString& paramName, QString& paramValue);
+ bool getHtiCfgParam(QString& paramName, QString& paramValue);
+ bool setBtCfgParam(QString& paramName, QString& paramValue);
+ bool getBtCfgParam(QString& paramName, QString& paramValue);
+ bool setSerialCfgParam(QString& paramName, QString& paramValue);
+ bool getSerialCfgParam(QString& paramName, QString& paramValue);
+ bool setIPCfgParam(QString& paramName, QString& paramValue);
+ bool getIPCfgParam(QString& paramName, QString& paramValue);
+ void getVersionIfo(QString& version);
+ bool updateStatuses();
+ bool listCommPlugins();
+ bool listIAPs(QStringList& list);
+ bool getSelectedComm(QString& commName);
+
+ //Called from engine side
+ void updateStatus(HtiStatus status);
+ void updateSelectedComm(const TDesC& aText);
+ void updateAutostartStatus(AutoStartStatus status);
+ void updateConsoleStatus(bool bEnabled);
+ void updateWatchDogStatus(bool bEnabled);
+ void updateCommDetails(const TDesC& aText);
+
+
+
+signals:
+ void statusChanged(HtiEngineWrapper::HtiStatus status);
+ void commSet(QString& statusText);
+ void commDetails(QString& statusText);
+ void commPluginsRetrieved(QStringList& pluginNames);
+ void autostartSet(HtiEngineWrapper::AutoStartStatus status);
+ void consoleSet(bool enabled);
+ void watchDogSet(bool enabled);
+
+private:
+ CHtiAdminEngine* iEngine;
+ QString iSelectedCommText;
+ QString iCommDetailsText;
+ QStringList iPluginNames;
+
+ };
+
+#endif //HTIENGINEWRAPPER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/main.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of HtiAdmin main.
+*
+*/
+
+#include <hbmainwindow.h>
+//#include <hbview.h>
+#include <coecntrl.h>
+#include <hbapplication.h>
+
+
+#include "mainview.h"
+#include "htienginewrapper.h"
+
+
+
+
+
+int main(int argc, char *argv[])
+{
+ // Initialization
+ HbApplication app(argc, argv);
+
+ // Create HtiEngineWrapper
+ HtiEngineWrapper engineWrapper;
+
+ if (!engineWrapper.init()) {
+ return EXIT_FAILURE;
+ }
+
+ // Main window widget.
+ // Includes decorators such as signal strength and battery life indicator.
+ HbMainWindow mainWindow;
+
+ //Create main view
+ MainView* view = new MainView(mainWindow, engineWrapper);
+
+ //initialize main view
+ view->init(app);
+
+ // Add View to main window and reveal it.
+ mainWindow.addView(view);
+
+ // Show widget
+ //mainWindow.show();
+ mainWindow.showFullScreen();
+
+ int result = app.exec();
+
+ return result;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/mainview.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,726 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of HtiAdmin main.
+*
+*/
+
+
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+#include <hbmenu.h>
+#include <hbaction.h>
+#include <hblabel.h>
+#include <hbinputdialog.h>
+#include <qgraphicslinearlayout.h>
+#include <hbselectiondialog.h>
+#include <hbmessagebox.h>
+
+
+
+#include "htienginewrapper.h"
+#include "mainview.h"
+#include "hbtoolbar.h"
+
+// ---------------------------------------------------------------------------
+
+MainView::MainView(HbMainWindow &mainWindow, HtiEngineWrapper& engineWrapper):
+ mMainWindow(mainWindow),
+ mEngineWrapper(engineWrapper)
+{
+}
+
+// ---------------------------------------------------------------------------
+
+MainView::~MainView()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+
+void MainView::init(HbApplication &app)
+{
+ this->setTitle("Hti Admin");
+ createToolbar();
+ createMenu(app);
+ createTexts();
+
+ mEngineWrapper.updateStatuses();
+
+ QString version;
+ mEngineWrapper.getVersionIfo(version);
+ mEngineWrapper.listCommPlugins();
+
+ mHtiVersionTxt->setPlainText("Hti Version: " + version);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::createMenu(HbApplication& app)
+{
+
+ HbMenu* menu = new HbMenu();
+
+ if (menu != NULL) {
+
+ mActionExit = menu->addAction("Exit");
+ connect(mActionExit, SIGNAL(triggered()), &app, SLOT( quit() ) );
+
+ connect(mActionStartHti, SIGNAL(triggered()), this, SLOT( startHti() ) );
+ connect(mActionStopHti, SIGNAL(triggered()), this, SLOT( stopHti() ) );
+
+ mActionSelectComm = menu->addAction("Select Communication");
+ connect(mActionSelectComm, SIGNAL(triggered()), this, SLOT( enableComm() ) );
+
+ mActionSetPriority = menu->addAction("Set Priority");
+ connect(mActionSetPriority, SIGNAL(triggered()), this, SLOT( setPriority() ) );
+
+ mActionEnableAuto = menu->addAction("Enable Auto Start");
+ connect(mActionEnableAuto, SIGNAL(triggered()), this, SLOT( enableAutoStart() ) );
+
+ mActionDisableAuto = menu->addAction("Disable Auto Start");
+ connect(mActionDisableAuto, SIGNAL(triggered()), this, SLOT( disableAutoStart() ) );
+
+ mActionEnableWdog = menu->addAction("Enable Watchdog");
+ connect(mActionEnableWdog, SIGNAL(triggered()), this, SLOT( enableWatchdog() ) );
+
+ mActionDisableWdog = menu->addAction("Disable Watchdog");
+ connect(mActionDisableWdog, SIGNAL(triggered()), this, SLOT( disableWatchdog() ) );
+
+ mActionEnableConsole = menu->addAction("Enable Console");
+ connect(mActionEnableConsole, SIGNAL(triggered()), this, SLOT( enableConsole() ) );
+
+ mActionDisableConsole = menu->addAction("Disable Console");
+ connect(mActionDisableConsole, SIGNAL(triggered()), this, SLOT( disableConsole() ) );
+
+ mActionSetParameter = menu->addAction("Set Parameter");
+ connect(mActionSetParameter, SIGNAL(triggered()), this, SLOT( showParamList() ) );
+
+ this->setMenu(menu);
+ }
+
+
+ connect(&mEngineWrapper, SIGNAL(statusChanged(HtiEngineWrapper::HtiStatus)), this, SLOT(htiStatusChanged(HtiEngineWrapper::HtiStatus)));
+ connect(&mEngineWrapper, SIGNAL(commSet(QString&)), this, SLOT(commStatusChanged(QString&)));
+ connect(&mEngineWrapper, SIGNAL(commDetails(QString&)), this, SLOT(commDetailsChanged(QString&)));
+ connect(&mEngineWrapper, SIGNAL(autostartSet(HtiEngineWrapper::AutoStartStatus)), this, SLOT(autostartStatusChanged(HtiEngineWrapper::AutoStartStatus)));
+ connect(&mEngineWrapper, SIGNAL(consoleSet(bool)), this, SLOT(consoleStatusChanged(bool)));
+ connect(&mEngineWrapper, SIGNAL(watchDogSet(bool)), this, SLOT(watchDogStatusChanged(bool)));
+ connect(&mEngineWrapper, SIGNAL(commPluginsRetrieved(QStringList&)), this, SLOT(updatePluginInfo(QStringList&)));
+
+
+}
+
+// ---------------------------------------------------------------------------
+void MainView::createTexts()
+{
+ QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical, this);
+
+ mCommDetailsTxt = new HbLabel(this);
+ mHtiStatusTxt = new HbLabel(this);
+ mHtiVersionTxt = new HbLabel(this);
+
+ mHtiAutoStartStatusTxt = new HbLabel(this);
+ mCommunicationTxt = new HbLabel(this);
+
+ mHtiStatusTxt->setPlainText("Hti Status:");
+ mHtiVersionTxt->setPlainText("Hti Version:");
+ mHtiAutoStartStatusTxt->setPlainText("Auto Start:");
+ mCommunicationTxt->setPlainText("Communication ");
+
+ layout->addItem(mHtiStatusTxt);
+ layout->addItem(mHtiVersionTxt);
+ layout->addItem(mHtiAutoStartStatusTxt);
+ layout->addItem(mCommunicationTxt);
+ layout->addItem(mCommDetailsTxt);
+
+ layout->setMaximumHeight(300);
+ this->setLayout(layout);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::htiStatusChanged(HtiEngineWrapper::HtiStatus newStatus)
+{
+ switch(newStatus)
+ {
+ case HtiEngineWrapper::Running:
+ mHtiStatusTxt->setPlainText("Hti Status: Running" );
+ break;
+ case HtiEngineWrapper::Stopped:
+ mHtiStatusTxt->setPlainText("Hti Status: Stopped" );
+ break;
+ case HtiEngineWrapper::Panic:
+ mHtiStatusTxt->setPlainText("Hti Status: Panic" );
+ break;
+ default:
+ mHtiStatusTxt->setPlainText("Hti Status: Error" );
+ }
+
+ // Update menu items status
+ bool isRunning = (newStatus == HtiEngineWrapper::Running);
+ mActionStartHti->setEnabled(!isRunning);
+ mActionStopHti->setEnabled(isRunning);
+ mActionSelectComm->setEnabled(!isRunning);
+ mActionSetPriority->setEnabled(!isRunning);
+ mActionEnableAuto->setEnabled(!isRunning);
+ mActionDisableAuto->setEnabled(!isRunning);
+ mActionEnableWdog->setEnabled(!isRunning);
+ mActionDisableWdog->setEnabled(!isRunning);
+ mActionEnableConsole->setEnabled(!isRunning);
+ mActionDisableConsole->setEnabled(!isRunning);
+ mActionSetParameter->setEnabled(!isRunning);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::commStatusChanged(QString& newStatus)
+{
+ if (mCommunicationTxt) {
+ mCommunicationTxt->setPlainText("Communication: " + newStatus);
+ }
+}
+
+// ---------------------------------------------------------------------------
+void MainView::commDetailsChanged(QString& newStatus)
+{
+ if (mCommDetailsTxt) {
+ mCommDetailsTxt->setPlainText(newStatus);
+ }
+}
+
+// ---------------------------------------------------------------------------
+void MainView::updatePluginInfo(QStringList& pluginList)
+{
+ mPluginList = pluginList;
+}
+
+// ---------------------------------------------------------------------------
+void MainView::autostartStatusChanged(HtiEngineWrapper::AutoStartStatus newStatus)
+{
+ switch(newStatus)
+ {
+ case HtiEngineWrapper::AutoStartDisabled:
+ mHtiAutoStartStatusTxt->setPlainText("Auto Start: Disabled" );
+ break;
+ case HtiEngineWrapper::AutoStartEnabled:
+ mHtiAutoStartStatusTxt->setPlainText("Auto Start: Enabled" );
+ break;
+ default:
+ mHtiAutoStartStatusTxt->setPlainText("Auto Start: Unknown" );
+ }
+
+ bool isAutoStartEnabled = (newStatus == HtiEngineWrapper::AutoStartEnabled);
+ mActionEnableAuto->setVisible(!isAutoStartEnabled);
+ mActionDisableAuto->setVisible(isAutoStartEnabled);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::consoleStatusChanged(bool enabled)
+{
+ mActionEnableConsole->setVisible(!enabled);
+ mActionDisableConsole->setVisible(enabled);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::watchDogStatusChanged(bool enabled)
+{
+ mActionEnableWdog->setVisible(!enabled);
+ mActionDisableWdog->setVisible(enabled);
+}
+
+
+// ---------------------------------------------------------------------------
+
+void MainView::createToolbar()
+{
+ mActionStartHti = toolBar()->addAction("Start Hti");
+ mActionStopHti = toolBar()->addAction("Stop Hti");
+}
+
+// ---------------------------------------------------------------------------
+
+void MainView::startHti()
+{
+ mEngineWrapper.startHti();
+}
+
+// ---------------------------------------------------------------------------
+
+void MainView::stopHti()
+{
+ mEngineWrapper.stopHti();
+}
+
+
+// ---------------------------------------------------------------------------
+void MainView::enableComm()
+{
+ //Get current selection
+ QString currentComm;
+ mEngineWrapper.getSelectedComm(currentComm);
+ int curSelection = mPluginList.indexOf(currentComm, 0);
+ openListDialog(mPluginList, curSelection, QString("Select Comm"), this, SLOT(doSelectComm(HbAction*)));
+}
+
+void MainView::doSelectComm(HbAction* action)
+{
+ HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+ if(dlg && dlg->selectedModelIndexes().count() &&
+ (!action || action == dlg->actions().at(0)))
+ {
+ int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+
+ if (mPluginList[selectionIndex] == QString("Bt serial comm"))
+ {
+ enableBTComm();
+ }
+ else if (mPluginList[selectionIndex] == QString("IP comm"))
+ {
+ enableIPComm();
+ }
+ else if (mPluginList[selectionIndex] == QString("SERIAL comm"))
+ {
+ enableSerialComm();
+ }
+ else
+ {
+ //All other comm plugins
+ mEngineWrapper.enableOtherComm(mPluginList[selectionIndex]);
+ }
+ }
+}
+// ---------------------------------------------------------------------------
+void MainView::enableSerialComm()
+{
+ QString heading = QString("Set Comm Port number");
+ HbInputDialog::getInteger(heading, this, SLOT(doEnableSerialComm(HbAction*)), 0, scene());
+}
+
+void MainView::doEnableSerialComm(HbAction* action)
+{
+ HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+ if (action == dlg->actions().at(0))
+ {
+ QString strPortNumber = dlg->value().toString();
+ mEngineWrapper.enableSerial(strPortNumber);
+ }
+}
+// ---------------------------------------------------------------------------
+void MainView::enableIPComm()
+{
+ // Get IAPs list
+ QStringList iapsList;
+ mEngineWrapper.listIAPs(iapsList);
+ if(iapsList.count() == 0)
+ {
+ HbMessageBox::warning(QString("No IAPs for selection!"));
+ return;
+ }
+
+ // Get current selection
+ QString curIapName;
+ QString param = "IAPName";
+ mEngineWrapper.getIPCfgParam(param, curIapName);
+ int curSelection = iapsList.indexOf(curIapName, 0);
+
+ openListDialog(iapsList, curSelection, QString("Select IAP:"), this, SLOT(doSelectIAP(HbAction*)));
+}
+
+void MainView::doSelectIAP(HbAction* action)
+{
+ HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+ if(dlg && dlg->selectedModelIndexes().count() &&
+ (!action || action == dlg->actions().at(0)))
+ {
+ int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+ mIapSelection = dlg->stringItems()[selectionIndex];
+
+ QStringList items;
+ items <<"Listen" <<"Connect";
+ openListDialog(items, 0, QString("Select IP Comm"), this, SLOT(doSelectIpComm(HbAction*)));
+ }
+}
+
+void MainView::doSelectIpComm(HbAction* action)
+{
+ HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+ if(dlg && dlg->selectedModelIndexes().count() &&
+ (!action || action == dlg->actions().at(0)))
+ {
+ int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+ if(selectionIndex == 0) //Listen
+ {
+ HbInputDialog::getInteger(QString("Local port"), this, SLOT(doListenOnPort(HbAction*)), 0, scene());
+ }
+ else //Connect
+ {
+ openIPAddressDialog(QString("Remote Host"), this, SLOT(doConnectRemoteHost(HbAction*)));
+ }
+ }
+}
+
+void MainView::doListenOnPort(HbAction* action)
+{
+ HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+ if (action == dlg->actions().at(0))
+ {
+ QString port = dlg->value().toString();
+ mEngineWrapper.ipListen(port, mIapSelection);
+ }
+}
+
+void MainView::doConnectRemoteHost(HbAction* action)
+{
+ HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+ if (action == dlg->actions().at(0))
+ {
+ QString host = dlg->value(0).toString();
+ QString port = dlg->value(1).toString();
+ mEngineWrapper.ipConnect(host, port, mIapSelection);
+ }
+}
+
+// ---------------------------------------------------------------------------
+void MainView::enableBTComm()
+{
+ QStringList items;
+ items <<"BT address" <<"BT name" <<"Search when starting" ;
+ openListDialog(items, 0, QString("Bluetooth Comm"), this, SLOT(doSelectBTComm(HbAction*)));
+}
+
+void MainView::doSelectBTComm(HbAction* action)
+{
+ HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+ if(dlg && dlg->selectedModelIndexes().count() &&
+ (!action || action == dlg->actions().at(0)))
+ {
+ int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+ if(selectionIndex == 0)
+ {
+ HbInputDialog::getText(QString("BT address"), this, SLOT(doEnableByBTAddress(HbAction*)));
+ }
+ else if(selectionIndex == 1)
+ {
+ HbInputDialog::getText(QString("BT name"), this, SLOT(doEnableByBTName(HbAction*)));
+ }
+ else if(selectionIndex == 2)
+ {
+ mEngineWrapper.btSearch();
+ }
+ }
+}
+
+void MainView::doEnableByBTAddress(HbAction* action)
+{
+ HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+ if (action == dlg->actions().at(0))
+ {
+ QString address = dlg->value().toString();
+ mEngineWrapper.enableBtByAddress(address);
+ }
+}
+void MainView::doEnableByBTName(HbAction* action)
+{
+ HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+ if (action == dlg->actions().at(0))
+ {
+ QString name = dlg->value().toString();
+ mEngineWrapper.enableBtByName(name);
+ }
+}
+
+// ---------------------------------------------------------------------------
+void MainView::setPriority()
+{
+ // Get current priority
+ bool ok = false;
+ QString curPriority;
+ QString param = "Priority";
+ mEngineWrapper.getHtiCfgParam(param, curPriority);
+ int curSelection = curPriority.toInt(&ok);
+ if(ok){
+ curSelection--;
+ }
+ else{
+ curSelection = 2;
+ }
+
+ QStringList items;
+ items <<"Backgroung" <<"Foregound" <<"High" << "Absolute High";
+ openListDialog(items, curSelection, QString("Select Hti Priority"),
+ this, SLOT(doSetPriority(HbAction*)));
+}
+
+void MainView::doSetPriority(HbAction* action)
+{
+ HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+ if(dlg && dlg->selectedModelIndexes().count() &&
+ (!action || action == dlg->actions().at(0)))
+ {
+ int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+ if(selectionIndex == 0)
+ {
+ mEngineWrapper.setPriorityBackground();
+ }
+ else if(selectionIndex == 1)
+ {
+ mEngineWrapper.setPriorityForeground();
+ }
+ else if(selectionIndex == 2)
+ {
+ mEngineWrapper.setPriorityHigh();
+ }
+ else
+ {
+ mEngineWrapper.setPriorityAbsoluteHigh();
+ }
+ }
+}
+// ---------------------------------------------------------------------------
+void MainView::enableAutoStart()
+{
+ mEngineWrapper.autoStartEnable(true);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::disableAutoStart()
+{
+ mEngineWrapper.autoStartEnable(false);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::enableWatchdog()
+{
+ mEngineWrapper.watchDogEnable(true);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::disableWatchdog()
+{
+ mEngineWrapper.watchDogEnable(false);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::enableConsole()
+{
+ mEngineWrapper.consoleEnable(true);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::disableConsole()
+{
+ mEngineWrapper.consoleEnable(false);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::showParamList()
+{
+ QStringList items;
+ items << "Hti.cfg" << "HtiBtComm.cfg" << "HtiSerialComm.cfg" << "HtiIPComm.cfg";
+ openListDialog(items, 0, QString("Select cfg file to modify"),
+ this, SLOT(doSelectCfgFile(HbAction*)));
+}
+
+void MainView::doSelectCfgFile(HbAction* action)
+{
+ HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+ if(dlg && dlg->selectedModelIndexes().count() &&
+ (!action || action == dlg->actions().at(0)))
+ {
+ int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+ QStringList items;
+ if(selectionIndex == 0)
+ {
+ items <<"CommPlugin" <<"MaxMsgSize" <<"MaxQueueSize" <<"MaxHeapSize"<<"Priority"
+ <<"ShowConsole"<<"MaxWaitTime"<<"StartUpDelay"<<"EnableHtiWatchDog"
+ <<"EnableHtiAutoStart"<<"ShowErrorDialogs"<<"ReconnectDelay";
+ openListDialog(items, 0, QString("Hti.cfg"), this, SLOT(doModifyHtiCfgFile(HbAction*)));
+ }
+ else if(selectionIndex == 1)
+ {
+ items <<"BtDeviceName" <<"BtDeviceName";
+ openListDialog(items, 0, QString("HtiBtComm.cfg"), this, SLOT(doModifyBtCfgFile(HbAction*)));
+ }
+ else if(selectionIndex == 2)
+ {
+ items <<"CommPort" <<"DataRate"<<"Parity"<<"DataBits"<<"StopBits"<<"SendDelay"<<"Handshake";
+ openListDialog(items, 0, QString("HtiSerialComm.cfg"), this, SLOT(doModifySerialCfgFile(HbAction*)));
+ }
+ else
+ {
+ items <<"IAPName"<<"LocalPort"<<"RemoteHost"<<"RemotePort"<<"ConnectTimeout";
+ openListDialog(items, 0, QString("HtiIPComm.cfg"), this, SLOT(doModifyIPCfgFile(HbAction*)));
+ }
+ }
+}
+
+void MainView::doModifyHtiCfgFile(HbAction* action)
+{
+ HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender());
+ if(dlgSelection && dlgSelection->selectedModelIndexes().count() &&
+ (!action || action == dlgSelection->actions().at(0)))
+ {
+ int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row();
+ HbInputDialog* dlgInput = new HbInputDialog();
+ dlgInput->setAttribute(Qt::WA_DeleteOnClose);
+ dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]);
+ dlgInput->setInputMode(HbInputDialog::TextInput);
+
+ HbLabel *title = new HbLabel(dlgInput);
+ title->setPlainText(QString("Set parameter value"));
+ dlgInput->setHeadingWidget(title);
+
+ dlgInput->open(this, SLOT(doSetHtiCfgParameter(HbAction*)));
+ }
+}
+
+void MainView::doSetHtiCfgParameter(HbAction* action)
+{
+ HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+ if (action == dlg->actions().at(0))
+ {
+ QString parameter = dlg->promptText();
+ QString value = dlg->value().toString();
+ mEngineWrapper.setHtiCfgParam(parameter, value);
+ }
+}
+
+void MainView::doModifyBtCfgFile(HbAction* action)
+{
+ HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender());
+ if(dlgSelection && dlgSelection->selectedModelIndexes().count() &&
+ (!action || action == dlgSelection->actions().at(0)))
+ {
+ int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row();
+ HbInputDialog* dlgInput = new HbInputDialog();
+ dlgInput->setAttribute(Qt::WA_DeleteOnClose);
+ dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]);
+ dlgInput->setInputMode(HbInputDialog::TextInput);
+
+ HbLabel *title = new HbLabel(dlgInput);
+ title->setPlainText(QString("Set parameter value"));
+ dlgInput->setHeadingWidget(title);
+
+ dlgInput->open(this, SLOT(doSetBtCfgParameter(HbAction*)));
+ }
+}
+
+void MainView::doSetBtCfgParameter(HbAction* action)
+{
+ HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+ if (action == dlg->actions().at(0))
+ {
+ QString parameter = dlg->promptText();
+ QString value = dlg->value().toString();
+ mEngineWrapper.setBtCfgParam(parameter, value);
+ }
+}
+
+void MainView::doModifySerialCfgFile(HbAction* action)
+{
+ HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender());
+ if(dlgSelection && dlgSelection->selectedModelIndexes().count() &&
+ (!action || action == dlgSelection->actions().at(0)))
+ {
+ int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row();
+ HbInputDialog* dlgInput = new HbInputDialog();
+ dlgInput->setAttribute(Qt::WA_DeleteOnClose);
+ dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]);
+ dlgInput->setInputMode(HbInputDialog::TextInput);
+
+ HbLabel *title = new HbLabel(dlgInput);
+ title->setPlainText(QString("Set parameter value"));
+ dlgInput->setHeadingWidget(title);
+
+ dlgInput->open(this, SLOT(doSetSerialCfgParameter(HbAction*)));
+ }
+}
+
+void MainView::doSetSerialCfgParameter(HbAction* action)
+{
+ HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+ if (action == dlg->actions().at(0))
+ {
+ QString parameter = dlg->promptText();
+ QString value = dlg->value().toString();
+ mEngineWrapper.setSerialCfgParam(parameter, value);
+ }
+}
+
+void MainView::doModifyIPCfgFile(HbAction* action)
+{
+ HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender());
+ if(dlgSelection && dlgSelection->selectedModelIndexes().count() &&
+ (!action || action == dlgSelection->actions().at(0)))
+ {
+ int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row();
+ HbInputDialog* dlgInput = new HbInputDialog();
+ dlgInput->setAttribute(Qt::WA_DeleteOnClose);
+ dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]);
+ dlgInput->setInputMode(HbInputDialog::TextInput);
+
+ HbLabel *title = new HbLabel(dlgInput);
+ title->setPlainText(QString("Set parameter value"));
+ dlgInput->setHeadingWidget(title);
+
+ dlgInput->open(this, SLOT(doSetIPCfgParameter(HbAction*)));
+ }
+}
+
+void MainView::doSetIPCfgParameter(HbAction* action)
+{
+ HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+ if (action == dlg->actions().at(0))
+ {
+ QString parameter = dlg->promptText();
+ QString value = dlg->value().toString();
+ mEngineWrapper.setIPCfgParam(parameter, value);
+ }
+}
+
+void MainView::openListDialog(const QStringList& items, const int currentSelection,
+ const QString &titleText, QObject* receiver, const char* member)
+{
+ // Create a list and some simple content for it
+ HbSelectionDialog *dlg = new HbSelectionDialog();
+ dlg->setAttribute(Qt::WA_DeleteOnClose);
+ // Set items to be popup's content
+ dlg->setStringItems(items);
+ dlg->setSelectionMode(HbAbstractItemView::SingleSelection);
+ QList<QVariant> current;
+ current.append(QVariant(currentSelection));
+ dlg->setSelectedItems(current);
+
+ HbLabel *title = new HbLabel(dlg);
+ title->setPlainText(titleText);
+ dlg->setHeadingWidget(title);
+
+ // Launch popup and handle the user response:
+ dlg->open(receiver, member);
+}
+
+void MainView::openIPAddressDialog(const QString &titleText, QObject* receiver, const char* member)
+{
+ HbInputDialog* dlg = new HbInputDialog();
+ dlg->setAttribute(Qt::WA_DeleteOnClose);
+ dlg->setAdditionalRowVisible(true);
+ dlg->setPromptText(QString("IP Address:"), 0);
+ dlg->setInputMode(HbInputDialog::IpInput, 0);
+ dlg->setPromptText(QString("Port:"), 1);
+ dlg->setInputMode(HbInputDialog::IntInput, 1);
+
+ HbLabel *title = new HbLabel(dlg);
+ title->setPlainText(titleText);
+ dlg->setHeadingWidget(title);
+
+ dlg->open(receiver, member);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/mainview.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of HtiAdmin main.
+*
+*/
+
+#ifndef MAINVIEW_H
+#define MAINVIEW_H
+
+
+#include <hbview.h>
+#include "htienginewrapper.h"
+
+
+class HbMainWindow;
+class HbApplication;
+class SettingsView;
+class HbAction;
+class HbTextEdit;
+class HbTextItem;
+class HbLabel;
+class QGraphicsLinearLayout;
+class QGraphicsGridLayout;
+
+
+/**
+ * Class that implements the main view of Screen Grabber
+ */
+class MainView : public HbView
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Constructor
+ */
+ MainView(HbMainWindow &mainWindow, HtiEngineWrapper &engineWrapper);
+
+ /**
+ * Destructor
+ */
+ ~MainView();
+
+ /**
+ * Initializes Engine Wrapper
+ * @param app application class of Screen Grabber
+ */
+ void init(HbApplication &app);
+
+ void enableSerialComm();
+ void enableBTComm();
+ void enableIPComm();
+
+
+private slots:
+ void htiStatusChanged(HtiEngineWrapper::HtiStatus newStatus);
+ void commStatusChanged(QString& newStatus);
+ void updatePluginInfo(QStringList& pluginList);
+ void autostartStatusChanged(HtiEngineWrapper::AutoStartStatus newStatus);
+ void consoleStatusChanged(bool enabled);
+ void watchDogStatusChanged(bool enabled);
+ void commDetailsChanged(QString& newStatus);
+
+ void startHti();
+ void stopHti();
+ void enableComm();
+ void setPriority();
+ void enableAutoStart();
+ void disableAutoStart();
+ void enableWatchdog();
+ void disableWatchdog();
+ void enableConsole();
+ void disableConsole();
+ void showParamList ();
+
+ void doSelectComm(HbAction*);
+ void doEnableSerialComm(HbAction* );
+ void doSelectIAP(HbAction* );
+ void doSelectIpComm(HbAction* );
+ void doListenOnPort(HbAction* );
+ void doConnectRemoteHost(HbAction*);
+ void doSelectBTComm(HbAction*);
+ void doEnableByBTAddress(HbAction*);
+ void doEnableByBTName(HbAction*);
+ void doSetPriority(HbAction*);
+ void doSelectCfgFile(HbAction*);
+ void doModifyHtiCfgFile(HbAction*);
+ void doModifyBtCfgFile(HbAction*);
+ void doModifySerialCfgFile(HbAction*);
+ void doModifyIPCfgFile(HbAction*);
+ void doSetHtiCfgParameter(HbAction*);
+ void doSetBtCfgParameter(HbAction*);
+ void doSetSerialCfgParameter(HbAction*);
+ void doSetIPCfgParameter(HbAction*);
+private:
+
+ /**
+ * Creates menu
+ */
+ void createMenu(HbApplication &app);
+
+ /**
+ * Creates toolbar components
+ */
+ void createToolbar();
+
+ void createTexts();
+
+ void openListDialog(const QStringList& items, const int currentSelection,
+ const QString &titleText, QObject* receiver, const char* member);
+ void openIPAddressDialog(const QString &titleText, QObject* receiver, const char* member);
+
+public:
+
+private:
+ /* Main windo of Screen Grabber */
+ HbMainWindow &mMainWindow;
+
+ /* Hti Engine Wrapper */
+ HtiEngineWrapper& mEngineWrapper;
+
+ /* Actions that are used in toolbars and menus */
+ HbAction* mActionExit;
+ HbAction* mActionStartHti;
+ HbAction* mActionStopHti;
+ HbAction* mActionSelectComm;
+ HbAction* mActionSetPriority;
+ HbAction* mActionEnableAuto;
+ HbAction* mActionDisableAuto;
+ HbAction* mActionEnableWdog;
+ HbAction* mActionDisableWdog;
+ HbAction* mActionEnableConsole;
+ HbAction* mActionDisableConsole;
+ HbAction* mActionSetParameter;
+
+ HbLabel* mHtiStatusTxt;
+ HbLabel* mHtiVersionTxt;
+ HbLabel* mHtiAutoStartStatusTxt;
+ HbLabel* mCommunicationTxt;
+ HbLabel* mCommDetailsTxt;
+
+ QStringList mPluginList;
+
+ QString mIapSelection;
+
+};
+
+#endif // MAINVIEW_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiDeviceReboot/group/HtiDeviceReboot.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build description file for HtiDeviceReboot in APP layer
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET HtiDeviceRebootUI.exe
+TARGETTYPE EXE
+
+UID 0x1000008d 0x200212D6
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
+
+SOURCEPATH ../src
+SOURCE HtiDeviceReboot.cpp
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY hal.lib
+LIBRARY starterclient.lib
+LIBRARY syslangutil.lib
+LIBRARY flogger.lib
+
+SMPSAFE
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiDeviceReboot/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for HtiDeviceReboot
+*
+*/
+
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+HtiDeviceReboot.mmp
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiDeviceReboot/src/HtiDeviceReboot.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HtiDeviceReboot implementation.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <hal.h>
+#include <starterclient.h>
+#include <syslangutil.h>
+
+// CONSTANTS
+_LIT( KHtiDeviceRebootName, "HtiDeviceReboot" );
+_LIT( KParamNormalRfs, "rfsnormal" );
+_LIT( KParamDeepRfs, "rfsdeep" );
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+LOCAL_C TInt StartL();
+LOCAL_C TInt Reboot(RStarterSession::TResetReason aReason);
+LOCAL_C TInt RestoreFactorySettings( TBool aIsDeepRfs );
+
+
+// FORWARD DECLARATIONS
+
+// ============================ LOCAL FUNCTIONS ===============================
+
+LOCAL_C TInt StartL()
+ {
+ TInt error = KErrNone;
+
+ TInt cmdLen = User::CommandLineLength();
+ HBufC* cmdLine = HBufC::NewLC( cmdLen );
+ TPtr ptCmdLine = cmdLine->Des();
+ User::CommandLine( ptCmdLine );
+
+ if ( cmdLen == 0 )
+ {
+ error = Reboot(RStarterSession::EUnknownReset);
+ }
+
+ else
+ {
+ TLex parser( *cmdLine );
+ TInt input;
+ TInt ret = parser.Val(input);
+
+ parser.SkipCharacters();
+ if ( parser.MarkedToken().CompareF( KParamNormalRfs ) == 0 )
+ {
+ error = RestoreFactorySettings( EFalse );
+ }
+ else if ( parser.MarkedToken().CompareF( KParamDeepRfs ) == 0 )
+ {
+ error = RestoreFactorySettings( ETrue );
+ }
+ else
+ {
+ if(ret != KErrNone )
+ {
+ error = KErrArgument; // Unknown argument
+ }
+ else
+ {
+ error = Reboot(static_cast<RStarterSession::TResetReason>(input));
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // cmdLine
+ return error;
+ }
+
+LOCAL_C TInt Reboot(RStarterSession::TResetReason aReason)
+ {
+ RStarterSession session;
+ TInt error = session.Connect();
+ if ( error == KErrNone )
+ {
+ session.Reset( aReason );
+ session.Close();
+ }
+ return error;
+ }
+
+LOCAL_C TInt RestoreFactorySettings( TBool aIsDeepRfs )
+ {
+ // In case of deep rfs, set language to default
+ if ( aIsDeepRfs )
+ {
+ TInt lang = 0;
+ if ( SysLangUtil::GetDefaultLanguage( lang ) == KErrNone )
+ {
+ HAL::Set( HALData::ELanguageIndex, lang );
+ }
+ }
+
+ // Do reboot with appropriate rfs reason code
+ RStarterSession session;
+ TInt error = session.Connect();
+ if ( error == KErrNone )
+ {
+ session.Reset( aIsDeepRfs ? RStarterSession::EDeepRFSReset :
+ RStarterSession::ENormalRFSReset );
+ session.Close();
+ }
+ return error;
+ }
+
+GLDEF_C TInt E32Main()
+ {
+ __UHEAP_MARK;
+
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+ CActiveScheduler *scheduler = new(ELeave) CActiveScheduler;
+ CActiveScheduler::Install( scheduler );
+
+ User::RenameThread( KHtiDeviceRebootName );
+
+ TRAPD( err, StartL() );
+
+ delete scheduler;
+ delete cleanup;
+
+ __UHEAP_MARKEND;
+
+ return err;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/bwins/HtiAppControlu.def Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?NewHtiAppControl@@YAPAVCHtiAppControl@@XZ @ 1 NONAME ; class CHtiAppControl * NewHtiAppControl(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/eabi/HtiAppControlu.def Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z16NewHtiAppControlv @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/group/HtiAppControl.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build description file for HtiAppControl
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../../../symbian_version.hrh"
+
+TARGET HtiAppControl.dll
+TARGETTYPE dll
+
+
+UID 0x1020DEB7 0x2002B3E9
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
+
+SOURCEPATH ../src
+SOURCE HtiAppControl.cpp
+
+USERINCLUDE ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY bafl.lib
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+LIBRARY apgrfx.lib
+LIBRARY apparc.lib
+LIBRARY apmime.lib
+LIBRARY ws32.lib
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+LIBRARY swinstcli.lib
+#else
+LIBRARY sif.lib // USIF
+LIBRARY scrclient.lib // SCR
+#endif
+LIBRARY sisregistryclient.lib
+LIBRARY javaregistryclient.lib
+LIBRARY widgetregistryclient.lib
+LIBRARY flogger.lib
+
+SMPSAFE
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for HtiAppServicePlugin
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiAppControl.mmp
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/inc/HtiAppControl.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,226 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of ECOM plug-in service interface providing
+* process and application control service.
+*
+*/
+
+
+
+#ifndef HTIAPPSERVICEPLUGIN_H__
+#define HTIAPPSERVICEPLUGIN_H__
+
+// INCLUDES
+#include "../../../symbian_version.hrh"
+
+#include <e32base.h>
+#include <apgcli.h>
+#include <w32std.h>
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+#include <SWInstDefs.h>
+#include <swi/sisregistryentry.h>
+#else
+#include <usif/usifcommon.h>
+#endif
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CDesC8ArrayFlat;
+class TApaTask;
+
+// CLASS DECLARATION
+
+NONSHARABLE_CLASS (CHtiAppControl) : public CHTIServicePluginInterface
+ {
+protected:
+ //commands
+ enum TAppCommand
+ {
+ //commands
+ EProcessLastCommand = 0x0F, //!!! used to sort process control from
+ //!!! app control
+
+ //app control
+ EStartApp = 0x10,
+ EStartApp_u = 0x11,
+ EStartApp_uid = 0x12,
+ EStartApp_uid_u = 0x13,
+ EStartDoc = 0x14,
+ EStartDoc_u = 0x15,
+ EStatusApp = 0x16,
+ EStatusApp_u = 0x17,
+ EStatusDoc = 0x18,
+ EStatusDoc_u = 0x19,
+ EStatusApp_uid = 0x1A,
+ EStopApp = 0x1C,
+ EStopApp_u = 0x1D,
+ EStopDoc = 0x1E,
+ EStopDoc_u = 0x1F,
+ EStopApp_uid = 0x20,
+ EListApps = 0x24,
+ EListApps_u = 0x25,
+ EListInstalledApps = 0x26,
+ EListInstalledApps_u = 0x27,
+
+ EAppLastCommand = 0x2F, //!!! used to sort process control from
+ //!!! app control
+ EInstall = 0x30,
+ EInstall_u = 0x31,
+ EUnInstall = 0x32,
+ EUnInstallName_u = 0x33,
+ EUnInstallName = 0x34,
+
+ ESisLastCommand = 0x3F, //!!! used to sort sis control from
+ //!!! app control
+ //responses
+ EOk = 0xF0,
+ ENotFound = 0xF1,
+ EAlreadyRunning = 0xF2,
+ EAlreadyStopped = 0xF3,
+ ERunning = 0xF4,
+ EKilled = 0xF5,
+ EPanic = 0xF6
+ };
+
+public:
+ static CHtiAppControl* NewL();
+
+ // Interface implementation
+ void ProcessMessageL(const TDesC8& aMessage,
+ THtiMessagePriority aPriority);
+
+protected:
+ CHtiAppControl();
+ void ConstructL();
+
+ virtual ~CHtiAppControl();
+
+ void HandleAppControlL(const TDesC8& aMessage);
+ void HandleInstallerControlL( const TDesC8& aMessage );
+ /**
+ * Extracts string from incoming request and convert it to unicode
+ * for non-unicode request
+ * aResult should have enough maz length and it will contain
+ * Function returns either offset for a next parameter in aRequest
+ * or some symbian error code
+ */
+ TInt ParseString( const TDesC8& aRequest,
+ TInt anOffset,
+ TBool aUnicode,
+ TDes& aResult);
+
+ //command handlers
+ void HandleStartProcessL( const TDesC& aProgramName,
+ const TDesC& aCmdLine,
+ TBool aStoreProcessHandle );
+
+ void HandleStopProcessL( RProcess& aProcess );
+ void HandleStatusProcessL( RProcess& aProcess );
+
+ void HandleListProcessesL( const TDesC& aMatch );
+
+ void HandleStartAppL( TApaAppInfo &aAppInfo, const TDesC& aDocName );
+
+ void HandleListAppsL( TBool aIncludeHidden,
+ TBool aIncludeSystem,
+ TBool aUnicode );
+
+ void HandleListInstalledAppsL( TBool aUnicode );
+
+ //construct and send short message
+ void SendMessageL(TAppCommand aResponseCode, const TDesC8& aMsg = KNullDesC8 );
+
+ /**
+ * Helper to send error message
+ * @return KErrNone or some system-wide error code
+ */
+ inline TInt SendErrorMsg( TInt anError, const TDesC8& aMsg );
+
+ /**
+ *
+ */
+ TInt OpenProcessL( RProcess& aProcess, const TDesC& aMatch );
+ TInt OpenProcessL( RProcess& aProcess, const TUint32 aProcessId );
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ SwiUI::TPolicy ConvertToPolicy( const TInt8 aValue );
+ TInt GetPackageUidL( const TDesC& aPackageName, TInt aMimeIndex );
+#else
+ Usif::TSifPolicy ConvertToSifPolicy( const TInt8 aValue );
+ TInt GetComponentIdFromUid(const TInt32 aUid);
+ TInt GetComponentIdFromPackageName(const TDesC& aPackageName);
+#endif
+
+ TBool ValidateInstallParams( const TDesC8& aParams, TBool aIsUnicode );
+
+ /**
+ * Find application based on its full path name and fill in aAppInfo
+ * @return KErrNone or KErrNotFound
+ */
+ TBool FindAppL( TApaAppInfo &aAppInfo, const TDesC& aAppFullName );
+ TBool FindAppL( TApaAppInfo &aAppInfo, const TInt32 aUid );
+
+ /**
+ * Find a task running the application specified by the UID as a root app
+ * (i.e. not embedded.
+ * @param aAppUid the UID of the application to find
+ * @return the found task or an empty task if not found
+ */
+ TApaTask FindRunningRootApp( TUid aAppUid );
+
+ /**
+ * Convert string to T 32bit int (e.g. TUint, TInt32)
+ */
+ template<class T> T Parse32( const TDesC8& a32int);
+
+protected:
+
+ // Session to Window Server
+ RWsSession iWs;
+
+ // Session to Application Architecture Server
+ RApaLsSession iAppServer;
+
+ // A flag that is set to EFalse if connecting to Window Server or
+ // Application Architecture Server fails. In that case all application
+ // related commands will return a "not supported" error.
+ TBool iIsAppCmdsSupported;
+
+ // Container array for process handles for querying the process exit codes
+ RArray<RProcess> iProcessHandleArray;
+
+ // possible mimetypes for silent software uninstallation
+ CDesC8ArrayFlat* iMimeTypes;
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ SwiUI::TInstallOptions iInstOpts;
+ SwiUI::TInstallOptionsPckg iInstOptsPckg;
+ SwiUI::TUninstallOptions iUnInstOpts;
+ SwiUI::TUninstallOptionsPckg iUnInstOptsPckg;
+ RPointerArray<Swi::CSisRegistryPackage> iAugmentations;
+ TInt iAugmentationIndex;
+#endif
+ };
+
+#endif
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,2094 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HtiAppControl implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <apacmdln.h>
+#include <apgtask.h>
+#include <apgwgnam.h>
+#include <apmstd.h>
+
+#include <badesca.h>
+#include <f32file.h>
+
+#include "HtiAppControl.h"
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+#include <SWInstApi.h>
+#include <swi/sisregistrysession.h>
+#include <swi/sisregistrypackage.h>
+#else
+#include <usif/sif/sif.h>
+#include <usif/scr/scr.h> //RSoftwareComponentRegistry
+#endif
+#include <javaregistryincludes.h>
+#include <WidgetRegistryClient.h>
+
+using namespace Java;
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+_LIT8( KSisxMimeType, "x-epoc/x-sisx-app" );
+_LIT8( KSisMimeType, "application/vnd.symbian.install" );
+_LIT8( KPipMimeType, "application/x-pip" );
+_LIT8( KJadMIMEType, "text/vnd.sun.j2me.app-descriptor" );
+_LIT8( KJarMIMEType, "application/java-archive" );
+_LIT8( KJavaMIMEType, "application/java");
+_LIT8( KJarxMIMEType, "application/x-java-archive");
+#endif
+
+// CONSTANTS
+const static TUid KAppServiceUid = { 0x1020DEC7 }; //This is Uid of AppServiceOS
+
+//error descriptions
+_LIT8( KErrDescrNoMemory, "No memory" );
+_LIT8( KErrDescrInvalidCmd, "Invalid command" );
+_LIT8( KErrDescrInvalidArguments, "Invalid arguments" );
+_LIT8( KErrDescrFailedCreateProcess, "Failed create process" );
+_LIT8( KErrDescrNotSupported, "Command not supported" );
+
+_LIT8( KErrDescrFailedStartApp, "Failed start app" );
+_LIT8( KErrDescrInvalidUid, "Invalid application uid" );
+_LIT8( KErrDescrFailedFindApp, "Failed find app" );
+
+_LIT8( KErrDescrFailedConnectSilentInstaller, "Failed to connect to silent installer" );
+_LIT8( KErrDescrFailedInstall, "Failed to install" );
+_LIT8( KErrDescrFailedUnInstall, "Failed to uninstall" );
+_LIT8( KErrDescrFailedFindPackage, "Failed to find the package" );
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+_LIT8( KErrDescrBadComponentId, "Bad component id");
+#endif
+_LIT8( KErrDescrFailedListInstApps, "Failed to list installed apps" );
+
+const static TUint8 KUnicodeMask = 0x01;
+const static TInt KTerminateReason = 0;
+const static TInt KTUintLength = sizeof(TUint);
+const static TInt KCloseTaskDelay = 250000; // microseconds
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+CHtiAppControl* CHtiAppControl::NewL()
+ {
+ CHtiAppControl* self = new ( ELeave ) CHtiAppControl;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// Constructor
+CHtiAppControl::CHtiAppControl():iIsAppCmdsSupported( EFalse )
+ {
+ }
+
+EXPORT_C CHtiAppControl* NewHtiAppControl()
+ {
+ return CHtiAppControl::NewL();
+ }
+
+CHtiAppControl::~CHtiAppControl()
+ {
+ HTI_LOG_FUNC_IN( "~CHtiAppControl" );
+
+ for ( TInt i = 0; i < iProcessHandleArray.Count(); i++ )
+ {
+ iProcessHandleArray[i].Close();
+ }
+ iProcessHandleArray.Close();
+
+ iAppServer.Close();
+ iWs.Close();
+
+ if ( iMimeTypes )
+ {
+ iMimeTypes->Reset();
+ delete iMimeTypes;
+ }
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ iAugmentations.ResetAndDestroy();
+#endif
+
+ HTI_LOG_FUNC_OUT( "~CHtiAppControl" );
+ }
+
+// Second phase construction.
+void CHtiAppControl::ConstructL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::ConstructL" );
+ iMimeTypes = new (ELeave) CDesC8ArrayFlat( 8 );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ iMimeTypes->AppendL( SwiUI::KSisxMimeType() );
+ iMimeTypes->AppendL( SwiUI::KSisMimeType() );
+ iMimeTypes->AppendL( SwiUI::KPipMimeType() );
+ iMimeTypes->AppendL( SwiUI::KJadMIMEType() );
+ iMimeTypes->AppendL( SwiUI::KJarMIMEType() );
+ iMimeTypes->AppendL( SwiUI::KJavaMIMEType() );
+ iMimeTypes->AppendL( SwiUI::KJarxMIMEType() );
+#else
+ iMimeTypes->AppendL( KSisxMimeType() );
+ iMimeTypes->AppendL( KSisMimeType() );
+ iMimeTypes->AppendL( KPipMimeType() );
+ iMimeTypes->AppendL( KJadMIMEType() );
+ iMimeTypes->AppendL( KJarMIMEType() );
+ iMimeTypes->AppendL( KJavaMIMEType() );
+ iMimeTypes->AppendL( KJarxMIMEType() );
+#endif
+ iMimeTypes->AppendL( KWidgetMime() ); // from widgetregistryconstants.h
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ iAugmentationIndex = 0;
+#endif
+
+ TInt err = iAppServer.Connect();
+ if ( err == KErrNone )
+ {
+ err = iWs.Connect();
+ }
+ if ( err == KErrNone )
+ {
+ iIsAppCmdsSupported = ETrue;
+ }
+ else
+ {
+ iAppServer.Close();
+ }
+ HTI_LOG_FUNC_OUT( "CHtiAppControl::ConstructL" );
+ }
+
+TInt CHtiAppControl::ParseString( const TDesC8& aRequest,
+ TInt anOffset,
+ TBool aUnicode,
+ TDes& aResult )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::ParseString" );
+ //validate parameters
+ //if offset outside the string return empty string
+ if ( anOffset >= aRequest.Size() )
+ {
+ return anOffset;
+ }
+
+ TInt len = aRequest[anOffset];
+ HTI_LOG_FORMAT( "length %d", len );
+
+ if ( len > aResult.MaxLength() )
+ {
+ return KErrBadDescriptor;
+ }
+
+ TInt nextOffset = ( aUnicode ? len * 2 : len ) + anOffset + 1;
+ HTI_LOG_FORMAT( "nextOffset %d", nextOffset );
+ HTI_LOG_FORMAT( "reqSize %d", aRequest.Size() );
+ if ( nextOffset > aRequest.Size() )
+ {
+ return KErrArgument;
+ }
+
+ if ( aUnicode )
+ {
+ const TPtrC8 aFrom( aRequest.Mid( anOffset + 1, len * 2 ) );
+ aResult.SetLength( len );
+ for ( TInt i = 0; i < len; ++i )
+ {
+ aResult[i] = ( TUint16 ) aFrom[i << 1] +
+ ( ( ( TUint16 ) aFrom[( i << 1 ) + 1] ) << 8 );
+ }
+ }
+ else
+ {
+ aResult.Copy( aRequest.Mid( anOffset + 1, len ) );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiAppControl::ParseString" );
+ return nextOffset;
+ }
+
+void CHtiAppControl::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/ )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::ProcessMessage" );
+ if ( aMessage.Length() < 1 )
+ {
+ // no command
+ SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+ return;
+ }
+
+ if ( aMessage.Length() < 2 &&
+ aMessage[0] != EListInstalledApps &&
+ aMessage[0] != EListInstalledApps_u)
+ {
+ // parameter is required with all commands except
+ // listing processes or installed applications
+ SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+ return;
+ }
+
+ HTI_LOG_FORMAT( "cmd %d", aMessage[0] );
+
+ if ( aMessage[0] > EProcessLastCommand &&
+ aMessage[0] < EAppLastCommand)
+ {
+ if ( iIsAppCmdsSupported )
+ {
+ HandleAppControlL( aMessage );
+ }
+ else
+ {
+ SendErrorMsg( KErrNotSupported, KErrDescrNotSupported );
+ }
+ }
+ else if ( aMessage[0] > EAppLastCommand &&
+ aMessage[0] < ESisLastCommand )
+ {
+ HandleInstallerControlL( aMessage );
+ }
+ else
+ {
+ SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+ }
+ HTI_LOG_FUNC_OUT( "CHtiAppControl::ProcessMessage" );
+ }
+
+void CHtiAppControl::HandleAppControlL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::HandleAppControl" );
+
+ TBool unicode = aMessage[0] & KUnicodeMask;
+
+ HTI_LOG_FORMAT( "unicode %d", unicode );
+
+ TApaAppInfo appInfo;
+ TFileName appName;
+ TFileName docName;
+
+ switch ( aMessage[0] )
+ {
+ case EStartApp_uid:
+ case EStartApp_uid_u:
+ {
+ TPtrC8 parameters = aMessage.Mid( 1 );
+ if ( parameters.Length() >= 4 )
+ {
+ TInt32 uid = Parse32<TInt32>( parameters );
+
+ TInt offset = ParseString( parameters, 4, unicode, docName );
+ if ( offset >= 0)
+ {
+ if ( FindAppL( appInfo, uid ) )
+ {
+ HandleStartAppL( appInfo, docName );
+ }
+ }
+ else
+ {
+ SendErrorMsg( offset , KErrDescrInvalidArguments );
+ }
+ }
+ else
+ {
+ SendErrorMsg( KErrArgument , KErrDescrInvalidUid );
+ }
+ }
+ break;
+ case EStartApp:
+ case EStartApp_u:
+ {
+ TInt offset = ParseString( aMessage, 1, unicode, appName );
+ if ( offset >= 0 )
+ {
+ offset = ParseString( aMessage, offset, unicode, docName );
+ if ( offset >= 0 )
+ {
+ //find appInfo by app full name
+ if ( FindAppL( appInfo, appName ) )
+ {
+ HTI_LOG_TEXT( "call HandleStartAppL" );
+ HandleStartAppL( appInfo, docName );
+ }
+ }
+ }
+
+ if ( offset < 0 )
+ {
+ SendErrorMsg( offset , KErrDescrInvalidArguments );
+ }
+ }
+ break;
+ case EStartDoc:
+ case EStartDoc_u:
+ {
+ TInt offset = ParseString( aMessage, 1, unicode, docName );
+ if ( offset >= 0 )
+ {
+ HandleStartAppL( appInfo, docName ); //appInfo is empty
+ }
+ else
+ {
+ SendErrorMsg( offset , KErrDescrInvalidArguments );
+ }
+ }
+ break;
+ case EStatusApp_uid:
+ {
+ TPtrC8 appUid8 = aMessage.Mid( 1 );
+ if ( appUid8.Length() == 4 )
+ {
+ TApaTaskList tl( iWs );
+ TInt32 appUid = Parse32<TInt32>( appUid8 );
+ TApaTask task = tl.FindApp( TUid::Uid( appUid ) );
+ if ( task.Exists() )
+ {
+ SendMessageL( ERunning );
+ }
+ else
+ {
+ SendMessageL( ENotFound );
+ }
+ }
+ else
+ {
+ SendErrorMsg( KErrArgument, KErrDescrInvalidUid );
+ }
+ }
+ break;
+ case EStatusApp:
+ case EStatusApp_u:
+ {
+ TInt offset = ParseString( aMessage, 1, unicode, appName );
+ if ( offset >= 0 )
+ {
+ TApaTaskList tl( iWs );
+ TApaTask task = tl.FindApp( appName );
+ if ( task.Exists() )
+ {
+ SendMessageL( ERunning );
+ break; // we are done
+ }
+
+ // Maybe the user gave path or filename instead of caption
+ if ( FindAppL( appInfo, appName ) )
+ {
+ TApaTask task2 = tl.FindApp( appInfo.iUid );
+ if ( task2.Exists() )
+ {
+ SendMessageL( ERunning );
+ }
+ else
+ {
+ SendMessageL( ENotFound );
+ }
+ }
+ // If app was not found by FindAppL method, a response message
+ // has already been sent there - no need to send anything here.
+ }
+ else
+ {
+ SendErrorMsg( offset , KErrDescrInvalidArguments );
+ }
+ }
+ break;
+ case EStatusDoc:
+ case EStatusDoc_u:
+ {
+ TInt offset = ParseString( aMessage, 1, unicode, docName );
+ if ( offset >= 0 )
+ {
+ TApaTaskList tl( iWs );
+ TApaTask task = tl.FindDoc( docName );
+ if ( task.Exists() )
+ {
+ SendMessageL( ERunning );
+ }
+ else
+ {
+ SendMessageL( ENotFound );
+ }
+ }
+ else
+ {
+ SendErrorMsg( offset , KErrDescrInvalidArguments );
+ }
+ }
+ break;
+ case EStopApp:
+ case EStopApp_u:
+ {
+ TInt offset = ParseString( aMessage, 1, unicode, appName );
+ if ( offset >= 0 )
+ {
+ TApaTaskList tl( iWs );
+ TApaTask task = tl.FindApp( appName );
+ if ( task.Exists() )
+ {
+ task.EndTask();
+ User::After( KCloseTaskDelay );
+ TApaTask task = tl.FindApp( appName );
+ if ( task.Exists() )
+ {
+ task.KillTask();
+ }
+ SendMessageL( EOk );
+ break; // we are done
+ }
+
+ // Maybe the user gave path or filename instead of caption
+ if ( FindAppL( appInfo, appName ) )
+ {
+ TApaTask task2 = tl.FindApp( appInfo.iUid );
+ if ( task2.Exists() )
+ {
+ task2.EndTask();
+ User::After( KCloseTaskDelay );
+ TApaTask task2 = tl.FindApp( appInfo.iUid );
+ if ( task2.Exists() )
+ {
+ task2.KillTask();
+ }
+ SendMessageL( EOk );
+ }
+ else
+ {
+ SendMessageL( ENotFound );
+ }
+ }
+ // If app was not found by FindAppL method, a response message
+ // has already been sent there - no need to send anything here.
+ }
+ else
+ {
+ SendErrorMsg( offset , KErrDescrInvalidArguments );
+ }
+ }
+ break;
+ case EStopDoc:
+ case EStopDoc_u:
+ {
+ TInt offset = ParseString( aMessage, 1, unicode, docName );
+ if ( offset >= 0 )
+ {
+ TApaTaskList tl( iWs );
+ TApaTask task = tl.FindDoc( docName );
+ if ( task.Exists() )
+ {
+ task.EndTask();
+ User::After( KCloseTaskDelay );
+ TApaTask task = tl.FindDoc( docName );
+ if ( task.Exists() )
+ {
+ task.KillTask();
+ }
+ SendMessageL( EOk );
+ }
+ else
+ {
+ SendMessageL( ENotFound );
+ }
+ }
+ else
+ {
+ SendErrorMsg( offset , KErrDescrInvalidArguments );
+ }
+ }
+ break;
+ case EStopApp_uid:
+ {
+ TPtrC8 appUid8 = aMessage.Mid( 1 );
+ if ( appUid8.Length() == 4 )
+ {
+ TApaTaskList tl( iWs );
+ TInt32 appUid = Parse32<TInt32>( appUid8 );
+ TApaTask task = tl.FindApp( TUid::Uid( appUid ) );
+ if ( task.Exists() )
+ {
+ task.EndTask();
+ User::After(KCloseTaskDelay);
+ TApaTask task = tl.FindApp( TUid::Uid( appUid ) );
+ if ( task.Exists() )
+ {
+ task.KillTask();
+ }
+ SendMessageL( EOk );
+ }
+ else
+ {
+ SendMessageL( ENotFound );
+ }
+ }
+ else
+ {
+ SendErrorMsg( KErrArgument , KErrDescrInvalidUid );
+ }
+ }
+ break;
+ case EListApps:
+ case EListApps_u:
+ {
+ if ( aMessage.Length() != 3 )
+ {
+ SendErrorMsg( KErrArgument, KErrDescrInvalidArguments );
+ }
+ else
+ {
+ HandleListAppsL( aMessage[1], aMessage[2], unicode );
+ }
+ }
+ break;
+ case EListInstalledApps:
+ case EListInstalledApps_u:
+ {
+ if ( aMessage.Length() != 1 )
+ {
+ SendErrorMsg( KErrArgument, KErrDescrInvalidArguments );
+ }
+ else
+ {
+ HandleListInstalledAppsL( unicode );
+ }
+ }
+ break;
+ default:
+ {
+ SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+ }
+ }
+
+ HTI_LOG_FUNC_OUT("CHtiAppControl::HandleAppControl");
+ }
+
+void CHtiAppControl::HandleInstallerControlL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::HandleInstallerControlL" );
+
+ if ( aMessage.Length() < 2 )
+ {
+ HTI_LOG_TEXT( "Command parameters missing" );
+ SendErrorMsg( KErrArgument , KErrDescrInvalidCmd );
+ return;
+ }
+
+ TBool unicode = aMessage[0] & KUnicodeMask;
+ HTI_LOG_FORMAT( "Unicode flag: %d", unicode );
+
+ TFileName path;
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ TBuf<SwiUI::KSWInstMaxPasswordLength> login;
+ TBuf<SwiUI::KSWInstMaxPasswordLength> password;
+#endif
+
+ switch ( aMessage[0] )
+ {
+ case EInstall:
+ case EInstall_u:
+ {
+ TPtrC8 parameters = aMessage.Mid( 1 );
+ if ( ValidateInstallParams( parameters, unicode ) )
+ {
+ TInt offset = ParseString( parameters, 0, unicode, path );
+
+ HTI_LOG_TEXT( "Parsed path to install package:" );
+ HTI_LOG_DES( path )
+
+ if ( offset >= 0)
+ {
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ iInstOpts = SwiUI::TInstallOptions();
+
+ iInstOpts.iUpgrade = ConvertToPolicy( parameters[offset] ); offset++;
+ iInstOpts.iOptionalItems = ConvertToPolicy( parameters[offset] ); offset++;
+ iInstOpts.iOCSP = ConvertToPolicy( parameters[offset] ); offset++;
+ iInstOpts.iIgnoreOCSPWarnings = ConvertToPolicy( parameters[offset] ); offset++;
+ iInstOpts.iUntrusted = ConvertToPolicy( parameters[offset] ); offset++;
+ iInstOpts.iPackageInfo = ConvertToPolicy( parameters[offset] ); offset++;
+ iInstOpts.iCapabilities = ConvertToPolicy( parameters[offset] ); offset++;
+ iInstOpts.iKillApp = ConvertToPolicy( parameters[offset] ); offset++;
+ iInstOpts.iOverwrite = ConvertToPolicy( parameters[offset] ); offset++;
+ iInstOpts.iDownload = ConvertToPolicy( parameters[offset] ); offset++;
+
+ HTI_LOG_FORMAT( "iUpgrade: %d", iInstOpts.iUpgrade );
+ HTI_LOG_FORMAT( "iOptionalItems: %d", iInstOpts.iOptionalItems );
+ HTI_LOG_FORMAT( "iOCSP: %d", iInstOpts.iOCSP );
+ HTI_LOG_FORMAT( "iIgnoreOCSPWarnings: %d", iInstOpts.iIgnoreOCSPWarnings );
+ HTI_LOG_FORMAT( "iUntrusted: %d", iInstOpts.iUntrusted );
+ HTI_LOG_FORMAT( "iPackageInfo: %d", iInstOpts.iPackageInfo );
+ HTI_LOG_FORMAT( "iCapabilities: %d", iInstOpts.iCapabilities );
+ HTI_LOG_FORMAT( "iKillApp: %d", iInstOpts.iKillApp );
+ HTI_LOG_FORMAT( "iOverwrite: %d", iInstOpts.iOverwrite );
+ HTI_LOG_FORMAT( "iDownload: %d", iInstOpts.iDownload );
+
+ offset = ParseString( parameters, offset, unicode, login );
+ iInstOpts.iLogin.Copy( login );
+ HTI_LOG_TEXT( "Parsed login:" );
+ HTI_LOG_DES( login )
+
+ offset = ParseString( parameters, offset, unicode, password );
+ iInstOpts.iPassword.Copy( password );
+ HTI_LOG_TEXT( "Parsed password:" );
+ HTI_LOG_DES( password )
+
+ iInstOpts.iDrive = (TChar) parameters[offset]; offset++;
+ iInstOpts.iLang = (TLanguage) parameters[offset]; offset++;
+ iInstOpts.iUsePhoneLang = (TBool) parameters[offset]; offset++;
+ iInstOpts.iUpgradeData = ConvertToPolicy( parameters[offset] );
+ offset++;
+ HTI_LOG_FORMAT( "parameters length: %d", parameters.Length());
+ HTI_LOG_FORMAT( "next offset: %d", offset);
+
+ if(parameters.Length() > offset)
+ {
+ TInt language = iInstOpts.iLang;
+ if (parameters.Length() == offset+2)
+ {
+ language = parameters[offset] + (parameters[offset+1]<<8);
+ }
+ if (parameters.Length() == offset+1)
+ {
+ language = parameters[offset];
+ }
+ if ((language > ELangTest) && (language < ELangMaximum))
+ {
+ iInstOpts.iLang = (TLanguage) language;
+ }
+ }
+ HTI_LOG_FORMAT( "iDrive: %c", iInstOpts.iDrive.GetLowerCase() );
+ HTI_LOG_FORMAT( "iLang: %d", iInstOpts.iLang );
+ HTI_LOG_FORMAT( "iUsePhoneLang: %d", iInstOpts.iUsePhoneLang );
+ HTI_LOG_FORMAT( "iUpgradeData: %d", iInstOpts.iUpgradeData );
+
+ iInstOptsPckg = iInstOpts;
+
+ // Connect to silent installer
+ SwiUI::RSWInstSilentLauncher launcher;
+ TInt err = launcher.Connect();
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Error connecting to silent installer, err: %d", err );
+ SendErrorMsg( err , KErrDescrFailedConnectSilentInstaller );
+ break;
+ }
+
+ err = launcher.SilentInstall( path, iInstOptsPckg );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Error installing software, err: %d", err );
+ launcher.Close();
+ SendErrorMsg( err , KErrDescrFailedInstall );
+ break;
+ }
+
+ launcher.Close();
+ SendMessageL( EOk );
+#else
+ HTI_LOG_TEXT( "============RSoftwareInstall::Install=============" );
+ Usif::RSoftwareInstall installer;
+ TInt err = installer.Connect();
+ if(err)
+ {
+ SendErrorMsg( err , KErrDescrFailedConnectSilentInstaller );
+ HTI_LOG_FORMAT("cannot connect to SIF server, err %d", err);
+ User::Leave(err);
+ }
+ CleanupClosePushL(installer);
+ TRequestStatus status;
+ Usif::COpaqueNamedParams *arguments = Usif::COpaqueNamedParams::NewL();
+ CleanupStack::PushL(arguments);
+ Usif::COpaqueNamedParams *results = Usif::COpaqueNamedParams::NewL();
+ CleanupStack::PushL(results);
+
+ arguments->AddIntL(Usif::KSifInParam_InstallSilently, ETrue);
+
+ TInt intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+ if(intValue != Usif::EAllowed)
+ arguments->AddIntL(Usif::KSifInParam_AllowUpgrade, intValue);
+ HTI_LOG_FORMAT( "iUpgrade: %d", intValue );
+ intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+ if(intValue != Usif::EAllowed)
+ arguments->AddIntL(Usif::KSifInParam_InstallOptionalItems, intValue);
+ HTI_LOG_FORMAT( "iOptionalItems: %d", intValue );
+ intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+ if(intValue != Usif::EAllowed)
+ arguments->AddIntL(Usif::KSifInParam_PerformOCSP, intValue);
+ HTI_LOG_FORMAT( "iOCSP: %d", intValue );
+ intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+ if(intValue != Usif::EAllowed)
+ arguments->AddIntL(Usif::KSifInParam_IgnoreOCSPWarnings, intValue);
+ HTI_LOG_FORMAT( "iIgnoreOCSPWarnings: %d", intValue );
+ intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+ if(intValue != Usif::ENotAllowed)
+ arguments->AddIntL(Usif::KSifInParam_AllowUntrusted, intValue);
+ HTI_LOG_FORMAT( "iUntrusted: %d", intValue );
+ intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+ if(intValue != Usif::EAllowed)
+ arguments->AddIntL(Usif::KSifInParam_PackageInfo, intValue);
+ HTI_LOG_FORMAT( "iPackageInfo: %d", intValue );
+ intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+ if(intValue != Usif::EAllowed)
+ arguments->AddIntL(Usif::KSifInParam_GrantCapabilities,intValue);
+ HTI_LOG_FORMAT( "iCapabilities: %d", intValue );
+ intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+ if(intValue != Usif::EAllowed)
+ arguments->AddIntL(Usif::KSifInParam_AllowAppShutdown,intValue);
+ HTI_LOG_FORMAT( "iKillApp: %d", intValue );
+ intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+ if(intValue != Usif::EAllowed)
+ arguments->AddIntL(Usif::KSifInParam_AllowOverwrite,intValue);
+ HTI_LOG_FORMAT( "iOverwrite: %d", intValue );
+ intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+ if(intValue != Usif::EAllowed)
+ arguments->AddIntL(Usif::KSifInParam_AllowDownload, intValue);
+ HTI_LOG_FORMAT( "iDownload: %d", intValue );
+
+ TBuf<32> login;
+ offset = ParseString( parameters, offset, unicode, login );
+ HTI_LOG_FORMAT( "login length: %d", login.Length() );
+ if(login != KNullDesC)
+ {
+ arguments->AddStringL(Usif::KSifInParam_UserName, login);
+ }
+ HTI_LOG_TEXT( "Parsed login:" );
+ HTI_LOG_DES( login )
+
+ TBuf<32> password;
+ offset = ParseString( parameters, offset, unicode, password );
+ HTI_LOG_FORMAT( "password length: %d", password.Length() );
+ if(password != KNullDesC)
+ {
+ arguments->AddStringL(Usif::KSifInParam_Password, password );
+ }
+ HTI_LOG_TEXT( "Parsed password:" );
+ HTI_LOG_DES( password )
+
+ TChar driver = (TChar) parameters[offset]; offset++;
+ if(driver >= 'A' && driver <= 'Z')
+ {
+ intValue = driver - (TChar)'A';
+ arguments->AddIntL(Usif::KSifInParam_Drive, intValue);
+ HTI_LOG_FORMAT( "iDrive: %c", intValue + 'a' );
+ }
+ else if(driver >= 'a' && driver <= 'z')
+ {
+ intValue = driver - (TChar)'a';
+ arguments->AddIntL(Usif::KSifInParam_Drive, intValue);
+ HTI_LOG_FORMAT( "iDrive: %c", intValue + 'a' );
+ }
+
+ TLanguage oldFormatLanuage = (TLanguage)parameters[offset]; offset++;
+
+ TBool usePhoneLang = (TBool)parameters[offset]; offset++;
+ HTI_LOG_FORMAT( "iUsePhoneLang: %d", usePhoneLang );
+
+ intValue = ConvertToSifPolicy( parameters[offset] );offset++;
+ /*if(intValue != Usif::EAllowed)
+ arguments->AddIntL(Usif::KSifInParam_AllowUpgrade, intValue);*/
+ HTI_LOG_FORMAT( "iUpgradeData: %d", intValue );
+
+ HTI_LOG_FORMAT( "parameters length: %d", parameters.Length());
+ HTI_LOG_FORMAT( "next offset: %d", offset);
+
+ if(usePhoneLang == EFalse)
+ {
+ if(parameters.Length() > offset)
+ {
+ TLanguage language = ELangTest;
+ if (parameters.Length() == offset+2)
+ {
+ language = (TLanguage)(parameters[offset] + (parameters[offset+1]<<8));
+ }
+ else if (parameters.Length() == offset+1)
+ {
+ language = (TLanguage)(parameters[offset]);
+ }
+ if ((language > ELangTest) && (language < ELangMaximum))
+ {
+ arguments->AddIntL(Usif::KSifInParam_Languages, language);
+ HTI_LOG_FORMAT( "iLang: %d", language );
+ }
+ }
+ else
+ {
+ arguments->AddIntL(Usif::KSifInParam_Languages, oldFormatLanuage);
+ HTI_LOG_FORMAT( "iLang0: %d", oldFormatLanuage );
+ }
+ }
+
+ installer.Install(path, *arguments, *results, status);
+ User::WaitForRequest(status);
+ HTI_LOG_FORMAT("install status: %d", status.Int());
+ TInt componentId = 0;
+ TBool idExisted = results->GetIntByNameL(Usif::KSifOutParam_ComponentId, componentId);
+ if ( idExisted )
+ {
+ HTI_LOG_FORMAT( "componentId:%d", componentId);
+ }
+ CleanupStack::PopAndDestroy(3);
+ if (status != KErrNone)
+ {
+ SendErrorMsg( status.Int(), KErrDescrFailedInstall );
+ break;
+ }
+ SendMessageL( EOk );
+#endif
+ }
+ else
+ {
+ HTI_LOG_TEXT( "Error parsing path" );
+ SendErrorMsg( offset , KErrDescrInvalidArguments );
+ }
+ }
+ else
+ {
+ SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+ }
+ }
+ break;
+
+ case EUnInstall:
+ case EUnInstallName:
+ case EUnInstallName_u:
+ {
+ TPtrC8 parameters = aMessage.Mid( 1 );
+ if ( ( aMessage[0] == EUnInstall && parameters.Length() != 7 ) ||
+ ( aMessage[0] == EUnInstallName &&
+ parameters.Length() != parameters[0] + 4 ) ||
+ ( aMessage[0] == EUnInstallName_u &&
+ parameters.Length() != parameters[0] * 2 + 4 ) )
+ {
+ HTI_LOG_FORMAT( "Invalid command length: %d",
+ parameters.Length() );
+ SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+ break;
+ }
+
+ TInt offset = 0;
+ TInt32 uid = KErrNotFound;
+ HBufC* packageName = NULL;
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+ Usif::TComponentId cid = KErrNotFound;
+ HTI_LOG_TEXT( "============RSoftwareInstall::Uninstall=============" );
+ Usif::RSoftwareInstall installer;
+ TInt err = installer.Connect();
+ if(err)
+ {
+ SendErrorMsg( err , KErrDescrFailedConnectSilentInstaller );
+ HTI_LOG_FORMAT("cannot connect to SIF server, err %d", err);
+ User::Leave(err);
+ }
+ CleanupClosePushL(installer);
+ TRequestStatus status;
+ Usif::COpaqueNamedParams *arguments = Usif::COpaqueNamedParams::NewL();
+ CleanupStack::PushL(arguments);
+ Usif::COpaqueNamedParams *results = Usif::COpaqueNamedParams::NewL();
+ CleanupStack::PushL(results);
+#endif
+ if ( aMessage[0] == EUnInstall )
+ {
+ uid = Parse32<TInt32>( parameters );
+ offset += 4;
+ HTI_LOG_FORMAT( "Uninstall by uid: %d", uid );
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+ cid = GetComponentIdFromUid(uid);
+ if ( cid == KErrNotFound )
+ {
+ HTI_LOG_FORMAT( "cid: %d", cid );
+ SendErrorMsg( KErrNotFound, KErrDescrBadComponentId );
+ CleanupStack::PopAndDestroy(3); //results, arguments, installer
+ break;
+ }
+#endif
+ }
+ else
+ {
+ packageName = HBufC::NewLC( parameters[offset] );
+ TPtr namePtr = packageName->Des();
+ offset = ParseString( parameters, offset, unicode, namePtr );
+ HTI_LOG_FORMAT( "Uninstall by name: %S", packageName );
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+ cid = GetComponentIdFromPackageName(*packageName);
+ CleanupStack::PopAndDestroy(); // packageName
+ if ( cid == KErrNotFound )
+ {
+ HTI_LOG_FORMAT( "cid: %d", cid );
+ SendErrorMsg( KErrNotFound, KErrDescrFailedFindPackage );
+ CleanupStack::PopAndDestroy(3); //results, arguments, installer
+ break;
+ }
+#endif
+ }
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ iUnInstOpts = SwiUI::TUninstallOptions();
+ iUnInstOpts.iKillApp = ConvertToPolicy( parameters[offset] );
+ offset++;
+ iUnInstOpts.iBreakDependency = ConvertToPolicy( parameters[offset] );
+ offset++;
+ HTI_LOG_FORMAT( "iKillApp: %d", iUnInstOpts.iKillApp );
+ HTI_LOG_FORMAT( "iBreakDependency: %d", iUnInstOpts.iBreakDependency );
+
+ TInt mimeIndex = parameters[offset];
+ if ( mimeIndex > iMimeTypes->Count() - 1 )
+ {
+ HTI_LOG_FORMAT( "Invalid mime type: %d", mimeIndex );
+ SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+ break;
+ }
+
+ HTI_LOG_TEXT( "Uninstall mime type:" );
+ HTI_LOG_DES( (*iMimeTypes)[mimeIndex] );
+
+ TInt err = KErrNone;
+ iAugmentationIndex = 0;
+ if ( packageName )
+ {
+ TRAP( err, uid = GetPackageUidL( *packageName, mimeIndex ) );
+ CleanupStack::PopAndDestroy(); // packageName
+ iAugmentations.ResetAndDestroy();
+ if ( err != KErrNone )
+ {
+ SendErrorMsg( err, KErrDescrFailedFindPackage );
+ break;
+ }
+ }
+ HTI_LOG_FORMAT( "UID = %d", uid );
+
+ iUnInstOptsPckg = iUnInstOpts;
+
+ // Connect to silent installer
+ SwiUI::RSWInstSilentLauncher launcher;
+ err = launcher.Connect();
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Error connecting to silent installer, err: %d", err );
+ SendErrorMsg( err , KErrDescrFailedConnectSilentInstaller );
+ break;
+ }
+
+ if ( iAugmentationIndex > 0 )
+ {
+ SwiUI::TOpUninstallIndexParam params;
+ params.iUid = TUid::Uid( uid );
+ params.iIndex = iAugmentationIndex;
+ SwiUI::TOpUninstallIndexParamPckg paramPckg( params );
+ SwiUI::TOperation operation( SwiUI::EOperationUninstallIndex );
+ err = launcher.SilentCustomUninstall( operation, iUnInstOptsPckg,
+ paramPckg, (*iMimeTypes)[mimeIndex] );
+ }
+ else
+ {
+ err = launcher.SilentUninstall( TUid::Uid( uid ), iUnInstOptsPckg,
+ (*iMimeTypes)[mimeIndex] );
+ }
+
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Error uninstalling software, err: %d", err );
+ launcher.Close();
+ SendErrorMsg( err , KErrDescrFailedUnInstall );
+ break;
+ }
+
+ launcher.Close();
+#else
+
+ TInt intValue = ConvertToSifPolicy( parameters[offset] );
+ offset++;
+ arguments->AddIntL(Usif::KSifInParam_AllowAppShutdown, intValue);
+ HTI_LOG_FORMAT( "iKillApp: %d", intValue );
+ intValue = ConvertToSifPolicy( parameters[offset] );
+ offset++;
+ arguments->AddIntL(Usif::KSifInParam_AllowAppBreakDependency, intValue);
+ HTI_LOG_FORMAT( "iBreakDependency: %d", intValue );
+
+ TInt mimeIndex = parameters[offset];
+ if ( mimeIndex > iMimeTypes->Count() - 1 )
+ {
+ HTI_LOG_FORMAT( "Invalid mime type: %d", mimeIndex );
+ SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+ break;
+ }
+
+ HTI_LOG_TEXT( "Uninstall mime type:" );
+ HTI_LOG_DES( (*iMimeTypes)[mimeIndex] );
+
+ HBufC* buf = HBufC::NewLC((*iMimeTypes)[mimeIndex].Length());
+ TPtr ptr = buf->Des();
+ ptr.Copy((*iMimeTypes)[mimeIndex]);
+ arguments->AddStringL(Usif::KSifInParam_MimeType, *buf);
+ CleanupStack::PopAndDestroy(); // buf
+
+ HTI_LOG_FORMAT( "Component ID = %d", cid );
+
+ arguments->AddIntL(Usif::KSifInParam_InstallSilently, ETrue);
+
+ installer.Uninstall(cid, *arguments, *results, status, EFalse);
+ User::WaitForRequest(status);
+ HTI_LOG_FORMAT("uninstall status:%d", status.Int());
+ CleanupStack::PopAndDestroy(3); //results, arguments, installer
+ if (status != KErrNone)
+ {
+ SendErrorMsg(status.Int(), KErrDescrFailedUnInstall);
+ break;
+ }
+#endif
+ SendMessageL( EOk );
+ }
+ break;
+
+ default:
+ {
+ SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+ }
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiAppControl::HandleInstallerControlL" );
+ }
+
+
+void CHtiAppControl::HandleStartProcessL( const TDesC& aProgramName,
+ const TDesC& aCmdLine,
+ TBool aStoreProcessHandle )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::HandleStartProcessL" );
+ HTI_LOG_FORMAT( "progr name %d", aProgramName.Length() );
+ HTI_LOG_DES( aProgramName );
+
+ RProcess process;
+ TInt err = process.Create( aProgramName, aCmdLine ); // command parameters
+
+ if ( err == KErrNone )
+ {
+ CleanupClosePushL( process );
+
+ //convert process id to binary des
+ TUint processId = process.Id();
+ HTI_LOG_FORMAT( "process id %d", processId );
+
+ TBuf8<KTUintLength> processIdDes;
+ processIdDes.Append(
+ ( TUint8* )( &processId ), KTUintLength );
+
+ SendMessageL( EOk, processIdDes );
+
+ process.Resume();
+
+ if ( aStoreProcessHandle )
+ {
+ HTI_LOG_TEXT( "Storing the process handle" );
+ iProcessHandleArray.Append( process );
+ CleanupStack::Pop();
+ }
+ else
+ {
+ CleanupStack::PopAndDestroy();
+ }
+ }
+ else if ( err == KErrNotFound )
+ {
+ SendMessageL( ENotFound );
+ }
+ else
+ {
+ SendErrorMsg( err ,KErrDescrFailedCreateProcess );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiAppControl::HandleStartProcessL" );
+ }
+
+void CHtiAppControl::HandleStopProcessL( RProcess& aProcess )
+ {
+ if ( aProcess.ExitType() == EExitPending )
+ {
+ aProcess.Kill( KTerminateReason );
+ SendMessageL( EOk );
+ }
+ else
+ {
+ SendMessageL( EAlreadyStopped );
+ }
+ }
+
+void CHtiAppControl::HandleStatusProcessL( RProcess& aProcess )
+ {
+ TExitType exT = aProcess.ExitType();
+
+ switch ( exT )
+ {
+ case EExitPending:
+ {
+ SendMessageL( ERunning );
+ }
+ break;
+ case EExitKill:
+ case EExitTerminate:
+ {
+ SendMessageL( EKilled );
+ }
+ break;
+ case EExitPanic:
+ {
+ SendMessageL( EPanic );
+ }
+ break;
+ };
+ }
+
+
+void CHtiAppControl::HandleListProcessesL( const TDesC& aMatch )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::HandleListProcessesL" );
+
+ RProcess process;
+ TFullName processName;
+ TUint processId;
+ TBuf8<KTUintLength> processIdDes;
+ TExitType exitType;
+
+ TBuf8<128> buf;
+ CBufFlat* processListBuf = NULL;
+ TRAPD( err, processListBuf = CBufFlat::NewL( 128 ) );
+ if ( err )
+ {
+ SendErrorMsg( err ,KErrDescrNoMemory );
+ return;
+ }
+
+ CleanupStack::PushL( processListBuf );
+
+ // The default match pattern is the single character *
+ TFindProcess finder;
+
+ // if some real match pattern is defined, use it
+ if ( aMatch.Length() > 0 )
+ {
+ HTI_LOG_TEXT( "Match pattern was given:" );
+ HTI_LOG_DES( aMatch );
+ finder.Find( aMatch );
+ }
+
+ TInt pos = 0;
+ TUint numberOfEntries = 0;
+
+ while ( finder.Next( processName ) == KErrNone )
+ {
+ err = process.Open( finder );
+
+ //convert process id to binary des
+ processId = process.Id();
+ processIdDes.Append( ( TUint8* ) ( &processId ), KTUintLength );
+ buf.Append( processIdDes );
+
+ // status
+ exitType = process.ExitType();
+ switch ( exitType )
+ {
+ case EExitPending:
+ {
+ buf.Append( ERunning );
+ }
+ break;
+ case EExitKill:
+ case EExitTerminate:
+ {
+ buf.Append( EKilled );
+ }
+ break;
+ case EExitPanic:
+ {
+ buf.Append( EPanic );
+ }
+ break;
+ };
+
+ // name length
+ buf.Append( processName.Length() );
+
+ // name
+ buf.Append( processName );
+
+ process.Close();
+
+ TRAP( err, processListBuf->ExpandL( pos, buf.Length() ) );
+ if ( err )
+ {
+ SendErrorMsg( err , KErrDescrNoMemory );
+ delete processListBuf;
+ return;
+ }
+ processListBuf->Write( pos, buf, buf.Length() );
+
+ pos += buf.Length();
+ buf.Zero();
+ processIdDes.Zero();
+ numberOfEntries++;
+ }
+
+ // insert the number of entries in the beginning
+ TBuf8<2> entries;
+ entries.Append( ( TUint8* ) ( &numberOfEntries ), 2 );
+ processListBuf->ExpandL( 0, 2 );
+ processListBuf->Write( 0, entries, 2 );
+
+ SendMessageL( EOk, processListBuf->Ptr( 0 ) );
+
+ CleanupStack::PopAndDestroy( processListBuf );
+
+ HTI_LOG_FUNC_OUT( "CHtiAppControl::HandleListProcessesL" );
+ }
+
+
+void CHtiAppControl::HandleStartAppL( TApaAppInfo &aAppInfo,
+ const TDesC& aDocName )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::HandleStartAppL" );
+
+ // Check if app is running as a root app (not embedded)
+ TApaTask task = FindRunningRootApp( aAppInfo.iUid );
+ if ( task.Exists() )
+ {
+ User::ResetInactivityTime();
+ task.BringToForeground();
+ SendMessageL( EAlreadyRunning );
+ }
+ else
+ {
+ TThreadId threadId;
+ TInt err = KErrNone;
+ if ( aAppInfo.iUid != TUid::Null() )
+ {
+ TApaAppCapabilityBuf capBuf;
+ err = iAppServer.GetAppCapability( capBuf, aAppInfo.iUid );
+ TApaAppCapability& caps = capBuf();
+ CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
+ cmdLine->SetExecutableNameL( aAppInfo.iFullName );
+ if ( caps.iLaunchInBackground )
+ {
+ cmdLine->SetCommandL( EApaCommandBackground );
+ HTI_LOG_TEXT( "Launching in background" );
+ }
+ else
+ {
+ if ( aDocName != KNullDesC )
+ {
+ cmdLine->SetCommandL( EApaCommandOpen );
+ cmdLine->SetDocumentNameL( aDocName );
+ HTI_LOG_TEXT( "Launching with document" );
+ }
+ else
+ {
+ cmdLine->SetCommandL( EApaCommandRun );
+ HTI_LOG_TEXT( "Launching without document" );
+ }
+ }
+ err = iAppServer.StartApp( *cmdLine, threadId );
+ CleanupStack::PopAndDestroy( cmdLine );
+ }
+ else if ( aDocName != KNullDesC )
+ {
+ HTI_LOG_TEXT( "Launching a document" );
+ /*
+ * If the app that should handle the doc is already running, we
+ * try to switch the open file and bring it to foreground. Whether
+ * switching the file works depends on the application: It must
+ * implement CEikAppUi::OpenFileL() or CAknAppUi::OpenFileL() in S60.
+ */
+ TUid appUid;
+ TDataType dataType;
+ err = iAppServer.AppForDocument( aDocName, appUid, dataType );
+ if ( err == KErrNone )
+ {
+ TApaTask task = FindRunningRootApp( appUid );
+ if ( task.Exists() )
+ {
+ HTI_LOG_TEXT( "App for doc already running, switch file" );
+ err = task.SwitchOpenFile( aDocName );
+ task.BringToForeground();
+ }
+ else
+ {
+ err = iAppServer.StartDocument( aDocName, threadId );
+ }
+ }
+ }
+ else
+ {
+ User::Leave( KErrArgument );
+ }
+
+ if ( err == KErrNone )
+ {
+ User::ResetInactivityTime();
+ //convert thread id to string
+ TUint threadIdUint = threadId; //cast to UInt
+ TBuf8<KTUintLength> threadIdDes;
+ threadIdDes.Append( ( TUint8* )( &threadIdUint ), KTUintLength );
+ SendMessageL( EOk, threadIdDes );
+ }
+ else if ( err == KErrNotFound )
+ {
+ SendMessageL( ENotFound );
+ }
+ else
+ {
+ SendErrorMsg( err, KErrDescrFailedStartApp );
+ }
+ }
+ HTI_LOG_FUNC_OUT( "CHtiAppControl::HandleStartAppL" );
+ }
+
+void CHtiAppControl::HandleListInstalledAppsL( TBool aUnicode )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::HandleListInstalledAppsL" );
+
+ // max file name + max caption + max short caption + 7 constant bytes
+ TInt bufSize = KMaxFileName + 2 * KApaMaxAppCaption + 7;
+ if ( aUnicode )
+ {
+ bufSize *= 2;
+ }
+
+ CBufFlat* appListBuf = CBufFlat::NewL( bufSize );
+ CleanupStack::PushL( appListBuf );
+
+ HBufC8* appsArray = HBufC8::NewLC( bufSize );
+ TPtr8 appsArrayPtr = appsArray->Des();
+
+ TInt err = KErrNone;
+ err = iAppServer.GetAllApps();
+ if ( err != KErrNone )
+ {
+ SendErrorMsg( err, KErrDescrFailedListInstApps );
+ }
+ else
+ {
+ TApaAppInfo appInfo;
+ TInt pos( 0 );
+
+ // Add application count
+ TInt numOfEntries = 0;
+ iAppServer.AppCount( numOfEntries );
+
+ appsArrayPtr.Append( ( TUint8*) ( &numOfEntries ), 2 );
+
+ while ( iAppServer.GetNextApp( appInfo ) == KErrNone )
+ {
+ TUint appUidUint = appInfo.iUid.iUid;
+ appsArrayPtr.Append( ( TUint8* ) &appUidUint, KTUintLength );
+
+ // Add length of full name
+ appsArrayPtr.Append( appInfo.iFullName.Length() );
+ // Add full name if there is one
+ if ( appInfo.iFullName.Length() > 0 )
+ {
+ if ( aUnicode )
+ {
+ appsArrayPtr.Append( ( TUint8* ) appInfo.iFullName.Ptr(),
+ appInfo.iFullName.Length() * 2 );
+ }
+ else
+ {
+ appsArrayPtr.Append( appInfo.iFullName );
+ }
+ }
+
+ // Add length of caption
+ appsArrayPtr.Append( appInfo.iCaption.Length() );
+ // Add caption if there is one
+ if ( appInfo.iCaption.Length() > 0 )
+ {
+ if ( aUnicode )
+ {
+ appsArrayPtr.Append( ( TUint8* ) appInfo.iCaption.Ptr(),
+ appInfo.iCaption.Length() * 2 );
+ }
+ else
+ {
+ appsArrayPtr.Append( appInfo.iCaption );
+ }
+ }
+
+ // Add length of short caption
+ appsArrayPtr.Append( appInfo.iShortCaption.Length() );
+ // Add short caption if there is one
+ if ( appInfo.iShortCaption.Length() > 0 )
+ {
+ if ( aUnicode )
+ {
+ appsArrayPtr.Append( ( TUint8* ) appInfo.iShortCaption.Ptr(),
+ appInfo.iCaption.Length() * 2 );
+ }
+ else
+ {
+ appsArrayPtr.Append( appInfo.iShortCaption );
+ }
+ }
+
+ // Add app info to response buffer
+ appListBuf->ExpandL( pos, appsArray->Length() );
+ appListBuf->Write( pos, *appsArray, appsArray->Length() );
+
+ pos += appsArray->Length();
+ appsArrayPtr.Zero();
+ }
+
+ SendMessageL( EOk, appListBuf->Ptr( 0 ) );
+ }
+
+ CleanupStack::PopAndDestroy( 2 ); //appListBuf, appsArray
+
+ HTI_LOG_FUNC_IN( "CHtiAppControl::HandleListInstalledAppsL" );
+ }
+
+void CHtiAppControl::HandleListAppsL( TBool aIncludeHidden,
+ TBool aIncludeSystem,
+ TBool aUnicode )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::HandleListAppsL" );
+
+ RArray<RWsSession::TWindowGroupChainInfo>* wgChain = new ( ELeave )
+ RArray<RWsSession::TWindowGroupChainInfo>( 12 );
+ CleanupDeletePushL( wgChain );
+ CleanupClosePushL( *wgChain );
+ User::LeaveIfError( iWs.WindowGroupList( 0, wgChain ) );
+ TInt wgCount = wgChain->Count();
+
+ HTI_LOG_FORMAT( "%d Window Groups in the chain", wgCount );
+
+ TInt bufSize = 2 * KMaxFileName + 11; // caption & document + 11 constant bytes
+ if ( aUnicode )
+ {
+ bufSize *= 2;
+ }
+ CBufFlat* appListBuf = CBufFlat::NewL( bufSize );
+ CleanupStack::PushL( appListBuf );
+ HBufC8* buf = HBufC8::NewLC( bufSize );
+ TPtr8 bufPtr = buf->Des();
+
+ TInt pos = 0;
+ TInt numOfEntries = 0;
+
+ for ( TInt i = 0; i < wgCount; i++ )
+ {
+ const RWsSession::TWindowGroupChainInfo& info = ( *wgChain )[i];
+ CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( iWs, info.iId );
+
+ HTI_LOG_FORMAT( "WG ID: %d", info.iId );
+ HTI_LOG_DES( wgName->WindowGroupName() );
+
+ // Info is returned only from root tasks and system and hidden tasks
+ // are included only if requested.
+ if ( info.iParentId <= 0 &&
+ ( !wgName->IsSystem() || aIncludeSystem ) &&
+ ( !wgName->Hidden() || aIncludeHidden ) )
+ {
+ // Add application UID
+ TUint appUidUint = wgName->AppUid().iUid;
+ bufPtr.Append( ( TUint8* ) &appUidUint, KTUintLength );
+
+ // Add caption
+ TPtrC caption = wgName->Caption();
+ bufPtr.Append( caption.Length() );
+ if ( caption.Length() > 0 )
+ {
+ if ( aUnicode )
+ {
+ bufPtr.Append(
+ ( TUint8* ) caption.Ptr(), caption.Length() * 2 );
+ }
+ else
+ {
+ bufPtr.Append( caption );
+ }
+ }
+
+ // Add document name
+ TPtrC document = wgName->DocName();
+ bufPtr.Append( document.Length() );
+ if ( document.Length() > 0 )
+ {
+ if ( aUnicode )
+ {
+ bufPtr.Append(
+ ( TUint8* ) document.Ptr(), document.Length() * 2 );
+ }
+ else
+ {
+ bufPtr.Append( document );
+ }
+ }
+
+ // Add Hidden flag
+ if ( wgName->Hidden() )
+ bufPtr.Append( 1 );
+ else
+ bufPtr.Append( 0 );
+
+ // Add System flag
+ if ( wgName->IsSystem() )
+ bufPtr.Append( 1 );
+ else
+ bufPtr.Append( 0 );
+
+ // Add Ready flag
+ if ( wgName->IsAppReady() )
+ bufPtr.Append( 1 );
+ else
+ bufPtr.Append( 0 );
+
+ // Add Busy flag
+ if ( wgName->IsBusy() )
+ bufPtr.Append( 1 );
+ else
+ bufPtr.Append( 0 );
+
+ // Add Shutdown response flag
+ if ( wgName->RespondsToShutdownEvent() )
+ bufPtr.Append( 1 );
+ else
+ bufPtr.Append( 0 );
+
+ // Add this task's info to response buffer
+ appListBuf->ExpandL( pos, buf->Length() );
+ appListBuf->Write( pos, *buf, buf->Length() );
+
+ pos += buf->Length();
+ bufPtr.Zero();
+ numOfEntries++;
+ } // if
+ CleanupStack::PopAndDestroy(); // wgName
+ } // for
+
+ CleanupStack::PopAndDestroy(); // buf
+
+ // Add number of entries to the beginning of the response
+ TBuf8<2> entries;
+ entries.Append( ( TUint8* ) ( &numOfEntries ), 2 );
+ appListBuf->ExpandL( 0, 2 );
+ appListBuf->Write( 0, entries, 2 );
+
+ SendMessageL( EOk, appListBuf->Ptr( 0 ) );
+
+ CleanupStack::PopAndDestroy( 3 ); // appListBuf, wgChain Close, wgChain delete
+
+ HTI_LOG_FUNC_OUT( "CHtiAppControl::HandleListAppsL" );
+ }
+
+TBool CHtiAppControl::FindAppL( TApaAppInfo& aAppInfo,
+ const TDesC& aAppFullName )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::FindAppL name" );
+ TInt err = KErrNone;
+ err = iAppServer.GetAllApps();
+ if ( err != KErrNone )
+ {
+ SendErrorMsg( err, KErrDescrFailedFindApp );
+ return EFalse;
+ }
+
+ TParse toFind;
+ err = toFind.SetNoWild( aAppFullName, NULL, NULL );
+ if ( err != KErrNone )
+ {
+ SendErrorMsg( err, KErrDescrFailedFindApp );
+ return EFalse;
+ }
+
+ TBool isFullName = ( toFind.DrivePresent() && toFind.PathPresent() );
+
+ while ( ( err = iAppServer.GetNextApp( aAppInfo) ) == KErrNone )
+ {
+ if ( isFullName ) // assume that full path has been given
+ {
+ if ( !aAppFullName.CompareF( aAppInfo.iFullName ) )
+ {
+ return ETrue;
+ }
+ }
+ else // assume that only filename has been given
+ {
+ TParsePtrC current( aAppInfo.iFullName );
+
+ // does the given filename contain extension
+ if ( toFind.ExtPresent() )
+ {
+ // compare with filename + extension
+ if ( !toFind.NameAndExt().CompareF( current.NameAndExt() ) )
+ {
+ return ETrue;
+ }
+ }
+ else
+ {
+ // compare with filename only
+ if ( !toFind.Name().CompareF( current.Name() ) )
+ {
+ return ETrue;
+ }
+ // Try to match the caption.
+ // For Java MIDlets the full name is like C:\270194328.fakeapp
+ // so we have to use caption to find MIDlets.
+ if ( !toFind.Name().CompareF( aAppInfo.iCaption ) )
+ {
+ return ETrue;
+ }
+ }
+ }
+ }
+
+ if ( err == RApaLsSession::ENoMoreAppsInList )
+ {
+ SendMessageL( ENotFound );
+ }
+ else if ( err != KErrNone )
+ {
+ SendErrorMsg( err,KErrDescrFailedFindApp );
+ }
+ HTI_LOG_FUNC_OUT( "CHtiAppControl::FindAppL name" );
+ return EFalse;
+ }
+
+TBool CHtiAppControl::FindAppL( TApaAppInfo &aAppInfo,
+ const TInt32 aUid )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::FindAppL uid" );
+ TInt err = iAppServer.GetAppInfo( aAppInfo, TUid::Uid( aUid ) );
+ if ( err == KErrNone )
+ {
+ return ETrue;
+ }
+ else if ( err == KErrNotFound )
+ {
+ SendMessageL( ENotFound );
+ }
+ else
+ {
+ SendErrorMsg( err , KErrDescrFailedFindApp );
+ }
+ HTI_LOG_FUNC_OUT( "CHtiAppControl::FindAppL uid" );
+ return EFalse;
+ }
+
+TApaTask CHtiAppControl::FindRunningRootApp( TUid aAppUid )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::FindRunningRootApp" );
+ TApaTask task( iWs );
+ task.SetWgId( 0 ); // initialize to empty task
+
+ TInt wgId = 0; // on first call to FindByAppUid wgId must be zero
+ CApaWindowGroupName::FindByAppUid( aAppUid, iWs, wgId );
+ HTI_LOG_FORMAT( "FindByAppUid returned WG ID: %d", wgId );
+
+ RArray<RWsSession::TWindowGroupChainInfo> wgs;
+ TInt err = KErrNone;
+ TInt wgCount = 0;
+ if ( wgId != KErrNotFound )
+ {
+ // Get a list of Window Group Chain Infos
+ err = iWs.WindowGroupList( 0, &wgs ); // get only priority 0 WGs
+ wgCount = wgs.Count();
+ HTI_LOG_FORMAT( "WindowGroupList returned %d WGs", wgCount );
+ }
+ while ( wgId != KErrNotFound && task.WgId() == 0 && err == KErrNone )
+ {
+ // App was found - check if it is root by looping through the
+ // WG chain infos to find the one with out wgId
+ TInt i = 0;
+ while ( task.WgId() == 0 && i < wgCount )
+ {
+ const RWsSession::TWindowGroupChainInfo& info = wgs[i];
+ if ( info.iId == wgId && info.iParentId <= 0 )
+ {
+ // This is the one and it is root (does not have parent)
+ task.SetWgId( wgId );
+ }
+ i++;
+ }
+ if ( task.WgId() == 0 )
+ {
+ // This was not root - check if there's more instances of the app
+ CApaWindowGroupName::FindByAppUid( aAppUid, iWs, wgId );
+ HTI_LOG_FORMAT( "FindByAppUid returned WG ID: %d", wgId );
+ }
+ }
+
+ wgs.Close();
+ HTI_LOG_FORMAT( "Returning task with WG ID %d", task.WgId() );
+ HTI_LOG_FUNC_OUT( "CHtiAppControl::FindRunningRootApp" );
+ return task;
+ }
+
+TInt CHtiAppControl::OpenProcessL( RProcess& aProcess,
+ const TDesC& aMatch )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::OpenProcessL" );
+ TFullName processName;
+ TInt err = KErrNone;
+ TFindProcess finder( aMatch );
+
+ err = finder.Next( processName );
+ if ( err == KErrNone )
+ {
+ err = aProcess.Open( finder );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiAppControl::OpenProcessL" );
+ return err;
+ }
+
+template<class T> T CHtiAppControl::Parse32(
+ const TDesC8& a32int )
+ {
+ //manually construct TUint or TInt32
+ return T( a32int[0] + ( a32int[1] << 8 ) +
+ ( a32int[2] << 16) + ( a32int[3] << 24) );
+ }
+
+void CHtiAppControl::SendMessageL( TAppCommand aResponseCode,
+ const TDesC8& aMsg )
+ {
+ HTI_LOG_FORMAT( "SendMessage %d", aResponseCode );
+ HTI_LOG_FORMAT( "Message len %d", aMsg.Length() );
+ HBufC8* sendMsg = HBufC8::NewL( 1 + aMsg.Length() );
+ CleanupStack::PushL( sendMsg );
+ sendMsg->Des().Append( aResponseCode );
+ sendMsg->Des().Append( aMsg );
+
+ User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+ sendMsg,
+ KAppServiceUid ) );
+ CleanupStack::Pop();
+ }
+
+inline TInt CHtiAppControl::SendErrorMsg( TInt anError,
+ const TDesC8& aMsg )
+ {
+ return iDispatcher->DispatchOutgoingErrorMessage( anError,
+ aMsg,
+ KAppServiceUid );
+ }
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+SwiUI::TPolicy CHtiAppControl::ConvertToPolicy( const TInt8 aValue )
+ {
+ if ( aValue == 0 ) return SwiUI::EPolicyNotAllowed;
+
+ return SwiUI::EPolicyAllowed;
+ }
+#else
+Usif::TSifPolicy CHtiAppControl::ConvertToSifPolicy( const TInt8 aValue )
+ {
+ if ( aValue == 0 ) return Usif::ENotAllowed;
+
+ return Usif::EAllowed;
+ }
+#endif
+
+TBool CHtiAppControl::ValidateInstallParams( const TDesC8& aParams, TBool aIsUnicode )
+ {
+ HTI_LOG_FORMAT( "ValidateInstallParams => length: %d", aParams.Length() );
+ if ( aParams.Length() > 0 )
+ {
+ TInt offset = 0;
+ TInt length = aParams[offset]; // inst package path length;
+ if ( aIsUnicode ) length *= 2;
+ offset++;
+ if ( aParams.Length() < offset + length )
+ {
+ HTI_LOG_TEXT( "ValidateInstallParams: Failed, data missing in inst pkg path" );
+ return EFalse;
+ }
+
+ offset += length; // skip over inst package path
+ offset += 10; // skip over the following one byte params
+
+ if ( aParams.Length() < offset )
+ {
+ HTI_LOG_TEXT( "ValidateInstallParams: Failed, data missing in one byte params" );
+ return EFalse;
+ }
+
+ length = aParams[offset]; // login username length;
+ if ( aIsUnicode ) length *= 2;
+ offset++;
+ if ( aParams.Length() < offset + length )
+ {
+ HTI_LOG_TEXT( "ValidateInstallParams: Failed, data missing in username" );
+ return EFalse;
+ }
+
+ offset += length; // skip over login username
+
+ length = aParams[offset]; // password length;
+ if ( aIsUnicode ) length *= 2;
+ offset++;
+ if ( aParams.Length() < offset + length )
+ {
+ HTI_LOG_TEXT( "ValidateInstallParams: Failed, data missing in password" );
+ return EFalse;
+ }
+
+ offset += length; // skip over password
+ offset += 4; // the last one byte params
+
+ if ( aParams.Length() < offset || aParams.Length() > offset + 2)
+ {
+ HTI_LOG_TEXT( "ValidateInstallParams: Failed, final length incorrect" );
+ return EFalse;
+ }
+
+ return ETrue;
+ }
+
+ return EFalse;
+ }
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+TInt CHtiAppControl::GetPackageUidL( const TDesC& aPackageName,
+ TInt aMimeIndex )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAppControl::GetPackageUidL" );
+
+ if ( aMimeIndex >= 0 && aMimeIndex < 2 ) // SIS
+ {
+ Swi::RSisRegistrySession regSession;
+ User::LeaveIfError( regSession.Connect() );
+ CleanupClosePushL( regSession );
+
+ RArray<TUid> uids;
+ CleanupClosePushL( uids );
+ regSession.InstalledUidsL( uids );
+ TInt count = uids.Count();
+ HTI_LOG_FORMAT( "Found %d SISx installations", count );
+ for ( TInt i = 0; i < count; i++ )
+ {
+ Swi::RSisRegistryEntry entry;
+ CleanupClosePushL( entry );
+ User::LeaveIfError( entry.Open( regSession, uids[i] ) );
+ if ( !entry.IsInRomL() && entry.IsPresentL() )
+ {
+ if ( aPackageName.Compare( *( entry.PackageNameL() ) ) == 0 )
+ {
+ HTI_LOG_TEXT( "Matching SIS package found" );
+ TInt uid = entry.UidL().iUid;
+ CleanupStack::PopAndDestroy( 3 ); // entry, uids, regSession
+ return uid;
+ }
+ }
+ // Check augmentations of this entry
+ entry.AugmentationsL( iAugmentations );
+ TInt augCount = iAugmentations.Count();
+ for ( TInt j = 0; j < augCount; j++ )
+ {
+ Swi::RSisRegistryEntry augmentation;
+ CleanupClosePushL( augmentation );
+ augmentation.OpenL( regSession, *iAugmentations[j] );
+ if ( aPackageName.Compare(
+ *( augmentation.PackageNameL() ) ) == 0 )
+ {
+ if ( !augmentation.IsInRomL() && augmentation.IsPresentL() )
+ {
+ HTI_LOG_TEXT( "Matching SIS augmentation found" );
+ TInt uid = augmentation.UidL().iUid;
+ Swi::CSisRegistryPackage* pkg = augmentation.PackageL();
+ iAugmentationIndex = pkg->Index();
+ delete pkg;
+ HTI_LOG_FORMAT( "Aug. index %d", iAugmentationIndex );
+ CleanupStack::PopAndDestroy( 4 ); // augmentation, entry, uids, regSession
+ return uid;
+ }
+ }
+ CleanupStack::PopAndDestroy(); // augmentation
+ } // for j
+ iAugmentations.ResetAndDestroy();
+ CleanupStack::PopAndDestroy(); // entry
+ } // for i
+ User::Leave( KErrNotFound );
+ }
+
+ else if ( aMimeIndex > 2 && aMimeIndex < 7 ) // Java
+ {
+ RArray<TUid> uids;
+ CleanupClosePushL( uids );
+
+ CJavaRegistry* javaRegistry = CJavaRegistry::NewLC();
+ javaRegistry->GetRegistryEntryUidsL( uids );
+
+ TInt uid = KErrNotFound;
+ TInt count = uids.Count();
+ HTI_LOG_FORMAT( "Found %d Java installations", count );
+ for ( TInt i = 0; i < count; i++ )
+ {
+ CJavaRegistryEntry* entry = javaRegistry->RegistryEntryL( uids[i] );
+ if ( entry )
+ {
+ CleanupStack::PushL( entry );
+ if ( entry->Type() >= EGeneralPackage &&
+ entry->Type() < EGeneralApplication )
+ {
+ // entry was a package (MIDlet suite)
+ CJavaRegistryPackageEntry* packageEntry =
+ ( CJavaRegistryPackageEntry* ) entry;
+ if ( aPackageName.Compare( packageEntry->Name() ) == 0 )
+ {
+ HTI_LOG_TEXT( "Matching Java installation found" );
+ uid = packageEntry->Uid().iUid;
+ CleanupStack::PopAndDestroy( entry );
+ break;
+ }
+ }
+ CleanupStack::PopAndDestroy( entry );
+ }
+ }
+ CleanupStack::PopAndDestroy( javaRegistry );
+ CleanupStack::PopAndDestroy( &uids );
+ User::LeaveIfError( uid );
+ return uid;
+ }
+
+ else if ( aMimeIndex == 7 ) // Widget
+ {
+ RWidgetRegistryClientSession widgetRegistry;
+ User::LeaveIfError( widgetRegistry.Connect() );
+
+ RWidgetInfoArray widgets;
+ TRAPD( err, widgetRegistry.InstalledWidgetsL( widgets ) );
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "Failed to get installed widgets %d", err );
+ widgets.ResetAndDestroy();
+ widgetRegistry.Disconnect();
+ User::Leave( err );
+ }
+
+ TInt uid = KErrNotFound;
+ TInt count = widgets.Count();
+ HTI_LOG_FORMAT( "Found %d Widget installations", count );
+ for ( TInt i = 0; i < count; i++ )
+ {
+ CWidgetInfo* widgetInfo = widgets[i];
+ HTI_LOG_DES( *( widgetInfo->iBundleName ) );
+ if ( aPackageName.Compare( *( widgetInfo->iBundleName ) ) == 0 )
+ {
+ HTI_LOG_TEXT( "Matching Widget installation found" );
+ uid = widgetInfo->iUid.iUid;
+ break;
+ }
+ }
+ widgets.ResetAndDestroy();
+ widgetRegistry.Disconnect();
+ User::LeaveIfError( uid );
+ return uid;
+ }
+
+ else // invalid mime index
+ {
+ User::Leave( KErrArgument );
+ }
+
+ return KErrNone; // never returns from here
+ }
+#else
+TInt CHtiAppControl::GetComponentIdFromUid(const TInt32 aUid)
+ {
+ TInt cid = KErrNotFound;
+ Usif::RSoftwareComponentRegistry registry;
+ User::LeaveIfError(registry.Connect());
+ CleanupClosePushL(registry);
+ RArray<TUid> uidList;
+ CleanupClosePushL(uidList);
+ RArray<Usif::TComponentId> componentIdList;
+ CleanupClosePushL(componentIdList);
+ registry.GetComponentIdsL(componentIdList);
+ for(TInt i = 0; i < componentIdList.Count(); i++)
+ {
+ Usif::TComponentId compId = componentIdList[i];
+ Usif::CComponentEntry *compEntry = Usif::CComponentEntry::NewLC();
+ if(registry.GetComponentL(compId, *compEntry))
+ {
+ /*if(compEntry->IsRemovable() &&
+ compEntry->SoftwareType() == Usif::KSoftwareTypeNative)*/
+ if(compEntry->IsRemovable())
+ {
+ _LIT(KCompUid, "CompUid");
+ Usif::CPropertyEntry *property =
+ registry.GetComponentPropertyL(compId, KCompUid);
+ CleanupStack::PushL(property);
+ Usif::CIntPropertyEntry* intProperty =
+ dynamic_cast<Usif::CIntPropertyEntry*>(property);
+ uidList.AppendL(TUid::Uid(intProperty->IntValue()));
+ CleanupStack::PopAndDestroy(property);
+ }
+ else
+ {
+ uidList.AppendL(KNullUid);
+ }
+ }
+ CleanupStack::PopAndDestroy( compEntry );
+ }
+ TUid tuid(TUid::Uid(aUid));
+ if(tuid != KNullUid)
+ {
+ TInt index = uidList.Find(tuid);
+ if(index >= 0 && index < componentIdList.Count())
+ {
+ cid = componentIdList[index];
+ }
+ }
+ CleanupStack::PopAndDestroy( 3, ®istry );// componentIdList, uidList, registry
+ return cid;
+ }
+
+TInt CHtiAppControl::GetComponentIdFromPackageName(const TDesC& aPackageName)
+ {
+ TInt cid = KErrNotFound;
+ Usif::RSoftwareComponentRegistry registry;
+ User::LeaveIfError(registry.Connect());
+ CleanupClosePushL(registry);
+ RArray<Usif::TComponentId> componentIdList;
+ CleanupClosePushL(componentIdList);
+ registry.GetComponentIdsL(componentIdList);
+ TInt count = componentIdList.Count();
+ for(TInt i = 0; i < count; i++)
+ {
+ Usif::TComponentId compId = componentIdList[i];
+ Usif::CComponentEntry *compEntry = Usif::CComponentEntry::NewLC();
+ if(registry.GetComponentL(compId, *compEntry))
+ {
+ if(compEntry->IsRemovable())
+ {
+ if ( aPackageName.Compare( compEntry->Name() ) == 0 )
+ {
+ cid = compId;
+ CleanupStack::PopAndDestroy( compEntry );
+ break;
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy( compEntry );
+ }
+ CleanupStack::PopAndDestroy( 2, ®istry );// componentIdList, registry
+ return cid;
+ }
+
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAudioServicePlugin/data/1020DEC8.rss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HTI service plugin for playing audio.
+*
+*/
+
+
+
+// RESOURCE IDENTIFIER
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+
+// CONSTANTS
+
+// MACROS
+
+
+// RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// theInfo
+// ECom registry info resource.
+//
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE REGISTRY_INFO theInfo
+ {
+ // UID for the DLL
+ dll_uid = 0x1020DEC8;
+ // Declare array of interface info
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // UID of interface that is implemented
+ interface_uid = 0x1020DEB7;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10210CCB;
+ version_no = 1;
+ display_name = "Audio Control Service";
+ default_data = "AUDIO";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAudioServicePlugin/group/HtiAudioServicePlugin.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HTI service plugin for controlling audio playback.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET HtiAudioServicePlugin.dll
+TARGETTYPE PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x1020DEC8
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
+
+SOURCEPATH ../src
+SOURCE proxy.cpp
+SOURCE HtiAudioServicePlugin.cpp
+
+USERINCLUDE ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE ../data/1020DEC8.rss
+TARGET HtiAudioServicePlugin.rsc
+END
+
+LIBRARY apgrfx.lib // RApaLsSession
+LIBRARY apmime.lib // TDataType
+LIBRARY bafl.lib
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+LIBRARY mediaclientaudio.lib
+LIBRARY platformenv.lib
+LIBRARY flogger.lib
+
+SMPSAFE
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAudioServicePlugin/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for HtiAudioServicePlugin
+*
+*/
+
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiAudioServicePlugin.mmp
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAudioServicePlugin/inc/HtiAudioServicePlugin.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,279 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Defines the ECom plugin for HTI audio playback control service.
+*
+*/
+
+
+
+#ifndef HTIAUDIOSERVICEPLUGIN_H
+#define HTIAUDIOSERVICEPLUGIN_H
+
+// INCLUDES
+#include <badesca.h>
+#include <HtiServicePluginInterface.h>
+#include <mdaaudiosampleplayer.h>
+#include <mdaaudiotoneplayer.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* The ECom plugin for HTI audio playback control service.
+*
+*/
+class CHtiAudioServicePlugin : public CHTIServicePluginInterface,
+ public MMdaAudioPlayerCallback,
+ public MMdaAudioToneObserver
+ {
+
+ protected:
+ // commands
+ enum TAudioCommands
+ {
+ ECmdListAudioFiles = 0x01,
+ ECmdPlayFile = 0x02,
+ ECmdPlayTone = 0x03,
+ ECmdPlayDtmf = 0x04,
+ ECmdStop = 0x05,
+ ECmdGetDuration = 0x06,
+ ECmdGetMaxVol = 0x07,
+ ECmdSetVol = 0x08
+ };
+
+ // audio setting options
+ enum TAudioSetting
+ {
+ EDefault,
+ EGeneralMusic,
+ ERingTonePreview,
+ //EIncomingCall,
+ EDtmfString
+ };
+
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CHtiAudioServicePlugin* NewL();
+
+ public: // New functions
+
+ public: // Functions from base classes
+
+ /**
+ * From CHTIServicePluginInterface
+ * Called by the HTI Framework when sending message to this service.
+ * @param aMessage message body destinated to a servive
+ * @param aPriority message priority
+ */
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+ /**
+ * From CHTIServicePluginInterface
+ * Called by HTI Framework to tell the service how much memory is
+ * available for messages in the message queue.
+ * @param aAvailableMemory amount of currently available memory
+ * in the message queue
+ */
+ void NotifyMemoryChange( TInt aAvailableMemory );
+
+ /**
+ * From CHTIServicePluginInterface
+ * Indicates to HTI Framework whether the plugin is ready to process
+ * a new message or if it's busy processing previous message.
+ */
+ TBool IsBusy();
+
+ /**
+ * From MMdaAudioToneObserver
+ * Handle the event when a tone utility initialisation
+ * operation has completed.
+ * @param aError indicates whether an error occurred.
+ */
+ void MatoPrepareComplete( TInt aError );
+
+ /**
+ * From MMdaAudioToneObserver
+ * Handle the event when a tone playing operation has completed.
+ * @param aError indicates whether an error occurred.
+ */
+ void MatoPlayComplete( TInt aError );
+
+ /**
+ * From MMdaAudioPlayerCallback
+ * Handle the event when initialisation of
+ * the audio player utility is complete.
+ * @param aError The status of the audio sample after initialisation
+ * @param aDuration The duration of the sample
+ */
+ void MapcInitComplete( TInt aError,
+ const TTimeIntervalMicroSeconds& aDuration );
+
+ /**
+ * From MMdaAudioPlayerCallback
+ * Handle the event when when the audio player utility
+ * completes asynchronous playing.
+ * @param aError The status of playback
+ */
+ void MapcPlayComplete( TInt aError );
+
+
+ protected: // New functions
+
+ /**
+ * C++ default constructor.
+ */
+ CHtiAudioServicePlugin();
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CHtiAudioServicePlugin();
+
+
+ protected: // Functions from base classes
+
+ private:
+
+ void HandleListAudioFilesCmdL( const TDesC8& aMessage );
+
+ void HandlePlayFileCmdL( const TDesC8&aMessage );
+
+ void HandlePlayToneCmdL( const TDesC8& aMessage );
+
+ void HandlePlayDtmfCmdL( const TDesC8& aMessage );
+
+ void HandleStopCmdL( const TDesC8& aMessage );
+
+ void HandleGetDurationCmdL( const TDesC8& aMessage );
+
+ void HandleGetMaxVolCmdL( const TDesC8& aMessage );
+
+ void HandleSetVolCmdL( const TDesC8& aMessage );
+
+ TInt ParseString( const TDesC8& aRequest,
+ TInt aOffset, TDes& aResult );
+
+ TInt SendResponseMsg( const TDesC8& aMsg,
+ const TUint8 aCommandId = 0 );
+
+ TInt SendErrorResponseMsg( TInt aErrorCode,
+ const TDesC8& aErrorDescription,
+ const TUint8 aCommandId = 0 );
+
+ void AddSubdirsRecursivelyL( const TDesC& aPath,
+ CDesCArraySeg& aArray, RFs& aFs );
+
+ TBool MatchMimeTypeL( const TDesC& aFilePath,
+ const TDesC& aMimeTypeMatchPattern );
+
+ void SetAudioSettings( TAudioSetting aSetting );
+
+ inline TUint ParseUint16( const TUint8* aPtr )
+ {
+ return aPtr[0] + ( aPtr[1] << 8 );
+ }
+
+ inline TUint ParseUint32( const TUint8* aPtr )
+ {
+ return aPtr[0] + ( aPtr[1] << 8 )
+ + ( aPtr[2] << 16 ) + ( aPtr[3] << 24 );
+ }
+
+
+ public: // Data
+
+ protected: // Data
+
+ private: // Data
+ // Flag telling if the service is busy processing a message
+ TBool iIsBusy;
+
+ // Flag telling if audio or tone is currently playing
+ TBool iIsPlaying;
+
+ // Id of the latest command
+ TUint8 iCommandId;
+
+ // Id of the latest play command
+ TUint8 iPlayCommandId;
+
+ // Container for the response message to be dispatched out
+ HBufC8* iMessage;
+
+ // Error code in the outgoing error message
+ TInt iErrorCode;
+
+ // Audio player utility object
+ CMdaAudioPlayerUtility* iAudioPlayer;
+
+ // Tone player utility object
+ CMdaAudioToneUtility* iTonePlayer;
+
+ // Current volume value
+ TInt iVolume;
+
+ // Current repeat value
+ TInt iRepeats;
+
+ // Current trailing silence value
+ TInt iTrailingSilence;
+
+ // DTMF tone length
+ TInt iDtmfLength;
+
+ // Silence between DTMF tones
+ TInt iDtmfGapLength;
+
+ // Playback start position
+ TInt iStartPos;
+
+ // Playback end position
+ TInt iEndPos;
+
+ // Audio priority setting
+ TInt iAudioPriority;
+
+ // Audio priority preference setting
+ TMdaPriorityPreference iAudioPriorityPreference;
+
+
+ public: // Friend classes
+
+ protected: // Friend classes
+
+ private: // Friend classes
+
+ };
+
+#endif // HTIAUDIOSERVICEPLUGIN_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAudioServicePlugin/src/HtiAudioServicePlugin.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,1672 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implements the ECom plugin for HTI audio playback control
+* service.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <apgcli.h>
+#include <AudioPreference.h>
+#include <bautils.h>
+#include <e32std.h>
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+#include <pathinfo.h>
+
+#include "HtiAudioServicePlugin.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const static TInt KPlayToneCmdLength = 13;
+const static TInt KStopCmdLength = 1;
+const static TInt KSetVolCmdLength = 2;
+const static TInt KListCmdMinLength = 4;
+const static TInt KPlayDtmfCmdMinLength = 17;
+const static TInt KPlayFileCmdMinLength = 21;
+const static TInt KDurationCmdMinLength = 6;
+const static TInt KMaxVolCmdMinLength = 6;
+
+const static TInt KTUintSize = sizeof( TUint );
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+const static TUid KAudioServiceUid = { 0x10210CCB };
+
+_LIT( KBackslash, "\\" );
+_LIT( KRngMimeType, "application/vnd.nokia.ringing-tone" );
+_LIT( KAudioMimeType, "audio/*" );
+
+// NOTE: Max length for error description is defined
+// in HtiDispatcherInterface.h (currently 118).
+_LIT8( KErrorNoCmd, "ERROR: No command given" );
+_LIT8( KErrorUnknownCmd, "ERROR: Unknown Audio Service command" );
+_LIT8( KErrorInvalidParameters,
+ "ERROR: Invalid parameter data for this command" );
+_LIT8( KErrorInvalidPath, "ERROR: Invalid path" );
+_LIT8( KErrorToneInitFailed, "ERROR: Tone initialization failed" );
+_LIT8( KErrorTonePlayFailed, "ERROR: Tone playing failed" );
+_LIT8( KErrorFileInitFailed, "ERROR: File playing initialization failed" );
+_LIT8( KErrorFilePlayFailed, "ERROR: File playing failed" );
+_LIT8( KErrorBusyPlaying, "ERROR: Currently busy playing" );
+_LIT8( KErrorNothingPlaying, "ERROR: Nothing playing" );
+_LIT8( KErrorDurationFailed, "ERROR: Duration query failed" );
+_LIT8( KErrorMaxVolFailed, "ERROR: Max volume query failed" );
+_LIT8( KErrorPosition, "ERROR: Invalid start or end position value" );
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::CHtiAudioServicePlugin
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CHtiAudioServicePlugin::CHtiAudioServicePlugin():iIsBusy( EFalse ),
+ iIsPlaying( EFalse ),
+ iCommandId( 0 ),
+ iPlayCommandId( 0 ),
+ iMessage( NULL ),
+ iErrorCode( 0 ),
+ iVolume( 0 ),
+ iRepeats( 0 ),
+ iTrailingSilence( 0 ),
+ iDtmfLength( 0 ),
+ iDtmfGapLength( 0 ),
+ iStartPos( 0 ),
+ iEndPos( 0 )
+ {
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::ConstructL()
+ {
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CHtiAudioServicePlugin* CHtiAudioServicePlugin::NewL()
+ {
+ CHtiAudioServicePlugin* self = new (ELeave) CHtiAudioServicePlugin;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+// Destructor
+CHtiAudioServicePlugin::~CHtiAudioServicePlugin()
+ {
+ delete iMessage;
+ iMessage = NULL;
+ delete iAudioPlayer;
+ iAudioPlayer = NULL;
+ delete iTonePlayer;
+ iTonePlayer = NULL;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::ProcessMessageL
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/ )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::ProcessMessageL" );
+ HTI_LOG_FORMAT( "Message length = %d", aMessage.Length() );
+
+ if ( iIsBusy )
+ {
+ HTI_LOG_TEXT( "Plugin is busy - leaving" );
+ User::Leave( KErrInUse );
+ }
+
+ // Will be set to EFalse in the SendResponseMsg or SendErrorResponseMsg
+ // methods when the response has been successfully sent and the plugin is
+ // ready for next message.
+ iIsBusy = ETrue;
+
+ if ( aMessage.Length() < 1 )
+ {
+ User::LeaveIfError(
+ SendErrorResponseMsg( KErrArgument, KErrorNoCmd ) );
+ return;
+ }
+
+ iCommandId = aMessage[0];
+ HTI_LOG_FORMAT( "Command = %d", iCommandId );
+ TInt err = KErrNone;
+
+ if ( iCommandId == ECmdListAudioFiles )
+ {
+ TRAP( err, HandleListAudioFilesCmdL( aMessage ) );
+ }
+
+ else if ( iCommandId == ECmdPlayFile )
+ {
+ TRAP( err, HandlePlayFileCmdL( aMessage ) );
+ }
+
+ else if ( iCommandId == ECmdPlayTone )
+ {
+ TRAP( err, HandlePlayToneCmdL( aMessage ) );
+ }
+
+ else if ( iCommandId == ECmdPlayDtmf )
+ {
+ TRAP( err, HandlePlayDtmfCmdL( aMessage ) );
+ }
+
+ else if ( iCommandId == ECmdStop )
+ {
+ TRAP( err, HandleStopCmdL( aMessage ) );
+ }
+
+ else if ( iCommandId == ECmdGetDuration )
+ {
+ TRAP( err, HandleGetDurationCmdL( aMessage ) );
+ }
+
+ else if ( iCommandId == ECmdGetMaxVol )
+ {
+ TRAP( err, HandleGetMaxVolCmdL( aMessage ) );
+ }
+
+ else if ( iCommandId == ECmdSetVol )
+ {
+ TRAP( err, HandleSetVolCmdL( aMessage ) );
+ }
+
+ else
+ {
+ User::LeaveIfError(
+ SendErrorResponseMsg( KErrArgument, KErrorUnknownCmd ) );
+ }
+
+ if ( err != KErrNone )
+ {
+ User::LeaveIfError(
+ SendErrorResponseMsg( err, KNullDesC8, iCommandId ) );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::ProcessMessageL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandleListAudioFilesCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandleListAudioFilesCmdL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandleListAudioFilesCmdL" );
+
+ RFs fsSession;
+ User::LeaveIfError( fsSession.Connect() );
+ CleanupClosePushL( fsSession );
+
+ // Build a list of directories to scan
+ CDesCArraySeg* directories = new (ELeave) CDesCArraySeg( 5 );
+ CleanupStack::PushL( directories );
+
+ if ( aMessage.Length() == 1 ) // Add default sound directories
+ {
+ TFileName directory;
+
+ // ROM
+ directory.Append( PathInfo::RomRootPath() );
+ directory.Append( PathInfo::SoundsPath() );
+ if ( BaflUtils::PathExists( fsSession, directory ) )
+ {
+ directories->AppendL( directory );
+ AddSubdirsRecursivelyL( directories->MdcaPoint(
+ directories->Count() - 1 ), *directories, fsSession );
+ }
+
+ // Phone memory
+ directory.Zero();
+ directory.Append( PathInfo::PhoneMemoryRootPath() );
+ directory.Append( PathInfo::SoundsPath() );
+ if ( BaflUtils::PathExists( fsSession, directory ) )
+ {
+ directories->AppendL( directory );
+ AddSubdirsRecursivelyL( directories->MdcaPoint(
+ directories->Count() - 1 ), *directories, fsSession );
+ }
+
+ // Memory card
+ directory.Zero();
+ directory.Append( PathInfo::MemoryCardRootPath() );
+ directory.Append( PathInfo::SoundsPath() );
+ if ( BaflUtils::PathExists( fsSession, directory ) )
+ {
+ directories->AppendL( directory );
+ AddSubdirsRecursivelyL( directories->MdcaPoint(
+ directories->Count() - 1 ), *directories, fsSession );
+ }
+ }
+
+ else // Add given directory
+ {
+ if ( aMessage.Length() < KListCmdMinLength )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ CleanupStack::PopAndDestroy( 2 ); // directories, fsSession
+ return;
+ }
+
+ TInt pathLength = aMessage[1];
+ if ( ( aMessage.Length() - pathLength ) != KListCmdMinLength - 2 )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ CleanupStack::PopAndDestroy( 2 ); // directories, fsSession
+ return;
+ }
+
+ TFileName directory;
+ TInt nextOffset = ParseString( aMessage, 1, directory );
+ TInt dirLength = directory.Length();
+ if ( dirLength < 2 || nextOffset < 0 )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ CleanupStack::PopAndDestroy( 2 ); // directories, fsSession
+ return;
+ }
+
+ HTI_LOG_DES( directory );
+
+ if ( directory[dirLength - 1] != '\\' )
+ {
+ HTI_LOG_TEXT( "Adding backslash to the end" );
+ directory.Append( KBackslash );
+ HTI_LOG_DES( directory );
+ }
+
+ if ( BaflUtils::PathExists( fsSession, directory ) )
+ {
+ HTI_LOG_TEXT( "Given path exists" );
+ directories->AppendL( directory );
+ AddSubdirsRecursivelyL( directories->MdcaPoint(
+ directories->Count() - 1 ), *directories, fsSession );
+ }
+ }
+
+ // Buffer for the file list that is returned
+ CBufFlat* fileListBuf = CBufFlat::NewL( 256 );
+ CleanupStack::PushL( fileListBuf );
+ TInt bufPos = 0;
+
+ TInt audioFileCount = 0;
+ TInt dirCount( directories->Count() );
+ HTI_LOG_FORMAT( "Total directory count = %d", dirCount );
+
+ if ( dirCount == 0 )
+ {
+ HTI_LOG_TEXT( "The given directory did not exist" );
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidPath ) );
+ CleanupStack::PopAndDestroy( 3 ); // fileListBuf, directories, fsSession
+ return;
+ }
+
+ // Loop all the directories
+ for ( TInt i = 0; i < dirCount; i++ )
+ {
+ HTI_LOG_TEXT( "Reading dir:" );
+ HTI_LOG_DES( directories->MdcaPoint( i ) );
+ CDir* dir;
+ TInt err = fsSession.GetDir( directories->MdcaPoint( i ),
+ KEntryAttNormal, ESortNone, dir );
+ if ( err )
+ {
+ delete dir;
+ dir = NULL;
+ continue; // This dir is skipped
+ }
+ CleanupStack::PushL( dir );
+
+ // Loop all the entries in this directory
+ TInt fileCount( dir->Count() );
+ for ( TInt j = 0; j < fileCount; j++ )
+ {
+ TFileName filePath;
+ filePath.Copy( directories->MdcaPoint( i ) );
+ filePath.Append( ( *dir )[j].iName );
+
+ // Check MIME type match
+ if ( MatchMimeTypeL( filePath, KAudioMimeType ) ||
+ MatchMimeTypeL( filePath, KRngMimeType ) )
+ {
+ HBufC8* filePathBuf8 = HBufC8::NewLC( KMaxFileName );
+ filePathBuf8->Des().Copy( filePath );
+ TInt pathLength = filePathBuf8->Length();
+ HTI_LOG_DES( *filePathBuf8 );
+ fileListBuf->ExpandL( bufPos, pathLength + 1 );
+ TBuf8<1> lengthBuf;
+ lengthBuf.Append( pathLength );
+ fileListBuf->Write( bufPos, lengthBuf, 1 );
+ bufPos++;
+ fileListBuf->Write( bufPos, filePathBuf8->Ptr(), pathLength );
+ bufPos += pathLength;
+ CleanupStack::PopAndDestroy(); // filePathBuf8
+ audioFileCount++;
+ }
+
+ } // files loop
+ CleanupStack::PopAndDestroy(); // dir
+ } // directories loop
+
+ HTI_LOG_FORMAT( "Total audio file count = %d", audioFileCount );
+
+ // All files added - write number of files to the beginning of buffer...
+ TBuf8<2> countBuf;
+ countBuf.Append( (TUint8*)(&audioFileCount), 2 );
+ fileListBuf->InsertL( 0, countBuf, 2 );
+
+ // ...and send it away
+ TPtr8 ptr = fileListBuf->Ptr( 0 );
+ User::LeaveIfError( SendResponseMsg( ptr ) );
+
+ CleanupStack::PopAndDestroy( 3 ); // fileListBuf, directories, fsSession
+
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandleListAudioFilesCmdL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandlePlayFileCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandlePlayFileCmdL( const TDesC8&aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandlePlayFileCmdL" );
+
+ if ( iIsPlaying )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrInUse, KErrorBusyPlaying ) );
+ return;
+ }
+
+ iPlayCommandId = ECmdPlayFile;
+
+ /*
+ Message bytes:
+ 0 = command code
+ 1 = path length
+ 2 - n = full path to file
+ next 1 = volume
+ next 4 = start position
+ next 4 = end position
+ next 1 = repeats
+ next 4 = silence between repeats
+ next 1 = audio setting
+ */
+
+ if ( aMessage.Length() < KPlayFileCmdMinLength )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+
+ // Parse parameter values from the message
+ const TUint8* ptr = aMessage.Ptr();
+ TInt pathLength = aMessage[1];
+
+ if ( ( aMessage.Length() - pathLength ) !=
+ ( KPlayFileCmdMinLength - 4 ) )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+
+ TFileName filePath;
+ TInt nextOffset = ParseString( aMessage, 1, filePath );
+ if ( filePath.Length() < 2 || nextOffset < 0 )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+ HTI_LOG_TEXT( "Full file path:" );
+ HTI_LOG_DES( filePath );
+ iVolume = aMessage[nextOffset];
+ nextOffset++;
+ HTI_LOG_FORMAT( "Volume = %d", iVolume );
+ iStartPos = ParseUint32( ptr + nextOffset );
+ HTI_LOG_FORMAT( "Start position = %d", iStartPos );
+ nextOffset += 4;
+ iEndPos = ParseUint32( ptr + nextOffset );
+ HTI_LOG_FORMAT( "End position = %d", iEndPos );
+ nextOffset += 4;
+ iRepeats = aMessage[nextOffset];
+ nextOffset++;
+ HTI_LOG_FORMAT( "Repeats = %d", iRepeats );
+ iTrailingSilence = ParseUint32( ptr + nextOffset );
+ HTI_LOG_FORMAT( "Trailing silence = %d", iTrailingSilence );
+ nextOffset += 4;
+ TInt audioSetting = aMessage[nextOffset];
+ HTI_LOG_FORMAT( "Audio setting = %d", audioSetting );
+
+ // Set audio settings
+ if ( audioSetting > ERingTonePreview ) audioSetting = EDefault;
+ SetAudioSettings( ( TAudioSetting ) audioSetting );
+
+ // Check if file is rng ringtone, it has to be played using tone player -
+ // other formats are played with audio player.
+
+ TInt err = KErrNone;
+ TBool isRng = EFalse;
+ TRAP( err, isRng = MatchMimeTypeL( filePath, KRngMimeType ) );
+
+ if ( err )
+ {
+ User::LeaveIfError( SendErrorResponseMsg( err, KErrorFileInitFailed ) );
+ return;
+ }
+
+ if ( isRng )
+ {
+ HTI_LOG_TEXT( "File is RNG - creating tone player" );
+ TRAP( err, iTonePlayer = CMdaAudioToneUtility::NewL(
+ *this, NULL, iAudioPriority, iAudioPriorityPreference ) );
+ }
+
+ else
+ {
+ HTI_LOG_TEXT( "File is not RNG - creating audio player" );
+ TRAP( err, iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(
+ filePath, *this, iAudioPriority, iAudioPriorityPreference ) );
+ // MapcInitComplete callback function will be called
+ }
+
+ if ( err )
+ {
+ delete iAudioPlayer;
+ iAudioPlayer = NULL;
+ delete iTonePlayer;
+ iTonePlayer = NULL;
+ User::LeaveIfError( SendErrorResponseMsg(
+ err, KErrorFileInitFailed ) );
+ }
+
+ if ( iTonePlayer )
+ {
+ iTonePlayer->PrepareToPlayFileSequence( filePath );
+ // MatoPrepareComplete callback function will be called
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandlePlayFileCmdL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandlePlayToneCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandlePlayToneCmdL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandlePlayToneCmdL" );
+
+ if ( iIsPlaying )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrInUse, KErrorBusyPlaying ) );
+ return;
+ }
+
+ iPlayCommandId = ECmdPlayTone;
+
+ /*
+ Message bytes:
+ 0 = command code
+ 1 - 2 = frequency value
+ 3 - 6 = duration value
+ 7 = volume value
+ 8 = repeat value
+ 9 - 12 = silence between repeats
+ */
+
+ if ( aMessage.Length() != KPlayToneCmdLength )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+
+ // Parse parameter values from the message
+ const TUint8* ptr = aMessage.Ptr();
+ TInt frequency = ParseUint16( ptr + 1 );
+ HTI_LOG_FORMAT( "Freq = %d", frequency );
+ TUint duration = ParseUint32( ptr + 3 );
+ HTI_LOG_FORMAT( "Duration = %d", duration );
+ iVolume = aMessage[7];
+ HTI_LOG_FORMAT( "Volume = %d", iVolume );
+ iRepeats = aMessage[8];
+ HTI_LOG_FORMAT( "Repeats = %d", iRepeats );
+ iTrailingSilence = ParseUint32( ptr + 9 );
+ HTI_LOG_FORMAT( "Silence = %d", iTrailingSilence );
+
+ TRAPD( err, iTonePlayer = CMdaAudioToneUtility::NewL( *this ) );
+
+ if ( err )
+ {
+ delete iTonePlayer;
+ iTonePlayer = NULL;
+ User::LeaveIfError( SendErrorResponseMsg(
+ err, KErrorToneInitFailed ) );
+ }
+
+ iTonePlayer->PrepareToPlayTone( frequency,
+ TTimeIntervalMicroSeconds( duration ) );
+ // MatoPrepareComplete callback function will be called when ready to play
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandlePlayToneCmdL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandlePlayDtmfCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandlePlayDtmfCmdL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandlePlayDtmfCmdL" );
+
+ if ( iIsPlaying )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrInUse, KErrorBusyPlaying ) );
+ return;
+ }
+
+ iPlayCommandId = ECmdPlayDtmf;
+
+ /*
+ Message bytes:
+ 0 = command code
+ 1 = DTMF string length
+ 2 - n = dtmf string
+ next 4 = tone length
+ next 4 = tone gap length
+ next 1 = volume
+ next 1 = repeats
+ next 4 = silence between repeats
+ */
+
+ if ( aMessage.Length() < KPlayDtmfCmdMinLength )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+
+ // Parse parameter values from the message
+ const TUint8* ptr = aMessage.Ptr();
+ TInt stringLength = aMessage[1];
+
+ if ( ( aMessage.Length() - stringLength ) !=
+ ( KPlayDtmfCmdMinLength - 1 ) )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+
+ TBuf<255> dtmfString;
+ TInt nextOffset = ParseString( aMessage, 1, dtmfString );
+ if ( dtmfString.Length() < 1 || nextOffset < 0 )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+ HTI_LOG_TEXT( "DTMF string:" );
+ HTI_LOG_DES( dtmfString );
+ iDtmfLength = ParseUint32( ptr + nextOffset );
+ nextOffset += 4;
+ HTI_LOG_FORMAT( "DTMF length = %d", iDtmfLength );
+ iDtmfGapLength = ParseUint32( ptr + nextOffset );
+ nextOffset += 4;
+ HTI_LOG_FORMAT( "DTMF gap length = %d", iDtmfGapLength );
+ iVolume = aMessage[nextOffset];
+ nextOffset++;
+ HTI_LOG_FORMAT( "Volume = %d", iVolume );
+ iRepeats = aMessage[nextOffset];
+ nextOffset++;
+ HTI_LOG_FORMAT( "Repeats = %d", iRepeats );
+ iTrailingSilence = ParseUint32( ptr + nextOffset );
+ HTI_LOG_FORMAT( "Trailing silence = %d", iTrailingSilence );
+
+ SetAudioSettings( EDtmfString );
+
+ TRAPD( err, iTonePlayer = CMdaAudioToneUtility::NewL(
+ *this, NULL, iAudioPriority, iAudioPriorityPreference ) );
+
+ if ( err )
+ {
+ delete iTonePlayer;
+ iTonePlayer = NULL;
+ User::LeaveIfError( SendErrorResponseMsg( err, KErrorToneInitFailed ) );
+ }
+
+ iTonePlayer->PrepareToPlayDTMFString( dtmfString );
+ // MatoPrepareComplete callback function will be called when ready to play
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandlePlayDtmfCmdL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandleStopCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandleStopCmdL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandleStopCmdL" );
+
+ if ( aMessage.Length() != KStopCmdLength )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+
+ if ( !iIsPlaying )
+ {
+ HTI_LOG_TEXT( "Not playing - nothing to stop" );
+ // Just send "OK" reply if nothing is currently playing
+ User::LeaveIfError( SendResponseMsg( _L8( "OK" ) ) );
+ }
+
+ else
+ {
+ if ( iAudioPlayer )
+ {
+ HTI_LOG_TEXT( "Stopping audio player" );
+ iAudioPlayer->Stop();
+ iIsPlaying = EFalse;
+ delete iAudioPlayer;
+ iAudioPlayer = NULL;
+ // According to documentation should call MapcPlayComplete callback
+ // method but it doesn't, so sending reply here.
+ User::LeaveIfError( SendResponseMsg( _L8( "OK" ) ) );
+ }
+
+ else if ( iTonePlayer )
+ {
+ HTI_LOG_TEXT( "Stopping tone player" );
+ iTonePlayer->CancelPlay();
+ iIsPlaying = EFalse;
+ delete iTonePlayer;
+ iTonePlayer = NULL;
+ // Callback method MatoPlayComplete is not called -
+ // sending reply here.
+ User::LeaveIfError( SendResponseMsg( _L8( "OK" ) ) );
+ }
+ }
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandleStopCmdL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandleGetDurationCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandleGetDurationCmdL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandleGetDurationCmdL" );
+
+ if ( iIsPlaying )
+ {
+ // If currently playing, no parameters allowed. Returns the duration
+ // of currently playing sound.
+ if ( aMessage.Length() != 1 )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrInUse, KErrorBusyPlaying ) );
+ return;
+ }
+
+ if ( iAudioPlayer )
+ {
+ TTimeIntervalMicroSeconds durationValue =
+ iAudioPlayer->Duration();
+
+ if ( I64HIGH( durationValue.Int64() ) > 0 )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrOverflow, KErrorDurationFailed ) );
+ return;
+ }
+ else
+ {
+ TUint duration = I64LOW( durationValue.Int64() );
+ TBuf8<KTUintSize> durationBuf;
+ durationBuf.Append( (TUint8*)(&duration), KTUintSize );
+ User::LeaveIfError( SendResponseMsg( durationBuf ) );
+ return;
+ }
+ }
+
+ else // Duration supported only for audio player
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrNotSupported, KErrorDurationFailed ) );
+ return;
+ }
+ }
+
+ /* Command must have file path parameter if not currently playing.
+ Message bytes:
+ 0 = command code
+ 1 = path length
+ 2 - n = full path to file
+ */
+
+ if ( aMessage.Length() < KDurationCmdMinLength )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+
+ TInt pathLength = aMessage[1];
+ if ( ( aMessage.Length() - pathLength ) !=
+ ( KDurationCmdMinLength - 4 ) )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+
+ // Parse parameter values from the message
+ TFileName filePath;
+ TInt nextOffset = ParseString( aMessage, 1, filePath );
+ if ( filePath.Length() < 2 || nextOffset < 0 )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+ HTI_LOG_TEXT( "Full file path:" );
+ HTI_LOG_DES( filePath );
+
+ TRAPD( err, iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(
+ filePath, *this ) );
+ if ( err )
+ {
+ delete iAudioPlayer;
+ iAudioPlayer = NULL;
+ User::LeaveIfError( SendErrorResponseMsg( err, KErrorDurationFailed ) );
+ }
+
+ // MapcInitComplete callback function will be called
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandleGetDurationCmdL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandleGetMaxVolCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandleGetMaxVolCmdL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandleGetMaxVolCmdL" );
+
+ if ( iIsPlaying )
+ {
+ // If currently playing, no parameters allowed. Returns the max volume
+ // of currently playing sound.
+ if ( aMessage.Length() != 1 )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrInUse, KErrorBusyPlaying ) );
+ return;
+ }
+
+ TInt maxVol = -1;
+
+ if ( iAudioPlayer )
+ {
+ maxVol = iAudioPlayer->MaxVolume();
+ }
+
+ else if ( iTonePlayer )
+ {
+ maxVol = iTonePlayer->MaxVolume();
+ }
+
+ HTI_LOG_FORMAT( "Max volume = %d", maxVol );
+
+ if ( maxVol < 0 )
+ {
+ // Should not happen
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrGeneral, KErrorMaxVolFailed ) );
+ return;
+ }
+
+ if ( maxVol > 255 ) maxVol = 255;
+ TBuf8<1> maxVolBuf;
+ maxVolBuf.Append( maxVol );
+ User::LeaveIfError( SendResponseMsg( maxVolBuf ) );
+ return;
+ }
+
+ /*
+ Message bytes:
+ 0 = command code
+ 1 = path length
+ 2 - n = full path to file
+ */
+
+ if ( aMessage.Length() < KMaxVolCmdMinLength )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+
+ TInt pathLength = aMessage[1];
+ if ( ( aMessage.Length() - pathLength ) != ( KMaxVolCmdMinLength - 4 ) )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+
+ // Parse parameter values from the message
+ TFileName filePath;
+ TInt nextOffset = ParseString( aMessage, 1, filePath );
+ if ( filePath.Length() < 2 || nextOffset < 0 )
+ {
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrArgument, KErrorInvalidParameters ) );
+ return;
+ }
+ HTI_LOG_TEXT( "Full file path:" );
+ HTI_LOG_DES( filePath );
+
+ TInt err = KErrNone;
+ TBool isRng = EFalse;
+ TRAP( err, isRng = MatchMimeTypeL( filePath, KRngMimeType ) );
+
+ if ( err )
+ {
+ User::LeaveIfError( SendErrorResponseMsg( err, KErrorMaxVolFailed ) );
+ return;
+ }
+
+ if ( isRng )
+ {
+ HTI_LOG_TEXT( "File is RNG - creating tone player" );
+ TRAP( err, iTonePlayer = CMdaAudioToneUtility::NewL( *this ) );
+ }
+
+ else
+ {
+ HTI_LOG_TEXT( "File is not RNG - creating audio player" );
+ TRAP( err, iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(
+ filePath, *this ) );
+ // MapcInitComplete callback function will be called
+ }
+
+ if ( err )
+ {
+ delete iAudioPlayer;
+ iAudioPlayer = NULL;
+ delete iTonePlayer;
+ iTonePlayer = NULL;
+ User::LeaveIfError( SendErrorResponseMsg( err, KErrorMaxVolFailed ) );
+ }
+
+ if ( iTonePlayer )
+ {
+ iTonePlayer->PrepareToPlayFileSequence( filePath );
+ // MatoPrepareComplete callback function will be called
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandleGetMaxVolCmdL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandleSetVolCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandleSetVolCmdL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandleSetVolCmdL" );
+
+ if ( aMessage.Length() != KSetVolCmdLength )
+ {
+ User::LeaveIfError( SendErrorResponseMsg( KErrArgument,
+ KErrorInvalidParameters ) );
+ }
+
+ if ( !iIsPlaying )
+ {
+ HTI_LOG_TEXT( "Nothing playing - not setting volume" );
+ User::LeaveIfError( SendErrorResponseMsg(
+ KErrNotReady, KErrorNothingPlaying ) );
+ }
+
+ else
+ {
+ TInt volume = aMessage[1]; // [0] = command code, [1] = volume value
+ HTI_LOG_FORMAT( "requested volume = %d", volume );
+
+ if ( iAudioPlayer )
+ {
+ HTI_LOG_TEXT( "Setting audio player volume" );
+ TInt maxVol = iAudioPlayer->MaxVolume();
+ HTI_LOG_FORMAT( "max volume = %d", maxVol );
+ if ( volume > maxVol ) volume = maxVol;
+ iAudioPlayer->SetVolume( volume );
+ TBuf8<1> volBuf;
+ volBuf.Append( volume );
+ User::LeaveIfError( SendResponseMsg( volBuf ) );
+ }
+ else if ( iTonePlayer )
+ {
+ HTI_LOG_TEXT( "Setting tone player volume" );
+ TInt maxVol = iTonePlayer->MaxVolume();
+ HTI_LOG_FORMAT( "max volume = %d", maxVol );
+ if ( volume > maxVol ) volume = maxVol;
+ iTonePlayer->SetVolume( volume );
+ TBuf8<1> volBuf;
+ volBuf.Append( volume );
+ User::LeaveIfError( SendResponseMsg( volBuf ) );
+ }
+ }
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandleSetVolCmdL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::MatoPrepareComplete()
+// Tone player prepare complete
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::MatoPrepareComplete( TInt aError )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::MatoPrepareComplete" );
+
+ if ( iCommandId == ECmdGetMaxVol )
+ {
+ if ( aError )
+ {
+ SendErrorResponseMsg( aError, KErrorMaxVolFailed );
+ }
+
+ else
+ {
+ TInt maxVol = iTonePlayer->MaxVolume();
+ HTI_LOG_FORMAT( "Max volume = %d", maxVol );
+ if ( maxVol > 255 ) maxVol = 255;
+ TBuf8<1> maxVolBuf;
+ maxVolBuf.Append( maxVol );
+ SendResponseMsg( maxVolBuf );
+ }
+
+ delete iTonePlayer;
+ iTonePlayer = NULL;
+ return;
+ }
+
+ if ( aError )
+ {
+ SendErrorResponseMsg( aError, KErrorToneInitFailed );
+ delete iTonePlayer;
+ iTonePlayer = NULL;
+ }
+
+ else
+ {
+ if ( iCommandId == ECmdPlayDtmf )
+ {
+ iTonePlayer->SetDTMFLengths(
+ TTimeIntervalMicroSeconds32( iDtmfLength ),
+ TTimeIntervalMicroSeconds32( iDtmfGapLength ),
+ TTimeIntervalMicroSeconds32( 0 ) );
+ }
+
+ if ( iVolume > iTonePlayer->MaxVolume() )
+ {
+ iVolume = iTonePlayer->MaxVolume();
+ }
+
+ iTonePlayer->SetVolume( iVolume );
+ iTonePlayer->SetRepeats( iRepeats + 1,
+ TTimeIntervalMicroSeconds( iTrailingSilence ) );
+ iIsPlaying = ETrue;
+ iTonePlayer->Play();
+ iIsBusy = EFalse;
+ // MatoPlayComplete callback function will be called when playing ends.
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::MatoPrepareComplete" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::MatoPlayComplete()
+// Tone play complete
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::MatoPlayComplete( TInt aError )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::MatoPlayComplete" );
+
+ iIsPlaying = EFalse;
+ iIsBusy = ETrue; // Busy dispatching the play complete message
+
+ if ( aError )
+ {
+ SendErrorResponseMsg( aError, KErrorTonePlayFailed, iPlayCommandId );
+ }
+
+ else
+ {
+ SendResponseMsg( _L8( "OK" ), iPlayCommandId );
+ }
+
+ delete iTonePlayer;
+ iTonePlayer = NULL;
+
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::MatoPlayComplete" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::MapcInitComplete()
+// Audio player init complete
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::MapcInitComplete( TInt aError,
+ const TTimeIntervalMicroSeconds& aDuration )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::MapcInitComplete" );
+
+ if ( iCommandId == ECmdPlayFile )
+ {
+ if ( aError )
+ {
+ SendErrorResponseMsg( aError, KErrorFileInitFailed );
+ delete iAudioPlayer;
+ iAudioPlayer = NULL;
+ }
+
+ else
+ {
+ if ( iEndPos < iStartPos ||
+ TTimeIntervalMicroSeconds( iStartPos ) > aDuration )
+ {
+ SendErrorResponseMsg( KErrArgument, KErrorPosition );
+ delete iAudioPlayer;
+ iAudioPlayer = NULL;
+ return;
+ }
+
+ if ( iEndPos > 0 )
+ {
+ iAudioPlayer->SetPlayWindow(
+ TTimeIntervalMicroSeconds( iStartPos ),
+ TTimeIntervalMicroSeconds( iEndPos ) );
+ }
+
+ HTI_LOG_FORMAT( "Max volume = %d", iAudioPlayer->MaxVolume() );
+ HTI_LOG_FORMAT( "Setting volume = %d", iVolume );
+ if ( iVolume > iAudioPlayer->MaxVolume() )
+ {
+ iVolume = iAudioPlayer->MaxVolume();
+ }
+
+ iAudioPlayer->SetVolume( iVolume );
+ iAudioPlayer->SetRepeats( iRepeats,
+ TTimeIntervalMicroSeconds( iTrailingSilence ) );
+ iIsPlaying = ETrue;
+ iAudioPlayer->Play();
+
+ // Have to do this after play command because
+ // volume setting before play seems to have no effect.
+ iAudioPlayer->SetVolume( 0 );
+ iAudioPlayer->SetVolume( iVolume );
+
+ iIsBusy = EFalse;
+ // MapcPlayComplete callback function is called when playing ends
+ }
+ }
+
+ else if ( iCommandId == ECmdGetDuration )
+ {
+ if ( aError )
+ {
+ SendErrorResponseMsg( aError, KErrorDurationFailed );
+ }
+
+ else
+ {
+ if ( I64HIGH( aDuration.Int64() ) > 0 )
+ {
+ SendErrorResponseMsg( KErrOverflow, KErrorDurationFailed );
+ }
+ else
+ {
+ TUint duration = I64LOW( aDuration.Int64() );
+ TBuf8<KTUintSize> durationBuf;
+ durationBuf.Append( (TUint8*)(&duration), KTUintSize );
+ SendResponseMsg( durationBuf );
+ }
+ }
+ delete iAudioPlayer;
+ iAudioPlayer = NULL;
+ }
+
+ else if ( iCommandId == ECmdGetMaxVol )
+ {
+ if ( aError )
+ {
+ SendErrorResponseMsg( aError, KErrorMaxVolFailed );
+ }
+
+ else
+ {
+ TInt maxVol = iAudioPlayer->MaxVolume();
+ HTI_LOG_FORMAT( "Max volume = %d", maxVol );
+ if ( maxVol > 255 ) maxVol = 255;
+ TBuf8<1> maxVolBuf;
+ maxVolBuf.Append( maxVol );
+ SendResponseMsg( maxVolBuf );
+ }
+ delete iAudioPlayer;
+ iAudioPlayer = NULL;
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::MapcInitComplete" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::MapcPlayComplete()
+// Audio play complete
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::MapcPlayComplete( TInt aError )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::MapcPlayComplete" );
+
+ iIsPlaying = EFalse;
+ iIsBusy = ETrue; // Busy dispatching the play complete message
+
+ if ( aError )
+ {
+ SendErrorResponseMsg( aError, KErrorFilePlayFailed, ECmdPlayFile );
+ }
+
+ else
+ {
+ SendResponseMsg( _L8( "OK" ), iPlayCommandId );
+ }
+
+ delete iAudioPlayer;
+ iAudioPlayer = NULL;
+
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::MapcPlayComplete" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::NotifyMemoryChange
+// Called when HTI Framework has dispatched a message forward and the amount
+// of free memory in the message queue has changed.
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::NotifyMemoryChange( TInt aAvailableMemory )
+ {
+ if ( iIsBusy && iMessage )
+ {
+ if ( aAvailableMemory >= iMessage->Size() )
+ {
+ if ( iErrorCode == 0 )
+ {
+ TInt err = iDispatcher->DispatchOutgoingMessage(
+ iMessage, KAudioServiceUid );
+
+ if ( err == KErrNone )
+ {
+ // Ownership of iMessage has been transferred
+ iMessage = NULL;
+ iIsBusy = EFalse;
+ iDispatcher->RemoveMemoryObserver( this );
+ }
+
+ else if ( err == KErrNoMemory )
+ {
+ // Keep retrying.
+ }
+
+ else // Give up on sending
+ {
+ delete iMessage;
+ iMessage = NULL;
+ iIsBusy = EFalse;
+ iDispatcher->RemoveMemoryObserver( this );
+ }
+ }
+
+ else
+ {
+ TInt err = iDispatcher->DispatchOutgoingErrorMessage(
+ iErrorCode, *iMessage, KAudioServiceUid );
+
+ // If it was success or some other error than KErrNoMemory
+ // we are done sending or trying to send this message.
+ if ( err != KErrNoMemory )
+ {
+ delete iMessage;
+ iMessage = NULL;
+ iIsBusy = EFalse;
+ iDispatcher->RemoveMemoryObserver( this );
+ }
+
+ else
+ {
+ // Keep retrying.
+ }
+ }
+ }
+ }
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::IsBusy
+// -----------------------------------------------------------------------------
+//
+TBool CHtiAudioServicePlugin::IsBusy()
+ {
+ return iIsBusy;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::SendResponseMsg
+// Sends a message out to the message dispatcher.
+// -----------------------------------------------------------------------------
+//
+TInt CHtiAudioServicePlugin::SendResponseMsg( const TDesC8& aMsg,
+ const TUint8 aCommandId )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::SendResponseMsg" );
+
+ iErrorCode = 0;
+
+ if ( iDispatcher == NULL )
+ {
+ iIsBusy = EFalse;
+ return KErrGeneral;
+ }
+
+ iDispatcher->RemoveMemoryObserver( this );
+
+ delete iMessage;
+ iMessage = NULL;
+ iMessage = HBufC8::New( aMsg.Length() + 1 );
+
+ if ( iMessage == NULL )
+ {
+ iIsBusy = EFalse;
+ return KErrNoMemory;
+ }
+
+ TPtr8 ptr8 = iMessage->Des();
+ if ( aCommandId != 0 )
+ {
+ ptr8.Append( aCommandId );
+ }
+ else
+ {
+ ptr8.Append( iCommandId );
+ }
+
+ ptr8.Append( aMsg );
+
+ TInt err = KErrNone;
+
+ err = iDispatcher->DispatchOutgoingMessage( iMessage, KAudioServiceUid );
+
+ if ( err == KErrNoMemory )
+ {
+ HTI_LOG_TEXT( "Message queue memory full - waiting" );
+ iIsBusy = ETrue; // Should already be true, but just in case
+ iDispatcher->AddMemoryObserver( this );
+ // For the caller of this method all is OK, sending is just delayed
+ err = KErrNone;
+ }
+
+ else if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "Message sent to dispatcher" );
+ iMessage = NULL; // Ownership of iMessage has been transferred
+ iIsBusy = EFalse;
+ }
+
+ else // give up on sending
+ {
+ HTI_LOG_FORMAT( "Other dispatcher error %d", err );
+ delete iMessage;
+ iMessage = NULL;
+ iIsBusy = EFalse;
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::SendResponseMsg" );
+ return err;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::SendErrorResponseMsg
+// Sends an error message out to the message dispatcher.
+// -----------------------------------------------------------------------------
+//
+TInt CHtiAudioServicePlugin::SendErrorResponseMsg( TInt aErrorCode,
+ const TDesC8& aErrorDescription,
+ const TUint8 aCommandId )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::SendErrorResponseMsg" );
+
+ iErrorCode = aErrorCode;
+
+ if ( iDispatcher == NULL )
+ {
+ iIsBusy = EFalse;
+ return KErrGeneral;
+ }
+
+ iDispatcher->RemoveMemoryObserver( this );
+
+ delete iMessage;
+ iMessage = NULL;
+ iMessage = HBufC8::New( aErrorDescription.Length() + 1 );
+
+ if ( iMessage == NULL )
+ {
+ iIsBusy = EFalse;
+ return KErrNoMemory;
+ }
+
+ TPtr8 ptr8 = iMessage->Des();
+ if ( aCommandId != 0 )
+ {
+ ptr8.Append( aCommandId );
+ }
+ else
+ {
+ ptr8.Append( iCommandId );
+ }
+
+ ptr8.Append( aErrorDescription );
+
+ TInt err = KErrNone;
+
+ err = iDispatcher->DispatchOutgoingErrorMessage(
+ aErrorCode, *iMessage, KAudioServiceUid );
+
+ if ( err == KErrNoMemory )
+ {
+ HTI_LOG_TEXT( "Message queue memory full - waiting" );
+ iIsBusy = ETrue; // Should already be true, but just in case
+ iDispatcher->AddMemoryObserver( this );
+ // For the caller of this method all is OK, sending is just delayed
+ err = KErrNone;
+ }
+
+ else if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "Error message sent to dispatcher" );
+ delete iMessage;
+ iMessage = NULL;
+ iIsBusy = EFalse;
+ }
+
+ else // give up on sending
+ {
+ HTI_LOG_FORMAT( "Other dispatcher error %d", err );
+ delete iMessage;
+ iMessage = NULL;
+ iIsBusy = EFalse;
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::SendErrorResponseMsg" );
+ return err;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::ParseString()
+// -----------------------------------------------------------------------------
+//
+TInt CHtiAudioServicePlugin::ParseString( const TDesC8& aRequest,
+ TInt aOffset,
+ TDes& aResult )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::ParseString" );
+
+ // If offset outside the string return empty string
+ if ( aOffset >= aRequest.Size() )
+ {
+ return aOffset;
+ }
+
+ TInt length = aRequest[aOffset];
+ HTI_LOG_FORMAT( "String length = %d", length );
+
+ // If length is zero return empty string
+ if ( length < 1 )
+ {
+ return aOffset + 1;
+ }
+
+ if ( length > aResult.MaxLength() )
+ {
+ return KErrBadDescriptor;
+ }
+
+ TInt nextOffset = length + aOffset + 1;
+ HTI_LOG_FORMAT( "Next offset = %d", nextOffset );
+ HTI_LOG_FORMAT( "Request size = %d", aRequest.Size() );
+
+ if ( nextOffset > aRequest.Size() )
+ {
+ return KErrArgument;
+ }
+
+ aResult.Copy( aRequest.Mid( aOffset + 1, length ) );
+
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::ParseString" );
+ return nextOffset;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::AddSubdirsRecursivelyL
+// Scan all subdirectories from the given path and add them to the aArray.
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::AddSubdirsRecursivelyL( const TDesC& aPath,
+ CDesCArraySeg& aArray,
+ RFs& aFs )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::AddSubdirsRecursivelyL" );
+
+ CDirScan* dirScan = CDirScan::NewL( aFs );
+ CleanupStack::PushL( dirScan );
+
+ TFileName* path = new (ELeave) TFileName;
+ CleanupStack::PushL( path );
+
+ CDir* directory = NULL;
+ TPtrC currentPath;
+
+ dirScan->SetScanDataL( aPath, KEntryAttMatchExclusive | KEntryAttDir, ESortNone );
+ dirScan->NextL( directory );
+
+ while ( directory )
+ {
+ CleanupStack::PushL( directory );
+ currentPath.Set( dirScan->FullPath() );
+
+ TInt dirCount( directory->Count() );
+ for ( TInt i = 0; i < dirCount ; ++i )
+ {
+ path->Copy( currentPath );
+ path->Append( ( *directory )[ i ].iName );
+ path->Append( KBackslash );
+ aArray.AppendL( *path );
+ }
+
+ CleanupStack::PopAndDestroy( directory );
+ directory = NULL;
+
+ dirScan->NextL( directory );
+ }
+
+ CleanupStack::PopAndDestroy( 2 ); // path, dirScan
+
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::AddSubdirsRecursivelyL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::MatchMimeTypeL
+// Check if the MIME type of the given file matches to the given pattern.
+// -----------------------------------------------------------------------------
+//
+TBool CHtiAudioServicePlugin::MatchMimeTypeL( const TDesC& aFilePath,
+ const TDesC& aMimeTypeMatchPattern )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::MatchMimeTypeL" );
+
+ RApaLsSession apaSession;
+ User::LeaveIfError( apaSession.Connect() );
+ CleanupClosePushL( apaSession );
+
+ TUid dummyUid( KNullUid );
+ TDataType dataType;
+ User::LeaveIfError( apaSession.AppForDocument( aFilePath,
+ dummyUid,
+ dataType ) );
+ CleanupStack::PopAndDestroy(); // apaSession
+
+ if ( dataType.Des().MatchF( aMimeTypeMatchPattern ) >= 0 )
+ {
+ HTI_LOG_TEXT( "Match" );
+ return ETrue;
+ }
+
+ HTI_LOG_TEXT( "Not match" );
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::MatchMimeTypeL" );
+ return EFalse;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::SetAudioSettings
+// Set the audio priority and priority preference values.
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::SetAudioSettings( TAudioSetting aSetting )
+ {
+ HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::SetAudioSettings" );
+ HTI_LOG_FORMAT( "Setting values for audio setting %d", aSetting );
+
+ switch ( aSetting )
+ {
+ case EGeneralMusic:
+ {
+ iAudioPriority = KAudioPriorityRealOnePlayer;
+ iAudioPriorityPreference =
+ ( TMdaPriorityPreference ) KAudioPrefRealOneLocalPlayback;
+ break;
+ }
+
+ case ERingTonePreview:
+ {
+ iAudioPriority = KAudioPriorityRingingTonePreview;
+ iAudioPriorityPreference =
+ ( TMdaPriorityPreference ) KAudioPrefRingFilePreview;
+ break;
+ }
+/*
+ case EIncomingCall:
+ {
+ iAudioPriority = KAudioPriorityPhoneCall;
+ iAudioPriorityPreference =
+ ( TMdaPriorityPreference ) KAudioPrefIncomingCall;
+ break;
+ }
+*/
+ case EDtmfString:
+ {
+
+ iAudioPriority = KAudioPriorityDTMFString;
+ iAudioPriorityPreference =
+ ( TMdaPriorityPreference ) KAudioDTMFString;
+ break;
+ }
+
+ default:
+ {
+ iAudioPriority = EMdaPriorityNormal;
+ iAudioPriorityPreference = EMdaPriorityPreferenceTimeAndQuality;
+ break;
+ }
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::SetAudioSettings" );
+ }
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAudioServicePlugin/src/proxy.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation proxy for the ECom plugin.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+#include "HtiAudioServicePlugin.h"
+
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY( 0x10210CCB, CHtiAudioServicePlugin::NewL )
+ };
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+ {
+ aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+ return ImplementationTable;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/data/2002EA9D.rss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HTI service plugin for playing audio.
+*
+*/
+
+
+
+// RESOURCE IDENTIFIER
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+
+// CONSTANTS
+
+// MACROS
+
+
+// RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// theInfo
+// ECom registry info resource.
+//
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE REGISTRY_INFO theInfo
+ {
+ // UID for the DLL
+ dll_uid = 0x2002EA9D;
+ // Declare array of interface info
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // UID of interface that is implemented
+ interface_uid = 0x1020DEB7;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x2002EA9E;
+ version_no = 1;
+ display_name = "Camera Service";
+ default_data = "Camera";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/engine/inc/EngineVideoRecording.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,524 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Video recording engine implementation class.
+*
+*/
+
+#ifndef ENGINEVIDEORECORDING_H
+#define ENGINEVIDEORECORDING_H
+
+// INCLUDES
+#include <ecam.h>
+#include <videorecorder.h>
+#include <e32std.h>
+
+// CONSTANTS
+const TInt KCameraPriority = -1; // Relative priority (-100...100) of camera HW
+
+// FORWARD DECLARATIONS
+class CVideoRecorderUtility;
+class CVideoRecordingQualityLevels;
+
+
+class TEngineVideoRecordingInfo
+ {
+ public:
+
+ // Camera hardware version present.
+ TVersion iHardwareVersion;
+ // Camera driver software version present.
+ TVersion iSoftwareVersion;
+ // Actual orientation of the camera.
+ TCameraInfo::TCameraOrientation iOrientation;
+
+ // Bitfield of CCamera::TOptions available.
+ TUint32 iOptionsSupported;
+ // Bitfield of CCamera::TFlash modes available.
+ TUint32 iFlashModesSupported;
+ // Bitfield of CCamera::TExposure modes available.
+ TUint32 iExposureModesSupported;
+ // Bitfield of CCamera::TWhiteBalance modes available.
+ TUint32 iWhiteBalanceModesSupported;
+
+ // Minimum zoom value allowed. Must be negative or
+ // zero (for not supported).
+ TInt iMinZoom;
+ // Maximum zoom value allowed. Must be positive or
+ // zero (for not supported).
+ TInt iMaxZoom;
+ // Maximum digital zoom value allowed. Must be positive or
+ // zero (for not supported).
+ TInt iMaxDigitalZoom;
+
+ // Image size multiplier corresponding to minimum zoom value.
+ // Must be between 0 and 1 inclusive.
+ TReal32 iMinZoomFactor;
+ // Image size multiplier corresponding to maximum zoom value.
+ // Must be greater than or equal to 1.
+ TReal32 iMaxZoomFactor;
+ // Image size multiplier corresponding to maximum digital zoom value.
+ // Must be greater than or equal to 1.
+ TReal32 iMaxDigitalZoomFactor;
+
+ // Count of still image capturing sizes allowed.
+ TInt iNumImageSizesSupported;
+ // Bitfield of still image CCamera::TFormat values supported.
+ TUint32 iImageFormatsSupported;
+
+ // Count of still image capturing quality levels initialized.
+ TInt iNumStillQualityLevelsSupported;
+ // Count of video recording quality levels initialized.
+ TInt iNumVideoQualityLevelsSupported;
+
+ // Bitfield of CCaeEngine::TOptions available.
+ TUint32 iCaeOptionsSupported;
+
+ // Integer (e.g. -9) that corresponds to minimum EV compensation value.
+ TInt iMinEvCompensation;
+ // Integer (e.g. 9) that corresponds to maximum EV compensation value.
+ TInt iMaxEvCompensation;
+ // Minimum camera EV compensation value (e.g. -3.0).
+ TReal32 iMinEvCompensationValue;
+ // Maximum camera EV compensation value (e.g. 3.0).
+ TReal32 iMaxEvCompensationValue;
+ };
+
+class MEngineVideoRecordingObserver
+ {
+
+ public:
+ /**
+ * Called asynchronously when CEngineVideoRecording::Init(), CCaeEngine::CEngineVideoRecording(),
+ * or CEngineVideoRecording::Reserve() completes.
+ * Indicates if Video Recording Engine is ready for operation,
+ * the camera is reserved and its power is switched on.
+ * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+ * @return void
+ */
+ virtual void MevroInitComplete( TInt aError ) = 0;
+
+ /**
+ * Called asynchronously when preparing of video recording completes
+ * after PrepareVideoRecordingL() has been called.
+ * May be called second time with an error code after a successful preparation
+ * if video recording loses its prepared state for some reason (e.g. audio HW
+ * is reserved for some other application).
+ * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+ * @return void
+ */
+ virtual void MevroVideoPrepareComplete( TInt aError ) = 0;
+
+ /**
+ * Called (possibly asynchronously) when video recording is running
+ * after CEngineVideoRecording::StartVideoRecording() or
+ * CEngineVideoRecording::ResumeVideoRecording() has been called.
+ * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+ * @return void
+ */
+ virtual void MevroVideoRecordingOn( TInt aError ) = 0;
+
+ /**
+ * Called (possibly asynchronously) when video recording is paused after
+ * CEngineVideoRecording::PauseVideoRecording() has been called.
+ * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+ * @return void
+ */
+ virtual void MevroVideoRecordingPaused( TInt aError ) = 0;
+
+ /**
+ * Called (possibly asynchronously) when video recording is completed
+ * after CEngineVideoRecording::StopVideoRecording() has been called or
+ * recording has been completed for some other reason.
+ * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+ * if aError == KErrDiskFull, then disk storage is full.
+ * if aError == KErrCompletion, then clip max size was reached.
+ * @return void
+ */
+ virtual void MevroVideoRecordingComplete( TInt aError ) = 0;
+ };
+
+
+NONSHARABLE_CLASS( CEngineVideoRecording ) : public CBase,
+ public MVideoRecorderUtilityObserver,
+ public MCameraObserver,
+ public MCameraObserver2
+ {
+ public:
+ // Possible zooming modes.
+ enum TZoomMode
+ {
+ EZoomModeDigital = 0x00, // Digital zoom (default).
+ EZoomModeOptical = 0x01, // Optical zoom.
+ EZoomModeOpticalDigital = 0x02 // Optical+digital zoom.
+ };
+
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~CEngineVideoRecording();
+
+ // Construction and destruction
+ static CEngineVideoRecording* NewL(MEngineVideoRecordingObserver& aObserver,
+ TInt aCameraIndex);
+
+ void InitL();
+
+ void InitVideoRecorderL();
+
+ void SetVideoRecordingFileNameL(
+ const TDesC& aVideoClipFileName );
+
+ void ChangeVideoFileNameL();
+
+ void PrepareVideoRecordingL(
+ TInt aVideoQualityIndex );
+
+ void PrepareVideoRecordingL(
+ const TSize& aFrameSize,
+ TReal32 aFrameRate,
+ TInt aBitRate,
+ TBool aAudioEnabled,
+ const TDesC8& aMimeType,
+ const TDesC& aPreferredSupplier,
+ const TDesC8& aVideoType = KNullDesC8,
+ const TDesC8& aAudioType = KNullDesC8 );
+
+ void PrepareVideoRecordingL(
+ const TSize& aFrameSize,
+ TReal32 aFrameRate,
+ TInt aBitRate,
+ TBool aAudioEnabled,
+ TInt aAudioBitRate,
+ const TDesC8& aMimeType,
+ const TDesC& aPreferredSupplier,
+ const TDesC8& aVideoType,
+ const TDesC8& aAudioType );
+
+ void CloseVideoRecording();
+
+ TInt VideoQualityIndex() const;
+
+ TInt VideoQualityCount() const;
+
+ void GetVideoFrameSize(
+ TInt aVideoQualityIndex,
+ TSize& aSize ) const;
+
+ TReal32 VideoFrameRate(
+ TInt aVideoQualityIndex ) const;
+
+ TInt EstimatedVideoRecordingBitRateL(
+ TInt aVideoQualityIndex ) const;
+
+ void SetVideoClipMaxSizeL(
+ TInt aMaxClipSizeInBytes = 0 );
+
+ TInt VideoClipMaxSize() const;
+
+ void SetVideoAudioL(
+ TBool aAudioEnabled );
+
+ TBool VideoAudio() const;
+
+ void StartVideoRecording();
+
+ void StopVideoRecording();
+
+ void PauseVideoRecording();
+
+ void ResumeVideoRecording();
+
+ TTimeIntervalMicroSeconds RemainingVideoRecordingTime() const;
+
+ TBool IsVideoRecording() const;
+
+ void Reserve();
+
+ void Release();
+
+ void PowerOn();
+
+ void PowerOff();
+
+ void SetZoomModeL(TZoomMode aZoomMode = EZoomModeDigital);
+
+ TZoomMode ZoomMode() const;
+
+ void SetZoomValueL(TInt aZoomValue = 0);
+
+ TInt ZoomValue() const;
+
+ TInt MaxZoomValue() const;
+ TInt MinZoomValue() const;
+
+ void SetBrightnessL(TInt aBrightness = 0);
+
+ TInt Brightness() const;
+
+ void SetContrastL(TInt aContrast = 0);
+
+ TInt Contrast() const;
+
+ void SetExposureModeL(CCamera::TExposure aExposureMode =
+ CCamera::EExposureAuto);
+
+ CCamera::TExposure ExposureMode() const;
+
+ void SetWhiteBalanceModeL(CCamera::TWhiteBalance aWhiteBalanceMode =
+ CCamera::EWBAuto);
+
+ CCamera::TWhiteBalance WhiteBalanceMode() const;
+
+ void SetFlashModeL(CCamera::TFlash aFlashMode = CCamera::EFlashNone);
+
+ CCamera::TFlash FlashMode() const;
+
+ void ResetToDefaultsL();
+ private:
+ void InitializeInfo(const CCamera& aCamera);
+
+ /**
+ * Checks that power is on. If not, then leaves.
+ * @since 2.1
+ * @return void
+ */
+ void CheckPowerL();
+
+ void CancelVideoRecording();
+
+ void PrepareVideoSettingsL();
+
+ void FindVideoUidsL(const TDesC8& aMimeType,
+ const TDesC& aPreferredSupplier);
+
+ TFourCC ConvertAndSetVideoAudioTypeL(const TDesC8& aAudioType);
+
+ private:
+
+ /**
+ * From MVideoRecorderUtilityObserver
+ * Notification to the client that the opening of the video clip has completed,
+ * successfully, or otherwise.
+ * @param aError
+ * The status of the video recorder after initialisation.
+ * This is either KErrNone if the open has completed successfully,
+ * or one of the system wide error codes.
+ */
+ virtual void MvruoOpenComplete(TInt aError);
+
+ /**
+ * From MVideoRecorderUtilityObserver
+ * Notification that video recorder is ready to begin recording. This callback
+ * is generated in response to a call to Prepare.
+ * @param aError
+ * This is either KErrNone if the video recorder has been prepared for
+ * recording successfully, or one of the system wide error codes
+ */
+ virtual void MvruoPrepareComplete(TInt aError);
+
+ /**
+ * From MVideoRecorderUtilityObserver
+ * Notification that video recording has completed. This is not called if
+ * recording is explicitly stopped by calling Stop.
+ * @param aError
+ * This is either KErrNone if recording was completed successfully,
+ * or one of the system wide error codes.
+ */
+ virtual void MvruoRecordComplete(TInt aError);
+
+ /**
+ * From MVideoRecorderUtilityObserver
+ * General event notification from controller. These events are specified by
+ * the supplier of the controller.
+ * @param aEvent
+ * The event sent by the controller.
+ */
+ virtual void MvruoEvent(const TMMFEvent& aEvent);
+
+ private: // From Camera Observer / ECam.h
+
+ void ReserveComplete(
+ TInt aError );
+
+ void PowerOnComplete(
+ TInt aError );
+
+ void ViewFinderFrameReady(
+ CFbsBitmap& /*aFrame*/ ){};
+
+ void ImageReady(
+ CFbsBitmap* /*aBitmap*/,
+ HBufC8* /*aData*/,
+ TInt /*aError*/ ){};
+
+ void FrameBufferReady(
+ MFrameBuffer* /*aFrameBuffer*/,
+ TInt /*aError*/ ) {}; // Empty default because not in use.
+
+ private: // From Camera Observer2 / ECam.h
+
+ void HandleEvent(const TECAMEvent& aEvent);
+
+ void ViewFinderReady(MCameraBuffer& /*aCameraBuffer*/,TInt /*aError*/){};
+
+ void ImageBufferReady(MCameraBuffer& /*aCameraBuffer*/,TInt /*aError*/){};
+
+ void VideoBufferReady(MCameraBuffer& /*aCameraBuffer*/,TInt /*aError*/){};
+ protected:
+
+ /**
+ * C++ default constructor.
+ */
+ CEngineVideoRecording();
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL(MEngineVideoRecordingObserver& aObserver,
+ TInt aCameraIndex);
+
+ private:
+ // Camera API implementation object.
+ CCamera* iCamera;
+
+ // Video Recorder API implementation object.
+ CVideoRecorderUtility* iVideoRecorder;
+
+ // Video Recording observer
+ MEngineVideoRecordingObserver* iVideoRecordingObserver;
+
+ // Video Recording Engine info object.
+ TEngineVideoRecordingInfo* iInfo;
+
+ // Video recording quality levels container.
+ CVideoRecordingQualityLevels* iVideoQualityLevels;
+
+ // Video recording frame size.
+ // This is ptr because video recorder is not necessarily initialized.
+ TSize* iVideoFrameSize;
+
+ // Video recording frame size (to be prepared).
+ // This is ptr because video recorder is not necessarily initialized.
+ TSize* iVideoFrameSizePrep;
+
+ // Video clip file name.
+ HBufC* iVideoClipFileName;
+
+ // Video Recorder video type.
+ HBufC8* iVideoType;
+
+ // Boolean indicating if camera module is reserved for the engine.
+ TBool iReserved;
+
+ // Boolean indicating if camera module power is on.
+ TBool iPowerOn;
+
+ // Boolean indicating if video recording is initialized.
+ TBool iVideoInitialized;
+
+ // Boolean indicating if video recording is opened.
+ TBool iVideoOpened;
+
+ // Boolean indicating if video recording is prepared.
+ TBool iVideoPrepared;
+
+ // Boolean indicating if video recording is currently running.
+ TBool iVideoRecordingRunning;
+
+ // Boolean indicating if video recording is currently paused.
+ TBool iVideoRecordingPaused;
+
+ // Video recording quality level index currently prepared.
+ TInt iVideoQualityIndex;
+
+ // Handle to the camera used.
+ TInt iCameraHandle;
+
+ // Video Recorder controller UID.
+ TUid iVideoControllerUid;
+
+ // Video Recorder format UID.
+ TUid iVideoFormatUid;
+
+ // Video Recorder audio type.
+ TFourCC iVideoAudioType;
+
+ //// Camera module settings related variables. ////
+
+ // Current zoom mode.
+ TZoomMode iZoomMode;
+
+ // Current zoom value.
+ TInt iZoomValue;
+
+ // Current brightness value.
+ TInt iBrightness;
+
+ // Current contrast value.
+ TInt iContrast;
+
+ // Camera exposure mode.
+ CCamera::TExposure iExposureMode;
+
+ // Camera white balance mode.
+ CCamera::TWhiteBalance iWhiteBalanceMode;
+
+ // Camera flash mode.
+ CCamera::TFlash iFlashMode;
+ //// Video recording parameters prepared. ////
+
+ // Video recording frame rate.
+ TReal32 iVideoFrameRate;
+
+ // Video recording bit rate.
+ TInt iVideoBitRate;
+
+ // Boolean indicating if audio is enabled with video recording.
+ TBool iVideoAudioEnabled;
+
+ // Video recording audio bit rate.
+ TInt iVideoAudioBitRate;
+
+ // Video recording maximum clip size in bytes.
+ TInt iMaxClipSizeInBytes;
+
+ //// Video recording parameters to be prepared. ////
+
+ // Video recording frame rate (to be prepared).
+ TReal32 iVideoFrameRatePrep;
+
+ // Video recording bit rate (to be prepared).
+ TInt iVideoBitRatePrep;
+
+ // Boolean indicating if audio is enabled with video recording (to be prepared).
+ TBool iVideoAudioEnabledPrep;
+
+ // Video recording audio bit rate (to be prepared).
+ TInt iVideoAudioBitRatePrep;
+
+ // Video recording maximum clip size in bytes (to be prepared).
+ TInt iMaxClipSizeInBytesPrep;
+
+ // Boolean indicating if parameters are/were prepared in video recording preparation..
+ TBool iPrepPars;
+
+ // Boolean indicating if video audio bit rate should be prepared.
+ TBool iPrepareVideoAudioBitRate;
+ };
+
+
+
+
+#endif //ENGINEVIDEORECORDING_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/engine/inc/VideoRecordingQualityLevels.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Engine video quality level and container.
+*
+*/
+
+#ifndef VIDEORECORDINGQUALITYLEVELS_H_
+#define VIDEORECORDINGQUALITYLEVELS_H_
+
+
+const TInt KMaxVideoStringParLength = 32;
+const TInt KMaxAudioTypeStringParLength = 4;
+
+const TInt KMaxVideoQltyLevelCount = 6;
+
+const TInt KImgWidthSubQCIF = 128;
+const TInt KImgHeightSubQCIF = 96;
+
+const TInt KImgWidthQCIF = 176;
+const TInt KImgHeightQCIF = 144;
+
+const TInt KImgWidthCIF = 352;
+const TInt KImgHeightCIF = 288;
+
+_LIT8(KVideoMimeType, "video/3gpp");
+
+_LIT(KPreferredSupplier, "Nokia");
+
+_LIT8(KVideoType, "video/H263-2000");
+
+_LIT8(KAudioType, " AMR");
+
+class CVideoRecordingQualityLevel : public CBase
+ {
+public:
+ CVideoRecordingQualityLevel(){}
+ virtual ~CVideoRecordingQualityLevel(){}
+
+public:
+
+ // The video recording frame size.
+ TSize iFrameSize;
+
+ // The video recording frame rate.
+ TReal32 iFrameRate;
+
+ // The video recording bit rate.
+ TInt iBitRate;
+
+ // A Boolean indicating if video recording audio is enabled or not.
+ TBool iAudioEnabled;
+
+ // The video recording audio bit rate.
+ TInt iAudioBitRate;
+
+ // The video MIME type (e.g. "video/3gpp").
+ TBuf8<KMaxVideoStringParLength> iMimeType;
+
+ // The preferred supplier of video controller (e.g. "Company X").
+ TBuf<KMaxVideoStringParLength> iPreferredSupplier;
+
+ // The video type (e.g. "video/H263-2000").
+ TBuf8<KMaxVideoStringParLength> iVideoType;
+
+ // The audio type expressed with four characters (e.g. " AMR").
+ TBuf8<KMaxAudioTypeStringParLength> iAudioType;
+
+ // The estimated video recording bit rate to storage (bits per second).
+ TInt iStorageRate;
+ };
+
+
+class CVideoRecordingQualityLevels : public CBase
+ {
+public:
+ /**
+ * Destructor.
+ */
+ virtual ~CVideoRecordingQualityLevels();
+
+ /**
+ * Two-phased constructor.
+ */
+ static CVideoRecordingQualityLevels* NewL();
+
+ /**
+ * Initializes quality levels to hardcoded default values.
+ * @return The count of quality levels initialized
+ */
+ TInt InitDefaultsL();
+
+ /**
+ * Gets the quality level count.
+ * @return Quality level count
+ */
+ TInt Count() const;
+
+ /**
+ * Gets the specified quality level.
+ * @param aIndex Quality level index
+ * @return Video quality level
+ */
+ CVideoRecordingQualityLevel& At(
+ TInt aIndex ) const;
+
+private:
+
+ /**
+ * C++ constructor.
+ */
+ CVideoRecordingQualityLevels();
+
+ /**
+ * Symbian OS 2nd phase constructor that can leave.
+ */
+ void ConstructL();
+
+private:
+
+ // Supported video recording quality levels.
+ CArrayFixFlat<CVideoRecordingQualityLevel>* iQualityLevels;
+ };
+
+#endif /* VIDEORECORDINGQUALITYLEVELS_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/engine/src/EngineVideoRecording.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,1429 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Engine implementation video recording methods.
+*
+*/
+
+
+// INCLUDE FILES
+#include <HtiLogging.h>
+#include <AudioPreference.h> // For MMF audio preference definitions.
+
+
+#include "EngineVideoRecording.h"
+#include "VideoRecordingQualityLevels.h"
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CEngineVideoRecording::CEngineVideoRecording
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CEngineVideoRecording::CEngineVideoRecording() :
+ iZoomMode( EZoomModeDigital ),
+ iExposureMode( CCamera::EExposureAuto ),
+ iWhiteBalanceMode( CCamera::EWBAuto ),
+ iFlashMode( CCamera::EFlashNone ),
+ iMaxClipSizeInBytes( KMMFNoMaxClipSize ),
+ iMaxClipSizeInBytesPrep( KMMFNoMaxClipSize )
+ {
+ }
+
+
+// -----------------------------------------------------------------------------
+// CEngineVideoRecording::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CEngineVideoRecording::ConstructL(MEngineVideoRecordingObserver& aObserver,
+ TInt aCameraIndex)
+ {
+ HTI_LOG_FUNC_IN( "CEngineVideoRecording::ConstructL" );
+ iVideoRecordingObserver = &aObserver;
+
+ if ( ( aCameraIndex < 0 ) ||
+ ( aCameraIndex >= CCamera::CamerasAvailable() ) )
+ {
+ HTI_LOG_FORMAT("Cae: CEngineVideoRecording::ConstructL leaving KErrHardwareNotAvailable, aCameraIndex=%d", aCameraIndex );
+ User::Leave( KErrHardwareNotAvailable );
+ }
+
+ // Create a new Camera API implementation object, if supported
+ TRAPD( err, iCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), aCameraIndex, KCameraPriority ) );
+ if ( err )
+ {
+ HTI_LOG_FORMAT("CEngineVideoRecording::ConstructL() CCamera::New2L return code=%d", err );
+
+ // Create old Camera API implementation object.
+ iCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), aCameraIndex );
+ HTI_LOG_TEXT("CEngineVideoRecording::ConstructL() using MCameraObserver");
+ }
+ else
+ {
+ HTI_LOG_TEXT("CEngineVideoRecording::ConstructL() using MCameraObserver2");
+ }
+
+
+ // Get camera handle.
+ iCameraHandle = iCamera->Handle();
+
+ // Create and initialize info object.
+ iInfo = new( ELeave ) TEngineVideoRecordingInfo;
+ InitializeInfo( *iCamera );
+
+ HTI_LOG_FUNC_OUT( "CEngineVideoRecording::ConstructL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CEngineVideoRecording::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CEngineVideoRecording* CEngineVideoRecording::NewL(MEngineVideoRecordingObserver& aObserver,
+ TInt aCameraIndex)
+ {
+ CEngineVideoRecording* self = new (ELeave) CEngineVideoRecording;
+ CleanupStack::PushL( self );
+ self->ConstructL(aObserver, aCameraIndex);
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+// Destructor
+CEngineVideoRecording::~CEngineVideoRecording()
+ {
+ HTI_LOG_FUNC_IN( "CEngineVideoRecording::~CEngineVideoRecording");
+
+ delete iVideoType;
+ delete iVideoClipFileName;
+
+ // Turn camera power off first, then release camera.
+ if ( iCamera )
+ {
+ if ( iReserved )
+ {
+ if ( iPowerOn )
+ {
+ iCamera->PowerOff();
+ }
+ iCamera->Release();
+ }
+ }
+
+ delete iVideoFrameSizePrep;
+ delete iVideoFrameSize;
+
+ delete iVideoRecorder;
+
+ delete iVideoQualityLevels;
+
+ delete iCamera;
+
+ REComSession::FinalClose();
+
+ HTI_LOG_FUNC_OUT( "CEngineVideoRecording::~CEngineVideoRecording");
+ }
+
+void CEngineVideoRecording::InitL( )
+ {
+ HTI_LOG_FUNC_IN( "CEngineVideoRecording::InitL");
+
+ // To allow re-initialization, release the camera (first cancels possible
+ // activities and turns camera power off).
+ Release();
+
+ iCamera->Reserve();
+
+ HTI_LOG_FUNC_OUT( "CEngineVideoRecording::InitL");
+ }
+
+void CEngineVideoRecording::InitializeInfo(
+ const CCamera& aCamera )
+ {
+
+ // Initialise Camera (API) info.
+
+ TCameraInfo cameraInfo;
+ aCamera.CameraInfo( cameraInfo );
+
+ iInfo->iHardwareVersion = cameraInfo.iHardwareVersion;
+ iInfo->iSoftwareVersion = cameraInfo.iSoftwareVersion;
+
+ iInfo->iOrientation = cameraInfo.iOrientation;
+
+ iInfo->iOptionsSupported = cameraInfo.iOptionsSupported;
+
+ iInfo->iFlashModesSupported = cameraInfo.iFlashModesSupported;
+
+ iInfo->iExposureModesSupported = cameraInfo.iExposureModesSupported;
+
+ iInfo->iWhiteBalanceModesSupported = cameraInfo.iWhiteBalanceModesSupported;
+
+ iInfo->iMinZoom = cameraInfo.iMinZoom;
+ iInfo->iMaxZoom = cameraInfo.iMaxZoom;
+ iInfo->iMaxDigitalZoom = cameraInfo.iMaxDigitalZoom;
+
+ iInfo->iMinZoomFactor = cameraInfo.iMinZoomFactor;
+ iInfo->iMaxZoomFactor = cameraInfo.iMaxZoomFactor;
+ iInfo->iMaxDigitalZoomFactor = cameraInfo.iMaxDigitalZoomFactor;
+
+ iInfo->iNumImageSizesSupported = cameraInfo.iNumImageSizesSupported;
+ iInfo->iImageFormatsSupported = cameraInfo.iImageFormatsSupported;
+
+ // Initialize EV compensation info (no supported in this version)
+ iInfo->iMinEvCompensation = 0;
+ iInfo->iMaxEvCompensation = 0;
+ iInfo->iMinEvCompensationValue = 0;
+ iInfo->iMaxEvCompensationValue = 0;
+
+ // Initialize engine info.
+
+ iInfo->iNumStillQualityLevelsSupported = 0; // Quality levels are initialized separately.
+ iInfo->iNumVideoQualityLevelsSupported = 0; // Quality levels are initialized separately.
+
+ }
+void CEngineVideoRecording::InitVideoRecorderL()
+ {
+ HTI_LOG_FUNC_IN( "CEngineVideoRecording::InitVideoRecorderL()");
+
+ iVideoInitialized = EFalse;
+
+ // Close video recording if previously opened/prepared.
+ CloseVideoRecording();
+
+ // (Re-)initialize these.
+ iMaxClipSizeInBytes = KMMFNoMaxClipSize;
+ iMaxClipSizeInBytesPrep = KMMFNoMaxClipSize;
+
+ // Create video quality levels container object.
+ iVideoQualityLevels = CVideoRecordingQualityLevels::NewL();
+
+ // Destroy possible video clip file name. (Its allocated elsewhere when file name is set.)
+ delete iVideoClipFileName;
+ iVideoClipFileName = NULL;
+
+ // Create video recorder.
+ delete iVideoRecorder;
+ iVideoRecorder = NULL;
+ iVideoRecorder = CVideoRecorderUtility::NewL( *this , KAudioPriorityVideoRecording,
+ TMdaPriorityPreference( KAudioPrefVideoRecording ) );
+
+ delete iVideoFrameSize;
+ iVideoFrameSize = NULL;
+ iVideoFrameSize = new( ELeave ) TSize();
+
+ delete iVideoFrameSizePrep;
+ iVideoFrameSizePrep = NULL;
+ iVideoFrameSizePrep = new( ELeave ) TSize();
+
+ iInfo->iNumVideoQualityLevelsSupported = iVideoQualityLevels->InitDefaultsL();
+ iVideoInitialized = ETrue;
+
+ HTI_LOG_FUNC_OUT( "CEngineVideoRecording::InitVideoRecorderL()");
+ }
+
+void CEngineVideoRecording::SetVideoRecordingFileNameL(
+ const TDesC& aVideoClipFileName )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::SetVideoRecordingFileNameL");
+
+ if ( !iVideoInitialized || iVideoRecordingRunning )
+ {
+ HTI_LOG_TEXT("CEngineVideoRecording::SetVideoRecordingFileNameL leaving KErrNotReady" );
+ User::Leave( KErrNotReady );
+ }
+
+ if ( aVideoClipFileName.Length() > 0 )
+ {
+ // Memorize the video clip file name.
+ delete iVideoClipFileName;
+ iVideoClipFileName = NULL;
+ iVideoClipFileName = aVideoClipFileName.AllocL();
+ }
+ else
+ {
+ HTI_LOG_TEXT("CEngineVideoRecording::SetVideoRecordingFileNameL leaving KErrArgument");
+ User::Leave( KErrArgument );
+ }
+
+ if ( iVideoPrepared )
+ {
+ // Does the actual change of file name, only if video is prepared.
+ // Note: Variated implementation
+ ChangeVideoFileNameL();
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetVideoRecordingFileNameL");
+ }
+
+void CEngineVideoRecording::ChangeVideoFileNameL()
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::ChangeVideoFileNameL");
+
+ // Close if previously prepared.
+ CloseVideoRecording();
+ // Open video recorder.
+ iVideoOpened = ETrue; // This is always set to ETrue when
+ // OpenFileL has been called to allow
+ // freeing resources by CloseVideoRecording().
+ iVideoRecorder->OpenFileL( iVideoClipFileName->Des(),
+ iCameraHandle,
+ iVideoControllerUid,
+ iVideoFormatUid,
+ iVideoType->Des(),
+ iVideoAudioType );
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::ChangeVideoFileNameL");
+ }
+
+void CEngineVideoRecording::PrepareVideoRecordingL(
+ TInt aVideoQualityIndex )
+ {
+ HTI_LOG_TEXT("CEngineVideoRecording::PrepareVideoRecordingL with video quality index");
+
+ if ( ( aVideoQualityIndex < 0 ) ||
+ ( aVideoQualityIndex >= iVideoQualityLevels->Count() ) )
+ {
+ HTI_LOG_TEXT("PrepareVideoRecordingL() leaving KErrArgument");
+ User::Leave( KErrArgument );
+ }
+
+ PrepareVideoRecordingL( iVideoQualityLevels->At( aVideoQualityIndex ).iFrameSize,
+ iVideoQualityLevels->At( aVideoQualityIndex ).iFrameRate,
+ iVideoQualityLevels->At( aVideoQualityIndex ).iBitRate,
+ iVideoQualityLevels->At( aVideoQualityIndex ).iAudioEnabled,
+ iVideoQualityLevels->At( aVideoQualityIndex ).iAudioBitRate,
+ iVideoQualityLevels->At( aVideoQualityIndex ).iMimeType,
+ iVideoQualityLevels->At( aVideoQualityIndex ).iPreferredSupplier,
+ iVideoQualityLevels->At( aVideoQualityIndex ).iVideoType,
+ iVideoQualityLevels->At( aVideoQualityIndex ).iAudioType );
+
+ iVideoQualityIndex = aVideoQualityIndex;
+ }
+
+void CEngineVideoRecording::PrepareVideoRecordingL(
+ const TSize& aFrameSize,
+ TReal32 aFrameRate,
+ TInt aBitRate,
+ TBool aAudioEnabled,
+ const TDesC8& aMimeType,
+ const TDesC& aPreferredSupplier,
+ const TDesC8& aVideoType,
+ const TDesC8& aAudioType )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::PrepareVideoRecordingL");
+ // Leave if not initialized properly or busy doing something else.
+ if ( !iVideoInitialized ||
+ !iVideoClipFileName ||
+ iVideoRecordingRunning )
+ {
+ HTI_LOG_TEXT("PrepareVideoRecordingL leaving KErrNotReady");
+ User::Leave( KErrNotReady );
+ }
+
+ CheckPowerL();
+
+ // Leave if video clip file name is not set properly.
+ if ( iVideoClipFileName->Length() == 0 )
+ {
+ HTI_LOG_TEXT("PrepareVideoRecordingL() leaving KErrArgument (iVideoClipFileName)");
+ User::Leave( KErrArgument );
+ }
+
+ // Close if previously opened/prepared.
+ CloseVideoRecording();
+
+ // Find values for iVideoControllerUid and iVideoFormatUid.
+ // Those are also needed if clip file name is changed when prepared.
+ FindVideoUidsL( aMimeType, aPreferredSupplier );
+
+ // Memorize video type.
+ delete iVideoType;
+ iVideoType = NULL;
+ iVideoType = aVideoType.AllocL();
+
+ // Convert audio type from TDesC8 to TFourCC.
+ iVideoAudioType = ConvertAndSetVideoAudioTypeL( aAudioType );
+
+ // Memorize the parameters to be prepared.
+ *iVideoFrameSizePrep = aFrameSize;
+ iVideoFrameRatePrep = aFrameRate;
+ iVideoBitRatePrep = aBitRate;
+ iVideoAudioEnabledPrep = aAudioEnabled;
+
+ // Open video recorder.
+ iVideoOpened = ETrue; // This is always set to ETrue when
+ // OpenFileL has been called to allow
+ // freeing resources by CloseVideoRecording().
+ iVideoRecorder->OpenFileL( iVideoClipFileName->Des(),
+ iCameraHandle,
+ iVideoControllerUid,
+ iVideoFormatUid,
+ iVideoType->Des(),
+ iVideoAudioType );
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::PrepareVideoRecordingL");
+ }
+
+void CEngineVideoRecording::PrepareVideoRecordingL(
+ const TSize& aFrameSize,
+ TReal32 aFrameRate,
+ TInt aBitRate,
+ TBool aAudioEnabled,
+ TInt aAudioBitRate,
+ const TDesC8& aMimeType,
+ const TDesC& aPreferredSupplier,
+ const TDesC8& aVideoType,
+ const TDesC8& aAudioType )
+ {
+ HTI_LOG_TEXT("CEngineVideoRecording::PrepareVideoRecordingL with audio bit rate");
+ // Memorize video audio bit rate value to be prepared.
+ iVideoAudioBitRatePrep = aAudioBitRate;
+ // Force audio bit rate preparation.
+ iPrepareVideoAudioBitRate = ETrue;
+
+ // Call the version without audio bit rate argument.
+ // This is possible because the separate PrepareVideoSettingsL() is doing
+ // settings after succesfull opening of video recording.
+ PrepareVideoRecordingL( aFrameSize,
+ aFrameRate,
+ aBitRate,
+ aAudioEnabled,
+ aMimeType,
+ aPreferredSupplier,
+ aVideoType,
+ aAudioType );
+ }
+
+void CEngineVideoRecording::CloseVideoRecording()
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::CloseVideoRecording");
+
+ if ( iVideoPrepared )
+ {
+ CancelVideoRecording();
+ iVideoPrepared = EFalse;
+ }
+
+ if ( iVideoOpened )
+ {
+ iVideoRecorder->Close();
+ iVideoOpened = EFalse;
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::CloseVideoRecording");
+ }
+
+TInt CEngineVideoRecording::VideoQualityIndex() const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::VideoQualityIndex");
+
+ TInt qualityIndex( -1 );
+ if ( iVideoPrepared )
+ {
+ qualityIndex = iVideoQualityIndex;
+ }
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::VideoQualityIndex");
+ return qualityIndex;
+ }
+
+TInt CEngineVideoRecording::VideoQualityCount() const
+ {
+ return iVideoQualityLevels->Count();
+ }
+
+
+void CEngineVideoRecording::GetVideoFrameSize(
+ TInt aVideoQualityIndex,
+ TSize& aFrameSize ) const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::GetVideoFrameSize");
+
+ if ( aVideoQualityIndex >= 0 &&
+ aVideoQualityIndex < iVideoQualityLevels->Count() )
+ {
+ aFrameSize = iVideoQualityLevels->At( aVideoQualityIndex ).iFrameSize;
+ }
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::GetVideoFrameSize");
+ }
+
+TReal32 CEngineVideoRecording::VideoFrameRate(
+ TInt aVideoQualityIndex ) const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::VideoFrameRate");
+
+ TReal32 frameRate( 0.0 );
+ if ( aVideoQualityIndex >= 0 &&
+ aVideoQualityIndex < iVideoQualityLevels->Count() )
+ {
+ frameRate = iVideoQualityLevels->At( aVideoQualityIndex ).iFrameRate;
+ }
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::VideoFrameRate");
+ return frameRate;
+ }
+
+TInt CEngineVideoRecording::EstimatedVideoRecordingBitRateL(
+ TInt aVideoQualityIndex ) const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::EstimatedVideoRecordingBitRateL");
+
+ TInt storageRate( 0 );
+ if ( aVideoQualityIndex >= 0 &&
+ aVideoQualityIndex < iVideoQualityLevels->Count() )
+ {
+ storageRate = iVideoQualityLevels->At( aVideoQualityIndex ).iStorageRate;
+ }
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::EstimatedVideoRecordingBitRateL");
+ return storageRate;
+ }
+
+void CEngineVideoRecording::SetVideoClipMaxSizeL(
+ TInt aMaxClipSizeInBytes )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::SetVideoClipMaxSizeL");
+
+ if ( !iVideoInitialized || iVideoRecordingRunning )
+ {
+ HTI_LOG_TEXT("SetVideoClipMaxSizeL leaving KErrNotReady");
+ User::Leave( KErrNotReady );
+ }
+
+ if ( aMaxClipSizeInBytes > 0 )
+ {
+ iMaxClipSizeInBytesPrep = aMaxClipSizeInBytes;
+ }
+ else
+ {
+ iMaxClipSizeInBytesPrep = KMMFNoMaxClipSize;
+ }
+
+ if ( iVideoPrepared )
+ {
+ iPrepPars = ETrue;
+ iVideoRecorder->SetMaxClipSizeL( iMaxClipSizeInBytesPrep );
+ iVideoRecorder->Prepare();
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetVideoClipMaxSizeL");
+ }
+
+TInt CEngineVideoRecording::VideoClipMaxSize() const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::VideoClipMaxSize");
+
+ TInt maxClipSizeInBytes( 0 );
+ if ( iMaxClipSizeInBytes != KMMFNoMaxClipSize )
+ {
+ maxClipSizeInBytes = iMaxClipSizeInBytes;
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::VideoClipMaxSize");
+ return maxClipSizeInBytes;
+ }
+
+void CEngineVideoRecording::SetVideoAudioL(
+ TBool aAudioEnabled )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::SetVideoAudioL");
+
+ if ( !iVideoInitialized || iVideoRecordingRunning )
+ {
+ HTI_LOG_TEXT("SetVideoAudioL leaving KErrNotReady");
+ User::Leave( KErrNotReady );
+ }
+
+ iVideoAudioEnabledPrep = aAudioEnabled;
+ iVideoRecorder->SetAudioEnabledL( iVideoAudioEnabledPrep );
+ iPrepPars = ETrue;
+ iVideoRecorder->Prepare();
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetVideoAudioL");
+ }
+
+TBool CEngineVideoRecording::VideoAudio() const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::VideoAudio");
+
+ TBool audioEnabled( EFalse );
+ if ( iVideoRecorder )
+ {
+ TRAPD( error, { audioEnabled = iVideoRecorder->AudioEnabledL(); } );
+ if ( error != KErrNone )
+ {
+ audioEnabled = EFalse;
+ }
+ }
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::VideoAudio");
+ return audioEnabled;
+ }
+
+void CEngineVideoRecording::StartVideoRecording()
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::StartVideoRecording");
+
+ TInt error( KErrNone );
+
+ if ( iVideoPrepared && !iVideoRecordingRunning )
+ {
+ iVideoRecordingRunning = ETrue;
+ iVideoRecordingPaused = EFalse;
+
+ // Start video recording.
+ iVideoRecorder->Record();
+ }
+ else
+ {
+ error = KErrNotReady;
+ }
+
+
+ iVideoRecordingObserver->MevroVideoRecordingOn( error );
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::StartVideoRecording");
+ }
+
+void CEngineVideoRecording::StopVideoRecording()
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::StopVideoRecording");
+
+ TInt stoppingError( KErrNone );
+
+ if ( iVideoRecordingRunning )
+ {
+ iVideoRecordingRunning = EFalse;
+ stoppingError = iVideoRecorder->Stop();
+
+ // Can't be paused anymore.
+ iVideoRecordingPaused = EFalse;
+ }
+ else
+ {
+ stoppingError = KErrNotReady;
+ }
+
+ iVideoRecordingObserver->MevroVideoRecordingComplete( stoppingError );
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::StopVideoRecording");
+ }
+
+void CEngineVideoRecording::PauseVideoRecording()
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::PauseVideoRecording");
+
+ TInt error( KErrNone );
+
+ if ( iVideoRecordingRunning && !iVideoRecordingPaused )
+ {
+ // Pause video recording.
+ TRAP( error, iVideoRecorder->PauseL() );
+
+ if ( error == KErrNone )
+ {
+ iVideoRecordingPaused = ETrue;
+ }
+ }
+ else
+ {
+ error = KErrNotReady;
+ }
+
+ iVideoRecordingObserver->MevroVideoRecordingPaused( error );
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::PauseVideoRecording");
+ }
+
+void CEngineVideoRecording::ResumeVideoRecording()
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::ResumeVideoRecording");
+
+ TInt error( KErrNone );
+
+ if ( iVideoRecordingRunning && iVideoRecordingPaused )
+ {
+ // Start video recording.
+ iVideoRecorder->Record();
+ iVideoRecordingPaused = EFalse;
+ }
+ else
+ {
+ error = KErrNotReady;
+ }
+
+ iVideoRecordingObserver->MevroVideoRecordingOn( error );
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::ResumeVideoRecording");
+ }
+
+TTimeIntervalMicroSeconds CEngineVideoRecording::RemainingVideoRecordingTime() const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::RemainingVideoRecordingTime");
+
+ TTimeIntervalMicroSeconds remaining( 0 );
+ if ( iVideoRecorder )
+ {
+ remaining = iVideoRecorder->RecordTimeAvailable();
+ }
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::RemainingVideoRecordingTime");
+ return remaining;
+ }
+
+TBool CEngineVideoRecording::IsVideoRecording() const
+ {
+ return iVideoRecordingRunning;
+ }
+
+
+void CEngineVideoRecording::CancelVideoRecording()
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::CancelVideoRecording");
+
+ if ( iVideoRecordingRunning )
+ {
+ iVideoRecordingRunning = EFalse;
+ // Stop video recording. Do not call MevroVideoRecordingComplete()
+ (void) iVideoRecorder->Stop();
+ iVideoRecordingPaused = EFalse;
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::CancelVideoRecording");
+ }
+
+void CEngineVideoRecording::PrepareVideoSettingsL()
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::PrepareVideoSettingsL");
+
+ iVideoRecorder->SetVideoFrameSizeL( *iVideoFrameSizePrep );
+ iVideoRecorder->SetVideoFrameRateL( iVideoFrameRatePrep );
+ iVideoRecorder->SetVideoBitRateL( iVideoBitRatePrep );
+ iVideoRecorder->SetAudioEnabledL( iVideoAudioEnabledPrep );
+ if ( iPrepareVideoAudioBitRate )
+ {
+ iVideoRecorder->SetAudioBitRateL( iVideoAudioBitRatePrep );
+ iPrepareVideoAudioBitRate = EFalse;
+ }
+ iVideoRecorder->SetMaxClipSizeL( iMaxClipSizeInBytesPrep );
+
+ // Set the recording gain to the maximum
+ TInt gain = iVideoRecorder->GainL();
+ HTI_LOG_FORMAT("CEngineVideoRecording::PrepareVideoSettingsL() GainL was %d", gain );
+ gain = iVideoRecorder->MaxGainL();
+ HTI_LOG_FORMAT("CEngineVideoRecording::PrepareVideoSettingsL() MaxGainL is %d", gain );
+ iVideoRecorder->SetGainL( gain );
+ gain = iVideoRecorder->GainL();
+ HTI_LOG_FORMAT("CEngineVideoRecording::PrepareVideoSettingsL() GainL set to %d", gain );
+
+ iPrepPars = ETrue;
+ iVideoRecorder->Prepare();
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::PrepareVideoSettingsL");
+ }
+
+void CEngineVideoRecording::FindVideoUidsL(
+ const TDesC8& aMimeType,
+ const TDesC& aPreferredSupplier )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::FindVideoUidsL");
+
+ iVideoControllerUid.iUid = 0;
+ iVideoFormatUid.iUid = 0;
+
+ // Retrieve a list of possible controllers from ECOM.
+ //
+ // Controller must support recording the requested mime type.
+ // Controller must be provided by preferred supplier.
+
+ CMMFControllerPluginSelectionParameters* cSelect =
+ CMMFControllerPluginSelectionParameters::NewLC();
+ CMMFFormatSelectionParameters* fSelect =
+ CMMFFormatSelectionParameters::NewLC();
+
+ fSelect->SetMatchToMimeTypeL( aMimeType );
+ cSelect->SetRequiredRecordFormatSupportL( *fSelect );
+ cSelect->SetPreferredSupplierL( aPreferredSupplier,
+ CMMFPluginSelectionParameters::EOnlyPreferredSupplierPluginsReturned );
+
+ RMMFControllerImplInfoArray controllers;
+ CleanupResetAndDestroyPushL( controllers );
+ cSelect->ListImplementationsL( controllers );
+
+ if ( controllers.Count() < 1 )
+ {
+ // No appropriate controllers found.
+ HTI_LOG_TEXT("CEngineVideoRecording::FindVideoUidsL() leaving KErrNotSupported (no controllers found)");
+ User::Leave( KErrNotSupported );
+ }
+
+ TBool found( EFalse );
+ for ( TInt contInd = 0; contInd < controllers.Count() && !found; contInd++ ) // there can be more than one controller, search from all of them
+ {
+ // Get the controller UID.
+ iVideoControllerUid = controllers[contInd]->Uid();
+ HTI_LOG_FORMAT("CEngineVideoRecording::FindVideoUidsL() iVideoControllerUid=%x", iVideoControllerUid.iUid );
+
+ // Inquires the controller about supported formats.
+ RMMFFormatImplInfoArray formats = controllers[contInd]->RecordFormats();
+
+ // Get the first format that supports our mime type.
+ for ( TInt i = 0; i < formats.Count(); i++ )
+ {
+ if ( formats[i]->SupportsMimeType( aMimeType ) )
+ {
+ iVideoFormatUid = formats[i]->Uid(); // set the UID
+ found = ETrue;
+ HTI_LOG_FORMAT("CEngineVideoRecording::FindVideoUidsL() Found iVideoFormatUid=%x", iVideoFormatUid.iUid);
+ break;
+ }
+ }
+ }
+ if ( !found )
+ {
+ // No appropriate video format found.
+ HTI_LOG_TEXT("CEngineVideoRecording::FindVideoUidsL() leaving KErrNotSupported (no video format found)");
+ User::Leave( KErrNotSupported );
+ }
+
+ CleanupStack::PopAndDestroy( 3, cSelect ); // cselect, fselect, controllers
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::FindVideoUidsL");
+ }
+
+
+TFourCC CEngineVideoRecording::ConvertAndSetVideoAudioTypeL(
+ const TDesC8& aAudioType )
+ {
+ if ( aAudioType == KNullDesC8 )
+ {
+ return KMMFFourCCCodeNULL;
+ }
+ else
+ {
+ if ( aAudioType.Length() != 4 )
+ {
+ User::Leave( KErrArgument );
+ }
+ return TFourCC( aAudioType[0], aAudioType[1], aAudioType[2], aAudioType[3] );
+ }
+ }
+
+void CEngineVideoRecording::Reserve()
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::Reserve");
+
+ if ( !iReserved )
+ {
+ iCamera->Reserve();
+ }
+ else if ( !iPowerOn ) // in case previous reserve ok, but poweron failed
+ {
+ PowerOn();
+ }
+
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::Reserve");
+ }
+
+
+void CEngineVideoRecording::Release()
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::Release");
+
+ if ( iReserved )
+ {
+ PowerOff(); // Cancel all activities (if any) and turn power off.
+ iCamera->Release(); // Release Camera HW.
+ iReserved = EFalse;
+ iVideoPrepared = EFalse;
+ iVideoOpened = EFalse;
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::Release");
+ }
+
+
+void CEngineVideoRecording::PowerOn()
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::PowerOn");
+
+ if ( iReserved && !iPowerOn )
+ {
+ iCamera->PowerOn();
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::PowerOn");
+ }
+
+
+void CEngineVideoRecording::PowerOff()
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::PowerOff");
+
+ if ( iPowerOn )
+ {
+ iCamera->PowerOff();
+ iPowerOn = EFalse;
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::PowerOff");
+ }
+
+
+void CEngineVideoRecording::SetZoomModeL(
+ TZoomMode aZoomMode )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::SetZoomModeL");
+
+ // Currently supporting digital and optical zooms, not EZoomModeOpticalDigital.
+ if ( ( aZoomMode != EZoomModeDigital ) && ( aZoomMode != EZoomModeOptical ) )
+ {
+ HTI_LOG_FORMAT("CEngineVideoRecording::SetZoomModeL leaving KErrNotSupported, aZoomMode=%d", aZoomMode );
+ User::Leave( KErrNotSupported );
+ }
+
+ iZoomMode = aZoomMode;
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetZoomModeL");
+ }
+
+
+CEngineVideoRecording::TZoomMode CEngineVideoRecording::ZoomMode() const
+ {
+ HTI_LOG_TEXT("CEngineVideoRecording::ZoomMode");
+
+ return iZoomMode;
+ }
+
+
+void CEngineVideoRecording::SetZoomValueL(
+ TInt aZoomValue )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::SetZoomValueL");
+
+ CheckPowerL();
+
+ switch ( iZoomMode )
+ {
+ case EZoomModeDigital:
+ // Leave if zoom factor is out of range.
+ if ( ( aZoomValue < 0 ) ||
+ ( aZoomValue > iInfo->iMaxDigitalZoom ) )
+ {
+ HTI_LOG_FORMAT("CEngineVideoRecording::SetZoomValueL leaving KErrArgument, aZoomValue=%d", aZoomValue );
+ HTI_LOG_FORMAT("The min digital zool value is 0, the max is %d", iInfo->iMaxDigitalZoom);
+ User::Leave( KErrArgument );
+ }
+ // Set DIGITAL zoom value.
+ iCamera->SetDigitalZoomFactorL( aZoomValue );
+ iZoomValue = aZoomValue;
+ break;
+ case EZoomModeOptical:
+ // Leave if zoom factor is out of range.
+ if ( ( aZoomValue < iInfo->iMinZoom ) ||
+ ( aZoomValue > iInfo->iMaxZoom ) )
+ {
+ HTI_LOG_FORMAT("CEngineVideoRecording::SetZoomValueL leaving KErrArgument, aZoomValue=%d", aZoomValue );
+ HTI_LOG_FORMAT("The max optical zoom value is %d", iInfo->iMaxZoom);
+ HTI_LOG_FORMAT("The min optical zoom value is %d", iInfo->iMinZoom);
+ if(iInfo->iMinZoom == iInfo->iMaxZoom)
+ {
+ User::Leave(KErrNotSupported);
+ }
+ User::Leave( KErrArgument );
+ }
+ // Set OPTICAL zoom value.
+ iCamera->SetZoomFactorL( aZoomValue );
+ iZoomValue = aZoomValue;
+ break;
+ default:
+ // EZoomModeOpticalDigital not supported
+ HTI_LOG_FORMAT("CEngineVideoRecording::SetZoomValueL leaving KErrNotSupported, iZoomMode=%d", iZoomMode );
+ User::Leave( KErrNotSupported );
+ break;
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetZoomValueL");
+ }
+
+
+TInt CEngineVideoRecording::ZoomValue() const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::ZoomValue");
+
+ TInt zoomValue( 0 );
+ if ( iPowerOn )
+ {
+ switch ( iZoomMode )
+ {
+ case EZoomModeDigital:
+ zoomValue = iCamera->DigitalZoomFactor();
+ break;
+ case EZoomModeOptical:
+ zoomValue = iCamera->ZoomFactor();
+ break;
+ default:
+ // EZoomModeOpticalDigital not supported
+ break;
+ }
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::ZoomValue");
+ return zoomValue;
+ }
+
+TInt CEngineVideoRecording::MaxZoomValue() const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::MaxZoomValue");
+
+ TInt zoomValue( 0 );
+ if ( iPowerOn )
+ {
+ switch ( iZoomMode )
+ {
+ case EZoomModeDigital:
+ zoomValue = iInfo->iMaxDigitalZoom;
+ break;
+ case EZoomModeOptical:
+ zoomValue = iInfo->iMaxZoom;
+ break;
+ default:
+ // EZoomModeOpticalDigital not supported
+ break;
+ }
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::MaxZoomValue");
+ return zoomValue;
+ }
+
+TInt CEngineVideoRecording::MinZoomValue() const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::MinZoomValue");
+
+ TInt zoomValue( 0 );
+ if ( iPowerOn )
+ {
+ switch ( iZoomMode )
+ {
+ case EZoomModeDigital:
+ zoomValue = 0;
+ break;
+ case EZoomModeOptical:
+ zoomValue = iInfo->iMinZoom;
+ break;
+ default:
+ // EZoomModeOpticalDigital not supported
+ break;
+ }
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::MinZoomValue");
+ return zoomValue;
+ }
+void CEngineVideoRecording::SetBrightnessL(
+ TInt aBrightness )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::SetBrightnessL");
+ // Leave if not supported.
+ if ( !( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported ) )
+ {
+ HTI_LOG_FORMAT("CEngineVideoRecording::SetBrightnessL leaving KErrNotSupported, aBrightness=%d", aBrightness );
+ User::Leave( KErrNotSupported );
+ }
+
+ CheckPowerL();
+
+ iCamera->SetBrightnessL( aBrightness );
+ iBrightness = aBrightness;
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetBrightnessL");
+ }
+
+
+TInt CEngineVideoRecording::Brightness() const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::Brightness");
+
+ TInt brightness( 0 );
+ if ( iPowerOn && ( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported ) )
+ {
+ brightness = iCamera->Brightness();
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::Brightness");
+ return brightness;
+ }
+
+
+void CEngineVideoRecording::SetContrastL(
+ TInt aContrast )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::SetContrastL");
+
+ // Leave if not supported.
+ if ( !( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported ) )
+ {
+ HTI_LOG_FORMAT("CEngineVideoRecording::SetContrastL leaving KErrNotSupported, aContrast=%d", aContrast );
+ User::Leave( KErrNotSupported );
+ }
+
+ CheckPowerL();
+
+ iCamera->SetContrastL( aContrast );
+ iContrast = aContrast;
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetContrastL");
+ }
+
+
+TInt CEngineVideoRecording::Contrast() const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::Contrast");
+ TInt contrast( 0 );
+ if ( iPowerOn && ( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported ) )
+ {
+ contrast = iCamera->Contrast();
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::Contrast");
+ return contrast;
+ }
+
+
+void CEngineVideoRecording::SetExposureModeL(
+ CCamera::TExposure aExposureMode )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::SetExposureModeL");
+
+ // Leave is requested exposure mode is not supported,
+ // EExposureAuto should be always supported.
+ if ( ( ( aExposureMode != CCamera::EExposureAuto ) &&
+ !( aExposureMode & iInfo->iExposureModesSupported ) ) ||
+ ( aExposureMode < 0 ) )
+ {
+ HTI_LOG_FORMAT("CEngineVideoRecording::SetExposureModeL leaving KErrNotSupported, aExposureMode=%d", aExposureMode );
+ User::Leave( KErrNotSupported );
+ }
+
+ CheckPowerL();
+
+ iCamera->SetExposureL( aExposureMode );
+ iExposureMode = aExposureMode;
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetExposureModeL");
+ }
+
+
+CCamera::TExposure CEngineVideoRecording::ExposureMode() const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::ExposureMode");
+
+ CCamera::TExposure exposureMode( CCamera::EExposureAuto );
+ if ( iPowerOn )
+ {
+ exposureMode = iCamera->Exposure();
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::ExposureMode");
+ return exposureMode;
+ }
+
+
+void CEngineVideoRecording::SetWhiteBalanceModeL(
+ CCamera::TWhiteBalance aWhiteBalanceMode )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::SetWhiteBalanceModeL");
+
+ // Leave is requested WB mode is not supported.
+ // EWBAuto is always supported.
+ if ( ( ( aWhiteBalanceMode != CCamera::EWBAuto ) &&
+ !( aWhiteBalanceMode & iInfo->iWhiteBalanceModesSupported ) ) ||
+ ( aWhiteBalanceMode < 0 ) )
+ {
+ HTI_LOG_FORMAT("CEngineVideoRecording::SetWhiteBalanceModeL leaving KErrNotSupported, aWhiteBalanceMode=%d", aWhiteBalanceMode );
+ User::Leave( KErrNotSupported );
+ }
+
+ CheckPowerL();
+
+ iCamera->SetWhiteBalanceL( aWhiteBalanceMode );
+ iWhiteBalanceMode = aWhiteBalanceMode;
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetWhiteBalanceModeL");
+ }
+
+
+CCamera::TWhiteBalance CEngineVideoRecording::WhiteBalanceMode() const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::WhiteBalanceMode");
+
+ CCamera::TWhiteBalance whiteBalanceMode( CCamera::EWBAuto );
+ if ( iPowerOn )
+ {
+ whiteBalanceMode = iCamera->WhiteBalance();
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::WhiteBalanceMode");
+ return whiteBalanceMode;
+ }
+
+
+void CEngineVideoRecording::SetFlashModeL(
+ CCamera::TFlash aFlashMode )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::SetFlashModeL");
+
+ // Leave is requested flash mode is not supported.
+ // EFlashNone is always supported.
+ if ( ( ( aFlashMode != CCamera::EFlashNone ) &&
+ !( aFlashMode & iInfo->iFlashModesSupported ) ) ||
+ ( aFlashMode < 0 ) )
+ {
+ HTI_LOG_FORMAT("CEngineVideoRecording::SetFlashModeL leaving KErrNotSupported, aFlashMode=%d", aFlashMode );
+ User::Leave( KErrNotSupported );
+ }
+
+ CheckPowerL();
+
+ iCamera->SetFlashL( aFlashMode );
+ iFlashMode = aFlashMode;
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetFlashModeL");
+ }
+
+
+CCamera::TFlash CEngineVideoRecording::FlashMode() const
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::FlashMode");
+
+ CCamera::TFlash flashMode( CCamera::EFlashNone );
+ if ( iPowerOn )
+ {
+ flashMode = iCamera->Flash();
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::FlashMode");
+ return flashMode;
+ }
+
+
+void CEngineVideoRecording::ResetToDefaultsL()
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::ResetToDefaultsL");
+
+ SetExposureModeL();
+ SetWhiteBalanceModeL();
+ SetZoomModeL();
+ SetZoomValueL();
+ SetFlashModeL();
+
+ // Reset this setting only if it is supported by Camera API.
+ if ( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported )
+ {
+ SetBrightnessL();
+ }
+
+ // Reset this setting only if it is supported by Camera API.
+ if ( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported )
+ {
+ SetContrastL();
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::ResetToDefaultsL");
+ }
+
+void CEngineVideoRecording::CheckPowerL()
+ {
+ if ( !iPowerOn )
+ {
+ HTI_LOG_TEXT("CEngineVideoRecording::CheckPowerL() leaving KErrNotReady (iPowerOn)");
+ User::Leave( KErrNotReady );
+ }
+ }
+
+void CEngineVideoRecording::MvruoOpenComplete(TInt aError)
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::MvruoOpenComplete");
+
+ HTI_LOG_FORMAT("aError = %d", aError);
+ if ( aError == KErrNone )
+ {
+ // To get default video audio bit rate.
+ TRAP( aError, { iVideoAudioBitRate = iVideoRecorder->AudioBitRateL(); } );
+ // (ignore possible error)
+ // Prepare settings only if no errors in opening.
+ TRAP( aError, PrepareVideoSettingsL() );
+ if ( aError != KErrNone )
+ {
+ iVideoRecordingObserver->MevroVideoPrepareComplete( aError );
+ }
+ }
+ else
+ {
+ iVideoRecordingObserver->MevroVideoPrepareComplete( aError );
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::MvruoOpenComplete");
+ }
+
+void CEngineVideoRecording::MvruoPrepareComplete(TInt aError)
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::MvruoPrepareComplete");
+
+ HTI_LOG_FORMAT("aError = %d", aError);
+ if ( iVideoOpened && ( aError == KErrNone ) )
+ {
+ iVideoPrepared = ETrue; // Later errors with settings after
+ // do not change the value.
+ }
+
+ if ( iPrepPars )
+ {
+ iPrepPars = EFalse;
+ // If no error, then fresh parameters are valid.
+ // Otherwise, old parameters are kept.
+ if ( aError == KErrNone )
+ {
+ *iVideoFrameSize = *iVideoFrameSizePrep;
+ iVideoFrameRate = iVideoFrameRatePrep;
+ iVideoBitRate = iVideoBitRatePrep;
+ iVideoAudioEnabled = iVideoAudioEnabledPrep;
+ iVideoAudioBitRate = iVideoAudioBitRatePrep;
+ iMaxClipSizeInBytes = iMaxClipSizeInBytesPrep;
+ }
+ else
+ {
+ *iVideoFrameSizePrep = *iVideoFrameSize;
+ iVideoFrameRatePrep = iVideoFrameRate;
+ iVideoBitRatePrep = iVideoBitRate;
+ iVideoAudioEnabledPrep = iVideoAudioEnabled;
+ iVideoAudioBitRatePrep = iVideoAudioBitRate;
+ iMaxClipSizeInBytesPrep = iMaxClipSizeInBytes;
+ }
+ }
+
+ iVideoRecordingObserver->MevroVideoPrepareComplete( aError );
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::MvruoPrepareComplete");
+ }
+
+void CEngineVideoRecording::MvruoRecordComplete(TInt aError)
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::MvruoRecordComplete");
+
+ HTI_LOG_FORMAT("aError = %d", aError);
+
+ // Recording stopped: can't be paused anymore.
+ iVideoRecordingPaused = EFalse;
+
+ if ( iVideoRecordingRunning) // To ensure that McaeoVideoRecordingComplete
+ { // gets called just once per recording.
+ iVideoRecordingRunning = EFalse;
+
+ // Close video recording always in error case. Otherwise the camcorder plugin would
+ // be in indeterminated state.
+ // The code KErrCompletion means that video reocording has been completed by timer
+ if ( aError && aError != KErrCompletion && aError != KErrDiskFull )
+ {
+ CloseVideoRecording();
+ }
+
+ iVideoRecordingObserver->MevroVideoRecordingComplete( aError );
+ }
+
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::MvruoRecordComplete");
+ }
+
+void CEngineVideoRecording::MvruoEvent(const TMMFEvent& /*aEvent*/)
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::MvruoEvent");
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::MvruoEvent");
+ }
+
+void CEngineVideoRecording::ReserveComplete(
+ TInt aError )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::ReserveComplete");
+
+ if ( aError == KErrNone )
+ {
+ iReserved = ETrue;
+ PowerOn();
+ }
+ else
+ {
+ iVideoRecordingObserver->MevroInitComplete( aError );
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::ReserveComplete");
+ }
+
+
+void CEngineVideoRecording::PowerOnComplete(
+ TInt aError )
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::PowerOnComplete");
+
+ if ( aError == KErrNone )
+ {
+ iPowerOn = ETrue;
+ }
+
+ iVideoRecordingObserver->MevroInitComplete( aError );
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::PowerOnComplete");
+ }
+
+void CEngineVideoRecording::HandleEvent( const TECAMEvent& aEvent)
+ {
+ HTI_LOG_FUNC_IN("CEngineVideoRecording::HandleEvent");
+ if (aEvent.iEventType == KUidECamEventCameraNoLongerReserved)
+ {
+ HTI_LOG_TEXT("CEngineVideoRecording::HandleEvent() KUidECamEventCameraNoLongerReserved");
+ iPowerOn = EFalse;
+ iReserved = EFalse;
+ iVideoPrepared = EFalse;
+ iVideoOpened = EFalse;
+ iVideoRecordingObserver->MevroInitComplete(KErrInUse); // Tell the client that other application has taken the camera
+ }
+ else if (aEvent.iEventType == KUidECamEventPowerOnComplete)
+ {
+ HTI_LOG_TEXT("CEngineVideoRecording::HandleEvent() KUidECamEventPowerOnComplete");
+ PowerOnComplete(aEvent.iErrorCode);
+ }
+ else if (aEvent.iEventType == KUidECamEventReserveComplete)
+ {
+ HTI_LOG_TEXT("CEngineVideoRecording::HandleEvent() KUidECamEventReserveComplete");
+ ReserveComplete(aEvent.iErrorCode);
+ }
+
+ HTI_LOG_FUNC_OUT("CEngineVideoRecording::HandleEvent");
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/engine/src/VideoRecordingQualityLevels.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Engine video quality level and container.
+*
+*/
+
+
+#include <e32std.h>
+#include <e32base.h>
+
+
+#include "VideoRecordingQualityLevels.h"
+
+
+// CONSTANTS
+const TInt KQualityLevelArrayGranularity = 3;
+
+CVideoRecordingQualityLevels::CVideoRecordingQualityLevels()
+ {
+ // TODO Auto-generated constructor stub
+
+ }
+
+CVideoRecordingQualityLevels::~CVideoRecordingQualityLevels()
+ {
+ delete iQualityLevels;
+ }
+
+void CVideoRecordingQualityLevels::ConstructL()
+ {
+
+ iQualityLevels = new( ELeave ) CArrayFixFlat<CVideoRecordingQualityLevel>( KQualityLevelArrayGranularity );
+
+ }
+
+CVideoRecordingQualityLevels* CVideoRecordingQualityLevels::NewL()
+ {
+
+ CVideoRecordingQualityLevels* self = new( ELeave ) CVideoRecordingQualityLevels;
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+
+
+ return self;
+ }
+
+TInt CVideoRecordingQualityLevels::InitDefaultsL()
+ {
+
+ // Delete all elements from the array and
+ // free the memory allocated to the array buffer.
+ iQualityLevels->Reset();
+
+ // Initialize hardcoded default quality levels.
+
+ TSize size;
+
+ CVideoRecordingQualityLevel* videoQualityLevel = new( ELeave ) CVideoRecordingQualityLevel;
+ CleanupStack::PushL( videoQualityLevel );
+
+ // Level 0:
+ size.SetSize( KImgWidthQCIF, KImgHeightQCIF );
+ videoQualityLevel->iFrameSize = size;
+ videoQualityLevel->iFrameRate = 15.0; // Frames per second. Basically HW dependent.
+ videoQualityLevel->iBitRate = 64000; // Bits per second. Basically HW dependent.
+ videoQualityLevel->iAudioEnabled = EFalse;
+ videoQualityLevel->iAudioBitRate = 12200; // Bits per second. Basically HW dependent.
+ videoQualityLevel->iMimeType.Copy( KVideoMimeType );
+ videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
+ videoQualityLevel->iVideoType.Copy( KVideoType );
+ videoQualityLevel->iAudioType.Copy( KAudioType );
+ videoQualityLevel->iStorageRate = 78000; // That many bits per second to store. Estimate only
+
+ iQualityLevels->AppendL( *videoQualityLevel );
+
+ // Level 1:
+ size.SetSize( KImgWidthSubQCIF, KImgHeightSubQCIF );
+ videoQualityLevel->iFrameSize = size;
+ videoQualityLevel->iFrameRate = 15.0; // Frames per second. Basically HW dependent.
+ videoQualityLevel->iBitRate = 60000; // Bits per second. Basically HW dependent.
+ videoQualityLevel->iAudioEnabled = EFalse;
+ videoQualityLevel->iAudioBitRate = 6700; // Bits per second. Basically HW dependent.
+ videoQualityLevel->iMimeType.Copy( KVideoMimeType );
+ videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
+ videoQualityLevel->iVideoType.Copy( KVideoType );
+ videoQualityLevel->iAudioType.Copy( KAudioType );
+ videoQualityLevel->iStorageRate = 68000; // That many bits per second to store. Estimate only
+
+ iQualityLevels->AppendL( *videoQualityLevel );
+
+ // Level 2:
+ size.SetSize( KImgWidthSubQCIF, KImgHeightSubQCIF );
+ videoQualityLevel->iFrameSize = size;
+ videoQualityLevel->iFrameRate = 5.0; // Frames per second. Basically HW dependent.
+ videoQualityLevel->iBitRate = 40000; // Bits per second. Basically HW dependent.
+ videoQualityLevel->iAudioEnabled = EFalse;
+ videoQualityLevel->iAudioBitRate = 5150; // Bits per second. Basically HW dependent.
+ videoQualityLevel->iMimeType.Copy( KVideoMimeType );
+ videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
+ videoQualityLevel->iVideoType.Copy( KVideoType );
+ videoQualityLevel->iAudioType.Copy( KAudioType );
+ videoQualityLevel->iStorageRate = 47000; // That many bits per second to store. Estimate only
+
+ iQualityLevels->AppendL( *videoQualityLevel );
+
+ CleanupStack::PopAndDestroy( videoQualityLevel );
+
+
+ return iQualityLevels->Count();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::Count
+// -----------------------------------------------------------------------------
+//
+TInt CVideoRecordingQualityLevels::Count() const
+ {
+ return iQualityLevels->Count();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::At
+// -----------------------------------------------------------------------------
+//
+CVideoRecordingQualityLevel& CVideoRecordingQualityLevels::At(
+ TInt aIndex ) const
+ {
+ return iQualityLevels->At( aIndex );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/group/HtiCameraServicePlugin.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HTI service plugin for controlling audio playback.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET HtiCameraServicePlugin.dll
+TARGETTYPE PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x2002EA9D
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
+
+SOURCEPATH ../src
+SOURCE proxy.cpp
+SOURCE HtiCameraServicePlugin.cpp
+
+SOURCE ../engine/src/EngineVideoRecording.cpp
+SOURCE ../engine/src/VideoRecordingQualityLevels.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../engine/inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE ../data/2002EA9D.rss
+TARGET HtiCameraServicePlugin.rsc
+END
+
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+LIBRARY flogger.lib
+LIBRARY mediaclientvideo.lib
+LIBRARY MMFControllerFramework.lib
+LIBRARY ECAM.lib
+SMPSAFE
+
+// End of file
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for HtiAudioServicePlugin
+*
+*/
+
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiCameraServicePlugin.mmp
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/inc/HtiCameraServicePlugin.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,204 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Defines the ECom plugin for HTI camera service.
+*
+*/
+
+
+
+#ifndef HTICAMERASERVICEPLUGIN_H
+#define HTICAMERASERVICEPLUGIN_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include "EngineVideoRecording.h"
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CEngineVideoRecording;
+class MEngineVideoRecordingObserver;
+
+// CLASS DECLARATION
+
+/**
+* The ECom plugin for HTI camera service.
+*
+*/
+class CHtiCameraServicePlugin : public CHTIServicePluginInterface,
+ public MEngineVideoRecordingObserver
+ {
+
+ protected:
+ // commands
+ enum TCommands
+ {
+ ECmdInitialize = 0x01,
+ ECmdPrepareVideoRecording = 0x02,
+ ECmdStartVideoRecording = 0x05,
+ ECmdPausingVideoRecording = 0x06,
+ ECmdResumeVideoRecording = 0x07,
+ ECmdStopVideoRecording = 0x08,
+ ECmdCloseVideoRecording = 0x09,
+ ECmdGetZoom = 0x0a,
+ ECmdSetZoom = 0x0b,
+
+ ECmdUninitialize = 0x51,
+ EResultOk = 0xFF // only for response message
+ };
+
+
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CHtiCameraServicePlugin* NewL();
+
+ public: // New functions
+
+ public:
+ // Functions from base classes
+
+ /**
+ * From CHTIServicePluginInterface
+ * Called by the HTI Framework when sending message to this service.
+ * @param aMessage message body destinated to a servive
+ * @param aPriority message priority
+ */
+ void ProcessMessageL(const TDesC8& aMessage,
+ THtiMessagePriority aPriority);
+
+ /**
+ * From CHTIServicePluginInterface
+ * Indicates to HTI Framework whether the plugin is ready to process
+ * a new message or if it's busy processing previous message.
+ */
+ TBool IsBusy();
+
+
+ protected: // New functions
+
+ /**
+ * C++ default constructor.
+ */
+ CHtiCameraServicePlugin();
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CHtiCameraServicePlugin();
+
+ protected:
+ // Functions from base classes
+
+ /**
+ * From MEngineVideoRecordingObserver
+ * Called asynchronously when CEngineVideoRecording::Init(), CCaeEngine::CEngineVideoRecording(),
+ * or CEngineVideoRecording::Reserve() completes.
+ * Indicates if Video Recording Engine is ready for operation,
+ * the camera is reserved and its power is switched on.
+ * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+ * @return void
+ */
+ virtual void MevroInitComplete( TInt aError );
+
+ /**
+ * From MEngineVideoRecordingObserver
+ * Called asynchronously when preparing of video recording completes
+ * after PrepareVideoRecordingL() has been called.
+ * May be called second time with an error code after a successful preparation
+ * if video recording loses its prepared state for some reason (e.g. audio HW
+ * is reserved for some other application).
+ * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+ * @return void
+ */
+ virtual void MevroVideoPrepareComplete(TInt aError);
+
+ /**
+ * From MEngineVideoRecordingObserver
+ * Called (possibly asynchronously) when video recording is running
+ * after CEngineVideoRecording::StartVideoRecording() or
+ * CEngineVideoRecording::ResumeVideoRecording() has been called.
+ * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+ * @return void
+ */
+ virtual void MevroVideoRecordingOn(TInt aError);
+
+ /**
+ * From MEngineVideoRecordingObserver
+ * Called (possibly asynchronously) when video recording is paused after
+ * CEngineVideoRecording::PauseVideoRecording() has been called.
+ * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+ * @return void
+ */
+ virtual void MevroVideoRecordingPaused(TInt aError);
+
+ /**
+ * From MEngineVideoRecordingObserver
+ * Called (possibly asynchronously) when video recording is completed
+ * after CEngineVideoRecording::StopVideoRecording() has been called or
+ * recording has been completed for some other reason.
+ * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+ * if aError == KErrDiskFull, then disk storage is full.
+ * if aError == KErrCompletion, then clip max size was reached.
+ * @return void
+ */
+ virtual void MevroVideoRecordingComplete(TInt aError);
+
+ private:
+ void HandleInitializeCmdL(const TDesC8& aData);
+ void HandleUninitializeCmdL(const TDesC8& aData);
+ void HandlePrepareVideoRecordingCmdL(const TDesC8& aData);
+ void HandleStartVideoRecordingCmdL( const TDesC8& aData );
+ void HandlePausingVideoRecordingCmdL( const TDesC8& aData );
+ void HandleResumeVideoRecordingCmdL( const TDesC8& aData );
+ void HandleStopVideoRecordingCmdL( const TDesC8& aData );
+ void HandleCloseVideoRecordingCmdL( const TDesC8& aData );
+ void HandleGetZoomCmdL( const TDesC8& aData );
+ void HandleSetZoomCmdL( const TDesC8& aData );
+
+ void SendOkMsgL( const TDesC8& aData );
+ void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+ TInt ParseString( const TDesC8& aRequest,
+ TInt aOffset, TDes& aResult );
+
+ public: // Data
+
+ protected: // Data
+
+ private: // Data
+ // Flag telling if the service is busy processing a message
+ TBool iIsBusy;
+
+ TInt iError;
+ CEngineVideoRecording* iVideoRecordingEngine;
+ CActiveSchedulerWait* iWaiter;
+
+ };
+
+#endif // HTICAMERASERVICEPLUGIN_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/src/HtiCameraServicePlugin.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,637 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implements the ECom plugin for HTI camera
+* service.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+
+#include "HtiCameraServicePlugin.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+const static TUid KCameraServiceUid = { 0x2002EA9E };
+
+
+
+// NOTE: Max length for error description is defined
+// in HtiDispatcherInterface.h (currently 118).
+
+_LIT8( KErrorNoCommand, "ERROR: No command given" );
+_LIT8( KErrorUnknownCmd, "ERROR: Unknown Camera Service command" );
+_LIT8( KErrorInitFailed, "ERROR: Failed to init");
+_LIT8( KErrorUninitialized, "ERROR: Uninitialized");
+_LIT8( KErrInvalidateParameters, "ERROR: Invalidate parameters");
+_LIT8( KErrQualityLevel, "ERROR: Invalidate quality level");
+_LIT8( KErrorPrepareVideoRecordingFailed, "ERROR: Prepare video recording failed");
+_LIT8( KErrorStartVideoRecordingFailed, "ERROR: Start video recording failed");
+_LIT8( KErrorPausingVideoRecordingFailed, "ERROR: Pausing video recording failed");
+_LIT8( KErrorResumeVideoRecordingFailed, "ERROR: Resume video recording failed");
+_LIT8( KErrorStopVideoRecordingFailed, "ERROR: Stop video recording failed");
+_LIT8( KErrorSetZoomModeFailed, "ERROR: Set zoom mode failed");
+_LIT8( KErrorSetZoomValueFailed, "ERROR: Set zoom value failed");
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::CHtiCameraServicePlugin
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CHtiCameraServicePlugin::CHtiCameraServicePlugin():iIsBusy(EFalse), iError(0),
+ iVideoRecordingEngine(NULL), iWaiter(NULL)
+ {
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CHtiCameraServicePlugin::ConstructL()
+ {
+ HTI_LOG_TEXT( "CHtiCameraServicePlugin::ConstructL" );
+ iWaiter = new ( ELeave ) CActiveSchedulerWait;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CHtiCameraServicePlugin* CHtiCameraServicePlugin::NewL()
+ {
+ CHtiCameraServicePlugin* self = new (ELeave) CHtiCameraServicePlugin;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+// Destructor
+CHtiCameraServicePlugin::~CHtiCameraServicePlugin()
+ {
+ if(iVideoRecordingEngine)
+ {
+ delete iVideoRecordingEngine;
+ iVideoRecordingEngine = NULL;
+ }
+
+ delete iWaiter;
+ iWaiter = NULL;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::ProcessMessageL
+// -----------------------------------------------------------------------------
+//
+void CHtiCameraServicePlugin::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/ )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::ProcessMessageL" );
+ HTI_LOG_FORMAT( "Message length = %d", aMessage.Length() );
+
+ if ( iIsBusy )
+ {
+ HTI_LOG_TEXT( "Plugin is busy - leaving" );
+ User::Leave( KErrInUse );
+ }
+
+ // Will be set to EFalse in the SendResponseMsg or SendErrorResponseMsg
+ // methods when the response has been successfully sent and the plugin is
+ // ready for next message.
+ iIsBusy = ETrue;
+
+ if ( aMessage.Length() < 1 )
+ {
+ SendErrorMessageL( KErrArgument, KErrorNoCommand );
+ return;
+ }
+
+ TUint8 command = aMessage.Ptr()[0];
+ TInt err = KErrNone;
+
+ switch (command)
+ {
+ case ECmdInitialize:
+ TRAP(err, HandleInitializeCmdL(aMessage.Right( aMessage.Length() - 1 )));
+ break;
+ case ECmdUninitialize:
+ TRAP(err, HandleUninitializeCmdL(aMessage.Right( aMessage.Length() - 1 )));
+ break;
+ case ECmdPrepareVideoRecording:
+ TRAP(err, HandlePrepareVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+ break;
+ case ECmdStartVideoRecording:
+ TRAP(err, HandleStartVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+ break;
+ case ECmdPausingVideoRecording:
+ TRAP(err, HandlePausingVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+ break;
+ case ECmdResumeVideoRecording:
+ TRAP(err, HandleResumeVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+ break;
+ case ECmdStopVideoRecording:
+ TRAP(err, HandleStopVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+ break;
+ case ECmdCloseVideoRecording:
+ TRAP(err, HandleCloseVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+ break;
+ case ECmdGetZoom:
+ TRAP(err, HandleGetZoomCmdL(aMessage.Right( aMessage.Length() - 1 )));
+ break;
+ case ECmdSetZoom:
+ TRAP(err, HandleSetZoomCmdL(aMessage.Right( aMessage.Length() - 1 )));
+ break;
+ default:
+ TRAP(err, SendErrorMessageL(KErrArgument, KErrorUnknownCmd));
+ break;
+ }
+
+ if(err != KErrNone)
+ {
+ iIsBusy = EFalse;
+ User::Leave( err );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::ProcessMessageL" );
+ }
+
+void CHtiCameraServicePlugin::HandleInitializeCmdL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleInitializeCmdL" );
+ if(aData.Length() != 0)
+ {
+ SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+ return;
+ }
+
+ HTI_LOG_TEXT("Initializes Camera Application Engine");
+ if(iVideoRecordingEngine)
+ {
+ delete iVideoRecordingEngine;
+ iVideoRecordingEngine = NULL;
+ }
+
+ iVideoRecordingEngine = CEngineVideoRecording::NewL(*this, 0);
+ iVideoRecordingEngine->InitL();
+ iWaiter->Start();
+ if(iError != KErrNone)
+ {
+ SendErrorMessageL(iError, KErrorInitFailed);
+ }
+ else
+ {
+ HTI_LOG_TEXT("Initializes video recording");
+ iVideoRecordingEngine->InitVideoRecorderL();
+
+ SendOkMsgL(KNullDesC8);
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleInitializeCmdL" );
+ }
+
+void CHtiCameraServicePlugin::HandleUninitializeCmdL(const TDesC8& aData)
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleUninitializeCmdL" );
+ if(aData.Length() != 0)
+ {
+ SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+ return;
+ }
+
+ if(iVideoRecordingEngine == NULL)
+ {
+ SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+ return;
+ }
+
+ delete iVideoRecordingEngine;
+ iVideoRecordingEngine = NULL;
+
+ SendOkMsgL(KNullDesC8);
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleUninitializeCmdL" );
+ }
+
+void CHtiCameraServicePlugin::HandlePrepareVideoRecordingCmdL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandlePrepareVideoRecordingCmdL" );
+ if(aData.Length() < 2 || aData[1] != aData.Length() -2)
+ {
+ SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+ return;
+ }
+
+ if(iVideoRecordingEngine == NULL)
+ {
+ SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+ return;
+ }
+
+ TInt qualityLevelIndex = aData[0];
+ if(qualityLevelIndex < 0 || qualityLevelIndex > iVideoRecordingEngine->VideoQualityCount() -1)
+ {
+ SendErrorMessageL(KErrOverflow, KErrQualityLevel);
+ return;
+ }
+
+ TBuf<255> filePath;
+ TInt nextOffset = ParseString( aData, 1, filePath );
+ if ( filePath.Length() < 1 || nextOffset < 0 )
+ {
+ SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+ return;
+ }
+
+ HTI_LOG_FORMAT("Set video recording file name: %S", &filePath);
+ iVideoRecordingEngine->SetVideoRecordingFileNameL(filePath);
+
+ HTI_LOG_FORMAT("Prepare video recording with quality level index: %d", qualityLevelIndex);
+ iVideoRecordingEngine->PrepareVideoRecordingL(qualityLevelIndex);
+
+ iWaiter->Start();
+ if(iError != KErrNone)
+ {
+ SendErrorMessageL(iError, KErrorPrepareVideoRecordingFailed);
+ }
+ else
+ {
+ SendOkMsgL(KNullDesC8);
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandlePrepareVideoRecordingCmdL" );
+ }
+
+void CHtiCameraServicePlugin::HandleStartVideoRecordingCmdL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleStartVideoRecordingCmdL" );
+ if(aData.Length() != 0)
+ {
+ SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+ return;
+ }
+
+ if(iVideoRecordingEngine == NULL)
+ {
+ SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+ return;
+ }
+
+ HTI_LOG_TEXT("Start video recording...");
+ iVideoRecordingEngine->StartVideoRecording();
+
+ if(iError != KErrNone)
+ {
+ SendErrorMessageL(iError, KErrorStartVideoRecordingFailed);
+ }
+ else
+ {
+ SendOkMsgL(KNullDesC8);
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleStartVideoRecordingCmdL" );
+ }
+
+void CHtiCameraServicePlugin::HandlePausingVideoRecordingCmdL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandlePausingVideoRecordingCmdL" );
+ if(aData.Length() != 0)
+ {
+ SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+ return;
+ }
+
+ if(iVideoRecordingEngine == NULL)
+ {
+ SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+ return;
+ }
+
+ HTI_LOG_TEXT("Pausing video recording");
+ iVideoRecordingEngine->PauseVideoRecording();
+ if(iError != KErrNone)
+ {
+ SendErrorMessageL(iError, KErrorPausingVideoRecordingFailed);
+ }
+ else
+ {
+ SendOkMsgL(KNullDesC8);
+ }
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandlePausingVideoRecordingCmdL" );
+ }
+
+void CHtiCameraServicePlugin::HandleResumeVideoRecordingCmdL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleResumeVideoRecordingCmdL" );
+ if(aData.Length() != 0)
+ {
+ SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+ return;
+ }
+
+ if(iVideoRecordingEngine == NULL)
+ {
+ SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+ return;
+ }
+
+ HTI_LOG_TEXT("Resume video recording...");
+ iVideoRecordingEngine->ResumeVideoRecording();
+
+ if(iError != KErrNone)
+ {
+ SendErrorMessageL(iError, KErrorResumeVideoRecordingFailed);
+ }
+ else
+ {
+ SendOkMsgL(KNullDesC8);
+ }
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleResumeVideoRecordingCmdL" );
+ }
+
+void CHtiCameraServicePlugin::HandleStopVideoRecordingCmdL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleStopVideoRecordingCmdL" );
+ if(aData.Length() != 0)
+ {
+ SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+ return;
+ }
+
+ if(iVideoRecordingEngine == NULL)
+ {
+ SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+ return;
+ }
+
+ HTI_LOG_TEXT("Stop video recording");
+ iVideoRecordingEngine->StopVideoRecording();
+ if(iError != KErrNone)
+ {
+ SendErrorMessageL(iError, KErrorStopVideoRecordingFailed);
+ }
+ else
+ {
+ SendOkMsgL(KNullDesC8);
+ }
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleStopVideoRecordingCmdL" );
+ }
+
+void CHtiCameraServicePlugin::HandleCloseVideoRecordingCmdL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleCloseVideoRecordingCmdL" );
+ if(aData.Length() != 0)
+ {
+ SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+ return;
+ }
+
+ if(iVideoRecordingEngine == NULL)
+ {
+ SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+ return;
+ }
+
+ HTI_LOG_TEXT("Close video recording");
+ iVideoRecordingEngine->CloseVideoRecording();
+ SendOkMsgL(KNullDesC8);
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleCloseVideoRecordingCmdL" );
+ }
+
+void CHtiCameraServicePlugin::HandleGetZoomCmdL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleGetZoomCmdL" );
+ if(aData.Length() != 0)
+ {
+ SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+ return;
+ }
+
+ if(iVideoRecordingEngine == NULL)
+ {
+ SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+ return;
+ }
+
+ TUint8 zoomMode = (TUint8)iVideoRecordingEngine->ZoomMode();
+ HTI_LOG_FORMAT("Current zoom mode: %d", zoomMode);
+
+ TUint32 zoomValue = iVideoRecordingEngine->ZoomValue();
+ HTI_LOG_FORMAT("Current zoom value: %d", zoomValue);
+
+ TUint32 zoomMinValue = iVideoRecordingEngine->MinZoomValue();
+ HTI_LOG_FORMAT("Min zoom value: %d", zoomMinValue);
+
+ TUint32 zoomMaxValue = iVideoRecordingEngine->MaxZoomValue();
+ HTI_LOG_FORMAT("Max zoom value: %d", zoomMaxValue);
+
+ TBuf8<13> buf;
+ buf.Append(zoomMode);
+ buf.Append((TUint8*)&zoomValue, 4);
+ buf.Append((TUint8*)&zoomMinValue, 4);
+ buf.Append((TUint8*)&zoomMaxValue, 4);
+ SendOkMsgL( buf );
+
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleGetZoomCmdL" );
+ }
+
+void CHtiCameraServicePlugin::HandleSetZoomCmdL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleSetZoomCmdL" );
+ if(aData.Length() != 5)
+ {
+ SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+ return;
+ }
+
+ if(iVideoRecordingEngine == NULL)
+ {
+ SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+ return;
+ }
+
+ CEngineVideoRecording::TZoomMode zoomMode = (CEngineVideoRecording::TZoomMode)aData[0];
+ HTI_LOG_FORMAT("Set zoom mode: %d", zoomMode);
+ TRAPD(err, iVideoRecordingEngine->SetZoomModeL(zoomMode));
+ if(err != KErrNone)
+ {
+ SendErrorMessageL(err, KErrorSetZoomModeFailed);
+ }
+ else
+ {
+ TInt value = aData[1] + ( aData[2] << 8 )
+ + ( aData[3] << 16 )
+ + ( aData[4] << 24 );
+ HTI_LOG_FORMAT("Set zoom value: %d", value);
+ TRAPD(err, iVideoRecordingEngine->SetZoomValueL(value));
+ if(err != KErrNone)
+ {
+ SendErrorMessageL(err, KErrorSetZoomValueFailed);
+ }
+ else
+ {
+ SendOkMsgL(KNullDesC8);
+ }
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleSetZoomCmdL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::IsBusy
+// -----------------------------------------------------------------------------
+//
+TBool CHtiCameraServicePlugin::IsBusy()
+ {
+ return iIsBusy;
+ }
+
+
+// ----------------------------------------------------------------------------
+void CHtiCameraServicePlugin::SendOkMsgL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::SendOkMsgL: Starting" );
+
+ User::LeaveIfNull( iDispatcher );
+
+ HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+ TPtr8 response = temp->Des();
+ response.Append( ( TChar ) EResultOk );
+ response.Append( aData );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+ temp, KCameraServiceUid ) );
+ iIsBusy = EFalse;
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::SendOkMsgL: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiCameraServicePlugin::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::SendErrorMessageL: Starting" );
+ User::LeaveIfNull( iDispatcher );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+ aError, aDescription, KCameraServiceUid ) );
+ iIsBusy = EFalse;
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::SendErrorMessageL: Done" );
+ }
+
+TInt CHtiCameraServicePlugin::ParseString( const TDesC8& aRequest,
+ TInt aOffset,
+ TDes& aResult )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::ParseString" );
+
+ // If offset outside the string return empty string
+ if ( aOffset >= aRequest.Size() )
+ {
+ return aOffset;
+ }
+
+ TInt length = aRequest[aOffset];
+ HTI_LOG_FORMAT( "String length = %d", length );
+
+ // If length is zero return empty string
+ if ( length < 1 )
+ {
+ return aOffset + 1;
+ }
+
+ if ( length > aResult.MaxLength() )
+ {
+ return KErrBadDescriptor;
+ }
+
+ TInt nextOffset = length + aOffset + 1;
+ HTI_LOG_FORMAT( "Next offset = %d", nextOffset );
+ HTI_LOG_FORMAT( "Request size = %d", aRequest.Size() );
+
+ if ( nextOffset > aRequest.Size() )
+ {
+ return KErrArgument;
+ }
+
+ aResult.Copy( aRequest.Mid( aOffset + 1, length ) );
+
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::ParseString" );
+ return nextOffset;
+ }
+
+void CHtiCameraServicePlugin::MevroInitComplete( TInt aError )
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroInitComplete" );
+ HTI_LOG_FORMAT("aError = %d", aError);
+ iError = aError;
+ iWaiter->AsyncStop();
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroInitComplete" );
+ }
+
+void CHtiCameraServicePlugin::MevroVideoPrepareComplete(TInt aError)
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoPrepareComplete" );
+ HTI_LOG_FORMAT("aError = %d", aError);
+ iError = aError;
+ iWaiter->AsyncStop();
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoPrepareComplete" );
+ }
+
+void CHtiCameraServicePlugin::MevroVideoRecordingOn(TInt aError)
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingOn" );
+ HTI_LOG_FORMAT("aError = %d", aError);
+ iError = aError;
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingOn" );
+ }
+
+void CHtiCameraServicePlugin::MevroVideoRecordingPaused(TInt aError)
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingPaused" );
+ HTI_LOG_FORMAT("aError = %d", aError);
+ iError = aError;
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingPaused" );
+ }
+
+void CHtiCameraServicePlugin::MevroVideoRecordingComplete(TInt aError)
+ {
+ HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingComplete" );
+ HTI_LOG_FORMAT("aError = %d", aError);
+ iError = aError;
+ HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingComplete" );
+ }
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/src/proxy.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation proxy for the ECom plugin.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+#include "HtiCameraServicePlugin.h"
+
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY( 0x2002EA9E, CHtiCameraServicePlugin::NewL )
+ };
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+ {
+ aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+ return ImplementationTable;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiFtpBackupFake/bwins/HtiFtpBackupFakeu.def Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?NewHtiFtpBackupFake@@YAPAVCHtiFtpBackupFake@@XZ @ 1 NONAME ; class CHtiFtpBackupFake * NewHtiFtpBackupFake(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiFtpBackupFake/eabi/HtiFtpBackupFakeu.def Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z19NewHtiFtpBackupFakev @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiFtpBackupFake/group/HtiFtpBackupFake.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build description file for HtiFtpBackupFake
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET HtiFtpBackupFake.dll
+TARGETTYPE DLL
+
+// HtiFtpBackupFakeInterface UID followed by the unique UID for this DLL
+UID 0x20022D5F 0x20022D60
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
+
+SOURCEPATH ../src
+SOURCE HtiFtpBackupFake.cpp
+
+USERINCLUDE ../inc
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/connect
+
+LIBRARY euser.lib
+LIBRARY efsrv.lib
+LIBRARY sbeclient.lib
+LIBRARY flogger.lib
+
+SMPSAFE
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiFtpBackupFake/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for HtiFtpBackupFake
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiFtpBackupFake.mmp
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiFtpBackupFake/inc/HtiFtpBackupFake.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Definition of the CHtiFtpBackupFake class.
+*
+*/
+
+
+#ifndef __HTIFTPBACKUPFAKE_H
+#define __HTIFTPBACKUPFAKE_H
+
+// INCLUDES
+#include <e32std.h>
+#include <f32file.h>
+#include <connect/sbeclient.h>
+#include <HtiFtpBackupFakeBase.h>
+
+using namespace conn;
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Definition of the class implementing the CHtiFtpBackupFakeBase
+*/
+NONSHARABLE_CLASS( CHtiFtpBackupFake ) : public CHtiFtpBackupFakeBase
+ {
+ public:
+ // constructor support
+ virtual void ConstructL( RFs* aFs );
+
+ // destructor
+ virtual ~CHtiFtpBackupFake();
+
+ public: // from CHtiFtpBackupFakeBase
+ virtual TInt ActivateBackup();
+ virtual TInt DeactivateBackup();
+
+ private:
+ CSBEClient* iSBEClient; // owned
+ };
+
+#endif // __HTIFTPBACKUPFAKE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiFtpBackupFake/src/HtiFtpBackupFake.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CHtiFtpBackupFake implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiFtpBackupFake.h"
+#include <HtiLogging.h>
+
+// CONSTANTS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiFtpBackupFake* NewHtiFtpBackupFake()
+// Function to construct the CHtiFtpBackupFakeBase derived object.
+// Exported at ordinal 1 and not a member of the class.
+// -----------------------------------------------------------------------------
+EXPORT_C CHtiFtpBackupFake* NewHtiFtpBackupFake()
+ {
+ return new ( ELeave ) CHtiFtpBackupFake();
+ }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiFtpBackupFake::ConstructL
+// -----------------------------------------------------------------------------
+void CHtiFtpBackupFake::ConstructL( RFs* aFs )
+ {
+ HTI_LOG_FUNC_IN( "CHtiFtpBackupFake::ConstructL" );
+ iFs = aFs;
+ iSBEClient = NULL;
+ HTI_LOG_FUNC_OUT( "CHtiFtpBackupFake::ConstructL" );
+ }
+
+// -----------------------------------------------------------------------------
+// CHtiFtpBackupFake::~CHtiFtpBackupFake()
+// -----------------------------------------------------------------------------
+CHtiFtpBackupFake::~CHtiFtpBackupFake()
+ {
+ HTI_LOG_FUNC_IN( "CHtiFtpBackupFake::~CHtiFtpBackupFake" );
+ if ( iSBEClient )
+ {
+ DeactivateBackup(); // will delete iSBEClient
+ }
+ delete iSBEClient; // just to be sure
+ iSBEClient = NULL;
+ iFs = NULL; // iFs is not owned
+ HTI_LOG_FUNC_OUT( "CHtiFtpBackupFake::~CHtiFtpBackupFake" );
+ }
+
+// -----------------------------------------------------------------------------
+// CHtiFtpBackupFake::ActivateBackup()
+// Activates the backup operation if isn't already active.
+// -----------------------------------------------------------------------------
+TInt CHtiFtpBackupFake::ActivateBackup()
+ {
+ HTI_LOG_FUNC_IN( "CHtiFtpBackupFake::ActivateBackup" );
+ TInt err = KErrNone;
+ if ( iSBEClient )
+ {
+ err = KErrAlreadyExists; // Backup already active
+ }
+ else
+ {
+ HTI_LOG_TEXT( "Activating backup" );
+ TDriveList drives;
+ err = iFs->DriveList( drives );
+ if ( !err )
+ {
+ TRAP( err, iSBEClient = CSBEClient::NewL() );
+ if ( !err )
+ {
+ TRAP( err, iSBEClient->SetBURModeL(
+ drives, EBURBackupFull, EBackupBase ) );
+ HTI_LOG_FORMAT( "CSBEClient::SetBURModeL returned %d", err );
+ if ( !err )
+ {
+ User::After( 1000000 ); // wait for the backup to activate
+ }
+ }
+ }
+ }
+ HTI_LOG_FUNC_OUT( "CHtiFtpBackupFake::ActivateBackup" );
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CHtiFtpBackupFake::DeactivateBackup()
+// Deactivates the backup operation if it's active.
+// -----------------------------------------------------------------------------
+TInt CHtiFtpBackupFake::DeactivateBackup()
+ {
+ HTI_LOG_FUNC_IN( "CHtiFtpBackupFake::DeactivateBackup" );
+ TInt err = KErrNone;
+
+ if ( !iSBEClient )
+ {
+ err = KErrNotReady; // Backup not active
+ }
+ else
+ {
+ HTI_LOG_TEXT( "Deactivating Backup" );
+ TDriveList drives;
+ err = iFs->DriveList( drives );
+ if ( !err )
+ {
+ TRAP( err, iSBEClient->SetBURModeL(
+ drives, EBURNormal, ENoBackup ) );
+ HTI_LOG_FORMAT( "CSBEClient::SetBURModeL returned %d", err );
+ }
+ delete iSBEClient;
+ iSBEClient = NULL;
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiFtpBackupFake::DeactivateBackup" );
+ return err;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/data/1020DEC0.rss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource definitions for key event service ECOM plugin.
+*
+*/
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+
+
+// RESOURCE DEFINITIONS
+RESOURCE REGISTRY_INFO theInfo
+ {
+ // UID for the DLL
+ dll_uid = 0x1020DEC0;
+ // Declare array of interface info
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // UID of interface that is implemented
+ interface_uid = 0x1020DEB7;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x1020DEC1;
+ version_no = 1;
+ display_name = "Key event service";
+ default_data = "KEYEVENT";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/group/HtiKeyEventServicePlugin.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECOM implementation of key event service
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET HtiKeyEventServicePlugin.dll
+TARGETTYPE PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x1020DEC0
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
+
+SOURCEPATH ../src
+SOURCE proxy.cpp
+SOURCE HtiKeyEventServicePlugin.cpp
+SOURCE KeyEventHandler.cpp
+SOURCE PointerEventHandler.cpp
+SOURCE MultiTouchPointerEventHandler.cpp MultiTouchPointerEvent.cpp
+
+USERINCLUDE ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE ../data/1020DEC0.rss
+TARGET HtiKeyEventServicePlugin.rsc
+END
+
+LIBRARY apgrfx.lib
+LIBRARY centralrepository.lib
+LIBRARY cenrepnotifhandler.lib
+LIBRARY ecom.lib
+LIBRARY euser.lib
+LIBRARY ws32.lib
+LIBRARY flogger.lib
+LIBRARY hal.lib
+
+SMPSAFE
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build info for HtiKeyEventServicePlugin
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiKeyEventServicePlugin.mmp
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/HtiKeyEventServicePlugin.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of ECOM plug-in service interface. Provides
+* key event service.
+*
+*/
+
+
+#ifndef CHTIKEYEVENTSERVICEPLUGIN_H
+#define CHTIKEYEVENTSERVICEPLUGIN_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include <w32std.h>
+#include <centralrepository.h>
+#include <cenrepnotifyhandler.h>
+
+
+// CONSTANTS
+const TInt KKeyEventServiceUidValue = 0x1020DEC1; // ECOM Implementation UID
+const TUid KKeyEventServiceUid = { KKeyEventServiceUidValue };
+
+// FORWARD DECLARATIONS
+class CKeyEventHandler;
+class CPointerEventHandler;
+
+// CLASS DECLARATION
+
+/**
+* Implementation of ECOM plug-in service interface.
+*/
+class CHtiKeyEventServicePlugin : public CHTIServicePluginInterface
+ ,public MCenRepNotifyHandlerCallback
+ {
+public:
+
+ static CHtiKeyEventServicePlugin* NewL();
+
+ // Interface implementation
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+protected:
+
+ CHtiKeyEventServicePlugin();
+ void ConstructL();
+
+ virtual ~CHtiKeyEventServicePlugin();
+
+ // from MCenRepNotifyHandlerCallback
+ void HandleNotifyInt( TUint32 aId, TInt aNewValue );
+ void HandleNotifyError( TUint32 aId, TInt error,
+ CCenRepNotifyHandler* aHandler );
+
+private:
+
+ CKeyEventHandler* iKeyHandler;
+ CPointerEventHandler* iPointerHandler;
+
+ TInt iLightTimeout;
+ CRepository* iCenRepSession;
+ CCenRepNotifyHandler* iLightTimeoutSettingHandler;
+ };
+
+#endif // CHTIKEYEVENTSERVICEPLUGIN_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/KeyEventHandler.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Functional implentation of key event service.
+*
+*/
+
+
+#ifndef CKEYEVENTHANDLER_H
+#define CKEYEVENTHANDLER_H
+
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include <w32std.h>
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+* Functional implentation of key event service.
+*/
+class CKeyEventHandler : public CActive
+ {
+public:
+
+ static CKeyEventHandler* NewL();
+
+ // Interface implementation
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+ virtual ~CKeyEventHandler();
+
+ void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+ enum TError
+ {
+ EMissingCommand = 0x01,
+ EUnrecognizedCommand = 0x02,
+ ENotReadyCommand = 0x03,
+ EInvalidScancode = 0x80,
+ EEmptyUnicodeCharArray = 0x90,
+ EInvalidUnicodeCharArray = 0x91
+ };
+
+ enum TCommand
+ {
+ EPressKey = 0x01,
+ EKeyDown = 0x02,
+ EKeyUp = 0x03,
+ ETypeText = 0x04,
+ ELongKeyPress = 0x05,
+ ETypeTextPassword = 0x06,
+ EPressKeySequence = 0x07,
+ EPointer = 0x10,
+ EResultOk = 0xFF // only for response message
+ };
+
+protected:
+
+ void RunL();
+ TInt RunError(TInt aError);
+ void DoCancel();
+
+private:
+
+ CKeyEventHandler();
+ void ConstructL();
+
+private: // helpers
+
+ void HandleTypeTextFuncL( const TDesC8& aUnicodeChars );
+ void HandleKeyboardFuncL( const TDesC8& aData );
+ void HandleLongKeyPressFuncL( const TDesC8& aData );
+ void HandlePressKeySequenceFuncL( const TDesC8& aData );
+
+ void SendOkMsgL();
+ void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+ void TypeTextWithDelay( TInt aNextIndex );
+ void SimulateKeyEventL( const TDesC8& aUnicodeChars, TInt aIndex );
+ void PressKeySequenceKeyL();
+
+ void KeyUp( TUint aCode );
+ void KeyDown( TUint aCode );
+
+private:
+
+ RWsSession iWsSession;
+ MHtiDispatcher* iDispatcher; // referenced
+
+ // Typetext specialities:
+ RTimer iTimer;
+ TInt iFocusedWindowGroup;
+ HBufC8* iUnicodeChars;
+ TInt iUnicodeCharIndex;
+
+ TBool iReady;
+ TUint8 iCommand;
+ TUint iHoldingScanCode;
+ TTimeIntervalMicroSeconds32 iKeySequenceHoldTime;
+ TTimeIntervalMicroSeconds32 iKeySequenceInterval;
+ TBool iHoldingKey;
+ };
+
+#endif // CKEYEVENTHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/MultiTouchPointerEvent.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Functional implementation of one touch(pointer sequence) event service.
+*
+*/
+
+#ifndef CMULTITOUCHPOINTER_UNIT_H
+#define CMULTITOUCHPOINTER_UNIT_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include <w32std.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CMultiTouchPointerEventHandler;
+
+/**
+* Functional implentation of pointer event service.
+*/
+class CMultiTouchPointerEvent : public CActive
+ {
+ public:
+
+ /**
+ * Two-phased constructor.
+ */
+ static CMultiTouchPointerEvent* NewL(TUint8 aTouchNumber,
+ CMultiTouchPointerEventHandler* aEventHandler);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CMultiTouchPointerEvent();
+
+
+ /**
+ * Touch active object start function
+ * @param aDelayTime initial wait time to start "finger" down for touch
+ */
+ void StartTouch();
+
+ void AddPointL(TTimeIntervalMicroSeconds32 aTime,
+ TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType);
+
+ void PrintInfo();
+
+ /**
+ * Insert a dragging event between two given pointers
+ * Interpolate pointer sequence with step aStepCount and dragging time.
+ * @param aX1, aY1, aZ1 3D coordinate of start point
+ * @param aX2, aY2, aZ2 3D coordinate of end point
+ * @param aDragTime dragging time between start point and end point
+ * @param aStepCount step count between two points
+ */
+ void InterpolatePointL(TInt aX1,TInt aY1, TInt aZ1, TInt aX2,TInt aY2, TInt aZ2,
+ TTimeIntervalMicroSeconds32 aDragTime, TInt aStepCount);
+
+ protected: // Functions from base classes
+
+ // From CActive
+ void RunL();
+ TInt RunError(TInt aError);
+ void DoCancel();
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CMultiTouchPointerEvent(TUint8 aTouchNumber, CMultiTouchPointerEventHandler* aEventHandler);
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ void SimulatePointerEvent();
+
+ /**
+ * Insert an advanced pointer to pointer sequence array for a touch
+ * @param aX, aY, aZ pointer 3D coordinate
+ * @param aEventType event type
+ */
+ void InsertPointArrayL(TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType);
+
+ /**
+ * Insert time duration to time array
+ * @param aDelayTime time duation to wait for
+ */
+ void InsertTimeArrayL(TTimeIntervalMicroSeconds32 aDelayTime);
+
+ private: // data
+
+ struct TAdvancedPointer
+ {
+ TInt X;
+ TInt Y;
+ TInt Z;
+ TRawEvent::TType EventType;
+ };
+
+ CMultiTouchPointerEventHandler* iEventHandler;
+ TUint8 iTouchNumber;
+
+ RTimer iTimer;
+
+ RPointerArray<TAdvancedPointer> iAdvPointerArray;
+ RPointerArray<TTimeIntervalMicroSeconds32> iTimeArray;
+ };
+
+#endif // CMULTITOUCHPOINTER_UNIT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/MultiTouchPointerEventHandler.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Functional implementation of advanced pointer multitouch service.
+*
+*/
+
+#ifndef CMULTITOUCHPOINTEREVENTHANDLER_H
+#define CMULTITOUCHPOINTEREVENTHANDLER_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CMultiTouchPointerEvent;
+
+/**
+* Observer interface for Multi touch event.
+*/
+class MHtiMultiTouchObserver
+ {
+public:
+ /**
+ * Notify multi touch event completed
+ */
+ virtual void NotifyMultiTouchComplete() = 0;
+
+ };
+/**
+* Functional implentation of pointer event service.
+*/
+class CMultiTouchPointerEventHandler
+ {
+ public:
+ /**
+ * Two-phased constructor.
+ */
+ static CMultiTouchPointerEventHandler* NewL(MHtiMultiTouchObserver& aObserver);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CMultiTouchPointerEventHandler();
+
+
+ TBool HandleMultiTouchL( const TDesC8& aData );
+
+ /**
+ * Callback function called by CMultiTouchPointerEvent to notify CMultiTouchPointerEventHandler
+ * that this touch action(pointer sequence) is conpleted.
+ * @param aTouchNumber touch number ordinal
+ */
+ void NotifyTouchComplete(TUint8 aTouchNumber);
+
+ void SimulateEvent(TUint8 aTouchNumber,TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType);
+
+ void Clear();
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CMultiTouchPointerEventHandler(MHtiMultiTouchObserver& aObserver);
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ TBool ParsePoint( const TDesC8& aData, TInt& aoffset,
+ TInt& aX, TInt& aY, TInt& aZ,
+ TTimeIntervalMicroSeconds32& aWait, TTimeIntervalMicroSeconds32& aHold );
+
+ TBool ParseMove( const TDesC8& aData, TInt& aoffset,
+ TTimeIntervalMicroSeconds32& aDragTime, TInt& aStepCount );
+
+ private: // data
+ RWsSession iWsSession;
+ RPointerArray<CMultiTouchPointerEvent> iTouchPointerArray;
+ TUint8 iFinishedCount;
+
+ MHtiMultiTouchObserver& iObserver;
+ };
+
+#endif // CKEYEVENTHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/PointerEventHandler.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Functional implentation of pointer event service.
+*
+*/
+
+#ifndef CPOINTEREVENTHANDLER_H
+#define CPOINTEREVENTHANDLER_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include <w32std.h>
+#include "MultiTouchPointerEventHandler.h"
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+/**
+* Functional implentation of pointer event service.
+*/
+class CPointerEventHandler :
+ public CActive,
+ public MHtiMultiTouchObserver
+ {
+ public:
+
+ enum TError
+ {
+ EMissingCommand = 0x01,
+ EUnrecognizedCommand = 0x02,
+ ENotReadyCommand = 0x03,
+ EInvalidParameters = 0x9A
+ };
+
+ enum TCommand
+ {
+ ETapScreen = 0x10,
+ ETapAndDrag = 0x11,
+ ETapAndDragMultipoint = 0x12,
+ EPressPointerDown = 0x13,
+ ELiftPointerUp = 0x14,
+ EAdvancedTapScreen = 0x15, //for advanced pointer
+ EPinchZoom = 0x16, //for advanced pointer
+ EMultiTouch = 0x17, //for advanced pointer
+ EResultOk = 0xFF // only for response message
+ };
+
+ enum TPointerState
+ {
+ EPointerUp,
+ EPointerDown,
+ EPointerMoving
+ };
+
+ struct TAdvancedPointer
+ {
+ TUint8 PointerNum;
+ TInt X;
+ TInt Y;
+ TInt Z;
+ };
+
+
+
+ /**
+ * Two-phased constructor.
+ */
+ static CPointerEventHandler* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CPointerEventHandler();
+
+ /**
+ * Called by the HtiKeyEventServicePlugin when a pointer event
+ * command is received.
+ * @param aMessage message body destinated to the servive
+ * @param aPriority message priority
+ */
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+ /**
+ * Sets the dispatcher to send outgoing messages to.
+ * @param aDispatcher pointer to dispatcher instance
+ */
+ void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+
+ protected: // Functions from base classes
+
+ // From CActive
+ void RunL();
+ TInt RunError(TInt aError);
+ void DoCancel();
+
+ // From MHtiMultiTouchObserver
+ void NotifyMultiTouchComplete();
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CPointerEventHandler();
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ // Helper methods
+ void HandleTapScreenL( const TDesC8& aData );
+ void HandleTapAndDragL( const TDesC8& aData );
+ void HandleTapAndDragMultipointL( const TDesC8& aData );
+ void HandlePointerDownOrUpL( const TDesC8& aData );
+
+ //for advanced pointer
+ void HandleAdvancedTapScreenL( const TDesC8& aData );
+ void HandlePinchZoomL( const TDesC8& aData );
+ void HandleMultiTouchL( const TDesC8& aData );
+
+ void SendOkMsgL();
+ void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+ void ChangePointerStateL();
+ void MoveToNextPointL();
+ void PointerDown();
+ void PointerUp();
+ void PointerMove();
+ void SimulatePointerEvent( TRawEvent::TType aType );
+ TBool IsMultitouch();
+ void AdvanceAddMiddlePointL(TInt aPointNumber,TInt aX1,TInt aY1, TInt aZ1,TInt aX2,TInt aY2, TInt aZ2 , TInt aStepCount );
+ void AdvancedAddDelayArray(TTimeIntervalMicroSeconds32 aDelay , TInt aStepCount );
+ TBool AdvancedStartDelay();
+
+
+ private: // data
+
+ RWsSession iWsSession;
+ MHtiDispatcher* iDispatcher; // referenced
+
+ RTimer iTimer;
+ TBool iReady;
+ TUint8 iCommand;
+ TInt iX;
+ TInt iY;
+ TInt iTapCount;
+ TTimeIntervalMicroSeconds32 iEventDelay;
+ TTimeIntervalMicroSeconds32 iActionDelay;
+ TPointerState iState;
+ RArray<TInt>* iCoords;
+ RPointerArray<TAdvancedPointer> iAdvancedPointers;
+
+ RPointerArray<TAdvancedPointer> iAdvPointerMoveArray;
+ RPointerArray<TTimeIntervalMicroSeconds32> iDelayArray;
+
+ CMultiTouchPointerEventHandler* iMultiTouchHandler;
+ };
+
+#endif // CKEYEVENTHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/HtiKeyEventServicePlugin.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: KeyEventPlugin entry implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+#include "KeyEventHandler.h"
+#include "PointerEventHandler.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+#include <hwrmlightdomaincrkeys.h>
+
+// CONSTANTS
+_LIT8( KErrorMissingCommand, "Command was not given - message was empty" );
+const TInt KDefaultMinLightTimeout = 5;
+const TInt KWakeupWaitTime = 200000; // 0.2 sec
+
+// ----------------------------------------------------------------------------
+// CHtiKeyEventServicePlugin::NewL()
+// Create instance of concrete ECOM interface implementation
+// ----------------------------------------------------------------------------
+CHtiKeyEventServicePlugin* CHtiKeyEventServicePlugin::NewL()
+ {
+ CHtiKeyEventServicePlugin* self = new (ELeave) CHtiKeyEventServicePlugin;
+ CleanupStack::PushL (self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiKeyEventServicePlugin::CHtiKeyEventServicePlugin()
+// ----------------------------------------------------------------------------
+CHtiKeyEventServicePlugin::CHtiKeyEventServicePlugin()
+ : iLightTimeout( KDefaultMinLightTimeout ),
+ iCenRepSession( NULL ),
+ iLightTimeoutSettingHandler( NULL )
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiKeyEventServicePlugin::~CHtiKeyEventServicePlugin()
+// ----------------------------------------------------------------------------
+CHtiKeyEventServicePlugin::~CHtiKeyEventServicePlugin()
+ {
+ HTI_LOG_TEXT( "CHtiKeyEventServicePlugin destroy" );
+ delete iKeyHandler;
+ delete iPointerHandler;
+
+ if ( iLightTimeoutSettingHandler )
+ {
+ iLightTimeoutSettingHandler->StopListening();
+ }
+ delete iLightTimeoutSettingHandler;
+ delete iCenRepSession;
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiKeyEventServicePlugin::ConstructL()
+// ----------------------------------------------------------------------------
+void CHtiKeyEventServicePlugin::ConstructL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiKeyEventServicePlugin::ConstructL" );
+ iCenRepSession = CRepository::NewL( KCRUidLightSettings );
+ iLightTimeoutSettingHandler = CCenRepNotifyHandler::NewL( *this,
+ *iCenRepSession, CCenRepNotifyHandler::EIntKey,
+ KDisplayLightsTimeout );
+ iLightTimeoutSettingHandler->StartListeningL();
+ HTI_LOG_FUNC_OUT( "CHtiKeyEventServicePlugin::ConstructL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiKeyEventServicePlugin::ProcessMessageL()
+// ----------------------------------------------------------------------------
+void CHtiKeyEventServicePlugin::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority)
+ {
+ HTI_LOG_FUNC_IN( "CHtiKeyEventServicePlugin::ProcessMessageL" );
+
+ if ( aMessage.Length() == 0 )
+ {
+ User::LeaveIfNull( iDispatcher );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+ CKeyEventHandler::EMissingCommand,
+ KErrorMissingCommand, KKeyEventServiceUid ) );
+ return;
+ }
+
+ HTI_LOG_FORMAT( "Light timeout = %d", iLightTimeout );
+ TTimeIntervalSeconds inactivityTime = User::InactivityTime();
+ HTI_LOG_FORMAT( "Inactivity time = %d", inactivityTime.Int() );
+ if ( inactivityTime.Int() >= iLightTimeout )
+ {
+ HTI_LOG_TEXT( "Waking up" );
+ User::ResetInactivityTime();
+ User::After( KWakeupWaitTime );
+ }
+
+ if ( aMessage[0] <= CKeyEventHandler::EPressKeySequence )
+ {
+ if ( iKeyHandler == NULL )
+ {
+ iKeyHandler = CKeyEventHandler::NewL();
+ iKeyHandler->SetDispatcher( iDispatcher );
+ }
+ iKeyHandler->ProcessMessageL( aMessage, aPriority );
+ }
+
+ else
+ {
+ if ( iPointerHandler == NULL )
+ {
+ iPointerHandler = CPointerEventHandler::NewL();
+ iPointerHandler->SetDispatcher( iDispatcher );
+ }
+ iPointerHandler->ProcessMessageL( aMessage, aPriority );
+ }
+
+
+ HTI_LOG_FUNC_OUT( "CHtiKeyEventServicePlugin::ProcessMessageL: Done" );
+ }
+
+// ---------------------------------------------------------------------------
+// From MCenRepNotifyHandlerCallback.
+// CHtiKeyEventServicePlugin::HandleNotifyInt
+// ---------------------------------------------------------------------------
+//
+void CHtiKeyEventServicePlugin::HandleNotifyInt( TUint32 aId, TInt aNewValue )
+ {
+ HTI_LOG_FUNC_IN( "CHtiKeyEventServicePlugin::HandleNotifyInt" );
+ if ( aId == KDisplayLightsTimeout )
+ {
+ HTI_LOG_FORMAT( "New light timeout value %d", aNewValue );
+ iLightTimeout = aNewValue;
+ }
+ HTI_LOG_FUNC_OUT( "CHtiKeyEventServicePlugin::HandleNotifyInt" );
+ }
+
+// ---------------------------------------------------------------------------
+// From MCenRepNotifyHandlerCallback.
+// CHtiKeyEventServicePlugin::HandleNotifyError
+// ---------------------------------------------------------------------------
+//
+void CHtiKeyEventServicePlugin::HandleNotifyError( TUint32 /*aId*/,
+ TInt /*error*/, CCenRepNotifyHandler* /*aHandler*/ )
+ {
+ HTI_LOG_TEXT( "CHtiKeyEventServicePlugin::HandleNotifyError()" );
+ iLightTimeout = KDefaultMinLightTimeout;
+ TRAP_IGNORE( iLightTimeoutSettingHandler->StartListeningL() );
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/KeyEventHandler.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,663 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Functional implementation of key event service
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+#include "KeyEventHandler.h"
+
+#include <apgtask.h>
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+
+// CONSTANTS
+_LIT8( KErrorServiceNotReady, "Service is busy - possibly executing long running typetext or long key press functionality" );
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+_LIT8( KErrorEmptyUnicodeArray, "Unicode char array was empty" );
+_LIT8( KErrorInvalidUnicodeCharArray, "Invalid unicode character array" );
+_LIT8( KErrorInvalidScancode, "Invalid scancode. Wrong length" );
+_LIT8( KErrorTypeTextFailure, "Internal typetext failure" );
+_LIT8( KErrorLongKeyPressFailure, "Internal long key press failure" );
+
+const TInt KKeyboardFuncDataLength = 2; // scancode with 2 bytes
+const TInt KLongKeyPressDataLength = 4; // scancode 2 bytes + time 2 bytes
+const TInt KPressKeySequenceMinDataLength = 6; // hold time 2 bytes + key press interval 2 bytes + at least one scancode 2 bytes
+const TInt KTypeTextDelayBetweenCharsInMicroSeconds = 50000; // 50 milliseconds
+const TInt KTypeTextStartPausing = 200; // start pausing after this many characters
+const TInt KTypeTextPauseInterval = 50; // how many chars to type before pausing
+const TInt KTypeTextPauseInMicroSeconds = 800000; // 0.8 sec
+
+
+// ----------------------------------------------------------------------------
+// UintValue()
+// Helper: aPtr must point to 16 bits area where the value will be extracted
+// ----------------------------------------------------------------------------
+TUint UintValue( const TUint8* aPtr )
+ {
+ // This is short way to do it..
+ //return (aPtr[1]<<8) + aPtr[0];
+
+ TUint8 uInt8Low = *aPtr;
+ TUint8 uInt8High = *(aPtr+1);
+
+ HTI_LOG_FORMAT( "UintValue:: Low: %d", uInt8Low );
+ HTI_LOG_FORMAT( "UintValue:: High: %d", uInt8High );
+
+ TUint16 uInt16 = (TUint16)uInt8High;
+ uInt16 = (uInt16 << 8);
+ uInt16 = uInt16 + (TUint)uInt8Low;
+
+ HTI_LOG_FORMAT( "UintValue:: 16-bit value: %d", uInt16 );
+
+ TUint uInt = (TUint)uInt16;
+ HTI_LOG_FORMAT( "UintValue:: 32-bit value: %d", uInt );
+
+ return uInt;
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::NewL()
+// ----------------------------------------------------------------------------
+CKeyEventHandler* CKeyEventHandler::NewL()
+ {
+ HTI_LOG_FUNC_IN( "CKeyEventHandler::NewL" );
+ CKeyEventHandler* self = new (ELeave) CKeyEventHandler();
+ CleanupStack::PushL ( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "CKeyEventHandler::Done" );
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::CKeyEventHandler()
+// ----------------------------------------------------------------------------
+CKeyEventHandler::CKeyEventHandler()
+ : CActive( CActive::EPriorityStandard ), iReady( ETrue ), iCommand( 0 ),
+ iHoldingScanCode( 0 )
+
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::~CKeyEventHandler()
+// ----------------------------------------------------------------------------
+CKeyEventHandler::~CKeyEventHandler()
+ {
+ HTI_LOG_TEXT( "CKeyEventHandler destroy" );
+ Cancel();
+ iTimer.Close();
+ iWsSession.Close();
+ delete iUnicodeChars;
+ iUnicodeChars = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::ConstructL()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::ConstructL()
+ {
+ HTI_LOG_TEXT( "CKeyEventHandler::ConstructL" );
+ User::LeaveIfError( iWsSession.Connect() );
+ User::LeaveIfError( iTimer.CreateLocal() );
+ CActiveScheduler::Add( this );
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::SetDispatcher()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+ {
+ iDispatcher = aDispatcher;
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::RunL()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::RunL()
+ {
+ HTI_LOG_FUNC_IN( "CKeyEventHandler::RunL" );
+
+ if ( iCommand == ELongKeyPress )
+ {
+ KeyUp( iHoldingScanCode );
+ SendOkMsgL();
+ iReady = ETrue;
+ HTI_LOG_TEXT( "CKeyEventHandler::RunL: LongKeyPress has finished" );
+ }
+
+ else if ( iCommand == ETypeText || iCommand == ETypeTextPassword )
+ {
+ SimulateKeyEventL( *iUnicodeChars, iUnicodeCharIndex );
+
+ if ( iUnicodeCharIndex == iUnicodeChars->Length() / 2 - 1 )
+ {
+ delete iUnicodeChars;
+ iUnicodeChars = NULL;
+ SendOkMsgL();
+ iReady = ETrue;
+ HTI_LOG_TEXT( "CKeyEventHandler::RunL: TypeText has finished: OK" );
+ }
+ else
+ {
+ iUnicodeCharIndex++;
+ TypeTextWithDelay( iUnicodeCharIndex );
+ }
+ }
+
+ else if ( iCommand == EPressKeySequence )
+ {
+ PressKeySequenceKeyL();
+ }
+
+ HTI_LOG_FUNC_OUT( "CKeyEventHandler::RunL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::RunError()
+// ----------------------------------------------------------------------------
+TInt CKeyEventHandler::RunError( TInt aError )
+ {
+ TInt dispatchResult = KErrNone;
+
+ if ( iCommand == ELongKeyPress )
+ {
+ HTI_LOG_FORMAT( "CKeyEventHandler::RunError: LongKeyPress failure: %d.", aError );
+ dispatchResult = iDispatcher->DispatchOutgoingErrorMessage( aError,
+ KErrorLongKeyPressFailure, KKeyEventServiceUid );
+ }
+
+ else // it's TypeText
+ {
+ HTI_LOG_FORMAT( "CKeyEventHandler::RunError: TypeText failure: %d.", aError );
+ dispatchResult = iDispatcher->DispatchOutgoingErrorMessage( aError,
+ KErrorTypeTextFailure, KKeyEventServiceUid );
+ }
+
+ if ( dispatchResult != KErrNone )
+ {
+ HTI_LOG_FORMAT( "CKeyEventHandler::RunError: Failed to send error report to framework: %d.", dispatchResult );
+ }
+ iReady = ETrue;
+ return KErrNone;
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::DoCancel()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::DoCancel()
+ {
+ iTimer.Cancel();
+ delete iUnicodeChars;
+ iUnicodeChars = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::ProcessMessageL()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/ )
+ {
+ HTI_LOG_FUNC_IN("CKeyEventHandler::ProcessMessageL");
+ HTI_LOG_FORMAT("Msg len: %d.", aMessage.Length());
+
+ if ( !iReady )
+ {
+ SendErrorMessageL( ENotReadyCommand, KErrorServiceNotReady );
+ return;
+ }
+
+ iCommand = aMessage.Ptr()[0];
+ switch ( iCommand )
+ {
+ case EPressKey:
+ case EKeyDown:
+ case EKeyUp:
+ HandleKeyboardFuncL( aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+ case ETypeText:
+ case ETypeTextPassword:
+ HandleTypeTextFuncL( aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+ case ELongKeyPress:
+ HandleLongKeyPressFuncL( aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+ case EPressKeySequence:
+ HandlePressKeySequenceFuncL( aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+ default:
+ SendErrorMessageL( EUnrecognizedCommand,
+ KErrorUnrecognizedCommand );
+ break;
+ }
+
+ HTI_LOG_FUNC_OUT( "CKeyEventHandler::ProcessMessageL: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::HandleTypeTextFuncL()
+// Handle request to send one or more unicode characters to top most
+// focused UI application.
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::HandleTypeTextFuncL(
+ const TDesC8& aUnicodeChars )
+ {
+ HTI_LOG_FUNC_IN( "CKeyEventHandler::HandleTypeTextFunc" );
+
+ // For UCS-2 and common unicode key code areas, see
+ // http://czyborra.com/unicode/characters.html
+ // "How are the Unicode characters numbered?"
+
+ if ( aUnicodeChars.Size() == 0 )
+ {
+ SendErrorMessageL( EEmptyUnicodeCharArray, KErrorEmptyUnicodeArray );
+ return;
+ }
+
+#ifdef __ENABLE_LOGGING__
+ CArrayFixFlat<TInt> *windowGroups = new (ELeave) CArrayFixFlat<TInt>(5);
+ iWsSession.WindowGroupList(windowGroups);
+ HTI_LOG_FORMAT("WindowGroupList, %d groups:",windowGroups->Count());
+ for ( TInt i = 0; i < windowGroups->Count(); i++ )
+ {
+ TBuf<125> wgname; // max length for wg name?
+ iWsSession.GetWindowGroupNameFromIdentifier((*windowGroups)[i], wgname);
+
+ TBuf<145> logmsg;
+ logmsg.AppendFormat(_L("WgId %3d - \""), (*windowGroups)[i]);
+ logmsg.Append(wgname);
+ logmsg.Append(_L("\""));
+ HTI_LOG_DES(logmsg);
+ }
+ delete windowGroups;
+#endif
+
+ // Get the front most focused window group. Note that this might
+ // not necessarily be the front-most window group, as
+ // window groups can disable keyboard focus.
+ iFocusedWindowGroup = iWsSession.GetFocusWindowGroup();
+
+ HTI_LOG_TEXT("FocusWindowGroup name :");
+ TBuf<125> focusWindowGroupName; // max length for wg name?
+ iWsSession.GetWindowGroupNameFromIdentifier(iFocusedWindowGroup, focusWindowGroupName);
+ HTI_LOG_DES(focusWindowGroupName);
+
+ // ...exception to above! (in EKA2) :
+ // When we are in idle state the text must be sent to 'Telephone' task's
+ // windowgroup because 'idle' windowgroup does not handle keyevents.
+ //
+ // Also when typing in idle state we need EKeyUp event to prevent the key
+ // beeing stuck in the pressed position.
+ //
+ // Window group name contains UID - we are using UID to find the
+ // 'Idle' window group so it will be found also with different
+ // localizations. The name 'Idle' cannot be used since the name is
+ // localized.
+
+ if ( ( focusWindowGroupName.Find( _L( "101fd64c" ) ) != KErrNotFound ) ||
+ ( focusWindowGroupName.Find( _L( "102750f0" ) ) != KErrNotFound ) )
+ {
+ HTI_LOG_TEXT( "FocusWindowGroup is \"Idle\". Sending text to \"Telephone\" task." );
+ TApaTaskList taskList( iWsSession );
+ TApaTask telephoneTask = taskList.FindApp( TUid::Uid( 0x100058b3 ) );
+ if ( !telephoneTask.Exists() )
+ {
+ HTI_LOG_FUNC_OUT( "CKeyEventHandler::SimulateKeyEventL: \"Telephone\" task does not exist" );
+ User::Leave( KErrNotFound );
+ }
+
+ iFocusedWindowGroup = telephoneTask.WgId();
+
+ // We must also get focus to 'Telephone' task for it
+ // to receive our text.
+ TWsEvent event;
+ event.SetType( EEventFocusGained );
+ iWsSession.SendEventToWindowGroup( telephoneTask.WgId(), event );
+ }
+
+ if ( aUnicodeChars.Size() % 2 == 1 )
+ {
+ // aUnicodeChars descriptor must be divisible by two,
+ // because expecting two-byte characters
+ SendErrorMessageL( EInvalidUnicodeCharArray,
+ KErrorInvalidUnicodeCharArray );
+ return;
+ }
+
+ // Start work
+ if ( iUnicodeChars )
+ {
+ delete iUnicodeChars;
+ iUnicodeChars = NULL;
+ }
+
+ // If the string begins with unicode byte order mark 0xfffe, strip it away
+ if ( ( aUnicodeChars[0] == 0xff && aUnicodeChars[1] == 0xfe ) )
+ {
+ HTI_LOG_TEXT( "Ignoring Unicode BOM (first 2 bytes) from the string" );
+ iUnicodeChars = aUnicodeChars.Mid( 2 ).AllocL();
+ }
+ else // take the string as it is
+ {
+ iUnicodeChars = aUnicodeChars.AllocL();
+ }
+ iReady = EFalse;
+
+ TypeTextWithDelay( 0 );
+
+ HTI_LOG_FUNC_OUT("CKeyEventHandler::HandleTypeTextFunc: Done (operation started)");
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::TypeTextWithDelay()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::TypeTextWithDelay( TInt aNextIndex )
+ {
+ iUnicodeCharIndex = aNextIndex;
+ // Keep a longer pause in some character intervals if the given text
+ // is very long to avoid losing characters.
+ if ( iUnicodeCharIndex > KTypeTextStartPausing &&
+ iUnicodeCharIndex % KTypeTextPauseInterval == 0 )
+ {
+ iTimer.After( iStatus, KTypeTextPauseInMicroSeconds );
+ }
+ else
+ {
+ iTimer.After( iStatus, KTypeTextDelayBetweenCharsInMicroSeconds );
+ }
+ SetActive();
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::SimulateKeyEventL()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::SimulateKeyEventL( const TDesC8& aUnicodeChars,
+ TInt aIndex )
+ {
+
+ // Expect aUnicodeChars to be Unicode characters (each two bytes)
+ // Note: aIndex is within range of 0 to aUnicodeChars/2
+
+ HTI_LOG_FUNC_IN("CKeyEventHandler::SimulateKeyEventL");
+ TKeyEvent keyEvent;
+ const TUint8* rawDataStart = aUnicodeChars.Ptr();
+ keyEvent.iCode = *( (TUint16*) ( rawDataStart + aIndex * 2 ) );
+ // Set modifier to treat key events as events from external keyboard
+ // so that AknFep won't interfere with numbers and * and # characters.
+ keyEvent.iModifiers = EModifierKeyboardExtend;
+ keyEvent.iRepeats = 0;
+ //keyEvent.iScanCode = EStdKeyNull;
+ // change because FEP got confused about EStdKeyNull in key-up event and
+ // opened the edit menu
+ keyEvent.iScanCode = 255;
+
+ TWsEvent event;
+ *event.Key() = keyEvent;
+
+ if ( iCommand == ETypeTextPassword )
+ {
+ // Typing a password needs only EEventKey.
+ // Otherwise it will appear to be pressed twice.
+ HTI_LOG_FORMAT( "EEventKey 0x%x", keyEvent.iCode );
+ event.SetType( EEventKey );
+ iWsSession.SendEventToWindowGroup( iFocusedWindowGroup, event );
+ }
+ else
+ {
+ // EEventKeyUp is needed when typing a SMS or MMS. Otherwise the
+ // counters will not be updated and message will be corrupt.
+ // Also typing in idle state requires EEventKeyUp for the key to be
+ // released.
+ HTI_LOG_FORMAT( "EEventKey&EEventKeyUp 0x%x", keyEvent.iCode );
+ event.SetType( EEventKey );
+ iWsSession.SendEventToWindowGroup( iFocusedWindowGroup, event );
+
+ event.SetType( EEventKeyUp );
+ iWsSession.SendEventToWindowGroup( iFocusedWindowGroup, event );
+ }
+
+ HTI_LOG_FUNC_OUT( "CKeyEventHandler::SimulateKeyEventL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::KeyUp()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::KeyUp( TUint aCode )
+ {
+ HTI_LOG_FUNC_IN( "CKeyEventHandler::KeyUp: Starting" );
+ TRawEvent rawEvent;
+ rawEvent.Set( TRawEvent::EKeyUp, aCode );
+ iWsSession.SimulateRawEvent( rawEvent );
+ iWsSession.Flush();
+ HTI_LOG_FUNC_OUT( "CKeyEventHandler::KeyUp: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::KeyDown()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::KeyDown( TUint aCode )
+ {
+ HTI_LOG_FUNC_IN( "CKeyEventHandler::KeyDown: Starting" );
+ User::ResetInactivityTime();
+ TRawEvent rawEvent;
+ rawEvent.Set( TRawEvent::EKeyDown, aCode );
+ iWsSession.SimulateRawEvent( rawEvent );
+ iWsSession.Flush();
+ HTI_LOG_FUNC_OUT( "CKeyEventHandler::KeyDown: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::HandleKeyboardFuncL()
+// Handle request to emulate pressing keyboard keys in sequence.
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::HandleKeyboardFuncL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CKeyEventHandler::HandleKeyboardFuncL" );
+
+ HTI_LOG_FORMAT( "CKeyEventHandler::HandleKeyboardFuncL: Size of data: %d", aData.Length() );
+ HTI_LOG_TEXT( "CKeyEventHandler::HandleKeyboardFuncL: Data: " );
+ HTI_LOG_DES( aData );
+
+// <scancode> is unsigned short integer, a scancode of
+// keyboard key. Theses are defined in E32KEYS.H. It depends on
+// device how these are mapped to actual keyboard keys in the
+// device.
+//
+// Client note: each call to KEYDOWN should be followed by KEYUP
+// with the same scancode at some point.
+
+ if ( aData.Length() != KKeyboardFuncDataLength )
+ {
+// HTI_LOG_FORMAT( "PRESSKEY: Invalid scancode length: %d (expecting 2 bytes).", ptr.Length() - 1);
+ SendErrorMessageL( EInvalidScancode, KErrorInvalidScancode );
+ return;
+ }
+
+ iReady = EFalse;
+
+ TUint scanCode = UintValue( aData.Ptr() );
+
+ switch ( iCommand )
+ {
+ case EPressKey:
+ KeyDown( scanCode );
+ KeyUp( scanCode );
+ break;
+
+ case EKeyDown:
+ KeyDown( scanCode );
+ break;
+
+ case EKeyUp:
+ KeyUp( scanCode );
+ break;
+
+ default:
+ break;
+ }
+ SendOkMsgL();
+ iReady = ETrue;
+ HTI_LOG_FUNC_OUT("CKeyEventHandler::HandleKeyboardFuncL: Done");
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::HandleLongKeyPressFuncL()
+// Handle request to emulate holding a key down for specified time.
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::HandleLongKeyPressFuncL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CKeyEventHandler::HanldeLongKeyPressFuncL" );
+
+ if ( aData.Length() != KLongKeyPressDataLength )
+ {
+ SendErrorMessageL( EInvalidScancode, KErrorInvalidScancode );
+ return;
+ }
+
+ iReady = EFalse;
+ iHoldingScanCode = UintValue( aData.Ptr() );
+ TTimeIntervalMicroSeconds32 holdTime( UintValue( aData.Ptr() + 2 ) * 1000 );
+ KeyDown( iHoldingScanCode );
+ iTimer.After( iStatus, holdTime );
+ SetActive();
+
+ HTI_LOG_FUNC_OUT( "CKeyEventHandler::HanldeLongKeyPressFuncL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::HandlePressKeySequenceFuncL()
+// Handle request to press keys in sequence.
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::HandlePressKeySequenceFuncL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CKeyEventHandler::HandlePressKeySequenceFuncL" );
+
+ if ( aData.Length() % 2 != 0 )
+ {
+ HTI_LOG_FORMAT( "Invalid data length: %d", aData.Length() );
+ SendErrorMessageL( EInvalidUnicodeCharArray, KErrorInvalidUnicodeCharArray );
+ return;
+ }
+
+ if ( aData.Length() < KPressKeySequenceMinDataLength )
+ {
+ HTI_LOG_FORMAT( "Too short data: %d", aData.Length() );
+ SendErrorMessageL( EEmptyUnicodeCharArray, KErrorEmptyUnicodeArray );
+ return;
+ }
+
+ iReady = EFalse;
+
+ iKeySequenceHoldTime = UintValue( aData.Ptr() ) * 1000;
+ iKeySequenceInterval = UintValue( aData.Ptr() + 2 ) * 1000;
+ HTI_LOG_FORMAT( "Parsed key sequence hold time: %d", iKeySequenceHoldTime.Int() / 1000 );
+ HTI_LOG_FORMAT( "Parsed key sequence interval: %d", iKeySequenceInterval.Int() / 1000 );
+ if ( iKeySequenceInterval.Int() < KTypeTextDelayBetweenCharsInMicroSeconds )
+ {
+ HTI_LOG_TEXT( "Given key sequence interval too low, using the default value" );
+ iKeySequenceInterval = KTypeTextDelayBetweenCharsInMicroSeconds;
+ }
+
+ if(iUnicodeChars)
+ {
+ delete iUnicodeChars;
+ iUnicodeChars = NULL;
+ }
+
+ iUnicodeChars = aData.Mid( 4 ).AllocL();
+ iUnicodeCharIndex = 0;
+ iHoldingKey = EFalse;
+
+ PressKeySequenceKeyL();
+
+ HTI_LOG_FUNC_OUT( "CKeyEventHandler::HandlePressKeySequenceFuncL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::PressKeySequenceKeyL()
+// Handle a single key press from press keys in sequence command.
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::PressKeySequenceKeyL()
+ {
+ HTI_LOG_FUNC_IN( "CKeyEventHandler::PressKeySequenceKeyL" );
+
+ if ( iHoldingKey )
+ {
+ KeyUp( iHoldingScanCode );
+ iHoldingKey = EFalse;
+
+ HTI_LOG_FORMAT( "Released key: %d", iHoldingScanCode );
+
+ if ( iUnicodeChars->Length() > iUnicodeCharIndex )
+ {
+ iTimer.After( iStatus, iKeySequenceInterval );
+ SetActive();
+ }
+ else
+ {
+ HTI_LOG_TEXT( "PressKeySequence has finished: OK" );
+ SendOkMsgL();
+ iReady = ETrue;
+ }
+ }
+ else
+ {
+ iHoldingScanCode = UintValue( iUnicodeChars->Ptr() + iUnicodeCharIndex );
+ iUnicodeCharIndex += 2;
+
+ KeyDown( iHoldingScanCode );
+ iHoldingKey = ETrue;
+
+ HTI_LOG_FORMAT( "Holding down key: %d", iHoldingScanCode );
+
+ iTimer.After( iStatus, iKeySequenceHoldTime );
+ SetActive();
+ }
+
+ HTI_LOG_FUNC_OUT( "CKeyEventHandler::HandlePressKeySequenceFuncL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::SendOkMsgL()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::SendOkMsgL()
+ {
+ HTI_LOG_FUNC_IN("CKeyEventHandler::SendOkMsgL: Starting");
+
+ User::LeaveIfNull( iDispatcher );
+ TBuf8<1> response;
+ response.Append( EResultOk );
+ HBufC8* respH8 = response.AllocL();
+ User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+ respH8, KKeyEventServiceUid ) );
+
+ HTI_LOG_FUNC_OUT("CKeyEventHandler::SendOkMsgL: Done");
+ }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::SendErrorMessageL()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::SendErrorMessageL( TInt aError,
+ const TDesC8& aDescription )
+ {
+ HTI_LOG_FUNC_IN("CKeyEventHandler::SendErrorMessageL: Starting");
+ User::LeaveIfNull( iDispatcher );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+ aError, aDescription, KKeyEventServiceUid ) );
+ HTI_LOG_FUNC_OUT("CKeyEventHandler::SendErrorMessageL: Done");
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/MultiTouchPointerEvent.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,257 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Functional implementation of one touch(pointer sequence) event service.
+*
+*/
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+#include "MultiTouchPointerEvent.h"
+#include "MultiTouchPointerEventHandler.h"
+
+#include <HtiLogging.h>
+
+
+// CONSTANTS
+_LIT8( KErrorInternalFailure, "Internal pointer command failure" );
+_LIT (KPrintInfoString, "PrintInfo event id=%d time=%d type=%d X=%d Y=%d Z=%d");
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerUnit::NewL()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEvent* CMultiTouchPointerEvent::NewL(TUint8 aTouchNumber,
+ CMultiTouchPointerEventHandler* aEventHandler)
+ {
+ HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::NewL" );
+ CMultiTouchPointerEvent* self = new (ELeave) CMultiTouchPointerEvent(aTouchNumber, aEventHandler);
+ CleanupStack::PushL ( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::NewL" );
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::CMultiTouchPointerEvent()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEvent::CMultiTouchPointerEvent(TUint8 aTouchNumber,
+ CMultiTouchPointerEventHandler *aEventHandler)
+ : CActive(CActive::EPriorityStandard),
+ iEventHandler(aEventHandler),
+ iTouchNumber(aTouchNumber)
+ {
+ HTI_LOG_TEXT( "CMultiTouchPointerEvent constructor" );
+ }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::~CMultiTouchPointerEvent()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEvent::~CMultiTouchPointerEvent()
+ {
+ HTI_LOG_TEXT( "CMultiTouchPointerEvent destructor" );
+ Cancel();
+ iTimer.Close();
+
+ iTimeArray.ResetAndDestroy();
+ iAdvPointerArray.ResetAndDestroy();
+ }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::ConstructL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::ConstructL()
+ {
+ HTI_LOG_TEXT( "CMultiTouchPointerEvent::ConstructL" );
+ iTimeArray.Reset();
+
+ User::LeaveIfError( iTimer.CreateLocal() );
+ CActiveScheduler::Add( this );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::StartTouch()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::StartTouch()
+ {
+ HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::StartTouch" );
+ TBool bcontinue=ETrue;
+ while (iTimeArray.Count()>0 && bcontinue)
+ {
+ TTimeIntervalMicroSeconds32* time=iTimeArray[0];
+ iTimeArray.Remove(0);
+ HTI_LOG_FORMAT( "Event time=%d ", time->Int() );
+ if (time->Int()==0)
+ {
+ // execute immediately
+ SimulatePointerEvent();
+ }
+ else
+ {
+ // wait for specified time
+ iTimer.After( iStatus, *time );
+ SetActive();
+ bcontinue=EFalse;
+ }
+ delete time;
+ }
+
+ if (iTimeArray.Count()==0)
+ {
+ HTI_LOG_FORMAT( "Notify touch %d complete", iTouchNumber );
+ iEventHandler->NotifyTouchComplete(iTouchNumber);
+ }
+ HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::StartTouch" );
+ }
+
+// ----------------------------------------------------------------------------
+// void CMultiTouchPointerEvent::InsertPointArrayL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::InsertPointArrayL(TInt aX,TInt aY,TInt aZ,TRawEvent::TType aEventType)
+ {
+
+ TAdvancedPointer* point = new (ELeave) TAdvancedPointer;
+ CleanupStack::PushL(point);
+ iAdvPointerArray.AppendL(point);
+ CleanupStack::Pop();
+
+ point->X=aX;
+ point->Y=aY;
+ point->Z=aZ;
+ point->EventType=aEventType;
+
+ }
+
+// ----------------------------------------------------------------------------
+// void CMultiTouchPointerEvent::InsertTimeArrayL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::InsertTimeArrayL(TTimeIntervalMicroSeconds32 aDelayTime)
+ {
+
+ TTimeIntervalMicroSeconds32* time=new (ELeave) TTimeIntervalMicroSeconds32(aDelayTime);
+ iTimeArray.AppendL(time);
+
+ }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::InterpolatePointL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::InterpolatePointL(TInt aX1,TInt aY1, TInt aZ1,
+ TInt aX2,TInt aY2, TInt aZ2, TTimeIntervalMicroSeconds32 aDragTime, TInt aStepCount)
+ {
+ HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::InterpolatePointL" );
+ TInt dx = (aX2-aX1)/aStepCount;
+ TInt dy = (aY2-aY1)/aStepCount;
+
+ TTimeIntervalMicroSeconds32 dt = aDragTime.Int()/aStepCount;
+ TInt X,Y,Z;
+ for (TInt i=1;i<=aStepCount;i++)
+ {
+ if (i<aStepCount)
+ {
+ X=aX1+i*dx;
+ Y=aY1+i*dy;
+ Z=aZ1;
+ }
+ else
+ {
+ X=aX2;
+ Y=aY2;
+ Z=aZ2;
+ }
+ AddPointL(dt,X,Y,Z,TRawEvent::EPointerMove);
+ }
+
+ HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::InterpolatePointL" );
+ }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::RunL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::RunL()
+ {
+ HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::RunL" );
+ SimulatePointerEvent();
+ StartTouch();
+ HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::RunL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::RunError()
+// ----------------------------------------------------------------------------
+TInt CMultiTouchPointerEvent::RunError( TInt aError )
+ {
+ HTI_LOG_FORMAT( "CMultiTouchPointerEvent::RunError %d", aError );
+
+ return KErrNone;
+ }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::DoCancel()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::DoCancel()
+ {
+ HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::DoCancel" );
+ iTimer.Cancel();
+ HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::DoCancel" );
+ }
+
+void CMultiTouchPointerEvent::PrintInfo()
+ {
+#ifdef __ENABLE_LOGGING__
+ HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::PrintInfo" );
+
+ HTI_LOG_FORMAT( "PrintInfo touch number=%d ", iTouchNumber );
+
+ TInt size=iTimeArray.Count();
+ HTI_LOG_FORMAT( "PrintInfo event array=%d ", size );
+
+ TBuf<255> buf;
+
+ for (TInt i=0;i<size;i++)
+ {
+ buf.Format(KPrintInfoString,
+ i, iTimeArray[i]->Int(),iAdvPointerArray[i]->EventType ,
+ iAdvPointerArray[i]->X ,iAdvPointerArray[i]->Y, iAdvPointerArray[i]->Z );
+ HTI_LOG_DES(buf);
+ }
+ HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::PrintInfo" );
+#endif
+ }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::SimulatePointerEvent()
+// Sends the pointer event as a raw event.
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::SimulatePointerEvent()
+ {
+ HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::SimulatePointerEvent" );
+
+ if (iAdvPointerArray.Count()>0)
+ {
+ TAdvancedPointer* pointer = iAdvPointerArray[0];
+ iAdvPointerArray.Remove(0);
+
+ iEventHandler->SimulateEvent(iTouchNumber, pointer->X, pointer->Y, pointer->Z,pointer->EventType);
+ delete pointer;
+ }
+
+ HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::SimulatePointerEvent" );
+
+ }
+void CMultiTouchPointerEvent::AddPointL(TTimeIntervalMicroSeconds32 aTime,
+ TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType)
+ {
+ InsertPointArrayL( aX, aY, aZ,aEventType);
+ InsertTimeArrayL(aTime);
+ }
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/MultiTouchPointerEventHandler.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,286 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Functional implementation of advanced pointer multitouch service
+*
+*/
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+#include "MultiTouchPointerEventHandler.h"
+#include "MultiTouchPointerEvent.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+// CONSTANTS
+
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::NewL()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEventHandler* CMultiTouchPointerEventHandler::NewL(MHtiMultiTouchObserver& aObserver)
+ {
+ HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::NewL" );
+ CMultiTouchPointerEventHandler* self = new (ELeave) CMultiTouchPointerEventHandler(aObserver);
+ CleanupStack::PushL ( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::NewL" );
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::CMultiTouchPointerEventHandler()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEventHandler::CMultiTouchPointerEventHandler(MHtiMultiTouchObserver& aObserver)
+ :iFinishedCount(0), iObserver(aObserver)
+ {
+ HTI_LOG_TEXT( "CMultiTouchPointerEventHandler constructor" );
+ }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::~CMultiTouchPointerEventHandler()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEventHandler::~CMultiTouchPointerEventHandler()
+ {
+ HTI_LOG_TEXT( "CMultiTouchPointerEventHandler destructor" );
+ Clear();
+ iWsSession.Close();
+ }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::ConstructL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEventHandler::ConstructL()
+ {
+ HTI_LOG_TEXT( "CMultiTouchPointerEventHandler::ConstructL" );
+ User::LeaveIfError( iWsSession.Connect() );
+ }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::Clear()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEventHandler::Clear()
+ {
+ HTI_LOG_TEXT( "CMultiTouchPointerEventHandler::Clear" );
+ iTouchPointerArray.ResetAndDestroy();
+ iFinishedCount=0;
+ }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::NotifyTouchComplete()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEventHandler::NotifyTouchComplete(TUint8 aTouchNumber)
+ {
+ HTI_LOG_FUNC_IN("CMultiTouchPointerEventHandler::NotifyTouchComplete");
+
+ iFinishedCount++;
+ HTI_LOG_FORMAT( "touch number %d finished", aTouchNumber);
+ HTI_LOG_FORMAT( "%d touch finished", iFinishedCount);
+
+ if(iTouchPointerArray.Count() == iFinishedCount)
+ {
+ // notify observer
+ iObserver.NotifyMultiTouchComplete();
+ }
+
+ HTI_LOG_FUNC_OUT("CMultiTouchPointerEventHandler::NotifyTouchComplete");
+ }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::ParsePoint()
+// ----------------------------------------------------------------------------
+TBool CMultiTouchPointerEventHandler::ParsePoint( const TDesC8& aData, TInt& aoffset,
+ TInt& aX, TInt& aY, TInt& aZ,
+ TTimeIntervalMicroSeconds32& aWait, TTimeIntervalMicroSeconds32& aHold )
+ {
+ HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::ParsePoint" );
+
+ TInt dataLength = aData.Length();
+ if ( dataLength-aoffset < 14 )
+ return EFalse ;
+
+ aX = aData[aoffset] + ( aData[aoffset+1] << 8 );
+ aoffset += 2;
+
+ aY = aData[aoffset] + ( aData[aoffset+1] << 8 );
+ aoffset += 2;
+
+ aZ = aData[aoffset] + ( aData[aoffset+1] << 8 );
+ aoffset += 2;
+
+ aWait = (aData[aoffset] + ( aData[aoffset+1] << 8 )
+ + ( aData[aoffset+2] << 16 ) + (aData[aoffset+3] << 24) ) * 1000;
+ aoffset += 4;
+
+ aHold = ( aData[aoffset] + ( aData[aoffset+1] << 8 )
+ + ( aData[aoffset+2] << 16 ) + (aData[aoffset+3] << 24) ) * 1000;
+ aoffset += 4;
+
+ HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::ParsePoint" );
+ return ETrue;
+ }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::ParseMove()
+// ----------------------------------------------------------------------------
+TBool CMultiTouchPointerEventHandler::ParseMove( const TDesC8& aData, TInt& aoffset,
+ TTimeIntervalMicroSeconds32& aDragTime, TInt& aStepCount )
+ {
+ HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::ParseMove" );
+
+ TInt dataLength = aData.Length();
+ if ( dataLength-aoffset < 6 )
+ return EFalse ;
+
+ aDragTime = ( aData[aoffset] + ( aData[aoffset+1] << 8 )
+ + ( aData[aoffset+2] << 16 ) + (aData[aoffset+3] << 24) ) * 1000;
+ aoffset += 4;
+
+ aStepCount = aData[aoffset] + ( aData[aoffset+1] << 8 );
+ aoffset += 2;
+
+ HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::ParseMove" );
+ return ETrue;
+ }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::HandleMultiTouchL()
+// ----------------------------------------------------------------------------
+TBool CMultiTouchPointerEventHandler::HandleMultiTouchL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::HandleMultiTouchL" );
+ TBool validparameter=EFalse;
+
+ TInt dataLength = aData.Length();
+ if ( dataLength < 1 )
+ return validparameter;
+
+ // Parse the parameters - correct length is already verified
+ TInt offset = 0;
+
+ TInt touchCount = aData[offset];
+ offset += 1;
+ HTI_LOG_FORMAT( "Number of touches: %d", touchCount );
+ if (touchCount<=0)
+ return validparameter;
+
+ for(TInt i=0; i<touchCount; i++)
+ {
+ //check valid data length
+ if(dataLength-offset < 3)
+ return validparameter;
+
+ TInt pointerNumber = aData[offset];
+ offset += 1;
+ HTI_LOG_FORMAT( "Pointer Number %d", pointerNumber );
+
+ TInt pointerCount = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Number of points: %d", pointerCount );
+
+ if (pointerCount == 0 )
+ return validparameter;
+
+ CMultiTouchPointerEvent* touch = CMultiTouchPointerEvent::NewL(pointerNumber,this);
+ CleanupStack::PushL(touch);
+ iTouchPointerArray.AppendL(touch);
+ CleanupStack::Pop();
+
+ TInt lastX, lastY, lastZ, stepCount;
+ TTimeIntervalMicroSeconds32 dragTime;
+
+ for (TInt j=0;j<pointerCount;j++)
+ {
+ // read point
+ TInt X1, Y1, Z1;
+ TTimeIntervalMicroSeconds32 waitTime, holdTime;
+ if (!ParsePoint( aData, offset,X1, Y1, Z1, waitTime, holdTime))
+ return validparameter;
+
+ HTI_LOG_FORMAT( "X coord down = %d", X1 );
+ HTI_LOG_FORMAT( "Y coord down = %d", Y1 );
+ HTI_LOG_FORMAT( "Z coord down = %d", Z1 );
+ HTI_LOG_FORMAT( "Event wait time = %d", waitTime.Int() );
+ HTI_LOG_FORMAT( "Point holding time = %d", holdTime.Int() );
+
+ if ( waitTime.Int() < 0 || holdTime.Int() < 0 )
+ return validparameter;
+
+ // add move event from last point to this point
+ if (j!=0)
+ {
+ HTI_LOG_FORMAT( "Point dragging time = %d", dragTime.Int() );
+ HTI_LOG_FORMAT( "Step count between two points = %d", stepCount );
+ touch->InterpolatePointL(lastX, lastY, lastZ,X1,Y1,Z1,dragTime,stepCount);
+ }
+
+ // set last point
+ lastX=X1;
+ lastY=Y1;
+ lastZ=Z1;
+
+ // wait event
+ touch->AddPointL(waitTime,X1,Y1,Z1,TRawEvent::EButton1Down);
+
+ // hold event
+ touch->AddPointL(holdTime, X1,Y1,Z1,TRawEvent::EPointerMove);
+
+ if (j!=pointerCount-1)
+ {
+ // not last point
+ if (!ParseMove(aData, offset, dragTime, stepCount))
+ return validparameter;
+ if (dragTime.Int() < 0 || stepCount <= 0)
+ return validparameter;
+ }
+ else
+ {
+ // last point
+ touch->AddPointL(0,X1,Y1,Z1,TRawEvent::EButton1Up);
+ }
+ }
+
+ touch->PrintInfo();
+
+ }
+
+
+ for (TInt i=0;i<touchCount;i++)
+ iTouchPointerArray[i]->StartTouch();
+
+ validparameter=ETrue;
+
+ HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::HandleMultiTouchL" );
+ return validparameter;
+ }
+
+void CMultiTouchPointerEventHandler::SimulateEvent(TUint8 aTouchNumber,
+ TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType)
+ {
+ HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::SimulateEvent" );
+
+ TRawEvent rawEvent;
+ rawEvent.SetPointerNumber( aTouchNumber );
+ rawEvent.Set( aEventType, aX, aY, aZ);
+
+ HTI_LOG_FORMAT( "SimulatePointer touch number=%d ", aTouchNumber );
+ HTI_LOG_FORMAT( "SimulatePointer event=%d ", aEventType );
+ HTI_LOG_FORMAT( "SimulatePointer X=%d ", aX );
+ HTI_LOG_FORMAT( "SimulatePointer Y=%d ", aY );
+ HTI_LOG_FORMAT( "SimulatePointer Z=%d", aZ );
+
+ iWsSession.SimulateRawEvent( rawEvent );
+ iWsSession.Flush();
+
+ HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::SimulateEvent" );
+
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/PointerEventHandler.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,918 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Functional implementation of pointer event service
+*
+*/
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+#include "PointerEventHandler.h"
+
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+
+// CONSTANTS
+_LIT8( KErrorMissingCommand, "Command was not given - message was empty" );
+_LIT8( KErrorServiceNotReady, "Service is busy - possibly executing long running pointer events" );
+_LIT8( KErrorInvalidParameters, "Command parameters not valid" );
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+_LIT8( KErrorInternalFailure, "Internal pointer command failure" );
+_LIT8( KErrorGetHALData, "Can not get the HAL data" );
+
+const TInt KTapCmdLength = 10;
+const TInt KDragMultiCmdMinLength = 14;
+const TInt KSinglePointerCmdLength = 4;
+const TInt KAdvancedTapScreenCmdMinLength = 16;
+const TInt KPinchZoomCmdMinLength = 30;
+
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::NewL()
+// ----------------------------------------------------------------------------
+CPointerEventHandler* CPointerEventHandler::NewL()
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::NewL" );
+ CPointerEventHandler* self = new (ELeave) CPointerEventHandler();
+ CleanupStack::PushL ( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::Done" );
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::CPointerEventHandler()
+// ----------------------------------------------------------------------------
+CPointerEventHandler::CPointerEventHandler()
+ : CActive( CActive::EPriorityStandard ), iReady( ETrue ), iCommand( 0 ), iMultiTouchHandler(NULL),
+ iState( EPointerUp )
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::~CPointerEventHandler()
+// ----------------------------------------------------------------------------
+CPointerEventHandler::~CPointerEventHandler()
+ {
+ HTI_LOG_TEXT( "CPointerEventHandler destroy" );
+ Cancel();
+ iTimer.Close();
+ iWsSession.Close();
+ if ( iCoords )
+ {
+ iCoords->Close();
+ }
+ delete iCoords;
+ delete iMultiTouchHandler;
+
+ iAdvancedPointers.ResetAndDestroy();
+ iDelayArray.ResetAndDestroy();
+ iAdvPointerMoveArray.ResetAndDestroy();
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::ConstructL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::ConstructL()
+ {
+ HTI_LOG_TEXT( "CPointerEventHandler::ConstructL" );
+ User::LeaveIfError( iWsSession.Connect() );
+ User::LeaveIfError( iTimer.CreateLocal() );
+ CActiveScheduler::Add( this );
+ }
+
+// ----------------------------------------------------------------------------
+// void CPointerEventHandler::SetDispatcher()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+ {
+ iDispatcher = aDispatcher;
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::RunL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::RunL()
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::RunL" );
+
+ if ( iCommand == ETapScreen || iCommand == EAdvancedTapScreen )
+ {
+ ChangePointerStateL();
+ }
+
+ else if ( iCommand == ETapAndDrag && iState == EPointerDown )
+ {
+ PointerMove();
+ PointerUp();
+ SendOkMsgL();
+ iReady = ETrue;
+ }
+
+ else if ( iCommand == ETapAndDragMultipoint )
+ {
+ if ( iState == EPointerUp ) // Starting a new line
+ {
+ PointerDown();
+ iTapCount--;
+ iTimer.After( iStatus, iEventDelay );
+ SetActive();
+ }
+ else
+ {
+ MoveToNextPointL(); // Continuing current line
+ }
+ }
+
+ else if ( iCommand == EPinchZoom )
+ {
+ PointerMove();
+ if ( !AdvancedStartDelay())
+ {
+ PointerUp();
+ SendOkMsgL();
+ iAdvPointerMoveArray.ResetAndDestroy();
+ iReady = ETrue;
+ }
+ }
+
+ else if ( iCommand == EMultiTouch )
+ {
+ SendOkMsgL();
+ iMultiTouchHandler->Clear();
+ iReady = ETrue;
+ }
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::RunL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::RunError()
+// ----------------------------------------------------------------------------
+TInt CPointerEventHandler::RunError( TInt aError )
+ {
+ HTI_LOG_FORMAT( "CPointerEventHandler::RunError %d", aError );
+
+ TInt dispatchResult = KErrNone;
+ TRAP( dispatchResult, SendErrorMessageL( aError, KErrorInternalFailure ) );
+ if ( dispatchResult != KErrNone )
+ {
+ HTI_LOG_FORMAT( "CPointerEventHandler::RunError: Failed to send error report to framework: %d.", dispatchResult );
+ }
+ iReady = ETrue;
+ return KErrNone;
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::DoCancel()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::DoCancel()
+ {
+ iTimer.Cancel();
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::ProcessMessageL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/ )
+ {
+ HTI_LOG_FUNC_IN("CPointerEventHandler::ProcessMessageL");
+ HTI_LOG_FORMAT("Msg len: %d.", aMessage.Length());
+
+ if ( !iReady )
+ {
+ SendErrorMessageL( ENotReadyCommand, KErrorServiceNotReady );
+ return;
+ }
+ if ( aMessage.Length() == 0 )
+ {
+ SendErrorMessageL( EMissingCommand, KErrorMissingCommand );
+ return;
+ }
+
+ User::ResetInactivityTime();
+ iCommand = aMessage.Ptr()[0];
+ switch ( iCommand )
+ {
+ case ETapScreen:
+ HandleTapScreenL( aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+ case ETapAndDrag:
+ HandleTapAndDragL( aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+ case ETapAndDragMultipoint:
+ HandleTapAndDragMultipointL(
+ aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+ case EPressPointerDown:
+ case ELiftPointerUp:
+ HandlePointerDownOrUpL( aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+ case EAdvancedTapScreen:
+ HandleAdvancedTapScreenL( aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+ case EPinchZoom:
+ HandlePinchZoomL( aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+ case EMultiTouch:
+ HandleMultiTouchL(aMessage.Right( aMessage.Length() - 1 ));
+ break;
+ default:
+ SendErrorMessageL( EUnrecognizedCommand,
+ KErrorUnrecognizedCommand );
+ break;
+ }
+
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::ProcessMessageL: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::HandleTapScreenL()
+// Handles single or multiple taps to one point.
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::HandleTapScreenL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::HandleTapScreenL" );
+
+ if ( aData.Length() != KTapCmdLength )
+ {
+ SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+ return;
+ }
+
+ // Parse the parameters - correct length is already verified
+ TInt offset = 0;
+ iX = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "X coord = %d", iX );
+ iY = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Y coord = %d", iY );
+ iEventDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+ offset += 2;
+ HTI_LOG_FORMAT( "Time to hold down = %d", iEventDelay.Int() );
+ iTapCount = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Tap count = %d", iTapCount );
+ iActionDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+ HTI_LOG_FORMAT( "Pause between taps = %d", iActionDelay.Int() );
+
+ // Start tapping
+ iReady = EFalse;
+ ChangePointerStateL();
+
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandleTapScreenL" );
+ }
+
+
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::HandleTapAndDragL()
+// Handles a single drag and drop with straight line.
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::HandleTapAndDragL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::HandleTapAndDragL" );
+
+ if ( aData.Length() != KTapCmdLength )
+ {
+ SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+ return;
+ }
+
+ TInt offset = 0;
+ iX = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "X coord down = %d", iX );
+ iY = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Y coord down = %d", iY );
+ TInt xUp = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "X coord up = %d", xUp );
+ TInt yUp = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Y coord up = %d", yUp );
+ iEventDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+ HTI_LOG_FORMAT( "Drag time = %d", iEventDelay.Int() );
+
+ iReady = EFalse;
+ PointerDown();
+ iX = xUp;
+ iY = yUp;
+ iTimer.After( iStatus, iEventDelay );
+ SetActive();
+
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandleTapAndDragL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::HandleTapAndDragMultipointL()
+// Handles drawing one or more curvy lines.
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::HandleTapAndDragMultipointL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::HandleTapAndDragMultipointL" );
+
+ TInt dataLength = aData.Length();
+ if ( dataLength < KDragMultiCmdMinLength || dataLength % 2 != 0 )
+ {
+ SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+ return;
+ }
+
+ TInt offset = 0;
+ iEventDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+ offset += 2;
+ HTI_LOG_FORMAT( "Time between events = %d", iEventDelay.Int() );
+ iActionDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+ offset += 2;
+ HTI_LOG_FORMAT( "Pause between lines = %d", iActionDelay.Int() );
+
+ if ( iCoords == NULL )
+ {
+ iCoords = new ( ELeave ) RArray<TInt>();
+ }
+ iCoords->Reset();
+
+ // Read integers from aData to the array, all integers are 2 bytes
+ while ( offset < dataLength )
+ {
+ iCoords->AppendL( aData[offset] + ( aData[offset + 1] << 8 ) );
+ offset += 2;
+ }
+
+ iReady = EFalse;
+ iTapCount = ( *iCoords )[0];
+ iCoords->Remove( 0 );
+ iX = ( *iCoords )[0];
+ iCoords->Remove( 0 );
+ iY = ( *iCoords )[0];
+ iCoords->Remove( 0 );
+ HTI_LOG_FORMAT( "Point count for first line = %d", iTapCount );
+ PointerDown();
+ iTapCount--;
+ iTimer.After( iStatus, iEventDelay );
+ SetActive();
+
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandleTapAndDragMultipointL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::HandlePointerDownOrUpL()
+// Handles pushing pointer down in one point or lifting it up.
+// This is synchronous operation and sends OK message right after the event
+// is simulated.
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::HandlePointerDownOrUpL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::HandlePointerDownOrUpL" );
+ if ( aData.Length() != KSinglePointerCmdLength )
+ {
+ SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+ return;
+ }
+
+ // Parse the parameters - correct length is already verified
+ TInt offset = 0;
+ iX = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "X coord = %d", iX );
+ iY = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Y coord = %d", iY );
+
+ if ( iCommand == EPressPointerDown )
+ {
+ PointerDown();
+ }
+ else
+ {
+ PointerUp();
+ }
+ SendOkMsgL();
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandlePointerDownOrUpL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::ChangePointerStateL()
+// Decides whether to do "pointer down" or "pointer up" event next or if
+// operation is complete.
+// This function is used by ETapScreen command.
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::ChangePointerStateL()
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::ChangePointerStateL" );
+ HTI_LOG_FORMAT( "Taps remaining = %d", iTapCount );
+ if ( iTapCount < 1 )
+ {
+ SendOkMsgL();
+ iReady = ETrue;
+ return;
+ }
+
+ if ( iState == EPointerUp )
+ {
+ PointerDown();
+ iTimer.After( iStatus, iEventDelay );
+ SetActive();
+ }
+ else if ( iState == EPointerDown )
+ {
+ PointerUp();
+ iTapCount--; // one tap done
+ if ( iTapCount > 0 ) // do we continue tapping?
+ {
+ iTimer.After( iStatus, iActionDelay );
+ SetActive();
+ }
+ else
+ {
+ SendOkMsgL(); // tapping done
+ iReady = ETrue;
+ }
+ }
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::ChangePointerStateL" );
+ }
+
+ // ----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::HandleAdvancedTapScreenL()
+// ****cherry.
+// ----------------------------------------------------------------------------
+
+void CPointerEventHandler::HandleAdvancedTapScreenL( const TDesC8& aData )
+ {
+
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::HandleAdvancedTapScreenL" );
+
+ if ( aData.Length() < KAdvancedTapScreenCmdMinLength ) //KAdvancedTapScreenCmdMinLength needs to be defined
+ {
+ SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+ return;
+ }
+ TInt dataLength = aData.Length();
+
+ // Parse the parameters - correct length is already verified
+ TInt offset = 0;
+
+ iEventDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+ offset += 2;
+ HTI_LOG_FORMAT( "Time to hold down = %d", iEventDelay.Int() );
+ iTapCount = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Tap count = %d", iTapCount );
+ iActionDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+ offset += 2;
+ HTI_LOG_FORMAT( "Pause between taps = %d", iActionDelay.Int() );
+ TInt pointerCount = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Pointer Count = %d", pointerCount );
+
+ iAdvancedPointers.ResetAndDestroy();
+
+ // Read integers from aData to the array, all integers are 2 bytes
+ for ( TInt i = 0; i < pointerCount; i++ )
+ {
+ TAdvancedPointer* advancedPointer = new (ELeave) TAdvancedPointer;
+
+ advancedPointer->PointerNum = aData[offset];
+ offset += 1;
+ HTI_LOG_FORMAT( "%d Pointer", advancedPointer->PointerNum );
+
+ advancedPointer->X = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "X coord down = %d", advancedPointer->X );
+
+ advancedPointer->Y = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Y coord down = %d", advancedPointer->Y );
+
+ advancedPointer->Z = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Z coord down = %d", advancedPointer->Z );
+
+ iAdvancedPointers.AppendL( advancedPointer );
+ }
+
+ // Start tapping
+ iReady = EFalse;
+ ChangePointerStateL();
+
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandleAdvancedTapScreenL" );
+
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::HandlePinchZoomL()
+// ****cherry
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::HandlePinchZoomL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::HandlePinchZoomL" );
+
+ if ( aData.Length() < KPinchZoomCmdMinLength ) //KPinchZoomCmdMinLength needs to be defined
+ {
+ SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+ return;
+ }
+ TInt dataLength = aData.Length();
+
+ // Parse the parameters - correct length is already verified
+ TInt offset = 0;
+
+ TTimeIntervalMicroSeconds32 eventDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+ offset += 2;
+ HTI_LOG_FORMAT( "Event time = %d", eventDelay.Int() );
+
+ if (eventDelay.Int()<=0)
+ {
+ SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+ return;
+ }
+
+ TInt stepCount = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Step Count = %d", stepCount );
+
+ TInt pointerCount = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Pointer Count = %d", pointerCount );
+
+ iAdvPointerMoveArray.ResetAndDestroy();
+
+ // Read integers from aData to the array, all integers are 2 bytes
+ for ( TInt i = 0; i < pointerCount; i++ )
+ {
+ TInt pointNumber,X1, Y1, Z1,X2,Y2, Z2 ;
+
+ // invalid pointer array
+ if ((dataLength-offset)<3*2*2+1)
+ {
+ SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+ return;
+ }
+ // start point
+ pointNumber = aData[offset];
+ offset += 1;
+ HTI_LOG_FORMAT( "%d Pointer Start", pointNumber );
+
+ X1 = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "X coord down = %d", X1 );
+
+ Y1 = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Y coord down = %d", Y1 );
+
+ Z1 = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Z coord down = %d", Z1 );
+
+ // end point
+ X2 = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "X coord down = %d", X2 );
+
+ Y2 = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Y coord down = %d", Y2 );
+
+ Z2 = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Z coord down = %d", Z2 );
+
+ AdvanceAddMiddlePointL(pointNumber,X1, Y1, Z1,X2,Y2, Z2,stepCount );
+
+ }
+
+ AdvancedAddDelayArray(eventDelay,stepCount);
+
+ iReady = EFalse;
+ PointerDown();
+
+ if (!AdvancedStartDelay())
+ {
+ SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+ return;
+ }
+
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandlePinchZoomL" );
+ }
+// ----------------------------------------------------------------------------
+// void CPointerEventHandler::HandleMultiTouchL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::HandleMultiTouchL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::HandleMultiTouchL" );
+
+ if (iMultiTouchHandler == NULL)
+ iMultiTouchHandler=CMultiTouchPointerEventHandler::NewL(*this);
+
+ if ( !iMultiTouchHandler->HandleMultiTouchL ( aData ) )
+ {
+ iMultiTouchHandler->Clear();
+ SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+ }
+ else
+ iReady = EFalse;
+
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandleMultiTouchL" );
+ }
+// ----------------------------------------------------------------------------
+// void CPointerEventHandler::NotifyMultiTouchComplete()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::NotifyMultiTouchComplete()
+ {
+ HTI_LOG_FUNC_IN("CPointerEventHandler::NotifyMultiTouchComplete");
+
+ // wait for 1000 microsecond then clear multi touch and send ok msg
+ TTimeIntervalMicroSeconds32 time(1000);
+ iTimer.After( iStatus, time );
+ SetActive();
+
+ HTI_LOG_FUNC_OUT("CPointerEventHandler::NotifyMultiTouchComplete");
+ }
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::AdvancedStartDelay()
+// ----------------------------------------------------------------------------
+TBool CPointerEventHandler::AdvancedStartDelay()
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::AdvancedStartDelay" );
+ TBool ret=EFalse;
+ if (iDelayArray.Count()>0)
+ {
+ TTimeIntervalMicroSeconds32* time=iDelayArray[0];
+ iDelayArray.Remove(0);
+ ret=ETrue;
+
+ iTimer.After( iStatus, *time );
+ delete time;
+ SetActive();
+ }
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::AdvancedStartDelay" );
+ return ret;
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::AdvanceAddMiddlePointL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::AdvanceAddMiddlePointL(TInt aPointNumber,TInt aX1,TInt aY1, TInt aZ1,
+ TInt aX2,TInt aY2, TInt aZ2 , TInt aStepCount )
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::AdvanceAddMiddlePointL" );
+ TInt dx=(aX2-aX1)/aStepCount;
+ TInt dy=(aY2-aY1)/aStepCount;
+
+ for (TInt i=0;i<=aStepCount+1;i++)
+ {
+ TAdvancedPointer* point = new (ELeave) TAdvancedPointer;
+ CleanupStack::PushL(point);
+ iAdvPointerMoveArray.AppendL(point);
+ CleanupStack::Pop();
+
+ point->PointerNum=aPointNumber;
+ if (i<aStepCount)
+ {
+ point->X=aX1+i*dx;
+ point->Y=aY1+i*dy;
+ point->Z=aZ1;
+ }
+ else
+ {
+ point->X=aX2;
+ point->Y=aY2;
+ point->Z=aZ2;
+ }
+
+ }
+
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::AdvanceAddMiddlePointL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::AdvancedAddDelayArray()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::AdvancedAddDelayArray(TTimeIntervalMicroSeconds32 aDelay , TInt aStepCount )
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::AdvancedAddDelayArray" );
+
+ TInt interval=aDelay.Int()/aStepCount;
+ iDelayArray.ResetAndDestroy();
+
+ for (TInt i=0;i<aStepCount;i++)
+ {
+ TTimeIntervalMicroSeconds32* time = new (ELeave) TTimeIntervalMicroSeconds32(interval);
+ CleanupStack::PushL(time);
+ iDelayArray.AppendL(time);
+ CleanupStack::Pop(time);
+ }
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::AdvancedAddDelayArray" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::MoveToNextPointL()
+// Takes the next point from the coordinate array and initiates pointer moving
+// to that point.
+// This function is used by ETapAndDragMultipoint command and called from
+// the RunL().
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::MoveToNextPointL()
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::MoveToNextPointL" );
+ HTI_LOG_FORMAT( "Points remaining for this line = %d", iTapCount );
+
+ if ( iTapCount == 0 ) // End of current line
+ {
+ PointerUp();
+ if ( iCoords->Count() < 5 ) // point count & at least 2 points
+ {
+ // This was the last line, we are done
+ SendOkMsgL();
+ iReady = ETrue;
+ }
+ else
+ {
+ // New line starts: take the point count of this line and
+ // first coordinates.
+ iTapCount = ( *iCoords )[0];
+ iCoords->Remove( 0 );
+ iX = ( *iCoords )[0];
+ iCoords->Remove( 0 );
+ iY = ( *iCoords )[0];
+ iCoords->Remove( 0 );
+ HTI_LOG_FORMAT( "Point count for new line = %d", iTapCount );
+ iTimer.After( iStatus, iActionDelay );
+ SetActive();
+ }
+ }
+
+ else // Current line continues: take next point coords and move
+ {
+ iX = ( *iCoords )[0];
+ iCoords->Remove( 0 );
+ iY = ( *iCoords )[0];
+ iCoords->Remove( 0 );
+ PointerMove();
+ iTapCount--;
+ iTimer.After( iStatus, iEventDelay );
+ SetActive();
+ }
+
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::MoveToNextPointL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::PointerDown()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::PointerDown()
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::PointerDown" );
+ SimulatePointerEvent( TRawEvent::EButton1Down );
+ iState = EPointerDown;
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::PointerDown" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::PointerUp()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::PointerUp()
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::PointerUp" );
+ SimulatePointerEvent( TRawEvent::EButton1Up );
+ iState = EPointerUp;
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::PointerUp" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::PointerMove()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::PointerMove()
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::PointerMove" );
+ SimulatePointerEvent( TRawEvent::EPointerMove );
+ iState = EPointerMoving;
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::PointerMove" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::SimulatePointerEvent()
+// Sends the pointer event as a raw event.
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::SimulatePointerEvent( TRawEvent::TType aType )
+ {
+ HTI_LOG_FUNC_IN( "CPointerEventHandler::SimulatePointerEvent" );
+
+ TRawEvent rawEvent;
+
+ if ( iCommand == EAdvancedTapScreen )
+ {
+ TInt i;
+ for ( i = 0; i < iAdvancedPointers.Count(); i++ )
+ {
+ rawEvent.SetPointerNumber( iAdvancedPointers[i]->PointerNum );
+ rawEvent.Set( aType, iAdvancedPointers[i]->X, iAdvancedPointers[i]->Y, iAdvancedPointers[i]->Z);
+ iWsSession.SimulateRawEvent( rawEvent );
+ }
+ }
+ else if ( iCommand == EPinchZoom )
+ {
+ TInt i,index,pointnum=-1;
+ RPointerArray<TAdvancedPointer> array;
+ for ( i = 0; i < iAdvPointerMoveArray.Count(); i++ )
+ {
+ TAdvancedPointer* point=iAdvPointerMoveArray[i];
+ if (point->PointerNum!=pointnum)
+ {
+ pointnum=point->PointerNum;
+ rawEvent.SetPointerNumber( point->PointerNum );
+ rawEvent.Set( aType, point->X, point->Y, point->Z);
+ iWsSession.SimulateRawEvent( rawEvent );
+
+ HTI_LOG_FORMAT( "SimulateAdvanced event=%d ", aType );
+ HTI_LOG_FORMAT( "SimulateAdvanced PointerNum=%d", point->PointerNum );
+ HTI_LOG_FORMAT( "SimulateAdvanced X=%d ", point->X );
+ HTI_LOG_FORMAT( "SimulateAdvanced Y=%d ", point->Y );
+ HTI_LOG_FORMAT( "SimulateAdvanced Z=%d", point->Z );
+
+ array.Append(point);
+ }
+ }
+ for (i=0;i<array.Count();i++)
+ {
+ index=iAdvPointerMoveArray.Find(array[i]);
+ if (index!=KErrNotFound)
+ iAdvPointerMoveArray.Remove(index);
+ }
+ array.ResetAndDestroy();
+ }
+ else
+ {
+ rawEvent.Set( aType, iX, iY );
+ iWsSession.SimulateRawEvent( rawEvent );
+ }
+
+ iWsSession.Flush();
+ HTI_LOG_FUNC_OUT( "CPointerEventHandler::SimulatePointerEvent" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::IsMultitouch()
+// ----------------------------------------------------------------------------
+TBool CPointerEventHandler::IsMultitouch()
+ {
+ HTI_LOG_FUNC_IN("CPointerEventHandler::IsMultitouch");
+ TBool isMultitouch = EFalse;
+ if ( iCommand == EAdvancedTapScreen || iCommand == EPinchZoom )
+ {
+ isMultitouch = ETrue;
+ }
+ HTI_LOG_FUNC_OUT("CPointerEventHandler::IsMultitouch");
+ return isMultitouch;
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::SendOkMsgL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::SendOkMsgL()
+ {
+ HTI_LOG_FUNC_IN("CPointerEventHandler::SendOkMsgL");
+
+ User::LeaveIfNull( iDispatcher );
+ TBuf8<1> response;
+ response.Append( EResultOk );
+ HBufC8* respH8 = response.AllocL();
+ User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+ respH8, KKeyEventServiceUid ) );
+
+ HTI_LOG_FUNC_OUT("CPointerEventHandler::SendOkMsgL");
+ }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::SendErrorMessageL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::SendErrorMessageL(
+ TInt aError, const TDesC8& aDescription )
+ {
+ HTI_LOG_FUNC_IN("CPointerEventHandler::SendErrorMessageL");
+ User::LeaveIfNull( iDispatcher );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+ aError, aDescription, KKeyEventServiceUid ) );
+ HTI_LOG_FUNC_OUT("CPointerEventHandler::SendErrorMessageL");
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/proxy.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation proxy for key event service plugin dll
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY(0x1020DEC1, CHtiKeyEventServicePlugin::NewL)
+ };
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+ {
+ aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+ return ImplementationTable;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/data/200212C5.rss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource definitions for Message management (inbox, etc)
+* service ECOM plugin.
+*
+*/
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+
+
+// RESOURCE DEFINITIONS
+RESOURCE REGISTRY_INFO theInfo
+ {
+ // UID for the DLL
+ dll_uid = 0x200212C5;
+ // Declare array of interface info
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // UID of interface that is implemented
+ interface_uid = 0x1020DEB7;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x200212C6;
+ version_no = 1;
+ display_name = "Message management service (inbox etc.)";
+ default_data = "MessageMgmnt";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/group/HtiMessagesServicePlugin.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECOM implementation of HtiMessagesServicePlugin service
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET HtiMessagesServicePlugin.dll
+TARGETTYPE PLUGIN
+
+UID 0x10009D8D 0x200212C5
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
+
+SOURCEPATH ../src
+SOURCE proxy.cpp
+SOURCE HtiMessagesServicePlugin.cpp
+SOURCE MessageMgmntHandler.cpp
+SOURCE HtiIAPHandler.cpp
+SOURCE HtiMailboxHandler.cpp
+SOURCE HtiMsgSettingsHandler.cpp
+
+USERINCLUDE ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE ../data/200212C5.rss
+TARGET HtiMessagesServicePlugin.rsc
+END
+
+LIBRARY apgrfx.lib
+LIBRARY apmime.lib
+LIBRARY bafl.lib
+LIBRARY centralRepository.lib
+LIBRARY charconv.lib
+LIBRARY cmmanager.lib
+LIBRARY connmon.lib
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+LIBRARY gsmu.lib
+LIBRARY imcm.lib
+LIBRARY msgs.lib
+LIBRARY smcm.lib
+LIBRARY etel.lib
+LIBRARY etelmm.lib
+LIBRARY etext.lib
+LIBRARY mmsserversettings.lib
+LIBRARY flogger.lib
+
+SMPSAFE
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for HtiMessagesServicePlugin
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiMessagesServicePlugin.mmp
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiIAPHandler.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HTI Internet Access Point handler.
+*
+*/
+
+
+#ifndef CHTIIAPHANDLER_H
+#define CHTIIAPHANDLER_H
+
+
+// INCLUDES
+#include <cmpsettingsconsts.h>
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+enum TApFieldDataType
+ {
+ EDataTypeText,
+ EDataTypeBool,
+ EDataTypeUint,
+ EDataTypeText8,
+ EDataTypeUnknown
+ };
+
+struct TApField
+ {
+ TInt iId;
+ HBufC* iData;
+ TApFieldDataType iDataType;
+ };
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+* HTI Internet Access Point handler.
+*/
+class CHtiIAPHandler : public CBase
+ {
+ public:
+ enum TLegacyApFieldCodes
+ {
+ EApWapStartPage = 3,
+ EApIspDefaultTelNumber = 18,
+ EApIspUseLoginScript = 20,
+ EApIspLoginScript = 21,
+ EApIspLoginName = 23,
+ EApIspLoginPass = 24,
+ EApIspIfPromptForAuth = 29,
+ EApIspIfCallbackEnabled = 33,
+ EApIspIfCallbackType = 34,
+ EApIspIfCallbackInfo = 35,
+ EApIspIPAddr = 38,
+ EApIspIPNameServer1 = 42,
+ EApIspIPNameServer2 = 43,
+ EApIspEnableIpHeaderComp = 44,
+ EApIspDisablePlainTextAuth = 46,
+ EApIspBearerSpeed = 49,
+ EApIspBearerCallTypeIsdn = 50,
+ EApIspInitString = 52,
+ EApGprsAccessPointName = 58,
+ EApGprsPdpType = 59,
+ EApProxyServerAddress = 91,
+ EApProxyPortNumber = 93,
+ EApIP6NameServer1 = 104,
+ EApIP6NameServer2 = 105,
+ EApWlanNetworkName = 163,
+ EApWlanNetworkMode = 164,
+ EApWlanSecurityMode = 165,
+
+ // new fields that do not exist in legacy TApMember enum
+ EApSeamlessnessLevel = 200
+ };
+
+ /**
+ * Two-phased constructor.
+ */
+ static CHtiIAPHandler* NewL();
+
+ /**
+ * Called when there is a message to be processed by this service.
+ * @param aMessage message body destinated to the servive
+ * @param aPriority message priority
+ */
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CHtiIAPHandler();
+
+ /**
+ * Sets the dispatcher to send outgoing messages to.
+ * @param aDispatcher pointer to dispatcher instance
+ */
+ void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CHtiIAPHandler();
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ private: // helpers
+
+ void HandleCreateIapL( const TDesC8& aData );
+ void HandleDeleteIapL( const TDesC8& aData );
+ void HandleCreateDestinationL( const TDesC8& aData );
+ void HandleDeleteDestinationL( const TDesC8& aData );
+ void ModifyDestinationL( const TInt aCommand, const TDesC8& aData );
+ void SetDefaultConnectionL( const TDesC8& aData );
+
+ void ParseCreateMessageL( const TDesC8& aData );
+ TInt GetAccessPointUIDL();
+ TInt GetDestinationIDL( const TDesC& aName );
+ void CloseActiveConnectionsL();
+
+ TUint GetBearerUID( const TInt aBearerType );
+ void MapLegacyFieldIDs();
+ void ResolveFieldDataTypes();
+
+ void SendOkMsgL( const TDesC8& aData );
+ void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+ private: // Data
+
+ // Pointer to the dispatcher (referenced)
+ MHtiDispatcher* iDispatcher; // referenced
+
+ // Name of the connection to create/delete
+ TBuf<KMaxConnNameLength> iConnName;
+ TBuf<KMaxConnNameLength> iDestName;
+
+ // The type of Access Point to create
+ TUint iBearerType;
+
+ // The fields to add to the Access Point
+ RArray<TApField> iFields;
+
+ };
+
+#endif // CHTIIAPHANDLER_H
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMailboxHandler.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HTI Mailbox settings handler.
+*
+*/
+
+
+#ifndef HTIMAILBOXHANDLER_H_
+#define HTIMAILBOXHANDLER_H_
+
+// INCLUDES
+#include <cmmanager.h>
+#include <msvapi.h>
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class TSmtpAccount;
+
+// CLASS DECLARATION
+/**
+* HTI Mailbox settings handler.
+*/
+class CHtiMailboxHandler : public CBase,
+ public MMsvSessionObserver
+ {
+ public:
+
+ /**
+ * Two-phased constructor.
+ */
+ static CHtiMailboxHandler* NewL();
+
+ /**
+ * Called when there is a message to be processed by this service.
+ * @param aMessage message body destinated to the servive
+ * @param aPriority message priority
+ */
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CHtiMailboxHandler();
+
+ /**
+ * Sets the dispatcher to send outgoing messages to.
+ * @param aDispatcher pointer to dispatcher instance
+ */
+ void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CHtiMailboxHandler();
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ private: // helpers
+
+ void HandleCreateMailboxL( const TDesC8& aData );
+ void HandleDeleteMailboxL( const TDesC8& aData );
+ void ParseCreateMsgL( const TDesC8& aData );
+ HBufC* ParseStringL( const TDesC8& aData, TInt aStrLenOffset,
+ TInt aStrLenBytes = 1 );
+ HBufC8* ParseString8L( const TDesC8& aData, TInt aStrLenOffset,
+ TInt aStrLenBytes = 1 );
+ TInt AccessPointUIDL( const TDesC& aApName );
+ TInt FindSmtpAccount( const TDesC& aAccountName,
+ TSmtpAccount& aAccount );
+ void GetDeviceImeiL( TDes& aResult );
+ void ResetVariables();
+ void SendOkMsgL( const TDesC8& aData );
+ void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+ private: // from MMsvSessionObserver
+
+ void HandleSessionEventL( TMsvSessionEvent aEvent,
+ TAny* aArg1, TAny* aArg2, TAny* aArg3 );
+
+ private: // Data
+
+ // Pointer to the dispatcher (referenced)
+ MHtiDispatcher* iDispatcher;
+
+ // Handle to connection manager
+ RCmManager iCmManager;
+
+ // Email account settings
+ TInt iMailboxType;
+ HBufC* iMailboxName;
+ HBufC* iIncomingServer;
+ HBufC* iIncomingApName;
+ HBufC8* iIncomingUserName;
+ HBufC8* iIncomingPassword;
+ TInt iIncomingSecurity;
+ TInt iIncomingPort;
+ TBool iAPopSecureLogin;
+ HBufC* iOutgoingServer;
+ HBufC* iOutgoingApName;
+ HBufC8* iOutgoingUserName;
+ HBufC8* iOutgoingPassword;
+ TInt iOutgoingSecurity;
+ TInt iOutgoingPort;
+ HBufC* iOwnMailAddress;
+ HBufC* iOwnName;
+ TInt iSendOption; // (enum TImSMTPSendMessageOption)
+ TInt iSendCopyToOwnAddress; // (enum TImSMTPSendCopyToSelf)
+ HBufC* iSignatureText;
+ TBool iNewMailIndicators;
+ TInt iRetrievedParts;
+ TInt iRetrieveSizeLimitKb;
+ TInt iEmailsToRetrieve;
+ HBufC8* iImapFolderPath;
+ TInt iAutomaticUpdate;
+ TBool iSetAsDefault;
+ };
+
+#endif // HTIMAILBOXHANDLER_H_
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMessagesServicePlugin.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of ECOM plug-in service interface. Provides
+* HtiMessagesServicePlugin service.
+*
+*/
+
+
+#ifndef CHTIMESSAGESSERVICEPLUGIN_H
+#define CHTIMESSAGESSERVICEPLUGIN_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+const TInt KHtiMessagesServiceUidValue = 0x10210CCF; // ECOM Implementation UID
+const TUid KHtiMessagesServiceUid = {KHtiMessagesServiceUidValue};
+
+// FORWARD DECLARATIONS
+class CMessageMgmntHandler;
+class CHtiIAPHandler;
+class CHtiMailboxHandler;
+class CHtiMsgSettingsHandler;
+
+// CLASS DECLARATION
+
+/**
+* Implementation of ECOM plug-in service interface.
+*/
+class CHtiMessagesServicePlugin : public CHTIServicePluginInterface
+ {
+public:
+
+ enum TCommand
+ {
+ // MessagesMgmntHandler
+ EAddSms = 0x01,
+ EAddMms = 0x02,
+ EAddEmail = 0x03,
+ EAddIrMsg = 0x04,
+ EAddBtMsg = 0x05,
+ EAddSmartMsg = 0x06,
+ EAddAudioMsg = 0x07,
+ EDeleteMessage = 0x10,
+ EDeleteFolderContent = 0x11,
+
+ // MailboxHandler
+ ECreateMailBox = 0x20,
+ EDeleteMailBox = 0x21,
+
+ // IAPHandler
+ ECreateIAP = 0x30,
+ EDeleteIAP = 0x31,
+ ECreateDestination = 0x32,
+ EDeleteDestination = 0x33,
+ EAddToDestination = 0x34,
+ ERemoveFromDestination = 0x35,
+ ESetDefaultConnection = 0x36,
+
+ // MgsSettingsHandler
+ ESetDefaultSmsCenter = 0x40,
+ EDeleteSmsCenter = 0x41,
+ ESetSmsSettings = 0x42,
+ ESetMmsSettings = 0x45,
+
+ // only for response message
+ EResultOk = 0xFF,
+ };
+
+ static CHtiMessagesServicePlugin* NewL();
+
+ // Interface implementation
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+protected:
+
+ CHtiMessagesServicePlugin();
+ void ConstructL();
+
+ virtual ~CHtiMessagesServicePlugin();
+
+private:
+
+ CMessageMgmntHandler* iMessageHandler;
+ CHtiIAPHandler* iIAPHandler;
+ CHtiMailboxHandler* iMailboxHandler;
+ CHtiMsgSettingsHandler* iMsgSettingsHandler;
+ };
+
+#endif // CHTIMESSAGESSERVICEPLUGIN_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMsgSettingsHandler.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HTI message settings handler.
+*
+*/
+
+
+#ifndef CHTIMSGSETTINGSHANDLER_H
+#define CHTIMSGSETTINGSHANDLER_H
+
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+* HTI Internet Access Point handler.
+*/
+class CHtiMsgSettingsHandler : public CBase
+ {
+ public:
+
+ /**
+ * Character support settings values.
+ */
+ enum TCharSetSupport
+ {
+ ECharSetFull,
+ ECharSetReduced,
+ ECharSetFullLocked,
+ ECharSetReducedLocked
+ };
+
+ /**
+ * Two-phased constructor.
+ */
+ static CHtiMsgSettingsHandler* NewL();
+
+ /**
+ * Called when there is a message to be processed by this service.
+ * @param aMessage message body destinated to the servive
+ * @param aPriority message priority
+ */
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CHtiMsgSettingsHandler();
+
+ /**
+ * Sets the dispatcher to send outgoing messages to.
+ * @param aDispatcher pointer to dispatcher instance
+ */
+ void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CHtiMsgSettingsHandler();
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ private: // helpers
+
+ void HandleSetDefaultSmsCenterL( const TDesC8& aData );
+ void HandleDeleteSmsCenterL( const TDesC8& aData );
+ void HandleSetSmsSettingsL( const TDesC8& aData );
+
+ void HandleSetMmsSettingsL( const TDesC8& aData );
+
+ TInt GetAccessPointUIDL( const TDesC& aApName );
+ void SendOkMsgL( const TDesC8& aData );
+ void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+ private: // Data
+
+ // Pointer to the dispatcher (referenced)
+ MHtiDispatcher* iDispatcher; // referenced
+ };
+
+
+#endif // CHTIMSGSETTINGSHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/MessageMgmntHandler.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Functional implentation of message management service.
+*
+*/
+
+
+#ifndef CHTIMESSAGESSERVICEPLUGINHANDLER_H
+#define CHTIMESSAGESSERVICEPLUGINHANDLER_H
+
+
+// INCLUDES
+#include <msvapi.h>
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CClientMtmRegistry;
+
+// CLASS DECLARATION
+/**
+* Functional implentation of message management service.
+*/
+class CMessageMgmntHandler : public CBase,
+ public MMsvSessionObserver
+ {
+public:
+
+ static CMessageMgmntHandler* NewL();
+
+ // Interface implementation
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+ virtual ~CMessageMgmntHandler();
+
+ void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+ enum TFolder
+ {
+ EAllFolders = 0x00,
+ EInbox,
+ EDrafts,
+ ESent,
+ EOutbox,
+ ENumberOfFolders, // this must always be the last one
+ };
+
+ enum TMessageType
+ {
+ EAllMessageTypes = 0x00,
+ ESMS,
+ EMMS,
+ ESmartMessage,
+ EEmail,
+ EIrMessage,
+ EBtMessage,
+ EAudioMessage,
+ EEmailPOP3,
+ EEmailIMAP4,
+ ENumberOfMessageTypes, // this must always be the last one
+ };
+
+private:
+
+ CMessageMgmntHandler();
+ void ConstructL();
+
+private: // helpers
+
+ void HandleCreateSmsL( const TDesC8& aData );
+ void HandleCreateMmsL( const TDesC8& aData );
+ void HandleCreateEmailL( const TDesC8& aData );
+ void HandleCreateObexMsgL( const TDesC8& aData, TUid aMtmUid, TUid aMsgTypeUid );
+ void HandleCreateSmartMsgL( const TDesC8& aData );
+
+ void HandleDeleteMessageL( const TDesC8& aData );
+ void HandleDeleteMessagesL( const TDesC8& aData );
+ void HandleDeleteFromAllFoldersL( TMessageType aType );
+ void HandleDeleteAllMessageTypesL( TFolder aFolder );
+ void HandleDeleteFromFolderByTypeL( TFolder aFolder, TMessageType aType );
+
+ void SendOkMsgL( const TDesC8& aData );
+ void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+ TBool ValidateAddSmsCommand( const TDesC8& aData );
+ TBool ValidateAddMmsOrAddEmailCommand( const TDesC8& aData );
+ TBool ValidateAddObexMsgCommand( const TDesC8& aData );
+ TBool ValidateAddSmartMsgCommand( const TDesC8& aData );
+
+ HBufC16* ExtractDesLC( const TDesC8& aUtf8Data, TInt& aPosition, TInt aSizeBytes );
+ HBufC8* ExtractDes8LC( const TDesC8& aUtf8Data, TInt& aPosition, TInt aSizeBytes );
+ TMsvId MapFolderToIdL( TFolder aFolder );
+ TUid MapMessageTypeToUidL( TMessageType aType );
+
+private: // from MMsvSessionObserver
+
+ void HandleSessionEventL( TMsvSessionEvent aEvent,
+ TAny* aArg1,
+ TAny* aArg2,
+ TAny* aArg3 );
+
+private:
+
+ MHtiDispatcher* iDispatcher; // referenced
+ CMsvSession* iSession;
+ CClientMtmRegistry* iMtmReg;
+ };
+
+
+
+// CLASS DECLARATION
+/**
+* Helper class to wait the async requests.
+*/
+class CWaiter : public CActive
+ {
+public:
+ static CWaiter* NewL( TInt aPriority = EPriorityStandard );
+ static CWaiter* NewLC( TInt aPriority = EPriorityStandard );
+ ~CWaiter();
+
+ void StartAndWait();
+ TInt Result() const;
+
+private:
+ CWaiter( TInt aPriority );
+
+ // from CActive
+ void RunL();
+ void DoCancel();
+
+private:
+ CActiveSchedulerWait iWait;
+ TInt iResult;
+ };
+
+#endif // CHTIMESSAGESSERVICEPLUGINHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiIAPHandler.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,1446 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of internet access point handling.
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiMessagesServicePlugin.h"
+#include "HtiIAPHandler.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+#include <cmconnectionmethodext.h>
+#include <cmconnectionmethoddef.h>
+#include <cmdestinationext.h>
+#include <cmmanagerext.h>
+#include <cmplugincsddef.h>
+#include <cmpluginhscsddef.h>
+#include <cmpluginpacketdatadef.h>
+#include <cmpluginwlandef.h>
+#include <rconnmon.h>
+
+using namespace CMManager;
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KMinCreateMsgLength = 5;
+const TInt KMinDeleteMsgLength = 3;
+const TInt KMinCreateDestMsgLength = 3;
+const TInt KMinDeleteDestMsgLength = 3;
+const TInt KMinModifyDestMsgLength = 5;
+const TInt KMinSetDefConMsgLength = 3;
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+_LIT8( KErrorInvalidParameters, "Invalid command parameters" );
+_LIT8( KErrorCreateFailed, "Access Point creation failed" );
+_LIT8( KErrorDeleteFailed, "Access Point deletion failed" );
+_LIT8( KErrorDestCreateFailed, "Destination creation failed" );
+_LIT8( KErrorDestDeleteFailed, "Destination deletion failed" );
+_LIT8( KErrorApAlreadyExists, "Access Point with same name already exists" );
+_LIT8( KErrorApNotFound, "Access Point with given name not found" );
+_LIT8( KErrorConnCloseFailed,
+ "Failed to close a connection using the Access Point" );
+_LIT8( KErrorAddToDestFailed, "Adding to destination failed" );
+_LIT8( KErrorRemoveFromDestFailed, "Removing from destination failed" );
+_LIT8( KErrorDestNotFound, "Destination with given name not found" );
+_LIT8( KErrorSetDefConFailed, "Setting default connection failed" );
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiIAPHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CHtiIAPHandler* CHtiIAPHandler::NewL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::NewL" );
+ CHtiIAPHandler* self = new (ELeave) CHtiIAPHandler();
+ CleanupStack::PushL ( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::NewL" );
+ return self;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::CHtiIAPHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+CHtiIAPHandler::CHtiIAPHandler()
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::CHtiIAPHandler" );
+
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::CHtiIAPHandler" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiIAPHandler::~CHtiIAPHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+CHtiIAPHandler::~CHtiIAPHandler()
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::~CHtiIAPHandler" );
+
+ for ( TInt i = 0; i < iFields.Count(); i++ )
+ {
+ delete iFields[i].iData;
+ }
+ iFields.Reset();
+ iFields.Close();
+
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::~CHtiIAPHandler" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiIAPHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CHtiIAPHandler::ConstructL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::ConstructL" );
+
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::ConstructL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiIAPHandler::SetDispatcher
+// Sets the dispatcher pointer.
+// -----------------------------------------------------------------------------
+
+void CHtiIAPHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::SetDispatcher" );
+ iDispatcher = aDispatcher;
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::SetDispatcher" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiIAPHandler::ProcessMessageL
+// Parses the received message and calls handler functions.
+// -----------------------------------------------------------------------------
+void CHtiIAPHandler::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/ )
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::ProcessMessageL" );
+
+ for ( TInt i = 0; i < iFields.Count(); i++ )
+ delete iFields[i].iData;
+ iFields.Reset();
+ iFields.Close();
+ iConnName.Zero();
+ iBearerType = 0;
+
+ // Zero length message and command code validity already checked
+ // in HtiMessagesServicePlugin.
+
+ if ( aMessage[0] == CHtiMessagesServicePlugin::ECreateIAP )
+ {
+ if ( aMessage.Length() < KMinCreateMsgLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ TRAPD( err, HandleCreateIapL( aMessage.Mid( 1 ) ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorCreateFailed );
+ }
+ }
+ }
+
+ else if ( aMessage[0] == CHtiMessagesServicePlugin::EDeleteIAP )
+ {
+ if ( aMessage.Length() < KMinDeleteMsgLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ TRAPD( err, HandleDeleteIapL( aMessage.Mid( 1 ) ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorDeleteFailed );
+ }
+ }
+ }
+
+ else if ( aMessage[0] == CHtiMessagesServicePlugin::ECreateDestination )
+ {
+ if ( aMessage.Length() < KMinCreateDestMsgLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ TRAPD( err, HandleCreateDestinationL( aMessage.Mid( 1 ) ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorDestCreateFailed );
+ }
+ }
+ }
+
+ else if ( aMessage[0] == CHtiMessagesServicePlugin::EDeleteDestination )
+ {
+ if ( aMessage.Length() < KMinDeleteDestMsgLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ TRAPD( err, HandleDeleteDestinationL( aMessage.Mid( 1 ) ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorDestDeleteFailed );
+ }
+ }
+ }
+
+ else if ( aMessage[0] == CHtiMessagesServicePlugin::EAddToDestination ||
+ aMessage[0] == CHtiMessagesServicePlugin::ERemoveFromDestination )
+ {
+ if ( aMessage.Length() < KMinModifyDestMsgLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ TRAPD( err, ModifyDestinationL( aMessage[0], aMessage.Mid( 1 ) ) );
+ if ( err != KErrNone )
+ {
+ if ( aMessage[0] == CHtiMessagesServicePlugin::EAddToDestination )
+ {
+ SendErrorMessageL( err, KErrorAddToDestFailed );
+ }
+ else
+ {
+ SendErrorMessageL( err, KErrorRemoveFromDestFailed );
+ }
+ }
+ }
+ }
+ else if ( aMessage[0] == CHtiMessagesServicePlugin::ESetDefaultConnection )
+ {
+ if ( aMessage.Length() < KMinSetDefConMsgLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ TRAPD( err, SetDefaultConnectionL( aMessage.Mid( 1 ) ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorSetDefConFailed );
+ }
+ }
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::ProcessMessageL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::HandleCreateIapL
+// Creates new Internet Access Point.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::HandleCreateIapL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::HandleCreateIapL" );
+
+ TRAPD( err, ParseCreateMessageL( aData ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorInvalidParameters );
+ return;
+ }
+
+ if ( GetAccessPointUIDL() != KErrNotFound )
+ {
+ SendErrorMessageL( KErrAlreadyExists, KErrorApAlreadyExists );
+ return;
+ }
+
+ MapLegacyFieldIDs();
+ ResolveFieldDataTypes();
+
+ RCmManagerExt cmManager;
+ cmManager.OpenL();
+ CleanupClosePushL( cmManager );
+
+ RCmConnectionMethodExt cm = cmManager.CreateConnectionMethodL( iBearerType );
+ CleanupClosePushL( cm );
+ HTI_LOG_TEXT( "Connection method created" );
+
+ cm.SetStringAttributeL( ECmName, iConnName );
+ HTI_LOG_TEXT( "Name set" );
+
+ TUint32 requestedSeamlessness = 1; // default
+
+ // Set attributes
+ HTI_LOG_FORMAT( "Fields to write: %d", iFields.Count() );
+ for ( TInt i = 0; i < iFields.Count(); i++ )
+ {
+ if ( err != KErrNone ) break;
+
+ HTI_LOG_FORMAT( "Writing field %d", ( i + 1 ) );
+ TApField field = iFields[i];
+ HTI_LOG_FORMAT( "Field ID = %d", field.iId );
+
+ switch ( field.iDataType )
+ {
+ case EDataTypeText:
+ {
+ TRAP( err, cm.SetStringAttributeL( field.iId, *field.iData ) );
+ break;
+ }
+ case EDataTypeBool:
+ {
+ TLex lex( *field.iData );
+ TInt result = 0;
+ lex.Val( result );
+ TRAP( err, cm.SetBoolAttributeL( field.iId, ( TBool ) result ) );
+ break;
+ }
+ case EDataTypeUint:
+ {
+ TLex lex( *field.iData );
+ TUint32 result;
+ err = lex.Val( result, EDecimal );
+ if ( err == KErrNone )
+ TRAP( err, cm.SetIntAttributeL( field.iId, result ) );
+ if ( field.iId == ECmSeamlessnessLevel )
+ requestedSeamlessness = result;
+ break;
+ }
+ case EDataTypeText8:
+ {
+ HBufC8* buf8 = HBufC8::NewL( field.iData->Length() );
+ buf8->Des().Copy( *field.iData );
+ TRAP( err, cm.SetString8AttributeL( field.iId, *buf8 ) );
+ delete buf8;
+ buf8 = NULL;
+ break;
+ }
+ default:
+ {
+ HTI_LOG_FORMAT( "Unsupported field type %d", field.iDataType );
+ err = KErrNotSupported;
+ break;
+ }
+ }
+ }
+
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "Error occurred %d", err );
+ User::Leave( err );
+ }
+
+ cm.UpdateL();
+ TUint32 uid = cm.GetIntAttributeL( ECmId );
+ CleanupStack::PopAndDestroy(); // cm
+
+ // The seamlessness value is not always set correctly when the connection
+ // method is created. Have to update seamlessness value separately after
+ // creation.
+ cm = cmManager.ConnectionMethodL( uid );
+ CleanupClosePushL( cm );
+ TUint32 currentSeamlessness = cm.GetIntAttributeL( ECmSeamlessnessLevel );
+ HTI_LOG_FORMAT( "Requested seamlessness = %d", requestedSeamlessness );
+ HTI_LOG_FORMAT( "Current seamlessness = %d", currentSeamlessness );
+ if ( currentSeamlessness != requestedSeamlessness )
+ {
+ cm.SetIntAttributeL( ECmSeamlessnessLevel, requestedSeamlessness );
+ cm.UpdateL();
+ HTI_LOG_TEXT( "Seamlessness value updated" );
+ }
+ CleanupStack::PopAndDestroy(); // cm
+ CleanupStack::PopAndDestroy(); // cmManager
+
+ HTI_LOG_FORMAT( "AP created with uid %d", uid );
+
+ TBuf8<4> idBuf;
+ idBuf.Append( ( TUint8* ) &uid, 4 );
+ SendOkMsgL( idBuf );
+
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::HandleCreateIapL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::HandleDeleteIapL
+// Deletes the named Internet Access Point
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::HandleDeleteIapL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::HandleDeleteIapL" );
+ if ( aData.Length() < KMinDeleteMsgLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return;
+ }
+
+ TInt nameLength = aData[0];
+ if ( nameLength > KMaxConnNameLength ||
+ aData.Length() != ( nameLength + 1 ) )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return;
+ }
+
+ iConnName.Copy( aData.Mid( 1, nameLength ) );
+ HTI_LOG_FORMAT( "Searching connection with name: %S", &iConnName );
+ TInt uid = GetAccessPointUIDL();
+
+ if ( uid == KErrNotFound )
+ {
+ SendErrorMessageL( KErrNotFound, KErrorApNotFound );
+ return;
+ }
+
+ RCmManagerExt cmManagerExt;
+ cmManagerExt.OpenL();
+ CleanupClosePushL( cmManagerExt );
+ RCmConnectionMethodExt connMethod = cmManagerExt.ConnectionMethodL( uid );
+ CleanupClosePushL( connMethod );
+ if ( connMethod.GetBoolAttributeL( ECmConnected ) )
+ {
+ HTI_LOG_TEXT( "AP in use - trying to close connections" );
+ TRAPD( err, CloseActiveConnectionsL() );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorConnCloseFailed );
+ CleanupStack::PopAndDestroy( 2 ); // connMethod, cmManagerExt
+ return;
+ }
+ }
+
+ HTI_LOG_TEXT( "AP not in use - unlinking from all destinations" );
+ cmManagerExt.RemoveAllReferencesL( connMethod );
+ HTI_LOG_TEXT( "Deleting the AP" );
+ TBool deleted = connMethod.DeleteL(); // returns ETrue if really deleted
+ if ( !deleted )
+ {
+ HTI_LOG_TEXT( "Delete failed" );
+ User::Leave( KErrGeneral );
+ }
+ HTI_LOG_FORMAT( "AP deleted with uid %d", uid );
+ CleanupStack::PopAndDestroy(); // connMethod
+ CleanupStack::PopAndDestroy(); // cmManagerExt
+
+ SendOkMsgL( KNullDesC8 );
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::HandleDeleteIapL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::HandleCreateDestinationL
+// Creates a new Destination.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::HandleCreateDestinationL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::HandleCreateDestinationL" );
+
+ TInt nameLength = aData[0];
+ if ( aData.Length() - 1 != nameLength || nameLength > KMaxConnNameLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return;
+ }
+
+ RCmManagerExt cmManager;
+ cmManager.OpenL();
+ CleanupClosePushL( cmManager );
+
+ iDestName.Copy( aData.Mid( 1 ) );
+
+ RCmDestinationExt dest = cmManager.CreateDestinationL( iDestName );
+ CleanupClosePushL( dest );
+ dest.UpdateL();
+
+ CleanupStack::PopAndDestroy( 2 ); // dest, cmManager
+ SendOkMsgL( KNullDesC8 );
+
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::HandleCreateDestinationL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::HandleDeleteDestinationL
+// Deletes a named Destination.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::HandleDeleteDestinationL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::HandleDeleteDestinationL" );
+
+ TInt nameLength = aData[0];
+ if ( aData.Length() - 1 != nameLength || nameLength > KMaxConnNameLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return;
+ }
+
+ iDestName.Copy( aData.Mid( 1 ) );
+ TInt id = GetDestinationIDL( iDestName );
+
+ RCmManagerExt cmManager;
+ cmManager.OpenL();
+ CleanupClosePushL( cmManager );
+
+ RCmDestinationExt dest = cmManager.DestinationL ( id );
+ dest.DeleteLD();
+
+ CleanupStack::PopAndDestroy(); // cmManager
+ SendOkMsgL( KNullDesC8 );
+
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::HandleDeleteDestinationL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::ModifyDestinationL
+// Adds or removes IAP to/from a Destination.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::ModifyDestinationL( const TInt aCommand, const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::ModifyDestinationL" );
+
+ TInt dataLength = aData.Length();
+ TInt offset = 0;
+ TInt cmNameLength = aData[offset];
+ offset++;
+ if ( dataLength < cmNameLength + 3 || cmNameLength > KMaxConnNameLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return;
+ }
+ iConnName.Copy( aData.Mid( offset, cmNameLength ) );
+ offset += cmNameLength;
+ TInt destNameLength = aData[offset];
+ offset++;
+ if ( dataLength != cmNameLength + destNameLength + 2 ||
+ destNameLength > KMaxConnNameLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return;
+ }
+
+ iDestName.Copy( aData.Mid( offset, destNameLength ) );
+
+ TInt cmId = GetAccessPointUIDL();
+ if ( cmId == KErrNotFound )
+ {
+ SendErrorMessageL( KErrNotFound, KErrorApNotFound );
+ return;
+ }
+ TInt destId = GetDestinationIDL( iDestName );
+ if ( destId == KErrNotFound )
+ {
+ SendErrorMessageL( KErrNotFound, KErrorDestNotFound );
+ return;
+ }
+
+ RCmManagerExt cmManager;
+ cmManager.OpenL();
+ CleanupClosePushL( cmManager );
+
+ RCmConnectionMethodExt cm = cmManager.ConnectionMethodL( cmId );
+ CleanupClosePushL( cm );
+ HTI_LOG_TEXT( "Got Connection Method" );
+
+ RCmDestinationExt dest = cmManager.DestinationL( destId );
+ CleanupClosePushL( dest );
+ HTI_LOG_TEXT( "Got Destination" );
+
+ if ( aCommand == CHtiMessagesServicePlugin::EAddToDestination )
+ {
+ dest.AddConnectionMethodL( cm );
+ }
+ else if ( aCommand == CHtiMessagesServicePlugin::ERemoveFromDestination)
+ {
+ dest.RemoveConnectionMethodL( cm );
+ }
+ else
+ {
+ // Programming error
+ User::Panic( _L( "CHtiIAPHandler"), 1 );
+ }
+ dest.UpdateL();
+ HTI_LOG_TEXT( "Destination updated" );
+
+ CleanupStack::PopAndDestroy( 3 ); // dest, cm, cmManager
+ SendOkMsgL( KNullDesC8 );
+
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::ModifyDestinationL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::SetDefaultConnectionL
+// Sets the default connection setting.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::SetDefaultConnectionL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::SetDefaultConnectionL" );
+
+ if ( aData[0] > 3 || aData.Length() != aData[1] + 2 )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ TCmDefConnValue defConnValue;
+ defConnValue.iType = ( TCmDefConnType ) aData[0]; // cmdefconnvalues.h
+ HTI_LOG_FORMAT( "Requested type: %d", defConnValue.iType );
+
+ TInt id = 0;
+ if ( defConnValue.iType == ECmDefConnDestination )
+ {
+ if ( aData[1] == 0 || aData[1] > KMaxConnNameLength )
+ {
+ User::Leave( KErrArgument );
+ }
+ iDestName.Copy( aData.Mid( 2 ) );
+ HTI_LOG_FORMAT( "Destination name: %S", &iDestName );
+ id = GetDestinationIDL( iDestName );
+ if ( id == KErrNotFound )
+ {
+ SendErrorMessageL( KErrNotFound, KErrorDestNotFound );
+ return;
+ }
+ }
+
+ else if ( defConnValue.iType == ECmDefConnConnectionMethod )
+ {
+ if ( aData[1] == 0 || aData[1] > KMaxConnNameLength )
+ {
+ User::Leave( KErrArgument );
+ }
+ iConnName.Copy( aData.Mid( 2 ) );
+ HTI_LOG_FORMAT( "Connection method name: %S", &iConnName );
+ id = GetAccessPointUIDL();
+ if ( id == KErrNotFound )
+ {
+ SendErrorMessageL( KErrNotFound, KErrorApNotFound );
+ return;
+ }
+ }
+
+ defConnValue.iId = id;
+
+ RCmManagerExt cmManager;
+ cmManager.OpenL();
+ CleanupClosePushL( cmManager );
+ cmManager.WriteDefConnL( defConnValue );
+ CleanupStack::PopAndDestroy();
+ SendOkMsgL( KNullDesC8 );
+
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::SetDefaultConnectionL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::ParseCreateMessageL
+// Parses the parameters from the create IAP message. Leaves on error.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::ParseCreateMessageL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::ParseCreateMessageL" );
+
+ TInt dataLength = aData.Length();
+ TInt offset = 0;
+
+ iBearerType = GetBearerUID( aData[offset] );
+ offset++;
+ HTI_LOG_FORMAT( "Bearer type %d", iBearerType );
+ if ( iBearerType == 0 )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ TInt nameLength = aData[offset];
+ offset++;
+ if ( dataLength < ( nameLength + offset + 1 ) ||
+ nameLength > KMaxConnNameLength )
+ {
+ User::Leave( KErrArgument );
+ }
+ iConnName.Copy( aData.Mid( offset, nameLength ) );
+ offset += nameLength;
+ HTI_LOG_FORMAT( "Connection name: %S", &iConnName );
+
+ TInt fieldCount = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Field count %d", fieldCount );
+
+ for ( TInt i = 0; i < fieldCount; i++ )
+ {
+ if ( dataLength < ( offset + 3 ) )
+ {
+ User::Leave( KErrArgument );
+ }
+ HTI_LOG_FORMAT( "Parsing field %d", i + 1 );
+ TApField field;
+ field.iId = aData[offset];
+ offset++;
+ TInt fieldLength = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Field data length %d", fieldLength );
+ if ( fieldLength < 1 || dataLength < ( fieldLength + offset ) )
+ {
+ User::Leave( KErrArgument );
+ }
+ field.iData = HBufC::NewL( fieldLength );
+ field.iData->Des().Copy( aData.Mid( offset, fieldLength ) );
+ offset += fieldLength;
+ HTI_LOG_FORMAT( "Field data: %S", field.iData );
+ field.iDataType = EDataTypeUnknown; // set later
+ User::LeaveIfError( iFields.Append( field ) );
+ }
+
+ if ( offset != dataLength ) // too much data
+ {
+ User::Leave( KErrArgument );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::ParseCreateMessageL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::GetAccessPointUIDL
+// Gets the UID of Access Point named by iConnName.
+// Returns KErrNotFound if AP not found.
+// ----------------------------------------------------------------------------
+TInt CHtiIAPHandler::GetAccessPointUIDL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::GetAccessPointUIDL" );
+ TInt uid = KErrNotFound;
+
+ RCmManagerExt cmManager;
+ cmManager.OpenL();
+ CleanupClosePushL( cmManager );
+
+ // Search from uncategorised first
+ RArray<TUint32> array = RArray<TUint32>();
+ cmManager.ConnectionMethodL( array );
+ CleanupClosePushL( array );
+ TInt i = 0;
+ while ( i < array.Count() && uid == KErrNotFound )
+ {
+ RCmConnectionMethodExt cm = cmManager.ConnectionMethodL( array[i] );
+ CleanupClosePushL( cm );
+ HBufC* name = cm.GetStringAttributeL( ECmName );
+ HTI_LOG_FORMAT( "Found name: %S", name );
+ CleanupStack::PushL( name );
+ if ( iConnName.Compare( *name ) == 0 )
+ {
+ uid = cm.GetIntAttributeL( ECmId );
+ HTI_LOG_FORMAT( "Match: UID = %d", uid );
+ }
+ CleanupStack::PopAndDestroy(); // name
+ CleanupStack::PopAndDestroy(); // cm
+ i++;
+ }
+ CleanupStack::PopAndDestroy(); // array
+
+ // If not found from uncategorised, search from all destinations
+ if ( uid == KErrNotFound )
+ {
+ HTI_LOG_TEXT( "Not found from uncategorised" );
+ RArray<TUint32> destIdArray = RArray<TUint32>();
+ cmManager.AllDestinationsL( destIdArray );
+ CleanupClosePushL( destIdArray );
+ i = 0;
+ while ( i < destIdArray.Count() && uid == KErrNotFound )
+ {
+ RCmDestinationExt dest = cmManager.DestinationL( destIdArray[i] );
+ CleanupClosePushL( dest );
+ TInt j = 0;
+ while ( j < dest.ConnectionMethodCount() && uid == KErrNotFound )
+ {
+ HBufC* name = dest.ConnectionMethodL( j ).GetStringAttributeL(
+ ECmName );
+ CleanupStack::PushL( name );
+ HTI_LOG_FORMAT( "Found name: %S", name );
+ if ( iConnName.Compare( *name ) == 0 )
+ {
+ uid = dest.ConnectionMethodL( j ).GetIntAttributeL(
+ ECmId );
+ HTI_LOG_FORMAT( "Match: UID = %d", uid );
+ }
+ CleanupStack::PopAndDestroy(); // name
+ j++;
+ }
+ CleanupStack::PopAndDestroy(); // dest
+ i++;
+ }
+ CleanupStack::PopAndDestroy(); // destIdArray
+ }
+
+ CleanupStack::PopAndDestroy(); // cmManager
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::GetAccessPointUIDL" );
+ return uid;
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::GetDestinationIDL
+// Gets the ID of Destination named by aName.
+// Returns KErrNotFound if Destination is not found.
+// ----------------------------------------------------------------------------
+TInt CHtiIAPHandler::GetDestinationIDL( const TDesC& aName )
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::GetDestinationIDL" );
+ HTI_LOG_FORMAT( "Searching Destination %S", &aName );
+
+ RCmManagerExt cmManager;
+ cmManager.OpenL();
+ CleanupClosePushL( cmManager );
+
+ TInt id = KErrNotFound;
+ RArray<TUint32> destIdArray = RArray<TUint32>( 8 );
+ CleanupClosePushL( destIdArray );
+
+ cmManager.AllDestinationsL( destIdArray );
+ TInt i = 0;
+ while ( i < destIdArray.Count() && id == KErrNotFound )
+ {
+ RCmDestinationExt dest = cmManager.DestinationL( destIdArray[i] );
+ CleanupClosePushL( dest );
+ HBufC* destName = dest.NameLC();
+ HTI_LOG_FORMAT( "Found Destination: %S", destName );
+ if ( destName->Compare( aName ) == 0 )
+ {
+ id = dest.Id();
+ HTI_LOG_FORMAT( "Match: ID = %d", id );
+ }
+ CleanupStack::PopAndDestroy( 2 ); // destName, dest
+ i++;
+ }
+
+ CleanupStack::PopAndDestroy( 2 ); // destIdArray, cmManager
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::GetDestinationIDL" );
+ return id;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::CloseActiveConnectionsL
+// Closes connection(s) that are using the Access Point named by iConnName.
+// Leaves if closing fails.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::CloseActiveConnectionsL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::CloseActiveConnectionsL" );
+
+ RConnectionMonitor monitor;
+ monitor.ConnectL();
+ CleanupClosePushL( monitor );
+ HTI_LOG_TEXT( "RConnectionMonitor connected" );
+
+ TUint connCount = 0;
+ TUint subConnCount = 0;
+ TUint connId = 0;
+ //TUint iapId = 0;
+ TName iapName;
+ TRequestStatus status;
+
+ monitor.GetConnectionCount( connCount, status );
+ User::WaitForRequest( status );
+ User::LeaveIfError( status.Int() );
+ HTI_LOG_FORMAT( "Found %d connections", connCount );
+
+ for ( TUint i = 1; i <= connCount; i++ )
+ {
+ HTI_LOG_FORMAT( "Connection %d", i );
+ User::LeaveIfError(
+ monitor.GetConnectionInfo( i, connId, subConnCount ) );
+ HTI_LOG_FORMAT( " Connection ID = %d", connId );
+ HTI_LOG_FORMAT( " Sub connections = %d", subConnCount );
+ /*
+ monitor.GetUintAttribute( connId, 0, KIAPId, iapId, status );
+ User::WaitForRequest( status );
+ User::LeaveIfError( status.Int() );
+ HTI_LOG_FORMAT( " IAP ID = %d", iapId );
+ */
+ monitor.GetStringAttribute( connId, 0, KIAPName, iapName, status );
+ User::WaitForRequest( status );
+ User::LeaveIfError( status.Int() );
+ HTI_LOG_FORMAT( " IAP name = %S", &iapName );
+ if ( iapName.Compare( iConnName ) == 0 )
+ {
+ HTI_LOG_TEXT( " Match: Trying to close this connection" );
+ User::LeaveIfError(
+ monitor.SetBoolAttribute( connId, 0, KConnectionStop, ETrue ) );
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // monitor
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::CloseActiveConnectionsL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::GetBearerUID
+// Helper function for mapping old TApBearerType value to new bearer type
+// ECom UID.
+// ----------------------------------------------------------------------------
+TUint CHtiIAPHandler::GetBearerUID( const TInt aBearerType )
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::GetBearerUID" );
+ TUint uid = 0;
+ switch ( aBearerType )
+ {
+ case 0x01: // CSD
+ uid = KUidCSDBearerType;
+ break;
+ case 0x02: // GPRS
+ uid = KUidPacketDataBearerType;
+ break;
+ case 0x04: // HSCSD
+ uid = KUidHSCSDBearerType;
+ break;
+ case 0x10: // CDMA
+ uid = KUidPacketDataBearerType;
+ break;
+ case 0x20: // WLAN
+ uid = KUidWlanBearerType;
+ break;
+ default:
+ break;
+
+ }
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::GetBearerUID" );
+ return uid;
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::MapLegacyFieldIDs
+// Helper function for mapping the old access point field ID numbers to
+// new ones.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::MapLegacyFieldIDs()
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::MapLegacyFieldIDs" );
+
+ for ( TInt i = 0; i < iFields.Count(); i++ )
+ {
+ TApField field = iFields[i];
+ switch ( field.iId )
+ {
+ case EApWapStartPage:
+ {
+ field.iId = ECmStartPage;
+ break;
+ }
+ case EApIspDefaultTelNumber:
+ {
+ field.iId = EDialDefaultTelNum;
+ break;
+ }
+ case EApIspUseLoginScript:
+ {
+ field.iId = EDialUseLoginScript;
+ break;
+ }
+ case EApIspLoginScript:
+ {
+ field.iId = EDialLoginScript;
+ break;
+ }
+ case EApIspLoginName:
+ {
+ if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+ field.iId = EDialIFAuthName;
+ else if ( iBearerType == KUidPacketDataBearerType )
+ field.iId = EPacketDataIFAuthName;
+ else
+ field.iId = ECmIFAuthName;
+ break;
+ }
+ case EApIspLoginPass:
+ {
+ if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+ field.iId = EDialIFAuthPass;
+ else if ( iBearerType == KUidPacketDataBearerType )
+ field.iId = EPacketDataIFAuthPass;
+ else
+ field.iId = ECmIFAuthPass;
+ break;
+ }
+ case EApIspIfPromptForAuth:
+ {
+ if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+ field.iId = EDialIFPromptForAuth;
+ else if ( iBearerType == KUidPacketDataBearerType )
+ field.iId = EPacketDataIFPromptForAuth;
+ else
+ field.iId = ECmIFPromptForAuth;
+ break;
+ }
+ case EApIspIfCallbackEnabled:
+ {
+ field.iId = EDialIFCallbackEnabled;
+ break;
+ }
+ case EApIspIfCallbackType:
+ {
+ field.iId = EDialIFCallbackType;
+ break;
+ }
+ case EApIspIfCallbackInfo:
+ {
+ field.iId = EDialIFCallbackInfo;
+ break;
+ }
+ case EApIspIPAddr:
+ {
+ if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+ field.iId = EDialIPAddress;
+ else if ( iBearerType == KUidPacketDataBearerType )
+ field.iId = EPacketDataIPAddr;
+ else if ( iBearerType == KUidWlanBearerType )
+ field.iId = EWlanIpAddr;
+ else
+ field.iId = ECmIPAddress;
+ break;
+ }
+ case EApIspIPNameServer1:
+ {
+ if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+ field.iId = EDialIPNameServer1;
+ else if ( iBearerType == KUidPacketDataBearerType )
+ field.iId = EPacketDataIPNameServer1;
+ else if ( iBearerType == KUidWlanBearerType )
+ field.iId = EWlanIpNameServer1;
+ else
+ field.iId = ECmIPNameServer1;
+ break;
+ }
+ case EApIspIPNameServer2:
+ {
+ if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+ field.iId = EDialIPNameServer2;
+ else if ( iBearerType == KUidPacketDataBearerType )
+ field.iId = EPacketDataIPNameServer2;
+ else if ( iBearerType == KUidWlanBearerType )
+ field.iId = EWlanIpNameServer2;
+ else
+ field.iId = ECmIPNameServer2;
+ break;
+ }
+ case EApIspEnableIpHeaderComp:
+ {
+ if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+ field.iId = EDialEnableIPHeaderComp;
+ else if ( iBearerType == KUidPacketDataBearerType )
+ field.iId = EPacketDataHeaderCompression;
+ break;
+ }
+ case EApIspDisablePlainTextAuth:
+ {
+ if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+ field.iId = EDialDisablePlainTextAuth;
+ else if ( iBearerType == KUidPacketDataBearerType )
+ field.iId = EPacketDataDisablePlainTextAuth;
+ else
+ field.iId = ECmDisablePlainTextAuth;
+ break;
+ }
+ case EApIspBearerSpeed:
+ {
+ field.iId = EDialMaxConnSpeed;
+ break;
+ }
+ case EApIspBearerCallTypeIsdn:
+ {
+ field.iId = EDialCallType;
+ break;
+ }
+ case EApIspInitString:
+ {
+ field.iId = EDialInitString;
+ break;
+ }
+ case EApGprsAccessPointName:
+ {
+ field.iId = EPacketDataAPName;
+ break;
+ }
+ case EApGprsPdpType:
+ {
+ field.iId = EPacketDataPDPType;
+ break;
+ }
+ case EApProxyServerAddress:
+ {
+ field.iId = ECmProxyServerName;
+ break;
+ }
+ case EApProxyPortNumber:
+ {
+ field.iId = ECmProxyPortNumber;
+ break;
+ }
+ case EApIP6NameServer1:
+ {
+ if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+ field.iId = EDialIP6NameServer1;
+ else if ( iBearerType == KUidPacketDataBearerType )
+ field.iId = EPacketDataIPIP6NameServer1;
+ else if ( iBearerType == KUidWlanBearerType )
+ field.iId = EWlanIp6NameServer1;
+ else
+ field.iId = ECmIP6NameServer1;
+ break;
+ }
+ case EApIP6NameServer2:
+ {
+ if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+ field.iId = EDialIP6NameServer2;
+ else if ( iBearerType == KUidPacketDataBearerType )
+ field.iId = EPacketDataIPIP6NameServer2;
+ else if ( iBearerType == KUidWlanBearerType )
+ field.iId = EWlanIp6NameServer2;
+ else
+ field.iId = ECmIP6NameServer2;
+ break;
+ }
+ case EApWlanNetworkName:
+ {
+ field.iId = EWlanSSID;
+ break;
+ }
+ case EApWlanNetworkMode:
+ {
+ field.iId = EWlanConnectionMode;
+ break;
+ }
+ case EApWlanSecurityMode:
+ {
+ field.iId = EWlanSecurityMode;
+ break;
+ }
+ case EApSeamlessnessLevel:
+ {
+ field.iId = ECmSeamlessnessLevel;
+ break;
+ }
+ default:
+ break;
+ }
+ iFields[i] = field;
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::MapLegacyFieldIDs" );
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::ResolveFieldDataTypes
+// Helper function for resolving the data types for different AP settings
+// fields based on field ID and bearer type.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::ResolveFieldDataTypes()
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::ResolveFieldDataTypes" );
+
+ for ( TInt i = 0; i < iFields.Count(); i++ )
+ {
+ if ( iFields[i].iDataType != EDataTypeUnknown ) continue; // already set
+
+ // Common fields
+ switch ( iFields[i].iId )
+ {
+ // String types
+ case ECmStartPage:
+ case ECmProxyServerName:
+ case ECmProxyProtocolName:
+ case ECmProxyExceptions:
+ case ECmIFName:
+ case ECmIFParams:
+ case ECmIFNetworks:
+ case ECmIFAuthName:
+ case ECmIFAuthPass:
+ case ECmIPGateway:
+ case ECmIPAddress:
+ case ECmIPNameServer1:
+ case ECmIPNameServer2:
+ case ECmIP6NameServer1:
+ case ECmIP6NameServer2:
+ iFields[i].iDataType = EDataTypeText;
+ break;
+
+ // Bool types
+ case ECmProtected:
+ case ECmIFPromptForAuth:
+ case ECmIPAddFromServer:
+ case ECmIPDNSAddrFromServer:
+ case ECmIP6DNSAddrFromServer:
+ case ECmEnableLPCExtension:
+ case ECmDisablePlainTextAuth:
+ iFields[i].iDataType = EDataTypeBool;
+ break;
+
+ // Uint types
+ case ECmSeamlessnessLevel:
+ case ECmProxyPortNumber:
+ case ECmIFAuthRetries:
+ iFields[i].iDataType = EDataTypeUint;
+ break;
+
+ default:
+ break;
+ }
+
+ // If it was found from common fields, we can continue to next field
+ if ( iFields[i].iDataType != EDataTypeUnknown ) continue;
+
+ // Check from bearer specific fields.
+ // Different bearers have to be in separate switch-cases because
+ // there are same values in different bearers.
+
+ // Data call fields
+ if ( iBearerType == KUidCSDBearerType ||
+ iBearerType == KUidHSCSDBearerType )
+ {
+ switch ( iFields[i].iId )
+ {
+ // String types
+ case EDialDescription:
+ case EDialDefaultTelNum:
+ case EDialLoginScript:
+ case EDialLoginName:
+ case EDialLoginPassword:
+ case EDialIFParams:
+ case EDialIFNetworks:
+ case EDialIFAuthName:
+ case EDialIFAuthPass:
+ case EDialIPAddress:
+ case EDialIPNetmask:
+ case EDialIPGateway:
+ case EDialIPNameServer1:
+ case EDialIPNameServer2:
+ case EDialIP6NameServer1:
+ case EDialIP6NameServer2:
+ iFields[i].iDataType = EDataTypeText;
+ break;
+
+ // Bool types
+ case EDialOut:
+ case EDialDialResolution:
+ case EDialUseLoginScript:
+ case EDialPromptForLogin:
+ case EDialDisplayPCT:
+ case EDialIFPromptForAuth:
+ case EDialIFCallbackEnabled:
+ case EDialIFServerMode:
+ case EDialIPAddressFromServer:
+ case EDialIPDNSAddressFromServer:
+ case EDialIP6DNSAddressFromServer:
+ case EDialEnableIPHeaderComp:
+ case EDialEnableLCPExtension:
+ case EDialDisablePlainTextAuth:
+ case EDialEnableSWComp:
+ case EDialUseEdge:
+ iFields[i].iDataType = EDataTypeBool;
+ break;
+
+ // Uint types
+ case EDialCallType:
+ case EDialMaxConnSpeed:
+ case EDialType:
+ case EDialChargeCard:
+ case EDialIFAuthRetries:
+ case EDialIFCallbackType:
+ case EDialCallbackTimeout:
+ case EDialBearerName:
+ case EDialBearerSpeed:
+ case EDialBearerCE:
+ case EDialBearerService:
+ case EDialBearerProtocol:
+ case EDialRLPVersion:
+ case EDialIWFtoMS:
+ case EDialMStoIWF:
+ case EDialAckTimer:
+ case EDialRetransmissionAttempts:
+ case EDialResequencePeriod:
+ case EDialV42Compression:
+ case EDialV42CodeWords:
+ case EDialV42MaxLength:
+ case EHscsdAsymmetry:
+ case EHscsdUserInitUpgrade:
+ iFields[i].iDataType = EDataTypeUint;
+ break;
+
+ // 8-bit string types
+ case EDialIFCallbackInfo:
+ case EDialInitString:
+ iFields[i].iDataType = EDataTypeText8;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ // Packet data fields
+ else if ( iBearerType == KUidPacketDataBearerType )
+ {
+ switch ( iFields[i].iId )
+ {
+ // String types
+ case EPacketDataAPName:
+ case EPacketDataPDPAddress:
+ case EPacketDataIFParams:
+ case EPacketDataIFNetworks:
+ case EPacketDataIFAuthName:
+ case EPacketDataIFAuthPass:
+ case EPacketDataIPNetmask:
+ case EPacketDataIPGateway:
+ case EPacketDataIPAddr:
+ case EPacketDataIPNameServer1:
+ case EPacketDataIPNameServer2:
+ case EPacketDataIPIP6NameServer1:
+ case EPacketDataIPIP6NameServer2:
+ iFields[i].iDataType = EDataTypeText;
+ break;
+
+ // Bool types
+ case EPacketDataDataCompression:
+ case EPacketDataHeaderCompression:
+ case EPacketDataUseEdge:
+ case EPacketDataAnonymousAccess:
+ case EPacketDataIFPromptForAuth:
+ case EPacketDataIPAddrFromServer:
+ case EPacketDataIPDNSAddrFromServer:
+ case EPacketDataIPIP6DNSAddrFromServer:
+ case EPacketDataEnableLcpExtension:
+ case EPacketDataDisablePlainTextAuth:
+ case EPacketDataServiceEnableLLMNR:
+ iFields[i].iDataType = EDataTypeBool;
+ break;
+
+ // Uint types
+ case EPacketDataPDPType:
+ case EPacketDataIFAuthRetries:
+ case EPacketDataApType:
+ iFields[i].iDataType = EDataTypeUint;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ // WLAN fields
+ else if ( iBearerType == KUidWlanBearerType )
+ {
+ switch ( iFields[i].iId )
+ {
+ // String types
+ case EWlanIfNetworks:
+ case EWlanIpNetMask:
+ case EWlanIpGateway:
+ case EWlanIpAddr:
+ case EWlanIpNameServer1:
+ case EWlanIpNameServer2:
+ case EWlanIp6NameServer1:
+ case EWlanIp6NameServer2:
+ case EWlanSSID:
+ case EWlanUsedSSID:
+ iFields[i].iDataType = EDataTypeText;
+ break;
+
+ // Bool types
+ case EWlanIpAddrFromServer:
+ case EWlanIpDNSAddrFromServer:
+ case EWlanIp6DNSAddrFromServer:
+ case EWlanScanSSID:
+ case EWlanAllowSSIDRoaming:
+ iFields[i].iDataType = EDataTypeBool;
+ break;
+
+ // Uint types
+ case EWlanServiceId:
+ case EWlanConnectionMode:
+ case EWlanSecurityMode:
+ case EWlanAuthenticationMode:
+ case EWlanChannelID:
+ iFields[i].iDataType = EDataTypeUint;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ else
+ {
+ HTI_LOG_TEXT( "Unknown bearer type" )
+ }
+ }
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::ResolveFieldDataTypes" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::SendOkMsgL
+// Helper function for sending response messages.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::SendOkMsgL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::SendOkMsgL" );
+ User::LeaveIfNull( iDispatcher );
+ HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+ TPtr8 response = temp->Des();
+ response.Append( ( TChar ) CHtiMessagesServicePlugin::EResultOk );
+ response.Append( aData );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+ temp, KHtiMessagesServiceUid ) );
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::SendOkMsgL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::SendErrorMessageL
+// Helper function for sending error response messages.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
+ {
+ HTI_LOG_FUNC_IN( "CHtiIAPHandler::SendErrorMessageL" );
+ User::LeaveIfNull( iDispatcher );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+ aError, aDescription, KHtiMessagesServiceUid ) );
+ HTI_LOG_FUNC_OUT( "CHtiIAPHandler::SendErrorMessageL" );
+ }
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMailboxHandler.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,1198 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of HTI mailbox settings handling.
+*
+*/
+
+
+// INCLUDE FILES
+#include <cmconnectionmethod.h>
+#include <cmconnectionmethoddef.h>
+#include <cmdestination.h>
+#include <cmmanager.h>
+#include <cemailaccounts.h>
+#include <etelmm.h>
+#include <iapprefs.h>
+#include <imapset.h>
+#include <mtmuibas.h>
+#include <SendUiConsts.h>
+#include <pop3set.h>
+#include <smtpset.h>
+#include <txtrich.h>
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+#include "HtiMessagesServicePlugin.h"
+#include "HtiMailboxHandler.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KMinCreateMsgLength = 36;
+const TInt KMinDeleteMsgLength = 3;
+
+const TInt KImeiLength = 15;
+
+const TInt KDefaultImapPortSSL = 993;
+const TInt KDefaultPopPortSSL = 995;
+const TInt KDefaultSmtpPortSSL = 465;
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+_LIT8( KErrorInvalidParameters, "Invalid command parameters" );
+_LIT8( KErrorCreateFailed, "Mailbox creation failed" );
+_LIT8( KErrorDeleteFailed, "Mailbox deletion failed" );
+
+#ifdef __WINS__
+_LIT( KWinsImei, "123456789012345" );
+#else
+_LIT( KTsyName, "phonetsy" );
+#endif
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiMailboxHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CHtiMailboxHandler* CHtiMailboxHandler::NewL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::NewL" );
+ CHtiMailboxHandler* self = new (ELeave) CHtiMailboxHandler();
+ CleanupStack::PushL ( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::NewL" );
+ return self;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::CHtiMailboxHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+CHtiMailboxHandler::CHtiMailboxHandler()
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::CHtiMailboxHandler" );
+
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::CHtiMailboxHandler" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMailboxHandler::~CHtiMailboxHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+CHtiMailboxHandler::~CHtiMailboxHandler()
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::~CHtiMailboxHandler" );
+ delete iMailboxName;
+ delete iIncomingServer;
+ delete iIncomingApName;
+ delete iIncomingUserName;
+ delete iIncomingPassword;
+ delete iOutgoingServer;
+ delete iOutgoingApName;
+ delete iOutgoingUserName;
+ delete iOutgoingPassword;
+ delete iOwnMailAddress;
+ delete iOwnName;
+ delete iSignatureText;
+ delete iImapFolderPath;
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::~CHtiMailboxHandler" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMailboxHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CHtiMailboxHandler::ConstructL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::ConstructL" );
+
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::ConstructL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMailboxHandler::SetDispatcher
+// Sets the dispatcher pointer.
+// -----------------------------------------------------------------------------
+
+void CHtiMailboxHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::SetDispatcher" );
+ iDispatcher = aDispatcher;
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::SetDispatcher" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMailboxHandler::ProcessMessageL
+// Parses the received message and calls handler functions.
+// -----------------------------------------------------------------------------
+void CHtiMailboxHandler::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/ )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::ProcessMessageL" );
+
+ // Zero length message and command code validity already checked
+ // in HtiMessagesServicePlugin.
+
+ if ( aMessage[0] == CHtiMessagesServicePlugin::ECreateMailBox )
+ {
+ if ( aMessage.Length() < KMinCreateMsgLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ iCmManager.OpenL();
+ TRAPD( err, HandleCreateMailboxL(
+ aMessage.Right( aMessage.Length() - 1 ) ) );
+ if ( err != KErrNone )
+ {
+ if ( err == KErrArgument )
+ {
+ SendErrorMessageL( err, KErrorInvalidParameters );
+ }
+ else
+ {
+ HTI_LOG_FORMAT( "Create error %d", err );
+ SendErrorMessageL( err, KErrorCreateFailed );
+ }
+ }
+ else
+ {
+ SendOkMsgL( KNullDesC8 );
+ }
+ ResetVariables();
+ }
+ }
+
+ else
+ {
+ if ( aMessage.Length() < KMinDeleteMsgLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ TRAPD( err, HandleDeleteMailboxL(
+ aMessage.Right( aMessage.Length() - 1 ) ) );
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "Delete error %d", err );
+ SendErrorMessageL( err, KErrorDeleteFailed );
+ }
+ else
+ {
+ SendOkMsgL( KNullDesC8 );
+ }
+ }
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::ProcessMessageL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::HandleCreateMailboxL
+// Creates new mailbox.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::HandleCreateMailboxL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::HandleCreateMailboxL" );
+
+ ParseCreateMsgL( aData );
+
+ TSmtpAccount smtpAcc;
+ TInt result = FindSmtpAccount( *iMailboxName, smtpAcc );
+ if ( result != KErrNotFound )
+ {
+ User::Leave( KErrAlreadyExists );
+ }
+
+ CImImap4Settings* imap4Set = new (ELeave) CImImap4Settings;
+ CleanupStack::PushL( imap4Set );
+ CImPop3Settings* pop3Set = new (ELeave) CImPop3Settings;
+ CleanupStack::PushL( pop3Set );
+ CImSmtpSettings* smtpSet = new (ELeave) CImSmtpSettings;
+ CleanupStack::PushL( smtpSet );
+
+ CImIAPPreferences* incomingIapSet = CImIAPPreferences::NewLC();
+ CImIAPPreferences* outgoingIapSet = CImIAPPreferences::NewLC();
+
+ CEmailAccounts* accounts = CEmailAccounts::NewLC();
+ accounts->PopulateDefaultSmtpSettingsL( *smtpSet, *outgoingIapSet );
+ if ( iMailboxType == 0 ) // POP3
+ {
+ accounts->PopulateDefaultPopSettingsL( *pop3Set, *incomingIapSet );
+ }
+ else // IMAP4
+ {
+ accounts->PopulateDefaultImapSettingsL( *imap4Set, *incomingIapSet );
+ }
+
+ // Set access point settings
+ TImIAPChoice imIAPChoice;
+ imIAPChoice.iIAP = 0;
+ imIAPChoice.iDialogPref = ECommDbDialogPrefPrompt;
+
+ if ( iIncomingApName->Length() > 0 )
+ {
+ User::LeaveIfError(
+ imIAPChoice.iIAP = AccessPointUIDL( *iIncomingApName ) );
+ imIAPChoice.iDialogPref = ECommDbDialogPrefDoNotPrompt;
+ HTI_LOG_TEXT( "Incoming IAP user defined" );
+ }
+ incomingIapSet->AddIAPL( imIAPChoice );
+
+ imIAPChoice.iIAP = 0;
+ imIAPChoice.iDialogPref = ECommDbDialogPrefPrompt;
+
+ if ( iOutgoingApName->Length() > 0 )
+ {
+ User::LeaveIfError(
+ imIAPChoice.iIAP = AccessPointUIDL( *iOutgoingApName ) );
+ imIAPChoice.iDialogPref = ECommDbDialogPrefDoNotPrompt;
+ HTI_LOG_TEXT( "Outgoing IAP user defined" );
+ }
+ outgoingIapSet->AddIAPL( imIAPChoice );
+
+ // Set SMTP settings
+ HTI_LOG_TEXT( "Setting SMTP settings" );
+ smtpSet->SetServerAddressL( *iOutgoingServer );
+ smtpSet->SetLoginNameL( *iOutgoingUserName );
+ smtpSet->SetPasswordL( *iOutgoingPassword );
+ smtpSet->SetEmailAddressL( *iOwnMailAddress );
+ smtpSet->SetReplyToAddressL( *iOwnMailAddress );
+ smtpSet->SetEmailAliasL( *iOwnName );
+ if ( iSignatureText->Length() > 0 )
+ {
+ smtpSet->SetAddSignatureToEmail( ETrue );
+ }
+ else
+ {
+ smtpSet->SetAddSignatureToEmail( EFalse );
+ }
+ smtpSet->SetSendCopyToSelf( (TImSMTPSendCopyToSelf) iSendCopyToOwnAddress );
+ smtpSet->SetSendMessageOption( (TImSMTPSendMessageOption) iSendOption );
+ if ( iOutgoingSecurity == 0 )
+ {
+ smtpSet->SetSecureSockets( EFalse );
+ }
+ else
+ {
+ smtpSet->SetSecureSockets( ETrue );
+ if ( iOutgoingSecurity == 1 )
+ {
+ smtpSet->SetSSLWrapper( EFalse );
+ }
+ else // 2 = SSL
+ {
+ smtpSet->SetSSLWrapper( ETrue );
+ }
+ }
+ if ( iOutgoingPort > 0 )
+ {
+ smtpSet->SetPort( (TUint) iOutgoingPort );
+ }
+ else
+ {
+ if ( iOutgoingSecurity == 2 ) // SSL
+ {
+ smtpSet->SetPort( KDefaultSmtpPortSSL );
+ }
+ else
+ {
+ smtpSet->SetPort( KSMTPDefaultPortNumber );
+ }
+ }
+ smtpSet->SetBodyEncoding( EMsgOutboxMIME );
+ smtpSet->SetAddVCardToEmail( EFalse );
+ smtpSet->SetRequestReceipts( EFalse );
+ smtpSet->SetSMTPAuth( ETrue );
+
+ TSmtpAccount smtpAccount;
+ TPopAccount popAccount;
+ TImapAccount imapAccount;
+
+ // Set POP3 settings
+ if ( iMailboxType == 0 ) // POP3
+ {
+ HTI_LOG_TEXT( "Setting POP3 settings" );
+ pop3Set->SetServerAddressL( *iIncomingServer );
+ pop3Set->SetLoginNameL( *iIncomingUserName );
+ pop3Set->SetPasswordL( *iIncomingPassword );
+ pop3Set->SetApop( iAPopSecureLogin );
+ if ( iIncomingSecurity == 0 )
+ {
+ pop3Set->SetSecureSockets( EFalse );
+ }
+ else
+ {
+ pop3Set->SetSecureSockets( ETrue );
+ if ( iIncomingSecurity == 1 )
+ {
+ pop3Set->SetSSLWrapper( EFalse );
+ }
+ else
+ {
+ pop3Set->SetSSLWrapper( ETrue );
+ }
+ }
+ if ( iIncomingPort > 0 )
+ {
+ pop3Set->SetPort( (TUint) iIncomingPort );
+ }
+ else
+ {
+ if ( iIncomingSecurity == 2 ) // SSL
+ {
+ pop3Set->SetPort( KDefaultPopPortSSL );
+ }
+ else
+ {
+ pop3Set->SetPort( KPOP3DefaultPortNumber );
+ }
+ }
+ if ( iRetrievedParts == 0 ) // Only headers
+ {
+ pop3Set->SetGetMailOptions( EGetPop3EmailHeaders );
+ pop3Set->SetPopulationLimitL( -2 ); // -2 = headers only (EmailUtils.h)
+ }
+ else
+ {
+ pop3Set->SetGetMailOptions( EGetPop3EmailMessages );
+ if ( iRetrievedParts == 1 ) // Less than (kb)
+ {
+ pop3Set->SetMaxEmailSize( iRetrieveSizeLimitKb );
+ pop3Set->SetPopulationLimitL( iRetrieveSizeLimitKb );
+ }
+ else
+ {
+ pop3Set->SetPopulationLimitL( -1 ); // -1 = body and attachment (EmailUtils.h)
+ }
+ }
+
+ if ( iEmailsToRetrieve > 0 )
+ {
+ pop3Set->SetInboxSynchronisationLimit( iEmailsToRetrieve );
+ }
+ else
+ {
+ // If limit is not set (zero), retrieves all
+ pop3Set->SetInboxSynchronisationLimit( KErrNotFound );
+ }
+
+ pop3Set->SetAcknowledgeReceipts( EFalse );
+ pop3Set->SetDisconnectedUserMode( ETrue );
+ pop3Set->SetAutoSendOnConnect( ETrue );
+ pop3Set->SetDeleteEmailsWhenDisconnecting( EFalse );
+
+ popAccount = accounts->CreatePopAccountL(
+ *iMailboxName, *pop3Set, *incomingIapSet, EFalse );
+ HTI_LOG_FORMAT( "Created POP3 account %d", popAccount.iPopAccountId );
+ smtpAccount = accounts->CreateSmtpAccountL(
+ popAccount, *smtpSet, *outgoingIapSet, EFalse );
+ HTI_LOG_FORMAT( "Created SMTP account %d", smtpAccount.iSmtpAccountId );
+ }
+
+ // Set IMAP4 settings
+ else
+ {
+ HTI_LOG_TEXT( "Setting IMAP4 settings" );
+ imap4Set->SetServerAddressL( *iIncomingServer );
+ imap4Set->SetLoginNameL( *iIncomingUserName );
+ imap4Set->SetPasswordL( *iIncomingPassword );
+ if ( iIncomingSecurity == 0 )
+ {
+ imap4Set->SetSecureSockets( EFalse );
+ }
+ else
+ {
+ imap4Set->SetSecureSockets( ETrue );
+ if ( iIncomingSecurity == 1 )
+ {
+ imap4Set->SetSSLWrapper( EFalse );
+ }
+ else
+ {
+ imap4Set->SetSSLWrapper( ETrue );
+ }
+ }
+ if ( iIncomingPort > 0 )
+ {
+ imap4Set->SetPort( (TUint) iIncomingPort );
+ }
+ else
+ {
+ if ( iIncomingSecurity == 2 ) // SSL
+ {
+ imap4Set->SetPort( KDefaultImapPortSSL );
+ }
+ else
+ {
+ imap4Set->SetPort( KIMAPDefaultPortNumber );
+ }
+ }
+ if ( iEmailsToRetrieve > 0 )
+ {
+ imap4Set->SetInboxSynchronisationLimit( iEmailsToRetrieve );
+ imap4Set->SetMailboxSynchronisationLimit( iEmailsToRetrieve );
+ }
+ else
+ {
+ // If limit is not set (zero), retrieves all
+ imap4Set->SetInboxSynchronisationLimit( KErrNotFound );
+ imap4Set->SetMailboxSynchronisationLimit( KErrNotFound );
+ }
+
+ imap4Set->SetFolderPathL( *iImapFolderPath );
+
+ imap4Set->SetGetMailOptions( EGetImap4EmailHeaders );
+ imap4Set->SetPartialMailOptionsL( ENoSizeLimits );
+ imap4Set->SetBodyTextSizeLimitL( KMaxTInt );
+ imap4Set->SetAttachmentSizeLimitL( KMaxTInt );
+ imap4Set->SetAcknowledgeReceipts( EFalse );
+ imap4Set->SetDisconnectedUserMode( ETrue );
+ imap4Set->SetSynchronise( EUseLocal );
+ imap4Set->SetSubscribe( EUpdateNeither );
+ imap4Set->SetAutoSendOnConnect( ETrue );
+ imap4Set->SetDeleteEmailsWhenDisconnecting( EFalse );
+ imap4Set->SetImapIdle( ETrue );
+ imap4Set->SetUpdatingSeenFlags( ETrue );
+
+ imapAccount = accounts->CreateImapAccountL(
+ *iMailboxName, *imap4Set, *incomingIapSet, EFalse );
+ HTI_LOG_FORMAT( "Created IMAP4 account %d", imapAccount.iImapAccountId );
+ smtpAccount = accounts->CreateSmtpAccountL(
+ imapAccount, *smtpSet, *outgoingIapSet, EFalse );
+ HTI_LOG_FORMAT( "Created SMTP account %d", smtpAccount.iSmtpAccountId );
+ }
+
+ // Set as default if requested
+ if ( iSetAsDefault )
+ {
+ accounts->SetDefaultSmtpAccountL( smtpAccount );
+ }
+
+ // accounts, outgoingIapSet, incomingIapSet, smtpSet, pop3Set, imap4set
+ CleanupStack::PopAndDestroy( 6 );
+
+ // Get IDs of created incoming mail account
+ TMsvId mailboxId = 0;
+ TUint32 accountId = 0;
+ TUid protocol = TUid::Null();
+ if ( iMailboxType == 0 ) // POP3
+ {
+ mailboxId = popAccount.iPopService;
+ accountId = popAccount.iPopAccountId;
+ protocol.iUid = KSenduiMtmPop3UidValue;
+ }
+
+ else // IMAP4
+ {
+ mailboxId = imapAccount.iImapService;
+ accountId = imapAccount.iImapAccountId;
+ protocol.iUid = KSenduiMtmImap4UidValue;
+ iRetrievedParts = 0;
+ }
+
+ // Get the created mailbox entries
+ HTI_LOG_TEXT( "Opening MSV session" );
+ CMsvSession* session = CMsvSession::OpenSyncL( *this );
+ CleanupStack::PushL( session );
+ HTI_LOG_TEXT( "Getting mailbox MSV entries" );
+ CMsvEntry* incomingEntry = session->GetEntryL( mailboxId );
+ CleanupStack::PushL( incomingEntry );
+ CMsvEntry* outgoingEntry = session->GetEntryL( smtpAccount.iSmtpService );
+ CleanupStack::PushL( outgoingEntry );
+
+ // Store account IDs and device IMEI to entries
+ HTI_LOG_TEXT( "Storing account IDs and IMEI" );
+ TBuf<KImeiLength> phoneImei;
+ GetDeviceImeiL( phoneImei );
+ HTI_LOG_FORMAT( "Got IMEI: %S", &phoneImei );
+ TMsvEntry inTEntry = incomingEntry->Entry();
+ inTEntry.iMtmData2 = accountId;
+ inTEntry.iDescription.Set( phoneImei );
+ incomingEntry->ChangeL( inTEntry );
+ TMsvEntry outTEntry = outgoingEntry->Entry();
+ outTEntry.iMtmData2 = smtpAccount.iSmtpAccountId;
+ outTEntry.iDescription.Set( phoneImei );
+ outgoingEntry->ChangeL( outTEntry );
+
+ // Create the signature text if given
+ if ( iSignatureText->Length() > 0 )
+ {
+ // Get signature store
+ HTI_LOG_TEXT( "Getting signature store" );
+ CMsvStore* store = outgoingEntry->EditStoreL();
+ CleanupStack::PushL( store );
+
+ // Create signarure rich text
+ HTI_LOG_TEXT( "Creating signature CRichText" );
+ CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
+ CleanupStack::PushL( paraFormatLayer );
+ CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
+ CleanupStack::PushL( charFormatLayer );
+ CRichText* signature = CRichText::NewL( paraFormatLayer,
+ charFormatLayer );
+ CleanupStack::PushL( signature );
+ signature->InsertL( 0, *iSignatureText );
+
+ // Store the signature
+ store->StoreBodyTextL( *signature );
+ store->CommitL();
+
+ // signature, charFormatLayer, paraFormatLayer, store
+ CleanupStack::PopAndDestroy( 4 );
+ }
+
+ CleanupStack::PopAndDestroy( 3 ); // outgoingEntry, incomingEntry, session
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::HandleCreateMailboxL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::HandleDeleteMailboxL
+// Deletes a mailbox.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::HandleDeleteMailboxL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::HandleDeleteMailboxL" );
+
+ // Delete by name - name should be unique
+ TInt nameLength = aData[0];
+ if ( nameLength > KEmailAccountNameSize || nameLength == 0 ||
+ aData.Length() != ( nameLength + 1 ) )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ TBuf<KEmailAccountNameSize> accountName;
+ accountName.Copy( aData.Mid( 1, nameLength ) );
+ HTI_LOG_FORMAT( "Searching account with name: %S", &accountName );
+
+ TSmtpAccount smtpAcc;
+ User::LeaveIfError( FindSmtpAccount( accountName, smtpAcc ) );
+ HTI_LOG_FORMAT( "Found SMTP: %d", smtpAcc.iSmtpAccountId );
+ TMsvId relatedAcc = smtpAcc.iRelatedService;
+
+ CEmailAccounts* accounts = CEmailAccounts::NewLC();
+
+ // Delete the SMTP account
+ accounts->DeleteSmtpAccountL( smtpAcc );
+
+ // Search for related POP & IMAP acconts and delete if found
+ TInt result = KErrNone;
+ TPopAccount popAcc;
+ TRAP( result, accounts->GetPopAccountL( relatedAcc, popAcc ) );
+ if ( result == KErrNone )
+ {
+ HTI_LOG_FORMAT( "Found related POP: %d", popAcc.iPopAccountId );
+ accounts->DeletePopAccountL( popAcc );
+ }
+
+ TImapAccount imapAcc;
+ TRAP( result, accounts->GetImapAccountL( relatedAcc, imapAcc ) );
+ if ( result == KErrNone )
+ {
+ HTI_LOG_FORMAT( "Found related IMAP: %d", imapAcc.iImapAccountId );
+ accounts->DeleteImapAccountL( imapAcc );
+ }
+
+ CleanupStack::PopAndDestroy( 1 ); // accounts
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::HandleDeleteMailboxL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::ParseCreateMsgL
+// Parses the parameters from the create account message.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::ParseCreateMsgL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::ParseCreateMsgL" );
+ /* ACCOUNT SETTINGS
+ * Field Size Values Mandatory
+ * ---------------------------------------------------------------------
+ * Mailbox type 1 byte 0,1 YES
+ * Mailbox name length 1 byte 1-30 YES
+ * Mailbox name 1-30 YES
+ * Incoming mail server length 1 byte 3-50 YES
+ * Incoming mail server 3-50 YES
+ * Incoming access point name length 1 byte 0-255 YES
+ * Incoming access point name 0-255 NO
+ * Incoming user name length 1 byte 0-50 YES
+ * Incoming user name 0-50 NO
+ * Incoming password length 1 byte 0-50 YES
+ * Incoming password 0-50 NO
+ * Incoming security 1 byte 0,1,2 YES
+ * Incoming port 2 bytes 0-999 YES
+ * A POP secure login 1 byte 0,1 YES
+ * Outgoing mail server length 1 byte 1-50 YES
+ * Outgoing mail server 1-50 YES
+ * Outgoing access point name length 1 byte 0-255 YES
+ * Outgoing access point name 0-255 NO
+ * Outgoing user name length 1 byte 0-50 YES
+ * Outgoing user name 0-50 NO
+ * Outgoing password length 1 byte 0-50 YES
+ * Outgoing password 0-50 NO
+ * Outgoing security 1 byte 0,1,2 YES
+ * Outgoing port 2 bytes 0-999 YES
+ * Own mail address length 1 byte 1-100 YES
+ * Own mail address 1-100 YES
+ * Own name length 1 byte 0-100 YES
+ * Own name 0-100 NO
+ * Send message option 1 byte 0,1,2 YES
+ * Copy to own mail address 1 byte 0,1,2,3 YES
+ * Signature length 2 bytes 0-500 YES
+ * Signature text 0-500 NO
+ * New mail indicators 1 byte 0,1 YES
+ * Retrieved parts 1 byte 0,1,2 YES
+ * Retrieve size limit 2 bytes 1-999 YES
+ * Emails to retrieve 2 bytes 0-999 YES
+ * IMAP4 folder path length 1 byte 0-100 YES
+ * IMAP4 folder path 0-100 NO
+ * Automatic update 1 byte 0,1,2 YES
+ * Set as default for outgoing mail 1 byte 0,1 YES
+ */
+
+ TInt dataLength = aData.Length();
+ HTI_LOG_FORMAT( "Data length = %d", dataLength );
+ TInt offset = 0;
+ iMailboxType = aData[offset];
+ HTI_LOG_FORMAT( "Mailbox type = %d", iMailboxType );
+ if ( iMailboxType != 0 && iMailboxType != 1 )
+ {
+ User::Leave( KErrArgument );
+ }
+ offset++;
+
+ iMailboxName = ParseStringL( aData, offset );
+ offset += iMailboxName->Length() + 1;
+
+ iIncomingServer = ParseStringL( aData, offset );
+ offset += iIncomingServer->Length() + 1;
+
+
+ iIncomingApName = ParseStringL( aData, offset );
+ offset += iIncomingApName->Length() + 1;
+
+ iIncomingUserName = ParseString8L( aData, offset );
+ offset += iIncomingUserName->Length() + 1;
+
+ iIncomingPassword = ParseString8L( aData, offset );
+ offset += iIncomingPassword->Length() + 1;
+
+ // Check that it's safe to read next 4 bytes
+ if ( offset + 3 >= dataLength )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ iIncomingSecurity = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Incoming security = %d", iIncomingSecurity );
+
+ iIncomingPort = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Incoming port = %d", iIncomingPort );
+
+ iAPopSecureLogin = (TBool) aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "A POP secure login = %d", iAPopSecureLogin );
+
+ iOutgoingServer = ParseStringL( aData, offset );
+ offset += iOutgoingServer->Length() + 1;
+
+ iOutgoingApName = ParseStringL( aData, offset );
+ offset += iOutgoingApName->Length() + 1;
+
+ iOutgoingUserName = ParseString8L( aData, offset );
+ offset += iOutgoingUserName->Length() + 1;
+
+ iOutgoingPassword = ParseString8L( aData, offset );
+ offset += iOutgoingPassword->Length() + 1;
+
+ // Check that it's safe to read next 3 bytes
+ if ( offset + 2 >= dataLength )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ iOutgoingSecurity = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Outgoing security = %d", iOutgoingSecurity );
+
+ iOutgoingPort = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Outgoing port = %d", iOutgoingPort );
+
+ iOwnMailAddress = ParseStringL( aData, offset );
+ offset += iOwnMailAddress->Length() + 1;
+
+ iOwnName = ParseStringL( aData, offset );
+ offset += iOwnName->Length() + 1;
+
+ // Check that it's safe to read next 2 bytes
+ if ( offset + 1 >= dataLength )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ iSendOption = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Send option = %d", iSendOption );
+
+ iSendCopyToOwnAddress = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Send copy = %d", iSendCopyToOwnAddress );
+
+ iSignatureText = ParseStringL( aData, offset, 2 );
+ offset += iSignatureText->Length() + 2;
+
+ // Check that it's safe to read next 6 bytes
+ if ( offset + 5 >= dataLength )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ iNewMailIndicators = (TBool) aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Indicators = %d", iNewMailIndicators );
+
+ iRetrievedParts = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Retrieved parts = %d", iRetrievedParts );
+
+ iRetrieveSizeLimitKb = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Size limit = %d", iRetrieveSizeLimitKb );
+
+ iEmailsToRetrieve = aData[offset] + ( aData[offset+1] << 8 );
+ offset += 2;
+ HTI_LOG_FORMAT( "Emails to retrieve = %d", iEmailsToRetrieve );
+
+ iImapFolderPath = ParseString8L( aData, offset );
+ offset += iImapFolderPath->Length() + 1;
+
+ // Check that it's safe to read next 2 bytes
+ if ( offset + 1 >= dataLength )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ iAutomaticUpdate = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Automatic update = %d", iAutomaticUpdate );
+
+ iSetAsDefault = (TBool) aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Set as default = %d", iSetAsDefault );
+
+ HTI_LOG_FORMAT( "Final offset= %d", offset );
+ // Check that there's no extra bytes
+ if ( offset != dataLength )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ // Validate fields - limits based on S60 3.0 mailbox settings UI
+ if ( iMailboxName->Length() < 1 ||
+ iMailboxName->Length() > 30 ||
+ iIncomingServer->Length() < 3 || // a.b
+ iIncomingServer->Length() > 50 ||
+ iOutgoingServer->Length() < 3 || // a.b
+ iOutgoingServer->Length() > 50 ||
+ iOwnMailAddress->Length() < 5 || // a@b.c
+ iOwnMailAddress->Length() > 100 ||
+ iIncomingUserName->Length() > 50 ||
+ iIncomingPassword->Length() > 50 ||
+ iOutgoingUserName->Length() > 50 ||
+ iOutgoingPassword->Length() > 50 ||
+ iOwnName->Length() > 100 ||
+ iSignatureText->Length() > 500 ||
+ iImapFolderPath->Length() > 100 ||
+ iIncomingPort > 999 ||
+ iOutgoingPort > 999 ||
+ iRetrieveSizeLimitKb > 999 ||
+ iEmailsToRetrieve > 999 ||
+ iIncomingSecurity > 2 ||
+ iOutgoingSecurity > 2 ||
+ iSendOption > 2 ||
+ iSendCopyToOwnAddress > 3 ||
+ iRetrievedParts > 2 ||
+ iAutomaticUpdate > 2 )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::ParseCreateMsgL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::ParseStringL
+// Helper for parsing one string from the message.
+// ----------------------------------------------------------------------------
+HBufC* CHtiMailboxHandler::ParseStringL( const TDesC8& aData,
+ TInt aStrLenOffset,
+ TInt aStrLenBytes )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::ParseStringL" );
+ if ( aStrLenOffset >= aData.Length() ||
+ aStrLenBytes > 2 || aStrLenBytes < 1 )
+ {
+ User::Leave( KErrArgument );
+ }
+ TInt strLen = 0;
+ if ( aStrLenBytes == 1 )
+ {
+ strLen = aData[aStrLenOffset];
+ }
+ else
+ {
+ strLen = aData[aStrLenOffset] + ( aData[aStrLenOffset +1 ] << 8 );
+ }
+
+ if ( aData.Length() <= aStrLenOffset + strLen )
+ {
+ User::Leave( KErrArgument );
+ }
+ HTI_LOG_FORMAT( "String length = %d", strLen );
+ HBufC* result = HBufC::NewL( strLen );
+ result->Des().Copy( aData.Mid( aStrLenOffset + aStrLenBytes, strLen ) );
+ HTI_LOG_FORMAT( "Parsed: %S", result );
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::ParseStringL" );
+ return result;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::ParseString8L
+// Helper for parsing one string from the message.
+// ----------------------------------------------------------------------------
+HBufC8* CHtiMailboxHandler::ParseString8L( const TDesC8& aData,
+ TInt aStrLenOffset,
+ TInt aStrLenBytes )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::ParseString8L" );
+ if ( aStrLenOffset >= aData.Length() ||
+ aStrLenBytes > 2 || aStrLenBytes < 1 )
+ {
+ User::Leave( KErrArgument );
+ }
+ TInt strLen = 0;
+ if ( aStrLenBytes == 1 )
+ {
+ strLen = aData[aStrLenOffset];
+ }
+ else
+ {
+ strLen = aData[aStrLenOffset] + ( aData[aStrLenOffset + 1] << 8 );
+ }
+ if ( aData.Length() <= aStrLenOffset + strLen )
+ {
+ User::Leave( KErrArgument );
+ }
+ HTI_LOG_FORMAT( "String length = %d", strLen );
+ HBufC8* result = aData.Mid( aStrLenOffset + aStrLenBytes, strLen ).AllocL();
+ HTI_LOG_FORMAT( "Parsed: %S", result );
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::ParseString8L" );
+ return result;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::AccessPointUIDL
+// Gets the UID of Access Point named by aApName.
+// Returns KErrNotFound if AP not found.
+// ----------------------------------------------------------------------------
+TInt CHtiMailboxHandler::AccessPointUIDL( const TDesC& aApName )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::AccessPointUIDL" );
+ TInt iapId = KErrNotFound;
+
+ // Search from uncategorised first
+ RArray<TUint32> array = RArray<TUint32>();
+ iCmManager.ConnectionMethodL( array );
+ CleanupClosePushL( array );
+ TInt i = 0;
+ while ( i < array.Count() && iapId == KErrNotFound )
+ {
+ RCmConnectionMethod cm = iCmManager.ConnectionMethodL( array[i] );
+ CleanupClosePushL( cm );
+ HBufC* name = cm.GetStringAttributeL( CMManager::ECmName );
+ HTI_LOG_FORMAT( "Found name: %S", name );
+ CleanupStack::PushL( name );
+ if ( aApName.Compare( *name ) == 0 )
+ {
+ iapId = cm.GetIntAttributeL( CMManager::ECmId );
+ HTI_LOG_FORMAT( "Match: UID = %d", iapId );
+ }
+ CleanupStack::PopAndDestroy(); // name
+ CleanupStack::PopAndDestroy(); // cm
+ i++;
+ }
+ CleanupStack::PopAndDestroy(); // array
+
+ // If not found from uncategorised, search from all destinations
+ if ( iapId == KErrNotFound )
+ {
+ HTI_LOG_TEXT( "Not found from uncategorised" );
+ RArray<TUint32> destIdArray = RArray<TUint32>();
+ iCmManager.AllDestinationsL( destIdArray );
+ CleanupClosePushL( destIdArray );
+ i = 0;
+ while ( i < destIdArray.Count() && iapId == KErrNotFound )
+ {
+ RCmDestination dest = iCmManager.DestinationL( destIdArray[i] );
+ CleanupClosePushL( dest );
+ TInt j = 0;
+ while ( j < dest.ConnectionMethodCount() && iapId == KErrNotFound )
+ {
+ HBufC* name = dest.ConnectionMethodL( j ).GetStringAttributeL(
+ CMManager::ECmName );
+ CleanupStack::PushL( name );
+ HTI_LOG_FORMAT( "Found name: %S", name );
+ if ( aApName.Compare( *name ) == 0 )
+ {
+ iapId = dest.ConnectionMethodL( j ).GetIntAttributeL(
+ CMManager::ECmId );
+ HTI_LOG_FORMAT( "Match: UID = %d", iapId );
+ }
+ CleanupStack::PopAndDestroy(); // name
+ j++;
+ }
+ CleanupStack::PopAndDestroy(); // dest
+ i++;
+ }
+ CleanupStack::PopAndDestroy(); // destIdArray
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::AccessPointUIDL" );
+ return iapId;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::FindSmtpAccount
+// Searches for an SMTP account by name.
+// Returns KErrNone if found, otherwise KErrNotFound or other error.
+// ----------------------------------------------------------------------------
+TInt CHtiMailboxHandler::FindSmtpAccount( const TDesC& aAccountName,
+ TSmtpAccount& aAccount )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::FindSmtpAccount" );
+
+ TInt err = KErrNone;
+ TInt popCount = 0;
+
+ RArray<TSmtpAccount> smtpAccounts;
+ CleanupClosePushL( smtpAccounts );
+ popCount++; // smtpAccounts
+
+ CEmailAccounts* accounts = NULL;
+ TRAP( err, accounts = CEmailAccounts::NewL() );
+
+ if ( err == KErrNone )
+ {
+ CleanupStack::PushL( accounts );
+ popCount++; // accounts
+ TRAP( err, accounts->GetSmtpAccountsL( smtpAccounts ) );
+ }
+
+ if ( err == KErrNone )
+ {
+ TInt count = smtpAccounts.Count();
+ HTI_LOG_FORMAT( "Found %d SMTP accounts", count );
+ err = KErrNotFound;
+ for ( TInt i = 0; i < count; i++ )
+ {
+ aAccount = smtpAccounts[i];
+ HTI_LOG_FORMAT( "Account name: %S", &aAccount.iSmtpAccountName );
+ if ( aAccount.iSmtpAccountName.Compare( aAccountName ) == 0 )
+ {
+ HTI_LOG_FORMAT( "Match - MSV ID %d", aAccount.iSmtpService );
+ err = KErrNone;
+ break;
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy( popCount );
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::FindSmtpAccount" );
+ return err;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::GetDeviceImeiL()
+// Gets the device IMEI code and stores it to aResult.
+// ----------------------------------------------------------------------------
+//
+void CHtiMailboxHandler::GetDeviceImeiL( TDes& aResult )
+ {
+ if ( aResult.MaxLength() < KImeiLength )
+ {
+ User::Leave( KErrBadDescriptor );
+ }
+#ifdef __WINS__
+ aResult.Copy( KWinsImei );
+#else
+ RTelServer telServer;
+ User::LeaveIfError( telServer.Connect() );
+ CleanupClosePushL( telServer );
+ User::LeaveIfError( telServer.LoadPhoneModule( KTsyName ) );
+
+ TInt phoneCount = 0;
+ User::LeaveIfError( telServer.EnumeratePhones( phoneCount ) );
+ if ( phoneCount < 1 )
+ {
+ User::Leave( KErrNotFound );
+ }
+
+ RTelServer::TPhoneInfo phoneInfo;
+ User::LeaveIfError( telServer.GetPhoneInfo( 0, phoneInfo ) );
+ RMobilePhone mobilePhone;
+ User::LeaveIfError( mobilePhone.Open( telServer, phoneInfo.iName ) );
+ CleanupClosePushL( mobilePhone );
+
+ RMobilePhone::TMobilePhoneIdentityV1 identity;
+ TRequestStatus status;
+ mobilePhone.GetPhoneId( status, identity );
+ User::WaitForRequest( status );
+ User::LeaveIfError( status.Int() );
+
+ aResult.Copy( identity.iSerialNumber );
+ CleanupStack::PopAndDestroy( 2 ); // mobilePhone, telServer
+#endif
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::ResetVariables
+// Clears the instance variables that store the create message parameters.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::ResetVariables()
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::ResetVariables" );
+ delete iMailboxName;
+ iMailboxName = NULL;
+ delete iIncomingServer;
+ iIncomingServer = NULL;
+ delete iIncomingApName;
+ iIncomingApName = NULL;
+ delete iIncomingUserName;
+ iIncomingUserName = NULL;
+ delete iIncomingPassword;
+ iIncomingPassword = NULL;
+ delete iOutgoingServer;
+ iOutgoingServer = NULL;
+ delete iOutgoingApName;
+ iOutgoingApName = NULL;
+ delete iOutgoingUserName;
+ iOutgoingUserName = NULL;
+ delete iOutgoingPassword;
+ iOutgoingPassword = NULL;
+ delete iOwnMailAddress;
+ iOwnMailAddress = NULL;
+ delete iOwnName;
+ iOwnName = NULL;
+ delete iSignatureText;
+ iSignatureText = NULL;
+ delete iImapFolderPath;
+ iImapFolderPath = NULL;
+
+ iMailboxType = KErrUnknown;
+ iIncomingSecurity = KErrUnknown;
+ iIncomingPort = KErrUnknown;
+ iOutgoingSecurity = KErrUnknown;
+ iOutgoingPort = KErrUnknown;
+ iSendOption = KErrUnknown;
+ iSendCopyToOwnAddress = KErrUnknown;
+ iRetrievedParts = KErrUnknown;
+ iRetrieveSizeLimitKb = KErrUnknown;
+ iEmailsToRetrieve = KErrUnknown;
+ iAutomaticUpdate = KErrUnknown;
+
+ iAPopSecureLogin = EFalse;
+ iNewMailIndicators = EFalse;
+ iSetAsDefault = EFalse;
+
+ iCmManager.Close();
+
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::ResetVariables" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::SendOkMsgL
+// Helper function for sending response messages.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::SendOkMsgL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::SendOkMsgL" );
+ User::LeaveIfNull( iDispatcher );
+ HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+ TPtr8 response = temp->Des();
+ response.Append( ( TChar ) CHtiMessagesServicePlugin::EResultOk );
+ response.Append( aData );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+ temp, KHtiMessagesServiceUid ) );
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::SendOkMsgL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::SendErrorMessageL
+// Helper function for sending error response messages.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMailboxHandler::SendErrorMessageL" );
+ User::LeaveIfNull( iDispatcher );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+ aError, aDescription, KHtiMessagesServiceUid ) );
+ HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::SendErrorMessageL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::HandleSessionEventL
+// From MMsvSessionObserver.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::HandleSessionEventL( TMsvSessionEvent /*aEvent*/,
+ TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/ )
+ {
+ // HTI_LOG_FUNC_IN( "CHtiMailboxHandler::HandleSessionEventL" );
+
+ // HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::HandleSessionEventL" );
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMessagesServicePlugin.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MessagesServicePlugin implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiMessagesServicePlugin.h"
+#include "MessageMgmntHandler.h"
+#include "HtiIAPHandler.h"
+#include "HtiMailboxHandler.h"
+#include "HtiMsgSettingsHandler.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+// CONSTANTS
+_LIT8( KErrorMissingCommand, "Command was not given - message was empty" );
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+
+// ----------------------------------------------------------------------------
+// Create instance of concrete ECOM interface implementation
+CHtiMessagesServicePlugin* CHtiMessagesServicePlugin::NewL()
+ {
+ CHtiMessagesServicePlugin* self = new (ELeave) CHtiMessagesServicePlugin;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+CHtiMessagesServicePlugin::CHtiMessagesServicePlugin()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+CHtiMessagesServicePlugin::~CHtiMessagesServicePlugin()
+ {
+ HTI_LOG_TEXT( "CHtiMessagesServicePlugin destroy" );
+ delete iMessageHandler;
+ delete iIAPHandler;
+ delete iMailboxHandler;
+ delete iMsgSettingsHandler;
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiMessagesServicePlugin::ConstructL()
+ {
+ HTI_LOG_TEXT( "CHtiMessagesServicePlugin::ConstructL" );
+
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiMessagesServicePlugin::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority)
+ {
+ HTI_LOG_FUNC_IN( "CHtiMessagesServicePlugin::ProcessMessageL" );
+ HTI_LOG_FORMAT( "Msg len: %d.", aMessage.Length() );
+
+ if ( aMessage.Length() == 0 )
+ {
+ User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument, KErrorMissingCommand, KHtiMessagesServiceUid ) );
+ return;
+ }
+
+ TUint8 command = aMessage.Ptr()[0];
+
+ if ( command >= EAddSms && command <= EDeleteFolderContent )
+ {
+ if ( !iMessageHandler )
+ {
+ iMessageHandler = CMessageMgmntHandler::NewL();
+ iMessageHandler->SetDispatcher( iDispatcher );
+ }
+ iMessageHandler->ProcessMessageL( aMessage, aPriority );
+ }
+ else if ( command >= ECreateMailBox && command <= EDeleteMailBox )
+ {
+ if ( !iMailboxHandler )
+ {
+ iMailboxHandler = CHtiMailboxHandler::NewL();
+ iMailboxHandler->SetDispatcher( iDispatcher );
+ }
+ iMailboxHandler->ProcessMessageL( aMessage, aPriority );
+ }
+ else if ( command >= ECreateIAP && command <= ESetDefaultConnection )
+ {
+ if ( !iIAPHandler )
+ {
+ iIAPHandler = CHtiIAPHandler::NewL();
+ iIAPHandler->SetDispatcher( iDispatcher );
+ }
+ iIAPHandler->ProcessMessageL( aMessage, aPriority );
+ }
+
+ else if ( command >= ESetDefaultSmsCenter && command <= ESetMmsSettings )
+ {
+ if ( !iMsgSettingsHandler )
+ {
+ iMsgSettingsHandler = CHtiMsgSettingsHandler::NewL();
+ iMsgSettingsHandler->SetDispatcher( iDispatcher );
+ }
+ iMsgSettingsHandler->ProcessMessageL( aMessage, aPriority );
+ }
+
+ else
+ {
+ User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument, KErrorUnrecognizedCommand, KHtiMessagesServiceUid ) );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiMessagesServicePlugin::ProcessMessageL: Done" );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMsgSettingsHandler.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,829 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of message settings handling.
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiMessagesServicePlugin.h"
+#include "HtiMsgSettingsHandler.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+#include <cmconnectionmethod.h>
+#include <cmconnectionmethoddef.h>
+#include <cmdestination.h>
+#include <cmmanager.h>
+
+#include <csmsaccount.h>
+#include <mmssettings.h>
+#include <smutset.h>
+#include <centralrepository.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TUid KCRUidSmum = { 0x101F87EF }; // from MessagingInternalCRKeys.h
+
+const TInt KMinSetDefaultSmsCenterLength = 4;
+const TInt KMinDeleteSmsCenterLength = 2;
+const TInt KMinSetMmsSettingsLength = 10;
+
+// set SMS settings has a fixed length
+const TInt KSetSmsSettingsLength = 6;
+
+// message validity times in seconds
+const TInt KValidityTimeMax = 0;
+const TInt KValidityTime1h = 3600;
+const TInt KValidityTime6h = 6 * 3600;
+const TInt KValidityTime24h = 24 * 3600;
+const TInt KValidityTime3d = 3 * 24 * 3600;
+const TInt KValidityTime1w = 7 * 24 * 3600;
+
+// from MmsSettingsDefs.h
+const TInt KMmsUniImageSmallWidth = 640;
+const TInt KMmsUniImageSmallHeight = 480;
+const TInt KMmsUniImageLargeWidth = 1600;
+const TInt KMmsUniImageLargeHeight = 1200;
+
+const TInt KApMaxConnNameLength = 30;
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+_LIT8( KErrorInvalidParameters, "Invalid command parameters" );
+_LIT8( KErrorSetDefaultSmsCenterFailed, "Setting default SMS center failed" );
+_LIT8( KErrorDeleteSmsCenterFailed, "SMS center deletion failed" );
+_LIT8( KErrorSmsCenterAlreadyExists, "SMS center with given name already exists with different number" );
+_LIT8( KErrorSmsCenterNotFound, "SMS center with given name not found" );
+_LIT8( KErrorSetSmsSettingsFailed, "Setting SMS service settings failed" );
+_LIT8( KErrorSetMmsSettingsFailed, "Setting MMS service settings failed" );
+_LIT8( KErrorApNotFound, "Access Point not found" );
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CHtiMsgSettingsHandler* CHtiMsgSettingsHandler::NewL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::NewL" );
+ CHtiMsgSettingsHandler* self = new (ELeave) CHtiMsgSettingsHandler();
+ CleanupStack::PushL ( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::NewL" );
+ return self;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::CHtiMsgSettingsHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+CHtiMsgSettingsHandler::CHtiMsgSettingsHandler()
+ {
+ HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::CHtiMsgSettingsHandler" );
+
+ HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::CHtiMsgSettingsHandler" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::~CHtiMsgSettingsHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+CHtiMsgSettingsHandler::~CHtiMsgSettingsHandler()
+ {
+ HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::~CHtiMsgSettingsHandler" );
+
+ HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::~CHtiMsgSettingsHandler" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::ConstructL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::ConstructL" );
+
+ HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::ConstructL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::SetDispatcher
+// Sets the dispatcher pointer.
+// -----------------------------------------------------------------------------
+
+void CHtiMsgSettingsHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::SetDispatcher" );
+ iDispatcher = aDispatcher;
+ HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::SetDispatcher" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::ProcessMessageL
+// Parses the received message and calls handler functions.
+// -----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/ )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::ProcessMessageL" );
+
+ // Zero length message and command code validity already checked
+ // in HtiMessagesServicePlugin.
+
+ if ( aMessage[0] == CHtiMessagesServicePlugin::ESetDefaultSmsCenter )
+ {
+ if ( aMessage.Length() < 1 + KMinSetDefaultSmsCenterLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ TRAPD( err, HandleSetDefaultSmsCenterL(
+ aMessage.Right( aMessage.Length() - 1 ) ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorSetDefaultSmsCenterFailed );
+ }
+ }
+ }
+
+ else if ( aMessage[0] == CHtiMessagesServicePlugin::EDeleteSmsCenter )
+ {
+ if ( aMessage.Length() < 1 + KMinDeleteSmsCenterLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ TRAPD( err, HandleDeleteSmsCenterL(
+ aMessage.Right( aMessage.Length() - 1 ) ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorDeleteSmsCenterFailed );
+ }
+ }
+ }
+
+ else if ( aMessage[0] == CHtiMessagesServicePlugin::ESetSmsSettings )
+ {
+ if ( aMessage.Length() != 1 + KSetSmsSettingsLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ TRAPD( err, HandleSetSmsSettingsL(
+ aMessage.Right( aMessage.Length() - 1 ) ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorSetSmsSettingsFailed );
+ }
+ }
+ }
+
+ else if ( aMessage[0] == CHtiMessagesServicePlugin::ESetMmsSettings )
+ {
+ if ( aMessage.Length() < 1 + KMinSetMmsSettingsLength )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ TRAPD( err, HandleSetMmsSettingsL(
+ aMessage.Right( aMessage.Length() - 1 ) ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorSetMmsSettingsFailed );
+ }
+ }
+ }
+
+ else
+ {
+ SendErrorMessageL( KErrArgument, KErrorUnrecognizedCommand );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::ProcessMessageL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::HandleSetDefaultSmsCenterL
+// Creates new default SMS center.
+// ----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::HandleSetDefaultSmsCenterL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::HandleSetDefaultSmsCenterL" );
+
+ TBuf<255> name;
+ TBuf<255> number;
+
+ TInt dataLength = aData.Length();
+ TInt offset = 0;
+ TInt fieldLength = aData[offset];
+ offset++;
+
+ if ( offset + fieldLength > dataLength )
+ {
+ HTI_LOG_TEXT( "Invalid length specified for name" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return;
+ }
+ name.Copy( aData.Mid( offset, fieldLength ) );
+ offset += fieldLength;
+ fieldLength = aData[offset];
+ offset++;
+
+ if ( offset + fieldLength > dataLength )
+ {
+ HTI_LOG_TEXT( "Invalid length specified for number" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return;
+ }
+ number.Copy( aData.Mid( offset, fieldLength ) );
+
+ HTI_LOG_FORMAT( "SMS center name: %S", &name );
+ HTI_LOG_FORMAT( "SMS center number: %S", &number );
+
+ HTI_LOG_TEXT( "Loading current settings..." );
+ CSmsSettings* smsSettings = CSmsSettings::NewLC();
+ CSmsAccount* smsAccount = CSmsAccount::NewLC();
+ smsAccount->LoadSettingsL( *smsSettings );
+
+ HTI_LOG_TEXT( "Looping through existing SMS centers..." );
+ TInt i = 0;
+ for ( i = 0; i < smsSettings->ServiceCenterCount(); i++ )
+ {
+ CSmsServiceCenter ¢er = smsSettings->GetServiceCenter( i );
+
+ HTI_LOG_FORMAT( "Found SMS center: %S", &( center.Name() ) );
+
+ if ( center.Name() == name && center.Address() != number )
+ {
+ HTI_LOG_TEXT( "Error, SMS center with given name already exists" );
+ SendErrorMessageL( KErrAlreadyExists, KErrorSmsCenterAlreadyExists );
+ CleanupStack::PopAndDestroy( 2 ); // smsAccount, smsSettings
+ return;
+ }
+ else if ( center.Name() == name && center.Address() == number )
+ {
+ HTI_LOG_TEXT( "The defined SMS center already exists, setting it to default" );
+ smsSettings->SetDefaultServiceCenter( i );
+ smsAccount->SaveSettingsL( *smsSettings );
+
+ CleanupStack::PopAndDestroy( 2 ); // smsAccount, smsSettings
+ SendOkMsgL( KNullDesC8 );
+
+ return;
+ }
+ }
+
+ HTI_LOG_TEXT( "Creating new default SMS center" );
+ smsSettings->AddServiceCenterL( name, number );
+ smsSettings->SetDefaultServiceCenter( i );
+ smsAccount->SaveSettingsL( *smsSettings );
+
+ CleanupStack::PopAndDestroy( 2 ); // smsAccount, smsSettings
+
+ SendOkMsgL( KNullDesC8 );
+
+ HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::HandleSetDefaultSmsCenterL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::HandleDeleteSmsCenterL
+// Deletes the defined SMS center.
+// ----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::HandleDeleteSmsCenterL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::HandleDeleteSmsCenterL" );
+
+ TBuf<255> name;
+
+ TInt dataLength = aData.Length();
+ TInt offset = 0;
+ TInt fieldLength = aData[offset];
+ offset++;
+
+ if ( offset + fieldLength > dataLength )
+ {
+ HTI_LOG_TEXT( "Invalid length specified for name" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return;
+ }
+ name.Copy( aData.Mid( offset, fieldLength ) );
+
+ HTI_LOG_FORMAT( "SMS center name: %S", &name );
+
+ HTI_LOG_TEXT( "Loading current settings..." );
+ CSmsSettings* smsSettings = CSmsSettings::NewLC();
+ CSmsAccount* smsAccount = CSmsAccount::NewLC();
+ smsAccount->LoadSettingsL( *smsSettings );
+
+ HTI_LOG_TEXT( "Looping through existing SMS centers..." );
+ TInt i = 0;
+ for ( i = 0; i < smsSettings->ServiceCenterCount(); i++ )
+ {
+ CSmsServiceCenter ¢er = smsSettings->GetServiceCenter( i );
+
+ HTI_LOG_FORMAT( "Found SMS center: %S", &( center.Name() ) );
+
+ if ( center.Name() == name )
+ {
+ HTI_LOG_TEXT( "Name matches, deleting..." );
+ smsSettings->RemoveServiceCenter( i );
+ smsAccount->SaveSettingsL( *smsSettings );
+
+ CleanupStack::PopAndDestroy( 2 ); // smsAccount, smsSettings
+
+ SendOkMsgL( KNullDesC8 );
+ return;
+ }
+ }
+
+ CleanupStack::PopAndDestroy( 2 ); // smsAccount, smsSettings
+
+ SendErrorMessageL( KErrNotFound, KErrorSmsCenterNotFound );
+
+ HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::HandleDeleteSmsCenterL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::HandleSetSmsSettingsL
+// Sets the SMS service settings.
+// ----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::HandleSetSmsSettingsL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::HandleSetSmsSettingsL" );
+
+ // extract values
+ TInt offset = 0;
+ TInt characterSupport = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Character support = %d", characterSupport );
+
+ TBool deliveryReport = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Delivery report = %d", deliveryReport );
+
+ TInt validityPeriod = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Validity period = %d", validityPeriod );
+
+ TInt messageConversion = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Message conversion = %d", messageConversion );
+
+ TInt preferredConnection = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Preferred connection = %d", preferredConnection );
+
+ TBool replyViaSameCenter = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "Reply via same center = %d", replyViaSameCenter );
+
+ // Validate values
+ if ( characterSupport > 1 || validityPeriod > 5 ||
+ messageConversion > 3 || preferredConnection > 1 )
+ {
+ HTI_LOG_TEXT( "Invalid values found" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return;
+ }
+
+ HTI_LOG_TEXT( "Loading current settings..." );
+ CSmsSettings* smsSettings = CSmsSettings::NewLC();
+ CSmsAccount* smsAccount = CSmsAccount::NewLC();
+ smsAccount->LoadSettingsL( *smsSettings );
+
+ HTI_LOG_TEXT( "Opening SMS settings Central Repository" );
+ CRepository* cenRep = CRepository::NewLC( KCRUidSmum );
+ HTI_LOG_TEXT( "Setting character support setting to SMS settings Central Repository" );
+ TUint32 KSmumCharSupport = 0x00000008; // from MessagingInternalCRKeys.h
+ switch ( characterSupport )
+ {
+ case 0:
+ cenRep->Set( KSmumCharSupport, ECharSetFull );
+ break;
+ case 1:
+ cenRep->Set( KSmumCharSupport, ECharSetReduced );
+ break;
+ default:
+ User::Leave( KErrArgument );
+ break;
+ }
+ CleanupStack::PopAndDestroy( cenRep );
+ HTI_LOG_TEXT( "SMS settings Central Repository closed" );
+
+ smsSettings->SetDeliveryReport( deliveryReport );
+
+ switch ( validityPeriod )
+ {
+ case 0:
+ smsSettings->SetValidityPeriod( TTimeIntervalMinutes( 0 ) );
+ break;
+ case 1:
+ smsSettings->SetValidityPeriod(
+ TTimeIntervalMinutes( KValidityTime1h / 60 ) );
+ break;
+ case 2:
+ smsSettings->SetValidityPeriod(
+ TTimeIntervalMinutes( KValidityTime6h / 60 ) );
+ break;
+ case 3:
+ smsSettings->SetValidityPeriod(
+ TTimeIntervalMinutes( KValidityTime24h / 60 ) );
+ break;
+ case 4:
+ smsSettings->SetValidityPeriod(
+ TTimeIntervalMinutes( KValidityTime3d / 60 ) );
+ break;
+ case 5:
+ smsSettings->SetValidityPeriod(
+ TTimeIntervalMinutes( KValidityTime1w / 60 ) );
+ break;
+ default:
+ User::Leave( KErrArgument );
+ break;
+ }
+
+ switch ( messageConversion )
+ {
+ case 0:
+ smsSettings->SetMessageConversion( ESmsConvPIDNone );
+ break;
+ case 1:
+ smsSettings->SetMessageConversion( ESmsConvFax );
+ break;
+ case 2:
+ smsSettings->SetMessageConversion( ESmsConvPaging );
+ break;
+ case 3:
+ smsSettings->SetMessageConversion( ESmsConvMail );
+ break;
+ default:
+ User::Leave( KErrArgument );
+ break;
+ }
+
+ switch ( preferredConnection )
+ {
+ case 0:
+ smsSettings->SetSmsBearer( CSmsSettings::ESmsBearerCircuitPreferred );
+ break;
+ case 1:
+ smsSettings->SetSmsBearer( CSmsSettings::ESmsBearerPacketPreferred );
+ break;
+ default:
+ User::Leave( KErrArgument );
+ break;
+ }
+
+ smsSettings->SetReplyPath( replyViaSameCenter );
+
+ HTI_LOG_TEXT( "Saving the settings" );
+ smsAccount->SaveSettingsL( *smsSettings );
+
+ CleanupStack::PopAndDestroy( 2 ); // smsAccount, smsSettings
+
+ SendOkMsgL( KNullDesC8 );
+
+ HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::HandleSetSmsSettingsL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::HandleSetMmsSettingsL
+// Sets the MMS service settings.
+// ----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::HandleSetMmsSettingsL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::HandleSetMmsSettingsL" );
+ TInt offset = 0;
+
+ // Get the access point name and search UID for that AP.
+ TInt apNameLength = aData[offset];
+ offset++;
+ if ( apNameLength > KApMaxConnNameLength ||
+ aData.Length() != ( KMinSetMmsSettingsLength + apNameLength - 1 ) )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return;
+ }
+
+ TBuf<KApMaxConnNameLength> apName;
+ apName.Copy( aData.Mid( offset, apNameLength ) );
+ offset += apNameLength;
+ HTI_LOG_FORMAT( "Searching AP with name: %S", &apName );
+ TInt apUid = GetAccessPointUIDL( apName );
+ if ( apUid == KErrNotFound )
+ {
+ SendErrorMessageL( KErrNotFound, KErrorApNotFound );
+ return;
+ }
+
+ // Extract other values
+ TMmsCreationMode creationMode = ( TMmsCreationMode ) aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "creation mode = %d", creationMode );
+
+ TInt imageSize = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "image size = %d", imageSize );
+
+ TInt receptionMode = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "reception mode = %d", receptionMode );
+
+ TBool receiveAnonymous = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "receive anonymous = %d", receiveAnonymous );
+
+ TBool receiveAdvert = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "receive adverts = %d", receiveAdvert );
+
+ TBool requestDeliveryReport = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "request deliv reps = %d", requestDeliveryReport );
+
+ TBool sendDeliveryReport = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "send deliv reps = %d", sendDeliveryReport );
+
+ TInt validityPeriod = aData[offset];
+ offset++;
+ HTI_LOG_FORMAT( "validity period = %d", validityPeriod );
+
+ // Validate values
+ if ( creationMode > 2 || imageSize > 2 ||
+ receptionMode > 3 || validityPeriod > 5 ||
+ ( creationMode == 0 && imageSize == 2 ) )
+ {
+ HTI_LOG_TEXT( "Invalid values found" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return;
+ }
+
+ // Load current settings
+ CMmsSettings* mmsSettings = CMmsSettings::NewL();
+ CleanupStack::PushL( mmsSettings );
+ mmsSettings->LoadSettingsL();
+ HTI_LOG_TEXT( "Settings loaded - now updating" );
+
+ // Update the values
+ if ( mmsSettings->AccessPointCount() > 0 )
+ {
+ mmsSettings->DeleteAccessPointL( 0 );
+ }
+ mmsSettings->AddAccessPointL( apUid, 0 );
+
+ mmsSettings->SetCreationMode( creationMode );
+
+ switch ( imageSize )
+ {
+ case 0:
+ mmsSettings->SetImageWidth( KMmsUniImageSmallWidth );
+ mmsSettings->SetImageHeight( KMmsUniImageSmallHeight );
+ break;
+ case 1:
+ mmsSettings->SetImageWidth( KMmsUniImageLargeWidth );
+ mmsSettings->SetImageHeight( KMmsUniImageLargeHeight );
+ break;
+ default:
+ User::Leave( KErrArgument );
+ break;
+ }
+
+ switch ( receptionMode )
+ {
+ case 0:
+ mmsSettings->SetReceivingModeHome( EMmsReceivingAutomatic );
+ mmsSettings->SetReceivingModeForeign( EMmsReceivingAutomatic );
+ break;
+ case 1:
+ mmsSettings->SetReceivingModeHome( EMmsReceivingAutomatic );
+ mmsSettings->SetReceivingModeForeign( EMmsReceivingManual );
+ break;
+ case 2:
+ mmsSettings->SetReceivingModeHome( EMmsReceivingManual );
+ mmsSettings->SetReceivingModeForeign( EMmsReceivingManual );
+ break;
+ case 3:
+ mmsSettings->SetReceivingModeHome( EMmsReceivingReject );
+ mmsSettings->SetReceivingModeForeign( EMmsReceivingReject );
+ break;
+ default:
+ User::Leave( KErrArgument );
+ break;
+ }
+
+ mmsSettings->SetAcceptAnonymousMessages( receiveAnonymous );
+ mmsSettings->SetAcceptAdvertisementMessages( receiveAdvert );
+
+ if ( requestDeliveryReport )
+ {
+ mmsSettings->SetDeliveryReportWanted( KMmsYes );
+ }
+ else
+ {
+ mmsSettings->SetDeliveryReportWanted( KMmsNo );
+ }
+
+ if ( sendDeliveryReport )
+ {
+ mmsSettings->SetDeliveryReportSendingAllowed( KMmsYes );
+ }
+ else
+ {
+ mmsSettings->SetDeliveryReportSendingAllowed( KMmsNo );
+ }
+
+ switch ( validityPeriod )
+ {
+ case 0:
+ mmsSettings->SetExpiryInterval( KValidityTimeMax );
+ break;
+ case 1:
+ mmsSettings->SetExpiryInterval( KValidityTime1h );
+ break;
+ case 2:
+ mmsSettings->SetExpiryInterval( KValidityTime6h );
+ break;
+ case 3:
+ mmsSettings->SetExpiryInterval( KValidityTime24h );
+ break;
+ case 4:
+ mmsSettings->SetExpiryInterval( KValidityTime3d );
+ break;
+ case 5:
+ mmsSettings->SetExpiryInterval( KValidityTime1w );
+ break;
+ default:
+ User::Leave( KErrArgument );
+ break;
+ }
+
+ // Check validity of updated settings and save if valid.
+ if ( mmsSettings->ValidateSettings() != KErrNone )
+ {
+ HTI_LOG_TEXT( "Settings not valid - won't save" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ HTI_LOG_TEXT( "Settings valid - now saving" );
+ mmsSettings->SaveSettingsL();
+ SendOkMsgL( KNullDesC8 );
+ }
+
+ CleanupStack::PopAndDestroy(); // mmsSettings
+ HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::HandleSetMmsSettingsL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::GetAccessPointUIDL
+// Gets the UID of Access Point named by aApName.
+// Returns KErrNotFound if AP not found.
+// ----------------------------------------------------------------------------
+TInt CHtiMsgSettingsHandler::GetAccessPointUIDL( const TDesC& aApName )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::GetAccessPointUIDL" );
+ TInt uid = KErrNotFound;
+
+ RCmManager cmManager;
+ cmManager.OpenL();
+ CleanupClosePushL( cmManager );
+
+ // Search from uncategorised first
+ RArray<TUint32> array = RArray<TUint32>();
+ cmManager.ConnectionMethodL( array );
+ CleanupClosePushL( array );
+ TInt i = 0;
+ while ( i < array.Count() && uid == KErrNotFound )
+ {
+ RCmConnectionMethod cm = cmManager.ConnectionMethodL( array[i] );
+ CleanupClosePushL( cm );
+ HBufC* name = cm.GetStringAttributeL( CMManager::ECmName );
+ HTI_LOG_FORMAT( "Found name: %S", name );
+ CleanupStack::PushL( name );
+ if ( aApName.Compare( *name ) == 0 )
+ {
+ uid = cm.GetIntAttributeL( CMManager::ECmWapId );
+ HTI_LOG_FORMAT( "Match: UID = %d", uid );
+ }
+ CleanupStack::PopAndDestroy(); // name
+ CleanupStack::PopAndDestroy(); // cm
+ i++;
+ }
+ CleanupStack::PopAndDestroy(); // array
+
+ // If not found from uncategorised, search from all destinations
+ if ( uid == KErrNotFound )
+ {
+ HTI_LOG_TEXT( "Not found from uncategorised" );
+ RArray<TUint32> destIdArray = RArray<TUint32>();
+ cmManager.AllDestinationsL( destIdArray );
+ CleanupClosePushL( destIdArray );
+ i = 0;
+ while ( i < destIdArray.Count() && uid == KErrNotFound )
+ {
+ RCmDestination dest = cmManager.DestinationL( destIdArray[i] );
+ CleanupClosePushL( dest );
+ TInt j = 0;
+ while ( j < dest.ConnectionMethodCount() && uid == KErrNotFound )
+ {
+ HBufC* name = dest.ConnectionMethodL( j ).GetStringAttributeL(
+ CMManager::ECmName );
+ CleanupStack::PushL( name );
+ HTI_LOG_FORMAT( "Found name: %S", name );
+ if ( aApName.Compare( *name ) == 0 )
+ {
+ uid = dest.ConnectionMethodL( j ).GetIntAttributeL(
+ CMManager::ECmWapId );
+ HTI_LOG_FORMAT( "Match: UID = %d", uid );
+ }
+ CleanupStack::PopAndDestroy(); // name
+ j++;
+ }
+ CleanupStack::PopAndDestroy(); // dest
+ i++;
+ }
+ CleanupStack::PopAndDestroy(); // destIdArray
+ }
+
+ CleanupStack::PopAndDestroy(); // cmManager
+
+ HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::GetAccessPointUIDL" );
+ return uid;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::SendOkMsgL
+// Helper function for sending response messages.
+// ----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::SendOkMsgL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::SendOkMsgL" );
+ User::LeaveIfNull( iDispatcher );
+ HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+ TPtr8 response = temp->Des();
+ response.Append( ( TChar ) CHtiMessagesServicePlugin::EResultOk );
+ response.Append( aData );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+ temp, KHtiMessagesServiceUid ) );
+ HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::SendOkMsgL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::SendErrorMessageL
+// Helper function for sending error response messages.
+// ----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
+ {
+ HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::SendErrorMessageL" );
+ User::LeaveIfNull( iDispatcher );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+ aError, aDescription, KHtiMessagesServiceUid ) );
+ HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::SendErrorMessageL" );
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/MessageMgmntHandler.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,2074 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Functional implementation of HtiMessagesServicePlugin service
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiMessagesServicePlugin.h"
+#include "MessageMgmntHandler.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+#include <mtclreg.h>
+#include <smscmds.h>
+#include <smtcmtm.h>
+#include <smuthdr.h>
+#include <smsclnt.h>
+#include <utf.h>
+#include <mmsclient.h>
+#include <mmsconst.h>
+#include <miutset.h>
+#include <irmsgtypeuid.h>
+#include <btmsgtypeuid.h>
+#include <biouids.h>
+#include <apgcli.h>
+#include <apmstd.h>
+#include <bautils.h>
+#include <obexclientmtm.h>
+#include <cmsvmimeheaders.h>
+#include <mmsvattachmentmanager.h>
+
+// CONSTANTS
+_LIT8( KErrorMissingCommand, "Command was not given - message was empty" );
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+_LIT8( KErrorInvalidParameters, "Invalid command parameters");
+_LIT8( KErrorTooLongSmsBody, "Too long SMS body" );
+_LIT8( KErrorInvalidId, "Invalid SMS id parameter" );
+_LIT8( KErrorInvalidFolder, "Invalid folder parameter" );
+_LIT8( KErrorItemNotFound, "Item not found" );
+_LIT8( KErrorFailedDelete, "Failed to delete item" );
+_LIT8( KErrorNotSupported, "Not supported" );
+_LIT8( KErrorSmsSettingNotDefined, "SMS settings not defined" );
+_LIT8( KErrorMmsSettingNotDefined, "MMS settings not defined" );
+_LIT8( KErrorMailboxNotDefined, "Mailbox not defined" );
+_LIT8( KErrorMsgTypeNotFound, "Message type module not found" );
+_LIT8( KErrorMsgStoreOpenFailed, "Could not open message store" );
+_LIT8( KErrorRfsConnectFailed, "Could not connect to file server session" );
+_LIT8( KErrorAttachmentNotFound, "Attachment not found" );
+_LIT8( KErrorInvalidFolderForSmartMsg, "Only inbox allowed for smart messages" );
+
+const static TInt KAddSmsCmdMinLength = 7;
+const static TInt KAddMmsOrEmailCmdMinLength = 8;
+const static TInt KAddObexMsgCmdMinLength = 6;
+const static TInt KAddSmartMsgCmdMinLength = 11;
+const static TInt KAddAudioCmdMinLength = 10;
+
+// ----------------------------------------------------------------------------
+CMessageMgmntHandler* CMessageMgmntHandler::NewL()
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::NewL" );
+ CMessageMgmntHandler* self = new (ELeave) CMessageMgmntHandler();
+ CleanupStack::PushL ( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "CMessageMgmntHandler::NewL: Done" );
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+CMessageMgmntHandler::CMessageMgmntHandler()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+CMessageMgmntHandler::~CMessageMgmntHandler()
+ {
+ delete iMtmReg;
+ delete iSession;
+ }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::ConstructL()
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::ConstructL" );
+ iSession = CMsvSession::OpenSyncL( *this );
+ iMtmReg = CClientMtmRegistry::NewL( *iSession );
+ HTI_LOG_FUNC_OUT( "CMessageMgmntHandler::ConstructL: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+ {
+ iDispatcher = aDispatcher;
+ }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/ )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::ProcessMessageL" );
+ HTI_LOG_FORMAT( "Msg length: %d", aMessage.Length() );
+
+ if ( aMessage.Length() == 0 )
+ {
+ SendErrorMessageL( KErrArgument, KErrorMissingCommand );
+ return;
+ }
+
+ switch ( aMessage[0] )
+ {
+ case CHtiMessagesServicePlugin::EAddSms:
+ HTI_LOG_TEXT( "Add SMS" );
+ HandleCreateSmsL( aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+
+ case CHtiMessagesServicePlugin::EAddMms:
+ case CHtiMessagesServicePlugin::EAddAudioMsg: // special MMS sub type
+ HTI_LOG_TEXT( "Add MMS" );
+ HandleCreateMmsL( aMessage );
+ break;
+
+ case CHtiMessagesServicePlugin::EAddEmail:
+ HTI_LOG_TEXT( "Add Email" );
+ HandleCreateEmailL( aMessage );
+ break;
+
+ case CHtiMessagesServicePlugin::EAddIrMsg:
+ HTI_LOG_TEXT( "Add IR msg" );
+ HandleCreateObexMsgL( aMessage.Right( aMessage.Length() - 1 ),
+ TUid::Uid( KUidMsgTypeIrTInt32 ),
+ KUidMsgTypeIrUID );
+ break;
+
+ case CHtiMessagesServicePlugin::EAddBtMsg:
+ HTI_LOG_TEXT( "Add BT msg" );
+ HandleCreateObexMsgL( aMessage.Right( aMessage.Length() - 1 ),
+ TUid::Uid( KUidMsgTypeBtTInt32 ),
+ KUidMsgTypeBt );
+ break;
+
+ case CHtiMessagesServicePlugin::EAddSmartMsg:
+ HTI_LOG_TEXT( "Add smart msg" );
+ HandleCreateSmartMsgL( aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+
+ case CHtiMessagesServicePlugin::EDeleteMessage:
+ HTI_LOG_TEXT( "Delete message" );
+ HandleDeleteMessageL( aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+
+ case CHtiMessagesServicePlugin::EDeleteFolderContent:
+ HTI_LOG_TEXT( "Delete messages" );
+ HandleDeleteMessagesL( aMessage.Right( aMessage.Length() - 1 ) );
+ break;
+
+ default:
+ HTI_LOG_TEXT( "Unknown command" );
+ SendErrorMessageL( KErrUnknown, KErrorUnrecognizedCommand );
+ break;
+ }
+
+ HTI_LOG_FUNC_OUT( "CMessageMgmntHandler::ProcessMessageL: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleCreateSmsL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleSmsImportFuncL" );
+
+ if ( ValidateAddSmsCommand( aData ) )
+ {
+ TInt position( 0 );
+ HBufC16* fromTo = ExtractDesLC( aData, position, 1 );
+ HBufC16* description = ExtractDesLC( aData, position, 1 );
+ HBufC16* body = ExtractDesLC( aData, position, 2 );
+ TBool isNew = (TBool)aData[position];
+ TBool isUnread = (TBool)aData[position+1];
+ TFolder folder = (TFolder)aData[position+2];
+
+ CSmsClientMtm* smsMtm = NULL;
+ TRAPD( err, smsMtm = ( CSmsClientMtm* )iMtmReg->NewMtmL(
+ KUidMsgTypeSMS ) );
+ if ( err || !smsMtm )
+ {
+ HTI_LOG_TEXT( "SMS message type module not found" );
+ SendErrorMessageL( KErrNotFound, KErrorMsgTypeNotFound );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ CleanupStack::PushL( smsMtm );
+
+ CMsvEntry* entry = CMsvEntry::NewL( *iSession,
+ KMsvGlobalInBoxIndexEntryId,
+ TMsvSelectionOrdering() );
+ CleanupStack::PushL( entry );
+
+ // get the default service
+ TMsvId defaultServiceId = 0;
+ TRAP( err, defaultServiceId = smsMtm->DefaultServiceL() );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Could not get default service, err: %d", err );
+ SendErrorMessageL( err, KErrorSmsSettingNotDefined );
+ CleanupStack::PopAndDestroy( entry );
+ CleanupStack::PopAndDestroy( smsMtm );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+
+ // map the folder parameter to folder id
+ TMsvId folderId = KMsvGlobalInBoxIndexEntryId;
+ TRAP( err, folderId = MapFolderToIdL( folder ) );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Invalid folder: %d", folder );
+ SendErrorMessageL( err, KErrorInvalidFolder );
+ CleanupStack::PopAndDestroy( entry );
+ CleanupStack::PopAndDestroy( smsMtm );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ entry->SetEntryL( folderId );
+
+ // mtm takes ownership of entry context
+ smsMtm->SetCurrentEntryL( entry );
+ CleanupStack::Pop( entry );
+
+ // create a new message
+ smsMtm->CreateMessageL( defaultServiceId );
+
+ if ( folder == EInbox )
+ {
+ CSmsHeader* smsHeader = &( smsMtm->SmsHeader() );
+ delete smsHeader;
+ smsHeader = NULL;
+ smsHeader = CSmsHeader::NewL( CSmsPDU::ESmsDeliver, smsMtm->Body() );
+ smsHeader->SetFromAddressL( fromTo->Des() );
+ }
+ else
+ {
+ smsMtm->AddAddresseeL( fromTo->Des() );
+
+ // set delivery settings
+ CSmsSettings* sendOptions = CSmsSettings::NewL();
+ CleanupStack::PushL( sendOptions );
+ sendOptions->CopyL( smsMtm->ServiceSettings() );
+ sendOptions->SetDelivery( ESmsDeliveryImmediately );
+
+ CSmsHeader* smsHeader = &( smsMtm->SmsHeader() );
+ smsHeader->SetSmsSettingsL( *sendOptions );
+ CleanupStack::PopAndDestroy( sendOptions );
+ }
+
+
+
+ // set body
+ smsMtm->Body().Reset();
+ smsMtm->Body().InsertL( 0, *body );
+
+ // save the message
+ smsMtm->SaveMessageL();
+
+ // get the entry of the message
+ TMsvEntry tentry = smsMtm->Entry().Entry();
+
+ // set the details field
+ tentry.iDetails.Set( fromTo->Des() );
+
+ // set the description field if it is given.
+ // (with no description the beginning of the message body
+ // is used as a description)
+ if ( description->Length() > 0 )
+ {
+ tentry.iDescription.Set( description->Des() );
+ }
+
+ // final fine tuning
+ tentry.SetAttachment( EFalse );
+ tentry.iDate.UniversalTime();
+ tentry.SetVisible( ETrue );
+ tentry.SetInPreparation( EFalse );
+ tentry.SetUnread( isUnread );
+ tentry.SetNew( isNew );
+ tentry.SetComplete( ETrue );
+ tentry.SetSendingState( KMsvSendStateWaiting );
+ tentry.iServiceId = defaultServiceId;
+ tentry.iRelatedId = 0;
+ if ( folder == EInbox )
+ {
+ tentry.SetReadOnly( ETrue );
+ }
+
+ smsMtm->Entry().ChangeL( tentry );
+
+ // send the message, if it is in outbox
+ if ( folder == EOutbox )
+ {
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->AppendL( tentry.Id() );
+
+ TBuf8<1> dummyParameter;
+ CMsvOperationWait* waiter = CMsvOperationWait::NewLC();
+ CMsvOperation* op = smsMtm->InvokeAsyncFunctionL(
+ ESmsMtmCommandScheduleCopy, *selection,
+ dummyParameter, waiter->iStatus );
+ CleanupStack::PushL( op );
+ waiter->Start();
+ CActiveScheduler::Start();
+ CleanupStack::PopAndDestroy( op );
+ CleanupStack::PopAndDestroy( waiter );
+ CleanupStack::PopAndDestroy( selection );
+ }
+
+ CleanupStack::PopAndDestroy( smsMtm );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+
+ TInt32 id = tentry.Id();
+ TBuf8<8> idStr;
+ idStr.Copy( ( TUint8* )( &id ), sizeof( id ) );
+ SendOkMsgL( idStr );
+ }
+
+ HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleSmsImportFuncL: Done");
+ }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleCreateMmsL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleCreateMmsL" );
+
+ if ( !ValidateAddMmsOrAddEmailCommand( aData ) )
+ {
+ // Error message has been sent from validation method.
+ return;
+ }
+
+ // parse the parameters
+ TInt position( 0 );
+ TInt cmdCode = aData[position];
+ position++;
+ HBufC16* fromTo = ExtractDesLC( aData, position, 1 );
+ HBufC16* description = ExtractDesLC( aData, position, 1 );
+ HBufC8* body = NULL;
+ if ( cmdCode == CHtiMessagesServicePlugin::EAddMms )
+ {
+ body = ExtractDes8LC( aData, position, 2 );
+ }
+ else // Audio msg does not have body text
+ {
+ body = HBufC8::NewLC( 0 );
+ }
+ HBufC16* attPath = ExtractDesLC( aData, position, 1 );
+ TBool isNew = (TBool)aData[position];
+ TBool isUnread = (TBool)aData[position+1];
+ TFolder folder = (TFolder)aData[position+2];
+ TInt extraAttNum;
+ position += 3;
+ TInt len = aData.Length();
+ if( aData.Length() > position )
+ {
+ extraAttNum = (TInt)aData[position];
+ }
+ else
+ {
+ extraAttNum = 0;
+ }
+ position++;
+
+ HTI_LOG_TEXT( "Creating MMS Client MTM" );
+ CMmsClientMtm* mmsMtm = NULL;
+ TRAPD( err , mmsMtm = ( CMmsClientMtm* )iMtmReg->NewMtmL(
+ KUidMsgTypeMultimedia ) );
+ if ( err || !mmsMtm )
+ {
+ HTI_LOG_TEXT( "MMS message type module not found" );
+ SendErrorMessageL( KErrNotFound, KErrorMsgTypeNotFound );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ CleanupStack::PushL( mmsMtm );
+
+ HTI_LOG_TEXT( "Creating MMS Client MTM" );
+ CMsvEntry* entry = CMsvEntry::NewL( *iSession,
+ KMsvGlobalInBoxIndexEntryId,
+ TMsvSelectionOrdering() );
+ CleanupStack::PushL( entry );
+
+ // get the default service
+ TMsvId defaultServiceId = 0;
+ TRAP( err, defaultServiceId = mmsMtm->DefaultServiceL() );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Could not get default service, err: %d", err );
+ SendErrorMessageL( err, KErrorMmsSettingNotDefined );
+ CleanupStack::PopAndDestroy( entry );
+ CleanupStack::PopAndDestroy( mmsMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+
+ // map the folder parameter to folder id
+ TMsvId folderId = KMsvGlobalInBoxIndexEntryId;
+ TRAP( err, folderId = MapFolderToIdL( folder ) );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Invalid folder: %d", folder );
+ SendErrorMessageL( err, KErrorInvalidFolder );
+ CleanupStack::PopAndDestroy( entry );
+ CleanupStack::PopAndDestroy( mmsMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ entry->SetEntryL( folderId );
+
+ // mtm takes ownership of entry context
+ mmsMtm->SetCurrentEntryL( entry );
+ CleanupStack::Pop( entry );
+
+ HTI_LOG_TEXT( "Creating MMS..." );
+ mmsMtm->CreateMessageL( defaultServiceId );
+ mmsMtm->SetMessageClass( EMmsClassPersonal );
+ mmsMtm->SetExpiryInterval( 86400 );
+ mmsMtm->SetDeliveryTimeInterval( 0 );
+ mmsMtm->SetMessagePriority( EMmsPriorityNormal );
+ mmsMtm->SetSenderVisibility( EMmsMaximumSenderVisibility );
+ mmsMtm->SetDeliveryReport( EMmsDeliveryReportNo );
+ mmsMtm->SetReadReply( EMmsReadReplyYes );
+
+ if ( description->Length() > 0 )
+ {
+ mmsMtm->SetSubjectL( description->Des() );
+ }
+
+ if ( folder == EInbox )
+ {
+ mmsMtm->SetSenderL( fromTo->Des() );
+ }
+ else
+ {
+ mmsMtm->AddAddresseeL( fromTo->Des() );
+ }
+
+ // get an access to the message store
+ HTI_LOG_TEXT( "Getting message store..." );
+ CMsvStore* store = NULL;
+ TRAP( err, store = entry->EditStoreL() );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Could not get access to message store, err: %d", err );
+ SendErrorMessageL( err, KErrorMsgStoreOpenFailed );
+ CleanupStack::PopAndDestroy( mmsMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ CleanupStack::PushL( store );
+
+ MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
+ // set body attachment only for normal MMS - audio message doesn't have body
+ if ( cmdCode == CHtiMessagesServicePlugin::EAddMms )
+ {
+ // Set the message body as attachment
+ // Use UTF-8 as charset because MMS created with MMS editor seems to
+ // save text attachments also as UTF-8.
+ HTI_LOG_TEXT( "Setting body..." );
+ CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+ CleanupStack::PushL( mimeHeaders );
+ mimeHeaders->SetContentTypeL( _L8( "text" ) );
+ mimeHeaders->SetContentSubTypeL( _L8( "plain" ) );
+ mimeHeaders->SetMimeCharset( KMmsUtf8 );
+ mimeHeaders->SetSuggestedFilenameL( _L( "body.txt" ) );
+
+ // ownership of bodyAttachment will be transferred
+ CMsvAttachment* bodyAttachment = CMsvAttachment::NewL(
+ CMsvAttachment::EMsvFile );
+ CleanupStack::PushL( bodyAttachment );
+ bodyAttachment->SetAttachmentNameL( _L( "body.txt" ) );
+ bodyAttachment->SetMimeTypeL( _L8( "text/plain" ) );
+ mimeHeaders->StoreL( *bodyAttachment );
+
+ RFile textFile;
+ CleanupClosePushL( textFile );
+ CWaiter* waiter = CWaiter::NewLC();
+ attachMan.CreateAttachmentL( _L( "body.txt" ), textFile,
+ bodyAttachment, waiter->iStatus );
+ waiter->StartAndWait();
+ CleanupStack::PopAndDestroy( waiter );
+
+ // write the UTF-8 body data to attachment file
+ textFile.Write( *body );
+ CleanupStack::PopAndDestroy(); // textFile
+ CleanupStack::Pop( bodyAttachment ); // ownership transfered
+ CleanupStack::PopAndDestroy( mimeHeaders );
+ }
+
+ // get the entry of the message
+ TMsvEntry tentry = mmsMtm->Entry().Entry();
+
+ // set the details field
+ tentry.iDetails.Set( *fromTo );
+
+ // set the description field
+ if ( description->Length() > 0 )
+ {
+ tentry.iDescription.Set( description->Left( KMmsMaxDescription ) );
+ }
+ else
+ {
+ TBuf<KMmsMaxDescription> descr;
+ CnvUtfConverter::ConvertToUnicodeFromUtf8( descr, *body );
+ tentry.iDescription.Set( descr );
+ }
+
+ // if this is audio message, set the bio type uid
+ if ( cmdCode == CHtiMessagesServicePlugin::EAddAudioMsg )
+ {
+ tentry.iBioType = KUidMsgSubTypeMmsAudioMsg.iUid;
+ }
+
+ // handle attachment
+ TBool attachmentsExist = EFalse;
+ if ( attPath->Length() > 0 )
+ {
+ HTI_LOG_TEXT( "Handling attachment..." );
+ // check that attachment exists
+ RFs fsSession;
+ if ( fsSession.Connect() != KErrNone )
+ {
+ HTI_LOG_FORMAT( "Error in connecting to file server session: %d", err );
+ SendErrorMessageL( KErrCouldNotConnect, KErrorRfsConnectFailed );
+ CleanupStack::PopAndDestroy( store );
+ CleanupStack::PopAndDestroy( mmsMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+
+ TBool fileExists = BaflUtils::FileExists( fsSession, attPath->Des() );
+ fsSession.Close();
+ if ( !fileExists )
+ {
+ HTI_LOG_TEXT( "Attachment file not found" );
+ SendErrorMessageL( KErrPathNotFound, KErrorAttachmentNotFound );
+ store->RevertL();
+ CleanupStack::PopAndDestroy( store );
+ CleanupStack::PopAndDestroy( mmsMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ else
+ {
+ // save the attachment
+ TParse parser;
+ parser.Set( *attPath, NULL, NULL);
+ TFileName shortFileName = parser.NameAndExt();
+
+ // get the mime type
+ RApaLsSession ls;
+ User::LeaveIfError( ls.Connect() );
+ CleanupClosePushL( ls );
+ TUid appUid;
+ TDataType dataType;
+ ls.AppForDocument( *attPath, appUid, dataType );
+ CleanupStack::PopAndDestroy(); // ls
+ TPtrC8 mimeType = dataType.Des8();
+
+ // attachment settings
+ // ownership of attachment will be transferred
+ CMsvAttachment* attachment = CMsvAttachment::NewL(
+ CMsvAttachment::EMsvFile );
+ attachment->SetAttachmentNameL( shortFileName );
+ attachment->SetMimeTypeL( mimeType );
+
+ // save
+ CWaiter* waiter = CWaiter::NewLC();
+ attachMan.AddAttachmentL( *attPath, attachment, waiter->iStatus );
+ waiter->StartAndWait();
+ CleanupStack::PopAndDestroy( waiter );
+ attachmentsExist = ETrue;
+ }
+ }
+
+ do
+ {
+ HBufC16* attPath2;
+ if(extraAttNum-- > 0)
+ {
+ attPath2 = ExtractDesLC( aData, position, 1 );
+ }
+ else
+ {
+ break;
+ }
+
+ if ( attPath2->Length() > 0 )
+ {
+ HTI_LOG_TEXT( "Handling attachment..." );
+ // check that attachment exists
+ RFs fsSession;
+ if ( fsSession.Connect() != KErrNone )
+ {
+ HTI_LOG_FORMAT( "Error in connecting to file server session: %d", err );
+ SendErrorMessageL( KErrCouldNotConnect, KErrorRfsConnectFailed );
+ CleanupStack::PopAndDestroy( store );
+ CleanupStack::PopAndDestroy( mmsMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ CleanupStack::PopAndDestroy( attPath2 );
+ return;
+ }
+
+ TBool fileExists = BaflUtils::FileExists( fsSession, attPath2->Des() );
+ fsSession.Close();
+ if ( !fileExists )
+ {
+ HTI_LOG_TEXT( "Attachment file not found" );
+ SendErrorMessageL( KErrPathNotFound, KErrorAttachmentNotFound );
+ store->RevertL();
+ CleanupStack::PopAndDestroy( store );
+ CleanupStack::PopAndDestroy( mmsMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ CleanupStack::PopAndDestroy( attPath2 );
+ return;
+ }
+ else
+ {
+ // save the attachment
+ TParse parser;
+ parser.Set( *attPath2, NULL, NULL);
+ TFileName shortFileName = parser.NameAndExt();
+
+ // get the mime type
+ RApaLsSession ls;
+ User::LeaveIfError( ls.Connect() );
+ CleanupClosePushL( ls );
+ TUid appUid;
+ TDataType dataType;
+ ls.AppForDocument( *attPath2, appUid, dataType );
+ CleanupStack::PopAndDestroy(); // ls
+ TPtrC8 mimeType = dataType.Des8();
+
+ // attachment settings
+ // ownership of attachment will be transferred
+ CMsvAttachment* attachment = CMsvAttachment::NewL(
+ CMsvAttachment::EMsvFile );
+ attachment->SetAttachmentNameL( shortFileName );
+ attachment->SetMimeTypeL( mimeType );
+
+ // save
+ CWaiter* waiter = CWaiter::NewLC();
+ attachMan.AddAttachmentL( *attPath2, attachment, waiter->iStatus );
+ waiter->StartAndWait();
+ CleanupStack::PopAndDestroy( waiter );
+ attachmentsExist = ETrue;
+ }
+
+ CleanupStack::PopAndDestroy( attPath2 );
+ }
+ } while(ETrue);
+ // save the changes made to the message store
+ store->CommitL();
+ CleanupStack::PopAndDestroy( store );
+
+ // save the message
+ mmsMtm->SaveMessageL();
+
+ // final fine tuning
+ tentry.SetAttachment( attachmentsExist );
+ tentry.iDate.UniversalTime();
+ tentry.SetVisible( ETrue );
+ tentry.SetInPreparation( EFalse );
+ if ( folder == EDrafts )
+ {
+ tentry.SetReadOnly( EFalse );
+ }
+ else
+ {
+ tentry.SetReadOnly( ETrue );
+ }
+ tentry.SetUnread( isUnread );
+ tentry.SetNew( isNew );
+ tentry.SetComplete( ETrue );
+ tentry.SetSendingState( KMsvSendStateWaiting );
+ tentry.iServiceId = defaultServiceId;
+ tentry.iRelatedId = 0;
+ tentry.iMtmData1 = KMmsMessageMRetrieveConf | KMmsMessageMobileTerminated;
+
+ mmsMtm->Entry().ChangeL( tentry );
+
+ HTI_LOG_TEXT( "MMS created and ready" );
+
+ // send the message, if it is in outbox
+ if ( folder == EOutbox )
+ {
+ HTI_LOG_TEXT( "MMS is in Outbox, sending it..." );
+
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->AppendL( tentry.Id() );
+
+ CMsvOperationWait* waiter = CMsvOperationWait::NewLC();
+ CMsvOperation* op = mmsMtm->SendL( *selection,
+ waiter->iStatus,
+ tentry.iDate );
+ CleanupStack::PushL( op );
+ waiter->Start();
+ CActiveScheduler::Start();
+ CleanupStack::PopAndDestroy( op );
+ CleanupStack::PopAndDestroy( waiter );
+ CleanupStack::PopAndDestroy( selection );
+ }
+
+ HTI_LOG_TEXT( "Cleaning up" );
+ CleanupStack::PopAndDestroy( mmsMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+
+ // send the message id back
+ TInt32 id = tentry.Id();
+ TBuf8<8> idStr;
+ idStr.Copy( ( TUint8* )( &id ), sizeof( id ) );
+ SendOkMsgL( idStr );
+
+ HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleCreateMmsL: Done");
+ }
+
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleCreateEmailL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleCreateEmailL" );
+
+ if ( ValidateAddMmsOrAddEmailCommand( aData ) )
+ {
+ // parse the parameters
+ TInt position( 1 ); // position 0 is command code
+ HBufC16* fromTo = ExtractDesLC( aData, position, 1 );
+ HBufC16* description = ExtractDesLC( aData, position, 1 );
+ HBufC16* body = ExtractDesLC( aData, position, 2 );
+ HBufC16* attPath = ExtractDesLC( aData, position, 1 );
+ TBool isNew = (TBool)aData[position];
+ TBool isUnread = (TBool)aData[position+1];
+ TFolder folder = (TFolder)aData[position+2];
+ TInt extraAttNum;
+ position += 3;
+ TInt len = aData.Length();
+ if( aData.Length() > position )
+ {
+ extraAttNum = (TInt)aData[position];
+ }
+ else
+ {
+ extraAttNum = 0;
+ }
+ position++;
+
+ HTI_LOG_TEXT( "Creating SMTP Client MTM" );
+ CSmtpClientMtm* smtpMtm = NULL;
+ TRAPD( err, smtpMtm = ( CSmtpClientMtm* )iMtmReg->NewMtmL(
+ KUidMsgTypeSMTP ) );
+ if ( err || !smtpMtm )
+ {
+ HTI_LOG_TEXT( "SMTP message type module not found" );
+ SendErrorMessageL( KErrNotFound, KErrorMsgTypeNotFound );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ CleanupStack::PushL( smtpMtm );
+
+ HTI_LOG_TEXT( "Creating a new CMsvEntry" );
+ CMsvEntry* entry = CMsvEntry::NewL( *iSession,
+ KMsvGlobalInBoxIndexEntryId,
+ TMsvSelectionOrdering() );
+ CleanupStack::PushL( entry );
+
+ // get the default service
+ HTI_LOG_TEXT( "Getting the default service" );
+ TMsvId defaultServiceId = 0;
+ TRAP( err, defaultServiceId = smtpMtm->DefaultServiceL() );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Could not get default service, err: %d", err );
+ SendErrorMessageL( err, KErrorMailboxNotDefined );
+ CleanupStack::PopAndDestroy( entry );
+ CleanupStack::PopAndDestroy( smtpMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+
+ // map the folder parameter to folder id
+ HTI_LOG_TEXT( "Mapping the folder parameter to folder id" );
+ TMsvId folderId = KMsvGlobalInBoxIndexEntryId;
+ TRAP( err, folderId = MapFolderToIdL( folder ) );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Invalid folder: %d", folder );
+ SendErrorMessageL( err, KErrorInvalidFolder );
+ CleanupStack::PopAndDestroy( entry );
+ CleanupStack::PopAndDestroy( smtpMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ entry->SetEntryL( folderId );
+
+ // mtm takes ownership of entry context
+ smtpMtm->SetCurrentEntryL( entry );
+ CleanupStack::Pop( entry );
+
+ // create a message and set subject and body
+ smtpMtm->CreateMessageL( defaultServiceId );
+ smtpMtm->SetSubjectL( description->Des() );
+ smtpMtm->Body().Reset();
+ smtpMtm->Body().InsertL( 0, body->Des() );
+
+ // get the entry of the message
+ TMsvEntry tentry = smtpMtm->Entry().Entry();
+
+ // add addressee
+ smtpMtm->AddAddresseeL( fromTo->Des() );
+ tentry.iDetails.Set( fromTo->Des() );
+
+ // If creating to Inbox use other than KUidMsgTypeSMTP so that the
+ // mail displays "from" field and not "to" field.
+ if ( folder == EInbox )
+ {
+ tentry.iMtm = KUidMsgTypeIMAP4;
+ }
+
+ // set the description field same as the message subject
+ tentry.iDescription.Set( description->Des() );
+
+ // save the changes done above
+ smtpMtm->Entry().ChangeL( tentry );
+
+ // get an access to the message store
+ CMsvStore* store = entry->EditStoreL();
+ CleanupStack::PushL( store );
+ CImHeader* header = CImHeader::NewLC();
+ header->RestoreL( *store );
+ TUint charset = header->Charset();
+ CleanupStack::PopAndDestroy( header );
+ CleanupStack::PopAndDestroy( store );
+
+ // handle attachment
+ TBool attachmentsExist = EFalse;
+ if ( attPath->Length() > 0 )
+ {
+ // check that attachment exists
+ RFs fsSession;
+ if ( fsSession.Connect() != KErrNone )
+ {
+ HTI_LOG_FORMAT( "Error in connecting to file server session: %d", err );
+ SendErrorMessageL( KErrCouldNotConnect, KErrorRfsConnectFailed );
+ CleanupStack::PopAndDestroy( smtpMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ CleanupClosePushL( fsSession );
+
+ TBool fileExists = BaflUtils::FileExists( fsSession, attPath->Des() );
+ if ( !fileExists )
+ {
+ HTI_LOG_TEXT( "Attachment file not found" );
+ SendErrorMessageL( KErrPathNotFound, KErrorAttachmentNotFound );
+ CleanupStack::PopAndDestroy(); // fsSession
+ CleanupStack::PopAndDestroy( smtpMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ else
+ {
+ // get the mime type
+ HTI_LOG_TEXT( "Getting the attachment's mime type" );
+ RApaLsSession ls;
+ User::LeaveIfError( ls.Connect() );
+ TUid appUid;
+ TDataType dataType;
+ ls.AppForDocument( *attPath, appUid, dataType );
+ TPtrC8 mimeType = dataType.Des8();
+
+ HTI_LOG_TEXT( "Adding the attachment" );
+ CWaiter* waiter = CWaiter::NewLC();
+ smtpMtm->AddAttachmentL( attPath->Des(), mimeType, charset,
+ waiter->iStatus );
+ waiter->StartAndWait();
+ CleanupStack::PopAndDestroy( waiter );
+ HTI_LOG_TEXT( "Attachment added succesfully" );
+ ls.Close();
+ attachmentsExist = ETrue;
+ }
+
+ CleanupStack::PopAndDestroy(); // fsSession
+ }
+
+ do
+ {
+ HBufC16* attPath2;
+ if(extraAttNum-- > 0)
+ {
+ attPath2 = ExtractDesLC( aData, position, 1 );
+ }
+ else
+ {
+ break;
+ }
+ // check that attachment exists
+ RFs fsSession;
+ if ( fsSession.Connect() != KErrNone )
+ {
+ HTI_LOG_FORMAT( "Error in connecting to file server session: %d", err );
+ SendErrorMessageL( KErrCouldNotConnect, KErrorRfsConnectFailed );
+ CleanupStack::PopAndDestroy( smtpMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ CleanupStack::PopAndDestroy( attPath2 );
+ return;
+ }
+ CleanupClosePushL( fsSession );
+
+ TBool fileExists = BaflUtils::FileExists( fsSession, attPath2->Des() );
+ if ( !fileExists )
+ {
+ HTI_LOG_TEXT( "Attachment file not found" );
+ SendErrorMessageL( KErrPathNotFound, KErrorAttachmentNotFound );
+ CleanupStack::PopAndDestroy(); // fsSession
+ CleanupStack::PopAndDestroy( smtpMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ CleanupStack::PopAndDestroy( attPath2 );
+ return;
+ }
+ else
+ {
+ // get the mime type
+ HTI_LOG_TEXT( "Getting the attachment's mime type" );
+ RApaLsSession ls;
+ User::LeaveIfError( ls.Connect() );
+ TUid appUid;
+ TDataType dataType;
+ ls.AppForDocument( *attPath2, appUid, dataType );
+ TPtrC8 mimeType = dataType.Des8();
+
+ HTI_LOG_TEXT( "Adding the attachment" );
+ CWaiter* waiter = CWaiter::NewLC();
+ smtpMtm->AddAttachmentL( attPath2->Des(), mimeType, charset,
+ waiter->iStatus );
+ waiter->StartAndWait();
+ CleanupStack::PopAndDestroy( waiter );
+ HTI_LOG_TEXT( "Attachment added succesfully" );
+ ls.Close();
+ attachmentsExist = ETrue;
+ }
+
+ CleanupStack::PopAndDestroy(); // fsSession
+ CleanupStack::PopAndDestroy( attPath2 );
+ } while(ETrue);
+
+ // save the message
+ smtpMtm->SaveMessageL();
+
+ // final fine tuning
+ TMsvEmailEntry temailEntry = static_cast<TMsvEmailEntry>( tentry );
+ temailEntry.SetMessageFolderType( EFolderTypeUnknown );
+ temailEntry.SetDisconnectedOperation( ENoDisconnectedOperations );
+ temailEntry.SetEncrypted( EFalse );
+ temailEntry.SetSigned( EFalse );
+ temailEntry.SetVCard( EFalse );
+ temailEntry.SetVCalendar( EFalse );
+ temailEntry.SetReceipt( EFalse );
+ temailEntry.SetMHTMLEmail( EFalse );
+ temailEntry.SetBodyTextComplete( ETrue );
+ temailEntry.SetAttachment( attachmentsExist );
+ temailEntry.iDate.UniversalTime();
+ temailEntry.SetVisible( ETrue );
+ temailEntry.SetInPreparation( EFalse );
+ temailEntry.SetSendingState( KMsvSendStateWaiting );
+ temailEntry.SetUnread( isUnread );
+ temailEntry.SetNew( isNew );
+ temailEntry.SetComplete( ETrue );
+ temailEntry.iServiceId = defaultServiceId;
+ temailEntry.iRelatedId = 0;
+
+ smtpMtm->Entry().ChangeL( temailEntry );
+
+ // get an access to the message store
+ store = entry->EditStoreL();
+ CleanupStack::PushL( store );
+
+ // set email header info
+ header = CImHeader::NewLC();
+ header->RestoreL( *store );
+ header->SetSubjectL( description->Des() );
+ header->SetFromL( fromTo->Des() );
+ header->SetReceiptAddressL( fromTo->Des() );
+ header->StoreL( *store );
+ store->CommitL();
+ CleanupStack::PopAndDestroy( header );
+ CleanupStack::PopAndDestroy( store );
+
+ // send the message, if it is in outbox
+ if ( folder == EOutbox )
+ {
+ HTI_LOG_TEXT( "E-Mail was created in outbox, marking it to be sent on next connection" );
+
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->AppendL( temailEntry.Id() );
+
+ TBuf8<1> dummyParameter;
+ CMsvOperationActiveSchedulerWait* waiter =
+ CMsvOperationActiveSchedulerWait::NewLC();
+ CMsvOperation* op = smtpMtm->InvokeAsyncFunctionL(
+ KSMTPMTMSendOnNextConnection, *selection,
+ dummyParameter, waiter->iStatus );
+ CleanupStack::PushL( op );
+ waiter->Start();
+ CleanupStack::PopAndDestroy( op );
+ CleanupStack::PopAndDestroy( waiter );
+ CleanupStack::PopAndDestroy( selection );
+ }
+
+ HTI_LOG_TEXT( "Cleaning up" );
+ CleanupStack::PopAndDestroy( smtpMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+
+ // send the message id back
+ TInt32 id = tentry.Id();
+ TBuf8<8> idStr;
+ idStr.Copy( ( TUint8* )( &id ), sizeof( id ) );
+ SendOkMsgL( idStr );
+ }
+
+ HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleCreateEmailL: Done");
+ }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleCreateObexMsgL( const TDesC8& aData,
+ TUid aMtmUid,
+ TUid aMsgTypeUid )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleCreateObexMsgL" );
+
+ if ( ValidateAddObexMsgCommand( aData ) )
+ {
+ // parse the parameters
+ TInt position( 0 );
+ HBufC16* fromTo = ExtractDesLC( aData, position, 1 );
+ HBufC16* description = ExtractDesLC( aData, position, 1 );
+ HBufC16* attPath = ExtractDesLC( aData, position, 1 );
+ TBool isNew = (TBool)aData[position];
+ TBool isUnread = (TBool)aData[position+1];
+ TFolder folder = (TFolder)aData[position+2];
+
+ // Adding Obex messages to the outbox is not allowed
+ if ( folder == EOutbox )
+ {
+ HTI_LOG_TEXT( "Outbox not supported with Obex messages" );
+ SendErrorMessageL( KErrNotSupported, KErrorNotSupported );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+
+ CObexClientMtm* obexMtm = NULL;
+ TRAPD( err, obexMtm = ( CObexClientMtm* )iMtmReg->NewMtmL( aMtmUid ) );
+ if ( err || !obexMtm )
+ {
+ HTI_LOG_TEXT( "Obex message type module not found" );
+ SendErrorMessageL( KErrNotFound, KErrorMsgTypeNotFound );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ CleanupStack::PushL( obexMtm );
+
+ CMsvEntry* entry = CMsvEntry::NewL( *iSession,
+ KMsvGlobalInBoxIndexEntryId,
+ TMsvSelectionOrdering() );
+ CleanupStack::PushL( entry );
+
+ TMsvId defaultServiceId = 0;
+
+ // map the folder parameter to folder id
+ TMsvId folderId = KMsvGlobalInBoxIndexEntryId;
+ TRAP( err, folderId = MapFolderToIdL( folder ) );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Invalid folder: %d", folder );
+ SendErrorMessageL( err, KErrorInvalidFolder );
+ CleanupStack::PopAndDestroy( entry );
+ CleanupStack::PopAndDestroy( obexMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ entry->SetEntryL( folderId );
+
+ // mtm takes ownership of entry context
+ obexMtm->SetCurrentEntryL( entry );
+ CleanupStack::Pop( entry );
+
+ // create a new message
+ obexMtm->CreateMessageL( defaultServiceId );
+
+ // get the entry of the message
+ TMsvEntry tentry = obexMtm->Entry().Entry();
+
+ // set subject
+ obexMtm->SetSubjectL( description->Des() );
+ tentry.iDescription.Set( description->Des() );
+
+ // set body, must be empty for obex messages
+ obexMtm->Body().Reset();
+
+ // set the details field and
+ tentry.iDetails.Set( fromTo->Des() );
+
+ // set mtm
+ tentry.iMtm = aMtmUid;
+ tentry.iType = KUidMsvMessageEntry;
+ tentry.iServiceId = KMsvUnknownServiceIndexEntryId;
+
+ // save the changes done above
+ obexMtm->Entry().ChangeL( tentry );
+
+ // save the message
+ obexMtm->SaveMessageL();
+
+ // final fine tuning
+ tentry.iDate.HomeTime();
+ tentry.SetVisible( ETrue );
+ tentry.SetInPreparation( EFalse );
+ tentry.SetUnread( isUnread );
+ tentry.SetNew( isNew );
+ tentry.SetComplete( ETrue );
+ obexMtm->Entry().ChangeL( tentry );
+
+ // handle attachment
+ if ( attPath->Length() > 0 )
+ {
+ // check that attachment exists
+ RFs fsSession;
+ if ( fsSession.Connect() != KErrNone )
+ {
+ HTI_LOG_FORMAT( "Error in connecting to file server session: %d", err );
+ SendErrorMessageL( KErrCouldNotConnect, KErrorRfsConnectFailed );
+ CleanupStack::PopAndDestroy( obexMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+
+ TBool fileExists = BaflUtils::FileExists( fsSession, attPath->Des() );
+ fsSession.Close();
+ if ( !fileExists )
+ {
+ HTI_LOG_TEXT( "Attachment file not found" );
+ SendErrorMessageL( KErrPathNotFound, KErrorAttachmentNotFound );
+ CleanupStack::PopAndDestroy( obexMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ else
+ {
+ // create a new entry for the attachment
+ TMsvEntry attachTEntry;
+ attachTEntry.iType = KUidMsvAttachmentEntry;
+ attachTEntry.iServiceId = KMsvUnknownServiceIndexEntryId;
+ attachTEntry.iMtm = aMsgTypeUid; //save as bt message
+
+ entry->CreateL( attachTEntry );
+
+ CMsvEntry* attachEntry = iSession->GetEntryL( attachTEntry.Id() );
+ obexMtm->SetCurrentEntryL( attachEntry );
+
+ // get source file
+ TFileName sourceFileName = attPath->Des();
+
+ // get the mime type
+ RApaLsSession ls;
+ User::LeaveIfError( ls.Connect() );
+ CleanupClosePushL<RApaLsSession>(ls);
+ TUid appUid;
+ TDataType mimeType;
+ ls.AppForDocument( sourceFileName, appUid, mimeType );
+ CleanupStack::PopAndDestroy(); //ls
+
+ CWaiter* waiter = CWaiter::NewLC();
+
+ // add an attachment to the current message entry
+ obexMtm->AddAttachmentL( sourceFileName, mimeType.Des8(), 0,
+ waiter->iStatus );
+ waiter->StartAndWait();
+ CleanupStack::PopAndDestroy( waiter );
+ }
+ }
+
+ CleanupStack::PopAndDestroy( obexMtm );
+ CleanupStack::PopAndDestroy( attPath );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+
+ // send the message id back
+ TInt32 id = tentry.Id();
+ TBuf8<8> idStr;
+ idStr.Copy( ( TUint8* )( &id ), sizeof( id ) );
+ SendOkMsgL( idStr );
+ }
+
+ HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleCreateObexMsgL: Done");
+ }
+
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleCreateSmartMsgL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleCreateSmartMsgL" );
+
+ if ( ValidateAddSmartMsgCommand( aData ) )
+ {
+ TInt position( 0 );
+ HBufC16* fromTo = ExtractDesLC( aData, position, 1 );
+ HBufC16* description = ExtractDesLC( aData, position, 1 );
+ HBufC16* body = ExtractDesLC( aData, position, 2 );
+ TBool isNew = (TBool)aData[position];
+ TBool isUnread = (TBool)aData[position+1];
+ TFolder folder = (TFolder)aData[position+2];
+ TInt bioUidValue = aData[position+3] +
+ ( aData[position+4] << 8 ) +
+ ( aData[position+5] << 16 ) +
+ ( aData[position+6] << 24 );
+
+
+ // Smart messages can be created only to inbox.
+ // For sending smart messages, create a normal SMS with smart message
+ // content as a body and send it.
+ if ( folder != EInbox )
+ {
+ HTI_LOG_TEXT( "Invalid folder specified for smart message" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidFolderForSmartMsg );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+
+ }
+
+ CSmsClientMtm* smsMtm = NULL;
+ TRAPD( err, smsMtm = ( CSmsClientMtm* )iMtmReg->NewMtmL( KUidMsgTypeSMS ) );
+ if ( err || !smsMtm )
+ {
+ HTI_LOG_TEXT( "SMS message type module not found" );
+ SendErrorMessageL( KErrNotFound, KErrorMsgTypeNotFound );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+ CleanupStack::PushL( smsMtm );
+
+ CMsvEntry* entry = CMsvEntry::NewL( *iSession,
+ KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering() );
+ CleanupStack::PushL( entry );
+
+ // get the default service
+ TMsvId defaultServiceId = 0;
+ TRAP( err, defaultServiceId = smsMtm->DefaultServiceL() );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Could not get default service, err: %d", err );
+ SendErrorMessageL( err, KErrorSmsSettingNotDefined );
+ CleanupStack::PopAndDestroy( entry );
+ CleanupStack::PopAndDestroy( smsMtm );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+ return;
+ }
+
+ // no need for folder mapping, since only inbox allowed for smart messages
+ TMsvId folderId = KMsvGlobalInBoxIndexEntryId;
+ entry->SetEntryL( folderId );
+
+ // mtm takes ownership of entry context
+ smsMtm->SetCurrentEntryL( entry );
+ CleanupStack::Pop( entry );
+
+ // create a new message
+ smsMtm->CreateMessageL( defaultServiceId );
+
+ // update the message header
+ CSmsHeader* smsHeader = &( smsMtm->SmsHeader() );
+ delete smsHeader;
+ smsHeader = NULL;
+ smsHeader = CSmsHeader::NewL( CSmsPDU::ESmsSubmit, smsMtm->Body() );
+ smsHeader->SetFromAddressL( fromTo->Des() );
+
+ // set body, the actual BIO message content
+ smsMtm->Body().Reset();
+ smsMtm->Body().InsertL( 0, body->Des() );
+
+ // get the entry of the message
+ TMsvEntry tentry = smsMtm->Entry().Entry();
+
+ // set BIO message type specific data
+ tentry.iBioType = bioUidValue;
+ smsMtm->BioTypeChangedL( TUid::Uid( bioUidValue ) );
+
+ // set details field
+ tentry.iDetails.Set( fromTo->Des() );
+
+ // set the description field
+ tentry.iDescription.Set( description->Des() );
+
+ // set correct MTM type
+ tentry.iMtm= KUidBIOMessageTypeMtm;
+
+ // final fine tuning
+ tentry.SetAttachment( EFalse );
+ tentry.iDate.UniversalTime();
+ tentry.SetVisible( ETrue );
+ tentry.SetInPreparation( EFalse );
+ tentry.SetUnread( isUnread );
+ tentry.SetNew( isNew );
+ tentry.SetComplete( ETrue );
+ tentry.SetSendingState( KMsvSendStateWaiting );
+ tentry.iServiceId = defaultServiceId;
+ tentry.iRelatedId = 0;
+
+ // save the changes done above
+ smsMtm->Entry().ChangeL( tentry );
+
+ // save the message
+ smsMtm->SaveMessageL();
+
+ CleanupStack::PopAndDestroy( smsMtm );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( description );
+ CleanupStack::PopAndDestroy( fromTo );
+
+ TInt32 id = tentry.Id();
+ TBuf8<8> idStr;
+ idStr.Copy( ( TUint8* )( &id ), sizeof( id ) );
+ SendOkMsgL( idStr );
+ }
+
+ HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleCreateSmartMsgL: Done");
+ }
+
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleDeleteMessageL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleDeleteMessageL" );
+
+ if ( aData.Length() != 4 )
+ {
+ HTI_LOG_TEXT( "CMessageMgmntHandler: Error: wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidId );
+ return;
+ }
+
+ TMsvId entryId = aData[0] +
+ ( aData[1] << 8 ) +
+ ( aData[2] << 16 ) +
+ ( aData[3] << 24 );
+ HTI_LOG_FORMAT( "CMessageMgmntHandler: Deleting one message, id: %d", entryId );
+ TMsvEntry entry;
+ TMsvId service;
+ User::LeaveIfError( iSession->GetEntry( entryId, service, entry ) );
+
+ CMsvEntry* parentCEntry = iSession->GetEntryL( entry.Parent() );
+ CleanupStack::PushL( parentCEntry );
+ TRAPD( err, parentCEntry->DeleteL( entry.Id() ) );
+ CleanupStack::PopAndDestroy( parentCEntry );
+
+ if ( err == KErrNone )
+ {
+ SendOkMsgL( KNullDesC8 );
+ }
+ else if ( err == KErrNotFound )
+ {
+ SendErrorMessageL( err, KErrorItemNotFound );
+ }
+ else
+ {
+ SendErrorMessageL( err, KErrorFailedDelete );
+ }
+
+ HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleDeleteMessageL: Done");
+ }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleDeleteMessagesL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleDeleteMessagesFuncL" );
+
+ if ( aData.Length() != 2 )
+ {
+ HTI_LOG_TEXT( "CMessageMgmntHandler: Error: wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidFolder );
+ return;
+ }
+
+ if ( aData[0] == EAllFolders )
+ {
+ HandleDeleteFromAllFoldersL( (TMessageType)aData[1] );
+ }
+ else if ( aData[1] == EAllMessageTypes )
+ {
+ HandleDeleteAllMessageTypesL( (TFolder)aData[0] );
+ }
+ else
+ {
+ HandleDeleteFromFolderByTypeL( (TFolder)aData[0],
+ (TMessageType)aData[1] );
+ }
+
+ SendOkMsgL( KNullDesC8 );
+ HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleDeleteMessagesFuncL: Done");
+ }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleDeleteFromAllFoldersL( TMessageType aType )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleDeleteFromAllFoldersL" );
+
+ if ( aType == EAllMessageTypes )
+ {
+ for ( TInt i = 1; i < ENumberOfFolders; i++ )
+ {
+ HandleDeleteAllMessageTypesL( (TFolder)i );
+ }
+ }
+ else
+ {
+ for ( TInt i = 1; i < ENumberOfFolders; i++ )
+ {
+ HandleDeleteFromFolderByTypeL( (TFolder)i, aType );
+ }
+ }
+
+ HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleDeleteFromAllFoldersL: Done");
+ }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleDeleteAllMessageTypesL( TFolder aFolder )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleDeleteAllMessageTypesL" );
+
+ if ( aFolder == EAllFolders )
+ {
+ for ( TInt i = 1; i < ENumberOfMessageTypes; i++ )
+ {
+ HandleDeleteFromAllFoldersL( (TMessageType)i );
+ }
+ }
+ else
+ {
+ for ( TInt i = 1; i < ENumberOfMessageTypes; i++ )
+ {
+ HandleDeleteFromFolderByTypeL( aFolder, (TMessageType)i );
+ }
+ }
+
+ HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleDeleteAllMessageTypesL: Done");
+ }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleDeleteFromFolderByTypeL( TFolder aFolder,
+ TMessageType aType )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleDeleteFromFolderByTypeL" );
+
+ TMsvId folderId = MapFolderToIdL( aFolder );
+ TUid msgTypeUid = MapMessageTypeToUidL( aType );
+
+ HTI_LOG_TEXT( "Deleting messages..." );
+ HTI_LOG_FORMAT( "Folder: %d", aFolder );
+ HTI_LOG_FORMAT( "Message type: %d", aType );
+
+ CMsvEntry* folder = CMsvEntry::NewL( *iSession,
+ folderId,
+ TMsvSelectionOrdering() );
+ CleanupStack::PushL( folder );
+ CMsvEntrySelection* sel = folder->ChildrenWithMtmL( msgTypeUid );
+
+ CleanupStack::PushL( sel );
+ HTI_LOG_FORMAT( "Found %d matching items", sel->Count() );
+
+ for ( TInt i = 0; i < sel->Count(); i++ )
+ {
+ TMsvId entryId = sel->At( i );
+ TMsvEntry entry;
+ TMsvId service;
+ User::LeaveIfError( iSession->GetEntry( entryId, service, entry ) );
+ if ( ( aType == EAudioMessage && entry.iBioType != KUidMsgSubTypeMmsAudioMsg.iUid ) ||
+ ( aType == EMMS && entry.iBioType == KUidMsgSubTypeMmsAudioMsg.iUid ) )
+ {
+ // do not delete audio messages when MMS deletion
+ // requested and vice versa
+ continue;
+ }
+ CMsvEntry* parentCEntry = iSession->GetEntryL( entry.Parent() );
+ CleanupStack::PushL( parentCEntry );
+ parentCEntry->DeleteL( entry.Id() );
+ CleanupStack::PopAndDestroy( parentCEntry );
+ }
+
+ CleanupStack::PopAndDestroy( sel );
+ CleanupStack::PopAndDestroy( folder );
+
+ if ( aType == EEmail )
+ {
+ HandleDeleteFromFolderByTypeL( aFolder, EEmailPOP3 );
+ HandleDeleteFromFolderByTypeL( aFolder, EEmailIMAP4 );
+ }
+
+ HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleDeleteFromFolderByTypeL: Done");
+ }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::SendOkMsgL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN("CMessageMgmntHandler::SendOkMsgL: Starting");
+
+ User::LeaveIfNull( iDispatcher );
+
+ HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+ TPtr8 response = temp->Des();
+ response.Append( (TChar) CHtiMessagesServicePlugin::EResultOk );
+ response.Append( aData );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+ temp, KHtiMessagesServiceUid ) );
+
+ HTI_LOG_FUNC_OUT("CMessageMgmntHandler::SendOkMsgL: Done");
+ }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::SendErrorMessageL( TInt aError,
+ const TDesC8& aDescription )
+ {
+ HTI_LOG_FUNC_IN("CMessageMgmntHandler::SendErrorMessageL: Starting");
+ User::LeaveIfNull( iDispatcher );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+ aError, aDescription, KHtiMessagesServiceUid ) );
+ HTI_LOG_FUNC_OUT("CMessageMgmntHandler::SendErrorMessageL: Done");
+ }
+
+// ----------------------------------------------------------------------------
+TBool CMessageMgmntHandler::ValidateAddSmsCommand( const TDesC8& aData )
+ {
+ if ( aData.Length() < KAddSmsCmdMinLength )
+ {
+ HTI_LOG_TEXT( "ValidateAddSmsCommand: Error: missing data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+
+ TInt offset = 0;
+ TInt fromLength = aData[offset];
+
+ offset = 1 + fromLength;
+ if ( offset > aData.Length() - 1 )
+ {
+ HTI_LOG_TEXT( "ValidateAddSmsCommand: Error: wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+ TInt descrLength = aData[offset];
+
+ offset = offset + 1 + descrLength;
+ if ( offset > aData.Length() - 2 ) // body length in two bytes
+ {
+ HTI_LOG_TEXT( "ValidateAddSmsCommand: Error: wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+ TInt bodyLength = aData[offset] + ( aData[offset+1] << 8 );
+
+ TInt wholeLength = 1 + fromLength +
+ 1 + descrLength +
+ 2 + bodyLength +
+ 1 + // is new
+ 1 + // is unread
+ 1; // folder
+
+ if ( wholeLength != aData.Length() )
+ {
+ HTI_LOG_TEXT( "ValidateAddSmsCommand: Error: wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+
+ if ( bodyLength > 160 )
+ {
+ HTI_LOG_TEXT( "ValidateAddSmsCommand: Error: too long SMS body" );
+ SendErrorMessageL( KErrOverflow, KErrorTooLongSmsBody );
+ return EFalse;
+ }
+
+ return ETrue;
+ }
+
+
+// ----------------------------------------------------------------------------
+TBool CMessageMgmntHandler::ValidateAddMmsOrAddEmailCommand( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::ValidateAddMmsOrAddEmailCommand" );
+ if ( aData.Length() < KAddMmsOrEmailCmdMinLength + 1 ) // +1 = cmd code
+ {
+ HTI_LOG_TEXT( "Error: missing data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+
+ if ( aData[0] == CHtiMessagesServicePlugin::EAddAudioMsg &&
+ aData.Length() < KAddAudioCmdMinLength + 1 ) // +1 = cmd code
+ {
+ HTI_LOG_TEXT( "ValidateAddMmsOrAddEmailCommand: Error: missing data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+
+ TInt offset = 0;
+ TInt cmdCode = aData[offset];
+ offset++;
+ TInt fromToLength = aData[offset];
+ fromToLength++; // the length byte
+
+ offset = offset + fromToLength;
+ if ( offset > aData.Length() - 1 )
+ {
+ HTI_LOG_TEXT( "Error: wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+ TInt descrLength = aData[offset];
+ descrLength++; // the length byte
+
+ offset = offset + descrLength;
+ TInt bodyLength = 0;
+ if ( cmdCode != CHtiMessagesServicePlugin::EAddAudioMsg )
+ {
+ if ( offset > aData.Length() - 2 ) // body length in two bytes
+ {
+ HTI_LOG_TEXT( "Error: wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+ bodyLength = aData[offset] + ( aData[offset+1] << 8 );
+ bodyLength += 2; // the body length bytes
+ }
+
+ offset = offset + bodyLength;
+ if ( offset > aData.Length() - 1 )
+ {
+ HTI_LOG_TEXT( ": wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+ TInt attPathLength = aData[offset];
+ if ( attPathLength == 0 && cmdCode == CHtiMessagesServicePlugin::EAddAudioMsg )
+ {
+ // attachment (the audio) is mandatory for audio message
+ HTI_LOG_TEXT( "Error: missing attachment" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+ attPathLength++; // the length byte
+
+ TInt wholeLength = 1 + // command code
+ fromToLength + descrLength + bodyLength + attPathLength +
+ 1 + // is new
+ 1 + // is unread
+ 1; // folder
+
+ TInt extraAttPathLength = 0;
+ TInt extraAttNum = 0;
+ TInt extraNumLen = 0;
+ if( wholeLength < aData.Length() )
+ {
+ offset = wholeLength;
+ extraAttNum = aData[offset];
+ offset ++;
+
+ extraNumLen = 1;
+
+ while( offset < aData.Length() && extraAttNum > 0)
+ {
+ extraAttPathLength += aData[offset];
+ extraAttPathLength ++;
+ extraAttNum --;
+ offset += 1 + aData[offset];
+ }
+ }
+
+ wholeLength += extraNumLen + extraAttPathLength;
+
+ if ( wholeLength != aData.Length() )
+ {
+ HTI_LOG_TEXT( "Error: wrong length of data (wholeLength)" );
+ HTI_LOG_FORMAT( "Expected: %d", wholeLength );
+ HTI_LOG_FORMAT( "Was: %d", aData.Length() );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+
+ return ETrue;
+ }
+
+
+// ----------------------------------------------------------------------------
+TBool CMessageMgmntHandler::ValidateAddObexMsgCommand( const TDesC8& aData )
+ {
+ if ( aData.Length() < KAddObexMsgCmdMinLength )
+ {
+ HTI_LOG_TEXT( "ValidateAddObexMsgCommand: Error: missing data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+
+ TInt offset = 0;
+ TInt fromToLength = aData[offset];
+
+ offset = 1 + fromToLength;
+ if ( offset > aData.Length() - 1 )
+ {
+ HTI_LOG_TEXT( "ValidateAddObexMsgCommand: Error: wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+ TInt descrLength = aData[offset];
+
+ offset = offset + 1 + descrLength;
+ if ( offset > aData.Length() - 1 )
+ {
+ HTI_LOG_TEXT( "ValidateAddObexMsgCommand: Error: wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+ TInt attPathLength = aData[offset];
+
+ TInt wholeLength = 1 + fromToLength +
+ 1 + descrLength +
+ 1 + attPathLength +
+ 1 + // is new
+ 1 + // is unread
+ 1; // folder
+
+ if ( wholeLength != aData.Length() )
+ {
+ HTI_LOG_TEXT( "ValidateAddObexMsgCommand: Error: wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+
+ return ETrue;
+ }
+
+// ----------------------------------------------------------------------------
+TBool CMessageMgmntHandler::ValidateAddSmartMsgCommand( const TDesC8& aData )
+ {
+ if ( aData.Length() < KAddSmartMsgCmdMinLength )
+ {
+ HTI_LOG_TEXT( "ValidateAddSmartMsgCommand: Error: missing data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+
+ TInt offset = 0;
+ TInt fromToLength = aData[offset];
+
+ offset = 1 + fromToLength;
+ if ( offset > aData.Length() - 1 )
+ {
+ HTI_LOG_TEXT( "ValidateAddSmartMsgCommand: Error: wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+ TInt descrLength = aData[offset];
+
+ offset = offset + 1 + descrLength;
+ if ( offset > aData.Length() - 2 ) // body length in two bytes
+ {
+ HTI_LOG_TEXT( "ValidateAddSmartMsgCommand: Error: wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+ TInt bodyLength = aData[offset] + ( aData[offset+1] << 8 );
+
+ TInt wholeLength = 1 + fromToLength +
+ 1 + descrLength +
+ 2 + bodyLength +
+ 1 + // is new
+ 1 + // is unread
+ 1 + // folder
+ 4; // biomessage uid
+
+ if ( wholeLength != aData.Length() )
+ {
+ HTI_LOG_TEXT( "ValidateAddSmartMsgCommand: Error: wrong length of data" );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+
+ return ETrue;
+ }
+
+
+// ----------------------------------------------------------------------------
+// Extracts UTF-8 data, converts it to Unicode and returns as 16-bit descriptor.
+// Within aData, read descriptor from aPosition:
+// - first bytes tell the size of data for UTF8 formatted data
+// - next bytes are the data as indicated by the size
+// - position is finally set to the end of UTF8 data area
+// ----------------------------------------------------------------------------
+HBufC16* CMessageMgmntHandler::ExtractDesLC( const TDesC8& aUtf8Data,
+ TInt& aPosition,
+ TInt aSizeBytes )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::ExtractDesLC" );
+ TInt length = 0;
+ for ( TInt i = 0; i < aSizeBytes; i++ )
+ {
+ length += ( aUtf8Data[aPosition+i] << ( i * 8 ) );
+ }
+
+ if ( length < 0 ||
+ length > aUtf8Data.Mid( aPosition ).Length() )
+ {
+ User::Leave( KErrBadDescriptor );
+ }
+
+ HBufC16* result = NULL;
+
+ if ( length > 0 )
+ {
+ result = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+ aUtf8Data.Mid( aPosition + aSizeBytes, length ) );
+ HTI_LOG_TEXT( "ExtractDesLC: Conversion to Unicode done" );
+ CleanupStack::PushL( result );
+ }
+
+ else
+ {
+ result = HBufC16::NewLC( 0 );
+ }
+
+ aPosition += ( aSizeBytes + length );
+
+ HTI_LOG_FUNC_OUT( "CMessageMgmntHandler::ExtractDesLC" );
+ return result;
+ }
+
+
+// ----------------------------------------------------------------------------
+// Extracts UTF-8 data to 8-bit descriptor without doing any conversions.
+// ----------------------------------------------------------------------------
+HBufC8* CMessageMgmntHandler::ExtractDes8LC( const TDesC8& aUtf8Data,
+ TInt& aPosition,
+ TInt aSizeBytes )
+ {
+ HTI_LOG_FUNC_IN( "CMessageMgmntHandler::ExtractDes8LC" );
+ TInt length = 0;
+ for ( TInt i = 0; i < aSizeBytes; i++ )
+ {
+ length += ( aUtf8Data[aPosition+i] << ( i * 8 ) );
+ }
+
+ if ( length < 0 ||
+ length > aUtf8Data.Mid( aPosition ).Length() )
+ {
+ User::Leave( KErrBadDescriptor );
+ }
+
+ HBufC8* result = HBufC8::NewLC( length );
+
+ if ( length > 0 )
+ {
+ result->Des().Copy( aUtf8Data.Mid( aPosition + aSizeBytes, length ) );
+ }
+
+ aPosition += ( aSizeBytes + length );
+
+ HTI_LOG_FUNC_OUT( "CMessageMgmntHandler::ExtractDes8LC" );
+ return result;
+ }
+
+
+// ----------------------------------------------------------------------------
+TMsvId CMessageMgmntHandler::MapFolderToIdL( TFolder aFolder )
+ {
+ TMsvId id = 0;
+
+ switch ( aFolder )
+ {
+ case EInbox: { id = KMsvGlobalInBoxIndexEntryId; break; }
+ case EDrafts: { id = KMsvDraftEntryId; break; }
+ case ESent: { id = KMsvSentEntryId; break; }
+ case EOutbox: { id = KMsvGlobalOutBoxIndexEntryId; break; }
+ default: { User::Leave( KErrArgument ); break; }
+ }
+
+ return id;
+ }
+
+// ----------------------------------------------------------------------------
+TUid CMessageMgmntHandler::MapMessageTypeToUidL( TMessageType aType )
+ {
+ TUid uid = { 0 };
+
+ switch ( aType )
+ {
+ case ESMS: { uid = KUidMsgTypeSMS; break; }
+ case EAudioMessage: // fall through - audio msg is MMS sub type
+ case EMMS: { uid = KUidMsgTypeMultimedia; break; }
+ case ESmartMessage: { uid = KUidBIOMessageTypeMtm; break; }
+ case EEmail: { uid = KUidMsgTypeSMTP; break; }
+ case EEmailPOP3: { uid = KUidMsgTypePOP3; break; }
+ case EEmailIMAP4: { uid = KUidMsgTypeIMAP4; break; }
+ case EIrMessage: { uid = KUidMsgTypeIrUID; break; }
+ case EBtMessage: { uid = KUidMsgTypeBt; break; }
+ default: { User::Leave( KErrArgument ); break; }
+ }
+
+ return uid;
+ }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleSessionEventL( TMsvSessionEvent /*aEvent*/,
+ TAny* /*aArg1*/,
+ TAny* /*aArg2*/,
+ TAny* /*aArg3*/ )
+ {
+ }
+
+
+
+// ----------------------------------------------------------------------------
+CWaiter* CWaiter::NewL( TInt aPriority )
+ {
+ CWaiter* self = new(ELeave) CWaiter( aPriority );
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+CWaiter* CWaiter::NewLC( TInt aPriority )
+ {
+ CWaiter* self = new(ELeave) CWaiter( aPriority );
+ CleanupStack::PushL( self );
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+CWaiter::CWaiter( TInt aPriority ) : CActive( aPriority )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ----------------------------------------------------------------------------
+CWaiter::~CWaiter()
+ {
+ Cancel();
+ }
+
+// ----------------------------------------------------------------------------
+void CWaiter::StartAndWait()
+ {
+ iStatus = KRequestPending;
+ SetActive();
+ iWait.Start();
+ }
+
+// ----------------------------------------------------------------------------
+TInt CWaiter::Result() const
+ {
+ return iResult;
+ }
+
+// ----------------------------------------------------------------------------
+void CWaiter::RunL()
+ {
+ iResult = iStatus.Int();
+ iWait.AsyncStop();
+ }
+
+// ----------------------------------------------------------------------------
+void CWaiter::DoCancel()
+ {
+ iResult = KErrCancel;
+ if ( iStatus == KRequestPending )
+ {
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrCancel );
+ }
+
+ iWait.AsyncStop();
+ }
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/proxy.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation proxy for HtiMessagesServicePlugin service plugin dll
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiMessagesServicePlugin.h"
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY( 0x200212C6, CHtiMessagesServicePlugin::NewL )
+ };
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+ {
+ aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+ return ImplementationTable;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/data/200212C3.rss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource definitions for Personal data (vCard, vCalendar)
+* service ECOM plugin.
+*
+*/
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+
+
+// RESOURCE DEFINITIONS
+RESOURCE REGISTRY_INFO theInfo
+ {
+ // UID for the DLL
+ dll_uid = 0x200212C3;
+ // Declare array of interface info
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // UID of interface that is implemented
+ interface_uid = 0x1020DEB7;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x200212C4;
+ version_no = 1;
+ display_name = "Personal information manager service";
+ default_data = "PIM";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/group/HtiNpdHlp.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build description file for HtiNpdHlp
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET HtiNpdHlp.exe
+TARGETTYPE exe
+UID 0x1000008d 0x200212D5
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
+
+SOURCE ../src/HtiNpdHlp.cpp
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY efsrv.lib
+LIBRARY cone.lib
+LIBRARY npdlib.lib
+LIBRARY flogger.lib
+
+SMPSAFE
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/group/HtiPIMServicePlugin.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECOM implementation of PIM service
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET HtiPIMServicePlugin.dll
+TARGETTYPE PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x200212C3
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
+
+SOURCEPATH ../src
+SOURCE proxy.cpp
+SOURCE HtiPIMServicePlugin.cpp
+SOURCE PIMHandler.cpp
+SOURCE HtiBookmarkHandler.cpp
+SOURCE HtiSimDirHandler.cpp
+
+USERINCLUDE ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE ../data/200212C3.rss
+TARGET HtiPIMServicePlugin.rsc
+END
+
+LIBRARY cmmanager.lib
+LIBRARY apgrfx.lib
+LIBRARY calinterimapi.lib
+LIBRARY charconv.lib
+LIBRARY ecom.lib
+LIBRARY estor.lib
+LIBRARY euser.lib
+LIBRARY favouritesengine.lib
+LIBRARY ws32.lib
+LIBRARY flogger.lib
+LIBRARY cntmodel.lib
+LIBRARY etelmm.lib
+LIBRARY etel.lib
+SMPSAFE
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for HtiPIMServicePlugin
+*
+*/
+#include "../../../symbian_version.hrh"
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiPIMServicePlugin.mmp
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+HtiNpdHlp.mmp
+#endif
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Class that handles browser bookmark creation and deletion.
+*
+*/
+
+
+#ifndef HTIBOOKMARKHANDLER_H
+#define HTIBOOKMARKHANDLER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <FavouritesLimits.h>
+#include <FavouritesSession.h>
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+const TInt KApMaxConnNameLength = 30;
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Class that handles browser bookmark creation and deletion.
+*/
+class CHtiBookmarkHandler : public CBase
+ {
+ public:
+
+ /**
+ * Two-phased constructor.
+ */
+ static CHtiBookmarkHandler* NewL();
+
+ /**
+ * Called when there is a message to be processed by this service.
+ * @param aMessage message body destinated to the servive
+ * @param aPriority message priority
+ */
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+ /**
+ * Indicates whether this handler is ready to receive
+ * a new message or if it's busy processing previous message.
+ * @return ETrue if processing, EFalse if ready for new request
+ */
+ TBool IsBusy();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CHtiBookmarkHandler();
+
+ /**
+ * Sets the dispatcher to send outgoing messages to.
+ * @param aDispatcher pointer to dispatcher instance
+ */
+ void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+ private: // constructors
+
+ /**
+ * C++ default constructor.
+ */
+ CHtiBookmarkHandler();
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ private: // helpers
+
+ void HandleCreateBookmarkL();
+ void HandleDeleteBookmarkL();
+ void ParseCreateMessageL( const TDesC8& aMessage );
+ void ParseDeleteMessageL( const TDesC8& aMessage );
+ TInt ExtractStringL( const TDesC8& aMessage, TInt aOffset,
+ TInt aLengthBytes, TInt aMinLength,
+ TInt aMaxLength, TDes& aResult );
+ TInt GetFolderUidL( const TDesC& aFolderName );
+ TInt GetApUidL( const TDesC& aApName );
+ void SendOkMsgL( const TDesC8& aData );
+ void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+ private: // data
+
+ // Pointer to the dispatcher (referenced)
+ MHtiDispatcher* iDispatcher;
+
+ // Session to the favourites engine
+ RFavouritesSession iFavSession;
+
+ // The parsed parameter values from the command messages
+ TBuf<KFavouritesMaxName> iFolderName;
+ TBuf<KFavouritesMaxName> iBookmarkName;
+ TBuf<KApMaxConnNameLength> iApName;
+ TBuf<KFavouritesMaxUserName> iUserName;
+ TBuf<KFavouritesMaxPassword> iPassword;
+ HBufC* iUrl;
+ };
+
+#endif // HTIBOOKMARKHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiPIMServicePlugin.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of ECOM plug-in service interface. Provides
+* PIM service (vCard & vCalendar import).
+*
+*/
+
+
+#ifndef CHTIPIMSERVICEPLUGIN_H
+#define CHTIPIMSERVICEPLUGIN_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include <w32std.h>
+
+// CONSTANTS
+const TInt KPIMServiceUidValue = 0x10210CCD; // ECOM Implementation UID
+const TUid KPIMServiceUid = { KPIMServiceUidValue };
+
+// FORWARD DECLARATIONS
+class CPIMHandler;
+class CHtiBookmarkHandler;
+class CHtiSimDirHandler;
+// CLASS DECLARATION
+
+/**
+* Implementation of ECOM plug-in service interface.
+*/
+class CHtiPIMServicePlugin : public CHTIServicePluginInterface
+ {
+ public:
+
+ enum TCommand
+ {
+ EImportVCard = 0x01,
+ EImportVCalendar = 0x02,
+
+ EDeleteContact = 0x03,
+ EDeleteCalendar = 0x04,
+
+ ENotepadAddMemo = 0x05,
+ ENotepadAddMemoFromFile = 0x06,
+ ENotepadDeleteAll = 0x07,
+
+ EOpenCalendarFile = 0x08,
+ EListCalendarFiles = 0x09,
+
+ ESimCardInfo = 0x10,
+ EImportSimContact = 0x11,
+ EDeleteSimContact = 0x12,
+
+ ECreateBookmark = 0x1A,
+ EDeleteBookmark = 0x1B,
+
+ EResultOk = 0xFF // only for response message
+ };
+
+ public:
+
+ static CHtiPIMServicePlugin* NewL();
+
+ // Interface implementation
+
+ /**
+ * From CHTIServicePluginInterface
+ * Called by the HTI Framework when sending message to this service.
+ * @param aMessage message body destinated to a servive
+ * @param aPriority message priority
+ */
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+ /**
+ * From CHTIServicePluginInterface
+ * Indicates to HTI Framework whether the plugin is ready to process
+ * a new message or if it's busy processing previous message.
+ * @return ETrue if processing, EFalse if ready for new request
+ */
+ TBool IsBusy();
+
+
+ protected:
+
+ CHtiPIMServicePlugin();
+ void ConstructL();
+
+ virtual ~CHtiPIMServicePlugin();
+
+ private:
+
+ CPIMHandler* iPimHandler;
+ CHtiBookmarkHandler* iBookmarkHandler;
+ CHtiSimDirHandler* iSimDirHandler;
+ };
+
+#endif // CHTIPIMSERVICEPLUGIN_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiSimDirHandler.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Class that handles SIM card contacts creation and deletion
+* using the new Virtual Phonebook API
+*
+*/
+
+
+#ifndef HTISIMDIRHANDLER_H
+#define HTISIMDIRHANDLER_H
+
+
+// INCLUDES
+
+#include <HtiServicePluginInterface.h>
+#include <etelmm.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Class that handles SIM card contacts creation and deletion using the
+* new Virtual Phonebook API.
+*/
+class CHtiSimDirHandler : public CBase
+ {
+ public:
+
+ enum TContactFieldType
+ {
+ ENameField = 0x01,
+ ESecondNameField = 0x02,
+ EPhoneNumberField = 0x03,
+ EEMailField = 0x04,
+ EAdditNumberField = 0x05
+ };
+
+ public:
+
+ /**
+ * Two-phased constructor.
+ */
+ static CHtiSimDirHandler* NewL();
+
+ /**
+ * Called when there is a message to be processed by this service.
+ * @param aMessage message body destinated to the servive
+ * @param aPriority message priority
+ */
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+ /**
+ * Indicates whether this handler is ready to receive
+ * a new message or if it's busy processing previous message.
+ * @return ETrue if processing, EFalse if ready for new request
+ */
+ TBool IsBusy();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CHtiSimDirHandler();
+
+ /**
+ * Sets the dispatcher to send outgoing messages to.
+ * @param aDispatcher pointer to dispatcher instance
+ */
+ void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+ private: // constructors
+
+ /**
+ * C++ default constructor.
+ */
+ CHtiSimDirHandler();
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ private: // helpers
+
+ void HandleSimCardInfoL(const TDesC8& aData);
+ void HandleSimContactImportL(const TDesC8& aData);
+ void HandleSimContactDeleteL(const TDesC8& aData);
+
+ TBool CheckImportMsg(const TDesC8& aData);
+
+ void SendOkMsgL( const TDesC8& aData );
+ void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+ private: // data
+
+ // Pointer to the dispatcher (referenced)
+ MHtiDispatcher* iDispatcher;
+
+ // Flag indicating if service is busy processing a request
+ TBool iIsBusy;
+
+ RTelServer iEtelServer;
+ RMobilePhone iEtelPhone;
+ RMobilePhoneBookStore iEtelStore;
+
+ TBool iStoreIsOpen;
+ };
+
+#endif // HTISIMDIRHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/PIMHandler.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Functional implentation of PIM service.
+*
+*/
+
+
+#ifndef CPIMHANDLER_H
+#define CPIMHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include <HtiServicePluginInterface.h>
+#include <calprogresscallback.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CCalSession;
+
+// CLASS DECLARATION
+
+/**
+* Functional implentation of PIM service.
+*/
+class CPIMHandler : public CBase,
+ public MCalProgressCallBack
+ {
+ public:
+
+ static CPIMHandler* NewL();
+
+ // Interface implementation
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+ TBool IsBusy();
+
+ virtual ~CPIMHandler();
+
+ void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+
+ // From MCalProgressCallBack
+
+ void Progress( TInt aPercentageCompleted );
+ void Completed( TInt aError );
+ TBool NotifyProgress();
+
+ private:
+
+ CPIMHandler();
+ void ConstructL();
+
+ private: // helpers
+
+ void HandleVCardImportFuncL( const TDesC8& aData );
+ void HandleVCalendarImportFuncL( const TDesC8& aData );
+ void HandleContactDeleteFuncL( const TDesC8& aData );
+ void HandleCalendarDeleteFuncL( const TDesC8& aData );
+ void HandleOpenCalendarFileL( const TDesC8& aData );
+ void HandleListCalendarFilesL();
+ void HandleNotepadAddMemoFuncL( const TDesC8& aData );
+ void HandleNotepadAddMemoFromFileFuncL( const TDesC8& aData );
+ void HandleNotepadDeleteAllFuncL();
+
+ void SendOkMsgL( const TDesC8& aData );
+ void SendNotepadOkMsgL( CHtiPIMServicePlugin::TCommand aCommand );
+ void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+ private: // data
+ TBool iIsBusy;
+ MHtiDispatcher* iDispatcher; // referenced
+ CActiveSchedulerWait* iWaiter;
+ TInt iEntryViewErr;
+ CCalSession* iCalSession;
+ };
+
+#endif // CPIMHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiBookmarkHandler.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,702 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of browser bookmark handling.
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiBookmarkHandler.h"
+#include "HtiPIMServicePlugin.h"
+
+#include <cmconnectionmethod.h>
+#include <cmconnectionmethoddef.h>
+#include <cmdestination.h>
+#include <cmmanager.h>
+
+#include <FavouritesItem.h>
+#include <FavouritesItemList.h>
+#include <FavouritesDb.h>
+#include <FavouritesFile.h>
+#include <FavouritesWapAp.h>
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+_LIT8( KErrorInvalidParameters, "Invalid command parameters" );
+_LIT8( KErrorCreateFailed, "Bookmark creation failed" );
+_LIT8( KErrorDeleteFailed, "Bookmark deletion failed" );
+_LIT8( KErrorBookmarkNotFound, "Bookmark not found" );
+_LIT8( KErrorFolderNotFound, "Folder not found" );
+_LIT8( KErrorApNotFound, "Access point not found" );
+_LIT8( KErrorFolderSearchFailed, "Error when searching folder" );
+_LIT8( KErrorApSearchFailed, "Error when searching access point" );
+
+const TInt KCreateMessageMinLength = 10;
+const TInt KDeleteMessageMinLength = 3;
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiBookmarkHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CHtiBookmarkHandler* CHtiBookmarkHandler::NewL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::NewL" );
+ CHtiBookmarkHandler* self = new ( ELeave ) CHtiBookmarkHandler();
+ CleanupStack::PushL ( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::NewL" );
+ return self;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::CHtiBookmarkHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+CHtiBookmarkHandler::CHtiBookmarkHandler()
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::CHtiBookmarkHandler" );
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::CHtiBookmarkHandler" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiBookmarkHandler::~CHtiBookmarkHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+CHtiBookmarkHandler::~CHtiBookmarkHandler()
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::~CHtiBookmarkHandler" );
+ delete iUrl;
+ iFavSession.Close();
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::~CHtiBookmarkHandler" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiBookmarkHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CHtiBookmarkHandler::ConstructL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::ConstructL" );
+ User::LeaveIfError( iFavSession.Connect() );
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::ConstructL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiBookmarkHandler::SetDispatcher
+// Sets the dispatcher pointer.
+// -----------------------------------------------------------------------------
+
+void CHtiBookmarkHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::SetDispatcher" );
+ iDispatcher = aDispatcher;
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::SetDispatcher" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiBookmarkHandler::ProcessMessageL
+// Parses the received message and calls handler functions.
+// -----------------------------------------------------------------------------
+void CHtiBookmarkHandler::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/ )
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::ProcessMessageL" );
+ // Zero legth of aMessage tested already in CHtiPIMServicePlugin.
+ // Other sanity checks must be done here.
+ if ( aMessage[0] == CHtiPIMServicePlugin::ECreateBookmark )
+ {
+ TRAPD( err, ParseCreateMessageL( aMessage ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ TRAP( err, HandleCreateBookmarkL() );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorCreateFailed );
+ }
+ }
+ }
+
+ else if ( aMessage[0] == CHtiPIMServicePlugin::EDeleteBookmark )
+ {
+ TRAPD( err, ParseDeleteMessageL( aMessage ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ }
+ else
+ {
+ TRAP( err, HandleDeleteBookmarkL() );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorDeleteFailed );
+ }
+ }
+ }
+
+ else
+ {
+ SendErrorMessageL( KErrArgument, KErrorUnrecognizedCommand );
+ }
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::ProcessMessageL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::IsBusy
+// Returns the status whether this handler is busy processing a request.
+// ----------------------------------------------------------------------------
+TBool CHtiBookmarkHandler::IsBusy()
+ {
+ // Never busy if ProcessMessageL has completed.
+ return EFalse;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::HandleCreateBookmarkL
+// Handles the bookmark and/or folder creation command.
+// ----------------------------------------------------------------------------
+void CHtiBookmarkHandler::HandleCreateBookmarkL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::HandleCreateBookmarkL" );
+ TInt err = KErrNone;
+ // If folder given, get the UID if it exists
+ TInt folderUid = KFavouritesRootUid;
+ if ( iFolderName.Length() > 0 )
+ {
+ TRAP( err, folderUid = GetFolderUidL( iFolderName ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorFolderSearchFailed );
+ return;
+ }
+ }
+ HTI_LOG_FORMAT( "Folder UID = %d", folderUid );
+
+ // If access point given, search the UID. It's an error if AP is not found.
+ TInt apUid = KErrNotFound;
+ if ( iApName.Length() > 0 )
+ {
+ TRAP( err, apUid = GetApUidL( iApName ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorApSearchFailed );
+ return;
+ }
+ if ( apUid == KErrNotFound )
+ {
+ SendErrorMessageL( KErrNotFound, KErrorApNotFound );
+ return;
+ }
+ }
+
+ RFavouritesDb db;
+ User::LeaveIfError( db.Open( iFavSession, KBrowserBookmarks ) );
+ CleanupClosePushL<RFavouritesDb>( db );
+
+ TInt itemsCreated = 0;
+ // If folder was given but was not found, create the folder first.
+ if ( iFolderName.Length() > 0 && folderUid == KErrNotFound )
+ {
+ CFavouritesItem* folder = CFavouritesItem::NewLC();
+ folder->SetType( CFavouritesItem::EFolder );
+ folder->SetParentFolder( KFavouritesRootUid ) ;
+ folder->SetNameL( iFolderName );
+
+ HTI_LOG_TEXT( "Adding the folder item to DB" );
+ err = db.Add( *folder, EFalse );
+ HTI_LOG_FORMAT( "Add returned %d", err );
+ if ( err != KErrNone )
+ {
+ User::Leave( err );
+ }
+ folderUid = folder->Uid();
+ HTI_LOG_FORMAT( "New folder UID = %d", folderUid );
+ CleanupStack::PopAndDestroy(); // folder
+ itemsCreated++;
+ }
+
+ // Now create the actual bookmark item
+ CFavouritesItem* item = CFavouritesItem::NewLC();
+ item->SetType( CFavouritesItem::EItem );
+ item->SetParentFolder( folderUid ) ;
+ item->SetNameL( iBookmarkName );
+ item->SetUrlL( *iUrl );
+ if ( apUid != KErrNotFound )
+ {
+ TFavouritesWapAp favAp;
+ favAp.SetApId( ( TUint32 ) apUid );
+ item->SetWapAp( favAp );
+ }
+ if ( iUserName.Length() > 0 )
+ {
+ item->SetUserNameL( iUserName );
+ }
+ if ( iPassword.Length() > 0 )
+ {
+ item->SetPasswordL( iPassword );
+ }
+
+ HTI_LOG_TEXT( "Adding the bookmark item to DB" );
+ err = db.Add( *item, EFalse );
+ HTI_LOG_FORMAT( "Add returned %d", err );
+ if ( err )
+ {
+ User::Leave( err );
+ }
+ HTI_LOG_FORMAT( "Bookmark UID = %d", item->Uid() );
+ CleanupStack::PopAndDestroy(); // item
+ itemsCreated++;
+
+ CleanupStack::PopAndDestroy(); // db
+
+ TBuf8<1> response;
+ response.Append( itemsCreated );
+ SendOkMsgL( response );
+
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::HandleCreateBookmarkL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::HandleDeleteBookmarkL
+// Handles the bookmark and/or folder deletion.
+// ----------------------------------------------------------------------------
+void CHtiBookmarkHandler::HandleDeleteBookmarkL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::HandleDeleteBookmarkL" );
+ TInt err = KErrNone;
+ // If folder given, get the UID if it exists.
+ // It is an error if the given folder does not exist.
+ TInt folderUid = KFavouritesRootUid;
+ if ( iFolderName.Length() > 0 )
+ {
+ TRAP( err, folderUid = GetFolderUidL( iFolderName ) );
+ if ( err != KErrNone )
+ {
+ SendErrorMessageL( err, KErrorFolderSearchFailed );
+ return;
+ }
+ if ( folderUid == KErrNotFound )
+ {
+ SendErrorMessageL( KErrNotFound, KErrorFolderNotFound );
+ return;
+ }
+ }
+ HTI_LOG_FORMAT( "Folder UID = %d", folderUid );
+
+ RFavouritesDb db;
+ User::LeaveIfError( db.Open( iFavSession, KBrowserBookmarks ) );
+ CleanupClosePushL<RFavouritesDb>( db );
+
+ CArrayFixFlat<TInt>* deleteList = new ( ELeave ) CArrayFixFlat<TInt>( 10 );
+ CleanupStack::PushL( deleteList );
+ if ( iBookmarkName.Length() > 0 )
+ {
+ // Get the UID of bookmark item matching to iBookmarkName
+ // It is an error if nothing found.
+ CFavouritesItemList* items = new ( ELeave ) CFavouritesItemList();
+ CleanupStack::PushL( items );
+ User::LeaveIfError( db.GetAll( *items, folderUid,
+ CFavouritesItem::EItem ) );
+ TInt uid = KErrNotFound;
+ TInt itemCount = items->Count();
+ HTI_LOG_FORMAT( "Found %d items", itemCount );
+ TInt i = 0;
+ while ( uid == KErrNotFound && i < itemCount )
+ {
+ if ( ( *items )[i]->Name().CompareF( iBookmarkName ) == 0 )
+ {
+ uid = ( *items )[i]->Uid();
+ }
+ i++;
+ }
+ CleanupStack::PopAndDestroy(); // items
+ HTI_LOG_FORMAT( "Matching item UID: %d", uid );
+ if ( uid == KErrNotFound )
+ {
+ SendErrorMessageL( KErrNotFound, KErrorBookmarkNotFound );
+ CleanupStack::PopAndDestroy( 2 ); // deleteList, db
+ return;
+ }
+ else
+ {
+ deleteList->AppendL( uid );
+ }
+ }
+ else
+ {
+ // We are deleting a folder (whose UID we already have) or deleting all.
+ if ( folderUid != KFavouritesRootUid )
+ {
+ deleteList->AppendL( folderUid );
+ }
+ else
+ {
+ // We don't have folder or bookmark name - deleting all
+ User::LeaveIfError( db.GetUids( *deleteList, KFavouritesRootUid ) );
+ HTI_LOG_FORMAT( "Found %d matching items", deleteList->Count() );
+ }
+ }
+
+ TInt beginningCount = KErrNotFound;
+ User::LeaveIfError( db.Count( beginningCount ) );
+ HTI_LOG_FORMAT( "Items in DB before delete: %d", beginningCount );
+
+ // Start deleting
+ TInt deleteCount = 0;
+ for ( TInt i = 0; i < deleteList->Count(); i++ )
+ {
+ HTI_LOG_FORMAT( "Deleting with UID %d", ( *deleteList )[i] );
+ err = db.Delete( ( *deleteList )[i] );
+ HTI_LOG_FORMAT( "Delete returned %d", err );
+ if ( err == KErrNone )
+ {
+ deleteCount++;
+ }
+ if ( err != KErrNone && err != KErrAccessDenied )
+ {
+ HTI_LOG_TEXT( "Unexpected error when deleting - leaving" );
+ User::Leave( err );
+ }
+ }
+
+ TInt endingCount = KErrNotFound;
+ User::LeaveIfError( db.Count( endingCount ) );
+ HTI_LOG_FORMAT( "Items in DB after delete: %d", endingCount );
+
+ CleanupStack::PopAndDestroy( 2 ); // deleteList, db
+
+ TBuf8<1> response;
+ response.Append( beginningCount - endingCount );
+ SendOkMsgL( response );
+
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::HandleDeleteBookmarkL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::ParseCreateMessageL
+// Extracts the parameters from a create bookmark message.
+// ----------------------------------------------------------------------------
+void CHtiBookmarkHandler::ParseCreateMessageL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::ParseCreateMessageL" );
+ TInt length = aMessage.Length();
+ HTI_LOG_FORMAT( "CreateBookmark message length = %d", length );
+
+ if ( length < KCreateMessageMinLength )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ // Extract folder name
+ TInt offset = 1; // skip the command code in position 0
+ offset = ExtractStringL( aMessage, offset, 1, 0, KFavouritesMaxName,
+ iFolderName );
+ HTI_LOG_FORMAT( "Folder name: %S", &iFolderName );
+
+ // Extract bookmark name
+ offset = ExtractStringL( aMessage, offset, 1, 1, KFavouritesMaxName,
+ iBookmarkName );
+ HTI_LOG_FORMAT( "Bookmark name: %S", &iBookmarkName );
+
+ // Extract URL
+ delete iUrl;
+ iUrl = NULL;
+ iUrl = HBufC::NewL( KFavouritesMaxUrl );
+ TPtr urlPtr = iUrl->Des();
+ offset = ExtractStringL( aMessage, offset, 2, 1, KFavouritesMaxUrl,
+ urlPtr );
+ HTI_LOG_FORMAT( "URL: %S", iUrl );
+
+ // Extract AP name
+ offset = ExtractStringL( aMessage, offset, 1, 0, KApMaxConnNameLength,
+ iApName );
+ HTI_LOG_FORMAT( "AP name: %S", &iApName );
+
+ // Extract user name
+ offset = ExtractStringL( aMessage, offset, 1, 0, KFavouritesMaxUserName,
+ iUserName );
+ HTI_LOG_FORMAT( "User name: %S", &iUserName );
+
+ // Extract password
+ offset = ExtractStringL( aMessage, offset, 1, 0, KFavouritesMaxPassword,
+ iPassword );
+ HTI_LOG_FORMAT( "Password: %S", &iPassword );
+
+ // Check that there's no extra data
+ if ( offset != length )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::ParseCreateMessageL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::ParseDeleteMessageL
+// Extracts the parameters from a delete bookmark message.
+// ----------------------------------------------------------------------------
+void CHtiBookmarkHandler::ParseDeleteMessageL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::ParseDeleteMessageL" );
+ TInt length = aMessage.Length();
+ HTI_LOG_FORMAT( "DeleteBookmark message length = %d", length );
+
+ if ( length < KDeleteMessageMinLength )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ // Extract folder name
+ TInt offset = 1; // skip the command code in position 0
+ offset = ExtractStringL( aMessage, offset, 1, 0, KFavouritesMaxName,
+ iFolderName );
+ HTI_LOG_FORMAT( "Folder name: %S", &iFolderName );
+
+ // Extract bookmark name
+ offset = ExtractStringL( aMessage, offset, 1, 0, KFavouritesMaxName,
+ iBookmarkName );
+ HTI_LOG_FORMAT( "Bookmark name: %S", &iBookmarkName );
+
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::ParseDeleteMessageL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::ExtractStringL
+// Extract one string from the given message. Leaves on syntax errors.
+// ----------------------------------------------------------------------------
+TInt CHtiBookmarkHandler::ExtractStringL( const TDesC8& aMessage, TInt aOffset,
+ TInt aLengthBytes, TInt aMinLength, TInt aMaxLength, TDes& aResult )
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::ExtractStringL" );
+ __ASSERT_ALWAYS( aResult.MaxLength() >= aMaxLength,
+ User::Panic( _L( "HtiPimAssert" ), 1 ) );
+ __ASSERT_ALWAYS( aLengthBytes > 0, User::Panic( _L( "HtiPimAssert" ), 2 ) );
+
+ TInt length = aMessage.Length();
+ if ( length < aOffset + 1 )
+ {
+ User::Leave( KErrArgument );
+ }
+ TInt parseLength = aMessage[aOffset];
+ aOffset++;
+ if ( aLengthBytes > 1 )
+ {
+ for ( TInt i = 1; i < aLengthBytes; i++ )
+ {
+ parseLength += aMessage[aOffset] << ( i * 8 );
+ aOffset++;
+ }
+ }
+ HTI_LOG_FORMAT( "Parse length = %d", parseLength );
+ if ( parseLength < aMinLength || parseLength > aMaxLength ||
+ parseLength + aOffset > length )
+ {
+ User::Leave( KErrArgument );
+ }
+ else
+ {
+ aResult.Copy( aMessage.Mid( aOffset, parseLength ) );
+ aOffset += parseLength;
+ }
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::ExtractStringL" );
+ return aOffset;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::GetFolderUidL
+// Finds the UID of the named folder if it exists.
+// ----------------------------------------------------------------------------
+TInt CHtiBookmarkHandler::GetFolderUidL( const TDesC& aFolderName )
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::GetFolderUidL" );
+ HTI_LOG_FORMAT( "Searching folder %S", &aFolderName );
+ RFavouritesDb db;
+ User::LeaveIfError( db.Open( iFavSession, KBrowserBookmarks ) );
+ CleanupClosePushL<RFavouritesDb>( db );
+
+ /* Doing the name matching ourselves 'cause giving the name match pattern
+ * parameter to GetAll or GetUids methods crashes the favourites server.
+ */
+ CFavouritesItemList* folders = new ( ELeave ) CFavouritesItemList();
+ CleanupStack::PushL( folders );
+ User::LeaveIfError( db.GetAll( *folders, KFavouritesNullUid,
+ CFavouritesItem::EFolder ) );
+ TInt uid = KErrNotFound;
+ TInt folderCount = folders->Count();
+ HTI_LOG_FORMAT( "Found %d folders", folderCount );
+ TInt i = 0;
+ while ( uid == KErrNotFound && i < folderCount )
+ {
+ if ( ( *folders )[i]->Name().CompareF( aFolderName ) == 0 )
+ {
+ uid = ( *folders )[i]->Uid();
+ }
+ i++;
+ }
+
+ CleanupStack::PopAndDestroy( 2 ); // folders, db
+ HTI_LOG_FORMAT( "Matching UID: %d", uid );
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::GetFolderUidL" );
+ return uid;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::GetApUidL
+// Gets the WAP Access Point ID of access point named by iConnName.
+// Favourites item needs the WAP ID for identifying access point.
+// Returns KErrNotFound if AP not found.
+// ----------------------------------------------------------------------------
+TInt CHtiBookmarkHandler::GetApUidL( const TDesC& aApName )
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::GetApUidL" );
+ TInt uid = KErrNotFound;
+
+ RCmManager cmManager;
+ cmManager.OpenL();
+ CleanupClosePushL( cmManager );
+
+ // Search from uncategorised first
+ RArray<TUint32> array = RArray<TUint32>();
+ cmManager.ConnectionMethodL( array );
+ CleanupClosePushL( array );
+ TInt i = 0;
+ while ( i < array.Count() && uid == KErrNotFound )
+ {
+ RCmConnectionMethod cm = cmManager.ConnectionMethodL( array[i] );
+ CleanupClosePushL( cm );
+ HBufC* name = cm.GetStringAttributeL( CMManager::ECmName );
+ HTI_LOG_FORMAT( "Found name: %S", name );
+ CleanupStack::PushL( name );
+ if ( aApName.Compare( *name ) == 0 )
+ {
+ uid = cm.GetIntAttributeL( CMManager::ECmWapId );
+ HTI_LOG_FORMAT( "Match: UID = %d", uid );
+ }
+ CleanupStack::PopAndDestroy(); // name
+ CleanupStack::PopAndDestroy(); // cm
+ i++;
+ }
+ CleanupStack::PopAndDestroy(); // array
+
+ // If not found from uncategorised, search from all destinations
+ if ( uid == KErrNotFound )
+ {
+ HTI_LOG_TEXT( "Not found from uncategorised" );
+ RArray<TUint32> destIdArray = RArray<TUint32>();
+ cmManager.AllDestinationsL( destIdArray );
+ CleanupClosePushL( destIdArray );
+ i = 0;
+ while ( i < destIdArray.Count() && uid == KErrNotFound )
+ {
+ RCmDestination dest = cmManager.DestinationL( destIdArray[i] );
+ CleanupClosePushL( dest );
+ TInt j = 0;
+ while ( j < dest.ConnectionMethodCount() && uid == KErrNotFound )
+ {
+ HBufC* name = dest.ConnectionMethodL( j ).GetStringAttributeL(
+ CMManager::ECmName );
+ CleanupStack::PushL( name );
+ HTI_LOG_FORMAT( "Found name: %S", name );
+ if ( aApName.Compare( *name ) == 0 )
+ {
+ uid = dest.ConnectionMethodL( j ).GetIntAttributeL(
+ CMManager::ECmWapId );
+ HTI_LOG_FORMAT( "Match: UID = %d", uid );
+ }
+ CleanupStack::PopAndDestroy(); // name
+ j++;
+ }
+ CleanupStack::PopAndDestroy(); // dest
+ i++;
+ }
+ CleanupStack::PopAndDestroy(); // destIdArray
+ }
+
+ CleanupStack::PopAndDestroy(); // cmManager
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::GetApUidL" );
+ return uid;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::SendOkMsgL
+// Helper function for sending response messages.
+// ----------------------------------------------------------------------------
+void CHtiBookmarkHandler::SendOkMsgL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::SendOkMsgL" );
+ User::LeaveIfNull( iDispatcher );
+ HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+ TPtr8 response = temp->Des();
+ response.Append( ( TChar ) CHtiPIMServicePlugin::EResultOk );
+ response.Append( aData );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+ temp, KPIMServiceUid ) );
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::SendOkMsgL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::SendErrorMessageL
+// Helper function for sending error response messages.
+// ----------------------------------------------------------------------------
+void CHtiBookmarkHandler::SendErrorMessageL( TInt aError,
+ const TDesC8& aDescription )
+ {
+ HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::SendErrorMessageL" );
+ User::LeaveIfNull( iDispatcher );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+ aError, aDescription, KPIMServiceUid ) );
+ HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::SendErrorMessageL" );
+ }
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiNpdHlp.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,237 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HtiNpdHlp implementation.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <NpdApi.h>
+#include <eikenv.h>
+
+
+#ifdef __ENABLE_LOGGING__
+
+#include <flogger.h>
+_LIT( KLogFolder, "hti" );
+_LIT( KLogFile, "HtiNpdHlp.txt" );
+
+#define HTI_LOG_TEXT(a1) {_LIT(temp, a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);}
+#define HTI_LOG_DES(a1) {RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, a1);}
+#define HTI_LOG_FORMAT(a1,a2) {_LIT(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, (a2));}
+
+_LIT8(KFuncIn, "-=> %S");
+_LIT8(KFuncOut, "<=- %S");
+
+#define HTI_LOG_FUNC_IN(a1) {_LIT8(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, KFuncIn, &temp);}
+#define HTI_LOG_FUNC_OUT(a1) {_LIT8(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, KFuncOut, &temp);}
+
+#else // !__ENABLE_LOGGING__
+
+#define HTI_LOG_TEXT(a1)
+#define HTI_LOG_DES(a1)
+#define HTI_LOG_FORMAT(a1,a2)
+#define HTI_LOG_FUNC_IN(a1)
+#define HTI_LOG_FUNC_OUT(a1)
+
+#endif // __ENABLE_LOGGING__
+
+// CONSTANTS
+_LIT( KHtiNpdHlp, "HtiNpdHlp" );
+
+_LIT( KCmdAddMemo, "AddMemo" );
+_LIT( KCmdAddMemoFromFile, "AddMemoFromFile" );
+_LIT( KCmdDeleteAll, "DeleteAll" );
+
+_LIT( KNotepadDatabaseFile, "c:\\Private\\100012a5\\DBS_101F8878_Notepad.dat" );
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ LOCAL FUNCTIONS ===============================
+void HandleAddMemoL( TLex& aParser )
+ {
+ HTI_LOG_FUNC_IN( "HandleAddMemoL" );
+
+ aParser.SkipSpace();
+ TPtrC text = aParser.Remainder();
+
+ if ( text.Length() == 0 )
+ {
+ HTI_LOG_TEXT( "missing text arg" );
+ User::Leave(KErrArgument);
+ }
+
+ // NOTE: We need to create CCoeEnv to make CNotepadApi work.
+ // This also creates a new cleaupstack so we need to destory
+ // CCoeEnv's cleanupstack before leaving to make our cleanupstack
+ // the topmost stack
+
+ CCoeEnv* env = new CCoeEnv;
+ TRAPD( err, env->ConstructL() );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "CEikonEnv::ConstructL err %d", err );
+ User::Leave( err );
+ }
+
+ TRAP( err, CNotepadApi::AddContentL( text ) );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "CNotepadApi::AddContentL err %d", err );
+ env->DestroyEnvironment();
+ User::Leave( err );
+ }
+
+ env->DestroyEnvironment();
+
+ HTI_LOG_FUNC_OUT( "HandleAddMemoL" );
+ }
+
+
+void HandleAddMemoFromFileL( TLex& aParser )
+ {
+ HTI_LOG_FUNC_IN( "HandleAddMemoFromFileL" );
+
+ aParser.SkipSpaceAndMark();
+ aParser.SkipCharacters();
+ if ( aParser.TokenLength() <= 0 )
+ {
+ User::Leave(KErrArgument);
+ }
+
+ TPtrC filename = aParser.MarkedToken();
+
+ /*
+ NOTE: Maybe will add this later
+
+ aParser.SkipSpaceAndMark();
+ aParser.SkipCharacters();
+
+ TPtrC encoding = KNullDesC;
+ if ( aParser.TokenLength() > 0 )
+ {
+ encoding.Set( aParser.MarkedToken() );
+ }
+ */
+
+ CCoeEnv* env = new CCoeEnv;
+ TRAPD( err, env->ConstructL() );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "CEikonEnv::ConstructL err %d", err );
+ User::Leave( err );
+ }
+
+ TRAP( err, CNotepadApi::SaveFileAsMemoL( filename ) );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "CNotepadApi::SaveFileAsMemoL err %d", err );
+ env->DestroyEnvironment();
+ User::Leave( err );
+ }
+
+ env->DestroyEnvironment();
+
+ HTI_LOG_FUNC_OUT( "HandleAddMemoFromFileL" );
+ }
+
+void HandleDeleteAllL()
+ {
+ HTI_LOG_FUNC_IN( "HandleDeleteAllL" );
+ TInt err = KErrNone;
+ RFs fs;
+ err = fs.Connect();
+ if ( err == KErrNone )
+ {
+ err = fs.Delete( KNotepadDatabaseFile );
+ fs.Close();
+ }
+ if ( err != KErrNone && err != KErrNotFound )
+ {
+ HTI_LOG_FORMAT( "Notepad database delete failed %d", err );
+ User::Leave( err );
+ }
+ HTI_LOG_FUNC_OUT( "HandleDeleteAllL" );
+ }
+
+
+LOCAL_C TInt StartL()
+ {
+ HTI_LOG_FUNC_IN( "StartL" );
+ TInt cmdLen = User::CommandLineLength();
+ HBufC* cmdLine = HBufC::NewLC( cmdLen );
+ TPtr ptCmdLine = cmdLine->Des();
+ User::CommandLine( ptCmdLine );
+
+ HTI_LOG_DES( *cmdLine );
+
+ //parse command line
+ TLex parser( *cmdLine );
+ parser.SkipCharacters();
+
+ if ( parser.TokenLength() <= 0 )
+ {
+ HTI_LOG_TEXT( "missing arguments" );
+ User::Leave( KErrArgument );
+ }
+
+
+ TPtrC cmd = parser.MarkedToken();
+
+ if ( cmd == KCmdAddMemo )
+ {
+ HandleAddMemoL( parser );
+ }
+ else if ( cmd == KCmdAddMemoFromFile )
+ {
+ HandleAddMemoFromFileL( parser );
+ }
+ else if ( cmd == KCmdDeleteAll )
+ {
+ HandleDeleteAllL();
+ }
+ else
+ {
+ HTI_LOG_TEXT( "Unknown argument" );
+ User::Leave( KErrArgument );
+ }
+
+ CleanupStack::PopAndDestroy(); // cmdLine
+ HTI_LOG_FUNC_OUT( "StartL" );
+ return KErrNone;
+ }
+
+
+GLDEF_C TInt E32Main()
+ {
+ __UHEAP_MARK;
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+ User::RenameThread( KHtiNpdHlp );
+ TRAPD( err, StartL() );
+ delete cleanup;
+ __UHEAP_MARKEND;
+ return err;
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiPIMServicePlugin.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PIMServicePlugin implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiPIMServicePlugin.h"
+#include "PIMHandler.h"
+#include "HtiBookmarkHandler.h"
+#include "HtiSimDirHandler.h"
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+// CONSTANTS
+_LIT8( KErrorMissingCommand, "Missing command" );
+
+// ----------------------------------------------------------------------------
+// Create instance of concrete ECOM interface implementation
+CHtiPIMServicePlugin* CHtiPIMServicePlugin::NewL()
+ {
+ CHtiPIMServicePlugin* self = new (ELeave) CHtiPIMServicePlugin;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+CHtiPIMServicePlugin::CHtiPIMServicePlugin()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+CHtiPIMServicePlugin::~CHtiPIMServicePlugin()
+ {
+ HTI_LOG_TEXT("CHtiPIMServicePlugin destroy");
+ delete iPimHandler;
+ delete iBookmarkHandler;
+ delete iSimDirHandler;
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiPIMServicePlugin::ConstructL()
+ {
+ HTI_LOG_TEXT("CHtiPIMServicePlugin::ConstructL");
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiPIMServicePlugin::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority )
+ {
+ HTI_LOG_FUNC_IN( "CHtiPIMServicePlugin::ProcessMessageL" );
+ HTI_LOG_FORMAT( "Msg len: %d.", aMessage.Length() );
+
+ if ( aMessage.Length() == 0 )
+ {
+ User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument, KErrorMissingCommand, KPIMServiceUid ) );
+ return;
+ }
+
+ TUint8 aCommand = aMessage.Ptr()[0];
+ if ( aCommand < ESimCardInfo )
+ {
+ if ( iPimHandler == NULL )
+ {
+ iPimHandler = CPIMHandler::NewL();
+ iPimHandler->SetDispatcher( iDispatcher );
+ }
+ iPimHandler->ProcessMessageL( aMessage, aPriority );
+ }
+ else if ( aCommand < ECreateBookmark )
+ {
+ if ( iSimDirHandler == NULL )
+ {
+ iSimDirHandler = CHtiSimDirHandler::NewL();
+ iSimDirHandler->SetDispatcher( iDispatcher );
+ }
+ iSimDirHandler->ProcessMessageL( aMessage, aPriority );
+ }
+ else
+ {
+ if ( iBookmarkHandler == NULL )
+ {
+ iBookmarkHandler = CHtiBookmarkHandler::NewL();
+ iBookmarkHandler->SetDispatcher( iDispatcher );
+ }
+ iBookmarkHandler->ProcessMessageL( aMessage, aPriority );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiPIMServicePlugin::ProcessMessageL" );
+ }
+
+
+// ----------------------------------------------------------------------------
+TBool CHtiPIMServicePlugin::IsBusy()
+ {
+ if ( iPimHandler )
+ {
+ return iPimHandler->IsBusy();
+ }
+
+ if ( iBookmarkHandler )
+ {
+ return iBookmarkHandler->IsBusy();
+ }
+
+ if( iSimDirHandler)
+ {
+ return iSimDirHandler->IsBusy();
+ }
+ return EFalse;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiSimDirHandler.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,530 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation of SIM card contacts handling using the new
+ * Virtual Phonebook API
+ *
+ */
+
+// INCLUDE FILES
+#include "HtiSimDirHandler.h"
+#include "HtiPIMServicePlugin.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+#include <mmtsy_names.h>
+#include <mpbutil.h>
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KSimInfoResponseLength = 12;
+const TInt KOneSimContactBufferSize = 512;
+// MACROS
+// LOCAL CONSTANTS AND MACROS
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+_LIT8( KErrorInvalidParameters, "Invalid command parameters" );
+_LIT8( KErrorImportFailed, "Contact import failed" );
+_LIT8( KErrorDeleteFailed, "Failed to delete contact" );
+_LIT8( KErrorSimCardInfoFailed, "Failed to get SIM card info" );
+_LIT8( KErrorFieldNotSupported, "Field is not supported");
+_LIT8( KErrorFieldTooBig, "Filed is too long");
+//_LIT8( KErrorSimStoreOpenFailed, "Failed to open SIM contact store" );
+//_LIT8( KErrorSimStoreUnavailable, "SIM contact store unavailable" );
+//_LIT8( KErrorContactOperationFailed, "SIM contact operation failed" );
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CHtiSimDirHandler* CHtiSimDirHandler::NewL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiSimDirHandler::NewL" );
+ CHtiSimDirHandler* self = new (ELeave) CHtiSimDirHandler();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::NewL" );
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::CHtiSimDirHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+CHtiSimDirHandler::CHtiSimDirHandler() :
+ iIsBusy(EFalse), iStoreIsOpen(EFalse)
+ {
+ HTI_LOG_FUNC_IN( "CHtiSimDirHandler::CHtiSimDirHandler" );
+
+ HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::CHtiSimDirHandler" );
+ }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::~CHtiSimDirHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+CHtiSimDirHandler::~CHtiSimDirHandler()
+ {
+ HTI_LOG_FUNC_IN( "CHtiSimDirHandler::~CHtiSimDirHandler" );
+ iEtelStore.Close();
+ iEtelPhone.Close();
+ iEtelServer.Close();
+ HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::~CHtiSimDirHandler" );
+ }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CHtiSimDirHandler::ConstructL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiSimDirHandler::ConstructL" );
+
+ HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::ConstructL" );
+ }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::SetDispatcher
+// Sets the dispatcher pointer.
+// -----------------------------------------------------------------------------
+
+void CHtiSimDirHandler::SetDispatcher(MHtiDispatcher* aDispatcher)
+ {
+ HTI_LOG_FUNC_IN( "CHtiSimDirHandler::SetDispatcher" );
+ iDispatcher = aDispatcher;
+ HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::SetDispatcher" );
+ }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::ProcessMessageL
+// Parses the received message and calls handler functions.
+// -----------------------------------------------------------------------------
+void CHtiSimDirHandler::ProcessMessageL(const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/)
+ {
+ HTI_LOG_FUNC_IN( "CHtiSimDirHandler::ProcessMessageL" );
+
+ if (iStoreIsOpen == EFalse)
+ {
+ User::LeaveIfError(iEtelServer.Connect());
+ User::LeaveIfError(iEtelServer.LoadPhoneModule(KMmTsyModuleName));
+ User::LeaveIfError(iEtelPhone.Open(iEtelServer, KMmTsyPhoneName));
+ User::LeaveIfError(iEtelStore.Open(iEtelPhone, KETelIccAdnPhoneBook));
+ HTI_LOG_TEXT( "SIM card open" );
+ iStoreIsOpen = ETrue;
+ }
+
+ if (iIsBusy)
+ {
+ HTI_LOG_TEXT( "HtiSimDirHandler is busy - leaving" );
+ User::Leave(KErrInUse);
+ }
+
+ // Will be set to EFalse in the SendOkMsgL or SendErrorMessageL methods.
+ iIsBusy = ETrue;
+
+ // Zero legth of aMessage tested already in CHtiPIMServicePlugin.
+ // Other sanity checks must be done here.
+ TInt err = KErrNone;
+ TUint8 command = aMessage.Ptr()[0];
+ switch (command)
+ {
+ case CHtiPIMServicePlugin::ESimCardInfo:
+ {
+ TRAP(err ,HandleSimCardInfoL(aMessage.Right(aMessage.Length() - 1)));
+ break;
+ }
+ case CHtiPIMServicePlugin::EImportSimContact:
+ {
+ TRAP(err ,HandleSimContactImportL(aMessage.Right(aMessage.Length() - 1)));
+ break;
+ }
+ case CHtiPIMServicePlugin::EDeleteSimContact:
+ {
+ TRAP(err ,HandleSimContactDeleteL(aMessage.Right(aMessage.Length() - 1)));
+ break;
+ }
+ default:
+ {
+ SendErrorMessageL(KErrArgument, KErrorUnrecognizedCommand);
+ return;
+ }
+ }
+
+ if (err != KErrNone)
+ {
+ iIsBusy = EFalse;
+ User::Leave(err);
+ }
+ HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::ProcessMessageL" );
+ }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::IsBusy
+// -----------------------------------------------------------------------------
+//
+TBool CHtiSimDirHandler::IsBusy()
+ {
+ return iIsBusy;
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::HandleSimCardInfoL
+// Gets information about the SIM card.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::HandleSimCardInfoL(const TDesC8& aData)
+ {
+ HTI_LOG_FUNC_IN( "CHtiSimDirHandler::HandleSimCardInfoL" );
+ if (aData.Length() != 0)
+ {
+ HTI_LOG_TEXT( "CHtiSimDirHandler: wrong length of data" );
+ SendErrorMessageL(KErrArgument, KErrorInvalidParameters);
+ return;
+ }
+
+ RMobilePhoneBookStore::TMobilePhoneBookInfoV5 etelStoreInfo;
+ RMobilePhoneBookStore::TMobilePhoneBookInfoV5Pckg etelStoreInfoPckg(etelStoreInfo);
+
+ TRequestStatus requestStatus;
+ iEtelStore.GetInfo(requestStatus, (TDes8&) etelStoreInfoPckg);
+ User::WaitForRequest(requestStatus);
+ if (requestStatus.Int() != KErrNone)
+ {
+ HTI_LOG_TEXT( "CHtiSimDirHandler: Failed to get SIM card info" );
+ SendErrorMessageL(requestStatus.Int(), KErrorSimCardInfoFailed);
+ return;
+ }
+
+ // Create and send response message
+ TBuf8<KSimInfoResponseLength> reply;
+ reply.Append(etelStoreInfo.iMaxSecondNames > 0 ? etelStoreInfo.iMaxSecondNames : 0);
+ reply.Append(etelStoreInfo.iMaxAdditionalNumbers > 0 ? etelStoreInfo.iMaxAdditionalNumbers : 0);
+ reply.Append(etelStoreInfo.iMaxEmailAddr > 0 ? etelStoreInfo.iMaxEmailAddr : 0);
+ reply.Append(etelStoreInfo.iMaxTextLength > 0 ? etelStoreInfo.iMaxTextLength : 0);
+ reply.Append(etelStoreInfo.iMaxNumLength > 0 ? etelStoreInfo.iMaxNumLength : 0);
+ reply.Append(etelStoreInfo.iMaxTextLengthSecondName > 0 ?
+ etelStoreInfo.iMaxTextLengthSecondName : 0);
+ reply.Append(etelStoreInfo.iMaxNumLengthAdditionalNumber > 0?
+ etelStoreInfo.iMaxNumLengthAdditionalNumber : 0);
+ reply.Append(etelStoreInfo.iMaxTextLengthEmailAddr > 0 ? etelStoreInfo.iMaxTextLengthEmailAddr : 0);
+ reply.Append( ( TUint8* ) ( &etelStoreInfo.iTotalEntries ), 2 );
+ reply.Append( ( TUint8* ) ( &etelStoreInfo.iUsedEntries ), 2 );
+ SendOkMsgL(reply);
+ HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::HandleSimCardInfoL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::HandleSimContactImportL
+// Imports the contact to SIM card.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::HandleSimContactImportL(const TDesC8& aData)
+ {
+ HTI_LOG_FUNC_IN( "CHtiSimDirHandler::HandleSimContactImportL" );
+
+ if(CheckImportMsg(aData) == EFalse)
+ {
+ return;
+ }
+
+ RBuf8 buffer;
+ buffer.CreateL(KOneSimContactBufferSize);
+ CleanupClosePushL(buffer);
+ CPhoneBookBuffer* pbBuffer = new (ELeave) CPhoneBookBuffer();
+ CleanupStack::PushL(pbBuffer);
+ pbBuffer->Set(&buffer);
+
+ //add new enty tag
+ User::LeaveIfError(pbBuffer->AddNewEntryTag());
+
+ TInt offset = 0;
+ TInt fieldCount = aData[offset];
+ offset++;
+
+ for (TInt i = 0; i < fieldCount; i++)
+ {
+ HTI_LOG_FORMAT( "Processing field %d", i + 1 );
+
+ TContactFieldType type = (TContactFieldType) aData[offset];
+ offset++;
+ TInt fieldLength = aData[offset];
+ offset++;
+ HBufC* fieldData = HBufC::NewLC(fieldLength);
+ fieldData->Des().Copy(aData.Mid(offset, fieldLength));
+ switch (type)
+ {
+ case ENameField:
+ User::LeaveIfError(pbBuffer->PutTagAndValue(
+ RMobilePhoneBookStore::ETagPBText, fieldData->Des()));
+ break;
+ case ESecondNameField:
+ User::LeaveIfError(pbBuffer->PutTagAndValue(
+ RMobilePhoneBookStore::ETagPBSecondName,
+ fieldData->Des()));
+ break;
+ case EPhoneNumberField:
+ User::LeaveIfError(
+ pbBuffer->PutTagAndValue(
+ RMobilePhoneBookStore::ETagPBNumber,
+ fieldData->Des()));
+ break;
+ case EEMailField:
+ User::LeaveIfError(pbBuffer->PutTagAndValue(
+ RMobilePhoneBookStore::ETagPBEmailAddress,
+ fieldData->Des()));
+ break;
+ case EAdditNumberField:
+ User::LeaveIfError(pbBuffer->AddNewNumberTag());
+ User::LeaveIfError(
+ pbBuffer->PutTagAndValue(
+ RMobilePhoneBookStore::ETagPBNumber,
+ fieldData->Des()));
+ break;
+ default:
+ HTI_LOG_FORMAT( "Unknown field type %d", type );
+ User::Leave(KErrArgument);
+ break;
+ }
+ CleanupStack::PopAndDestroy(); // fieldData
+ offset += fieldLength;
+ }
+
+ // save contact into sim card
+ TInt index = -1;
+ TRequestStatus status;
+ //store the entry in the first free location and then return
+ //this location within index when it completes the request
+ iEtelStore.Write(status, buffer, index);
+ User::WaitForRequest(status);
+ if(status.Int() != KErrNone)
+ {
+ HTI_LOG_TEXT("Failed to add SIM contact");
+ SendErrorMessageL( status.Int(), KErrorImportFailed );
+ }
+ else
+ {
+ HTI_LOG_TEXT( "SIM contact added" );
+ TBuf8<4> idBuf;
+ idBuf.Append( ( TUint8* ) &index, 4 );
+ SendOkMsgL( idBuf );
+ }
+ CleanupStack::PopAndDestroy(2); // buffer, pbBuffer
+
+ HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::HandleSimContactImportL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::HandleSimContactDeleteL
+// Creates a contact view containing the contacts to be deleted.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::HandleSimContactDeleteL(const TDesC8& aData)
+ {
+ HTI_LOG_FUNC_IN( "CHtiSimDirHandler::HandleSimContactDeleteL" );
+ TInt dataLength = aData.Length();
+ if ( dataLength != 0 && dataLength != 4 )
+ {
+ HTI_LOG_TEXT( "CHtiSimDirHandler: Wrong length of data" )
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return;
+ }
+
+ TRequestStatus status;
+ if (dataLength == 0) //delete all
+ {
+ iEtelStore.DeleteAll(status);
+ HTI_LOG_TEXT("Delete all SIM contacts");
+ }
+ else //delete one contact with given id
+ {
+ TInt id = aData[0] + (aData[1] << 8) + (aData[2] << 16) + (aData[3]
+ << 24);
+ HTI_LOG_FORMAT( "Delete SIM contact with id %d", id );
+ iEtelStore.Delete(status, id);
+ }
+
+ User::WaitForRequest(status);
+ if(status.Int() != KErrNone)
+ {
+ HTI_LOG_TEXT("Failed to delete contact(s)");
+ SendErrorMessageL( status.Int(), KErrorDeleteFailed );
+ }
+ else
+ {
+ HTI_LOG_TEXT("SIM contact(s) deleted");
+ SendOkMsgL( KNullDesC8 );
+ }
+ HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::HandleSimContactDeleteL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::CheckImportMsg
+// Validates the syntax of import contact message.
+// ----------------------------------------------------------------------------
+TBool CHtiSimDirHandler::CheckImportMsg(const TDesC8& aData)
+ {
+ HTI_LOG_FUNC_IN( "CHtiSimDirHandler::CheckImportMsg" );
+ // Import command syntax:
+ // amount of fields (1 byte) __
+ // type of field (1 byte) |
+ // length of data field (1 byte) | repeated <amount of fields> times
+ // field data (variable) __|
+
+ TInt length = aData.Length();
+ if (length < 4) // min length 4 bytes
+ {
+ HTI_LOG_FORMAT( "Message too short %d", length );
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+
+ RMobilePhoneBookStore::TMobilePhoneBookInfoV5 etelStoreInfo;
+ RMobilePhoneBookStore::TMobilePhoneBookInfoV5Pckg etelStoreInfoPckg(etelStoreInfo);
+
+ TRequestStatus requestStatus;
+ iEtelStore.GetInfo(requestStatus, (TDes8&) etelStoreInfoPckg);
+ User::WaitForRequest(requestStatus);
+ if (requestStatus.Int() != KErrNone)
+ {
+ HTI_LOG_TEXT( "CHtiSimDirHandler: Failed to get SIM card info" );
+ SendErrorMessageL(requestStatus.Int(), KErrorSimCardInfoFailed);
+ return EFalse;
+ }
+ TInt offset = 0;
+ TInt fieldCount = aData[offset];
+ HTI_LOG_FORMAT( "Fields %d", fieldCount );
+ if (fieldCount < 1) // must be at least one field
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+
+ offset++;
+ TInt fieldsFound = 0;
+ while (offset < length)
+ {
+ fieldsFound++;
+ TContactFieldType fieldType = (TContactFieldType) aData[offset];
+ HTI_LOG_FORMAT( "Field type %d", fieldType );
+ TInt maxLength = 0;
+ if(fieldType == ENameField)
+ {
+ maxLength = etelStoreInfo.iMaxTextLength;
+ }
+ else if(fieldType == ESecondNameField)
+ {
+ maxLength = etelStoreInfo.iMaxTextLengthSecondName;
+ }
+ else if(fieldType == EPhoneNumberField)
+ {
+ maxLength = etelStoreInfo.iMaxNumLength;
+ }
+ else if(fieldType == EEMailField)
+ {
+ maxLength = etelStoreInfo.iMaxTextLengthEmailAddr;
+ }
+ else if(fieldType == EAdditNumberField)
+ {
+ maxLength = etelStoreInfo.iMaxNumLengthAdditionalNumber;
+ }
+ else
+ {
+ HTI_LOG_TEXT("Unknown field type");
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse; // invalid field type
+ }
+
+ if(maxLength <= 0)
+ {
+ HTI_LOG_TEXT("Field not supported");
+ SendErrorMessageL(KErrArgument, KErrorFieldNotSupported);
+ return EFalse;
+ }
+
+ offset++; // the type of field byte
+ if (offset >= length)
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+ TInt fieldLength = aData[offset];
+ HTI_LOG_FORMAT( "Field length %d", fieldLength );
+ if (fieldLength < 1)
+ {
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse; // Field data can not be empty
+ }
+ else if(fieldLength > maxLength)
+ {
+ HTI_LOG_TEXT("The length of field is too long");
+ SendErrorMessageL( KErrArgument, KErrorFieldTooBig );
+ return EFalse;
+ }
+ offset++; // advance over the length of data byte
+ offset += fieldLength; // and the field data
+ }
+
+ if (offset == length && fieldsFound == fieldCount)
+ {
+ HTI_LOG_TEXT( "Message OK" );
+ return ETrue;
+ }
+
+ SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+ return EFalse;
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::SendOkMsgL
+// Helper function for sending response messages.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::SendOkMsgL(const TDesC8& aData)
+ {
+ HTI_LOG_FUNC_IN( "CHtiSimDirHandler::SendOkMsgL" );
+ iIsBusy = EFalse; // Done with the current request
+ User::LeaveIfNull(iDispatcher);
+ HBufC8* temp = HBufC8::NewL(aData.Length() + 1);
+ TPtr8 response = temp->Des();
+ response.Append((TChar) CHtiPIMServicePlugin::EResultOk);
+ response.Append(aData);
+ User::LeaveIfError(iDispatcher->DispatchOutgoingMessage(temp,
+ KPIMServiceUid));
+ HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::SendOkMsgL" );
+ }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::SendErrorMessageL
+// Helper function for sending error response messages.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::SendErrorMessageL(TInt aError,
+ const TDesC8& aDescription)
+ {
+ HTI_LOG_FUNC_IN( "CHtiSimDirHandler::SendErrorMessageL" );
+ iIsBusy = EFalse; // Done with the current request
+ User::LeaveIfNull(iDispatcher);
+ User::LeaveIfError(iDispatcher->DispatchOutgoingErrorMessage(aError,
+ aDescription, KPIMServiceUid));
+ HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::SendErrorMessageL" );
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/PIMHandler.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,782 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Functional implementation of PIM service (for vCalendar, vCard)
+*
+*/
+
+
+// INCLUDE FILES
+#include "../../../symbian_version.hrh"
+
+#include "HtiPIMServicePlugin.h"
+#include "PIMHandler.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+#include <utf.h>
+#include <calcommon.h>
+#include <calsession.h>
+#include <calentryview.h>
+
+#include <cntdb.h>
+#include <cntitem.h>
+#include <cntfldst.h>
+#include <cntvcard.h>
+#include <cntfilt.h>
+#include <caldataexchange.h>
+#include <caldataformat.h>
+
+// CONSTANTS
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+_LIT8( KErrorCalendarFileFormat, "Invalid format of calendar file name");
+_LIT8( KErrorVCardImportFailed, "vCard import failed" );
+_LIT8( KErrorVCalendarImportFailed, "vCalendar import failed" );
+_LIT8( KErrorMissingVCalendar, "Missing vCalendar object" );
+_LIT8( KErrorMissingVCard, "Missing vCard object" );
+_LIT8( KErrorInvalidId, "Invalid ID parameter" );
+_LIT8( KErrorItemNotFound, "Item not found" );
+_LIT8( KErrorFailedDelete, "Failed to delete item" );
+_LIT8( KErrorFailedDeleteAll, "Failed to delete all items" );
+_LIT8( KErrorFailedOpenCalendar, "Failed to open calendar file");
+//_LIT8( KErrorFailedOpenContact, "Failed to open contact database");
+
+
+
+_LIT( KDefaultAgendaFile, "" ); // A default file is opened if fileName is KNullDesC
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+_LIT8( KErrorMissingText, "Text parameter missing" );
+_LIT8( KErrorMissingFilepath, "Filepath parameter missing" );
+_LIT8( KErrorNotepadAddMemoFailed, "Notepad add memo failed" );
+_LIT8( KErrorNotepadAddMemoFromFileFailed, "Notepad add memo from file failed" );
+_LIT8( KErrorNotepadDeleteAllFailed, "Notepad delete all failed" );
+
+_LIT( KHtiNpdHlpExe, "HtiNpdHlp.exe" );
+_LIT( KCmdAddMemo, "AddMemo" );
+_LIT( KCmdAddMemoFromFile, "AddMemoFromFile" );
+_LIT( KCmdDeleteAll, "DeleteAll" );
+_LIT( KCmdDelim, " " );
+#else
+_LIT8( KErrorNotepadNotSupported, "Notepad not supported" );
+#endif
+
+// ----------------------------------------------------------------------------
+CPIMHandler* CPIMHandler::NewL()
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::NewL" );
+ CPIMHandler* self = new (ELeave) CPIMHandler();
+ CleanupStack::PushL ( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "CPIMHandler::Done" );
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+CPIMHandler::CPIMHandler():iIsBusy( EFalse ), iEntryViewErr( KErrNone ),
+ iCalSession(NULL)
+ {
+ }
+
+// ----------------------------------------------------------------------------
+CPIMHandler::~CPIMHandler()
+ {
+ HTI_LOG_TEXT( "CPIMHandler destroy" );
+ HTI_LOG_TEXT( "Deleting iCalSession");
+ delete iCalSession;
+ HTI_LOG_TEXT( "Deleting iWaiter" );
+ delete iWaiter;
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::ConstructL()
+ {
+ HTI_LOG_TEXT( "CPIMHandler::ConstructL" );
+ iWaiter = new ( ELeave ) CActiveSchedulerWait;
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+ {
+ iDispatcher = aDispatcher;
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/ )
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::ProcessMessageL" );
+
+ iIsBusy = ETrue;
+ TInt err = KErrNone;
+
+ // Zero legth of aMessage tested already in CHtiPIMServicePlugin.
+ // Other sanity checks must be done here.
+
+ TUint8 command = aMessage.Ptr()[0];
+ switch ( command )
+ {
+ case CHtiPIMServicePlugin::EImportVCard:
+ {
+ TRAP( err, HandleVCardImportFuncL(
+ aMessage.Right( aMessage.Length() - 1 ) ) );
+ break;
+ }
+ case CHtiPIMServicePlugin::EImportVCalendar:
+ {
+ TRAP( err, HandleVCalendarImportFuncL(
+ aMessage.Right( aMessage.Length() - 1 ) ) );
+ break;
+ }
+ case CHtiPIMServicePlugin::EDeleteContact:
+ {
+ TRAP( err, HandleContactDeleteFuncL(
+ aMessage.Right( aMessage.Length() - 1 ) ) );
+ break;
+ }
+ case CHtiPIMServicePlugin::EDeleteCalendar:
+ {
+ TRAP( err, HandleCalendarDeleteFuncL(
+ aMessage.Right( aMessage.Length() - 1 ) ) );
+ break;
+ }
+ case CHtiPIMServicePlugin::EOpenCalendarFile:
+ {
+ TRAP( err, HandleOpenCalendarFileL(
+ aMessage.Right( aMessage.Length() - 1 )));
+ break;
+ }
+ case CHtiPIMServicePlugin::EListCalendarFiles:
+ {
+ TRAP( err, HandleListCalendarFilesL());
+ break;
+ }
+ case CHtiPIMServicePlugin::ENotepadAddMemo:
+ {
+ TRAP( err, HandleNotepadAddMemoFuncL( aMessage.Mid( 1 ) ) );
+ break;
+ }
+ case CHtiPIMServicePlugin::ENotepadAddMemoFromFile:
+ {
+ TRAP( err, HandleNotepadAddMemoFromFileFuncL( aMessage.Mid( 1 ) ) );
+ break;
+ }
+ case CHtiPIMServicePlugin::ENotepadDeleteAll:
+ {
+ TRAP( err, HandleNotepadDeleteAllFuncL() );
+ break;
+ }
+ default:
+ {
+ TRAP( err, SendErrorMessageL(
+ KErrArgument, KErrorUnrecognizedCommand ) );
+ break;
+ }
+ }
+
+ if ( err != KErrNone )
+ {
+ iIsBusy = EFalse;
+ User::Leave( err );
+ }
+
+ HTI_LOG_FUNC_OUT( "CPIMHandler::ProcessMessageL: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+TBool CPIMHandler::IsBusy()
+ {
+ return iIsBusy;
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleOpenCalendarFileL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::HandleOpenCalendarFileL" );
+
+ // check the format, the correct format is DriveLetter:FileName
+ if (aData.Length() != 0)
+ {
+ if(aData.Length() < 3 || aData[1] != ':'||
+ !(aData[0] >= 'a' && aData[0] <= 'z' || aData[0] >= 'A' && aData[0] <= 'Z'))
+ {
+ SendErrorMessageL( KErrArgument, KErrorCalendarFileFormat );
+ return;
+ }
+ }
+
+ delete iCalSession;
+ iCalSession = NULL;
+
+ // Open iCalSession
+ HTI_LOG_TEXT("Open calendar session");
+ iCalSession = CCalSession::NewL();
+ TBuf<KMaxFileName + 2> calFile;
+ calFile.Copy(aData);
+ TRAPD(err, iCalSession->OpenL(calFile));
+ if(err == KErrNone)
+ {
+ HTI_LOG_TEXT("Calendar session open");
+ SendOkMsgL( KNullDesC8 );
+ }
+ else
+ {
+ HTI_LOG_TEXT("Failed to open calendar file");
+ SendErrorMessageL( err, KErrorFailedOpenCalendar );
+ delete iCalSession;
+ iCalSession = NULL;
+ }
+ HTI_LOG_FUNC_OUT( "CPIMHandler::HandleOpenCalendarFileL: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleListCalendarFilesL()
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::HandleListCalendarFiles" );
+
+ CCalSession* calSession = CCalSession::NewL();
+ CleanupStack::PushL(calSession);
+ HTI_LOG_TEXT("List all calendar files");
+ CDesCArray* calFiles = calSession->ListCalFilesL();
+
+ if(calFiles == NULL) //No calendar files
+ {
+ TBuf8<2> reply;
+ reply.AppendFill(0, 2);
+ SendOkMsgL(reply);
+ CleanupStack::PopAndDestroy(); // calSession
+ return;
+ }
+
+ CleanupStack::PushL(calFiles);
+ TInt count = calFiles->Count();
+
+ // files count + file count * (file name length + max file name + driver letter + ':')
+ TInt bufSize = 2 + count * (2 + KMaxFileName + 1 + 1);
+ CBufFlat* calListBuf = CBufFlat::NewL( bufSize );
+ CleanupStack::PushL(calListBuf);
+
+ HBufC8* calArray = HBufC8::NewLC( bufSize );
+ TPtr8 calArrayPtr = calArray->Des();
+
+ calArrayPtr.Append((TUint8*)(&count), 2);
+ TInt pos = 0;
+ calListBuf->ExpandL(pos, 2);
+ calListBuf->Write(pos, *calArray, 2);
+ calArrayPtr.Zero();
+ pos += 2;
+
+ for(int i = 0; i < count; ++i)
+ {
+ TInt len = calFiles->MdcaPoint(i).Length();
+ calArrayPtr.Append((TUint8*)(&len), 2);
+ calArrayPtr.Append(calFiles->MdcaPoint(i));
+ calListBuf->ExpandL(pos, calArray->Length());
+ calListBuf->Write(pos,*calArray, calArray->Length());
+ pos += calArray->Length();
+ calArrayPtr.Zero();
+ }
+ SendOkMsgL( calListBuf->Ptr( 0 ) );
+ CleanupStack::PopAndDestroy(4); //calArray, calListBuf, calFiles, calSession;
+ HTI_LOG_FUNC_OUT( "CPIMHandler::HandleListCalendarFiles: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleVCardImportFuncL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::HandleVCardImportFuncL" );
+ if ( aData.Length() == 0 )
+ {
+ SendErrorMessageL( KErrArgument, KErrorMissingVCard );
+ return;
+ }
+
+ CContactDatabase* contactDatabase = CContactDatabase::OpenL();
+ HTI_LOG_TEXT( "CPIMHandler: Contact database open" );
+ CleanupStack::PushL(contactDatabase);
+
+ CBufFlat* buffer = CBufFlat::NewL(aData.Length());
+ CleanupStack::PushL(buffer);
+ buffer->ExpandL(0, aData.Length());
+ buffer->Ptr(0).Copy(aData.Right(aData.Length()));
+ RBufReadStream readStream;
+ readStream.Open(*buffer, 0);
+ CleanupClosePushL<RBufReadStream>( readStream );
+
+ // Imports vCard
+ TBool success = EFalse;
+ TUid format = TUid::Uid(KUidVCardConvDefaultImpl);
+ CArrayPtr<CContactItem>* contacts = NULL;
+ TRAPD(err,contacts = contactDatabase->ImportContactsL(format, readStream, success,
+ CContactDatabase::EImportSingleContact | CContactDatabase::ETTFormat));
+ CleanupStack::PushL(contacts);
+ if(err != KErrNone || success == EFalse || contacts == NULL || contacts->Count() == 0)
+ {
+ HTI_LOG_TEXT("Failed to import vCard");
+ SendErrorMessageL( err, KErrorVCardImportFailed );
+ }
+ else
+ {
+ // Returns the imported contact id
+ TInt32 entryId = contacts->At(0)->Id();
+ TBuf8<4> idBuf;
+ idBuf.Append( ( TUint8* ) &entryId, 4 );
+ HTI_LOG_TEXT("vCard imported");
+ SendOkMsgL( idBuf );
+ }
+
+ contacts->ResetAndDestroy();
+
+ CleanupStack::PopAndDestroy(4); // contacts, readStream, buffer, contactDatabase
+ HTI_LOG_FUNC_OUT( "CPIMHandler::HandleVCardImportFuncL: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleVCalendarImportFuncL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::HandleVCalendarImportFuncL" );
+
+ if ( aData.Length() == 0 )
+ {
+ HTI_LOG_TEXT( "CPIMHandler::HandleVCalendarImportFuncL: Error: length of data is zero" )
+ SendErrorMessageL( KErrArgument, KErrorMissingVCalendar );
+ return;
+ }
+
+ CBufFlat* buffer = CBufFlat::NewL( aData.Length() );
+ CleanupStack::PushL(buffer);
+ buffer->ExpandL( 0, aData.Length() );
+ buffer->Ptr( 0 ).Copy( aData );
+ RBufReadStream readStream;
+ readStream.Open( *buffer, 0 );
+ CleanupClosePushL( readStream );
+
+ if(iCalSession == NULL)
+ {
+ HTI_LOG_TEXT( "CPIMHandler: Open default calendar file" );
+ iCalSession = CCalSession::NewL();
+ iCalSession->OpenL( KDefaultAgendaFile );
+ HTI_LOG_TEXT( "CPIMHandler: Calendar session open" );
+ }
+
+ CCalDataExchange* importer = CCalDataExchange::NewL(*iCalSession);
+ CleanupStack::PushL( importer );
+ HTI_LOG_TEXT( "CPIMHandler: Calendar importer created" );
+
+ RPointerArray<CCalEntry> entryArray;
+ CleanupClosePushL( entryArray );
+
+ TInt err = KErrNone;
+ TInt size = 0;
+ // Import as VCalendar
+ TRAP( err, importer->ImportL( KUidVCalendar, readStream, entryArray ) );
+ HTI_LOG_FORMAT( "ImportL return value %d", err );
+ size = entryArray.Count();
+ HTI_LOG_FORMAT( "Import VCalendarL imported %d entries", size );
+ TCalLocalUid uniqueId = 0;
+ TInt success = 0;
+ if ( size > 0 )
+ {
+ CCalEntryView* entryView = CCalEntryView::NewL( *iCalSession, *this );
+ iWaiter->Start();
+ CleanupStack::PushL(entryView);
+ if ( iEntryViewErr == KErrNone )
+ {
+ TRAP( err, entryView->StoreL( entryArray, success ) );
+ HTI_LOG_FORMAT( "StoreL return value %d", err );
+ HTI_LOG_FORMAT( "Successfully stored %d entries", success );
+ uniqueId = entryArray[0]->LocalUidL();
+ }
+ CleanupStack::PopAndDestroy();
+ }
+ entryArray.ResetAndDestroy();
+ CleanupStack::PopAndDestroy(); // entryArray
+
+ if ( err == KErrNone && success > 0 )
+ {
+ HTI_LOG_TEXT("vCalendar imported");
+ TBuf8<8> uniqueIdStr;
+ uniqueIdStr.Copy( ( TUint8* ) ( &uniqueId ), sizeof( uniqueId ) );
+ SendOkMsgL( uniqueIdStr );
+ }
+ else
+ {
+ HTI_LOG_TEXT("Failed to import vCalendar");
+ if ( err == KErrNone )
+ {
+ err = KErrGeneral;
+ }
+ SendErrorMessageL( err, KErrorVCalendarImportFailed );
+ }
+
+ CleanupStack::PopAndDestroy( 3 ); // buffer, readStream, importer
+ HTI_LOG_FUNC_OUT( "CPIMHandler::HandleVCalendarImportFuncL: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleContactDeleteFuncL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::HandleContactDeleteFuncL" );
+ TInt dataLength = aData.Length();
+ if ( dataLength != 0 && dataLength != 4 )
+ {
+ HTI_LOG_TEXT( "CPIMHandler: Error: wrong length of data" )
+ SendErrorMessageL( KErrArgument, KErrorInvalidId );
+ return;
+ }
+ CContactDatabase* contactDatabase = CContactDatabase::OpenL();
+ HTI_LOG_TEXT( "CPIMHandler: Contact database open" );
+ CleanupStack::PushL(contactDatabase);
+
+ if(dataLength == 0) // delete all contacts
+ {
+ //const CContactIdArray* array = iContactDatabase->SortedItemsL();
+ CCntFilter *filter = CCntFilter::NewLC();
+ filter->SetContactFilterTypeCard(ETrue);
+ filter->SetContactFilterTypeGroup(EFalse);
+ contactDatabase->FilterDatabaseL(*filter);
+ TRAPD(err, contactDatabase->DeleteContactsL(*filter->iIds));
+ CleanupStack::PopAndDestroy();
+ if(err == KErrNone)
+ {
+ HTI_LOG_TEXT("All contacts deleted");
+ SendOkMsgL( KNullDesC8 );
+ }
+ else
+ {
+ HTI_LOG_TEXT("Failed to delete all contacts");
+ SendErrorMessageL( err, KErrorFailedDeleteAll );
+ }
+ }
+ else // delete one contact by id
+ {
+ TUint id = aData[0] + ( aData[1] << 8 )
+ + ( aData[2] << 16 )
+ + ( aData[3] << 24 );
+ TRAPD(err, contactDatabase->DeleteContactL(id));
+
+ if(err == KErrNone)
+ {
+ HTI_LOG_TEXT("Contact deleted");
+ SendOkMsgL( KNullDesC8 );
+ }
+ else
+ {
+ HTI_LOG_TEXT("Failed to delete contact");
+ SendErrorMessageL( err, KErrorFailedDelete );
+ }
+ }
+
+ CleanupStack::PopAndDestroy();
+ HTI_LOG_FUNC_OUT( "CPIMHandler::HandleContactDeleteFuncL" );
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleCalendarDeleteFuncL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::HandleVCalendarDeleteFuncL" );
+
+ TInt dataLength = aData.Length();
+ if ( dataLength != 0 && dataLength != 4 )
+ {
+ HTI_LOG_TEXT( "CPIMHandler: Error: wrong length of data" )
+ SendErrorMessageL( KErrArgument, KErrorInvalidId );
+ return;
+ }
+
+
+ if(iCalSession == NULL)
+ {
+ HTI_LOG_TEXT( "CPIMHandler: Open default calendar file" );
+ iCalSession = CCalSession::NewL();
+ iCalSession->OpenL( KDefaultAgendaFile );
+ HTI_LOG_TEXT( "CPIMHandler: Calendar session open" );
+ }
+
+ HTI_LOG_TEXT( "CPIMHandler: Creating entry view" );
+ CCalEntryView* entryView = CCalEntryView::NewL( *iCalSession, *this );
+ iWaiter->Start();
+ CleanupStack::PushL(entryView);
+ if ( iEntryViewErr != KErrNone )
+ {
+ User::Leave( iEntryViewErr );
+ }
+
+ // If dataLength is 0, no ID given, delete all calendar entries
+ if ( dataLength == 0 )
+ {
+ HTI_LOG_TEXT( "CPIMHandler: Deleting all calendar entries" );
+ TCalTime minTime;
+ TCalTime maxTime;
+ minTime.SetTimeUtcL( TCalTime::MinTime() );
+ maxTime.SetTimeUtcL( TCalTime::MaxTime() );
+ CalCommon::TCalTimeRange timeRange( minTime, maxTime );
+ TRAPD( err, entryView->DeleteL( timeRange,
+ CalCommon::EIncludeAll, *this ) );
+ iWaiter->Start();
+ if ( err == KErrNone && iEntryViewErr == KErrNone )
+ {
+ HTI_LOG_TEXT("All calendar entries deleted");
+ SendOkMsgL( KNullDesC8 );
+ }
+ else
+ {
+ HTI_LOG_TEXT("Failed to delete all calendar entries");
+ SendErrorMessageL( KErrGeneral, KErrorFailedDeleteAll );
+ }
+ }
+
+ // If id given, delete only calendar entry having that id
+ else
+ {
+ TCalLocalUid id = aData[0] + ( aData[1] << 8 )
+ + ( aData[2] << 16 )
+ + ( aData[3] << 24 );
+ HTI_LOG_FORMAT( "CPIMHandler: Deleting one calendar entry %d", id );
+ CCalEntry* entryToDelete = NULL;
+ TRAPD( err, entryToDelete = entryView->FetchL( id ) );
+
+ if ( err || entryToDelete == NULL )
+ {
+ HTI_LOG_TEXT( "CPIMHandler: Calendar entry not found" );
+ SendErrorMessageL( KErrNotFound, KErrorItemNotFound );
+ }
+ else
+ {
+ CleanupStack::PushL( entryToDelete );
+ TRAP( err, entryView->DeleteL( *entryToDelete ) );
+ if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT("calendar entrie deleted");
+ SendOkMsgL( KNullDesC8 );
+ }
+ else
+ {
+ HTI_LOG_TEXT( "Failed to delete calendar entry" )
+ SendErrorMessageL( KErrGeneral, KErrorFailedDelete );
+ }
+ CleanupStack::PopAndDestroy( entryToDelete );
+ }
+ }
+ CleanupStack::PopAndDestroy(); //entryView;
+ HTI_LOG_FUNC_OUT( "CPIMHandler::HandleVCalendarDeleteFuncL" );
+ }
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+TInt CallNpdHlp( const TDesC& aCmd )
+ {
+ HTI_LOG_FUNC_IN( "CallNpdHlp" );
+
+ RProcess HtiNpdHlp;
+ TInt err = HtiNpdHlp.Create( KHtiNpdHlpExe, aCmd );
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "Could not create HtiNpdHlp.Exe process %d", err );
+ return err;
+ }
+
+ TRequestStatus status;
+ HtiNpdHlp.Logon( status );
+ HtiNpdHlp.Resume();
+ User::WaitForRequest( status );
+ if ( status.Int() != KErrNone )
+ {
+ HTI_LOG_FORMAT( "status %d", status.Int() );
+ HTI_LOG_FORMAT( "ExitReason %d", HtiNpdHlp.ExitReason() );
+ HTI_LOG_FORMAT( "ExitType %d", HtiNpdHlp.ExitType() );
+ HtiNpdHlp.Close();
+ return status.Int();
+ }
+
+ HtiNpdHlp.Close();
+
+ HTI_LOG_FUNC_OUT( "CallNpdHlp" );
+ return KErrNone;
+ }
+#endif
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleNotepadAddMemoFuncL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::HandleNotepadAddMemoFuncL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ if ( aData.Length() < 1 )
+ {
+ SendErrorMessageL( KErrArgument, KErrorMissingText );
+ return;
+ }
+
+ // convert text from TDesC8 -> TDesC
+ // expecting the input TDesC8 contains UTF-8 data
+ HBufC* text = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aData );
+ HTI_LOG_TEXT( "CPIMHandler: Conversion to Unicode done" );
+ CleanupStack::PushL( text );
+
+ HBufC* cmd = HBufC::NewLC( KCmdAddMemo().Length() + 1 + ( *text ).Length() );
+ cmd->Des().Copy( KCmdAddMemo );
+ cmd->Des().Append( KCmdDelim );
+ cmd->Des().Append( *text );
+
+ TInt err = CallNpdHlp( *cmd );
+ if ( err )
+ {
+ SendErrorMessageL( err, KErrorNotepadAddMemoFailed );
+ }
+ else
+ {
+ SendNotepadOkMsgL( CHtiPIMServicePlugin::ENotepadAddMemo );
+ }
+
+ CleanupStack::PopAndDestroy( 2 ); // text, cmd
+#else
+ SendErrorMessageL(KErrNotSupported, KErrorNotepadNotSupported);
+#endif
+ HTI_LOG_FUNC_OUT( "CPIMHandler::HandleNotepadAddMemoFuncL" );
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleNotepadAddMemoFromFileFuncL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::HandleNotepadAddMemoFromFileFuncL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ if ( aData.Length() < 1 )
+ {
+ SendErrorMessageL( KErrArgument, KErrorMissingFilepath );
+ return;
+ }
+
+ // convert filename from TDesC8 -> TDesC
+ // expecting the input TDesC8 contains UTF-8 data
+ HBufC* filename = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aData );
+ HTI_LOG_TEXT( "CPIMHandler: Conversion to Unicode done" );
+ CleanupStack::PushL( filename );
+
+ HBufC* cmd = HBufC::NewLC( KCmdAddMemoFromFile().Length() + 1 + ( *filename ).Length() );
+ cmd->Des().Copy( KCmdAddMemoFromFile );
+ cmd->Des().Append( KCmdDelim );
+ cmd->Des().Append( *filename );
+
+ TInt err = CallNpdHlp( *cmd );
+ if ( err )
+ {
+ SendErrorMessageL( err, KErrorNotepadAddMemoFromFileFailed );
+ }
+ else
+ {
+ SendNotepadOkMsgL( CHtiPIMServicePlugin::ENotepadAddMemoFromFile );
+ }
+
+ CleanupStack::PopAndDestroy( 2 ); // filename, cmd
+#else
+ SendErrorMessageL(KErrNotSupported, KErrorNotepadNotSupported);
+#endif
+ HTI_LOG_FUNC_OUT( "CPIMHandler::HandleNotepadAddMemoFromFileFuncL" );
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleNotepadDeleteAllFuncL()
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::HandleNotepadDeleteAllFuncL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ TInt err = CallNpdHlp( KCmdDeleteAll() );
+ if ( err )
+ {
+ SendErrorMessageL( err, KErrorNotepadDeleteAllFailed );
+ }
+ else
+ {
+ SendNotepadOkMsgL( CHtiPIMServicePlugin::ENotepadDeleteAll );
+ }
+#else
+ SendErrorMessageL(KErrNotSupported, KErrorNotepadNotSupported);
+#endif
+ HTI_LOG_FUNC_OUT( "CPIMHandler::HandleNotepadDeleteAllFuncL" );
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::SendNotepadOkMsgL( CHtiPIMServicePlugin::TCommand aCommand )
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::SendNotepadOkMsgL" );
+ TBuf8<1> msg;
+ msg.Append( aCommand );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+ msg.AllocL(), KPIMServiceUid ) );
+ iIsBusy = EFalse;
+ HTI_LOG_FUNC_OUT( "CPIMHandler::SendNotepadOkMsgL" );
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::SendOkMsgL( const TDesC8& aData )
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::SendOkMsgL: Starting" );
+
+ User::LeaveIfNull( iDispatcher );
+
+ HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+ TPtr8 response = temp->Des();
+ response.Append( ( TChar ) CHtiPIMServicePlugin::EResultOk );
+ response.Append( aData );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+ temp, KPIMServiceUid ) );
+ iIsBusy = EFalse;
+ HTI_LOG_FUNC_OUT( "CPIMHandler::SendOkMsgL: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::SendErrorMessageL: Starting" );
+ User::LeaveIfNull( iDispatcher );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+ aError, aDescription, KPIMServiceUid ) );
+ iIsBusy = EFalse;
+ HTI_LOG_FUNC_OUT( "CPIMHandler::SendErrorMessageL: Done" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPIMHandler::Progress
+// Called during calendar entry view creation and operations.
+// Called only if NotifyProgress returns ETrue.
+// From MCalProgressCallBack
+// ----------------------------------------------------------------------------
+void CPIMHandler::Progress( TInt /*aProgress*/ )
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CPIMHandler::Completed
+// Called on completion of calendar entry view creation and operations
+// From MCalProgressCallBack
+// ----------------------------------------------------------------------------
+void CPIMHandler::Completed( TInt aError )
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::Completed" );
+ HTI_LOG_FORMAT( "Completed with error code %d", aError );
+ iEntryViewErr = aError;
+ iWaiter->AsyncStop();
+ HTI_LOG_FUNC_OUT( "CPIMHandler::Completed" );
+ }
+
+// ----------------------------------------------------------------------------
+// CPIMHandler::NotifyProgress
+// Returns whether or not progress notification is required
+// From MCalProgressCallBack
+// ----------------------------------------------------------------------------
+TBool CPIMHandler::NotifyProgress()
+ {
+ HTI_LOG_FUNC_IN( "CPIMHandler::NotifyProgress" );
+ HTI_LOG_FUNC_OUT( "CPIMHandler::NotifyProgress" );
+ return EFalse; // Don't notify about progress
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/proxy.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation proxy for PIM service plugin dll
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiPIMServicePlugin.h"
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY( 0x200212C4, CHtiPIMServicePlugin::NewL )
+ };
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+ {
+ aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+ return ImplementationTable;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/data/1020DEC2.rss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource definitions for screenshot service ECOM plugin.
+*
+*/
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+
+// RESOURCE DEFINITIONS
+RESOURCE REGISTRY_INFO theInfo
+ {
+ // UID for the DLL
+ dll_uid = 0x1020DEC2;
+ // Declare array of interface info
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // UID of interface that is implemented
+ interface_uid = 0x1020DEB7;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x1020DEC3;
+ version_no = 1;
+ display_name = "Screenshot service";
+ default_data = "SCREEN";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/group/HtiScreenshotServicePlugin.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HTI service plugin for taking screenshot.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../../../symbian_version.hrh"
+
+TARGET HtiScreenshotServicePlugin.dll
+TARGETTYPE PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x1020DEC2
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
+
+SOURCEPATH ../src
+SOURCE proxy.cpp
+SOURCE HtiScreenshotServicePlugin.cpp
+SOURCE HtiTextRcg.cpp
+
+USERINCLUDE ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE ../data/1020DEC2.rss
+TARGET HtiScreenshotServicePlugin.rsc
+END
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+LIBRARY alfclient.lib
+#endif
+LIBRARY avkon.lib
+LIBRARY bitgdi.lib
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY egul.lib
+LIBRARY euser.lib
+LIBRARY ezlib.lib
+LIBRARY fbscli.lib
+LIBRARY gdi.lib
+LIBRARY hal.lib
+LIBRARY imageconversion.lib
+LIBRARY ws32.lib
+LIBRARY flogger.lib
+LIBRARY apgrfx.lib
+
+SMPSAFE
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for HtiScreenshotServicePlugin
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiScreenshotServicePlugin.mmp
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/inc/HtiScreenshotServicePlugin.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,265 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of ECOM plug-in service interface. Provides
+* screenshot service.
+*
+*/
+
+
+#ifndef SCREENSHOOTPLUGIN_H
+#define SCREENSHOOTPLUGIN_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include <w32std.h>
+#include <f32file.h>
+#include "HtiTextRcg.h"
+
+
+// FORWARD DECLARATIONS
+class CImageEncoder;
+
+
+// CLASS DECLARATIONS
+class MICLObserver
+ {
+public:
+ virtual void ICLComplete( TInt anError) = 0;
+ };
+
+class CICLHandler : public CActive
+ {
+public:
+ CICLHandler(CImageEncoder* aService, MICLObserver* anObserver);
+ ~CICLHandler();
+
+ void Start();
+
+protected: //from CActive
+ void RunL();
+ void DoCancel();
+ //TInt RunError(TInt aError);
+
+protected:
+ MICLObserver* iObserver;
+ CImageEncoder* iService;
+ };
+
+
+
+
+
+class MSeriesShotTimerObserver
+ {
+public:
+ virtual void TimerExpired( TInt aId ) = 0;
+ };
+
+
+
+class CSeriesShotTimer : public CTimer
+ {
+public:
+ static CSeriesShotTimer* NewL(MSeriesShotTimerObserver* aObserver,
+ TInt aId,
+ TTimeIntervalMicroSeconds32 aTime);
+ ~CSeriesShotTimer();
+ void Start();
+
+protected:
+ void ConstructL();
+ CSeriesShotTimer(MSeriesShotTimerObserver* aObserver,
+ TInt aId,
+ TTimeIntervalMicroSeconds32 aTime);
+public: // from CTimer
+ void RunL();
+
+private:
+ MSeriesShotTimerObserver* iObserver;
+ TInt iId;
+ TTimeIntervalMicroSeconds32 iTime;
+ };
+
+
+class MSeriesShotObserver
+ {
+public:
+ virtual void SeriesShotCompletedL( HBufC8* aMsg ) = 0;
+ virtual TBool StartShotL(TRect aRegion, TDisplayMode aDisplayMode, TDesC8 &aMimeType) = 0;
+ };
+
+
+class CHtiScreenshotServicePlugin; // forward declaration
+
+class CSeriesShot : public CBase,
+ public MSeriesShotTimerObserver
+ {
+ enum TTimerType
+ {
+ EDuration,
+ EInterval
+ };
+public:
+ static CSeriesShot* NewL( MSeriesShotObserver* aServicePluginObserver );
+ CSeriesShot( MSeriesShotObserver* aServicePluginObserver );
+ virtual ~CSeriesShot();
+
+ void StartL( TTimeIntervalMicroSeconds32 aDuration,
+ TTimeIntervalMicroSeconds32 aInterval,
+ TDisplayMode aDisplayMode,
+ TRect aRegion,
+ TPtrC8 aMime);
+ TBool IsOngoing();
+ void SaveImage( TDesC8* aImage, TBool isCompressed );
+ void TriggerNewShot();
+ void Cancel();
+ void EncodeCompleted();
+ HBufC8* ConstructCompletedMessageL();
+
+protected:
+ void ConstructL();
+ void ClearShots();
+ void GetMIMEExtension(TDesC8 &aMime, TDes &aExt);
+
+public: // from MSeriesShotTimerObserver
+ void TimerExpired(TInt aId);
+
+private:
+ MSeriesShotObserver* iServicePluginObserver;
+ CSeriesShotTimer* iDurationTimer;
+ CSeriesShotTimer* iIntervalTimer;
+ TDisplayMode iDisplayMode;
+ TInt iIndex;
+ RFs iFs;
+ TBool isEncoding;
+ TBuf8<30> iMimeType;
+ TBuf<10> iExtension;
+ TRect iRegion;
+ };
+
+
+
+class CHtiScreenshotServicePlugin : public CHTIServicePluginInterface,
+ public MICLObserver,
+ public MSeriesShotObserver
+ {
+public:
+
+ static CHtiScreenshotServicePlugin* NewL();
+
+ // Interface implementation
+ TBool IsBusy();
+ void ProcessMessageL(const TDesC8& aMessage, THtiMessagePriority aPriority);
+ void NotifyMemoryChange( TInt aAvailableMemory );
+
+ // Observer implementation
+ void ICLComplete( TInt anError); // from MICLObserver
+ void SeriesShotCompletedL( HBufC8* aMsg ); // from MSeriesShotObserver
+ TBool StartShotL(TRect aRegion, TDisplayMode aDisplayMode, TDesC8 &aMimeType); // from MSeriesShotObserver
+
+protected:
+
+ void ProcessTextRcgMessageL(const TDesC8& aMessage);
+ void ProcessTextBitmapMessageL(const TDesC8& aMessage);
+
+ void SendTextRecgReplyL(const TBool aResult, const TRect& aLocation,
+ const TInt aFontIndex);
+
+
+ /**
+ * Selects fonts based on predefined platform-dependent strategy
+ *
+ */
+ TBool RecognizeTextL(const TDesC& aText,
+ TRect& aResult,
+ TInt& aFontIndex);
+
+ /**
+ * Extracts string from incoming request and convert it to unicode
+ * for non-unicode request
+ * aResult should have enough length
+ * Function returns either offset for a next parameter in aRequest
+ * or some symbian error code
+ */
+ TInt ParseString( const TDesC8& aRequest,
+ TInt anOffset,
+ TBool aUnicode,
+ TDes& aResult);
+
+ void CopyUnicode( TDes & aTo, const TDesC8& aFrom );
+
+ /**
+ * Extract from request font description (font name, height, style)
+ */
+ TInt ParseFontSpec( const TDesC8& aRequest,
+ TInt anOffset,
+ TBool aUnicode,
+ TFontSpec& aResult);
+
+ CWsScreenDevice* GetScreenDeviceL();
+
+ void CreateBitmapL( TRect& aRegion, TDisplayMode aMode = ENone);
+
+ void SelectEncoder( const TUid aEncoderUid );
+
+ //encode iScreen
+ void EncodeBitmapL(const TDesC8& aImageTypeMIME = KNullDesC8);
+
+ inline TInt ParseInt16( const TUint8* aStart );
+ inline TInt ParseInt32( const TUint8* aStart );
+
+ /**
+ * Compress content of iEncodedBitmap descriptor
+ */
+ TInt Compress();
+
+ CHtiScreenshotServicePlugin();
+ void ConstructL();
+
+ virtual ~CHtiScreenshotServicePlugin();
+
+ //void InitFontCache();
+
+ TBool IsMIMETypeSupported(TDesC8 &aMime);
+
+ void SetScreenNumber(TInt aScreenNumber);
+
+ void HandleRotateScreen(const TDesC8& aData);
+protected:
+ CFbsBitmap* iScreen; //raw screen bitmap
+ HBufC8* iEncodedBitmap; //ready to send
+
+ RWsSession iWs;
+ CWsScreenDevice* iScreenDevice;
+
+ CImageEncoder* iBitmapEncoder;
+ CICLHandler* iICLHandler;
+
+ TBool iCompress;
+
+ //text recognition algorithms
+ CHtiTextRcg iTextRcg;
+ //fonts to use for recognition
+ RArray<TFontSpec> iFontCache;
+
+ // Series shot implementation
+ CSeriesShot* iSeriesShot;
+
+ // Members for deltacapture
+ TBool iDeltaCapture;
+ CFbsBitmap* iPreviousBitmap;
+ TRect iDeltaRect;
+ };
+
+#endif // SCREENSHOOTPLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/inc/HtiTextRcg.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Text recognition algorithm implementation.
+*
+*/
+
+
+#ifndef __HTI_TEXT_RCG_
+#define __HTI_TEXT_RCG_
+
+#include <fbs.h>
+#include <gulfont.h>
+#include <e32math.h>
+
+const TInt KDefaultAvgDiffMin = 50;
+const TInt KDefaultFgSSMin = 50;
+const TInt KDefaultFgAvgDiffMin = 5; //in "pure" (not AA) pixels
+const TInt KWorstCase = 0xFF;
+const TInt KSuccessThresold = 50;
+const TInt KNormCoefAcc = 2;
+
+const TInt KDefaultFGAAmount = 5;
+const TInt KDefaultBGAAmount = 10;
+
+const TInt KFgPatternColor = 0x00; //black
+const TInt KBgPatternColor = 0xff; //white
+
+TInt CompareTPoint(const TPoint& aP1,const TPoint& aP2);
+
+enum THtiTextRecgHints
+ {
+ EHintNone = 0,
+ EHintEdge = 1
+ };
+
+/**
+* The class implements text recognition algorithm on screenshots
+* based on system fonts
+*
+*/
+class CHtiTextRcg : public CBase
+{
+public:
+ CHtiTextRcg();
+ virtual ~CHtiTextRcg();
+
+ void SetHint(TInt aHint);
+
+ TBool RecognizeTextL(CFbsBitmap* aScreenshot,
+ const TDesC& aText,
+ const CFont* aFont,
+ TRect& aResult);
+
+ /**
+ * aResult will contain the coordinates of the found text
+ * Return 0 if match is perfect, 255 if text was not found
+ * return value from 0 to 255 means some error, the lower it is the better match
+ *
+ */
+ //brute force optim
+ TInt RecognizeAAL(CFbsBitmap* aScreenshot,const TDesC& aText, const CFont* aFont, TRect& aResult);
+ //brute force clean optim
+ TInt RecognizeBinL(CFbsBitmap* aScreenshot,const TDesC& aText, const CFont* aFont, TRect& aResult);
+
+ //static image processing routines
+ //convert image to 256-greyscale
+ static CFbsBitmap* ColorDownL(CFbsBitmap * aBitmap);
+ //generates bitmap of the text using the font given
+
+ static CFbsBitmap* GetTextBitmapL( const TDesC& aText,
+ const CFont* fontUsed,
+ const TInt aLength = KMaxTInt );
+
+ static CFbsBitmap* GetTextBitmapL( const TDesC& aText,
+ const CFont* fontUsed,
+ TRgb aForeground,
+ TRgb aBackground,
+ TDisplayMode aDisplayMode,
+ const TInt aLength = KMaxTInt );
+
+ //calculates min max of a greyscale bitmap in question
+ static void MinMax(CFbsBitmap * aBitmap, TInt& aMin, TInt& aMax);
+
+ /**
+ * use FGA and BGA to speed-up comparation
+ * this function only returns 255 or 0
+ * Analyses only min and max colors
+ */
+ TInt ImageDiffBinSampleL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+ CFbsBitmap * aBitmap2);
+
+ /**
+ * Iterations like in Diff5 but metrics from Diff6
+ * Used for full word checking if Diff6 is 0 for a letter
+ * this function only returns 255 or 0
+ */
+ TInt ImageDiffBinFullL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+ CFbsBitmap * aBitmap2);
+
+ /**
+ * use FGA and BGA to speed-up comparation and AA pixels
+ */
+ TInt ImageDiffAASampleL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+ CFbsBitmap * aBitmap2);
+
+ /**
+ * Iterations like in Diff5 but metrics from Diff6/DiffAASample
+ * Used for full word checking if Diff6 is 0 for a letter
+ */
+ TInt ImageDiffAAFullL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+ CFbsBitmap * aBitmap2);
+
+ /*
+ * Analyze pattern and fills in FGA and BGA sets
+ * Return ETrue if pattern is valid (non empty)
+ */
+ TBool AnalyzePatternL(CFbsBitmap * aPattern);
+
+private:
+ //algorithm parameters
+ //minimal abs avarage difference beetwen foreground and background
+ TInt iAvgDiffMin;
+ //minimal SS for foreground, with plain color should be 0
+ TInt iFgSSMin;
+ /**
+ * minimal avg diff for foreground, used in Diff3
+ */
+ TInt iFgAvgDiffMin;
+
+ //TInt64 iSeed;
+
+ //following vars set by AnalyzePatternL
+ TInt iFGAAmount;
+ TInt iBGAAmount;
+ //foreground assesment point set
+ RArray<TPoint> iFGASet;
+ //background assesment point set
+ RArray<TPoint> iBGASet;
+
+ //font color in reference image
+ TInt iMaskFgColor;//
+ //background color in reference image
+ TInt iMaskBgColor;//
+
+ //used for AA algorithm
+ //set in Sample function and used in Full function
+ //for optimization
+ TInt iTestFgColor;
+ TInt iTestBgColor;
+
+ // normalization coeff to compare test image with mask directly
+ // |iMaskFgColor-iMaskBgColor|*NormCoefAcc)/|iTestFgColor-iTestBgColor|
+ // where NormCoefAcc multiplyer is used to increase accuracy (all ints)
+ // and is implemented as shif by KNormCoefAcc bits
+ // back shift is performed after color is multiplied by iTestNormCoef
+ TInt iTestNormCoef;
+
+ /**
+ * Current recognition method
+ * Changed by SetHint
+ */
+ TInt iCurrentStrategy;
+};
+
+#endif //__HTI_TEXT_RCG_
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/HtiScreenshotServicePlugin.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,2559 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SysInfoPlugin implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "../../../symbian_version.hrh"
+
+
+#include "HtiScreenshotServicePlugin.h"
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+#include <imageconversion.h>
+#include <ezcompressor.h>
+#include <hal.h>
+
+#include <AknLayoutConfig.h>
+#include <apgtask.h>
+#include <AknCapServerDefs.h>
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+#include <alf/alfdrawer.h>
+#endif
+
+// CONSTANTS
+const static TUid KScreenshotServiceUid = {0x1020DEC3};
+
+enum TScreenCommands
+ {
+ // Normal screencapture
+ ECmdScreen = 0x01,
+ ECmdScreenRegion = 0x02,
+ ECmdScreenZip = 0x03,
+ ECmdScreenRegionZip = 0x04,
+
+ // Text recognition
+ ECmdTextRcg = 0x10,
+ ECmdTextRcg_u = 0x11,
+
+ // Text bitmap
+ ECmdTextBitmap = 0x12,
+ ECmdTextBitmap_u = 0x13,
+
+ // Screencapture in series
+ ECmdScreenSeries = 0x21,
+ ECmdScreenRegionSeries = 0x22,
+ ECmdScreenZipSeries = 0x23,
+ ECmdScreenRegionZipSeries = 0x24,
+
+ // Selects the screen to use
+ ECmdSelectScreen = 0x30,
+
+ // Gets the current screen size and orientation
+ ECmdScreenMode = 0x3A,
+
+ // Rotates the screen to portrait or landscape
+ ECmdRotateScreen = 0x3B,
+
+ // Screencapture on updated part of screen only
+ ECmdDeltaCaptureMask = 0x80,
+ ECmdDeltaScreen = 0x81,
+ ECmdDeltaScreenRegion = 0x82,
+ ECmdDeltaScreenZip = 0x83,
+ ECmdDeltaScreenRegionZip = 0x84,
+ ECmdDeltaScreenReset = 0x85
+ //ECmdDeltaScreenSeries = 0xA1,
+ //ECmdDeltaScreenRegionSeries = 0xA2,
+ //ECmdDeltaScreenZipSeries = 0xA3,
+ //ECmdDeltaScreenRegionZipSeries = 0xA4
+ };
+
+enum TScreenResponse
+ {
+ ERspOk = 0xF0,
+ ERspNotFound = 0xF1
+ };
+
+enum THtiFontAttributes
+ {
+ EHtiFontAttBold = 0x01,
+ EHtiFontAttItalic = 0x02,
+ EHtiFontAttNotAA = 0x04,
+ EHtiFontAttPrintPositionFlag = 0x08,
+ EHtiFontAttPrintPositionValue = 0x10
+ };
+
+const static TInt KHtiFontAttSuperscriptValue = 0;
+const static TInt KHtiFontAttSubscriptValue = 1;
+
+//1 byte for cmd and 2*4 for 4 coordinates
+const static TInt KMinScreenRegionCmdLength = 9;
+const static TInt KScreenDisplayOffset = 1;
+const static TInt KScreenMIMEOffset = KScreenDisplayOffset + 1;
+const static TInt KScreenScreenNumber = KScreenMIMEOffset + 8;
+const static TInt KRegionDisplayOffset = KMinScreenRegionCmdLength;
+const static TInt KRegionMIMEOffset = KRegionDisplayOffset + 1;
+const static TInt KRegionScreenNumber = KRegionMIMEOffset + 8;
+
+const static TInt KSeriesDurationOffset = 1;
+const static TInt KSeriesIntervalOffset = KSeriesDurationOffset + 4;
+const static TInt KSeriesDisplayOffset = KSeriesIntervalOffset + 4;
+const static TInt KSeriesMIMEOffset = KSeriesDisplayOffset + 1;
+const static TInt KSeriesScreenNumber = KSeriesMIMEOffset + 8;
+const static TInt KMinSeriesCmdLength = KSeriesMIMEOffset;
+
+const static TInt KRegionSeriesTlX = KSeriesDisplayOffset + 1;
+const static TInt KRegionSeriesTlY = KRegionSeriesTlX + 2;
+const static TInt KRegionSeriesBlX = KRegionSeriesTlY + 2;
+const static TInt KRegionSeriesBlY = KRegionSeriesBlX + 2;
+const static TInt KRegionSeriesMIMEOffset = KRegionSeriesBlY + 2;
+const static TInt KRegionSeriesScreenNumber = KRegionSeriesMIMEOffset + 8;
+const static TInt KMinRegionSeriesCmdLength = KRegionSeriesMIMEOffset;
+
+const static TInt KDeltaResetCmdLength = 1;
+const static TInt KScreenModeCmdLength = 1;
+
+const static TInt KScreenNrOffset = 1;
+const static TInt KSelectScreenCmdLength = 2;
+const static TInt KRotateScreenCmdLength = 2;
+
+_LIT( KSeriesShotPath, "c:\\Hti\\SeriesShot\\" );
+
+//errors' descriptions
+_LIT8( KErrDescrInvalid, "invalid arguments" );
+_LIT8( KErrDescrInvalidMode, "invalid color mode" );
+_LIT8( KErrDescrRegiontEmpty, "region is empty" );
+_LIT8( KErrDescrRegionNotNormailized, "region is not normalized" );
+_LIT8( KErrDescrRegionOutOfScreen, "region is out of screen" );
+_LIT8( KErrDescrUnknownCommand, "unknown command" );
+_LIT8( KErrDescrFailedConvert, "failed to convert to image format" );
+_LIT8( KErrDescrFailedCompress, "failed to compress" );
+_LIT8( KErrDescrMIMENotSupported, "MIME type not supported" );
+_LIT8( KErrDescrScreenNotSupported, "screen not supported" );
+
+_LIT( KScreenshotPanic, "Screenshot plug-in invalid state" );
+
+//_LIT(KS60Sans, "Series 60 Sans");
+//_LIT(KS60SansTitleBold, "Series 60 Sans TitleSmBd");
+
+//const TInt KFonHeighMin = 110;
+//const TInt KFonHeighMax = 190;
+/*
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::InitFontCache()
+ {
+ //temporary
+ //just put harcoded data
+ //should be either external file or auto-defined based on logical fonts
+ //or some test app
+ TFontSpec fs;
+ fs.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
+ //primary font
+ fs.iTypeface.iName = KS60Sans;
+ fs.iHeight = 161;
+ fs.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
+ iFontCache.Append(fs);
+
+ fs.iFontStyle.SetStrokeWeight(EStrokeWeightNormal);
+
+ //Series 60 Sans TitleSmBd, 183
+ fs.iTypeface.iName = KS60SansTitleBold;
+ fs.iHeight = 183;
+ iFontCache.Append(fs);
+
+ //Series 60 Sans TitleSmBd, 172
+ fs.iTypeface.iName = KS60SansTitleBold;
+ fs.iHeight = 172;
+ iFontCache.Append(fs);
+
+ //Series 60 Sans, 122
+ fs.iTypeface.iName = KS60Sans;
+ fs.iHeight = 122;
+ iFontCache.Append(fs);
+ //Series 60 Sans, 116
+ fs.iTypeface.iName = KS60Sans;
+ fs.iHeight = 116;
+ iFontCache.Append(fs);
+
+ //Series 60 Sans TitleSmBd, 138
+ fs.iTypeface.iName = KS60SansTitleBold;
+ fs.iHeight = 138;
+ iFontCache.Append(fs);
+ }
+*/
+
+// ----------------------------------------------------------------------------
+TInt ImageDifferenceL( CFbsBitmap* aImage1, CFbsBitmap* aImage2,
+ CFbsBitmap* &aResult, TRect &aRect )
+ {
+ HTI_LOG_TEXT( "ImageDifferenceL()" );
+
+ // By default return coordinates of the full image
+ aRect = TRect( 0, 0, aImage2->SizeInPixels().iWidth,
+ aImage2->SizeInPixels().iHeight );
+
+//1. check that aImage1 and aImage2 are valid and can be compared
+ if ( aImage1 == NULL || aImage2 == NULL )
+ {
+ HTI_LOG_TEXT( "return KErrArgument" );
+ return KErrArgument;
+ }
+
+ if ( aImage1->SizeInPixels() != aImage2->SizeInPixels() )
+ {
+ HTI_LOG_TEXT( "return KErrGeneral (size)" );
+ return KErrGeneral;
+ }
+
+ if ( aImage1->DisplayMode() != aImage2->DisplayMode() )
+ {
+ HTI_LOG_TEXT( "return KErrGeneral (displaymode)" );
+ return KErrGeneral;
+ }
+
+
+//2. iterate through images from each border and compare to findout outline for diff region
+ TSize orgSize = aImage1->SizeInPixels();
+
+ TBitmapUtil srcBmpIterator1( aImage1 );
+ TBitmapUtil srcBmpIterator2( aImage2 );
+
+ srcBmpIterator1.Begin( TPoint( 0, 0 ) );
+ srcBmpIterator2.Begin( TPoint( 0, 0 ), srcBmpIterator1 );
+
+ TRect diffOutline = TRect( -1, -1, -1, -1 );
+
+ //2.1 top border iteration
+ TPoint c( 0,0 );
+ for ( ; c.iY < orgSize.iHeight && diffOutline.iTl.iY == -1; ++c.iY )
+ {
+ c.iX = 0;
+ srcBmpIterator1.SetPos( c );
+ srcBmpIterator2.SetPos( c );
+ for ( ; c.iX < orgSize.iWidth && diffOutline.iTl.iY == -1; ++c.iX )
+ {
+ if ( srcBmpIterator1.GetPixel() != srcBmpIterator2.GetPixel() )
+ {
+ diffOutline.iTl.iY = c.iY;
+ }
+
+ srcBmpIterator1.IncXPos();
+ srcBmpIterator2.IncXPos();
+ }
+ }
+
+ //2.2 bottom iteration
+ c.SetXY( 0, orgSize.iHeight - 1 );
+ for ( ; c.iY >= diffOutline.iTl.iY && diffOutline.iBr.iY == -1; --c.iY )
+ {
+ c.iX = 0;
+ srcBmpIterator1.SetPos( c );
+ srcBmpIterator2.SetPos( c );
+ for (; c.iX < orgSize.iWidth && diffOutline.iBr.iY == -1; ++c.iX )
+ {
+ if ( srcBmpIterator1.GetPixel() != srcBmpIterator2.GetPixel() )
+ {
+ diffOutline.iBr.iY = c.iY;
+ }
+
+ srcBmpIterator1.IncXPos();
+ srcBmpIterator2.IncXPos();
+ }
+ }
+
+ //2.3 left, goes in vertical lines
+ c.SetXY( 0, diffOutline.iTl.iY );
+ for ( ; c.iX < orgSize.iWidth && diffOutline.iTl.iX == -1; ++c.iX )
+ {
+ c.iY = diffOutline.iTl.iY;
+ srcBmpIterator1.SetPos( c );
+ srcBmpIterator2.SetPos( c );
+ for ( ; c.iY <= diffOutline.iBr.iY && diffOutline.iTl.iX == -1; ++c.iY )
+
+ {
+ if ( srcBmpIterator1.GetPixel() != srcBmpIterator2.GetPixel() )
+ {
+ diffOutline.iTl.iX = c.iX;
+ }
+
+ srcBmpIterator1.IncYPos();
+ srcBmpIterator2.IncYPos();
+ }
+ }
+ //2.4 right, goes in vertical lines
+ c.SetXY( orgSize.iWidth - 1, diffOutline.iTl.iY );
+ for ( ; c.iX >= diffOutline.iTl.iX && diffOutline.iBr.iX == -1; --c.iX )
+ {
+ c.iY = diffOutline.iTl.iY;
+ srcBmpIterator1.SetPos( c );
+ srcBmpIterator2.SetPos( c );
+ for ( ; c.iY <= diffOutline.iBr.iY && diffOutline.iBr.iX == -1; ++c.iY )
+
+ {
+ if ( srcBmpIterator1.GetPixel() != srcBmpIterator2.GetPixel() )
+ {
+ diffOutline.iBr.iX = c.iX;
+ }
+
+ srcBmpIterator1.IncYPos();
+ srcBmpIterator2.IncYPos();
+ }
+ }
+ srcBmpIterator2.End();
+ srcBmpIterator1.End();
+
+ //3. if there is some diff create CFbsBitmap in aResult and copy outlined image from aImage2
+ if ( diffOutline.iTl.iX == -1 &&
+ diffOutline.iTl.iY == -1 &&
+ diffOutline.iBr.iX == -1 &&
+ diffOutline.iBr.iY == -1 )
+ {
+ // No difference found
+ aRect = TRect( 0, 0, 0, 0 );
+ HTI_LOG_TEXT( "return KErrNotFound" );
+ return KErrNotFound;
+ }
+
+ aRect = diffOutline;
+
+ HTI_LOG_FORMAT( "Tlx - %d", aRect.iTl.iX );
+ HTI_LOG_FORMAT( "Tly - %d", aRect.iTl.iY );
+ HTI_LOG_FORMAT( "Bty - %d", aRect.iBr.iX );
+ HTI_LOG_FORMAT( "Bry - %d", aRect.iBr.iY );
+
+ // The bottom right co-ordinate is not included in the rectange
+ // (see TRect documentation) so we need to stretch the rectange
+ // for BitBlt to get the correct sized image.
+
+ TRect captureRect( diffOutline.iTl.iX, diffOutline.iTl.iY,
+ diffOutline.iBr.iX + 1, diffOutline.iBr.iY + 1 );
+
+ aResult = new (ELeave) CFbsBitmap();
+ User::LeaveIfError( aResult->Create( captureRect.Size(), aImage2->DisplayMode() ) );
+ CleanupStack::PushL( aResult );
+
+ CFbsBitmapDevice* bmpDevice = CFbsBitmapDevice::NewL( aResult );
+ CleanupStack::PushL( bmpDevice );
+
+ CFbsBitGc* bmpCtx;
+ bmpDevice->CreateContext( bmpCtx );
+ bmpCtx->BitBlt( TPoint( 0, 0 ), aImage2, captureRect );
+
+ delete bmpCtx;
+ bmpCtx = NULL;
+
+ CleanupStack::PopAndDestroy(); // bmpDevice
+ CleanupStack::Pop(); // aResult
+
+ HTI_LOG_TEXT( "return KErrNone" );
+ return KErrNone;
+ }
+
+// ----------------------------------------------------------------------------
+CICLHandler::CICLHandler( CImageEncoder* aService, MICLObserver* anObserver ):
+ CActive( EPriorityStandard ),
+ iObserver( anObserver ),
+ iService( aService )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ----------------------------------------------------------------------------
+CICLHandler::~CICLHandler()
+ {
+ Cancel();
+ }
+
+// ----------------------------------------------------------------------------
+void CICLHandler::Start()
+ {
+ SetActive();
+ }
+
+// ----------------------------------------------------------------------------
+void CICLHandler::RunL()
+ {
+ iObserver->ICLComplete( iStatus.Int() );
+ }
+
+// ----------------------------------------------------------------------------
+void CICLHandler::DoCancel()
+ {
+ iService->Cancel();
+ }
+
+/*
+// ----------------------------------------------------------------------------
+TInt CICLHandler::RunError(TInt aError)
+ {
+
+ }
+*/
+
+// ----------------------------------------------------------------------------
+// Create instance of concrete ECOM interface implementation
+CHtiScreenshotServicePlugin* CHtiScreenshotServicePlugin::NewL()
+ {
+ CHtiScreenshotServicePlugin* self = new (ELeave) CHtiScreenshotServicePlugin;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// Constructor
+CHtiScreenshotServicePlugin::CHtiScreenshotServicePlugin():
+ iScreen( NULL ),
+ iEncodedBitmap( NULL ),
+ iScreenDevice( NULL ),
+ iBitmapEncoder( NULL ),
+ iICLHandler( NULL ),
+ iCompress( EFalse ),
+ iDeltaCapture( EFalse ),
+ iPreviousBitmap( NULL )
+ {
+ }
+
+// ----------------------------------------------------------------------------
+CHtiScreenshotServicePlugin::~CHtiScreenshotServicePlugin()
+ {
+ HTI_LOG_FUNC_IN( "~CHtiScreenshotServicePlugin" );
+
+ iFontCache.Close();
+
+ delete iScreen;
+ delete iEncodedBitmap;
+
+ delete iICLHandler;
+ delete iBitmapEncoder;
+
+ delete iScreenDevice;
+
+ delete iSeriesShot;
+
+ if ( iPreviousBitmap )
+ delete iPreviousBitmap;
+
+ iWs.Close();
+ HTI_LOG_FUNC_OUT( "~CHtiScreenshotServicePlugin" );
+ }
+
+// ----------------------------------------------------------------------------
+// Second phase construction.
+void CHtiScreenshotServicePlugin::ConstructL()
+ {
+ HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::ConstructL" );
+ User::LeaveIfError( iWs.Connect() );
+
+ iScreenDevice = new ( ELeave ) CWsScreenDevice( iWs );
+ User::LeaveIfError( iScreenDevice->Construct() );
+
+ //InitFontCache();
+
+ iSeriesShot = CSeriesShot::NewL( this );
+
+ iPreviousBitmap = new ( ELeave ) CFbsBitmap;
+
+ //SelectEncoder( KImageTypeBMPUid );
+ HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::ConstructL" );
+ }
+
+// ----------------------------------------------------------------------------
+TBool CHtiScreenshotServicePlugin::IsBusy()
+ {
+ if ( iICLHandler )
+ {
+ return iICLHandler->IsActive();
+ }
+
+ if ( iSeriesShot->IsOngoing() )
+ {
+ return ETrue;
+ }
+
+ return iEncodedBitmap != NULL;
+ }
+
+// ----------------------------------------------------------------------------
+inline TInt CHtiScreenshotServicePlugin::ParseInt16( const TUint8* aStart )
+ {
+ return aStart[0] + (aStart[1]<<8);
+ }
+
+// ----------------------------------------------------------------------------
+inline TInt CHtiScreenshotServicePlugin::ParseInt32( const TUint8* aStart )
+ {
+ return aStart[0] + (aStart[1]<<8) + (aStart[2]<<16) + (aStart[3]<<24);
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::SendTextRecgReplyL(
+ const TBool aResult,
+ const TRect& aLocation,
+ const TInt aFontIndex)
+ {
+ HTI_LOG_FUNC_IN( "SendTextRecgReplyL" );
+ HBufC8* sendMsg = HBufC8::NewL( 10 );
+ CleanupStack::PushL( sendMsg );
+ if ( aResult )
+ {
+ sendMsg->Des().Append( ERspOk );
+ TUint16 co = aLocation.iTl.iX;
+ sendMsg->Des().Append( (TUint8*)(&co), 2 );
+ co = aLocation.iTl.iY;
+ sendMsg->Des().Append( (TUint8*)(&co), 2 );
+ co = aLocation.iBr.iX;
+ sendMsg->Des().Append( (TUint8*)(&co), 2 );
+ co = aLocation.iBr.iY;
+ sendMsg->Des().Append( (TUint8*)(&co), 2 );
+ sendMsg->Des().Append( (TUint8)aFontIndex );
+ }
+ else
+ {
+ sendMsg->Des().Append( ERspNotFound );
+ sendMsg->Des().AppendFill( 0, 5 );
+ }
+
+ User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+ sendMsg,
+ KScreenshotServiceUid) );
+
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "SendTextRecgReplyL" );
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::CopyUnicode( TDes & aTo, const TDesC8& aFrom )
+{
+ HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::CopyUnicode" );
+ //aTo.Copy( reinterpret_cast<const TUint16*>(aFrom.Ptr()), aFrom.Length() );
+ TInt len = aFrom.Length()>>1;
+ aTo.SetLength( len );
+ for ( TInt i = 0; i < len; ++i )
+ {
+ aTo[i] = (TUint16)aFrom[i<<1] + (((TUint16)aFrom[(i<<1)+1])<<8);
+ }
+ HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::CopyUnicode" );
+}
+
+// ----------------------------------------------------------------------------
+TInt CHtiScreenshotServicePlugin::ParseString( const TDesC8& aRequest,
+ TInt anOffset,
+ TBool aUnicode,
+ TDes& aResult)
+ {
+ HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::ParseString" );
+ //validate parameters
+ //if offset outside the string return empty string
+ if ( anOffset >= aRequest.Size() )
+ {
+ return anOffset;
+ }
+
+ TInt len = aRequest[ anOffset ];
+ HTI_LOG_FORMAT( "len %d", len );
+
+ if ( len> aResult.MaxLength() )
+ {
+ return KErrBadDescriptor;
+ }
+
+ TInt nextOffset = ( aUnicode ? len * 2 : len ) + anOffset + 1;
+ HTI_LOG_FORMAT( "nextOffset %d", nextOffset );
+ HTI_LOG_FORMAT( "reqSize %d", aRequest.Size() );
+ if ( nextOffset > aRequest.Size() )
+ {
+ return KErrArgument;
+ }
+
+ if ( aUnicode )
+ {
+ //const TUint8* ptr = aRequest.Mid( anOffset + 1, len * 2 ).Ptr();
+ //aResult.Copy( (const TUint16*)ptr, len );
+ CopyUnicode( aResult, aRequest.Mid( anOffset + 1, len * 2 ) );
+ }
+ else
+ {
+ aResult.Copy( aRequest.Mid( anOffset + 1, len ) );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::ParseString" );
+ return nextOffset;
+ }
+
+// ----------------------------------------------------------------------------
+TInt CHtiScreenshotServicePlugin::ParseFontSpec( const TDesC8& aRequest,
+ TInt anOffset,
+ TBool aUnicode,
+ TFontSpec& aResult)
+ {
+ if ( anOffset >= aRequest.Size() )
+ {
+ return KErrArgument;
+ }
+
+ //get font name
+ TPtr tn = aResult.iTypeface.iName.Des();
+ TInt offset = ParseString( aRequest,
+ anOffset,
+ aUnicode,
+ tn );
+
+ if ( offset > anOffset )
+ {
+ HTI_LOG_DES(aResult.iTypeface.iName);
+ //check that we have valid descr
+ if ( offset + 2 <= aRequest.Size() )
+ {
+ aResult.iHeight = ParseInt16( aRequest.Ptr() + offset );
+ HTI_LOG_FORMAT( "font height %d", aResult.iHeight );
+ //check style byte
+ TUint8 style = aRequest[ offset + 2 ];
+ HTI_LOG_FORMAT( "style %d", style );
+
+ //stroke bit
+ if ( style & EHtiFontAttBold )
+ {
+ aResult.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
+ }
+ else
+ {
+ aResult.iFontStyle.SetStrokeWeight(EStrokeWeightNormal);
+ }
+ //posture
+ if ( style & EHtiFontAttItalic )
+ {
+ aResult.iFontStyle.SetPosture(EPostureItalic);
+ }
+ else
+ {
+ aResult.iFontStyle.SetPosture(EPostureUpright);
+ }
+ //bitmap glyph type
+ if ( style & EHtiFontAttNotAA )
+ {
+ aResult.iFontStyle.SetBitmapType( EMonochromeGlyphBitmap );
+ }
+ else
+ {
+ aResult.iFontStyle.SetBitmapType( EAntiAliasedGlyphBitmap );
+ }
+ //print position
+ if ( style & EHtiFontAttPrintPositionFlag )
+ {
+ TInt printPos = style & EHtiFontAttPrintPositionValue;
+ if ( printPos == KHtiFontAttSuperscriptValue )
+ {
+ aResult.iFontStyle.SetPrintPosition( EPrintPosSuperscript );
+ }
+ else if ( printPos == KHtiFontAttSubscriptValue )
+ {
+ aResult.iFontStyle.SetPrintPosition( EPrintPosSubscript );
+ }
+ }
+ else
+ {
+ aResult.iFontStyle.SetPrintPosition( EPrintPosNormal );
+ }
+ return offset + 3;
+ }
+ else
+ {
+ return KErrArgument;
+ }
+ }
+ else
+ {
+ return offset<0?offset:KErrArgument;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::ProcessTextRcgMessageL(
+ const TDesC8& aMessage)
+ {
+ HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::ProcessTextRcgMessageL" );
+ TBool unicode = aMessage[0] & 0x1;
+
+ TBuf<0xFF> text;
+
+ TInt offset = ParseString(aMessage, 1, unicode, text);
+
+ HTI_LOG_FORMAT( "offset %d ", offset );
+ if ( offset > 1 )
+ {
+ HTI_LOG_DES(text);
+
+ if ( offset + 1 < aMessage.Size() )
+ {
+ TInt numOfFonts = aMessage[ offset ];
+ HTI_LOG_FORMAT( "num of fonts %d", numOfFonts );
+ iFontCache.Reset();
+ TInt nextOffset = offset + 1;
+ for ( TInt i = 0; i < numOfFonts; ++i )
+ {
+ TFontSpec fontSpec;
+ nextOffset = ParseFontSpec(aMessage,
+ nextOffset,
+ unicode,
+ fontSpec);
+ if ( nextOffset < 0 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ nextOffset,
+ KErrDescrInvalid,
+ KScreenshotServiceUid);
+ return;
+ }
+ else
+ {
+ iFontCache.Append( fontSpec );
+ }
+ }
+
+ //parameters parsing END
+ //get screenshot
+ TRect empty;
+ CreateBitmapL( empty, ENone );
+
+ //call text rcg routines
+ TInt fontIndex;
+ TRect resultRect;
+
+ //recognize text using fonts from iFontCache
+ TBool result = RecognizeTextL( text, resultRect, fontIndex );
+
+ SendTextRecgReplyL( result, resultRect, fontIndex );
+
+ delete iScreen;
+ iScreen = NULL;
+ }
+ else
+ {
+ //no fonts data
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalid,
+ KScreenshotServiceUid);
+
+ }
+ }
+ else if ( offset == 1 )
+ {
+ //empty text
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalid,
+ KScreenshotServiceUid);
+ }
+ else
+ {
+ //error
+ iDispatcher->DispatchOutgoingErrorMessage(
+ offset,
+ KErrDescrInvalid,
+ KScreenshotServiceUid);
+ }
+ HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::ProcessTextRcgMessageL" );
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::ProcessTextBitmapMessageL(
+ const TDesC8& aMessage)
+ {
+ HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::ProcessTextBitmapMessageL" );
+ TBool unicode = aMessage[0] & 0x1;
+
+ TDisplayMode displayMode = ENone;
+ //check display
+ if ( aMessage.Size() > KScreenDisplayOffset )
+ {
+ displayMode = (TDisplayMode)aMessage[KScreenDisplayOffset];
+ if ( displayMode >= EColorLast )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalidMode,
+ KScreenshotServiceUid);
+ return;
+ }
+ }
+
+ //check mime
+ TPtrC8 mime;
+ if ( aMessage[KScreenMIMEOffset] > 0 &&
+ ( aMessage[KScreenMIMEOffset] + KScreenMIMEOffset+1 ) < aMessage.Size() )
+ {
+ mime.Set( aMessage.Mid(KScreenMIMEOffset+1, aMessage[KScreenMIMEOffset] ) );
+ if ( !IsMIMETypeSupported( mime ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrMIMENotSupported,
+ KScreenshotServiceUid);
+ return;
+ }
+ }
+ else if ( aMessage[KScreenMIMEOffset] != 0 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalidMode,
+ KScreenshotServiceUid);
+ return;
+ }
+
+ TBuf<0xFF> text;
+ TInt preTextOffset = KScreenMIMEOffset + aMessage[KScreenMIMEOffset] + 1;
+ TInt offset = ParseString( aMessage, preTextOffset, unicode, text );
+
+ HTI_LOG_FORMAT( "offset %d ", offset );
+ if ( offset == preTextOffset )
+ {
+ //empty text
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalid,
+ KScreenshotServiceUid);
+ }
+ else if ( offset < preTextOffset )
+ {
+ //error
+ iDispatcher->DispatchOutgoingErrorMessage(
+ offset,
+ KErrDescrInvalid,
+ KScreenshotServiceUid);
+ }
+
+ HTI_LOG_DES(text);
+ TFontSpec fontSpec;
+ offset = ParseFontSpec(aMessage,
+ offset,
+ unicode,
+ fontSpec);
+ if ( offset < 0 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ offset,
+ KErrDescrInvalid,
+ KScreenshotServiceUid);
+
+ return;
+ }
+
+ //check colors
+ HTI_LOG_TEXT( "check colors" );
+ if ( offset + 2*4 != aMessage.Size() )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ offset,
+ KErrDescrInvalid,
+ KScreenshotServiceUid);
+ return;
+ }
+
+ //extract colors
+ TUint32 fgColor = ParseInt32( aMessage.Ptr() + offset );
+ TUint32 bgColor = ParseInt32( aMessage.Ptr() + offset + 4 );
+ HTI_LOG_FORMAT( "FG color %d", fgColor );
+ HTI_LOG_FORMAT( "BG color %d", bgColor );
+
+ //END parsing
+ //generate and return bitmap
+ CFont* useFont;
+
+ User::LeaveIfError( iScreenDevice->GetNearestFontToDesignHeightInPixels(
+ useFont, fontSpec ) );
+
+ TDisplayMode dm = displayMode==ENone || displayMode==0?
+ iScreenDevice->DisplayMode():
+ displayMode;
+
+
+ delete iScreen;
+ iScreen = NULL;
+ iScreen = CHtiTextRcg::GetTextBitmapL(
+ text,
+ useFont,
+ TRgb( fgColor ),
+ TRgb( bgColor ),
+ dm );
+
+ iScreenDevice->ReleaseFont( useFont );
+
+ //Encode iBitmap
+ iCompress = EFalse;
+ if ( mime.Length() == 0 )
+ {
+ EncodeBitmapL(); //use default encoder BMP
+ }
+ else
+ {
+ HTI_LOG_DES( mime );
+ EncodeBitmapL( mime );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::ProcessTextBitmapMessageL" );
+ }
+
+/*
+// ----------------------------------------------------------------------------
+TBool CHtiScreenshotServicePlugin::RecognizeTextAllL(
+ const TDesC& aText,
+ TPoint& aResult)
+ {
+ HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::RecognizeTextAllL" );
+
+ TSize screenRect = iScreenDevice->SizeInPixels();
+ TInt nofTF = iScreenDevice->NumTypefaces();
+ HTI_LOG_FORMAT( "Number of typefaces %d", nofTF );
+ TBool returnValue = EFalse;
+ for ( TInt i = 0; i < nofTF; ++i )
+ {
+ TTypefaceSupport tf;
+ iScreenDevice->TypefaceSupport(tf, i);
+
+ HTI_LOG_DES(tf.iTypeface.iName);
+
+ if ( tf.iIsScalable )
+ {
+ //iterate throuh heighes
+
+ HTI_LOG_FORMAT( "num of heighs %d", tf.iNumHeights );
+ HTI_LOG_FORMAT( "min h in tw %d", tf.iMinHeightInTwips );
+ HTI_LOG_FORMAT( "max h in tw %d", tf.iMaxHeightInTwips );
+ HTI_LOG_FORMAT( "scalable %d", tf.iIsScalable );
+
+ HTI_LOG_TEXT( "-----------------------" );
+
+ TInt minHeight = Max(tf.iMinHeightInTwips, KFonHeighMin );
+ TInt maxHeight = Min(tf.iMaxHeightInTwips, KFonHeighMax );
+
+ if ( minHeight > maxHeight )
+ {
+ continue;
+ }
+
+ for ( TInt v = 0; v < 2; ++v )
+ {
+ TInt lastFontHeight = 0;
+ for ( TInt fh = minHeight; fh <= maxHeight; ++fh )
+ {
+ TFontSpec fs( tf.iTypeface.iName, fh );
+ fs.iFontStyle.SetBitmapType( EAntiAliasedGlyphBitmap );
+ switch ( v )
+ {
+ case 1:
+ {
+ fs.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
+ HTI_LOG_TEXT( "BOLD" );
+ }
+ break;
+ default:
+ {
+ HTI_LOG_TEXT( "DEFAULT" );
+ }
+ }
+ HTI_LOG_FORMAT( "hh %d", fh );
+
+ CFont* useFont = NULL;
+
+ iScreenDevice->GetNearestFontToDesignHeightInTwips(useFont, fs);
+
+ if ( screenRect.iHeight < useFont->HeightInPixels() ||
+ screenRect.iWidth < useFont->MaxNormalCharWidthInPixels()
+ )
+ {
+ break;
+ }
+
+ if ( useFont->HeightInPixels() == lastFontHeight )
+ {
+ continue;
+ }
+
+
+ lastFontHeight = useFont->HeightInPixels();
+
+ returnValue = iTextRcg.RecognizeTextL(
+ iScreen,
+ aText,
+ useFont,
+ aResult);
+ //HTI_LOG_TEXT( "ReleaseFont" );
+ iScreenDevice->ReleaseFont(useFont);
+
+ if ( returnValue )
+ {
+ HTI_LOG_TEXT( "Found" );
+ HTI_LOG_DES( aText );
+ HTI_LOG_DES( tf.iTypeface.iName );
+ HTI_LOG_FORMAT( "Font height in twips %d", fh );
+ HTI_LOG_FORMAT( "X %d", aResult.iX );
+ HTI_LOG_FORMAT( "Y %d", aResult.iY );
+ return returnValue;
+ }
+ }
+ }
+ }
+ else
+ {//non scal. font
+ TFontSpec fs( tf.iTypeface.iName,0 ); //height doesn't matter for
+ //not scalable font
+
+ CFont* useFont = NULL;
+ //HTI_LOG_TEXT( "GetFont" );
+ iScreenDevice->GetNearestFontToDesignHeightInTwips( useFont, fs );
+
+ returnValue = iTextRcg.RecognizeTextL(
+ iScreen,
+ aText,
+ useFont,
+ aResult );
+ //HTI_LOG_TEXT( "ReleaseFont" );
+ iScreenDevice->ReleaseFont( useFont );
+
+ if ( returnValue )
+ {
+ HTI_LOG_TEXT( "Found" );
+ HTI_LOG_DES( aText );
+ HTI_LOG_DES(tf.iTypeface.iName );
+ HTI_LOG_FORMAT( "X %d", aResult.iX );
+ HTI_LOG_FORMAT( "Y %d", aResult.iY );
+ return returnValue;
+ }
+ }
+ }
+
+ //
+
+ HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::RecognizeTextAllL" );
+ //return returnValue;
+ return EFalse;
+ }
+*/
+
+// ----------------------------------------------------------------------------
+TBool CHtiScreenshotServicePlugin::RecognizeTextL(
+ const TDesC& aText,
+ TRect& aResult,
+ TInt& aFontIndex)
+ {
+ HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::RecognizeTextL" );
+
+ TSize screenRect = iScreenDevice->SizeInPixels();
+ TInt cacheSize = iFontCache.Count();
+ HTI_LOG_FORMAT( "Cache size %d", cacheSize );
+
+ TBool returnValue = EFalse;
+ for ( TInt i = 0; i < cacheSize; ++i )
+ {
+ CFont* useFont = NULL;
+
+ User::LeaveIfError(iScreenDevice->GetNearestFontToDesignHeightInPixels(
+ useFont, iFontCache[i] ) );
+ if ( iFontCache[i].iFontStyle.BitmapType()==EAntiAliasedGlyphBitmap )
+ {
+ iTextRcg.SetHint( EHintEdge );
+ }
+ else
+ {
+ iTextRcg.SetHint( EHintNone );
+ }
+
+ //check that font in valid size
+ if ( screenRect.iHeight < useFont->HeightInPixels() ||
+ screenRect.iWidth < useFont->MaxNormalCharWidthInPixels()
+ )
+ {
+ break;
+ }
+
+ returnValue = iTextRcg.RecognizeTextL( iScreen, aText, useFont,
+ aResult );
+
+ iScreenDevice->ReleaseFont( useFont );
+
+ if ( returnValue )
+ {
+ HTI_LOG_FORMAT( "Found! fontIndex %d", i );
+ HTI_LOG_DES( aText );
+ HTI_LOG_DES( iFontCache[i].iTypeface.iName );
+ HTI_LOG_FORMAT( "TL X %d", aResult.iTl.iX );
+ HTI_LOG_FORMAT( "TL Y %d", aResult.iTl.iY );
+ HTI_LOG_FORMAT( "BR X %d", aResult.iBr.iX );
+ HTI_LOG_FORMAT( "BR Y %d", aResult.iBr.iY );
+ aFontIndex = i;
+ return returnValue;
+ }
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::RecognizeTextL" );
+ return EFalse;
+ }
+
+/*
+TBool CHtiScreenshotServicePlugin::RecognizeTextL(
+ const TDesC& aText,
+ const TDesC& aTypeface,
+ TPoint& aResult)
+ {
+ HTI_LOG_FUNC_IN( "RecognizeTextL typeface" );
+ //const CFont* fontUsed = NULL;// AknLayoutUtils::FontFromName(aTypeface);
+ CFont* useFont = NULL;
+ TFontSpec fs(aTypeface, 0);
+
+ iScreenDevice->GetNearestFontInTwips(useFont, fs);
+
+ TBool returnValue = iTextRcg.RecognizeTextL(iScreen, aText, useFont, aResult);
+
+HTI_LOG_FUNC_OUT( "RecognizeTextL" );
+ return returnValue;
+}
+*/
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::ProcessMessageL(const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/)
+ {
+ HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::ProcessMessage");
+
+ if ( iICLHandler )
+ {
+ if ( iICLHandler->IsActive() || iEncodedBitmap)
+ {
+ User::Leave( KErrInUse );
+ }
+ }
+
+ if ( iSeriesShot->IsOngoing() )
+ User::Leave( KErrInUse );
+
+ // update the current screen mode
+ TPixelsAndRotation currentPixelsAndRotation;
+ iScreenDevice->GetScreenModeSizeAndRotation(
+ iScreenDevice->CurrentScreenMode(), currentPixelsAndRotation );
+ iScreenDevice->SetScreenSizeAndRotation( currentPixelsAndRotation );
+
+ if ( aMessage.Length() > 0 )
+ {
+ // set/reset delta capture status
+ iDeltaCapture = ( aMessage[0] & ECmdDeltaCaptureMask ) ? ETrue : EFalse;
+ if ( iDeltaCapture )
+ {
+ HTI_LOG_TEXT( "DeltaCapture ETrue" );
+ }
+
+ //if text recogn call separate handler
+ if ( aMessage[0] == ECmdTextRcg ||
+ aMessage[0] == ECmdTextRcg_u )
+ {
+ ProcessTextRcgMessageL( aMessage );
+ return;
+ }
+ else if ( aMessage[0] == ECmdTextBitmap ||
+ aMessage[0] == ECmdTextBitmap_u )
+ {
+ ProcessTextBitmapMessageL( aMessage );
+ return;
+ }
+
+ iCompress = ( aMessage[0] == ECmdScreenZip ) ||
+ ( aMessage[0] == ECmdScreenRegionZip ) ||
+ ( aMessage[0] == ECmdScreenZipSeries ) ||
+ ( aMessage[0] == ECmdScreenRegionZipSeries ) ||
+ ( aMessage[0] == ECmdDeltaScreenZip ) ||
+ ( aMessage[0] == ECmdDeltaScreenRegionZip );
+
+ HTI_LOG_FORMAT( "cmd 0x%x", aMessage[0] );
+ TPtrC8 mime;
+
+ switch ( aMessage[0] )
+ {
+ case ECmdScreen:
+ case ECmdScreenZip:
+ case ECmdDeltaScreen:
+ case ECmdDeltaScreenZip:
+ {
+ TRect empty;
+ TDisplayMode displayMode = ENone;
+ //check display
+ if ( aMessage.Length() > KScreenDisplayOffset )
+ {
+ displayMode = ( TDisplayMode ) aMessage[KScreenDisplayOffset];
+ if ( displayMode >= EColorLast )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalidMode,
+ KScreenshotServiceUid );
+ return;
+ }
+ }
+
+ bool screenNumberSet = false;
+ //check screen number
+ if ( (aMessage.Length() > KScreenScreenNumber) &&
+ ((aMessage[aMessage.Length()-1] == 0) || (aMessage[aMessage.Length()-1] == 1)))
+ {
+ TInt screenNumber = aMessage[aMessage.Length()-1];
+ HTI_LOG_FORMAT( "set screen number: %d", screenNumber );
+ screenNumberSet = true;
+ TInt screens;
+ TInt ret = HAL::Get(HAL::EDisplayNumberOfScreens, screens);
+ if(ret)
+ {
+ HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+ User::Leave(ret);
+ }
+ HTI_LOG_FORMAT( "HAL::Get number of screens %d", screens );
+ if( ( screenNumber>screens-1 ) || ( screenNumber<0 ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument, KErrDescrScreenNotSupported, KScreenshotServiceUid);
+ return;
+ }
+ SetScreenNumber(screenNumber);
+ }
+
+ CreateBitmapL( empty, displayMode );
+
+ //check mime
+ if ( aMessage.Length() > KScreenMIMEOffset )
+ {
+ if(screenNumberSet)
+ {
+ mime.Set( aMessage.Mid( KScreenMIMEOffset, aMessage.Length()-1-KScreenMIMEOffset ) );
+ }
+ else
+ {
+ mime.Set( aMessage.Mid( KScreenMIMEOffset ) );
+ }
+ if ( !IsMIMETypeSupported( mime ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrMIMENotSupported,
+ KScreenshotServiceUid );
+ return;
+ }
+ }
+ }
+ break;
+
+ case ECmdScreenRegion:
+ case ECmdScreenRegionZip:
+ case ECmdDeltaScreenRegion:
+ case ECmdDeltaScreenRegionZip:
+ {
+ //check screen number
+ bool screenNumberSet = false;
+ if ( (aMessage.Length() > KRegionScreenNumber) &&
+ ((aMessage[aMessage.Length()-1] == 0) || (aMessage[aMessage.Length()-1] == 1)))
+ {
+ TInt screenNumber = aMessage[aMessage.Length()-1];
+ screenNumberSet = true;
+ TInt screens;
+ TInt ret = HAL::Get(HAL::EDisplayNumberOfScreens, screens);
+ if(ret)
+ {
+ HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+ User::Leave(ret);
+ }
+ HTI_LOG_FORMAT( "HAL::Get number of screens %d", screens );
+ if( ( screenNumber>screens-1 ) || ( screenNumber<0 ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument, KErrDescrScreenNotSupported, KScreenshotServiceUid);
+ return;
+ }
+ SetScreenNumber(screenNumber);
+ }
+
+ if ( aMessage.Length() >= KMinScreenRegionCmdLength )
+ {
+ TRect region;
+ const TUint8* ptr = aMessage.Ptr();
+ region.iTl.iX = ParseInt16( ptr + 1 );
+ region.iTl.iY = ParseInt16( ptr + 3 );
+ region.iBr.iX = ParseInt16( ptr + 5 );
+ region.iBr.iY = ParseInt16( ptr + 7 );
+
+ //check empty and normmalizaed
+ if ( !region.IsNormalized() )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrRegionNotNormailized,
+ KScreenshotServiceUid );
+ return;
+ }
+
+ if ( region.IsEmpty() )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrRegiontEmpty,
+ KScreenshotServiceUid );
+ return;
+ }
+
+ TRect screenRect;
+ screenRect.iBr = iScreenDevice->SizeInPixels().AsPoint();
+ screenRect.iBr.iX++; //TRect::Contains() omitts
+ screenRect.iBr.iY++; //right bottom rows
+
+ TDisplayMode displayMode = ENone;
+ if ( aMessage.Length() > KRegionDisplayOffset )
+ {
+ displayMode = ( TDisplayMode ) aMessage[KRegionDisplayOffset];
+ if ( displayMode >= EColorLast )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalidMode,
+ KScreenshotServiceUid );
+ return;
+ }
+ }
+
+ if ( screenRect.Contains( region.iTl ) &&
+ screenRect.Contains( region.iBr ) )
+ {
+ CreateBitmapL( region, displayMode );
+ }
+ else
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrRegionOutOfScreen,
+ KScreenshotServiceUid );
+ return;
+ }
+
+ //check mime
+ if ( aMessage.Length() > KRegionMIMEOffset )
+ {
+ if(!screenNumberSet)
+ {
+ mime.Set( aMessage.Mid( KRegionMIMEOffset ) );
+ }
+ else
+ {
+ mime.Set( aMessage.Mid( KRegionMIMEOffset, aMessage.Length()-1-KRegionMIMEOffset ) );
+ }
+ if ( !IsMIMETypeSupported( mime ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrMIMENotSupported,
+ KScreenshotServiceUid );
+ return;
+ }
+ }
+
+ }
+ else
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalid,
+ KScreenshotServiceUid );
+ return;
+ }
+ }
+ break;
+
+ case ECmdScreenSeries:
+ case ECmdScreenZipSeries:
+ {
+ if ( aMessage.Length() < KMinSeriesCmdLength )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalid,
+ KScreenshotServiceUid );
+ return;
+ }
+
+ bool screenNumberSet = false;
+ if ( (aMessage.Length() > KSeriesScreenNumber) &&
+ ((aMessage[aMessage.Length()-1] == 0) || (aMessage[aMessage.Length()-1] == 1)) )
+ {
+ TInt screenNumber = aMessage[aMessage.Length()-1];
+ screenNumberSet = true;
+ TInt screens;
+ TInt ret = HAL::Get(HAL::EDisplayNumberOfScreens, screens);
+ if(ret)
+ {
+ HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+ User::Leave(ret);
+ }
+ HTI_LOG_FORMAT( "HAL::Get number of screens %d", screens );
+ if( ( screenNumber>screens-1 ) || ( screenNumber<0 ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument, KErrDescrScreenNotSupported, KScreenshotServiceUid);
+ return;
+ }
+ SetScreenNumber(screenNumber);
+ }
+
+ TInt duration = ParseInt32( aMessage.Ptr() + KSeriesDurationOffset );
+ TInt interval = ParseInt32( aMessage.Ptr() + KSeriesIntervalOffset );
+
+ TDisplayMode displayMode = ( TDisplayMode ) aMessage[KSeriesDisplayOffset];
+ if ( displayMode >= EColorLast )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalidMode,
+ KScreenshotServiceUid );
+ return;
+ }
+
+ if ( aMessage.Length() > KSeriesMIMEOffset )
+ {
+ if(screenNumberSet)
+ {
+ mime.Set( aMessage.Mid( KSeriesMIMEOffset, aMessage.Length()-1-KSeriesMIMEOffset ) );
+ }
+ else
+ {
+ mime.Set( aMessage.Mid( KSeriesMIMEOffset ) );
+ }
+ if ( !IsMIMETypeSupported( mime ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrMIMENotSupported,
+ KScreenshotServiceUid );
+ return;
+ }
+ }
+
+ TRect empty;
+ iSeriesShot->StartL( duration, interval, displayMode, empty, mime );
+ }
+ return;
+
+ case ECmdScreenRegionSeries:
+ case ECmdScreenRegionZipSeries:
+ {
+ bool screenNumberSet = false;
+ if ( (aMessage.Length() > KRegionSeriesScreenNumber) &&
+ ((aMessage[aMessage.Length()-1] == 0) || (aMessage[aMessage.Length()-1] == 1)) )
+ {
+ TInt screenNumber = aMessage[aMessage.Length()-1];
+ screenNumberSet = true;
+ TInt screens;
+ TInt ret = HAL::Get(HAL::EDisplayNumberOfScreens, screens);
+ if(ret)
+ {
+ HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+ User::Leave(ret);
+ }
+ HTI_LOG_FORMAT( "HAL::Get number of screens %d", screens );
+ if( ( screenNumber>screens-1 ) || ( screenNumber<0 ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument, KErrDescrScreenNotSupported, KScreenshotServiceUid);
+ return;
+ }
+ SetScreenNumber(screenNumber);
+ }
+
+ if ( aMessage.Length() < KMinRegionSeriesCmdLength )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalid,
+ KScreenshotServiceUid);
+ return;
+ }
+ TInt duration = ParseInt32( aMessage.Ptr() + KSeriesDurationOffset );
+ TInt interval = ParseInt32( aMessage.Ptr() + KSeriesIntervalOffset );
+
+ TDisplayMode displayMode = ( TDisplayMode ) aMessage[KSeriesDisplayOffset];
+ if ( displayMode >= EColorLast )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalidMode,
+ KScreenshotServiceUid );
+ return;
+ }
+
+ TRect region;
+ const TUint8* ptr = aMessage.Ptr();
+ region.iTl.iX = ParseInt16( ptr + KRegionSeriesTlX );
+ region.iTl.iY = ParseInt16( ptr + KRegionSeriesTlY );
+ region.iBr.iX = ParseInt16( ptr + KRegionSeriesBlX );
+ region.iBr.iY = ParseInt16( ptr + KRegionSeriesBlY );
+
+ //check empty and normmalizaed
+ if ( !region.IsNormalized() )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrRegionNotNormailized,
+ KScreenshotServiceUid );
+ return;
+ }
+
+ if ( region.IsEmpty() )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrRegiontEmpty,
+ KScreenshotServiceUid );
+ return;
+ }
+
+ TRect screenRect;
+ screenRect.iBr = iScreenDevice->SizeInPixels().AsPoint();
+ screenRect.iBr.iX++; //TRect::Contains() omitts
+ screenRect.iBr.iY++; //right bottom rows
+
+ if ( !screenRect.Contains( region.iTl ) ||
+ !screenRect.Contains( region.iBr ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrRegionOutOfScreen,
+ KScreenshotServiceUid );
+ return;
+ }
+
+ if ( aMessage.Length() > KRegionSeriesMIMEOffset )
+ {
+ if(screenNumberSet)
+ {
+ mime.Set( aMessage.Mid( KRegionSeriesMIMEOffset, aMessage.Length()-1-KRegionSeriesMIMEOffset ) );
+ }
+ else
+ {
+ mime.Set( aMessage.Mid( KRegionSeriesMIMEOffset ) );
+ }
+ if ( !IsMIMETypeSupported( mime ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrMIMENotSupported,
+ KScreenshotServiceUid );
+ return;
+ }
+ }
+
+ iSeriesShot->StartL( duration, interval, displayMode, region, mime );
+ }
+ return;
+
+ case ECmdSelectScreen:
+ {
+ if ( aMessage.Length() != KSelectScreenCmdLength )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalid,
+ KScreenshotServiceUid );
+ return;
+ }
+
+ TInt screenNr = aMessage[KScreenNrOffset];
+
+ TInt screens;
+ TInt ret=HAL::Get( HAL::EDisplayNumberOfScreens, screens );
+ if ( ret )
+ {
+ HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+ User::Leave( ret );
+ }
+
+
+ if ( ( screenNr > screens - 1 ) || ( screenNr < 0 ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrScreenNotSupported,
+ KScreenshotServiceUid );
+ return;
+ }
+
+
+ HTI_LOG_FORMAT( "Number of screens %d", screens );
+ HTI_LOG_FORMAT( "Setting to screen index %d", screenNr );
+
+ // Clear the previous delta bitmap to avoid error
+ iPreviousBitmap->Reset();
+
+ // delete old screendevice and create a new one
+ delete iScreenDevice;
+ iScreenDevice = NULL;
+ iScreenDevice = new ( ELeave ) CWsScreenDevice( iWs );
+ User::LeaveIfError( iScreenDevice->Construct( screenNr ) );
+
+ TBuf8<1> okMsg;
+ okMsg.Append( ECmdSelectScreen );
+ iDispatcher->DispatchOutgoingMessage(
+ okMsg.AllocL(), KScreenshotServiceUid );
+ }
+ return;
+
+ case ECmdDeltaScreenReset:
+ {
+ if ( aMessage.Length() != KDeltaResetCmdLength )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalid,
+ KScreenshotServiceUid );
+ return;
+ }
+
+ iPreviousBitmap->Reset();
+ TBuf8<1> okMsg;
+ okMsg.Append( ECmdDeltaScreenReset );
+ iDispatcher->DispatchOutgoingMessage(
+ okMsg.AllocL(), KScreenshotServiceUid );
+ }
+ return;
+
+ case ECmdScreenMode:
+ {
+ if ( aMessage.Length() != KScreenModeCmdLength )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrInvalid,
+ KScreenshotServiceUid );
+ return;
+ }
+
+ TInt focusScreen = iWs.GetFocusScreen();
+ TPixelsAndRotation sizeAndRotation;
+ TDisplayMode mode = ENone;
+ TInt thisScreen = iScreenDevice->GetScreenNumber();
+ iScreenDevice->GetDefaultScreenSizeAndRotation( sizeAndRotation );
+ mode = iScreenDevice->DisplayMode();
+
+ HTI_LOG_FORMAT( "This screen = %d", thisScreen );
+ HTI_LOG_FORMAT( "Screen width = %d", sizeAndRotation.iPixelSize.iWidth );
+ HTI_LOG_FORMAT( "Screen height = %d", sizeAndRotation.iPixelSize.iHeight );
+ HTI_LOG_FORMAT( "Rotation = %d", sizeAndRotation.iRotation );
+ HTI_LOG_FORMAT( "Display mode = %d", mode );
+ HTI_LOG_FORMAT( "Focus screen = %d", focusScreen );
+ TBuf8<8> respMsg;
+ respMsg.Append( thisScreen );
+ respMsg.Append( ( TUint8* )( &( sizeAndRotation.iPixelSize.iWidth ) ), 2 );
+ respMsg.Append( ( TUint8* )( &( sizeAndRotation.iPixelSize.iHeight ) ), 2 );
+ respMsg.Append( sizeAndRotation.iRotation );
+ respMsg.Append( mode );
+ respMsg.Append( focusScreen );
+ iDispatcher->DispatchOutgoingMessage(
+ respMsg.AllocL(), KScreenshotServiceUid );
+ }
+ return;
+ case ECmdRotateScreen:
+ {
+ if (aMessage.Length() != KRotateScreenCmdLength)
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+ KErrDescrInvalid, KScreenshotServiceUid);
+ return;
+ }
+ HandleRotateScreen(aMessage.Right(aMessage.Length() -1));
+ return;
+ }
+ default:
+ //Error: unknown command
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrUnknownCommand,
+ KScreenshotServiceUid );
+ return;
+ } // switch
+
+ //Encode iBitmap
+ if ( mime.Length() == 0 )
+ {
+ EncodeBitmapL(); //use default encoder BMP
+ }
+ else
+ {
+ HTI_LOG_DES( mime );
+ EncodeBitmapL( mime );
+ }
+ }
+ else
+ {
+ //error: empty request
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrUnknownCommand,
+ KScreenshotServiceUid );
+ }
+
+ HTI_LOG_FUNC_OUT( "HtiScreenshotServicePlugin::ProcessMessage" );
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::HandleRotateScreen(const TDesC8& aData)
+ {
+ HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::HandleRotateScreen" );
+
+ TInt orientation = aData[0];
+ if (orientation > 1 || orientation < 0)
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+ KErrDescrInvalid, KScreenshotServiceUid);
+ return;
+ }
+
+ TBool isLandScape = orientation;
+
+ RWsSession ws;
+ User::LeaveIfError(ws.Connect());
+ CWsScreenDevice* screenDevice = new (ELeave) CWsScreenDevice(ws);
+ CleanupStack::PushL(screenDevice);
+ User::LeaveIfError(screenDevice->Construct());
+ TSize currentScreenSize = screenDevice->SizeInPixels();
+
+ TBool needsRotating = ETrue;
+ if (currentScreenSize.iWidth > currentScreenSize.iHeight && isLandScape)
+ {
+ // we are already in landscape
+ HTI_LOG_TEXT("The screen are already in landscape.");
+ needsRotating = EFalse;
+ }
+ if (currentScreenSize.iWidth < currentScreenSize.iHeight
+ && (!isLandScape))
+ {
+ // we are already in portrait
+ HTI_LOG_TEXT("The screen are already in portrait.");
+ needsRotating = EFalse;
+ }
+
+ CAknLayoutConfig* layoutConfigPtr = CAknLayoutConfig::NewL();
+ CleanupStack::PushL(layoutConfigPtr);
+
+ CAknLayoutConfig& layoutConfig = *layoutConfigPtr;
+
+ const CAknLayoutConfig::THardwareStateArray& hwStates =
+ layoutConfig.HardwareStates();
+ const CAknLayoutConfig::TScreenModeArray& screenModes =
+ layoutConfig.ScreenModes();
+
+ TInt newHwStateIndex = KErrNotFound;
+
+ // lets select alternate state from current
+ TSize newScreenSize;
+ if (needsRotating)
+ {
+ newScreenSize = TSize(currentScreenSize.iHeight,
+ currentScreenSize.iWidth);
+ HTI_LOG_FORMAT("Rotate the screen to the new width %d", newScreenSize.iWidth);
+ HTI_LOG_FORMAT("Rotate the screen to the new height %d", newScreenSize.iHeight);
+ }
+ else // basicly select current state again to ensure correct mode is informed to akncapserver
+ {
+ newScreenSize = TSize(currentScreenSize.iWidth,
+ currentScreenSize.iHeight);
+ }
+
+ for (TInt i = 0; i < hwStates.Count(); i++)
+ {
+ const CAknLayoutConfig::THardwareState hwState = hwStates.At(i);
+
+ const CAknLayoutConfig::TScreenMode normal = screenModes.Find(
+ hwState.ScreenMode());
+
+ if (normal.SizeInPixels() == newScreenSize)
+ {
+ newHwStateIndex = i;
+ break;
+ }
+ }
+
+ if (newHwStateIndex >= 0)
+ {
+ const CAknLayoutConfig::THardwareState newHwState = hwStates.At(
+ newHwStateIndex);
+ TApaTaskList taskList(ws);
+ TApaTask aknCapsrvTask = taskList.FindApp(KAknCapServerUid);
+ TInt keyCode = newHwState.KeyCode();
+ HTI_LOG_FORMAT( "Send key code %d to akncapserver", keyCode );
+ aknCapsrvTask.SendKey(keyCode, 0);
+ }
+
+ TBuf8<1> okMsg;
+ okMsg.Append(0);
+ iDispatcher->DispatchOutgoingMessage(okMsg.AllocL(),
+ KScreenshotServiceUid);
+
+ CleanupStack::PopAndDestroy(layoutConfigPtr);
+ CleanupStack::PopAndDestroy(screenDevice);
+ ws.Close();
+
+ HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::HandleRotateScreen" );
+ }
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::CreateBitmapL( TRect& aRegion,
+ TDisplayMode aMode )
+ {
+ HTI_LOG_FUNC_IN( "CreateBitmapL" );
+ //create bitmap
+ TSize imageSize = aRegion.IsEmpty() ? iScreenDevice->SizeInPixels() :
+ aRegion.Size();
+
+ TDisplayMode displayMode = aMode == ENone ?
+ iScreenDevice->DisplayMode() : aMode;
+
+ delete iScreen;//in case ICLComplete was not called
+ iScreen = NULL;
+ iScreen = new( ELeave ) CFbsBitmap;
+ User::LeaveIfError( iScreen->Create( imageSize, displayMode ) );
+
+ TInt err = KErrNone;
+ TRect region;
+ if ( aRegion.IsEmpty() )
+ {
+ err = iScreenDevice->CopyScreenToBitmap( iScreen );
+ region = imageSize;
+ }
+ else
+ {
+ err = iScreenDevice->CopyScreenToBitmap( iScreen, aRegion );
+ region = aRegion;
+ }
+ if (err == KErrNoMemory)
+ {
+ HTI_LOG_TEXT( "screenshot in camera mode" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ err = CAlfDrawer::FallbackCopyScreenToBitmap(*iScreenDevice, iScreen, region);
+#endif
+ }
+
+ if ( iDeltaCapture )
+ {
+ HTI_LOG_TEXT( "DeltaCapture enabled" );
+
+
+ CFbsBitmap* differenceBitmap = NULL;
+ TInt err = ImageDifferenceL( iPreviousBitmap,
+ iScreen,
+ differenceBitmap,
+ iDeltaRect );
+
+ iPreviousBitmap->Reset();
+ iPreviousBitmap->Duplicate( iScreen->Handle() );
+
+ if ( err == KErrNone )
+ {
+ delete iScreen;
+ iScreen = differenceBitmap;
+ }
+ else if ( err == KErrNotFound )
+ {
+ delete iScreen;
+ iScreen = NULL;
+
+ if ( !iSeriesShot->IsOngoing() )
+ {
+ // Nothing has changed on the screen.
+ // Send just iDeltaRect coordidates
+ HBufC8* buf = HBufC8::NewL( 4 * 2 ); // 2 bytes for each coordinate
+ buf->Des().SetLength( 4 * 2 );
+ TUint16* ptr = (TUint16*) buf->Des().Ptr();
+ ptr[0] = (TUint16) iDeltaRect.iTl.iX;
+ ptr[1] = (TUint16) iDeltaRect.iTl.iY;
+ ptr[2] = (TUint16) iDeltaRect.iBr.iX;
+ ptr[3] = (TUint16) iDeltaRect.iBr.iY;
+ // Response also sent in ICLComplete
+ iDispatcher->DispatchOutgoingMessage( buf, KScreenshotServiceUid );
+ }
+ }
+ }
+
+ HTI_LOG_FUNC_OUT( "CreateBitmapL" );
+ }
+/*
+
+// ----------------------------------------------------------------------------
+void CleanupRArray( TAny* object )
+ {
+ ((RImageTypeDescriptionArray*)object)->ResetAndDestroy();
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::SelectEncoder( const TUid aEncoderUid )
+ {
+ //select encoder
+ RImageTypeDescriptionArray imageTypeArray;
+ CImageEncoder::GetImageTypesL( imageTypeArray );
+ CleanupStack::PushL( TCleanupItem(CleanupRArray, &imageTypeArray) );
+
+ //select specified encoder
+ TBool found = EFalse;
+ for ( TInt i = 0; i < imageTypeArray.Count(); ++i )
+ {
+ if ( imageTypeArray[i]->ImageType() == aEncoderUid )
+ {
+ iImageEncoderType = imageTypeArray[i]->ImageType();
+ iImageEncoderSubtype = imageTypeArray[i]->SubType();
+ found = ETrue;
+ }
+ }
+
+ if ( !found )
+ {
+ User::Leave( KErrNotFound );
+ }
+ CleanupStack::PopAndDestroy(); //imageTypeArray
+ }
+*/
+
+// ----------------------------------------------------------------------------
+TBool CHtiScreenshotServicePlugin::IsMIMETypeSupported(TDesC8 &aMime)
+ {
+ HTI_LOG_DES(aMime);
+ RFileExtensionMIMETypeArray array;
+ CImageEncoder::GetFileTypesL(array);
+ for ( TInt i = 0; i < array.Count(); i++ )
+ {
+ if ( array[i]->MIMEType() == aMime )
+ {
+ HTI_LOG_TEXT( "MIME supported" );
+ array.ResetAndDestroy();
+ return ETrue;
+ }
+ }
+ HTI_LOG_TEXT( "MIME not supported" );
+ array.ResetAndDestroy();
+ return EFalse;
+ }
+
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::EncodeBitmapL(const TDesC8& aImageTypeMIME )
+ {
+ HTI_LOG_FUNC_IN( "EncodeBitmapL" );
+ delete iBitmapEncoder;
+ iBitmapEncoder = NULL;
+ delete iICLHandler;
+ iICLHandler = NULL;
+
+ if ( iScreen )
+ {
+ HTI_LOG_TEXT( "create encoder" );
+ if ( aImageTypeMIME == KNullDesC8 )
+ {
+ iBitmapEncoder = CImageEncoder::DataNewL( iEncodedBitmap,
+ CImageEncoder::EOptionNone,
+ KImageTypeBMPUid);//,
+ //iImageEncoderSubtype);
+ }
+ else
+ {
+ iBitmapEncoder = CImageEncoder::DataNewL( iEncodedBitmap,
+ aImageTypeMIME);
+ }
+
+ HTI_LOG_TEXT( "create CICLHandler" );
+ iICLHandler = new(ELeave) CICLHandler( iBitmapEncoder, this );
+ iBitmapEncoder->Convert( &(iICLHandler->iStatus), *iScreen );
+
+ HTI_LOG_TEXT( "CICLHandler start");
+ iICLHandler->Start();
+ }
+ else
+ {
+ HTI_LOG_TEXT( "Nothing to encode" );
+ }
+
+ HTI_LOG_FUNC_OUT( "EncodeBitmapL" );
+ }
+
+// ----------------------------------------------------------------------------
+TInt CHtiScreenshotServicePlugin::Compress()
+ {
+ __ASSERT_ALWAYS(iEncodedBitmap!=NULL,User::Panic(KScreenshotPanic, KErrGeneral));
+ TInt err = KErrNone;
+ HBufC8* zippedTemp = NULL;
+
+ HTI_LOG_FORMAT( "image size %d", iEncodedBitmap->Size() );
+ TInt numOfSteps = 4;
+ TInt comprBufferIncrease = iEncodedBitmap->Size()/numOfSteps;
+
+ //straight way to handle cases
+ //when compressed data larger than uncompressed
+ //try until buffer for compr. data twice bigger than original data
+ for ( TInt i = 0; i < numOfSteps; ++i )
+ {
+ delete zippedTemp;
+ TRAP( err, zippedTemp = HBufC8::NewL( iEncodedBitmap->Size() +
+ i*comprBufferIncrease ) );
+ if ( err == KErrNone )
+ {
+ //try to zip
+ HTI_LOG_TEXT( "try to zip" );
+ TPtr8 zippedTempPtr = zippedTemp->Des();
+ TRAP( err, CEZCompressor::CompressL( zippedTempPtr,
+ *iEncodedBitmap ) );
+ if ( err == KErrNone || err != KEZlibErrBuf )
+ {
+ break;
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if ( err == KErrNone )
+ {
+ delete iEncodedBitmap;
+ iEncodedBitmap = zippedTemp;
+ }
+ else
+ {
+ HTI_LOG_FORMAT( "compre error %d", err );
+ delete zippedTemp;
+ }
+
+ return err;
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::ICLComplete( TInt anError)
+ {
+ HTI_LOG_FUNC_IN( "ICLComplete" );
+
+ //delete what we dont need right away
+ delete iBitmapEncoder;
+ iBitmapEncoder = NULL;
+ delete iICLHandler;
+ iICLHandler = NULL;
+
+
+ if ( anError==KErrNone )
+ {
+ TInt err = KErrNone;
+
+
+ //compress
+ if ( iCompress )
+ {
+ HTI_LOG_TEXT( "compress" );
+ err = Compress();
+ }
+
+ //send
+ if ( err == KErrNone )
+ {
+
+ if ( !iSeriesShot->IsOngoing() )
+ {
+ // Not a series shot
+
+ if ( iDeltaCapture )
+ {
+ // DeltaCapture on
+
+ // If we have encoded the bitmap then we
+ // also have some difference in the bitmap
+
+ HTI_LOG_TEXT( "Sending image with coordinates..." );
+
+ HBufC8* buf = HBufC8::NewL( (4*2) + iEncodedBitmap->Size() );
+ buf->Des().SetLength(4*2);
+ TUint16* ptr = (TUint16*) buf->Des().Ptr();
+ ptr[0] = (TUint16) iDeltaRect.iTl.iX;
+ ptr[1] = (TUint16) iDeltaRect.iTl.iY;
+ ptr[2] = (TUint16) iDeltaRect.iBr.iX;
+ ptr[3] = (TUint16) iDeltaRect.iBr.iY;
+
+ buf->Des().Append(*iEncodedBitmap);
+
+ delete iEncodedBitmap;
+ iEncodedBitmap = NULL;
+
+ // Response also sent in CreateBitmapL
+ err = iDispatcher->DispatchOutgoingMessage(buf,
+ KScreenshotServiceUid);
+ }
+ else
+ {
+ // Normal case
+ HTI_LOG_TEXT( "Sending image..." );
+ err = iDispatcher->DispatchOutgoingMessage(iEncodedBitmap,
+ KScreenshotServiceUid);
+ }
+
+ if ( err == KErrNoMemory )
+ {
+ HTI_LOG_TEXT( "wait for memory" );
+ iDispatcher->AddMemoryObserver( this );
+ }
+ else if ( err == KErrNone )
+ {
+ iEncodedBitmap = NULL;
+ }
+ else //just drop
+ {
+ HTI_LOG_TEXT( "ERROR: Impossible to send image" );
+ delete iEncodedBitmap;
+ iEncodedBitmap = NULL;
+ }
+ }
+ }
+ else
+ {
+ iSeriesShot->Cancel();
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrFailedCompress,
+ KScreenshotServiceUid);
+ delete iEncodedBitmap;
+ iEncodedBitmap = NULL;
+ }
+ }
+ else
+ {
+ iSeriesShot->Cancel();
+ iDispatcher->DispatchOutgoingErrorMessage(
+ anError,
+ KErrDescrFailedConvert,
+ KScreenshotServiceUid);
+ delete iEncodedBitmap;
+ iEncodedBitmap = NULL;
+ }
+
+ if ( iSeriesShot->IsOngoing() )
+ {
+ iSeriesShot->SaveImage( iEncodedBitmap, iCompress );
+ delete iEncodedBitmap;
+ iEncodedBitmap = NULL;
+
+ // Check if there's still more to do
+ if ( iSeriesShot->IsOngoing() )
+ {
+ iSeriesShot->TriggerNewShot();
+ }
+ else
+ {
+ // - No, timer still active
+ // SeriesShot can complete here and in CSeriesShot::TimerExpired
+ SeriesShotCompletedL(iSeriesShot->ConstructCompletedMessageL());
+ }
+ }
+
+ HTI_LOG_FUNC_OUT( "ICLComplete" );
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::NotifyMemoryChange( TInt aAvailableMemory )
+ {
+ if ( iEncodedBitmap )
+ {
+ if ( aAvailableMemory>= iEncodedBitmap->Size() )
+ {
+ TInt err = iDispatcher->DispatchOutgoingMessage(iEncodedBitmap,
+ KScreenshotServiceUid);
+
+ if ( err == KErrNone)
+ {
+ iEncodedBitmap = NULL;
+ iDispatcher->RemoveMemoryObserver( this );
+ }
+ else if ( err != KErrNoMemory )
+ {
+ delete iEncodedBitmap;
+ iEncodedBitmap = NULL;
+ iDispatcher->RemoveMemoryObserver( this );
+ }
+ }
+ }
+ else
+ {
+ //some error, should not be called
+ iDispatcher->RemoveMemoryObserver(this);
+ }
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::SeriesShotCompletedL(HBufC8* aMsg)
+ {
+ HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::SeriesShotCompletedL" );
+ User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+ aMsg,
+ KScreenshotServiceUid) );
+ HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::SeriesShotCompletedL" );
+ }
+
+// ----------------------------------------------------------------------------
+TBool CHtiScreenshotServicePlugin::StartShotL(TRect aRegion, TDisplayMode aDisplayMode, TDesC8 &aMimeType)
+ {
+ HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::StartShot" );
+ CreateBitmapL( aRegion, aDisplayMode );
+
+ if ( aMimeType.Length()==0 )
+ EncodeBitmapL(); //use default encoder BMP
+ else
+ EncodeBitmapL( aMimeType );
+
+ HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::StartShot" );
+ return iScreen ? ETrue : EFalse;
+ }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::SetScreenNumber(TInt aScreenNumber)
+ {
+ HTI_LOG_FUNC_IN("CHtiScreenshotServicePlugin::SetScreenNumber");
+ TInt currentScreen = iScreenDevice->GetScreenNumber();
+ HTI_LOG_FORMAT("current screen: %d", currentScreen);
+ HTI_LOG_FORMAT("new screen number: %d", aScreenNumber);
+ if(aScreenNumber == currentScreen)
+ {
+ return;
+ }
+
+ // Clear the previous delta bitmap to avoid error
+ iPreviousBitmap->Reset();
+ //delete old screendevice and create a new one
+ delete iScreenDevice;
+ iScreenDevice = NULL;
+ iScreenDevice = new (ELeave) CWsScreenDevice(iWs);
+ User::LeaveIfError(iScreenDevice->Construct(aScreenNumber));
+ HTI_LOG_FUNC_OUT("CHtiScreenshotServicePlugin::SetScreenNumber");
+ }
+
+// ----------------------------------------------------------------------------
+CSeriesShot* CSeriesShot::NewL( MSeriesShotObserver* aServicePlugin )
+ {
+ HTI_LOG_FUNC_IN( "CSeriesShot::NewL" );
+ CSeriesShot* self = new (ELeave) CSeriesShot( aServicePlugin );
+ CleanupStack::PushL (self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "CSeriesShot::NewL" );
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::ConstructL()
+ {
+ User::LeaveIfError(iFs.Connect());
+ }
+
+// ----------------------------------------------------------------------------
+CSeriesShot::CSeriesShot( MSeriesShotObserver* aServicePluginObserver ):
+ iServicePluginObserver( aServicePluginObserver ),
+ iDurationTimer( NULL ),
+ iIntervalTimer( NULL ),
+ isEncoding( EFalse )
+ {
+ }
+
+// ----------------------------------------------------------------------------
+CSeriesShot::~CSeriesShot()
+ {
+ Cancel();
+ iFs.Close();
+ }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::ClearShots()
+ {
+ HTI_LOG_FUNC_IN( "CSeriesShot::ClearShots" );
+
+ iFs.MkDirAll( KSeriesShotPath );
+
+ // Delete all files
+ TFileName files;
+ files.Append( KSeriesShotPath );
+ files.Append( _L( "*.*" ) );
+ HTI_LOG_DES(files);
+
+
+ CFileMan *fileman = CFileMan::NewL( iFs );
+ TInt err = fileman->Delete( files );
+ HTI_LOG_FORMAT( "delete %d", err );
+ if ( err != KErrNotFound )
+ User::LeaveIfError( err );
+ delete fileman;
+
+
+ HTI_LOG_FUNC_OUT( "CSeriesShot::ClearShots" );
+ }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::StartL( TTimeIntervalMicroSeconds32 aDuration,
+ TTimeIntervalMicroSeconds32 aInterval,
+ TDisplayMode aDisplayMode,
+ TRect aRegion,
+ TPtrC8 aMime )
+ {
+ HTI_LOG_FUNC_IN( "CSeriesShot::StartL" );
+ HTI_LOG_FORMAT( "Duration : %d microseconds", aDuration.Int() );
+ HTI_LOG_FORMAT( "Interval : %d microseconds", aInterval.Int() );
+ HTI_LOG_FORMAT( "Displaymode : %d", aDisplayMode );
+ HTI_LOG_FORMAT( "TopLeft X : %d", aRegion.iTl.iX );
+ HTI_LOG_FORMAT( "TopLeft Y : %d", aRegion.iTl.iY );
+ HTI_LOG_FORMAT( "BottomRight X : %d", aRegion.iBr.iX );
+ HTI_LOG_FORMAT( "BottomRight Y : %d", aRegion.iBr.iY );
+
+ iDisplayMode = aDisplayMode;
+ iRegion = aRegion;
+ iIndex = 0;
+
+ iMimeType.Zero();
+ iMimeType.Append( aMime );
+ HTI_LOG_DES( iMimeType );
+
+#ifdef __ENABLE_LOGGING__
+ HTI_LOG_TEXT( "Supported MIME types:" );
+ RFileExtensionMIMETypeArray array;
+ CImageEncoder::GetFileTypesL( array );
+ for ( TInt i = 0; i < array.Count(); i++ )
+ HTI_LOG_DES( array[i]->MIMEType() );
+ array.ResetAndDestroy();
+#endif
+
+ iExtension.Zero();
+ if ( iMimeType.Length() == 0 )
+ iExtension.Append( _L( ".bmp" ) );
+ else
+ GetMIMEExtension( iMimeType, iExtension );
+
+ ClearShots();
+
+ iDurationTimer = CSeriesShotTimer::NewL( this, EDuration, aDuration );
+ iIntervalTimer = CSeriesShotTimer::NewL( this, EInterval, aInterval );
+ iDurationTimer->Start();
+ TimerExpired( EInterval ); // trigger first shot immidietly
+
+ HTI_LOG_FUNC_OUT( "CSeriesShot::StartL" );
+ }
+
+void CSeriesShot::TimerExpired( TInt aId )
+ {
+ HTI_LOG_FUNC_IN( "CSeriesShot::TimerExpired" );
+ switch ( aId )
+ {
+ case EDuration:
+ HTI_LOG_TEXT( "EDuration" );
+
+ delete iDurationTimer;
+ iDurationTimer = NULL;
+
+ if ( iIntervalTimer ) // I'm paranoid
+ {
+ delete iIntervalTimer;
+ iIntervalTimer = NULL;
+ }
+ // SeriesShot can complete here and in CHtiScreenshotServicePlugin::ICLComplete
+ if ( isEncoding == EFalse )
+ iServicePluginObserver->SeriesShotCompletedL( ConstructCompletedMessageL() );
+
+ break;
+
+ case EInterval:
+ HTI_LOG_TEXT( "EInterval" );
+
+ isEncoding = iServicePluginObserver->StartShotL( iRegion, iDisplayMode, iMimeType );
+
+ break;
+
+ default:
+ break;
+ }
+ HTI_LOG_FUNC_OUT( "CSeriesShot::TimerExpired" );
+ }
+
+// ----------------------------------------------------------------------------
+TBool CSeriesShot::IsOngoing()
+ {
+ // It still might be encoding when duration timer has expired
+ return ( iDurationTimer || isEncoding ) ? ETrue : EFalse;
+ }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::SaveImage( TDesC8* aImage, TBool isCompressed )
+ {
+ HTI_LOG_FUNC_IN( "CSeriesShot::SaveImage" );
+
+ isEncoding = EFalse;
+
+ TFileName filename( KSeriesShotPath );
+ filename.AppendFormat( _L( "%04d" ), iIndex );
+ iIndex++;
+ filename.Append( iExtension );
+ if ( isCompressed )
+ filename.Append( _L( "z" ) );
+ HTI_LOG_DES( filename );
+
+ RFile file;
+ User::LeaveIfError( file.Create( iFs, filename, EFileWrite ) );
+ User::LeaveIfError( file.Write( *aImage ) );
+ file.Close();
+
+ HTI_LOG_FUNC_IN( "CSeriesShot::SaveImage" );
+ }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::TriggerNewShot()
+ {
+ if ( iDurationTimer )
+ iIntervalTimer->Start();
+ }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::Cancel()
+ {
+ if ( iDurationTimer )
+ {
+ delete iDurationTimer;
+ iDurationTimer = NULL;
+ }
+ if ( iIntervalTimer )
+ {
+ delete iIntervalTimer;
+ iIntervalTimer = NULL;
+ }
+ ClearShots();
+ }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::EncodeCompleted()
+ {
+ isEncoding = EFalse;
+ }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::GetMIMEExtension( TDesC8 &aMime, TDes &aExt )
+ {
+ RFileExtensionMIMETypeArray array;
+ CImageEncoder::GetFileTypesL( array );
+ for ( TInt i = 0; i < array.Count(); i++ )
+ {
+ if ( array[i]->MIMEType() == aMime )
+ aExt.Append( array[i]->FileExtension() );
+ }
+ array.ResetAndDestroy();
+
+ if ( aExt == KNullDesC ) // should not happen
+ aExt.Append( _L( ".xxx" ) );
+ }
+
+// ----------------------------------------------------------------------------
+HBufC8* CSeriesShot::ConstructCompletedMessageL()
+ {
+ HTI_LOG_FUNC_IN( "CSeriesShot::ConstructCompletedMessageL" );
+ // Serialshot completed send ok message.
+
+ CDir* dir = NULL;
+ User::LeaveIfError( iFs.GetDir(
+ KSeriesShotPath, KEntryAttNormal, ESortByName, dir ) );
+
+ TInt msgSize = 0;
+
+ if ( dir->Count() == 0 )
+ {
+ HTI_LOG_TEXT( "No shots found! Leaving..." );
+ User::Leave( KErrNotFound );
+ }
+
+ for ( TInt i = 0; i < dir->Count(); i++ )
+ {
+ msgSize += 1; // for length field
+ msgSize += KSeriesShotPath().Length();
+ msgSize += (*dir)[i].iName.Length();
+ }
+
+ HBufC8* msg = HBufC8::NewL( msgSize );
+
+ for ( TInt i = 0; i < dir->Count(); i++ )
+ {
+ msg->Des().Append( KSeriesShotPath().Length() + (*dir)[i].iName.Length() );
+ msg->Des().Append( KSeriesShotPath );
+ msg->Des().Append( (*dir)[i].iName );
+ }
+
+ delete dir;
+
+ HTI_LOG_FUNC_OUT( "CSeriesShot::ConstructCompletedMessageL" );
+ return msg;
+ }
+
+// ----------------------------------------------------------------------------
+CSeriesShotTimer* CSeriesShotTimer::NewL( MSeriesShotTimerObserver* aObserver,
+ TInt aId,
+ TTimeIntervalMicroSeconds32 aTime )
+ {
+ HTI_LOG_FUNC_IN( "CSeriesShotTimer::NewL" );
+ CSeriesShotTimer* self = new (ELeave) CSeriesShotTimer( aObserver, aId, aTime );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ HTI_LOG_FUNC_OUT( "CSeriesShotTimer::NewL" );
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+void CSeriesShotTimer::ConstructL()
+ {
+ HTI_LOG_FUNC_IN( "CSeriesShotTimer::ConstructL" );
+ CTimer::ConstructL();
+ if ( !IsAdded() ) // CTimer should add it but it seems that it does NOT!
+ {
+ CActiveScheduler::Add( this );
+ }
+ HTI_LOG_FUNC_OUT( "CSeriesShotTimer::ConstructL" );
+ }
+
+// ----------------------------------------------------------------------------
+CSeriesShotTimer::CSeriesShotTimer( MSeriesShotTimerObserver* aObserver,
+ TInt aId,
+ TTimeIntervalMicroSeconds32 aTime ):
+ CTimer( EPriorityStandard ),
+ iObserver( aObserver ),
+ iId( aId ),
+ iTime( aTime )
+ {
+ }
+
+// ----------------------------------------------------------------------------
+CSeriesShotTimer::~CSeriesShotTimer()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+void CSeriesShotTimer::RunL()
+ {
+ iObserver->TimerExpired( iId );
+ }
+
+// ----------------------------------------------------------------------------
+void CSeriesShotTimer::Start()
+ {
+ HTI_LOG_FORMAT( "Start CSeriesShotTimer : %d microseconds", iTime.Int() );
+ After( iTime );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/HtiTextRcg.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,955 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Text recognition algorithm implementation.
+*
+*/
+
+
+#include "HtiTextRcg.h"
+#include <HtiLogging.h>
+
+const static TInt KDefaultStrategy = EHintEdge;
+
+TInt CompareTPoint(const TPoint& aP1,const TPoint& aP2)
+ {
+ //this functions is used only to avoid equal points when creating FGA or BGA
+ //so only equality of points is important, order doesnt matter
+ if ( aP1.iY == aP2.iY )
+ return aP1.iX - aP2.iX;
+ return aP1.iY - aP2.iY;
+ }
+
+CHtiTextRcg::CHtiTextRcg()
+ {
+ iAvgDiffMin = KDefaultAvgDiffMin;
+ //minimal SS for foreground, with plain color should be 0
+ iFgSSMin = KDefaultFgSSMin;
+ iFgAvgDiffMin = KDefaultFgAvgDiffMin;
+
+ iFGAAmount = KDefaultFGAAmount;
+ iBGAAmount = KDefaultBGAAmount;
+
+ SetHint(KDefaultStrategy);
+ }
+
+CHtiTextRcg::~CHtiTextRcg()
+ {
+ iFGASet.Close();
+ iBGASet.Close();
+ }
+
+void CHtiTextRcg::SetHint(TInt aHint)
+ {
+ //selects strategy and algorithm parameters
+ switch ( aHint )
+ {
+ case EHintEdge:
+ {
+ //AA strategy
+ iCurrentStrategy = EHintEdge;
+ }
+ break;
+ case EHintNone:
+ default:
+ {
+ //default strategy
+ iCurrentStrategy = EHintNone;
+ }
+ }
+ }
+
+
+TBool CHtiTextRcg::RecognizeTextL(CFbsBitmap* aScreenshot,
+ const TDesC& aText,
+ const CFont* aFont,
+ TRect& aResult)
+ {
+HTI_LOG_FUNC_IN("RecognizeTextL");
+ TInt returnValue = KWorstCase;
+
+ CFbsBitmap* gray = ColorDownL(aScreenshot);
+ CleanupStack::PushL(gray);
+
+ switch ( iCurrentStrategy )
+ {
+ case EHintEdge:
+ {
+ returnValue = RecognizeAAL(gray,aText, aFont, aResult);
+ }
+ break;
+ case EHintNone:
+ default:
+ {
+ returnValue = RecognizeBinL(gray,aText, aFont, aResult);
+ }
+ }
+
+ CleanupStack::PopAndDestroy(gray);
+HTI_LOG_FUNC_OUT("RecognizeTextL");
+ return returnValue < KSuccessThresold;
+ }
+
+TInt CHtiTextRcg::RecognizeBinL(CFbsBitmap* aScreenshot,
+ const TDesC& aText,
+ const CFont* aFont,
+ TRect& aResult)
+{
+ HTI_LOG_FUNC_IN("RecognizeBinL");
+ CFbsBitmap* searchFirstLetter = GetTextBitmapL(aText, aFont, 1);
+ CleanupStack::PushL(searchFirstLetter);
+ HTI_LOG_FORMAT("pattern size w %d", searchFirstLetter->SizeInPixels().iWidth);
+ HTI_LOG_FORMAT("pattern size h %d", searchFirstLetter->SizeInPixels().iHeight);
+
+ if ( !AnalyzePatternL(searchFirstLetter) )
+ {
+ CleanupStack::PopAndDestroy(searchFirstLetter);
+ return KWorstCase;
+ }
+ CFbsBitmap* searchText = GetTextBitmapL(aText, aFont);
+ CleanupStack::PushL(searchText);
+
+ //search range (0,0) - (reg.Size() - searchText.SizeInPixels)
+ TPoint end(aScreenshot->SizeInPixels().iWidth, aScreenshot->SizeInPixels().iHeight);
+ end -= searchText->SizeInPixels();
+ end += TPoint(1,1);
+
+ //search itself
+ for ( TPoint p( 0, 0 ); p.iY < end.iY; p.iY++ )
+ {
+ for ( p.iX = 0; p.iX < end.iX; p.iX++ )
+ {
+ TInt t = ImageDiffBinSampleL(aScreenshot, p, searchFirstLetter);
+ if ( t == 0 )
+ {
+ //check full word
+ TInt wordD = ImageDiffBinFullL(aScreenshot, p, searchText);
+ if ( wordD == 0 )
+ {
+ aResult.iTl.iX = p.iX;
+ aResult.iTl.iY = p.iY;
+ aResult.SetSize(searchText->SizeInPixels());
+ CleanupStack::PopAndDestroy(searchText);
+ CleanupStack::PopAndDestroy(searchFirstLetter);
+ HTI_LOG_FUNC_OUT("RecognizeBinL");
+ return 0;
+ }
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy(searchText);
+ CleanupStack::PopAndDestroy(searchFirstLetter);
+
+ HTI_LOG_FUNC_OUT("RecognizeBinL");
+ return KWorstCase;
+}
+
+
+TInt CHtiTextRcg::RecognizeAAL(CFbsBitmap* aScreenshot,
+ const TDesC& aText,
+ const CFont* aFont,
+ TRect& aResult)
+{
+ HTI_LOG_FUNC_IN("RecognizeAAL");
+ CFbsBitmap* searchFirstLetter = GetTextBitmapL(aText, aFont, 1);
+ CleanupStack::PushL(searchFirstLetter);
+ if ( !AnalyzePatternL(searchFirstLetter) )
+ {
+ CleanupStack::PopAndDestroy(searchFirstLetter);
+ return KWorstCase;
+ }
+
+ CFbsBitmap* searchText = GetTextBitmapL(aText, aFont);
+ CleanupStack::PushL(searchText);
+
+
+ //search range (0,0) - (reg.Size() - searchText.SizeInPixels)
+ TPoint end(aScreenshot->SizeInPixels().iWidth, aScreenshot->SizeInPixels().iHeight);
+ end -= searchText->SizeInPixels();
+ end += TPoint(1,1);
+
+ //search itself
+ TInt min = KSuccessThresold;
+ TInt wordMin = KSuccessThresold;
+
+ for ( TPoint p( 0, 0 ); p.iY < end.iY; p.iY++ )
+ {
+ for ( p.iX = 0; p.iX < end.iX; p.iX++ )
+ {
+ TInt t = ImageDiffAASampleL(aScreenshot, p, searchFirstLetter);
+ if ( t < min )
+ {
+ //check full word
+ TInt wordD = ImageDiffAAFullL(aScreenshot, p, searchText);
+ if ( wordD < wordMin )
+ {
+ wordMin = wordD;
+ min = t;
+ aResult.iTl.iX = p.iX;
+ aResult.iTl.iY = p.iY;
+ aResult.SetSize(searchText->SizeInPixels());
+ if ( wordMin == 0 )
+ {
+ CleanupStack::PopAndDestroy(searchText);
+ CleanupStack::PopAndDestroy(searchFirstLetter);
+ HTI_LOG_FUNC_OUT("RecognizeAAL");
+ return 0;
+ }
+ }
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy(searchText);
+ CleanupStack::PopAndDestroy(searchFirstLetter);
+
+ HTI_LOG_FUNC_OUT("RecognizeAAL");
+
+ return wordMin;
+}
+
+TBool CHtiTextRcg::AnalyzePatternL(CFbsBitmap * aPattern)
+{
+ HTI_LOG_FUNC_IN("AnalyzePatternL");
+ if ( aPattern->SizeInPixels().iWidth == 0 ||
+ aPattern->SizeInPixels().iHeight == 0 )
+ {
+ return EFalse;
+ }
+ //points are selected as follow
+ //take pair of FG-BG points which located next to each other
+ MinMax(aPattern,
+ iMaskFgColor, //min, black font
+ iMaskBgColor);//max, white bg
+
+ if ( iMaskFgColor == iMaskBgColor ) //pattern is empty
+ {
+ return EFalse;
+ }
+
+ TLinearOrder<TPoint> pointOrder(CompareTPoint);
+ TSize borders = aPattern->SizeInPixels();
+ iFGASet.Reset();
+ iBGASet.Reset();
+
+ TBitmapUtil bmpIterator(aPattern);
+ //lock bitmap
+ bmpIterator.Begin( TPoint(0,0));
+
+ //first take center lines and find take at least two pairs
+ //vertical1
+ TPoint startPoint(borders.iWidth/2, 0);
+ bmpIterator.SetPos(startPoint);
+
+ TInt lastColor = bmpIterator.GetPixel()&0xff;
+ TInt lastColorPos = 0;
+ bmpIterator.IncYPos();
+ TInt i=1;
+ TInt found = 0;
+
+ while ( found < 2 && i < borders.iHeight )
+ {
+ TInt c = bmpIterator.GetPixel()&0xff;
+
+ if ( lastColor != c )
+ {
+ if ( c == iMaskFgColor )
+ {
+ iFGASet.InsertInOrder(TPoint(startPoint.iX, i), pointOrder);
+ iBGASet.InsertInOrder(TPoint(startPoint.iX, lastColorPos), pointOrder);
+ lastColor = c;
+ lastColorPos = i;
+ ++found;
+ }
+ else if ( c == iMaskBgColor )
+ {
+ iBGASet.InsertInOrder(TPoint(startPoint.iX, i), pointOrder);
+ iFGASet.InsertInOrder(TPoint(startPoint.iX, lastColorPos), pointOrder);
+ lastColor = c;
+ lastColorPos = i;
+ ++found;
+ }
+ }
+ else
+ {
+ lastColorPos = i;
+ }
+
+ ++i;
+ bmpIterator.IncYPos();
+ }
+
+ //horizontal1
+ startPoint.SetXY(0,borders.iHeight/2);
+ bmpIterator.SetPos(startPoint);
+ lastColor = bmpIterator.GetPixel()&0xff;
+ bmpIterator.IncXPos();
+ i=1;
+ found = 0;
+ lastColorPos = 0;
+
+ while ( found < 2 && i < borders.iWidth )
+ {
+ TInt c = bmpIterator.GetPixel()&0xff;
+
+ if ( lastColor != c )
+ {
+ if ( c == iMaskFgColor )
+ {
+ iFGASet.InsertInOrder(TPoint(i, startPoint.iY), pointOrder);
+ iBGASet.InsertInOrder(TPoint(lastColorPos, startPoint.iY), pointOrder);
+ lastColor = c;
+ lastColorPos = i;
+ ++found;
+ }
+ else if ( c == iMaskBgColor )
+ {
+ iBGASet.InsertInOrder(TPoint(i, startPoint.iY), pointOrder);
+ iFGASet.InsertInOrder(TPoint(lastColorPos, startPoint.iY), pointOrder);
+ lastColor = c;
+ lastColorPos = i;
+ ++found;
+ }
+ }
+ else
+ {
+ lastColorPos = i;
+ }
+ ++i;
+ bmpIterator.IncXPos();
+ }
+
+ //unlock bitmap
+ bmpIterator.End();
+
+ iFGAAmount = iFGASet.Count();
+ iBGAAmount = iBGASet.Count();
+
+ HTI_LOG_FUNC_OUT("AnalyzePatternL");
+ return ETrue;
+
+}
+
+TInt CHtiTextRcg::ImageDiffAASampleL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+ CFbsBitmap * aBitmap2)
+ {
+
+ if (iFGASet.Count()==0 || iBGASet.Count()==0)
+ return KWorstCase;
+
+ TSize aSize = aBitmap2->SizeInPixels();
+
+ //straight average difference
+ TBitmapUtil bmpIterator1(aBitmap1);
+ TBitmapUtil bmpIterator2(aBitmap2);
+
+ bmpIterator1.Begin( aOrigin1 );
+
+ //1. check FGA points are equal
+ bmpIterator1.SetPos( aOrigin1 + iFGASet[0]);
+ iTestFgColor = bmpIterator1.GetPixel()&0xff;
+
+ for ( TInt i = 1; i < iFGAAmount;++i )
+ {
+ bmpIterator1.SetPos( aOrigin1 + iFGASet[i]);
+ TInt c = bmpIterator1.GetPixel()&0xff;
+ if ( Abs(c-iTestFgColor) > iFgAvgDiffMin )
+ {
+ bmpIterator2.End();
+ bmpIterator1.End();
+ return KWorstCase;
+ }
+ }
+ // if we are here all FGA points are equal to colorFGA
+ //2. check that avg BGA point value is not equal to colorFGA
+ iTestBgColor = 0;
+ for ( TInt i = 0; i < iBGAAmount; ++i )
+ {
+ bmpIterator1.SetPos( aOrigin1 + iBGASet[i]);
+ iTestBgColor += bmpIterator1.GetPixel()&0xff;
+ }
+ iTestBgColor /= iBGAAmount;
+ //if difference is too small leave with false
+ if ( Abs(iTestBgColor-iTestFgColor) < iAvgDiffMin )
+ {
+ bmpIterator2.End();
+ bmpIterator1.End();
+ return KWorstCase;
+ }
+
+ //all checking based on FGA and BGA are correct, chance to have match
+ //3. calculate sum of diff between colorFGA and ALL FG points
+ bmpIterator1.End();
+ bmpIterator1.Begin( aOrigin1 );
+ bmpIterator2.Begin( TPoint(0,0), bmpIterator1 );
+
+ TInt nofF = 0;
+ TInt sum = 0;
+ TBool iterFlag = EFalse;
+
+ TInt rowDelta = 2;
+ TInt columnDelta = 1;
+
+ TBool intellFlagBG;
+ iTestNormCoef = (Abs(iMaskFgColor-iMaskBgColor)<<KNormCoefAcc)/Abs(iTestFgColor-iTestBgColor);
+
+ for ( TInt i = 0; i < aSize.iHeight; i += rowDelta )
+ {
+ intellFlagBG = EFalse;
+ for ( TInt j = 0; j < aSize.iWidth; j += columnDelta )
+ {
+ TInt c1 = (bmpIterator1.GetPixel())&0xff;
+ TInt c2 = (bmpIterator2.GetPixel())&0xff;
+
+ if ( c2 != iMaskBgColor ) // if foreground
+ {
+ if ( c2 == iMaskFgColor ) //should be "pure" FG
+ {
+ if ( Abs( c1 - iTestFgColor ) > iFgAvgDiffMin )
+ {
+ bmpIterator2.End();
+ bmpIterator1.End();
+ return KWorstCase;
+ }
+ intellFlagBG = ETrue;
+ }
+ else if ( intellFlagBG ) // AA pixels
+ {
+ //calculate diff. in relative diff in aa pixel
+ //in mask and searh image
+ //based on assumtion that aa pixels color
+ // relative to fg color should correlate
+ TInt normD = (Abs(c1-iTestFgColor)*iTestNormCoef)>>KNormCoefAcc;
+ sum += Abs(Abs(iMaskFgColor-c2) - normD );
+
+ ++nofF;
+ intellFlagBG = EFalse;
+
+ }
+ }
+ for ( TInt l = 0; l < columnDelta; l++ )
+ {
+ if ( iterFlag )
+ {
+ bmpIterator1.DecXPos();
+ bmpIterator2.DecXPos();
+ }
+ else
+ {
+ bmpIterator1.IncXPos();
+ bmpIterator2.IncXPos();
+ }
+ }
+ }
+
+ for ( int k = 0; k < rowDelta; k++ )
+ {
+ bmpIterator1.IncYPos();
+ bmpIterator2.IncYPos();
+ }
+ for ( int l = 0; l < columnDelta; l++ )
+ {
+ if ( iterFlag )
+ {
+ bmpIterator1.IncXPos();
+ bmpIterator2.IncXPos();
+ }
+ else
+ {
+ bmpIterator1.DecXPos();
+ bmpIterator2.DecXPos();
+ }
+ }
+ iterFlag = !iterFlag;
+ }
+
+
+ bmpIterator2.End();
+ bmpIterator1.End();
+
+ if ( nofF == 0 )
+ {
+ return 0;
+ }
+ return sum / nofF;
+ }
+
+
+TInt CHtiTextRcg::ImageDiffAAFullL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+ CFbsBitmap * aBitmap2)
+ {
+ TSize aSize = aBitmap2->SizeInPixels();
+ //straight average difference
+ TBitmapUtil bmpIterator1(aBitmap1);
+ TBitmapUtil bmpIterator2(aBitmap2);
+
+ bmpIterator1.Begin( aOrigin1 );
+ bmpIterator2.Begin( TPoint(0,0), bmpIterator1 );
+
+ TInt nofF = 0;
+ TInt sumF = 0;
+ TBool intellFlagBG;
+ TBool iterFlag = EFalse;
+ TInt rowDelta = 2;
+ TInt columnDelta = 1;
+
+ for ( TInt i = 0; i < aSize.iHeight; i += rowDelta )
+ {
+ intellFlagBG = EFalse;
+ for ( TInt j = 0; j < aSize.iWidth; j += columnDelta )
+ {
+ TInt c1 = ( bmpIterator1.GetPixel() ) & 0xff;
+ TInt c2 = ( bmpIterator2.GetPixel() ) & 0xff;
+
+ if ( c2 != iMaskBgColor ) // if foreground
+ {
+ if ( c2 == iMaskFgColor ) //should be pure FG
+ {
+ if ( Abs(c1 - iTestFgColor) > iFgAvgDiffMin )
+ {
+ bmpIterator2.End();
+ bmpIterator1.End();
+ return KWorstCase;
+ }
+ intellFlagBG = ETrue;
+ }
+ else if ( intellFlagBG ) // AA pixels
+ {
+ //calculate diff. in relative diff in aa pixel
+ //in mask and searh image
+ //based on assumtion that aa pixels color
+ // relative to fg color should correlate
+ TInt normD = (Abs(c1-iTestFgColor)*iTestNormCoef)>>KNormCoefAcc;
+ sumF += Abs(Abs(iMaskFgColor-c2) - normD );
+
+ ++nofF;
+ intellFlagBG = EFalse;
+ }
+ }
+ for ( TInt l = 0; l < columnDelta; l++ )
+ {
+ if ( iterFlag )
+ {
+ bmpIterator1.DecXPos();
+ bmpIterator2.DecXPos();
+ }
+ else
+ {
+ bmpIterator1.IncXPos();
+ bmpIterator2.IncXPos();
+ }
+ }
+ }
+
+ for ( TInt k = 0; k < rowDelta; k++ )
+ {
+ bmpIterator1.IncYPos();
+ bmpIterator2.IncYPos();
+ }
+ for ( TInt l = 0; l < columnDelta; l++ )
+ {
+ if ( iterFlag )
+ {
+ bmpIterator1.IncXPos();
+ bmpIterator2.IncXPos();
+ }
+ else
+ {
+ bmpIterator1.DecXPos();
+ bmpIterator2.DecXPos();
+ }
+ }
+ iterFlag = !iterFlag;
+ }
+ bmpIterator2.End();
+ bmpIterator1.End();
+
+ if ( nofF == 0 )
+ return 0;
+
+ return sumF/nofF;
+ }
+
+TInt CHtiTextRcg::ImageDiffBinSampleL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+ CFbsBitmap * aBitmap2)
+ {
+ TSize aSize = aBitmap2->SizeInPixels();
+ if ( iFGASet.Count() == 0 || iBGASet.Count() == 0 )
+ return KWorstCase;
+
+ //straight average difference
+ TBitmapUtil bmpIterator1(aBitmap1);
+ TBitmapUtil bmpIterator2(aBitmap2);
+
+ bmpIterator1.Begin( aOrigin1 );
+
+ //1. check FGA points are equal
+ bmpIterator1.SetPos( aOrigin1 + iFGASet[0]);
+ TInt colorFGA = bmpIterator1.GetPixel()&0xff;
+
+ for ( TInt i = 1; i < iFGAAmount; ++i )
+ {
+ bmpIterator1.SetPos( aOrigin1 + iFGASet[i] );
+ TInt c = bmpIterator1.GetPixel()&0xff;
+ if ( c != colorFGA )
+ {
+ bmpIterator2.End();
+ bmpIterator1.End();
+ return KWorstCase;
+ }
+ }
+ // if we are here all FGA points are equal to colorFGA
+ //2. check that avg BGA point value is not equal to colorFGA
+ TInt avgColorBGA = 0;
+ for ( TInt i = 0; i < iBGAAmount; ++i )
+ {
+ bmpIterator1.SetPos( aOrigin1 + iBGASet[i] );
+ avgColorBGA += bmpIterator1.GetPixel() & 0xff;
+ }
+ avgColorBGA /= iBGAAmount;
+ //if difference is too small leave with false
+ if ( Abs(avgColorBGA-colorFGA) < iAvgDiffMin )
+ {
+ bmpIterator2.End();
+ bmpIterator1.End();
+ return KWorstCase;
+ }
+
+ //all checking based on FGA and BGA are correct, chance to have math
+ //3. calculate sum of diff between colorFGA and ALL FG points
+ bmpIterator1.End();
+ bmpIterator1.Begin( aOrigin1 );
+ bmpIterator2.Begin( TPoint(0,0), bmpIterator1 );
+
+ TBool iterFlag = EFalse;
+
+ TInt rowDelta = 1;
+ TInt columnDelta = 1;
+
+ for ( TInt i = 0; i < aSize.iHeight; i += rowDelta )
+ {
+ for ( TInt j = 0; j < aSize.iWidth; j += columnDelta )
+ {
+ TInt c1 = ( bmpIterator1.GetPixel() ) & 0xff;
+ TInt c2 = ( bmpIterator2.GetPixel() ) & 0xff;
+
+ if ( c2 == iMaskFgColor ) // if foreground
+ {
+ if ( colorFGA != c1 )
+ {
+ bmpIterator2.End();
+ bmpIterator1.End();
+ return KWorstCase;
+ }
+ }
+ for ( TInt l = 0; l < columnDelta; l++ )
+ {
+ if ( iterFlag )
+ {
+ bmpIterator1.DecXPos();
+ bmpIterator2.DecXPos();
+ }
+ else
+ {
+ bmpIterator1.IncXPos();
+ bmpIterator2.IncXPos();
+ }
+ }
+ }
+
+ for ( TInt k = 0; k < rowDelta; k++ )
+ {
+ bmpIterator1.IncYPos();
+ bmpIterator2.IncYPos();
+ }
+ for ( TInt l = 0; l < columnDelta; l++ )
+ {
+ if ( iterFlag )
+ {
+ bmpIterator1.IncXPos();
+ bmpIterator2.IncXPos();
+ }
+ else
+ {
+ bmpIterator1.DecXPos();
+ bmpIterator2.DecXPos();
+ }
+ }
+ iterFlag = !iterFlag;
+ }
+
+
+ bmpIterator2.End();
+ bmpIterator1.End();
+
+ return 0;
+ }
+
+TInt CHtiTextRcg::ImageDiffBinFullL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+ CFbsBitmap * aBitmap2)
+ {
+ TSize aSize = aBitmap2->SizeInPixels();
+ //straight average difference
+ TBitmapUtil bmpIterator1(aBitmap1);
+ TBitmapUtil bmpIterator2(aBitmap2);
+
+ bmpIterator1.Begin( aOrigin1 );
+ bmpIterator2.Begin( TPoint(0,0), bmpIterator1 );
+
+ //TInt nofF = 0;
+ TInt nofB = 0;
+
+ TInt sumB = 0;
+ //TInt sumF = 0;
+ TBool intellFlagBG;
+ TBool iterFlag = EFalse;
+ TInt rowDelta = 1;
+ TInt columnDelta = 1;
+ TInt fgColor = -1;
+ for ( TInt i = 0; i < aSize.iHeight; i += rowDelta )
+ {
+ intellFlagBG = EFalse;
+ for ( TInt j = 0; j < aSize.iWidth; j += columnDelta )
+ {
+ TInt c1 = ( bmpIterator1.GetPixel() ) & 0xff;
+ TInt c2 = ( bmpIterator2.GetPixel() ) & 0xff;
+
+ if ( c2 == iMaskFgColor ) // if FG
+ {
+ if ( c1 != fgColor )
+ {
+ if ( fgColor != -1 )
+ {
+ //failed
+ bmpIterator2.End();
+ bmpIterator1.End();
+ return KWorstCase;
+ }
+ else
+ {
+ fgColor = c1; //init fgColor
+ }
+ }
+ intellFlagBG = ETrue;
+ }
+ else if ( c2 == iMaskBgColor && intellFlagBG )
+ {
+ sumB += c1;
+ ++nofB;
+ intellFlagBG = EFalse;
+ }
+ for ( TInt l = 0; l < columnDelta; l++ )
+ {
+ if ( iterFlag )
+ {
+ bmpIterator1.DecXPos();
+ bmpIterator2.DecXPos();
+ }
+ else
+ {
+ bmpIterator1.IncXPos();
+ bmpIterator2.IncXPos();
+ }
+ }
+ }
+
+ for ( TInt k = 0; k < rowDelta; k++ )
+ {
+ bmpIterator1.IncYPos();
+ bmpIterator2.IncYPos();
+ }
+ for ( TInt l = 0; l < columnDelta; l++ )
+ {
+ if ( iterFlag )
+ {
+ bmpIterator1.IncXPos();
+ bmpIterator2.IncXPos();
+ }
+ else
+ {
+ bmpIterator1.DecXPos();
+ bmpIterator2.DecXPos();
+ }
+ }
+ iterFlag = !iterFlag;
+ }
+ bmpIterator2.End();
+ bmpIterator1.End();
+
+ if ( nofB == 0 ) //something wrong, should be some BG
+ return KWorstCase;
+
+ TInt avgB = sumB / ( nofB );
+
+ if ( Abs( fgColor - avgB ) < iAvgDiffMin )
+ {
+ return KWorstCase;
+ }
+
+ return 0;
+ }
+
+void CHtiTextRcg::MinMax(CFbsBitmap * aBitmap, TInt& aMin, TInt& aMax)
+ {
+ //straight average difference
+ TSize aSize = aBitmap->SizeInPixels();
+ TBitmapUtil bmpIterator(aBitmap);
+
+ bmpIterator.Begin( TPoint(0,0) );
+
+ aMin = KMaxTInt;
+ aMax = -1;
+ for ( TInt i = 0; i < aSize.iHeight; ++i )
+ {
+ for ( TInt j = 0; j < aSize.iWidth; ++j )
+ {
+ TInt c = ( bmpIterator.GetPixel() ) & 0xff;
+
+ if ( c < aMin )
+ {
+ aMin = c;
+ }
+ else if ( c > aMax )
+ {
+ aMax = c;
+ }
+
+ if ( i & 1 )
+ {
+ bmpIterator.DecXPos();
+ }
+ else
+ {
+ bmpIterator.IncXPos();
+ }
+ }
+ bmpIterator.IncYPos();
+
+ if ( i & 1 )
+ {
+ bmpIterator.IncXPos();
+ }
+ else
+ {
+ bmpIterator.DecXPos();
+ }
+ }
+
+ bmpIterator.End();
+ }
+
+CFbsBitmap* CHtiTextRcg::ColorDownL( CFbsBitmap * aBitmap )
+ {
+ TSize bmpSize = aBitmap->SizeInPixels();
+ CFbsBitmap* result = new ( ELeave ) CFbsBitmap();
+ User::LeaveIfError( result->Create( bmpSize, EGray256 ) );
+
+ TBitmapUtil srcBmpIterator( aBitmap );
+ TBitmapUtil resultBmpIterator( result );
+
+ srcBmpIterator.Begin( TPoint( 0, 0 ) );
+ resultBmpIterator.Begin( TPoint( 0, 0 ), srcBmpIterator );
+
+ TPoint point( 0, 0 );
+ for ( point.iY = 0; point.iY < bmpSize.iHeight; ++point.iY )
+ {
+ point.iX = 0;
+ srcBmpIterator.SetPos( point );
+ resultBmpIterator.SetPos( point );
+ for ( ; point.iX < bmpSize.iWidth; ++point.iX )
+ {
+ TUint32 c = srcBmpIterator.GetPixel();
+ TRgb col( c );
+ resultBmpIterator.SetPixel( col.Gray256() );
+ srcBmpIterator.IncXPos();
+ resultBmpIterator.IncXPos();
+ }
+ }
+
+ resultBmpIterator.End();
+ srcBmpIterator.End();
+
+ return result;
+ }
+
+CFbsBitmap* CHtiTextRcg::GetTextBitmapL( const TDesC& aText,
+ const CFont* fontUsed,
+ const TInt aLength )
+ {
+ return GetTextBitmapL( aText, fontUsed, KRgbBlack, KRgbWhite,
+ EGray256, aLength );
+ }
+
+
+
+CFbsBitmap* CHtiTextRcg::GetTextBitmapL( const TDesC& aText,
+ const CFont* fontUsed,
+ TRgb aForeground,
+ TRgb aBackground,
+ TDisplayMode aDisplayMode,
+ const TInt aLength )
+{
+ HTI_LOG_FUNC_IN( "CHtiTextRcg::GetTextBitmapL" )
+ // Measure the text to get needed bitmap size and baseline point
+ CFont::TMeasureTextOutput output;
+ TInt reqWidth = fontUsed->MeasureText( aText, NULL, &output );
+ reqWidth = Max( reqWidth, output.iBounds.Width() );
+
+ // If only partial text requested, calculate new width but keep the
+ // height (and baseline) as it needs to be the same as for the full text
+ // for the text recognition to work.
+ if ( aLength < aText.Length() )
+ {
+ CFont::TMeasureTextOutput partialOutput;
+ reqWidth = fontUsed->MeasureText( aText.Left( aLength ), NULL,
+ &partialOutput );
+ reqWidth = Max( reqWidth, partialOutput.iBounds.Width() );
+ }
+
+ TSize bmpSize( reqWidth, output.iBounds.Height() );
+ HTI_LOG_FORMAT( "Bitmap width = %d", bmpSize.iWidth );
+ HTI_LOG_FORMAT( "Bitmap height = %d", bmpSize.iHeight );
+
+ // Create the bitmap
+ CFbsBitmap* result = new ( ELeave ) CFbsBitmap();
+ User::LeaveIfError( result->Create( bmpSize, aDisplayMode ) );
+
+ CFbsBitGc* bitmapContext = NULL;
+ CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( result );
+ CleanupStack::PushL( bitmapDevice );
+ User::LeaveIfError( bitmapDevice->CreateContext( bitmapContext ) );
+ CleanupStack::PushL( bitmapContext );
+ bitmapContext->SetBrushColor( aBackground );
+ bitmapContext->Clear();
+ bitmapContext->UseFont( fontUsed );
+ bitmapContext->SetPenColor( aForeground );
+
+ // Set the baseline point and draw the text
+ TPoint pos( 0, bmpSize.iHeight - output.iBounds.iBr.iY );
+ HTI_LOG_FORMAT( "Baseline Y = %d", pos.iY );
+ if ( aLength < aText.Length() )
+ {
+ bitmapContext->DrawText( aText.Left( aLength ), pos );
+ }
+ else
+ {
+ bitmapContext->DrawText( aText, pos );
+ }
+
+ CleanupStack::PopAndDestroy( 2 );
+ HTI_LOG_FUNC_OUT( "CHtiTextRcg::GetTextBitmapL" )
+ return result;
+}
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/proxy.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation proxy for screenshot service plugin dll
+*
+*/
+
+
+// INCLUDES
+#include "HtiScreenshotServicePlugin.h"
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY(0x1020DEC3, CHtiScreenshotServicePlugin::NewL)
+ };
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+ {
+ aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+ return ImplementationTable;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/data/10210CC6.rss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource definitions for system info service ECOM plugin.
+*
+*/
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+
+
+// RESOURCE DEFINITIONS
+RESOURCE REGISTRY_INFO theInfo
+ {
+ // UID for the DLL
+ dll_uid = 0x10210CC6;
+ // Declare array of interface info
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // UID of interface that is implemented
+ interface_uid = 0x1020DEB7;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10210CC7;
+ version_no = 1;
+ display_name = "SysInfo service";
+ default_data = "SysInfo";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/group/HtiSysInfoServicePlugin.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HTI service plugin for getting system information from device.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../../../symbian_version.hrh"
+
+TARGET HtiSysInfoServicePlugin.dll
+TARGETTYPE PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x10210CC6
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
+
+SOURCEPATH ../src
+SOURCE proxy.cpp
+SOURCE HtiSysInfoServicePlugin.cpp
+SOURCE HtiLightsController.cpp
+SOURCE HtiPropertySubscriber.cpp
+
+USERINCLUDE ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE ../data/10210CC6.rss
+TARGET HtiSysInfoServicePlugin.rsc
+END
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+LIBRARY avkon.lib
+#endif
+
+LIBRARY aknskinsrv.lib
+LIBRARY bafl.lib
+LIBRARY btdevice.lib
+LIBRARY btmanclient.lib
+LIBRARY btengsettings.lib
+LIBRARY c32.lib
+LIBRARY centralrepository.lib
+LIBRARY customapi.lib
+LIBRARY drmserverinterfaces.lib
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY etel.lib
+LIBRARY etelmm.lib
+LIBRARY euser.lib
+LIBRARY hal.lib
+LIBRARY hwrmlightclient.lib
+LIBRARY sysutil.lib
+LIBRARY tzclient.lib
+LIBRARY flogger.lib
+LIBRARY featmgr.lib // Chinese support
+
+SMPSAFE
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for HtiSysInfoServicePlugin
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiSysInfoServicePlugin.mmp
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiLightsController.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: For controlling S60 device lights.
+* Helper for SysInfoServicePlugin.
+*
+*/
+
+
+#ifndef HTILIGHTSCONTROLLER_H
+#define HTILIGHTSCONTROLLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <hwrmlight.h>
+
+// FORWARD DECLARATIONS
+class MHtiDispatcher;
+
+// CLASS DECLARATION
+/**
+* For controlling S60 device lights. Helper class for SysInfoServicePlugin.
+*/
+class CHtiLightsController : public CBase,
+ public MHWRMLightObserver
+ {
+public:
+
+ static CHtiLightsController* NewL( MHtiDispatcher* aDispatcher );
+
+ /**
+ * Called by the plugin when there is a message to be processed by
+ * the lights controller.
+ * @param aMessage message body destinated to the servive
+ * @param aReply on return contains the reply message (OK response)
+ */
+ void ProcessMessageL( const TDesC8& aMessage, TDes8& aReply );
+
+ ~CHtiLightsController();
+
+ // from MHWRMLightObserver
+ void LightStatusChanged( TInt aTarget,
+ CHWRMLight::TLightStatus aStatus );
+
+protected:
+
+ CHtiLightsController( MHtiDispatcher* aDispatcher );
+ void ConstructL();
+
+private: // private helper methods
+
+ void HandleLightStatusL( const TDesC8& aMessage );
+ void HandleLightOnL( const TDesC8& aMessage );
+ void HandleLightOffL( const TDesC8& aMessage );
+ void HandleLightBlinkL( const TDesC8& aMessage );
+
+
+private: // private data
+
+ // The message dispatcher interface for dispatching error messages.
+ MHtiDispatcher* iDispatcher;
+
+ // The reply message to dispatch.
+ TBuf8<4> iReply;
+
+ // Light client session.
+ CHWRMLight* iLight;
+
+ // The latest command
+ TInt iCommand;
+
+ // The light target bitmask of latest call
+ TInt iTarget;
+
+ // The duration given in latest call
+ TInt iDuration;
+
+ // The lights on duration given in latest blink lights call
+ TInt iOnDuration;
+
+ // The lights off duration given in latest blink lights call
+ TInt iOffDuration;
+
+ // The intensity value of latest call
+ TInt iIntensity;
+
+ // The fade value of latest call
+ TBool iFade;
+ };
+
+#endif // HTILIGHTSCONTROLLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiPropertySubscriber.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: For controlling S60 device lights.
+* Subscribes to a property to monitor changes in it.
+*
+*/
+
+
+#ifndef HTIPROPERTYSUBSCRIBER_H
+#define HTIPROPERTYSUBSCRIBER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32property.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+* Subscribes to a property to monitor changes in it.
+*/
+class CHtiPropertySubscriber : public CActive
+ {
+ public:
+ CHtiPropertySubscriber( TCallBack aCallBack, RProperty& aProperty );
+ ~CHtiPropertySubscriber();
+
+ public: // New functions
+ void Subscribe();
+ void Unsubscribe();
+
+ private: // from CActive
+ void RunL();
+ void DoCancel();
+
+ private: // data
+ TCallBack iCallBack;
+ RProperty& iProperty;
+ };
+
+#endif // HTIPROPERTYSUBSCRIBER_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiSysInfoServicePlugin.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of ECOM plug-in service interface. Provides
+* system info service.
+*
+*/
+
+
+#ifndef HTISYSINFOPLUGIN_H
+#define HTISYSINFOPLUGIN_H
+
+// INCLUDES
+#include "../../../symbian_version.hrh"
+
+#include <e32property.h>
+#include <f32file.h>
+#include <HtiServicePluginInterface.h>
+
+// FORWARD DECLARATIONS
+class CHtiLightsController;
+class CHtiPropertySubscriber;
+class CMGXFileManager;
+class CMGXFileNotificationHandler;
+class MDesCArray;
+
+// CLASS DECLARATION
+/**
+* System info service plugin.
+*/
+class CHtiSysInfoServicePlugin : public CHTIServicePluginInterface
+ {
+ public:
+
+ static CHtiSysInfoServicePlugin* NewL();
+
+ // Interface implementation
+ void ProcessMessageL( const TDesC8& aMessage,
+ THtiMessagePriority aPriority );
+
+ void NotifyMemoryChange( TInt aAvailableMemory );
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ static TInt HandleAllowSSPropertyChange( TAny* aPtr );
+#endif
+
+ protected:
+
+ CHtiSysInfoServicePlugin();
+ void ConstructL();
+ virtual ~CHtiSysInfoServicePlugin();
+
+
+ private: // private helper methods
+
+ void HandleGetHalAttrL( const TDesC8& aMessage );
+ void HandleGetImeiL( const TDesC8& aMessage );
+ void HandleGetSwVersionL( const TDesC8& aMessage );
+ void HandleGetLangVersionL( const TDesC8& aMessage );
+ void HandleGetSwLangVersionL( const TDesC8& aMessage );
+ void HandleGetUserAgentStringL( const TDesC8& aMessage );
+ void HandleGetFreeRamL( const TDesC8& aMessage );
+ void HandleGetUsedRamL( const TDesC8& aMessage );
+ void HandleGetTotalRamL( const TDesC8& aMessage );
+ void HandleEatRamL( const TDesC8& aMessage );
+ void HandleReleaseRamL( const TDesC8& aMessage );
+ void HandleGetFreeDiskSpaceL( const TDesC8& aMessage );
+ void HandleGetUsedDiskSpaceL( const TDesC8& aMessage );
+ void HandleGetTotalDiskSpaceL( const TDesC8& aMessage );
+ void HandleEatDiskSpaceL( const TDesC8& aMessage );
+ void HandleReleaseDiskSpaceL( const TDesC8& aMessage );
+ void HandleSetHomeTimeL( const TDesC8& aMessage );
+ void HandleGetHomeTimeL( const TDesC8& aMessage );
+ void HandleLightsCommandL( const TDesC8& aMessage );
+ void HandleScreenSaverCommandL( const TDesC8& aMessage );
+ void HandleScreenSaverTimeoutCommandL( const TDesC8& aMessage );
+ void HandleNetworkModeCommandL( const TDesC8& aMessage );
+ void HandleIrActivateCommandL( const TDesC8& aMessage );
+ void HandleBtPowerCommandL( const TDesC8& aMessage );
+ void HandleBtSettingsCommandL( const TDesC8& aMessage );
+ void HandleBtDeletePairingsL( const TDesC8& aMessage );
+ void HandleKeyLockToggleL( const TDesC8& aMessage );
+ void HandleAutoKeyGuardTimeL( const TDesC8& aMessage );
+ void HandleEmptyDrmRightsDbL( const TDesC8& aMessage );
+ void HandleBatteryStatusL( const TDesC8& aMessage );
+ void HandleSignalStrengthL( const TDesC8& aMessage );
+ void HandleSetDateTimeFormatL( const TDesC8& aMessage );
+ void HandleHsdpaCommandL( const TDesC8& aMessage );
+ void HandleUpdateMediaGalleryL( const TDesC8& aMessage );
+ void HandleActivateSkinL( const TDesC8& aMessage );
+ void HandleSetLanguageL( const TDesC8& aMessage );
+
+ void SetDefaultNumberModeL(TInt aMode, TInt aNbrModeType);
+ void ParseTimeDataL( const TDesC8& aTimeData, TTime& aResult );
+ TInt CleanUpTempFiles();
+ TBool CanTurnBluetoothOnL( const TBool aUseForce );
+ TInt CreatFileToEatDiskSpace( TFileName aPath, TInt64 aSpaceToEat );
+
+ private: // private data
+ RFs iFs;
+ CFileMan* iFileMan;
+ HBufC8* iMemEater;
+ HBufC8* iReply;
+ CHtiLightsController* iLightsController;
+ CHtiPropertySubscriber* iAllowSSSubscriber;
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ TInt iAllowSSValue;
+ RProperty iAllowSSProperty;
+ TBool iAllowSSPropertyAttached;
+#endif
+ TBool iGalleryUpdateSupported;
+ };
+
+
+// CLASS DECLARATION
+/**
+* Helper class to wait the async requests.
+*/
+class CAsyncWaiter : public CActive
+ {
+ public:
+ static CAsyncWaiter* NewL( TInt aPriority = EPriorityStandard );
+ static CAsyncWaiter* NewLC( TInt aPriority = EPriorityStandard );
+ ~CAsyncWaiter();
+
+ void StartAndWait();
+ TInt Result() const;
+
+ private:
+ CAsyncWaiter( TInt aPriority );
+
+ // from CActive
+ void RunL();
+ void DoCancel();
+
+ private:
+ CActiveSchedulerWait* iWait;
+ TInt iResult;
+
+ };
+
+
+// CLASS DECLARATION
+/**
+* Copied from MGXFileManagerFactory.h
+*/
+class MGXFileManagerFactory
+ {
+ public:
+ static CMGXFileManager* NewFileManagerL( RFs& aFs );
+ static CMGXFileNotificationHandler* NewFileNotificationHandlerL();
+ };
+
+
+// CLASS DECLARATION
+/**
+* Copied from CMGXFileManager.h
+*/
+class CMGXFileManager : public CBase
+ {
+ public:
+ virtual TBool SuccessFileNameL( const TDesC& aFileName,
+ TDriveNumber aDrive ) = 0;
+ virtual void UpdateL() = 0;
+ virtual void UpdateL( const TDesC& aFullPath ) = 0;
+ virtual void UpdateL( const TDesC& aOldName,
+ const TDesC& aNewName ) = 0;
+ virtual void UpdateL( const MDesCArray& aFileNameArray ) = 0;
+ };
+
+
+#endif // HTISYSINFOPLUGIN_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiLightsController.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,405 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation for controlling S60 device lights.
+*
+*/
+
+
+// INCLUDE FILES
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+#include "HtiLightsController.h"
+
+// CONSTANTS
+const static TUid KSysInfoServiceUid = { 0x10210CC7 };
+
+const static TInt KLightStatusCmdLength = 2;
+const static TInt KLightOnCmdLength = 6;
+const static TInt KLightOffCmdLength = 5;
+const static TInt KLightBlinkCmdLength = 9;
+
+enum TSysInfoLightControlCommand
+ {
+ ELightStatus = 0x30,
+ ELightOn = 0x31,
+ ELightOff = 0x32,
+ ELightBlink = 0x33
+ };
+
+_LIT8( KErrDescrArgument, "Invalid argument" );
+_LIT8( KErrDescrLightOn, "LightOn failed" );
+_LIT8( KErrDescrLightOff, "LightOff failed" );
+_LIT8( KErrDescrLightBlink, "LightBlink failed" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CHtiLightsController* CHtiLightsController::NewL( MHtiDispatcher* aDispatcher )
+ {
+ CHtiLightsController* self = new (ELeave) CHtiLightsController(
+ aDispatcher );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::CHtiLightsController
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+CHtiLightsController::CHtiLightsController(
+ MHtiDispatcher* aDispatcher ):iDispatcher( aDispatcher ),
+ iCommand( 0 ),
+ iTarget( 0 ),
+ iDuration( 0 ),
+ iOnDuration( 0 ),
+ iOffDuration( 0 ),
+ iIntensity( 0 ),
+ iFade( EFalse )
+ {
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::~CHtiLightsController()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CHtiLightsController::~CHtiLightsController()
+ {
+ HTI_LOG_TEXT("CHtiLightsController destroy");
+ delete iLight;
+ }
+
+// Second phase construction
+void CHtiLightsController::ConstructL()
+ {
+ HTI_LOG_TEXT("CHtiLightsController::ConstructL");
+ iLight = CHWRMLight::NewL( this );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::ProcessMessageL
+// Called by the plugin when there is a message to be processed by
+// the lights controller.
+// -----------------------------------------------------------------------------
+//
+void CHtiLightsController::ProcessMessageL( const TDesC8& aMessage,
+ TDes8& aReply )
+ {
+ HTI_LOG_FUNC_IN( "CHtiLightsController::ProcessMessageL" );
+
+ iCommand = aMessage[0];
+ iReply.Zero();
+
+ switch ( iCommand )
+ {
+ case ELightStatus:
+ {
+ HTI_LOG_TEXT( "ELightStatus" );
+ HandleLightStatusL( aMessage );
+ break;
+ }
+
+ case ELightOn:
+ {
+ HTI_LOG_TEXT( "ELightOn" );
+ HandleLightOnL( aMessage );
+ break;
+ }
+
+ case ELightOff:
+ {
+ HTI_LOG_TEXT( "ELightOff" );
+ HandleLightOffL( aMessage );
+ break;
+ }
+
+ case ELightBlink:
+ {
+ HTI_LOG_TEXT( "ELightBlink" );
+ HandleLightBlinkL( aMessage );
+ break;
+ }
+
+ default:
+ {
+ // If comes here it's an error from caller.
+ User::Leave( KErrArgument );
+ }
+ }
+
+ aReply.Copy( iReply );
+
+ HTI_LOG_FUNC_OUT("CHtiLightsController::ProcessMessageL");
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::HandleLightStatusL
+// Gets the status of the given light target.
+// Returns "Not supported" for S60 2.x
+// -----------------------------------------------------------------------------
+//
+void CHtiLightsController::HandleLightStatusL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiLightsController::HandleLightStatusL" );
+
+ if ( aMessage.Length() != KLightStatusCmdLength )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument, KErrDescrArgument, KSysInfoServiceUid );
+ }
+
+ else
+ {
+ iTarget = aMessage[1];
+ iReply.Append( iLight->LightStatus( iTarget ) );
+ }
+ HTI_LOG_FUNC_OUT( "CHtiLightsController::HandleLightStatusL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::HandleLightOnL
+// Turns on light with specified parameters.
+// For S60 2.x just turns on lights forever, parameters are ignored.
+// -----------------------------------------------------------------------------
+//
+void CHtiLightsController::HandleLightOnL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiLightsController::HandleLightOnL" );
+
+ if ( aMessage.Length() != KLightOnCmdLength )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument, KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+ // parse values from message
+ iTarget = aMessage[1];
+ iDuration = aMessage[2] + ( aMessage[3] << 8 );
+ iIntensity = aMessage[4];
+ iFade = (TBool)aMessage[5];
+
+ TInt err = KErrNone;
+
+ // normalize possibly abnormal values
+ if ( iIntensity < KHWRMLightMinIntensity )
+ iIntensity = KHWRMDefaultIntensity;
+
+ if ( iIntensity > KHWRMLightMaxIntensity )
+ iIntensity = KHWRMLightMaxIntensity;
+
+ if ( iDuration < 1 ) iDuration = KHWRMInfiniteDuration;
+
+ // shoot
+ TRAP( err, iLight->LightOnL( iTarget, iDuration, iIntensity, iFade ) );
+
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err, KErrDescrLightOn, KSysInfoServiceUid );
+ }
+
+ else
+ {
+ iReply.Append( 0 );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiLightsController::HandleLightOnL ");
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::HandleLightOffL
+// Turns off light with specified parameters.
+// Returns "Not supported" for S60 2.x
+// -----------------------------------------------------------------------------
+//
+void CHtiLightsController::HandleLightOffL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiLightsController::HandleLightOffL" );
+
+ if ( aMessage.Length() != KLightOffCmdLength )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument, KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+ // parse values from message
+ iTarget = aMessage[1];
+ iDuration = aMessage[2] + ( aMessage[3] << 8 );
+ iFade = (TBool)aMessage[4];
+
+ // normalize possibly abnormal values
+ if ( iDuration < 1 ) iDuration = KHWRMInfiniteDuration;
+
+ // shoot
+ TRAPD( err, iLight->LightOffL( iTarget, iDuration, iFade ) );
+
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err, KErrDescrLightOff, KSysInfoServiceUid );
+ }
+
+ else
+ {
+ iReply.Append( 0 );
+ }
+ HTI_LOG_FUNC_OUT( "CHtiLightsController::HandleLightOffL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::HandleLightBlinkL
+// Blinks light with specified parameters.
+// Returns "Not supported" for S60 2.x
+// -----------------------------------------------------------------------------
+//
+void CHtiLightsController::HandleLightBlinkL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiLightsController::HandleLightBlinkL" );
+
+ if ( aMessage.Length() != KLightBlinkCmdLength )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument, KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+ // parse values from message
+ iTarget = aMessage[1];
+ iDuration = aMessage[2] + ( aMessage[3] << 8 );
+ iOnDuration = aMessage[4] + ( aMessage[5] << 8 );
+ iOffDuration = aMessage[6] + ( aMessage[7] << 8 );
+ iIntensity = aMessage[8];
+
+ // normalize possibly abnormal values
+ if ( iIntensity < KHWRMLightMinIntensity )
+ iIntensity = KHWRMDefaultIntensity;
+
+ if ( iIntensity > KHWRMLightMaxIntensity )
+ iIntensity = KHWRMLightMaxIntensity;
+
+ if ( iDuration < 1 ) iDuration = KHWRMInfiniteDuration;
+
+ if ( iOnDuration < 1 || iOffDuration < 1 )
+ {
+ iOnDuration = KHWRMDefaultCycleTime;
+ iOffDuration = KHWRMDefaultCycleTime;
+ }
+
+ // shoot
+ TRAPD( err, iLight->LightBlinkL(
+ iTarget, iDuration, iOnDuration, iOffDuration, iIntensity ) );
+
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err, KErrDescrLightBlink, KSysInfoServiceUid );
+ }
+
+ else
+ {
+ iReply.Append( 0 );
+ }
+ HTI_LOG_FUNC_OUT( "CHtiLightsController::HandleLightBlinkL" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::LightStatusChanged
+// Called when status of any light target changes.
+// If infinite duration is requested, restores the state back to what was
+// last requested.
+// This method does not exist for S60 2.x
+// -----------------------------------------------------------------------------
+//
+void CHtiLightsController::LightStatusChanged( TInt aTarget,
+ CHWRMLight::TLightStatus aStatus )
+ {
+ HTI_LOG_FORMAT( "Light status changed for target %d", aTarget );
+ HTI_LOG_FORMAT( "New status = %d", aStatus );
+ HTI_LOG_FORMAT( "Current target = %d", iTarget );
+
+ TInt target = aTarget & iTarget;
+ if ( !target )
+ {
+ HTI_LOG_TEXT( "Not interested about the target" );
+ return;
+ }
+
+ HTI_LOG_TEXT( "Matches current target" );
+
+ if ( iDuration != KHWRMInfiniteDuration )
+ {
+ return;
+ }
+
+ if ( ( aStatus == CHWRMLight::ELightOn && iCommand == ELightOn ) ||
+ ( aStatus == CHWRMLight::ELightOff && iCommand == ELightOff ) ||
+ ( aStatus == CHWRMLight::ELightBlink && iCommand == ELightBlink ) )
+ {
+ HTI_LOG_TEXT( "Status already OK" );
+ return;
+ }
+
+ HTI_LOG_TEXT( "Infinite duration wanted - restore light status" );
+ switch ( iCommand )
+ {
+ case ELightOn:
+ {
+ // Ignore error
+ TRAPD( err, iLight->LightOnL(
+ target, iDuration, iIntensity, iFade ) );
+ HTI_LOG_FORMAT( "LightOnL return code %d", err );
+ err = err; // to get rid of compiler warning for non-logging
+ break;
+ }
+ case ELightOff:
+ {
+ // Ignore error
+ TRAPD( err, iLight->LightOffL( target, iDuration, iFade ) );
+ HTI_LOG_FORMAT( "LightOffL return code %d", err );
+ err = err; // to get rid of compiler warning for non-logging
+ break;
+ }
+ case ELightBlink:
+ {
+ // Ignore error
+ TRAPD( err, iLight->LightBlinkL(
+ target, iDuration, iOnDuration,
+ iOffDuration, iIntensity ) );
+ HTI_LOG_FORMAT( "LightBlinkL return code %d", err );
+ err = err; // to get rid of compiler warning for non-logging
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiPropertySubscriber.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation for controlling S60 device lights.
+*
+*/
+
+
+// INCLUDE FILES
+#include <HtiLogging.h>
+#include "HtiPropertySubscriber.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiPropertySubscriber::CHtiPropertySubscriber
+// -----------------------------------------------------------------------------
+//
+CHtiPropertySubscriber::CHtiPropertySubscriber( TCallBack aCallBack,
+ RProperty& aProperty) : CActive( EPriorityNormal ),
+ iCallBack( aCallBack ),
+ iProperty( aProperty )
+ {
+ HTI_LOG_TEXT( "CHtiPropertySubscriber construct" );
+ CActiveScheduler::Add( this );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiPropertySubscriber::~CHtiPropertySubscriber
+// -----------------------------------------------------------------------------
+//
+CHtiPropertySubscriber::~CHtiPropertySubscriber()
+ {
+ HTI_LOG_TEXT( "CHtiPropertySubscriber destroy" );
+ Cancel();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiPropertySubscriber::Subscribe
+// -----------------------------------------------------------------------------
+//
+void CHtiPropertySubscriber::Subscribe()
+ {
+ if ( !IsActive() )
+ {
+ iProperty.Subscribe( iStatus );
+ SetActive();
+ }
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiPropertySubscriber::Unsubscribe
+// -----------------------------------------------------------------------------
+//
+void CHtiPropertySubscriber::Unsubscribe()
+ {
+ Cancel();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiPropertySubscriber::RunL
+// -----------------------------------------------------------------------------
+//
+void CHtiPropertySubscriber::RunL()
+ {
+ if ( iStatus.Int() == KErrNone )
+ {
+ iCallBack.CallBack();
+ Subscribe();
+ }
+ }
+
+
+// -----------------------------------------------------------------------------
+// CHtiPropertySubscriber::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CHtiPropertySubscriber::DoCancel()
+ {
+ iProperty.Cancel();
+ }
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiSysInfoServicePlugin.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,3207 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SysInfoPlugin implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiSysInfoServicePlugin.h"
+#include "HtiLightsController.h"
+#include "HtiPropertySubscriber.h"
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+#include <aknkeylock.h>
+#include <ScreensaverInternalPSKeys.h>
+#endif
+
+#include <AknSkinsInternalCRKeys.h>
+#include <AknsSkinUID.h>
+#include <AknsSrvClient.h>
+#include <AknFepInternalCRKeys.h>
+#include <AknFepGlobalEnums.h> //For chinese input modes
+#include <CommonEngineDomainCRKeys.h>
+#include <featmgr.h>
+#include <bautils.h>
+#include <btengsettings.h>
+#include <btengdomaincrkeys.h>
+#include <bt_subscribe.h>
+#include <btmanclient.h>
+#include <centralrepository.h>
+#include <CoreApplicationUIsSDKCRKeys.h>
+#include <DRMRightsClient.h>
+#include <e32property.h>
+#include <etel.h>
+#include <etelmm.h>
+#include <hal.h>
+#include <ir_sock.h>
+#include <mmtsy_names.h>
+#include <rmmcustomapi.h>
+#include <hwrmpowerstatesdkpskeys.h>
+#include <settingsinternalcrkeys.h>
+#include <sysutil.h>
+#include <tz.h>
+
+// CONSTANTS
+const static TUid KSysInfoServiceUid = { 0x10210CC7 };
+
+// from irinternalpskey.h
+const static TUid KPSUidIrdaActivation = { 0x2000276D };
+
+const TInt KTimeDataLength = 7;
+const TInt KMaxBtNameLength = 30;
+const TInt KDateTimeFormatCmdLength = 6;
+
+const TInt KFepChineseInputModeLength = 10;
+
+_LIT( KTempFilePath, "\\" );
+_LIT( KTempFileName, "HtiTempFile.tmp" );
+_LIT( KMatchFileName, "HtiTempFile.tmp*" );
+_LIT( KDateSeparatorChars, ".:/-" );
+_LIT( KTimeSeparatorChars, ".:" );
+
+_LIT8( KErrDescrArgument, "Invalid argument" );
+_LIT8( KErrDescrNotSupported, "Command not supported" );
+_LIT8( KErrDescrHAL, "Error retrieving HAL attribute" );
+_LIT8( KErrDescrAttOutOfRange, "HAL attribute argument is out of range" );
+_LIT8( KErrDescrFreeRAM, "Error retrieving the amount of free RAM" );
+_LIT8( KErrDescrTotalRAM, "Error retrieving the amount of total RAM" );
+_LIT8( KErrDescrAllocRAM, "Error allocating RAM" );
+_LIT8( KErrDescrInvalidRAM, "Requested free RAM larger than currently free" );
+_LIT8( KErrDescrVolInfo, "Error retrieving volume info" );
+_LIT8( KErrDescrNotEnoughSpace, "Not enough disk space" );
+_LIT8( KErrDescrCreateTempFile, "Error creating temp file" );
+_LIT8( KErrDescrSetSizeTempFile, "Error allocating size for temp file" );
+_LIT8( KErrDescrDeleteTempFile, "Error deleting temp file" );
+_LIT8( KErrDescrSysUtil, "SysUtil failed" );
+_LIT8( KErrDescrSetTime, "Setting time failed" );
+_LIT8( KErrDescrDateTimeFormat, "Setting date and time formats failed" );
+_LIT8( KErrDescrSetLanguage, "Setting language failed");
+_LIT8( KErrDescrGetNetworkModes, "Getting network modes failed" );
+_LIT8( KErrDescrSetNetworkMode, "Setting network mode failed" );
+_LIT8( KErrDescrIrActivation, "IR activation failed" );
+_LIT8( KErrDescrGetBtPower, "Getting BT power state failed" );
+_LIT8( KErrDescrSetBtPower, "Setting BT power state failed" );
+_LIT8( KErrDescrBtOnDenied, "Turning BT on not allowed (Offline mode)" );
+_LIT8( KErrDescrBtOffDenied, "Turning BT off not allowed (active connections)" );
+_LIT8( KErrDescrBtSettings, "Bluetooth settings failed" );
+_LIT8( KErrDescrBtDeletePairings, "Deleting Bluetooth pairing(s) failed" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+_LIT8( KErrDescrKeyLock, "Key lock toggle failed" );
+_LIT8( KErrDescrScreenSaver, "Setting screen saver state failed" );
+_LIT8( KErrDescrInvalidSSTimeout, "Invalid screen saver timeout value" );
+_LIT8( KErrDescrSSTimeoutFailed, "Setting screen saver timeout failed" );
+#endif
+_LIT8( KErrDescrInvalidTime, "Auto key guard time value too large (max 3600)" );
+_LIT8( KErrDescrAutoKeyGuardFailed, "Setting auto key guard time failed" );
+_LIT8( KErrDescrDrmDbConnect, "DRM DB connect failed." );
+_LIT8( KErrDescrDrmDbDelete, "DRM DB delete failed." );
+_LIT8( KErrDescrBatteryLevel, "Getting battery level failed." );
+_LIT8( KErrDescrChargingStatus, "Getting charging status failed." );
+_LIT8( KErrDescrSignalStrength, "Getting signal strength failed." );
+_LIT8( KErrDescrMGUpdate, "Update Media Gallery failed" );
+_LIT8( KErrDescrActivateSkin, "Activating Skin failed" );
+
+enum TSysInfoCommand
+ {
+ ESysInfoHAL = 0x01,
+ ESysInfoIMEI= 0x02,
+ ESysInfoSWVersion = 0x03,
+ ESysInfoLangVersion = 0x04,
+ ESysInfoSWLangVersion = 0x05,
+ ESysInfoUserAgent = 0x06,
+ EFreeRAM = 0x07,
+ EUsedRAM = 0x08,
+ ETotalRAM = 0x09,
+ EEatRAM = 0x0A,
+ EReleaseRAM = 0x0B,
+ EFreeDiskSpace = 0x0C,
+ EUsedDiskSpace = 0x0D,
+ ETotalDiskSize = 0x0E,
+ EEatDiskSpace = 0x0F,
+ EReleaseDiskSpace = 0x10,
+
+ ESysInfoSetHomeTime = 0x20,
+ ESysInfoGetHomeTime = 0x21,
+ ESetDateTimeFormat = 0x22,
+
+ ESetLanguage = 0x25,
+
+ ELightStatus = 0x30,
+ ELightOn = 0x31,
+ ELightOff = 0x32,
+ ELightBlink = 0x33,
+ ELightRelease = 0x3A,
+
+ EScreenSaverDisable = 0x40,
+ EScreenSaverEnable = 0x41,
+ EScreenSaverTimeout = 0x42,
+
+ ENetworkModeGet = 0x50,
+ ENetworkModeSet = 0x51,
+ ENetworkModeSetNoReboot = 0x52,
+ EHsdpaSet = 0x53,
+
+ EIrActivate = 0x5A,
+ EBtPower = 0x5B,
+ EBtSettings = 0x5C,
+ EBtDeletePairings = 0x5D,
+
+ EKeylockToggle = 0x60,
+ EAutoKeyGuardTime = 0x61,
+
+ EEmtpyDrmRightsDb = 0x65,
+
+ EBatteryStatus = 0x70,
+ ESignalStrength = 0x71,
+
+ EUpdateMediaGallery = 0x7A,
+
+ EActivateSkin = 0x80
+ };
+
+enum TGSNumberModes
+ {
+ EGSNbrModeLatin, EGSNbrModeArabic = 1, EGSNbrModeIndic = 1
+ };
+
+// Number mode type
+enum TGSNumberModeType
+ {
+ EGSNbrModeTypeArabic, EGSNbrModeTypeIndic, EGSNbrModeTypeEasternArabic
+ // for Urdu & Farsi languages
+ };
+
+//------------------------------------------------------------------------------
+// Create instance of concrete ECOM interface implementation
+//------------------------------------------------------------------------------
+CHtiSysInfoServicePlugin* CHtiSysInfoServicePlugin::NewL()
+ {
+ CHtiSysInfoServicePlugin* self = new (ELeave) CHtiSysInfoServicePlugin;
+ CleanupStack::PushL (self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+//------------------------------------------------------------------------------
+// Constructor
+//------------------------------------------------------------------------------
+CHtiSysInfoServicePlugin::CHtiSysInfoServicePlugin():
+ iMemEater( NULL ), iReply( NULL ), iGalleryUpdateSupported( ETrue )
+ {
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ iAllowSSValue = -1;
+ iAllowSSPropertyAttached = EFalse;
+#endif
+ }
+
+//------------------------------------------------------------------------------
+// Destructor
+//------------------------------------------------------------------------------
+CHtiSysInfoServicePlugin::~CHtiSysInfoServicePlugin()
+ {
+ HTI_LOG_TEXT( "CHtiSysInfoServicePlugin destroy" );
+ delete iMemEater;
+ delete iReply;
+
+ CleanUpTempFiles();
+ delete iFileMan;
+ iFs.Close();
+ delete iLightsController;
+
+ if ( iAllowSSSubscriber )
+ {
+ iAllowSSSubscriber->Unsubscribe();
+ }
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ iAllowSSProperty.Close();
+#endif
+ delete iAllowSSSubscriber;
+
+ FeatureManager::UnInitializeLib();
+ }
+
+//------------------------------------------------------------------------------
+// Second phase construction
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::ConstructL()
+ {
+ HTI_LOG_TEXT( "CHtiSysInfoServicePlugin::ConstructL" );
+ User::LeaveIfError( iFs.Connect() );
+ iFileMan = CFileMan::NewL( iFs );
+
+ FeatureManager::InitializeLibL();
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::ProcessMessageL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::ProcessMessageL(const TDesC8& aMessage,
+ THtiMessagePriority /*aPriority*/)
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::ProcessMessage" );
+ HTI_LOG_FORMAT( "Message length: %d", aMessage.Length() );
+
+ if ( aMessage.Length() > 0 )
+ {
+ HTI_LOG_FORMAT( "Command: %d", aMessage[0] );
+
+ switch ( aMessage[0] )
+ {
+ case ESysInfoHAL:
+ {
+ HTI_LOG_TEXT( "ESysInfoHAL" );
+ HandleGetHalAttrL( aMessage );
+ }
+ break;
+ case ESysInfoIMEI:
+ {
+ HTI_LOG_TEXT( "ESysInfoIMEI" );
+ HandleGetImeiL( aMessage );
+ }
+ break;
+ case ESysInfoSWVersion:
+ {
+ HTI_LOG_TEXT( "ESysInfoSWVersion" );
+ HandleGetSwVersionL( aMessage );
+ }
+ break;
+ case ESysInfoLangVersion:
+ {
+ HTI_LOG_TEXT( "ESysInfoLangVersion" );
+ HandleGetLangVersionL( aMessage );
+ }
+ break;
+ case ESysInfoSWLangVersion:
+ {
+ HTI_LOG_TEXT( "ESysInfoSWLangVersion" );
+ HandleGetSwLangVersionL( aMessage );
+ }
+ break;
+ case ESysInfoUserAgent:
+ {
+ HTI_LOG_TEXT( "ESysInfoUserAgent" );
+ HandleGetUserAgentStringL( aMessage );
+ }
+ break;
+ case EFreeRAM:
+ {
+ HTI_LOG_TEXT( "EFreeRAM" );
+ HandleGetFreeRamL( aMessage );
+ }
+ break;
+ case EUsedRAM:
+ {
+ HTI_LOG_TEXT( "EUsedRAM" );
+ HandleGetUsedRamL( aMessage );
+ }
+ break;
+ case ETotalRAM:
+ {
+ HTI_LOG_TEXT( "ETotalRAM" );
+ HandleGetTotalRamL( aMessage );
+ }
+ break;
+ case EEatRAM:
+ {
+ HTI_LOG_TEXT( "EEatRAM" );
+ HandleEatRamL( aMessage );
+ }
+ break;
+ case EReleaseRAM:
+ {
+ HTI_LOG_TEXT( "EReleaseRAM" );
+ HandleReleaseRamL( aMessage );
+ }
+ break;
+ case EFreeDiskSpace:
+ {
+ HTI_LOG_TEXT( "EFreeDiskSpace" );
+ HandleGetFreeDiskSpaceL( aMessage );
+ }
+ break;
+ case EUsedDiskSpace:
+ {
+ HTI_LOG_TEXT( "EUsedDiskSpace" );
+ HandleGetUsedDiskSpaceL( aMessage );
+ }
+ break;
+ case ETotalDiskSize:
+ {
+ HTI_LOG_TEXT( "ETotalDiskSize" );
+ HandleGetTotalDiskSpaceL( aMessage );
+ }
+ break;
+ case EEatDiskSpace:
+ {
+ HTI_LOG_TEXT( "EEatDiskSpace" );
+ HandleEatDiskSpaceL( aMessage );
+ }
+ break;
+ case EReleaseDiskSpace:
+ {
+ HTI_LOG_TEXT( "EReleaseDiskSpace" );
+ HandleReleaseDiskSpaceL( aMessage );
+ }
+ break;
+ case ESysInfoSetHomeTime:
+ {
+ HTI_LOG_TEXT( "ESysInfoSetHomeTime" );
+ HandleSetHomeTimeL( aMessage );
+ }
+ break;
+ case ESysInfoGetHomeTime:
+ {
+ HTI_LOG_TEXT( "ESysInfoGetHomeTime" );
+ HandleGetHomeTimeL( aMessage );
+ }
+ break;
+ case ESetDateTimeFormat:
+ {
+ HTI_LOG_TEXT( "ESetDateTimeFormat" );
+ HandleSetDateTimeFormatL( aMessage );
+ }
+ break;
+ case ESetLanguage:
+ {
+ HTI_LOG_TEXT("ESetLanguage");
+ HandleSetLanguageL( aMessage);
+ }
+ break;
+ case ELightStatus:
+ case ELightOn:
+ case ELightOff:
+ case ELightBlink:
+ case ELightRelease:
+ {
+ HTI_LOG_TEXT( "ELight*" );
+ HandleLightsCommandL( aMessage );
+ }
+ break;
+ case EScreenSaverDisable:
+ case EScreenSaverEnable:
+ {
+ HTI_LOG_TEXT( "EScreenSaver*" );
+ HandleScreenSaverCommandL( aMessage );
+ }
+ break;
+ case EScreenSaverTimeout:
+ {
+ HTI_LOG_TEXT( "EScreenSaverTimeout" );
+ HandleScreenSaverTimeoutCommandL( aMessage );
+ }
+ break;
+ case ENetworkModeSet:
+ case ENetworkModeSetNoReboot:
+ case ENetworkModeGet:
+ {
+ HTI_LOG_TEXT( "ENetworkMode*" );
+ HandleNetworkModeCommandL( aMessage );
+ }
+ break;
+ case EHsdpaSet:
+ {
+ HTI_LOG_TEXT( "EHsdpaSet" );
+ HandleHsdpaCommandL( aMessage );
+ }
+ break;
+ case EIrActivate:
+ {
+ HTI_LOG_TEXT( "EIrActivate" );
+ HandleIrActivateCommandL( aMessage );
+ }
+ break;
+ case EBtPower:
+ {
+ HTI_LOG_TEXT( "EBtPower" );
+ HandleBtPowerCommandL( aMessage );
+ }
+ break;
+ case EBtSettings:
+ {
+ HTI_LOG_TEXT( "EBtSettings" );
+ HandleBtSettingsCommandL( aMessage );
+ }
+ break;
+ case EBtDeletePairings:
+ {
+ HTI_LOG_TEXT( "EBtDeletePairings" );
+ HandleBtDeletePairingsL( aMessage );
+ }
+ break;
+ case EKeylockToggle:
+ {
+ HTI_LOG_TEXT( "EKeylockToggle" );
+ HandleKeyLockToggleL( aMessage );
+ }
+ break;
+ case EAutoKeyGuardTime:
+ {
+ HTI_LOG_TEXT( "EAutoKeyGuardTime" );
+ HandleAutoKeyGuardTimeL( aMessage );
+ }
+ break;
+ case EEmtpyDrmRightsDb:
+ {
+ HTI_LOG_TEXT( "EEmtpyDrmRightsDb" );
+ HandleEmptyDrmRightsDbL( aMessage );
+ }
+ break;
+ case EBatteryStatus:
+ {
+ HTI_LOG_TEXT( "EBatteryStatus" );
+ HandleBatteryStatusL( aMessage );
+ }
+ break;
+ case ESignalStrength:
+ {
+ HTI_LOG_TEXT( "ESignalStrength" );
+ HandleSignalStrengthL( aMessage );
+ }
+ break;
+ case EUpdateMediaGallery:
+ {
+ HTI_LOG_TEXT( "EUpdateMediaGallery" );
+ HandleUpdateMediaGalleryL( aMessage );
+ }
+ break;
+ case EActivateSkin:
+ {
+ HTI_LOG_TEXT( "EActivateSkin" );
+ HandleActivateSkinL( aMessage );
+ }
+ break;
+ default:
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrNotSupported,
+ KSysInfoServiceUid );
+ }
+ }
+ }
+
+ else // aMessage.Length() > 0
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid);
+ }
+
+ if ( iReply )
+ {
+ TInt err = iDispatcher->DispatchOutgoingMessage( iReply,
+ KSysInfoServiceUid );
+ if ( err == KErrNoMemory )
+ {
+ HTI_LOG_TEXT( "KErrNoMemory" );
+ iDispatcher->AddMemoryObserver( this );
+ }
+ else
+ {
+ iReply = NULL;
+ }
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::ProcessMessage" );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::NotifyMemoryChange
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::NotifyMemoryChange( TInt aAvailableMemory )
+ {
+
+ if ( iReply )
+ {
+ if ( aAvailableMemory >= iReply->Size() )
+ {
+ TInt err = iDispatcher->DispatchOutgoingMessage(
+ iReply, KSysInfoServiceUid );
+
+ if ( err == KErrNone )
+ {
+ iReply = NULL;
+ iDispatcher->RemoveMemoryObserver( this );
+ }
+ else if ( err != KErrNoMemory ) //some other error
+ {
+ delete iReply;
+ iReply = NULL;
+ iDispatcher->RemoveMemoryObserver( this );
+ }
+ }
+ }
+ else
+ {
+ // some error, should not be called
+ iDispatcher->RemoveMemoryObserver( this );
+ }
+ }
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleAllowSSPropertyChange
+//------------------------------------------------------------------------------
+TInt CHtiSysInfoServicePlugin::HandleAllowSSPropertyChange( TAny* aPtr )
+ {
+ HTI_LOG_TEXT( "Allow SS property was changed" );
+ TInt newValue = -1;
+ TInt wantedValue =
+ STATIC_CAST( CHtiSysInfoServicePlugin*, aPtr )->iAllowSSValue;
+ RProperty::Get( KPSUidScreenSaver,
+ KScreenSaverAllowScreenSaver, newValue );
+ HTI_LOG_FORMAT( "New value is %d", newValue );
+
+ TInt err = KErrNone;
+ if ( newValue == 0 && wantedValue == 1 )
+ {
+ HTI_LOG_TEXT( "Restoring the SS disabled value" );
+ err = RProperty::Set( KPSUidScreenSaver,
+ KScreenSaverAllowScreenSaver, wantedValue );
+ }
+ return err;
+ }
+
+#endif
+/*
+ * Private helper methods
+ */
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetHalAttrL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetHalAttrL( const TDesC8& aMessage )
+ {
+ // check the message length
+ if ( aMessage.Length() != 5 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ TInt att = aMessage[1] +
+ ( aMessage[2] << 8 ) +
+ ( aMessage[3] << 16 ) +
+ ( aMessage[4] << 24 );
+
+ // check that requested HAL attribute is valid
+ if ( att < 0 || att >= HALData::ENumHalAttributes )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrAttOutOfRange,
+ KSysInfoServiceUid);
+ return;
+ }
+
+ // get the HAL attribute
+ TInt result;
+ TInt err = HAL::Get( ( HALData::TAttribute ) att, result );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrHAL,
+ KSysInfoServiceUid );
+ }
+ else
+ {
+ iReply = HBufC8::NewL( 4 );
+ iReply->Des().Append( ( TUint8* )( &result ), 4 );
+ }
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetImeiL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetImeiL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleGetImeiL" );
+
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+#if !defined (__WINS__) // no IMEI in emulator
+ RTelServer server;
+ User::LeaveIfError( server.Connect() );
+ CleanupClosePushL( server );
+ User::LeaveIfError( server.LoadPhoneModule( KMmTsyModuleName ) );
+
+ RTelServer::TPhoneInfo info;
+ TInt ret = KErrNotSupported;
+ TInt count;
+
+ RMobilePhone mobilePhone;
+
+ User::LeaveIfError( server.EnumeratePhones( count ) );
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ ret = server.GetPhoneInfo( i, info );
+ if ( ret == KErrNone )
+ {
+ User::LeaveIfError( mobilePhone.Open( server, info.iName ) );
+ CleanupClosePushL( mobilePhone );
+ break;
+ }
+ }
+
+ TRequestStatus status;
+ RMobilePhone::TMobilePhoneIdentityV1 identity;
+
+ mobilePhone.GetPhoneId( status, identity );
+ User::WaitForRequest( status );
+
+ CleanupStack::PopAndDestroy(); // mobilePhone
+
+ server.UnloadPhoneModule( KMmTsyModuleName );
+ CleanupStack::PopAndDestroy(); // server
+
+ iReply = HBufC8::NewL( identity.iSerialNumber.Length() );
+ iReply->Des().Copy( identity.iSerialNumber );
+
+#else // __WINS__
+ // no IMEI in emulator
+ iDispatcher->DispatchOutgoingErrorMessage( KErrNotSupported,
+ KErrDescrNotSupported, KSysInfoServiceUid );
+#endif // __WINS__
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleGetImeiL" );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetSwVersionL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetSwVersionL( const TDesC8& aMessage )
+ {
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid);
+ return;
+ }
+
+ TBuf<KSysUtilVersionTextLength> reply16;
+ TInt err = SysUtil::GetSWVersion( reply16 );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrSysUtil,
+ KSysInfoServiceUid );
+ }
+ else
+ {
+ iReply = HBufC8::NewL( reply16.Size() );
+ iReply->Des().Append( ( TUint8* )reply16.Ptr(), reply16.Size() );
+ }
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetLangVersionL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetLangVersionL( const TDesC8& aMessage )
+ {
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ TBuf<KSysUtilVersionTextLength> reply16;
+ TInt err = SysUtil::GetLangVersion( reply16 );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrSysUtil,
+ KSysInfoServiceUid );
+ }
+ else
+ {
+ iReply = HBufC8::NewL( reply16.Size() );
+ iReply->Des().Append( ( TUint8* )reply16.Ptr(), reply16.Size() );
+ }
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetSwLangVersionL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetSwLangVersionL( const TDesC8& aMessage )
+ {
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid);
+ return;
+ }
+
+ TBuf<KSysUtilVersionTextLength> reply16;
+ TInt err = SysUtil::GetLangSWVersion( reply16 );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrSysUtil,
+ KSysInfoServiceUid );
+ }
+ else
+ {
+ iReply = HBufC8::NewL( reply16.Size() );
+ iReply->Des().Append( ( TUint8* )reply16.Ptr(), reply16.Size() );
+ }
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetUserAgentStringL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetUserAgentStringL(
+ const TDesC8& aMessage )
+ {
+ aMessage.Length(); // get rid of compiler warning
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrNotSupported,
+ KErrDescrNotSupported,
+ KSysInfoServiceUid);
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetFreeRamL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetFreeRamL( const TDesC8& aMessage )
+ {
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ User::CompressAllHeaps();
+ TInt result;
+ TInt err = HAL::Get( HALData::EMemoryRAMFree, result );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrFreeRAM,
+ KSysInfoServiceUid );
+ }
+ else
+ {
+ iReply = HBufC8::NewL( 4 );
+ iReply->Des().Append( ( TUint8* )( &result ), 4 );
+ }
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetUsedRamL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetUsedRamL( const TDesC8& aMessage )
+ {
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid);
+ return;
+ }
+
+ User::CompressAllHeaps();
+
+ TInt totalRam;
+ TInt freeRam;
+ TInt usedRam;
+
+ // first get the total RAM...
+ TInt err = HAL::Get( HALData::EMemoryRAM, totalRam );
+ if ( err != KErrNone )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrTotalRAM,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ // ...then get the free RAM
+ err = HAL::Get( HALData::EMemoryRAMFree, freeRam );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrFreeRAM,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ // calculate used RAM from total and free RAM
+ usedRam = totalRam - freeRam;
+ iReply = HBufC8::NewL( 4 );
+ iReply->Des().Append( ( TUint8* )( &usedRam ), 4 );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetTotalRamL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetTotalRamL( const TDesC8& aMessage )
+ {
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid);
+ return;
+ }
+
+ User::CompressAllHeaps();
+
+ TInt result;
+ TInt err = HAL::Get( HALData::EMemoryRAM, result );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrTotalRAM,
+ KSysInfoServiceUid );
+ }
+ else
+ {
+ iReply = HBufC8::NewL( 4 );
+ iReply->Des().Append( ( TUint8* )( &result ), 4 );
+ }
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleEatRamL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleEatRamL( const TDesC8& aMessage )
+ {
+ if ( aMessage.Length() != 5 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ // get the amount of memory to be left free from the message
+ TInt memLeftFree = aMessage[1] +
+ ( aMessage[2] << 8 ) +
+ ( aMessage[3] << 16 ) +
+ ( aMessage[4] << 24 );
+
+ // if there's a previous memory eater, delete it
+ if ( iMemEater != NULL )
+ {
+ delete iMemEater;
+ iMemEater = NULL;
+ }
+
+ User::CompressAllHeaps();
+
+ // get the current free memory
+ TInt memFree;
+ TInt err = HAL::Get( HALData::EMemoryRAMFree, memFree );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrFreeRAM,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ // try to eat the memory
+ TInt memToBeEaten = memFree - memLeftFree;
+
+ if ( memToBeEaten < 0 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrUnderflow,
+ KErrDescrInvalidRAM,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ TRAP( err, iMemEater = HBufC8::NewL( memToBeEaten ) );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrAllocRAM,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ // get the amount of memory left
+ err = HAL::Get( HALData::EMemoryRAMFree, memFree );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrFreeRAM,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ // send the amount of memory back
+ iReply = HBufC8::NewL( 4 );
+ iReply->Des().Append( ( TUint8* )( &memFree ), 4 );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleReleaseRamL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleReleaseRamL( const TDesC8& aMessage )
+ {
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ // if there's a memory eater, delete it
+ if ( iMemEater != NULL )
+ {
+ delete iMemEater;
+ iMemEater = NULL;
+ }
+
+ User::CompressAllHeaps();
+
+ // query the amount of memory and send it back
+ TInt memFree;
+ TInt err = HAL::Get( HALData::EMemoryRAMFree, memFree );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrHAL,
+ KSysInfoServiceUid );
+ }
+ else
+ {
+ iReply = HBufC8::NewL( 4 );
+ iReply->Des().Append( ( TUint8* )( &memFree ), 4 );
+ }
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetFreeDiskSpaceL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetFreeDiskSpaceL( const TDesC8& aMessage )
+ {
+ if ( aMessage.Length() != 2 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid);
+ return;
+ }
+
+ TInt drive;
+ RFs::CharToDrive( TChar( aMessage[1] ), drive );
+ TVolumeInfo volInfo;
+ TInt err = iFs.Volume( volInfo, drive );
+
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrVolInfo,
+ KSysInfoServiceUid );
+ }
+ else
+ {
+ iReply = HBufC8::NewL( 8 );
+ iReply->Des().Append( ( TUint8* )( &volInfo.iFree ), 8 );
+ }
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetUsedDiskSpaceL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetUsedDiskSpaceL( const TDesC8& aMessage )
+ {
+ if ( aMessage.Length() != 2 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid);
+ return;
+ }
+
+ TInt drive;
+ RFs::CharToDrive( TChar( aMessage[1] ), drive );
+ TVolumeInfo volInfo;
+ TInt err = iFs.Volume( volInfo, drive );
+
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrVolInfo,
+ KSysInfoServiceUid );
+ }
+ else
+ {
+ TInt64 used = volInfo.iSize - volInfo.iFree;
+ iReply = HBufC8::NewL( 8 );
+ iReply->Des().Append( ( TUint8* )( &used ), 8 );
+ }
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetTotalDiskSpaceL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetTotalDiskSpaceL(
+ const TDesC8& aMessage )
+ {
+ if ( aMessage.Length() != 2 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid);
+ return;
+ }
+
+ TInt drive;
+ RFs::CharToDrive( TChar( aMessage[1] ), drive );
+ TVolumeInfo volInfo;
+ TInt err = iFs.Volume( volInfo, drive );
+
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrVolInfo,
+ KSysInfoServiceUid );
+ }
+ else
+ {
+ iReply = HBufC8::NewL( 8 );
+ iReply->Des().Append( ( TUint8* )( &volInfo.iSize ), 8 );
+ }
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleEatDiskSpaceL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleEatDiskSpaceL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
+
+ if ( aMessage.Length() != 10 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid );
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
+ return;
+ }
+
+ TFileName commonpath;
+ commonpath.Append( aMessage[1] );
+ commonpath.Append( _L( ":" ) );
+ commonpath.Append( KTempFilePath );
+ commonpath.Append( KTempFileName );
+ TFileName path;
+
+ // get free disk space
+ TInt drive;
+ RFs::CharToDrive( TChar( aMessage[1] ), drive );
+ TVolumeInfo volInfo;
+ TInt err = iFs.Volume( volInfo, drive );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrVolInfo,
+ KSysInfoServiceUid );
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
+ return;
+ }
+
+ // calculate how much we must eat the disk space
+ TInt64 temp1 = aMessage[2] +
+ ( aMessage[3] << 8 ) +
+ ( aMessage[4] << 16 ) +
+ ( aMessage[5] << 24 );
+ TInt64 temp2 = aMessage[6] +
+ ( aMessage[7] << 8 ) +
+ ( aMessage[8] << 16 ) +
+ ( aMessage[9] << 24 );
+
+ TInt64 spaceLeftFree = temp1 + ( temp2 << 32) ;
+ TInt64 spaceToEat = volInfo.iFree - spaceLeftFree;
+
+ HTI_LOG_FORMAT( "Disk space to eat: %Ld", spaceToEat );
+
+ // check that there is enough free disk space
+ if ( spaceToEat < 0 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrDiskFull,
+ KErrDescrNotEnoughSpace,
+ KSysInfoServiceUid );
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
+ return;
+ }
+
+ // check if scaceToEat is greater than KMaxTInt
+ // --> it must be eaten in several chunks
+ // --> not yet supported.
+
+ TInt64 size;
+ for(TInt i=1; spaceToEat>0; i++)
+ {
+ path.Zero();
+ path.Copy(commonpath);
+ path.AppendNum(i);
+ if ( BaflUtils::FileExists( iFs, path ) )
+ {
+ continue;
+ }
+
+ if(spaceToEat > KMaxTInt)
+ size=KMaxTInt;
+ else
+ size=spaceToEat;
+
+ err = CreatFileToEatDiskSpace(path, size);
+ if(err)
+ {
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL CreateFile Fail" );
+ return;
+ }
+
+ iFs.Volume( volInfo, drive );
+ HTI_LOG_FORMAT( "current free space: %Ld", volInfo.iFree );
+ spaceToEat = volInfo.iFree - spaceLeftFree;
+ }
+
+ // all ok, send the remaining disk size back
+ iReply = HBufC8::NewL( 8 );
+ iReply->Des().Append( ( TUint8* )( &volInfo.iFree ), 8 );
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
+ }
+
+TInt CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace( TFileName aPath, TInt64 aSpaceToEat )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace" );
+
+ HTI_LOG_FORMAT( "Create file: %S", &aPath );
+ HTI_LOG_FORMAT( "file size %Ld", aSpaceToEat );
+
+ // create a temp file
+ RFile diskEater;
+ TInt err = diskEater.Replace( iFs, aPath, EFileWrite );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrCreateTempFile,
+ KSysInfoServiceUid );
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace Replace error" );
+ return err;
+ }
+
+ // set the size for temp file
+ err = diskEater.SetSize( I64LOW( aSpaceToEat ) );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrSetSizeTempFile,
+ KSysInfoServiceUid );
+ diskEater.Close();
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace SetSize error" );
+ return err;
+ }
+ diskEater.Close();
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace" );
+ return 0;
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
+ if ( aMessage.Length() != 2 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid);
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
+ return;
+ }
+
+ TFileName path;
+ path.Append( aMessage[1] );
+ path.Append( _L( ":" ) );
+ path.Append(KTempFilePath);
+ path.Append(KMatchFileName);
+ TInt err = iFileMan->Delete(path);
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrDeleteTempFile,
+ KSysInfoServiceUid );
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
+ return;
+ }
+
+ // query the free disk space
+ TInt drive;
+ RFs::CharToDrive( TChar( aMessage[1] ), drive );
+ TVolumeInfo volInfo;
+ err = iFs.Volume( volInfo, drive );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrVolInfo,
+ KSysInfoServiceUid );
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
+ return;
+ }
+
+ // all ok, send the free disk space back
+ iReply = HBufC8::NewL( 8 );
+ iReply->Des().Append( ( TUint8* )( &volInfo.iFree ), 8 );
+
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleSetHomeTimeL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleSetHomeTimeL( const TDesC8& aMessage )
+ {
+ TTime time;
+ TRAPD( err, ParseTimeDataL( aMessage.Mid( 1 ), time ) );
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( err,
+ KErrDescrArgument,
+ KSysInfoServiceUid);
+ return;
+ }
+
+ // User::SetHomeTime() does not work correctly with daylight saving time
+ // in S60 3.0 - have to use time zone server instead.
+ RTz tzServer;
+ err = tzServer.Connect();
+ if ( err == KErrNone )
+ {
+ err = tzServer.SetHomeTime( time );
+ }
+ tzServer.Close();
+
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( err,
+ KErrDescrSetTime,
+ KSysInfoServiceUid);
+ return;
+ }
+
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetHomeTimeL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetHomeTimeL( const TDesC8& aMessage )
+ {
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid );
+
+ return;
+ }
+
+ TTime time;
+ time.HomeTime();
+ TDateTime dateTime = time.DateTime();
+ TUint year = dateTime.Year();
+ iReply = HBufC8::NewL( KTimeDataLength );
+ iReply->Des().Append( (TUint8*)(&year), 2 );
+ iReply->Des().Append( dateTime.Month() + 1 );
+ iReply->Des().Append( dateTime.Day() + 1 );
+ iReply->Des().Append( dateTime.Hour() );
+ iReply->Des().Append( dateTime.Minute() );
+ iReply->Des().Append( dateTime.Second() );
+ }
+
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleSetDateTimeFormatL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleSetDateTimeFormatL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleSetDateTimeFormatL" );
+
+ if ( aMessage.Length() != KDateTimeFormatCmdLength )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+ // Parse values from message
+ TDateFormat dateFormat = STATIC_CAST( TDateFormat, aMessage[1] );
+ TChar dateSepar = aMessage[2];
+ TTimeFormat timeFormat = STATIC_CAST( TTimeFormat, aMessage[3] );
+ TChar timeSepar = aMessage[4];
+ TClockFormat clockFormat = STATIC_CAST( TClockFormat, aMessage[5] );
+
+ HTI_LOG_FORMAT( "Date format : %d", dateFormat );
+ HTI_LOG_FORMAT( "Date separator: %c", aMessage[2] );
+ HTI_LOG_FORMAT( "Time format : %d", timeFormat );
+ HTI_LOG_FORMAT( "Time separator: %c", aMessage[4] );
+ HTI_LOG_FORMAT( "Clock format : %d", clockFormat );
+
+ // Check validity of values
+ if ( dateFormat < EDateAmerican || dateFormat > EDateJapanese ||
+ timeFormat < ETime12 || timeFormat > ETime24 ||
+ clockFormat < EClockAnalog || clockFormat > EClockDigital ||
+ KDateSeparatorChars().Locate( dateSepar ) == KErrNotFound ||
+ KTimeSeparatorChars().Locate( timeSepar ) == KErrNotFound )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+ // Set the values
+ TLocale locale;
+ locale.SetDateFormat( dateFormat );
+ locale.SetDateSeparator( dateSepar, 1 );
+ locale.SetDateSeparator( dateSepar, 2 );
+ locale.SetTimeFormat( timeFormat );
+ locale.SetTimeSeparator( timeSepar, 1 );
+ locale.SetTimeSeparator( timeSepar, 2 );
+ locale.SetClockFormat( clockFormat );
+ TInt err = locale.Set();
+
+ if ( err != KErrNone )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( err,
+ KErrDescrDateTimeFormat, KSysInfoServiceUid );
+ }
+ else
+ {
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleSetDateTimeFormatL" );
+ }
+
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleLightsCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleLightsCommandL( const TDesC8& aMessage )
+ {
+ if ( aMessage[0] == ELightRelease )
+ {
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid);
+ }
+
+ else
+ {
+ HTI_LOG_TEXT( "ELightRelease" );
+ delete iLightsController;
+ iLightsController = NULL;
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ }
+ }
+
+ else
+ {
+ if ( !iLightsController )
+ {
+ HTI_LOG_TEXT( "Creating lights controller" );
+ iLightsController = CHtiLightsController::NewL(
+ iDispatcher );
+ }
+ TBuf8<4> reply;
+ iLightsController->ProcessMessageL( aMessage, reply );
+ if ( reply.Length() > 0 )
+ {
+ iReply = HBufC8::NewL( reply.Length() );
+ iReply->Des().Copy( reply );
+ }
+ }
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleScreenSaverCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleScreenSaverCommandL(
+ const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN(
+ "CHtiSysInfoServicePlugin::HandleScreenSaverCommandL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid);
+ return;
+ }
+
+ if ( aMessage[0] == EScreenSaverDisable ) iAllowSSValue = 1;
+ else if ( aMessage[0] == EScreenSaverEnable ) iAllowSSValue = 0;
+ else User::Leave( KErrArgument );
+
+ HTI_LOG_FORMAT( "Setting allow screen saver state %d", iAllowSSValue );
+
+ TInt err = KErrNone;
+
+ if ( !iAllowSSPropertyAttached )
+ {
+ HTI_LOG_TEXT( "Attaching to KScreenSaverAllowScreenSaver property" );
+ err = iAllowSSProperty.Attach(
+ KPSUidScreenSaver, KScreenSaverAllowScreenSaver );
+
+ if ( err )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err, KErrDescrScreenSaver, KSysInfoServiceUid );
+ return;
+ }
+
+ iAllowSSPropertyAttached = ETrue;
+ }
+
+ if ( iAllowSSValue == 1 )
+ {
+ iAllowSSProperty.Set( iAllowSSValue ); // ignore error
+ // Screen saver disabled. We want to keep it disabled, so
+ // subscribe to the property to get notified about changes in it.
+ if ( !iAllowSSSubscriber )
+ {
+ iAllowSSSubscriber = new (ELeave) CHtiPropertySubscriber(
+ TCallBack( HandleAllowSSPropertyChange, this ),
+ iAllowSSProperty );
+ iAllowSSSubscriber->Subscribe();
+ }
+ }
+
+ else // iAllowSSValue == 0
+ {
+ // Enabling screen saver. Cancel possible subscription so
+ // other applications can control the property.
+ if ( iAllowSSSubscriber )
+ {
+ iAllowSSSubscriber->Unsubscribe();
+ }
+ iAllowSSProperty.Set( iAllowSSValue ); // ignore error
+ iAllowSSProperty.Close();
+ iAllowSSPropertyAttached = EFalse;
+ delete iAllowSSSubscriber;
+ iAllowSSSubscriber = NULL;
+ }
+
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+#else
+ iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+ KErrDescrNotSupported, KSysInfoServiceUid);
+#endif
+ HTI_LOG_FUNC_OUT(
+ "CHtiSysInfoServicePlugin::HandleScreenSaverCommandL" );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL(
+ const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN(
+ "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ if ( aMessage.Length() != 2 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid);
+ return;
+ }
+
+ TInt time = aMessage[1];
+ HTI_LOG_FORMAT( "Requested timeout %d", time );
+ if ( time < 5 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrInvalidSSTimeout, KSysInfoServiceUid );
+ return;
+ }
+
+ CRepository* persRep = CRepository::NewL( KCRUidPersonalizationSettings );
+ TInt err = persRep->Set( KSettingsScreenSaverPeriod, time );
+
+ if ( err == KErrNone )
+ {
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ }
+
+ else
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( err,
+ KErrDescrSSTimeoutFailed, KSysInfoServiceUid );
+ }
+
+ delete persRep;
+#else
+ iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+ KErrDescrNotSupported, KSysInfoServiceUid);
+#endif
+ HTI_LOG_FUNC_OUT(
+ "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleNetworkModeCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleNetworkModeCommandL( const TDesC8& aMessage )
+{
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleNetworkModeCommandL" );
+
+ TInt err = StartC32();
+ if ( ( err != KErrNone ) && ( err != KErrAlreadyExists ) )
+ {
+ HTI_LOG_FORMAT( "StartC32 failed %d", err );
+ User::Leave( err );
+ }
+
+ // Connect to telephony server
+ RTelServer telServer;
+ err = telServer.Connect();
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "RTelServer::Connect() failed %d", err );
+ User::Leave( err );
+ }
+ CleanupClosePushL( telServer );
+
+ // load phonetsy
+ err = telServer.LoadPhoneModule( KMmTsyModuleName );
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "RTelServer::LoadPhoneModule() failed %d", err );
+ User::Leave( err );
+ }
+
+ // get phones
+ TInt noOfPhones;
+ err = telServer.EnumeratePhones( noOfPhones );
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "RTelServer::EnumeratePhones() failed %d", err );
+ User::Leave( err );
+ }
+
+ if ( noOfPhones == 0 )
+ {
+ HTI_LOG_TEXT( "No phones found" );
+ User::Leave( KErrNotFound );
+ }
+
+ HTI_LOG_FORMAT( "noOfPhones %d", noOfPhones );
+
+ RTelServer::TPhoneInfo phoneInfo;
+ for ( TInt i = 0; i < noOfPhones; i++ )
+ {
+ TName phoneTsy;
+ telServer.GetTsyName( i, phoneTsy );
+ HTI_LOG_DES( phoneTsy );
+
+ err = telServer.GetPhoneInfo( i, phoneInfo );
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "RTelServer::GetPhoneInfo() %d", i );
+ HTI_LOG_FORMAT( "failed %d", err );
+ User::Leave( err );
+ }
+ HTI_LOG_DES( phoneInfo.iName );
+ }
+
+ // open phone
+ RMobilePhone phone;
+ err = phone.Open( telServer, phoneInfo.iName );
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "RMobilePhone::Open() failed %d", err );
+ User::Leave( err );
+ }
+ CleanupClosePushL( phone );
+
+ err = phone.Initialise();
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "RMobilePhone::Initialise() failed %d", err );
+ User::Leave( err );
+ }
+
+ // Open customapi
+ RMmCustomAPI customAPI;
+ err = customAPI.Open( phone );
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "RMmCustomAPI::Open() %d", err );
+ User::LeaveIfError( err );
+ }
+ CleanupClosePushL( customAPI );
+
+ switch ( aMessage[0] )
+ {
+ case ENetworkModeGet:
+ {
+ HTI_LOG_TEXT( "ENetworkModeGet" );
+ TUint32 networkModes = 0;
+ err = customAPI.GetCurrentSystemNetworkModes( networkModes );
+ if ( err )
+ {
+ HTI_LOG_FORMAT(
+ "RMmCustomAPI::GetCurrentSystemNetworkModes() failed %d",
+ err );
+ User::LeaveIfError(
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrGetNetworkModes,
+ KSysInfoServiceUid ) );
+ }
+ else
+ {
+ HTI_LOG_FORMAT( "networkModes 0x%x", networkModes );
+ TBuf8<5> okMsg;
+ okMsg.Append( ENetworkModeGet );
+ okMsg.Append( (TUint8*) &networkModes, 4 );
+ iReply = okMsg.AllocL();
+ }
+ }
+ break;
+
+ case ENetworkModeSet:
+ HTI_LOG_TEXT( "ENetworkModeSet" );
+ if ( aMessage.Length() != 5 )
+ {
+ HTI_LOG_TEXT( "KErrArgument" );
+ User::LeaveIfError(
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid ) );
+ }
+ else
+ {
+ TUint32 mode = aMessage[1] + ( aMessage[2] << 8 ) +
+ ( aMessage[3] << 16 ) + ( aMessage[4] << 24 );
+
+ HTI_LOG_FORMAT( "SetSystemNetworkMode 0x%x", mode );
+ err = customAPI.SetSystemNetworkMode(
+ ( RMmCustomAPI::TNetworkModeCaps ) mode );
+ if ( err )
+ {
+ HTI_LOG_FORMAT(
+ "RMmCustomAPI::SetSystemNetworkMode() failed %d", err );
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrSetNetworkMode,
+ KSysInfoServiceUid );
+ }
+ else
+ {
+ iDispatcher->ShutdownAndRebootDeviceL();
+ }
+ }
+ break;
+
+ case ENetworkModeSetNoReboot:
+ {
+ HTI_LOG_TEXT( "ENetworkModeSetNoReboot" );
+ if ( aMessage.Length() != 5 )
+ {
+ HTI_LOG_TEXT( "KErrArgument" );
+ User::LeaveIfError(
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid ) );
+ }
+ else
+ {
+ TUint32 mode = aMessage[1] + ( aMessage[2] << 8 ) +
+ ( aMessage[3] << 16 ) + ( aMessage[4] << 24 );
+
+ HTI_LOG_FORMAT( "SetSystemNetworkMode 0x%x", mode );
+ err = customAPI.SetSystemNetworkMode(
+ ( RMmCustomAPI::TNetworkModeCaps ) mode );
+ if ( err )
+ {
+ HTI_LOG_FORMAT(
+ "RMmCustomAPI::SetSystemNetworkMode() failed %d", err );
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrSetNetworkMode,
+ KSysInfoServiceUid );
+ }
+ else
+ {
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ }
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ CleanupStack::PopAndDestroy( 3 ); // telServer, phone, customAPI
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleNetworkModeCommandL" );
+}
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleIrActivateCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleIrActivateCommandL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleIrActivateCommandL" );
+
+ // Message validation
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ TInt irStatus = -1;
+ TInt err = RProperty::Get( KIrdaPropertyCategory, KIrdaStatus, irStatus );
+ if ( err != KErrNone || irStatus < TIrdaStatusCodes::EIrLoaded
+ || irStatus > TIrdaStatusCodes::EIrDisconnected )
+ {
+ // values from irinternalpskey.h
+ err = RProperty::Set( KPSUidIrdaActivation, 1, 1 );
+ if ( err != KErrNone )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err, KErrDescrIrActivation, KSysInfoServiceUid );
+ }
+ else
+ {
+ // Activation OK
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ }
+ }
+ else
+ {
+ // Already active - just send a message
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 1 );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleIrActivateCommandL" );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleBtPowerCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleBtPowerCommandL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleBtPowerCommandL" );
+
+ // Message validation
+ if ( aMessage.Length() != 3 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ TInt err = KErrNone;
+ TBool setBtOn = aMessage[1];
+ TBool useForce = aMessage[2];
+ TBool isBtOn = EFalse;
+
+ TBTPowerStateValue powerState = EBTPowerOff;
+ CBTEngSettings* btSettings = CBTEngSettings::NewLC();
+ err = btSettings->GetPowerState( powerState );
+ if ( err == KErrNone && powerState == EBTPowerOn )
+ {
+ isBtOn = ETrue;
+ }
+
+ if ( err )
+ {
+ HTI_LOG_FORMAT( "GetPowerState error %d", err );
+ CleanupStack::PopAndDestroy(); // btSettings
+ iDispatcher->DispatchOutgoingErrorMessage( err, KErrDescrGetBtPower,
+ KSysInfoServiceUid );
+ return;
+ }
+ HTI_LOG_FORMAT( "Current BT power state %d", isBtOn );
+ HTI_LOG_FORMAT( "Requested BT power state %d", setBtOn );
+
+ if ( setBtOn == isBtOn )
+ {
+ // Already in requested state - just send message
+ CleanupStack::PopAndDestroy(); // btSettings
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 1 );
+ }
+
+ else
+ {
+ if ( setBtOn && !CanTurnBluetoothOnL( useForce ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrAccessDenied,
+ KErrDescrBtOnDenied, KSysInfoServiceUid );
+ return;
+ }
+
+
+ if ( !setBtOn )
+ {
+ // If we are setting BT off, do checks for active connections.
+ TInt connCount = 0;
+ // Ignore error.
+ // If we cannot query, we act like there's no active connections.
+ RProperty::Get( KPropertyUidBluetoothCategory,
+ KPropertyKeyBluetoothGetPHYCount,
+ connCount );
+ // Check if there's Bluetooth audio accessory connected
+ TBool isBtAacConnected = EFalse;
+
+ // If there are connections, force flag is required in the
+ // command to turn BT off.
+ if ( ( connCount || isBtAacConnected ) && !useForce )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrInUse,
+ KErrDescrBtOffDenied, KSysInfoServiceUid );
+ CleanupStack::PopAndDestroy(); // btMcm/btSettings
+ return;
+ }
+ }
+
+ if ( setBtOn )
+ {
+ err = btSettings->SetPowerState( EBTPowerOn );
+ }
+ else
+ {
+ err = btSettings->SetPowerState( EBTPowerOff );
+ }
+
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "CBTMCMSettings::SetPowerState error %d", err );
+ iDispatcher->DispatchOutgoingErrorMessage( err, KErrDescrSetBtPower,
+ KSysInfoServiceUid );
+ }
+ else
+ {
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ }
+ CleanupStack::PopAndDestroy(); // btSettings
+ }
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleBtPowerCommandL" );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleBtSettingsCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleBtSettingsCommandL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleBtSettingsCommandL" );
+
+ // Message validation
+ if ( aMessage.Length() < 4 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid );
+ return;
+ }
+ TInt btNameLength = aMessage[3];
+ if ( btNameLength > KMaxBtNameLength ||
+ aMessage.Length() != ( btNameLength + 4 ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ TBTVisibilityMode visibilityMode = EBTVisibilityModeGeneral;
+ if ( aMessage[1] == 0 )
+ {
+ visibilityMode = EBTVisibilityModeHidden;
+ }
+ HTI_LOG_FORMAT( "Visibility mode = %d", visibilityMode );
+
+ TInt sapMode = 1; // EBTSapEnabled
+ if ( aMessage[2] == 0 )
+ {
+ sapMode = 0; // EBTSapDisabled
+ }
+ HTI_LOG_FORMAT( "SAP mode = %d", sapMode );
+
+ TBuf<KMaxBtNameLength> btName;
+ if ( btNameLength > 0 )
+ {
+ btName.Copy( aMessage.Mid( 4, btNameLength ) );
+ }
+ HTI_LOG_FORMAT( "BT name = %S", &btName );
+
+ TInt err = KErrNone;
+ CBTEngSettings* btSettings = CBTEngSettings::NewLC();
+ HTI_LOG_TEXT( "CBTEngSettings::NewLC done" );
+
+ HTI_LOG_TEXT( "Setting visibility mode" );
+ err = btSettings->SetVisibilityMode( visibilityMode );
+ if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "Setting SAP mode" );
+ // CenRep UID and key value from btengprivatecrkeys.h
+ // const TUid KCRUidBTEngPrivateSettings = { 0x10204DAC }
+ // const TUint32 KBTSapEnabled = 0x00000003
+ CRepository* btEngRep = CRepository::NewL( TUid::Uid( 0x10204DAC ) );
+ err = btEngRep->Set( 0x00000003, sapMode );
+ delete btEngRep;
+ btEngRep = NULL;
+ }
+ if ( err == KErrNone && btName.Length() > 0 )
+ {
+ HTI_LOG_TEXT( "Setting BT name" );
+ err = btSettings->SetLocalName( btName );
+ }
+
+ if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "All set successfully" );
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ }
+ else
+ {
+ HTI_LOG_FORMAT( "Error %d", err );
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrBtSettings,
+ KSysInfoServiceUid );
+ }
+
+ CleanupStack::PopAndDestroy(); // btSettings
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleBtSettingsCommandL" );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleBtDeletePairingsL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleBtDeletePairingsL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleBtDeletePairingsL" );
+
+ // Message validation
+ if ( aMessage.Length() < 3 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ TInt btNameLength = aMessage[2];
+ if ( btNameLength > KMaxBluetoothNameLen ||
+ aMessage.Length() != ( btNameLength + 3 ) )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage(
+ KErrArgument,
+ KErrDescrArgument,
+ KSysInfoServiceUid );
+ return;
+ }
+
+ // Message parsing
+ TBool closeConnections = aMessage[1];
+ HTI_LOG_FORMAT( "Close connections = %d", closeConnections );
+ TBTDeviceName8 btName8;
+ if ( btNameLength > 0 )
+ {
+ btName8.Copy( aMessage.Mid( 3, btNameLength ) );
+ }
+ HTI_LOG_FORMAT( "BT name = %S",
+ &( BTDeviceNameConverter::ToUnicodeL( btName8 ) ) );
+
+ // Action
+ TInt deleteCount = 0;
+ TInt err = KErrNone;
+ RBTRegServ regServ;
+ RBTRegistry registry;
+ User::LeaveIfError( regServ.Connect() );
+ CleanupClosePushL( regServ );
+ User::LeaveIfError( registry.Open( regServ ) );
+ CleanupClosePushL( registry );
+ TBTRegistrySearch searchPattern;
+ searchPattern.FindBonded();
+
+ TRequestStatus status;
+ registry.CreateView( searchPattern, status );
+ User::WaitForRequest( status );
+ err = status.Int();
+ HTI_LOG_FORMAT( "RBTRegistry::CreateView returned %d", err );
+
+ if ( err > 0 )
+ {
+ CBTRegistryResponse* response = CBTRegistryResponse::NewL( registry );
+ CleanupStack::PushL( response );
+ HTI_LOG_TEXT( "Creating AsyncWaiter" );
+ CAsyncWaiter* waiter = CAsyncWaiter::NewLC();
+ HTI_LOG_TEXT( "Calling response->Start()" );
+ response->Start( waiter->iStatus );
+ HTI_LOG_TEXT( "Calling waiter->StartAndWait()" );
+ waiter->StartAndWait();
+ err = waiter->Result();
+ CleanupStack::PopAndDestroy( waiter );
+
+ if ( err == KErrNone )
+ {
+ RBTDeviceArray results = response->Results();
+ TInt count = results.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ HTI_LOG_FORMAT( "Device %d", i + 1 );
+ CBTDevice* device = results[i];
+ if ( btNameLength == 0 ||
+ device->DeviceName().Match( btName8 ) != KErrNotFound )
+ {
+ HTI_LOG_TEXT( "Name qualifies for deletion" );
+ registry.UnpairDevice( device->BDAddr(), status );
+ User::WaitForRequest( status );
+ err = status.Int();
+ if ( err == KErrNone )
+ {
+ deleteCount++; // one deletion successfully done
+ }
+ }
+ if ( err != KErrNone )
+ {
+ // Break out if any failure occurs - the command has not
+ // been able to do what it is expected to do.
+ break;
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy( response );
+ }
+
+ CleanupStack::PopAndDestroy( ®istry );
+ CleanupStack::PopAndDestroy( ®Serv );
+
+ // Create OK response or send error
+ if ( err == KErrNone )
+ {
+ HTI_LOG_FORMAT( "%d pairings deleted successfully", deleteCount );
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( deleteCount );
+ }
+ else
+ {
+ HTI_LOG_FORMAT( "Error %d", err );
+ iDispatcher->DispatchOutgoingErrorMessage(
+ err,
+ KErrDescrBtDeletePairings,
+ KSysInfoServiceUid );
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleBtDeletePairingsL" );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleKeyLockToggleL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleKeyLockToggleL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleKeyLockToggleL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+ if ( aMessage.Length() != 3 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+ RAknKeyLock keyLock;
+ User::LeaveIfError( keyLock.Connect() );
+ HTI_LOG_TEXT( "RAknKeyLock connect OK" );
+
+ TBool isKeyLockOn = keyLock.IsKeyLockEnabled();
+ HTI_LOG_FORMAT( "Keylock status = %d", isKeyLockOn );
+
+ TBool requested = aMessage[1];
+ HTI_LOG_FORMAT( "Requested status = %d", requested );
+
+ if ( requested == isKeyLockOn )
+ {
+ // Already in requested state - just send message
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 1 );
+ }
+
+ else
+ {
+ TBool showNote = aMessage[2];
+ HTI_LOG_FORMAT( "Note request = %d", showNote );
+ if ( requested )
+ {
+ if ( showNote )
+ {
+ keyLock.EnableKeyLock();
+ }
+ else
+ {
+ keyLock.EnableWithoutNote();
+ }
+ }
+ else
+ {
+ if ( showNote )
+ {
+ keyLock.DisableKeyLock();
+ }
+ else
+ {
+ keyLock.DisableWithoutNote();
+ }
+ }
+ User::After( 500000 );
+ isKeyLockOn = keyLock.IsKeyLockEnabled();
+ HTI_LOG_FORMAT( "New keylock status = %d", isKeyLockOn );
+ if ( isKeyLockOn == requested )
+ {
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ }
+ else
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrGeneral,
+ KErrDescrKeyLock, KSysInfoServiceUid );
+ }
+ }
+
+ keyLock.Close();
+#else
+ iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+ KErrDescrNotSupported, KSysInfoServiceUid);
+#endif
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleKeyLockToggleL" );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleAutoKeyGuardTimeL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleAutoKeyGuardTimeL( const TDesC8& aMessage )
+ {
+
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleAutoKeyGuardTimeL" );
+
+ if ( aMessage.Length() != 3 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+ TInt time = aMessage[1] + ( aMessage[2] << 8 );
+ HTI_LOG_FORMAT( "Requested auto key guard time %d", time );
+ if ( time > 3600 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrInvalidTime, KSysInfoServiceUid );
+ return;
+ }
+
+ CRepository* secRep = CRepository::NewL( KCRUidSecuritySettings );
+ TInt err = secRep->Set( KSettingsAutomaticKeyguardTime, time );
+
+ if ( err == KErrNone )
+ {
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ }
+
+ else
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( err,
+ KErrDescrAutoKeyGuardFailed, KSysInfoServiceUid );
+ }
+
+ delete secRep;
+
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleAutoKeyGuardTimeL" );
+ }
+
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleEmptyDrmRightsDbL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleEmptyDrmRightsDbL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleEmptyDrmRightsDbL" );
+
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+ RDRMRightsClient rightsClient;
+ TInt err = rightsClient.Connect();
+
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "RDRMRightsClient connect failed %d", err );
+ iDispatcher->DispatchOutgoingErrorMessage( err,
+ KErrDescrDrmDbConnect, KSysInfoServiceUid );
+ }
+
+ else
+ {
+ HTI_LOG_TEXT( "RDRMRightsClient connect OK, clearing DB..." );
+ err = rightsClient.DeleteAll();
+ if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "DB cleared OK" );
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ }
+ else
+ {
+ HTI_LOG_FORMAT( "DB clear failed %d", err );
+ iDispatcher->DispatchOutgoingErrorMessage( err,
+ KErrDescrDrmDbDelete, KSysInfoServiceUid );
+ }
+ rightsClient.Close();
+ }
+
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEmptyDrmRightsDbL" );
+ }
+
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleBatteryStatusL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleBatteryStatusL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleBatteryStatusL" );
+
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+ TInt err = KErrNone;
+ TInt batteryLevel = EBatteryLevelUnknown;
+ TInt chargingStatus = EChargingStatusError;
+
+ err = RProperty::Get( KPSUidHWRMPowerState,
+ KHWRMBatteryLevel, batteryLevel );
+ HTI_LOG_FORMAT( "Battery level = %d", batteryLevel );
+ if ( err != KErrNone || batteryLevel == EBatteryLevelUnknown )
+ {
+ if ( err == KErrNone ) err = KErrGeneral;
+ iDispatcher->DispatchOutgoingErrorMessage( err,
+ KErrDescrBatteryLevel, KSysInfoServiceUid );
+ return;
+ }
+
+ err = RProperty::Get( KPSUidHWRMPowerState,
+ KHWRMChargingStatus, chargingStatus );
+ HTI_LOG_FORMAT( "Charging status = %d", chargingStatus );
+ if ( err != KErrNone || chargingStatus == EChargingStatusError )
+ {
+ if ( err == KErrNone ) err = KErrGeneral;
+ iDispatcher->DispatchOutgoingErrorMessage( err,
+ KErrDescrChargingStatus, KSysInfoServiceUid );
+ return;
+ }
+
+ iReply = HBufC8::NewL( 2 );
+ iReply->Des().Append( batteryLevel );
+ iReply->Des().Append( chargingStatus );
+
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleBatteryStatusL" );
+ }
+
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleSignalStrengthL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleSignalStrengthL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleSignalStrengthL" );
+
+ if ( aMessage.Length() != 1 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+#if defined(__WINS__)
+ iDispatcher->DispatchOutgoingErrorMessage( KErrNotSupported,
+ KErrDescrNotSupported, KSysInfoServiceUid );
+#else
+ TInt err = KErrNone;
+ TInt popCount = 0;
+ RTelServer server;
+ err = server.Connect();
+
+ if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "Connected to RTelServer" );
+ CleanupClosePushL( server );
+ popCount++;
+ err = server.LoadPhoneModule( KMmTsyModuleName );
+ if ( err == KErrAlreadyExists ) err = KErrNone; // ok if already loaded
+ }
+
+ RMobilePhone mobilePhone;
+
+ if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "Phone module loaded" );
+ err = mobilePhone.Open( server, KMmTsyPhoneName );
+ }
+
+ TInt8 signalBars;
+ TInt32 signalStrength;
+
+ if ( err == KErrNone )
+ {
+ HTI_LOG_TEXT( "RMobilePhone open" );
+ CleanupClosePushL( mobilePhone );
+ popCount++;
+ TRequestStatus status;
+ mobilePhone.GetSignalStrength( status, signalStrength, signalBars );
+ User::WaitForRequest( status );
+ HTI_LOG_FORMAT( "GetSignalStrength return value %d", status.Int() );
+ err = status.Int();
+ }
+
+ if ( err == KErrNone )
+ {
+ HTI_LOG_FORMAT( "Signal bars = %d", signalBars );
+ HTI_LOG_FORMAT( "Signal strength = %d", signalStrength );
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( signalBars );
+ }
+
+ else
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( err,
+ KErrDescrSignalStrength, KSysInfoServiceUid );
+ }
+
+ if ( popCount > 0 )
+ {
+ CleanupStack::PopAndDestroy( popCount );
+ }
+#endif // __WINS__
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleSignalStrengthL" );
+ }
+
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleHsdpaCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleHsdpaCommandL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleHsdpaCommandL" );
+
+ if ( aMessage.Length() != 2 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+ TBool enableHsdpa = aMessage[1];
+
+ RTelServer telServer;
+ RMmCustomAPI customAPI;
+ RMobilePhone mobilePhone;
+ User::LeaveIfError( telServer.Connect() );
+ CleanupClosePushL( telServer );
+ User::LeaveIfError( mobilePhone.Open( telServer, KMmTsyPhoneName ) );
+ CleanupClosePushL( mobilePhone );
+ User::LeaveIfError( customAPI.Open( mobilePhone ) );
+ CleanupClosePushL( customAPI );
+
+ // Get current HSDPA status
+ TBool isHsdpaEnabled = EFalse;
+ TRequestStatus status;
+ RMmCustomAPI::THSxPAStatus hSxPAStatus;
+ customAPI.ReadHSxPAStatus( status, hSxPAStatus );
+ User::WaitForRequest( status );
+ HTI_LOG_FORMAT( "Reading HSxPA status returned %d", status.Int() );
+ User::LeaveIfError( status.Int() );
+ if ( hSxPAStatus == RMmCustomAPI::EHSxPAEnabled )
+ {
+ isHsdpaEnabled = ETrue;
+ }
+
+ HTI_LOG_FORMAT( "Current HSDPA status = %d", isHsdpaEnabled );
+ HTI_LOG_FORMAT( "Requested HSDPA status = %d", enableHsdpa );
+
+ if ( isHsdpaEnabled == enableHsdpa )
+ {
+ // Already in requested state - just send message
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 1 );
+ }
+
+ else
+ {
+ // Try to change status
+ if ( enableHsdpa )
+ {
+ hSxPAStatus = RMmCustomAPI::EHSxPAEnabled;
+ }
+ else
+ {
+ hSxPAStatus = RMmCustomAPI::EHSxPADisabled;
+ }
+ customAPI.WriteHSxPAStatus( status, hSxPAStatus );
+ User::WaitForRequest( status );
+ HTI_LOG_FORMAT( "Writing HSxPA status returned %d", status.Int() );
+ User::LeaveIfError( status.Int() );
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ }
+
+ CleanupStack::PopAndDestroy( 3 ); // mobilePhone, customAPI, telServer
+
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleHsdpaCommandL" );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleUpdateMediaGalleryL()
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleUpdateMediaGalleryL(
+ const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleUpdateMediaGalleryL" );
+
+ if ( !iGalleryUpdateSupported )
+ {
+ HTI_LOG_TEXT( "Media Gallery update not supported" );
+ iDispatcher->DispatchOutgoingErrorMessage( KErrNotSupported,
+ KErrDescrNotSupported, KSysInfoServiceUid );
+ return;
+ }
+
+ if ( aMessage.Length() < 2 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+ TInt filePathLength = aMessage[1];
+ // Check that given file path length is valid: Index 0 is the
+ // command code, index 1 is the path length -> hence the + 2
+ if ( aMessage.Length() != filePathLength + 2 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+ // Try to load the Media File API DLL
+ TInt err = KErrNone;
+ RLibrary galleryUpdaterDLL;
+ err = galleryUpdaterDLL.Load( _L( "MGXMediaFileAPI.dll" ) );
+ if ( err == KErrNotFound ) // DLL does not exist
+ {
+ HTI_LOG_TEXT( "MGXMediaFileAPI.dll file not found" );
+ iGalleryUpdateSupported = EFalse;
+ iDispatcher->DispatchOutgoingErrorMessage( KErrNotSupported,
+ KErrDescrNotSupported, KSysInfoServiceUid );
+ return;
+ }
+ User::LeaveIfError( err ); // Some other error in loading the DLL
+
+ // DLL loaded successfully
+ CleanupClosePushL( galleryUpdaterDLL );
+
+ // Construct the CMGXFileManager object from the DLL
+ typedef CMGXFileManager* ( *TNewFileManagerFunc )( RFs& aFs );
+ TNewFileManagerFunc newFileManFunc =
+ ( TNewFileManagerFunc ) galleryUpdaterDLL.Lookup( 1 );
+ if ( newFileManFunc == NULL )
+ {
+ HTI_LOG_TEXT( "Function not found from DLL" );
+ iGalleryUpdateSupported = EFalse;
+ User::Leave( KErrNotSupported );
+ }
+
+ CMGXFileManager* mgManager = NULL;
+ TRAP( err, mgManager = newFileManFunc( iFs ) );
+ HTI_LOG_FORMAT( "NewFileManagerL returned %d", err );
+ User::LeaveIfError( err );
+ User::LeaveIfNull( mgManager );
+ CleanupStack::PushL( mgManager );
+
+ if ( filePathLength > 0 )
+ {
+ TBuf<KMaxFileName> path;
+ path.Copy( aMessage.Mid( 2 ) );
+ HTI_LOG_FORMAT( "Updating file %S to gallery", &path );
+ TRAP( err, mgManager->UpdateL( path ) );
+ }
+ else
+ {
+ HTI_LOG_TEXT( "Updating all files to gallery" );
+ TRAP( err, mgManager->UpdateL() );
+ }
+
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "Gallery update failed with %d", err );
+ iDispatcher->DispatchOutgoingErrorMessage( err, KErrDescrMGUpdate,
+ KSysInfoServiceUid );
+ }
+
+ CleanupStack::PopAndDestroy( 2 ); // mgManager, galleryUpdaterDLL
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleUpdateMediaGalleryL" );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleActivateSkinL()
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleActivateSkinL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleActivateSkinL" );
+
+ // Must be at least command code + name length byte
+ if ( aMessage.Length() < 2 || aMessage.Length() != aMessage[1] + 2 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+ TFileName skinName;
+ if ( aMessage[1] > 0 )
+ {
+ skinName.Copy( aMessage.Mid( 2 ) );
+ }
+ HTI_LOG_FORMAT( "Skin name: %S", &skinName );
+
+ // Check if we got full path to skn file
+ TParse fileParse;
+ fileParse.Set( skinName, NULL, NULL );
+ TBool isFullPath = fileParse.DrivePresent() && fileParse.PathPresent() &&
+ fileParse.NamePresent() && fileParse.ExtPresent();
+ HTI_LOG_FORMAT( "Is full path = %d", isFullPath );
+
+ // Check current skin
+ TAknsPkgIDBuf pidBuf;
+ TInt currentSkinLocation; // TAknSkinSrvSkinPackageLocation
+ CRepository* repository =
+ CRepository::NewL( KCRUidPersonalisation );
+ CleanupStack::PushL( repository );
+ repository->Get( KPslnActiveSkinUid, pidBuf );
+ repository->Get( KPslnActiveSkinLocation, currentSkinLocation );
+ TAknsPkgID currentSkinPid;
+ currentSkinPid.SetFromDesL( pidBuf );
+ HTI_LOG_FORMAT( "Current skin pkg ID buf = %S", &pidBuf );
+ HTI_LOG_FORMAT( "Current skin location = %d", currentSkinLocation );
+
+ // Connect to the skins server
+ RAknsSrvSession skinsSession;
+ User::LeaveIfError( skinsSession.Connect() );
+ CleanupClosePushL( skinsSession );
+
+ // Resolve the ID for the requested skin
+ TAknsPkgID requestedSkinPid = KAknsNullPkgID;
+ TInt requestedSkinLocation = EAknsSrvPhone;
+
+ if ( skinName.Length() == 0 )
+ {
+ // Default skin requested - resolve default skin ID
+ // Use KAknsPIDS60DefaultSkin if nothing else found from CenRep
+ requestedSkinPid.Set( KAknsPIDS60DefaultSkin );
+ TAknsPkgID defaultSkin = KAknsNullPkgID;
+ TAknsPkgIDBuf defaultPidBuf;
+ TInt ret = repository->Get( KPslnDefaultSkinUID, defaultPidBuf );
+ if ( ret != KErrNone || defaultPidBuf.Length() == 0 )
+ {
+ HTI_LOG_TEXT( "KPslnDefaultSkinUID not found" );
+ TInt defaultID = 0;
+ ret = repository->Get( KPslnDefaultSkinID, defaultID );
+ if ( ret == KErrNone && defaultID != 0 )
+ {
+ HTI_LOG_FORMAT( "KPslnDefaultSkinID found: %d", defaultID );
+ defaultSkin.Set( TUid::Uid( defaultID ) );
+ }
+ }
+ else
+ {
+ HTI_LOG_FORMAT( "KPslnDefaultSkinUID found: %S", &defaultPidBuf );
+ TLex lexer( defaultPidBuf );
+ TPtrC pidToken( lexer.NextToken() );
+ TUint pid = 0;
+ TUint timeStamp = 0;
+ // as hex UID is 8 characters
+ // as decimal UID is 9 or 10 characters
+ if ( pidToken.Length() == 8 )
+ {
+ ret = TLex( pidToken ).Val( pid, EHex ); // value is in hex
+ }
+ else
+ {
+ ret = TLex( pidToken ).Val( pid ); // value is in decimal
+ }
+ if ( ret == KErrNone )
+ {
+ TPtrC stampToken( lexer.NextToken() );
+ // Timestamp doesn't exist if PID is an UID
+ if ( stampToken.Length() )
+ {
+ if ( stampToken.Length() == 8 )
+ {
+ // value is in hex
+ ret = TLex( stampToken ).Val( timeStamp, EHex );
+ }
+ else
+ {
+ // value is decimal
+ ret = TLex( stampToken ).Val( timeStamp );
+ }
+ }
+ }
+ if ( ret == KErrNone )
+ {
+ // We have found some valid values.
+ // Timestamp is 0 if pid is UID value
+ HTI_LOG_FORMAT( "PID %d", pid );
+ HTI_LOG_FORMAT( "Timestamp %d", timeStamp );
+ defaultSkin.Set( timeStamp, pid );
+ }
+ }
+ // Did we find something from CenRep
+ if ( defaultSkin != KAknsNullPkgID )
+ {
+ requestedSkinPid.Set( defaultSkin );
+ }
+ }
+
+ else
+ {
+ // We have skin name - try to find it
+ CArrayPtr<CAknsSrvSkinInformationPkg>* skinInfoArray =
+ skinsSession.EnumerateSkinPackagesL( EAknsSrvAll );
+ HTI_LOG_FORMAT( "Skins found: %d", skinInfoArray->Count() );
+ TInt i = 0;
+ for ( ; i < skinInfoArray->Count(); i++ )
+ {
+ if ( isFullPath )
+ {
+ if ( skinName.CompareF(
+ skinInfoArray->At( i )->FullName() ) == 0 )
+ {
+ requestedSkinPid = skinInfoArray->At( i )->PID();
+ }
+ }
+ else
+ {
+ if ( skinName.CompareF( skinInfoArray->At( i )->Name() ) == 0 )
+ {
+ requestedSkinPid = skinInfoArray->At( i )->PID();
+ }
+ }
+ if ( requestedSkinPid != KAknsNullPkgID )
+ {
+ // Requested skin was found - check the location
+ TUint16 drive = ( skinInfoArray->At( i )->Directory() )[0];
+ if ( drive == 'E' || drive == 'e' )
+ {
+ requestedSkinLocation = EAknsSrvMMC;
+ }
+ else
+ {
+ requestedSkinLocation = EAknsSrvPhone;
+ }
+ break;
+ }
+ }
+ skinInfoArray->ResetAndDestroy(); // not needed anymore
+ delete skinInfoArray;
+ skinInfoArray = NULL;
+ }
+
+ if ( requestedSkinPid != KAknsNullPkgID )
+ {
+ // Do we need to change skin
+ if ( requestedSkinPid != currentSkinPid )
+ {
+ HTI_LOG_FORMAT( "Activating skin %d", requestedSkinPid.iNumber );
+ TInt err = skinsSession.SetAllDefinitionSets( requestedSkinPid );
+ HTI_LOG_FORMAT( "Activation returned %d", err );
+ if ( err == KErrNone )
+ {
+ TAknsPkgIDBuf newPidBuf;
+ requestedSkinPid.CopyToDes( newPidBuf );
+ err = repository->Set( KPslnActiveSkinUid, newPidBuf );
+ HTI_LOG_FORMAT( "Set KPslnActiveSkinUid returned %d", err );
+ if ( err == KErrNone &&
+ requestedSkinLocation != currentSkinLocation )
+ {
+ err = repository->Set(
+ KPslnActiveSkinLocation, requestedSkinLocation );
+ HTI_LOG_FORMAT( "Set KPslnActiveSkinLocation returned %d",
+ err );
+ }
+ if ( err == KErrNone )
+ {
+ // Send OK message
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 ); // 0 means OK
+ }
+ }
+ if ( err != KErrNone )
+ {
+ HTI_LOG_FORMAT( "Skin activation failed with %d", err );
+ iDispatcher->DispatchOutgoingErrorMessage( err,
+ KErrDescrActivateSkin, KSysInfoServiceUid );
+ }
+ }
+ else
+ {
+ // Requested skin already active - just send message
+ HTI_LOG_TEXT( "Already active - no need to change" );
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 1 ); // 1 means "already active"
+ }
+ }
+
+ else
+ {
+ // Skin was not found
+ HTI_LOG_TEXT( "Skin was not found" );
+ iDispatcher->DispatchOutgoingErrorMessage( KErrNotFound,
+ KErrDescrActivateSkin, KSysInfoServiceUid );
+ }
+
+ CleanupStack::PopAndDestroy( 2 ); // skinsSession, repository
+
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleActivateSkinL" );
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleSetLanguageL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleSetLanguageL( const TDesC8& aMessage )
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleSetLanguageL" );
+ if ( aMessage.Length() != 3 )
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrArgument, KSysInfoServiceUid );
+ return;
+ }
+
+ TInt language = aMessage[1] + ( aMessage[2] << 8 );
+ if(language < 0)
+ {
+ iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+ KErrDescrSetLanguage, KSysInfoServiceUid );
+ return;
+ }
+ HTI_LOG_FORMAT( "Set language to %d", language );
+
+ // Never set Language code 0 to HAL
+ if (language != 0)
+ {
+ User::LeaveIfError(HAL::Set(HAL::ELanguageIndex, language));
+ }
+
+ CRepository* commonEngineRepository = CRepository::NewL(
+ KCRUidCommonEngineKeys);
+ CleanupStack::PushL(commonEngineRepository);
+
+ User::LeaveIfError(commonEngineRepository->Set(KGSDisplayTxtLang, language));
+
+ CleanupStack::PopAndDestroy();
+
+ TBool nbrModeSaved = EFalse;
+ if (language == ELangArabic || User::Language() == ELangArabic)
+ {
+ //numberMode = EGSNumberModeArabicIndic;
+ SetDefaultNumberModeL(EGSNbrModeArabic, EGSNbrModeTypeArabic);
+ nbrModeSaved = ETrue;
+ }
+ else if ((language == ELangUrdu || User::Language() == ELangUrdu)
+ || (language == ELangFarsi || User::Language() == ELangFarsi))
+ {
+ //numberMode = EGSNumberModeEasternArabicIndic;
+ SetDefaultNumberModeL(EGSNbrModeLatin, EGSNbrModeTypeEasternArabic);
+ nbrModeSaved = ETrue;
+ }
+ else if (language == ELangHindi || User::Language() == ELangHindi
+ || language == ELangMarathi || User::Language() == ELangMarathi)
+ {
+ //numberMode = EGSNumberModeIndic;
+ SetDefaultNumberModeL(EGSNbrModeLatin, EGSNbrModeTypeIndic);
+ nbrModeSaved = ETrue;
+ }
+
+ //if number mode is not set above, then set it to Latin with respective
+ //number mode types. This part might be executed when Automatic is
+ //selected and the SIM card does not support the language.
+ if (!nbrModeSaved)
+ {
+ TInt nbrModeType = EGSNbrModeTypeIndic;
+ if (language == ELangArabic || User::Language() == ELangArabic)
+ {
+ nbrModeType = EGSNbrModeTypeArabic;
+ }
+ else if ((language == ELangUrdu || User::Language() == ELangUrdu)
+ || (language == ELangFarsi || User::Language() == ELangFarsi))
+ {
+ nbrModeType = EGSNbrModeTypeEasternArabic;
+ }
+
+ //EGSNumberModeLatin is true in both cases;
+ SetDefaultNumberModeL(EGSNbrModeLatin, nbrModeType);
+ }
+
+ // Change input language
+ CRepository* aknFepRepository = CRepository::NewL( KCRUidAknFep );
+ CleanupStack::PushL(aknFepRepository);
+ User::LeaveIfError( aknFepRepository->Set( KAknFepInputTxtLang,
+ language ));
+ // Change input method for Chinese variants
+ if( FeatureManager::FeatureSupported( KFeatureIdChinese ) )
+ {
+ TBuf<KFepChineseInputModeLength> conversion;
+ if( language == ELangPrcChinese )
+ {
+ conversion.Num( EPinyin, EHex );
+ User::LeaveIfError( aknFepRepository->Set( KAknFepChineseInputMode, conversion ) );
+ }
+ else if( language == ELangHongKongChinese )
+ {
+ conversion.Num( EStroke, EHex );
+ User::LeaveIfError( aknFepRepository->Set( KAknFepChineseInputMode, conversion ) );
+ }
+ else if( language == ELangTaiwanChinese )
+ {
+ conversion.Num( EZhuyin, EHex );
+ User::LeaveIfError( aknFepRepository->Set( KAknFepChineseInputMode, conversion ) );
+ }
+ }
+ CleanupStack::PopAndDestroy();
+
+ iReply = HBufC8::NewL( 1 );
+ iReply->Des().Append( 0 );
+ HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleSetLanguageL" );
+ }
+
+void CHtiSysInfoServicePlugin::SetDefaultNumberModeL(TInt aMode, TInt aNbrModeType)
+ {
+
+ CRepository* localeRepository = CRepository::NewL(KCRUidLocaleSettings);
+ CleanupStack::PushL(localeRepository);
+ if (aNbrModeType == EGSNbrModeTypeArabic || aNbrModeType
+ == EGSNbrModeTypeEasternArabic)
+ {
+ localeRepository->Set(KSettingsDefaultNumberMode, aMode);
+ }
+ else
+ {
+ localeRepository->Set(KSettingsIndicDefaultNumberMode, aMode);
+ }
+ CleanupStack::PopAndDestroy();
+
+ TLocale locale;
+ if (aMode == EGSNbrModeLatin)
+ {
+ locale.SetDigitType(EDigitTypeWestern);
+ }
+ else
+ {
+ //if aMode <> EGSNbrModeLatin, then it should be either latin or arabic. However
+ //as EGSNbrModeArabic and EGsNbrModeIndic both have a value = 1, we can't use
+ //that constant for below comparison. Hence, need to depend on the 2nd param.
+ switch (aNbrModeType)
+ {
+ case EGSNbrModeTypeArabic:
+ locale.SetDigitType(EDigitTypeArabicIndic);
+ break;
+ case EGSNbrModeTypeIndic:
+ locale.SetDigitType(EDigitTypeDevanagari);
+ break;
+ case EGSNbrModeTypeEasternArabic:
+ locale.SetDigitType(EDigitTypeEasternArabicIndic);
+ break;
+ default:
+ break;
+ }
+ }
+
+ locale.Set();
+ }
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::ParseTimeDataL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::ParseTimeDataL( const TDesC8& aTimeData,
+ TTime& aResult )
+ {
+ /*
+ aTimeData =
+ bytes 0 - 1 = year
+ 2 = month
+ 3 = day
+ 4 = hour
+ 5 = minute
+ 6 = second
+ */
+ if ( aTimeData.Length() != KTimeDataLength )
+ {
+ User::Leave( KErrBadDescriptor );
+ }
+
+ TInt year = aTimeData[0] + ( aTimeData[1] << 8 );
+ TInt month = aTimeData[2];
+ TInt day = aTimeData[3];
+ TInt hour = aTimeData[4];
+ TInt minute = aTimeData[5];
+ TInt second = aTimeData[6];
+
+ TDateTime dateTime;
+ User::LeaveIfError( dateTime.Set(
+ year, TMonth( month - 1 ), day - 1, hour, minute, second, 0 ) );
+ aResult = dateTime;
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::CleanUpTempFiles
+//------------------------------------------------------------------------------
+TInt CHtiSysInfoServicePlugin::CleanUpTempFiles()
+ {
+ HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::CleanUpTempFiles" );
+ TFindFile finder( iFs );
+ CDir* dir = NULL;
+ TInt err = finder.FindWildByDir(KMatchFileName, KTempFilePath, dir);
+ TInt safeDeleteCount = 0;
+ while ( err == KErrNone && safeDeleteCount < 20)
+ {
+ safeDeleteCount++;
+ TFileName path;
+ path.Copy(finder.File());
+ HTI_LOG_FORMAT( "found file: %S", &path );
+ TInt ret = iFileMan->Delete(path);
+ delete dir;
+ dir = NULL;
+ if(ret != KErrNone)
+ {
+ break;
+ }
+ err = finder.FindWildByDir(KMatchFileName, KTempFilePath, dir);
+ }
+ HTI_LOG_FUNC_OUT("CHtiSysInfoServicePlugin::CleanUpTempFiles");
+ return KErrNone;
+ }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::CanTurnBluetoothOnL
+//------------------------------------------------------------------------------
+TBool CHtiSysInfoServicePlugin::CanTurnBluetoothOnL( const TBool aUseForce )
+ {
+ HTI_LOG_FUNC_IN("CHtiSysInfoServicePlugin::CanTurnBluetoothOnL");
+ TInt isInNetwork = 0;
+ CRepository* repository = CRepository::NewL( KCRUidCoreApplicationUIs );
+ repository->Get( KCoreAppUIsNetworkConnectionAllowed, isInNetwork );
+ HTI_LOG_FORMAT( "isInNetwork = %d", isInNetwork );
+ delete repository;
+
+ if ( isInNetwork )
+ {
+ return ETrue;
+ }
+
+ // Phone is offline - check if it's allowed to turn BT on.
+
+ // If the force flag was not set in command, we won't turn BT on in offline.
+ if ( !aUseForce )
+ {
+ return EFalse;
+ }
+
+ // Check if it's possible to turn BT on in offline mode.
+ TInt btOfflineEnabled = 0;
+ CRepository* repository2 = CRepository::NewL( KCRUidBluetoothEngine );
+ repository2->Get( KBTEnabledInOffline, btOfflineEnabled );
+ HTI_LOG_FORMAT( "btOfflineEnabled = %d", btOfflineEnabled );
+ delete repository2;
+
+ if ( btOfflineEnabled )
+ {
+ return ETrue;
+ }
+ HTI_LOG_FUNC_OUT("CHtiSysInfoServicePlugin::CanTurnBluetoothOnL");
+ return EFalse;
+ }
+
+
+// ----------------------------------------------------------------------------
+CAsyncWaiter* CAsyncWaiter::NewL( TInt aPriority )
+ {
+ CAsyncWaiter* self = new(ELeave) CAsyncWaiter( aPriority );
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+CAsyncWaiter* CAsyncWaiter::NewLC( TInt aPriority )
+ {
+ CAsyncWaiter* self = new ( ELeave ) CAsyncWaiter( aPriority );
+ CleanupStack::PushL( self );
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+CAsyncWaiter::CAsyncWaiter( TInt aPriority ) : CActive( aPriority )
+ {
+ iWait = new CActiveSchedulerWait();
+ CActiveScheduler::Add( this );
+ }
+
+// ----------------------------------------------------------------------------
+CAsyncWaiter::~CAsyncWaiter()
+ {
+ Cancel();
+ delete iWait;
+ }
+
+// ----------------------------------------------------------------------------
+void CAsyncWaiter::StartAndWait()
+ {
+ HTI_LOG_FUNC_IN( "CAsyncWaiter::StartAndWait" );
+ iStatus = KRequestPending;
+ SetActive();
+ iWait->Start();
+ HTI_LOG_FUNC_OUT( "CAsyncWaiter::StartAndWait" );
+ }
+
+// ----------------------------------------------------------------------------
+TInt CAsyncWaiter::Result() const
+ {
+ return iResult;
+ }
+
+// ----------------------------------------------------------------------------
+void CAsyncWaiter::RunL()
+ {
+ HTI_LOG_FUNC_IN( "CAsyncWaiter::RunL" );
+ iResult = iStatus.Int();
+ iWait->AsyncStop();
+ HTI_LOG_FUNC_OUT( "CAsyncWaiter::RunL" );
+ }
+
+// ----------------------------------------------------------------------------
+void CAsyncWaiter::DoCancel()
+ {
+ iResult = KErrCancel;
+ if ( iStatus == KRequestPending )
+ {
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrCancel );
+ }
+ iWait->AsyncStop();
+ }
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/proxy.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation proxy for systen info service plugin dll
+*
+*/
+
+
+// INCLUDES
+#include "HtiSysInfoServicePlugin.h"
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY(0x10210CC7, CHtiSysInfoServicePlugin::NewL)
+ };
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+ {
+ aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+ return ImplementationTable;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiStartupWait/bwins/HtiStartupWaitu.def Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?NewStartupWait@@YAPAVCHtiStartupWait@@XZ @ 1 NONAME ; class CHtiStartupWait * NewStartupWait(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiStartupWait/eabi/HtiStartupWaitu.def Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z14NewStartupWaitv @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiStartupWait/group/HtiStartupWait.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: DLL implementing the MHtiStartupWaitInterface
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET HtiStartupWait.dll
+TARGETTYPE dll
+
+UID 0x1020DEB9 0x200212DE
+
+VENDORID 0x101FB657
+
+CAPABILITY ALL -TCB
+
+SOURCEPATH ../src
+SOURCE HtiStartupWait.cpp
+
+USERINCLUDE ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY hal.lib
+LIBRARY flogger.lib
+
+SMPSAFE
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiStartupWait/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for HtiStartupWait
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiStartupWait.mmp
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiStartupWait/inc/HtiStartupWait.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CHtiStartupWait class declaration.
+*
+*/
+
+
+#ifndef __HTISTARTUPWAIT_H
+#define __HTISTARTUPWAIT_H
+
+// INCLUDES
+#include <e32std.h>
+#include <HtiStartupWaitInterface.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*
+*/
+NONSHARABLE_CLASS(CHtiStartupWait) : public MHtiStartupWaitInterface
+ {
+ public: // from MHtiStartupWaitInterface
+ virtual TInt WaitForStartup( TInt aMaxWaitTime );
+ };
+
+#endif // __HTISTARTUPWAIT_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiStartupWait/src/HtiStartupWait.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HtiStartupWait implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiStartupWait.h"
+#include <HtiLogging.h>
+#include <e32property.h>
+#include <hal.h>
+#include <startupdomainpskeys.h>
+
+// CONSTANTS
+const TInt KStateCheckInterval = 3000000; // microseconds
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ----------------------------------------------------------------------------
+EXPORT_C CHtiStartupWait* NewStartupWait()
+ {
+ return new ( ELeave ) CHtiStartupWait();
+
+ }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ----------------------------------------------------------------------------
+TInt CHtiStartupWait::WaitForStartup( TInt aMaxWaitTime )
+ {
+ TInt err = KErrNone;
+
+ // Not relying on TTime as the time might change during OS startup.
+ // Counting the time from nano ticks.
+ TInt nTickPeriod;
+ HAL::Get( HAL::ENanoTickPeriod, nTickPeriod );
+ HTI_LOG_FORMAT( "ENanoTickPeriod = %d", nTickPeriod );
+
+ TUint32 startTime = User::NTickCount();
+ TInt secsFromStart = 0;
+
+ TInt state = ESwStateStartingUiServices; // TPSGlobalSystemState
+ RProperty::Get( KPSUidStartup, KPSGlobalSystemState, state );
+ while ( state != ESwStateNormalRfOn && state != ESwStateNormalRfOff &&
+ secsFromStart < aMaxWaitTime )
+ {
+ HTI_LOG_FORMAT(
+ "HTI waiting for device to start: TPSGlobalSystemState = %d",
+ state );
+ User::After( KStateCheckInterval );
+ secsFromStart =
+ ( User::NTickCount() - startTime ) * nTickPeriod / 1000000;
+ HTI_LOG_FORMAT( "Seconds from start %d", secsFromStart );
+ RProperty::Get( KPSUidStartup, KPSGlobalSystemState, state );
+ }
+
+ if ( secsFromStart >= aMaxWaitTime )
+ {
+ HTI_LOG_TEXT( "Max wait time exceeded" );
+ err = KErrTimedOut;
+ }
+
+ return err;
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for building
+* HTI UI layer components.
+*
+*
+*/
+
+#include <platform_paths.hrh>
+#include "../symbian_version.hrh"
+
+PRJ_EXPORTS
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+../rom/htiui.iby CORE_IBY_EXPORT_PATH(tools,htiui.iby)
+#else
+../rom/htiui_10_1.iby CORE_IBY_EXPORT_PATH(tools,htiui.iby)
+#endif
+
+// Service plugins
+#include "../HtiServicePlugins/HtiAppServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiAudioServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiCameraServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiKeyEventServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiMessagesServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiPIMServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiScreenshotServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiSysInfoServicePlugin/group/bld.inf"
+
+// Backup fake DLL used by HtiFtpServicePlugin
+#include "../HtiServicePlugins/HtiFtpBackupFake/group/bld.inf"
+
+// Device rebooter
+#include "../HtiDeviceReboot/group/bld.inf"
+
+// Startup wait DLL
+#include "../HtiStartupWait/group/bld.inf"
+
+// HTI Admin UI application
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+#include "../HtiAdmin/group/bld.inf"
+#endif
+
+// Build stub SIS
+PRJ_EXTENSIONS
+#ifdef MARM
+START EXTENSION app-services/buildstubsis
+OPTION SRCDIR ../sis
+OPTION SISNAME HTI_stub
+END
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/group/hti_stub_sis.mk Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,58 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Makefile for creating HTI stub SIS for ROM image.
+#
+
+
+TARGETDIR=$(EPOCROOT)EPOC32\Data\Z\System\Install
+
+SISNAME=HTI_stub
+PKGNAME=HTI_stub
+
+$(TARGETDIR) :
+ @perl -S emkdir.pl "$(TARGETDIR)"
+
+do_nothing :
+ rem do_nothing
+
+SISFILE=$(TARGETDIR)\$(SISNAME).sis
+
+$(SISFILE) : ..\sis\$(PKGNAME).pkg
+ makesis -s $? $@
+
+#
+# The targets invoked by bld...
+#
+
+MAKMAKE : do_nothing
+
+RESOURCE : do_nothing
+
+SAVESPACE : do_nothing
+
+BLD : do_nothing
+
+FREEZE : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+FINAL : $(TARGETDIR) $(SISFILE)
+
+CLEAN :
+ -erase $(SISFILE)
+
+RELEASABLES :
+ @echo $(SISFILE)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/htiui.pro Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+SUBDIRS += HtiAdminQt/HtiAdmin.pro
+BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"group/bld.inf\""
+BLD_INF_RULES.prj_extensions += "prj_extensions"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/rom/htiui.iby Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Specifies HTI UI layer components for ROM image
+*
+*/
+
+#ifndef __HTIUI_IBY__
+#define __HTIUI_IBY__
+
+// HtiAdmin application
+S60_APP_EXE(HtiAdmin)
+#ifdef S60_UPGRADABLE_APP_REG_RSC
+ S60_UPGRADABLE_APP_REG_RSC(HtiAdmin)
+#else
+ S60_APP_AIF_RSC(HtiAdmin)
+#endif
+S60_APP_RESOURCE(HtiAdmin)
+
+// Test service plug-ins
+ECOM_PLUGIN(HtiAudioServicePlugin.dll,HtiAudioServicePlugin.rsc)
+ECOM_PLUGIN(HtiCameraServicePlugin.dll,HtiCameraServicePlugin.rsc)
+ECOM_PLUGIN(HtiKeyEventServicePlugin.dll,HtiKeyEventServicePlugin.rsc)
+ECOM_PLUGIN(HtiMessagesServicePlugin.dll,HtiMessagesServicePlugin.rsc)
+ECOM_PLUGIN(HtiPIMServicePlugin.dll,HtiPIMServicePlugin.rsc)
+ECOM_PLUGIN(HtiScreenshotServicePlugin.dll,HtiScreenshotServicePlugin.rsc)
+ECOM_PLUGIN(HtiSysInfoServicePlugin.dll,HtiSysInfoServicePlugin.rsc)
+
+// Test service plug-in extension
+file=ABI_DIR\BUILD_DIR\HtiAppControl.dll SHARED_LIB_DIR\HtiAppControl.dll
+
+// Backup fake DLL used by HtiFtpServicePlugin
+file=ABI_DIR\BUILD_DIR\HtiFtpBackupFake.dll SHARED_LIB_DIR\HtiFtpBackupFake.dll
+
+// Notepad helper
+file=ABI_DIR\BUILD_DIR\HtiNpdHlp.exe SHARED_LIB_DIR\HtiNpdHlp.exe
+
+// Device rebooter
+file=ABI_DIR\BUILD_DIR\HtiDeviceRebootUI.exe SHARED_LIB_DIR\HtiDeviceRebootUI.exe
+
+// Startup wait DLL
+file=ABI_DIR\BUILD_DIR\HtiStartupWait.dll SHARED_LIB_DIR\HtiStartupWait.dll
+
+// Stub SIS
+data=ZSYSTEM\Install\HTI_stub.sis system\install\HTI_stub.sis
+
+#endif // __HTIUI_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/rom/htiui_10_1.iby Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Specifies HTI UI layer components for ROM image
+*
+*/
+
+#ifndef __HTIUI_IBY__
+#define __HTIUI_IBY__
+
+
+// HtiAdmin application
+S60_APP_EXE(HtiAdmin)
+data=DATAZ_\Resource\apps\HtiAdmin.rsc Resource\Apps\HtiAdmin.rsc
+data=ZPRIVATE\10003a3f\import\apps\HtiAdmin_reg.rsc private\10003a3f\import\apps\HtiAdmin_reg.rsc
+
+
+// Test service plug-ins
+ECOM_PLUGIN(HtiAudioServicePlugin.dll,HtiAudioServicePlugin.rsc)
+ECOM_PLUGIN(HtiCameraServicePlugin.dll,HtiCameraServicePlugin.rsc)
+ECOM_PLUGIN(HtiKeyEventServicePlugin.dll,HtiKeyEventServicePlugin.rsc)
+ECOM_PLUGIN(HtiMessagesServicePlugin.dll,HtiMessagesServicePlugin.rsc)
+ECOM_PLUGIN(HtiPIMServicePlugin.dll,HtiPIMServicePlugin.rsc)
+ECOM_PLUGIN(HtiScreenshotServicePlugin.dll,HtiScreenshotServicePlugin.rsc)
+ECOM_PLUGIN(HtiSysInfoServicePlugin.dll,HtiSysInfoServicePlugin.rsc)
+
+// Test service plug-in extension
+file=ABI_DIR\BUILD_DIR\HtiAppControl.dll SHARED_LIB_DIR\HtiAppControl.dll
+
+// Backup fake DLL used by HtiFtpServicePlugin
+file=ABI_DIR\BUILD_DIR\HtiFtpBackupFake.dll SHARED_LIB_DIR\HtiFtpBackupFake.dll
+
+// Device rebooter
+file=ABI_DIR\BUILD_DIR\HtiDeviceRebootUI.exe SHARED_LIB_DIR\HtiDeviceRebootUI.exe
+
+// Startup wait DLL
+file=ABI_DIR\BUILD_DIR\HtiStartupWait.dll SHARED_LIB_DIR\HtiStartupWait.dll
+
+// Stub SIS
+data=ZSYSTEM\Install\HTI_stub.sis system\install\HTI_stub.sis
+
+#endif // __HTIUI_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/sis/HTI_S60-10_1.pkg Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,116 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Installation file for HTI
+
+
+; Languages
+&EN
+
+; Using UID of HtiFramework project
+#{"HTI"},(0x1020DEB6),2,25,0
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Install files
+
+; HtiCfg library
+"\epoc32\release\armv5\urel\HtiCfg.dll" - "!:\sys\bin\HtiCfg.dll"
+
+; HtiAdmin
+"\epoc32\release\armv5\urel\HtiAdmin.exe" - "!:\sys\bin\HtiAdmin.exe"
+"\epoc32\data\Z\Resource\apps\HtiAdmin.rsc" - "!:\Resource\Apps\HtiAdmin.rsc"
+"\epoc32\data\Z\private\10003a3f\import\apps\HtiAdmin_reg.rsc" - "!:\private\10003a3f\import\apps\HtiAdmin_reg.rsc"
+
+; Serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSerialCommEcomPlugin.dll" - "!:\sys\bin\HtiSerialCommEcomPlugin.dll"
+
+; BtSerial comm module
+"\epoc32\release\armv5\urel\HtiBtSerialComHelper.dll" - "!:\sys\bin\HtiBtSerialComHelper.dll"
+"\epoc32\release\armv5\urel\HtiBtCommServer.dll" - "!:\sys\bin\HtiBtCommServer.dll"
+"\epoc32\release\armv5\urel\HtiBtCommInterface.dll" - "!:\sys\bin\HtiBtCommInterface.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiBtCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiBtCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiBtCommEcomPlugin.dll" - "!:\sys\bin\HtiBtCommEcomPlugin.dll"
+
+; IPComm module
+"\epoc32\release\armv5\urel\HtiIPCommServer.exe" - "!:\sys\bin\HtiIPCommServer.exe"
+"\epoc32\release\armv5\urel\HtiIPCommServerClient.dll" - "!:\sys\bin\HtiIPCommServerClient.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIPCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiIPCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIPCommEcomPlugin.dll" - "!:\sys\bin\HtiIPCommEcomPlugin.dll"
+
+; USB serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiUsbSerialCommEcomPlugin.dll" - "!:\sys\bin\HtiUsbSerialCommEcomPlugin.dll"
+
+; Test service plug-ins
+"\epoc32\release\armv5\urel\HtiEchoServicePlugin.dll" - "!:\sys\bin\HtiEchoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiEchoServicePlugin.rsc" - "!:\Resource\Plugins\HtiEchoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiKeyEventServicePlugin.dll" - "!:\sys\bin\HtiKeyEventServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiKeyEventServicePlugin.rsc" - "!:\Resource\Plugins\HtiKeyEventServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiScreenshotServicePlugin.dll" - "!:\sys\bin\HtiScreenshotServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiScreenshotServicePlugin.rsc" - "!:\Resource\Plugins\HtiScreenshotServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiFtpServicePlugin.dll" - "!:\sys\bin\HtiFtpServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiFtpServicePlugin.rsc" - "!:\Resource\Plugins\HtiFtpServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppServicePlugin.dll" - "!:\sys\bin\HtiAppServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAppServicePlugin.rsc" - "!:\Resource\Plugins\HtiAppServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppControl.dll" - "!:\sys\bin\HtiAppControl.dll"
+"\epoc32\release\armv5\urel\HtiStifTfServicePlugin.dll" - "!:\sys\bin\HtiStifTfServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiStifTfServicePlugin.rsc" - "!:\Resource\Plugins\HtiStifTfServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSysInfoServicePlugin.dll" - "!:\sys\bin\HtiSysInfoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiSysInfoServicePlugin.rsc" - "!:\Resource\Plugins\HtiSysInfoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAudioServicePlugin.dll" - "!:\sys\bin\HtiAudioServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAudioServicePlugin.rsc" - "!:\Resource\Plugins\HtiAudioServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiMessagesServicePlugin.dll" - "!:\sys\bin\HtiMessagesServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiMessagesServicePlugin.rsc" - "!:\Resource\Plugins\HtiMessagesServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiPIMServicePlugin.dll" - "!:\sys\bin\HtiPIMServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiPIMServicePlugin.rsc" - "!:\Resource\Plugins\HtiPIMServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIpProxyServicePlugin.dll" - "!:\sys\bin\HtiIpProxyServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIpProxyServicePlugin.rsc" - "!:\Resource\Plugins\HtiIpProxyServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiCameraServicePlugin.dll" - "!:\sys\bin\HtiCameraServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiCameraServicePlugin.rsc" - "!:\Resource\Plugins\HtiCameraServicePlugin.rsc"
+
+; File helper with capability ALL - for file operations to TCB folders
+"\epoc32\release\armv5\urel\HtiFileHlp.exe" - "!:\sys\bin\HtiFileHlp.exe"
+
+; Backup fake DLL used by HtiFtpServicePlugin
+"\epoc32\release\armv5\urel\HtiFtpBackupFake.dll" - "!:\sys\bin\HtiFtpBackupFake.dll"
+
+; HTI watchdog
+"\epoc32\release\armv5\urel\HtiWatchDog.exe" - "!:\sys\bin\HtiWatchDog.exe"
+
+; HTI Restart
+"\epoc32\release\armv5\urel\HtiRestart.exe" - "!:\sys\bin\HtiRestart.exe"
+
+; HTI device reboot
+"\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe" - "!:\sys\bin\HtiDeviceRebootUI.exe"
+
+; HTI Framework
+"\epoc32\release\armv5\urel\HTIFramework.exe" - "!:\sys\bin\HTIFramework.exe"
+
+; AutoStart recogniser plug-in
+"\epoc32\release\armv5\urel\HtiAutoStart.dll" - "!:\sys\bin\HtiAutoStart.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAutoStart.rsc" - "!:\Resource\Plugins\HtiAutoStart.rsc"
+
+; HTI startup wait
+"\epoc32\release\armv5\urel\HtiStartupWait.dll" - "!:\sys\bin\HtiStartupWait.dll"
+
+; Startup list resource file for starting HTIFramework.exe in device boot
+;"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc" - "c:\private\101f875a\import\[1020deb6].rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/sis/HTI_S60-52.pkg Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,119 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Installation file for HTI
+
+
+; Languages
+&EN
+
+; Using UID of HtiFramework project
+#{"HTI"},(0x1020DEB6),2,25,0
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Install files
+
+; HtiCfg library
+"\epoc32\release\armv5\urel\HtiCfg.dll" - "!:\sys\bin\HtiCfg.dll"
+
+; HtiAdmin
+"\epoc32\release\armv5\urel\HtiAdmin.exe" - "!:\sys\bin\HtiAdmin.exe"
+"\epoc32\data\Z\Resource\apps\HtiAdmin.rsc" - "!:\Resource\Apps\HtiAdmin.rsc"
+"\epoc32\data\Z\private\10003a3f\apps\HtiAdmin_reg.rsc" - "!:\private\10003a3f\import\apps\HtiAdmin_reg.rsc"
+
+; Serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSerialCommEcomPlugin.dll" - "!:\sys\bin\HtiSerialCommEcomPlugin.dll"
+
+; BtSerial comm module
+"\epoc32\release\armv5\urel\HtiBtSerialComHelper.dll" - "!:\sys\bin\HtiBtSerialComHelper.dll"
+"\epoc32\release\armv5\urel\HtiBtCommServer.dll" - "!:\sys\bin\HtiBtCommServer.dll"
+"\epoc32\release\armv5\urel\HtiBtCommInterface.dll" - "!:\sys\bin\HtiBtCommInterface.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiBtCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiBtCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiBtCommEcomPlugin.dll" - "!:\sys\bin\HtiBtCommEcomPlugin.dll"
+
+; IPComm module
+"\epoc32\release\armv5\urel\HtiIPCommServer.exe" - "!:\sys\bin\HtiIPCommServer.exe"
+"\epoc32\release\armv5\urel\HtiIPCommServerClient.dll" - "!:\sys\bin\HtiIPCommServerClient.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIPCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiIPCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIPCommEcomPlugin.dll" - "!:\sys\bin\HtiIPCommEcomPlugin.dll"
+
+; USB serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiUsbSerialCommEcomPlugin.dll" - "!:\sys\bin\HtiUsbSerialCommEcomPlugin.dll"
+
+; Test service plug-ins
+"\epoc32\release\armv5\urel\HtiEchoServicePlugin.dll" - "!:\sys\bin\HtiEchoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiEchoServicePlugin.rsc" - "!:\Resource\Plugins\HtiEchoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiKeyEventServicePlugin.dll" - "!:\sys\bin\HtiKeyEventServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiKeyEventServicePlugin.rsc" - "!:\Resource\Plugins\HtiKeyEventServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiScreenshotServicePlugin.dll" - "!:\sys\bin\HtiScreenshotServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiScreenshotServicePlugin.rsc" - "!:\Resource\Plugins\HtiScreenshotServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiFtpServicePlugin.dll" - "!:\sys\bin\HtiFtpServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiFtpServicePlugin.rsc" - "!:\Resource\Plugins\HtiFtpServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppServicePlugin.dll" - "!:\sys\bin\HtiAppServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAppServicePlugin.rsc" - "!:\Resource\Plugins\HtiAppServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppControl.dll" - "!:\sys\bin\HtiAppControl.dll"
+"\epoc32\release\armv5\urel\HtiStifTfServicePlugin.dll" - "!:\sys\bin\HtiStifTfServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiStifTfServicePlugin.rsc" - "!:\Resource\Plugins\HtiStifTfServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSysInfoServicePlugin.dll" - "!:\sys\bin\HtiSysInfoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiSysInfoServicePlugin.rsc" - "!:\Resource\Plugins\HtiSysInfoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAudioServicePlugin.dll" - "!:\sys\bin\HtiAudioServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAudioServicePlugin.rsc" - "!:\Resource\Plugins\HtiAudioServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiMessagesServicePlugin.dll" - "!:\sys\bin\HtiMessagesServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiMessagesServicePlugin.rsc" - "!:\Resource\Plugins\HtiMessagesServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiPIMServicePlugin.dll" - "!:\sys\bin\HtiPIMServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiPIMServicePlugin.rsc" - "!:\Resource\Plugins\HtiPIMServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIpProxyServicePlugin.dll" - "!:\sys\bin\HtiIpProxyServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIpProxyServicePlugin.rsc" - "!:\Resource\Plugins\HtiIpProxyServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiCameraServicePlugin.dll" - "!:\sys\bin\HtiCameraServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiCameraServicePlugin.rsc" - "!:\Resource\Plugins\HtiCameraServicePlugin.rsc"
+
+; Helper to add notepad memos
+"\epoc32\release\armv5\urel\HtiNpdHlp.exe" - "!:\sys\bin\HtiNpdHlp.exe"
+
+; File helper with capability ALL - for file operations to TCB folders
+"\epoc32\release\armv5\urel\HtiFileHlp.exe" - "!:\sys\bin\HtiFileHlp.exe"
+
+; Backup fake DLL used by HtiFtpServicePlugin
+"\epoc32\release\armv5\urel\HtiFtpBackupFake.dll" - "!:\sys\bin\HtiFtpBackupFake.dll"
+
+; HTI watchdog
+"\epoc32\release\armv5\urel\HtiWatchDog.exe" - "!:\sys\bin\HtiWatchDog.exe"
+
+; HTI Restart
+"\epoc32\release\armv5\urel\HtiRestart.exe" - "!:\sys\bin\HtiRestart.exe"
+
+; HTI device reboot
+"\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe" - "!:\sys\bin\HtiDeviceRebootUI.exe"
+
+; HTI Framework
+"\epoc32\release\armv5\urel\HTIFramework.exe" - "!:\sys\bin\HTIFramework.exe"
+
+; AutoStart recogniser plug-in
+"\epoc32\release\armv5\urel\HtiAutoStart.dll" - "!:\sys\bin\HtiAutoStart.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAutoStart.rsc" - "!:\Resource\Plugins\HtiAutoStart.rsc"
+
+; HTI startup wait
+"\epoc32\release\armv5\urel\HtiStartupWait.dll" - "!:\sys\bin\HtiStartupWait.dll"
+
+; Startup list resource file for starting HTIFramework.exe in device boot
+;"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc" - "c:\private\101f875a\import\[1020deb6].rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/sis/HTI_S60_Upgrade-10_1.pkg Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,116 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Installation file for HTI
+
+
+; Languages
+&EN
+
+; Using UID of HtiFramework project
+#{"HTI"},(0x1020DEB6),2,25,0,TYPE=SA,RU
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Install files
+
+; HtiCfg library
+"\epoc32\release\armv5\urel\HtiCfg.dll" - "!:\sys\bin\HtiCfg.dll"
+
+; HtiAdmin
+"\epoc32\release\armv5\urel\HtiAdmin.exe" - "!:\sys\bin\HtiAdmin.exe"
+"\epoc32\data\Z\Resource\apps\HtiAdmin.rsc" - "!:\Resource\Apps\HtiAdmin.rsc"
+"\epoc32\data\Z\private\10003a3f\import\apps\HtiAdmin_reg.rsc" - "!:\private\10003a3f\import\apps\HtiAdmin_reg.rsc"
+
+; Serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSerialCommEcomPlugin.dll" - "!:\sys\bin\HtiSerialCommEcomPlugin.dll"
+
+; BtSerial comm module
+"\epoc32\release\armv5\urel\HtiBtSerialComHelper.dll" - "!:\sys\bin\HtiBtSerialComHelper.dll"
+"\epoc32\release\armv5\urel\HtiBtCommServer.dll" - "!:\sys\bin\HtiBtCommServer.dll"
+"\epoc32\release\armv5\urel\HtiBtCommInterface.dll" - "!:\sys\bin\HtiBtCommInterface.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiBtCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiBtCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiBtCommEcomPlugin.dll" - "!:\sys\bin\HtiBtCommEcomPlugin.dll"
+
+; IPComm module
+"\epoc32\release\armv5\urel\HtiIPCommServer.exe" - "!:\sys\bin\HtiIPCommServer.exe"
+"\epoc32\release\armv5\urel\HtiIPCommServerClient.dll" - "!:\sys\bin\HtiIPCommServerClient.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIPCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiIPCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIPCommEcomPlugin.dll" - "!:\sys\bin\HtiIPCommEcomPlugin.dll"
+
+; USB serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiUsbSerialCommEcomPlugin.dll" - "!:\sys\bin\HtiUsbSerialCommEcomPlugin.dll"
+
+; Test service plug-ins
+"\epoc32\release\armv5\urel\HtiEchoServicePlugin.dll" - "!:\sys\bin\HtiEchoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiEchoServicePlugin.rsc" - "!:\Resource\Plugins\HtiEchoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiKeyEventServicePlugin.dll" - "!:\sys\bin\HtiKeyEventServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiKeyEventServicePlugin.rsc" - "!:\Resource\Plugins\HtiKeyEventServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiScreenshotServicePlugin.dll" - "!:\sys\bin\HtiScreenshotServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiScreenshotServicePlugin.rsc" - "!:\Resource\Plugins\HtiScreenshotServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiFtpServicePlugin.dll" - "!:\sys\bin\HtiFtpServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiFtpServicePlugin.rsc" - "!:\Resource\Plugins\HtiFtpServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppServicePlugin.dll" - "!:\sys\bin\HtiAppServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAppServicePlugin.rsc" - "!:\Resource\Plugins\HtiAppServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppControl.dll" - "!:\sys\bin\HtiAppControl.dll"
+"\epoc32\release\armv5\urel\HtiStifTfServicePlugin.dll" - "!:\sys\bin\HtiStifTfServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiStifTfServicePlugin.rsc" - "!:\Resource\Plugins\HtiStifTfServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSysInfoServicePlugin.dll" - "!:\sys\bin\HtiSysInfoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiSysInfoServicePlugin.rsc" - "!:\Resource\Plugins\HtiSysInfoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAudioServicePlugin.dll" - "!:\sys\bin\HtiAudioServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAudioServicePlugin.rsc" - "!:\Resource\Plugins\HtiAudioServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiMessagesServicePlugin.dll" - "!:\sys\bin\HtiMessagesServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiMessagesServicePlugin.rsc" - "!:\Resource\Plugins\HtiMessagesServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiPIMServicePlugin.dll" - "!:\sys\bin\HtiPIMServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiPIMServicePlugin.rsc" - "!:\Resource\Plugins\HtiPIMServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIpProxyServicePlugin.dll" - "!:\sys\bin\HtiIpProxyServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIpProxyServicePlugin.rsc" - "!:\Resource\Plugins\HtiIpProxyServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiCameraServicePlugin.dll" - "!:\sys\bin\HtiCameraServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiCameraServicePlugin.rsc" - "!:\Resource\Plugins\HtiCameraServicePlugin.rsc"
+
+; File helper with capability ALL - for file operations to TCB folders
+"\epoc32\release\armv5\urel\HtiFileHlp.exe" - "!:\sys\bin\HtiFileHlp.exe"
+
+; Backup fake DLL used by HtiFtpServicePlugin
+"\epoc32\release\armv5\urel\HtiFtpBackupFake.dll" - "!:\sys\bin\HtiFtpBackupFake.dll"
+
+; HTI watchdog
+"\epoc32\release\armv5\urel\HtiWatchDog.exe" - "!:\sys\bin\HtiWatchDog.exe"
+
+; HTI Restart
+"\epoc32\release\armv5\urel\HtiRestart.exe" - "!:\sys\bin\HtiRestart.exe"
+
+; HTI device reboot
+"\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe" - "!:\sys\bin\HtiDeviceRebootUI.exe"
+
+; HTI Framework
+"\epoc32\release\armv5\urel\HTIFramework.exe" - "!:\sys\bin\HTIFramework.exe"
+
+; AutoStart recogniser plug-in
+"\epoc32\release\armv5\urel\HtiAutoStart.dll" - "!:\sys\bin\HtiAutoStart.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAutoStart.rsc" - "!:\Resource\Plugins\HtiAutoStart.rsc"
+
+; HTI startup wait
+"\epoc32\release\armv5\urel\HtiStartupWait.dll" - "!:\sys\bin\HtiStartupWait.dll"
+
+; Startup list resource file for starting HTIFramework.exe in device boot
+;"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc" - "c:\private\101f875a\import\[1020deb6].rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/sis/HTI_S60_Upgrade-52.pkg Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,119 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Installation file for HTI
+
+
+; Languages
+&EN
+
+; Using UID of HtiFramework project
+#{"HTI"},(0x1020DEB6),2,25,0,TYPE=SA,RU
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Install files
+
+; HtiCfg library
+"\epoc32\release\armv5\urel\HtiCfg.dll" - "!:\sys\bin\HtiCfg.dll"
+
+; HtiAdmin
+"\epoc32\release\armv5\urel\HtiAdmin.exe" - "!:\sys\bin\HtiAdmin.exe"
+"\epoc32\data\Z\Resource\apps\HtiAdmin.rsc" - "!:\Resource\Apps\HtiAdmin.rsc"
+"\epoc32\data\Z\private\10003a3f\apps\HtiAdmin_reg.rsc" - "!:\private\10003a3f\import\apps\HtiAdmin_reg.rsc"
+
+; Serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSerialCommEcomPlugin.dll" - "!:\sys\bin\HtiSerialCommEcomPlugin.dll"
+
+; BtSerial comm module
+"\epoc32\release\armv5\urel\HtiBtSerialComHelper.dll" - "!:\sys\bin\HtiBtSerialComHelper.dll"
+"\epoc32\release\armv5\urel\HtiBtCommServer.dll" - "!:\sys\bin\HtiBtCommServer.dll"
+"\epoc32\release\armv5\urel\HtiBtCommInterface.dll" - "!:\sys\bin\HtiBtCommInterface.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiBtCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiBtCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiBtCommEcomPlugin.dll" - "!:\sys\bin\HtiBtCommEcomPlugin.dll"
+
+; IPComm module
+"\epoc32\release\armv5\urel\HtiIPCommServer.exe" - "!:\sys\bin\HtiIPCommServer.exe"
+"\epoc32\release\armv5\urel\HtiIPCommServerClient.dll" - "!:\sys\bin\HtiIPCommServerClient.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIPCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiIPCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIPCommEcomPlugin.dll" - "!:\sys\bin\HtiIPCommEcomPlugin.dll"
+
+; USB serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiUsbSerialCommEcomPlugin.dll" - "!:\sys\bin\HtiUsbSerialCommEcomPlugin.dll"
+
+; Test service plug-ins
+"\epoc32\release\armv5\urel\HtiEchoServicePlugin.dll" - "!:\sys\bin\HtiEchoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiEchoServicePlugin.rsc" - "!:\Resource\Plugins\HtiEchoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiKeyEventServicePlugin.dll" - "!:\sys\bin\HtiKeyEventServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiKeyEventServicePlugin.rsc" - "!:\Resource\Plugins\HtiKeyEventServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiScreenshotServicePlugin.dll" - "!:\sys\bin\HtiScreenshotServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiScreenshotServicePlugin.rsc" - "!:\Resource\Plugins\HtiScreenshotServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiFtpServicePlugin.dll" - "!:\sys\bin\HtiFtpServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiFtpServicePlugin.rsc" - "!:\Resource\Plugins\HtiFtpServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppServicePlugin.dll" - "!:\sys\bin\HtiAppServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAppServicePlugin.rsc" - "!:\Resource\Plugins\HtiAppServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppControl.dll" - "!:\sys\bin\HtiAppControl.dll"
+"\epoc32\release\armv5\urel\HtiStifTfServicePlugin.dll" - "!:\sys\bin\HtiStifTfServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiStifTfServicePlugin.rsc" - "!:\Resource\Plugins\HtiStifTfServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSysInfoServicePlugin.dll" - "!:\sys\bin\HtiSysInfoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiSysInfoServicePlugin.rsc" - "!:\Resource\Plugins\HtiSysInfoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAudioServicePlugin.dll" - "!:\sys\bin\HtiAudioServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAudioServicePlugin.rsc" - "!:\Resource\Plugins\HtiAudioServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiMessagesServicePlugin.dll" - "!:\sys\bin\HtiMessagesServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiMessagesServicePlugin.rsc" - "!:\Resource\Plugins\HtiMessagesServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiPIMServicePlugin.dll" - "!:\sys\bin\HtiPIMServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiPIMServicePlugin.rsc" - "!:\Resource\Plugins\HtiPIMServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIpProxyServicePlugin.dll" - "!:\sys\bin\HtiIpProxyServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIpProxyServicePlugin.rsc" - "!:\Resource\Plugins\HtiIpProxyServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiCameraServicePlugin.dll" - "!:\sys\bin\HtiCameraServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiCameraServicePlugin.rsc" - "!:\Resource\Plugins\HtiCameraServicePlugin.rsc"
+
+; Helper to add notepad memos
+"\epoc32\release\armv5\urel\HtiNpdHlp.exe" - "!:\sys\bin\HtiNpdHlp.exe"
+
+; File helper with capability ALL - for file operations to TCB folders
+"\epoc32\release\armv5\urel\HtiFileHlp.exe" - "!:\sys\bin\HtiFileHlp.exe"
+
+; Backup fake DLL used by HtiFtpServicePlugin
+"\epoc32\release\armv5\urel\HtiFtpBackupFake.dll" - "!:\sys\bin\HtiFtpBackupFake.dll"
+
+; HTI watchdog
+"\epoc32\release\armv5\urel\HtiWatchDog.exe" - "!:\sys\bin\HtiWatchDog.exe"
+
+; HTI Restart
+"\epoc32\release\armv5\urel\HtiRestart.exe" - "!:\sys\bin\HtiRestart.exe"
+
+; HTI device reboot
+"\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe" - "!:\sys\bin\HtiDeviceRebootUI.exe"
+
+; HTI Framework
+"\epoc32\release\armv5\urel\HTIFramework.exe" - "!:\sys\bin\HTIFramework.exe"
+
+; AutoStart recogniser plug-in
+"\epoc32\release\armv5\urel\HtiAutoStart.dll" - "!:\sys\bin\HtiAutoStart.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAutoStart.rsc" - "!:\Resource\Plugins\HtiAutoStart.rsc"
+
+; HTI startup wait
+"\epoc32\release\armv5\urel\HtiStartupWait.dll" - "!:\sys\bin\HtiStartupWait.dll"
+
+; Startup list resource file for starting HTIFramework.exe in device boot
+;"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc" - "c:\private\101f875a\import\[1020deb6].rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/sis/HTI_stub.pkg Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,113 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Installation file for HTI stub SIS
+
+
+; Languages
+&EN
+
+; Using UID of HtiFramework project
+#{"HTI"},(0x1020DEB6),2,25,0
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Install files
+
+; HtiCfg library
+""- "z:\sys\bin\HtiCfg.dll"
+
+; HtiAdmin
+""- "z:\sys\bin\HtiAdmin.exe"
+""- "z:\Resource\Apps\HtiAdmin.rsc"
+""- "z:\private\10003a3f\import\apps\HtiAdmin_reg.rsc"
+
+; Serial comm module
+""- "z:\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"
+""- "z:\sys\bin\HtiSerialCommEcomPlugin.dll"
+
+; BtSerial comm module
+""- "z:\sys\bin\HtiBtSerialComHelper.dll"
+""- "z:\sys\bin\HtiBtCommServer.dll"
+""- "z:\sys\bin\HtiBtCommInterface.dll"
+""- "z:\Resource\Plugins\HtiBtCommEcomPlugin.rsc"
+""- "z:\sys\bin\HtiBtCommEcomPlugin.dll"
+
+; IPComm module
+""- "z:\sys\bin\HtiIPCommServer.exe"
+""- "z:\sys\bin\HtiIPCommServerClient.dll"
+""- "z:\Resource\Plugins\HtiIPCommEcomPlugin.rsc"
+""- "z:\sys\bin\HtiIPCommEcomPlugin.dll"
+
+; USB serial comm module
+""- "z:\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc"
+""- "z:\sys\bin\HtiUsbSerialCommEcomPlugin.dll"
+
+; Test service plug-ins
+""- "z:\sys\bin\HtiEchoServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiEchoServicePlugin.rsc"
+""- "z:\sys\bin\HtiKeyEventServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiKeyEventServicePlugin.rsc"
+""- "z:\sys\bin\HtiScreenshotServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiScreenshotServicePlugin.rsc"
+""- "z:\sys\bin\HtiFtpServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiFtpServicePlugin.rsc"
+""- "z:\sys\bin\HtiAppServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiAppServicePlugin.rsc"
+""- "z:\sys\bin\HtiAppControl.dll"
+""- "z:\sys\bin\HtiStifTfServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiStifTfServicePlugin.rsc"
+""- "z:\sys\bin\HtiSysInfoServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiSysInfoServicePlugin.rsc"
+""- "z:\sys\bin\HtiAudioServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiAudioServicePlugin.rsc"
+""- "z:\sys\bin\HtiMessagesServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiMessagesServicePlugin.rsc"
+""- "z:\sys\bin\HtiPIMServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiPIMServicePlugin.rsc"
+""- "z:\sys\bin\HtiIpProxyServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiIpProxyServicePlugin.rsc"
+""- "z:\sys\bin\HtiCameraServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiCameraServicePlugin.rsc"
+
+; Helper to add notepad memos
+""- "z:\sys\bin\HtiNpdHlp.exe"
+
+; File helper with capability ALL - for file operations to TCB folders
+""- "z:\sys\bin\HtiFileHlp.exe"
+
+; Backup fake DLL used by HtiFtpServicePlugin
+""- "z:\sys\bin\HtiFtpBackupFake.dll"
+
+; HTI watchdog
+""- "z:\sys\bin\HtiWatchDog.exe"
+
+; HTI Restart
+""- "z:\sys\bin\HtiRestart.exe"
+
+; HTI device reboot
+""- "z:\sys\bin\HtiDeviceRebootUI.exe"
+
+; HTI Framework
+""- "z:\sys\bin\HtiFramework.exe"
+
+; AutoStart recogniser plug-in
+""- "z:\sys\bin\HtiAutoStart.dll"
+""- "z:\Resource\Plugins\HtiAutoStart.rsc"
+
+; HTI startup wait
+""- "z:\sys\bin\HtiStartupWait.dll"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/symbian_version.hrh Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Symbian version configuration file
+*
+*/
+
+#ifndef __SYMBIAN_VERSION_HRH
+#define __SYMBIAN_VERSION_HRH
+
+// S60 and Symbian version number enumeration definitions
+
+#define S60_30 30
+#define S60_31 31
+#define S60_32 32
+#define S60_50 50
+#define S60_51 91
+#define S60_52 92
+#define SYMBIAN_1 50
+#define SYMBIAN_2 91
+#define SYMBIAN_3 92
+#define SYMBIAN_4 101
+
+
+/**
+ * Defines the S60 or Symbian version used by this component. This flag can be
+ * used to variate the source code based on the SDK in use. The value of the
+ * flag should be always changed to reflect the current build environment.
+ */
+#define SYMBIAN_VERSION_SUPPORT SYMBIAN_3
+
+
+#endif // __SYMBIAN_VERSION_HRH
--- a/loadgen/inc/loadgen_netconn.h Wed Sep 15 12:13:45 2010 +0300
+++ b/loadgen/inc/loadgen_netconn.h Wed Oct 13 14:32:52 2010 +0300
@@ -22,7 +22,7 @@
// INCLUDES
#include <e32std.h>
#include <e32base.h>
-#include <downloadmgrclient.h>
+#include <DownloadMgrClient.h>
#include "loadgen_loadbase.h"
#include "loadgen_loadattributes.h"
--- a/memspyui/data/memspyui.rss Wed Sep 15 12:13:45 2010 +0300
+++ b/memspyui/data/memspyui.rss Wed Oct 13 14:32:52 2010 +0300
@@ -35,7 +35,7 @@
// User includes
-#include "../ui/avkon/inc/MemSpy.hrh"
+#include "MemSpy.hrh"
RESOURCE RSS_SIGNATURE { }
@@ -220,9 +220,9 @@
items=
{
MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralSummary; txt = "Summary"; },
- MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralDetailed; txt = "Detailed Info"; }//,
- //MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralHandles; txt = "Handle Info"; },
- //MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralKernelContainers; txt = "Kernel Containers"; }
+ MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralDetailed; txt = "Detailed Info"; },
+ MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralHandles; txt = "Handle Info"; },
+ MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralKernelContainers; txt = "Kernel Containers"; }
};
}
@@ -278,7 +278,7 @@
-/*
+
RESOURCE MENU_PANE r_memspy_menupane_process_sort
{
items=
@@ -292,6 +292,7 @@
};
}
+
RESOURCE MENU_PANE r_memspy_menupane_process_info
{
items=
@@ -300,7 +301,6 @@
MENU_ITEM { command = EMemSpyCmdProcessInfoHandles; txt = "Handles"; }
};
}
-*/
RESOURCE MENU_PANE r_memspy_menupane_process_end
@@ -318,11 +318,11 @@
{
items=
{
- //MENU_ITEM { command = EMemSpyCmdProcessInfo; txt = "Info"; cascade = r_memspy_menupane_process_info; },
- //MENU_ITEM { command = EMemSpyCmdProcessSort; txt = "Sort"; cascade = r_memspy_menupane_process_sort; },
- MENU_ITEM { command = EMemSpyCmdProcessEnd; txt = "End"; cascade = r_memspy_menupane_process_end; }
+ MENU_ITEM { command = EMemSpyCmdProcessInfo; txt = "Info"; cascade = r_memspy_menupane_process_info; },
+ MENU_ITEM { command = EMemSpyCmdProcessSort; txt = "Sort"; cascade = r_memspy_menupane_process_sort; },
+ MENU_ITEM { command = EMemSpyCmdProcessEnd; txt = "End"; cascade = r_memspy_menupane_process_end; }
};
- }
+ }
@@ -354,7 +354,7 @@
};
}
-/*
+
RESOURCE MENU_PANE r_memspy_menupane_thread_info
{
items=
@@ -362,7 +362,7 @@
MENU_ITEM { command = EMemSpyCmdThreadInfoHandles; txt = "Handles"; }
};
}
-*/
+
RESOURCE MENU_PANE r_memspy_menupane_thread_end
{
@@ -379,7 +379,7 @@
{
items=
{
- //MENU_ITEM { command = EMemSpyCmdThreadInfo; txt = "Info"; cascade = r_memspy_menupane_thread_info; },
+ MENU_ITEM { command = EMemSpyCmdThreadInfo; txt = "Info"; cascade = r_memspy_menupane_thread_info; },
MENU_ITEM { command = EMemSpyCmdThreadSetPriority; txt = "Change Priority"; cascade = r_memspy_menupane_thread_priority; },
MENU_ITEM { command = EMemSpyCmdThreadEnd; txt = "End"; cascade = r_memspy_menupane_thread_end; }
};
@@ -1019,7 +1019,7 @@
id = EAknMessageQueryContentId;
control = AVKON_MESSAGE_QUERY
{
- message = "Version 2.1.0 - 15th June 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.";
+ message = "Version 1.2.1 - 15th June 2010. Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.";
};
}
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/group/MemSpyCapabilities.mmh Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,19 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+CAPABILITY ReadUserData WriteUserData ReadDeviceData WriteDeviceData SwEvent PowerMgmt
--- a/memspyui/group/bld.inf Wed Sep 15 12:13:45 2010 +0300
+++ b/memspyui/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -11,20 +11,44 @@
*
* Contributors:
*
-* Description:
+* Description:
*
*/
+
#include <platform_paths.hrh>
+#include "../memspywindowserverhelper/group/bld.inf"
-prj_platforms
+PRJ_EXPORTS
+../data/MemSpyEComInterfaceIds.xml z:/private/2002129F/memspyecominterfaceids.xml
+../data/MemSpyProcessMemoryTrackingAutoStartConfig.xml z:/private/2002129F/memspyprocessmemorytrackingautostartconfig.xml
+../data/backup_registration.xml z:/private/2002129F/backup_registration.xml
+../rom/memspyui.iby CORE_IBY_EXPORT_PATH(tools,memspyui.iby)
-WINSCW GCCE ARMV5 ARMV6
+
+PRJ_MMPFILES
+memspyui.mmp
+
+#ifndef SBSV2
+ gnumakefile memspyui_icons_aif.mk
-#include "bld_generic.inf"
-
-#include "../ui/avkon/group/bld.inf"
+ #ifdef MARM
+ gnumakefile memspyui_stub_sis.mk
+ #endif
+#endif
-prj_mmpfiles
+#ifdef SBSV2
+ PRJ_EXTENSIONS
+ START EXTENSION s60/mifconv
+ OPTION TARGETFILE memspyui_aif.mif
+ OPTION SOURCEDIR ../icons
+ OPTION SOURCES -c8,8 qgn_menu_memspyui
+ END
-prj_extensions
\ No newline at end of file
+ #ifdef MARM
+ START EXTENSION app-services/buildstubsis
+ OPTION SRCDIR ../sis
+ OPTION SISNAME MemSpy_stub
+ END
+ #endif
+#endif
--- a/memspyui/group/bld_generic.inf Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#include <platform_paths.hrh>
-#include "../memspywindowserverhelper/group/bld.inf"
-
-PRJ_EXPORTS
-../data/MemSpyEComInterfaceIds.xml z:/private/2002129F/memspyecominterfaceids.xml
-../data/MemSpyProcessMemoryTrackingAutoStartConfig.xml z:/private/2002129F/memspyprocessmemorytrackingautostartconfig.xml
-../data/backup_registration.xml z:/private/2002129F/backup_registration.xml
-../rom/memspyui.iby CORE_IBY_EXPORT_PATH(tools,memspyui.iby)
-
-#ifndef SBSV2
- gnumakefile memspyui_icons_aif.mk
-
- #ifdef MARM
- gnumakefile memspyui_stub_sis.mk
- #endif
-#endif
-
-#ifdef SBSV2
- PRJ_EXTENSIONS
- START EXTENSION s60/mifconv
- OPTION TARGETFILE memspyui_aif.mif
- OPTION SOURCEDIR ../icons
- OPTION SOURCES -c8,8 qgn_menu_memspyui
- END
-
- #ifdef MARM
- START EXTENSION app-services/buildstubsis
- OPTION SRCDIR ../sis
- OPTION SISNAME MemSpy_stub
- END
- #endif
-#endif
--- a/memspyui/group/group.pro Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-TEMPLATE = subdirs
-
-BLD_INF_RULES.prj_platforms += "$${LITERAL_HASH}include \"bld_generic.inf\""
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/group/memspyui.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET memspyui.exe
+TARGETTYPE exe
+UID 0x100039CE 0x2002129F
+VENDORID VID_DEFAULT
+SMPSAFE
+
+EPOCSTACKSIZE 0x4000
+EPOCHEAPSIZE 0x100000 0x4000000
+
+#include "MemSpyCapabilities.mmh"
+
+SOURCEPATH ../source
+source MemSpyApp.cpp
+source MemSpyAppUi.cpp
+source MemSpyDocument.cpp
+source MemSpyContainer.cpp
+source MemSpyDeviceWideOperationDialog.cpp
+source MemSpyExportBitmapsToMemoryCardDialog.cpp
+source MemSpyUiUtils.cpp
+source MemSpySettings.cpp
+//
+source MemSpyViewBase.cpp
+source MemSpyViewMainMenu.cpp
+source MemSpyViewType.cpp
+source MemSpyViewProcesses.cpp
+source MemSpyViewServerList.cpp
+source MemSpyViewOpenFiles.cpp
+source MemSpyViewRAMInfo.cpp
+source MemSpyViewROMInfo.cpp
+source MemSpyViewFBServBitmaps.cpp
+source MemSpyViewSystemConfig.cpp
+source MemSpyViewCodeSegList.cpp
+source MemSpyViewChunkList.cpp
+source MemSpyViewKernel.cpp
+source MemSpyViewKernelContainers.cpp
+source MemSpyViewKernelHeap.cpp
+source MemSpyViewDriveInfo.cpp
+source MemSpyViewECom.cpp
+source MemSpyViewThreads.cpp
+source MemSpyViewThreadInfoItemList.cpp
+source MemSpyViewThreadInfoItemGeneric.cpp
+source MemSpyViewThreadInfoItemHeap.cpp
+source MemSpyViewThreadInfoItemStack.cpp
+source MemSpyViewThreadInfoItemCodeSeg.cpp
+source MemSpyViewThreadInfoItemChunk.cpp
+source MemSpyViewThreadInfoItemServer.cpp
+source MemSpyViewThreadInfoItemActiveObject.cpp
+source MemSpyViewThreadInfoItemGeneralInfo.cpp
+source MemSpyViewHeapTracking.cpp
+source MemSpyViewHeapTrackingResults.cpp
+source MemSpyViewHeapTrackingSettings.cpp
+source MemSpyViewThreadInfoItemMemoryTracking.cpp
+source MemSpyViewMemoryTrackingAutoStartConfig.cpp
+source MemSpyViewWindowGroups.cpp
+source MemSpyViewKernelObjects.cpp
+
+USERINCLUDE ../include
+
+APP_LAYER_SYSTEMINCLUDE
+
+
+START RESOURCE ../data/memspyui.rss
+HEADER
+TARGETPATH APP_RESOURCE_DIR
+END
+
+START RESOURCE ../data/memspyui_reg.rss
+DEPENDS memspyui.rsg
+TARGETPATH /private/10003a3f/apps
+END
+
+
+LIBRARY fbscli.lib imageconversion.lib estor.lib apgrfx.lib
+LIBRARY euser.lib apparc.lib cone.lib eikcore.lib
+LIBRARY eikcoctl.lib avkon.lib etext.lib eikctl.lib
+LIBRARY efsrv.lib bafl.lib egul.lib hal.lib
+LIBRARY cdlengine.lib xmlframework.lib charconv.lib viewcli.lib
+LIBRARY eikdlg.lib ws32.lib bitgdi.lib
+
+LIBRARY memspydriverclient.lib
+LIBRARY memspyengine.lib
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpy.hrh Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPY_HRH
+#define MEMSPY_HRH
+
+#define KMemSpyMenuCommandBase 50000
+#define KMemSpyMenuCommandViewSpecific (KMemSpyMenuCommandBase + 10000)
+
+enum TMemSpyCommandIds
+ {
+ ////////////////////////////////
+ // GENERIC MENU COMMANDS
+ ////////////////////////////////
+ EMemSpyCmdOpen = KMemSpyMenuCommandBase,
+ //
+ EMemSpyCmdView,
+ EMemSpyCmdViewRefresh,
+ EMemSpyCmdViewOutputToSink,
+ //
+ EMemSpyCmdTools,
+ EMemSpyCmdToolsListOpenFiles,
+ EMemSpyCmdToolsAbout,
+ //
+ EMemSpyCmdPhoneInfo,
+ EMemSpyCmdPhoneInfoGeneral,
+ EMemSpyCmdPhoneInfoGeneralSummary,
+ EMemSpyCmdPhoneInfoGeneralDetailed,
+ EMemSpyCmdPhoneInfoGeneralHandles,
+ EMemSpyCmdPhoneInfoGeneralKernelContainers,
+ EMemSpyCmdPhoneInfoHeap,
+ EMemSpyCmdPhoneInfoHeapInfoSummary,
+ EMemSpyCmdPhoneInfoHeapInfoCompact,
+ EMemSpyCmdPhoneInfoHeapCellListing,
+ EMemSpyCmdPhoneInfoHeapDump,
+ EMemSpyCmdPhoneInfoStack,
+ EMemSpyCmdPhoneInfoStackInfo,
+ EMemSpyCmdPhoneInfoStackInfoCompact,
+ EMemSpyCmdPhoneInfoStackDumpUser,
+ EMemSpyCmdPhoneInfoStackDumpKernel,
+ //
+ EMemSpyCmdAutoCapture,
+ EMemSpyCmdAutoCaptureToggle,
+ EMemSpyCmdAutoCaptureRetryTime,
+ EMemSpyCmdAutoCaptureOperationType,
+
+ ////////////////////////////////
+ // VIEW SPECIFIC MENU COMMANDS
+ ////////////////////////////////
+ EMemSpyCmdProcess = KMemSpyMenuCommandViewSpecific,
+ EMemSpyCmdProcessInfo,
+ EMemSpyCmdProcessInfoSummary,
+ EMemSpyCmdProcessInfoHandles,
+ EMemSpyCmdProcessSort,
+ EMemSpyCmdProcessSortById,
+ EMemSpyCmdProcessSortByName,
+ EMemSpyCmdProcessSortByThreadCount,
+ EMemSpyCmdProcessSortByCodeSegs,
+ EMemSpyCmdProcessSortByHeapUsage,
+ EMemSpyCmdProcessSortByStackUsage,
+ EMemSpyCmdProcessEnd,
+ EMemSpyCmdProcessEndKill,
+ EMemSpyCmdProcessEndPanic,
+ EMemSpyCmdProcessEndTerminate,
+ //
+ EMemSpyCmdThread,
+ EMemSpyCmdThreadEnd,
+ EMemSpyCmdThreadEndKill,
+ EMemSpyCmdThreadEndPanic,
+ EMemSpyCmdThreadEndTerminate,
+ EMemSpyCmdThreadSetPriority,
+ EMemSpyCmdThreadSetPriorityAbsoluteVeryLow,
+ EMemSpyCmdThreadSetPriorityAbsoluteLowNormal,
+ EMemSpyCmdThreadSetPriorityAbsoluteLow,
+ EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal,
+ EMemSpyCmdThreadSetPriorityAbsoluteBackground,
+ EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal,
+ EMemSpyCmdThreadSetPriorityAbsoluteForeground,
+ EMemSpyCmdThreadSetPriorityAbsoluteHighNormal,
+ EMemSpyCmdThreadSetPriorityAbsoluteHigh,
+ EMemSpyCmdThreadSetPriorityAbsoluteRealTime1,
+ EMemSpyCmdThreadSetPriorityAbsoluteRealTime2,
+ EMemSpyCmdThreadSetPriorityAbsoluteRealTime3,
+ EMemSpyCmdThreadSetPriorityAbsoluteRealTime4,
+ EMemSpyCmdThreadSetPriorityAbsoluteRealTime5,
+ EMemSpyCmdThreadSetPriorityAbsoluteRealTime6,
+ EMemSpyCmdThreadSetPriorityAbsoluteRealTime7,
+ EMemSpyCmdThreadSetPriorityAbsoluteRealTime8,
+ EMemSpyCmdThreadInfo,
+ EMemSpyCmdThreadInfoHandles,
+ //
+ EMemSpyCmdOutput,
+ EMemSpyCmdOutputToDebug,
+ EMemSpyCmdOutputToFile,
+ //
+ EMemSpyCmdHeap,
+ EMemSpyCmdHeapInfoThread,
+ EMemSpyCmdHeapData,
+ EMemSpyCmdHeapCellListing,
+ EMemSpyCmdHeapDataDump,
+ //
+ EMemSpyCmdStack,
+ EMemSpyCmdStackInfoThread,
+ EMemSpyCmdStackData,
+ EMemSpyCmdStackDataUser,
+ EMemSpyCmdStackDataKernel,
+ //
+ EMemSpyCmdChunk,
+ EMemSpyCmdChunkSort,
+ EMemSpyCmdChunkSortByName,
+ EMemSpyCmdChunkSortBySize,
+ EMemSpyCmdChunkListing,
+ //
+ EMemSpyCmdCodeSeg,
+ EMemSpyCmdCodeSegShow,
+ EMemSpyCmdCodeSegShowItemsAll,
+ EMemSpyCmdCodeSegShowItemsGlobalData,
+ EMemSpyCmdCodeSegShowCaps,
+ EMemSpyCmdCodeSegShowCapsWithTCBProcess,
+ EMemSpyCmdCodeSegShowCapsWithTCBAll,
+ EMemSpyCmdCodeSegShowCapsWithCommDDProcess,
+ EMemSpyCmdCodeSegShowCapsWithCommDDAll,
+ EMemSpyCmdCodeSegShowCapsWithPowerMgmtProcess,
+ EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll,
+ EMemSpyCmdCodeSegShowCapsWithMultimediaDDProcess,
+ EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll,
+ EMemSpyCmdCodeSegShowCapsWithReadDeviceDataProcess,
+ EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll,
+ EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataProcess,
+ EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll,
+ EMemSpyCmdCodeSegShowCapsWithDRMProcess,
+ EMemSpyCmdCodeSegShowCapsWithDRMAll,
+ EMemSpyCmdCodeSegShowCapsWithTrustedUIProcess,
+ EMemSpyCmdCodeSegShowCapsWithTrustedUIAll,
+ EMemSpyCmdCodeSegShowCapsWithProtServProcess,
+ EMemSpyCmdCodeSegShowCapsWithProtServAll,
+ EMemSpyCmdCodeSegShowCapsWithDiskAdminProcess,
+ EMemSpyCmdCodeSegShowCapsWithDiskAdminAll,
+ EMemSpyCmdCodeSegShowCapsWithNetworkControlProcess,
+ EMemSpyCmdCodeSegShowCapsWithNetworkControlAll,
+ EMemSpyCmdCodeSegShowCapsWithAllFilesProcess,
+ EMemSpyCmdCodeSegShowCapsWithAllFilesAll,
+ EMemSpyCmdCodeSegShowCapsWithSwEventProcess,
+ EMemSpyCmdCodeSegShowCapsWithSwEventAll,
+ EMemSpyCmdCodeSegShowCapsWithNetworkServicesProcess,
+ EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll,
+ EMemSpyCmdCodeSegShowCapsWithLocalServicesProcess,
+ EMemSpyCmdCodeSegShowCapsWithLocalServicesAll,
+ EMemSpyCmdCodeSegShowCapsWithReadUserDataProcess,
+ EMemSpyCmdCodeSegShowCapsWithReadUserDataAll,
+ EMemSpyCmdCodeSegShowCapsWithWriteUserDataProcess,
+ EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll,
+ EMemSpyCmdCodeSegShowCapsWithLocationProcess,
+ EMemSpyCmdCodeSegShowCapsWithLocationAll,
+ EMemSpyCmdCodeSegShowCapsWithSurroundingsDDProcess,
+ EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll,
+ EMemSpyCmdCodeSegShowCapsWithUserEnvProcess,
+ EMemSpyCmdCodeSegShowCapsWithUserEnvAll,
+ EMemSpyCmdCodeSegSort,
+ EMemSpyCmdCodeSegSortByName,
+ EMemSpyCmdCodeSegSortByCodeSize,
+ EMemSpyCmdCodeSegSortByDataSize,
+ EMemSpyCmdCodeSegSortByUid,
+ EMemSpyCmdCodeSegListing,
+ //
+ EMemSpyCmdImages,
+ EMemSpyCmdImagesSlideshow,
+ EMemSpyCmdImagesSaveAllToMemoryCard,
+ EMemSpyCmdImagesListing,
+ //
+ EMemSpyCmdActiveObject,
+ EMemSpyCmdActiveObjectListing,
+ //
+ EMemSpyCmdServerList,
+ EMemSpyCmdServerListOutput,
+ EMemSpyCmdServerListOutputListCSV,
+ EMemSpyCmdServerListOutputListDetailed,
+ EMemSpyCmdServerListSort,
+ EMemSpyCmdServerListSortByName,
+ EMemSpyCmdServerListSortBySessionCount,
+ //
+ EMemSpyCmdKernelContainers,
+ EMemSpyCmdKernelContainersOutput,
+ EMemSpyCmdKernelObjects,
+ EMemSpyCmdKernelObjectTerminate,
+ EMemSpyCmdKernelObjectSwitchTo,
+ EMemSpyCmdKernelObjectEnd,
+ EMemSpyCmdKernelObjectPanic,
+
+ //
+ EMemSpyCmdKernelHeap,
+ EMemSpyCmdKernelHeapDump,
+ //
+ EMemSpyCmdRAM,
+ EMemSpyCmdRAMAvkonIconCacheDisabled,
+ EMemSpyCmdRAMAvkonIconCacheEnabled,
+ //
+ EMemSpyCmdBTrace,
+ EMemSpyCmdBTraceCaptureToggle,
+ //
+ EMemSpyCmdMemoryTracking,
+ EMemSpyCmdMemoryTrackingStart,
+ EMemSpyCmdMemoryTrackingStop,
+ EMemSpyCmdMemoryTrackingAutoStart,
+ EMemSpyCmdMemoryTrackingAutoStartItemAdd,
+ EMemSpyCmdMemoryTrackingAutoStartItemEdit,
+ EMemSpyCmdMemoryTrackingAutoStartItemDelete,
+ EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll,
+ EMemSpyCmdMemoryTrackingAutoStartItemImport,
+ EMemSpyCmdMemoryTrackingHWM,
+ EMemSpyCmdMemoryTrackingHWMReset,
+ EMemSpyCmdMemoryTrackingTotalWithSharedMem,
+ EMemSpyCmdMemoryTrackingTotalWithoutSharedMem,
+
+ //
+ EMemSpyCmdWindowGroups,
+ EMemSpyCmdWindowGroupTerminate,
+ EMemSpyCmdWindowGroupSwitchTo,
+ EMemSpyCmdWindowGroupEnd,
+ EMemSpyCmdWindowGroupPanic
+ };
+
+enum TMemSpyControlIds
+ {
+ EMemSpyCtrlIdProgressNote = 1000,
+ EMemSpyCtrlIdSlideShowImage,
+ EMemSpyCtrlIdWaitNote
+ };
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyApp.h Wed Oct 13 14:32:52 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:
+*
+*/
+
+#ifndef MEMSPYAPP_H
+#define MEMSPYAPP_H
+
+// System includes
+#include <aknapp.h>
+
+// Constants
+const TUid KUidMemSpy = { 0x2002129F };
+
+
+class CMemSpyApp : public CAknApplication
+ {
+private: // From CApaApplication
+ CApaDocument* CreateDocumentL();
+ TUid AppDllUid() const;
+ };
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyAppUi.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYAPPUI_H
+#define MEMSPYAPPUI_H
+
+// System includes
+#include <eikapp.h>
+#include <eikdoc.h>
+#include <e32std.h>
+#include <coeccntx.h>
+#include <aknappui.h>
+#include <coecobs.h>
+
+// User includes
+#include "MemSpyDeviceWideOperationDialog.h"
+#include "MemSpyContainerObserver.h"
+#include <memspy/engine/memspyengineobserver.h>
+
+// Classes referenced
+class CEikMenuBar;
+class CMemSpyEngine;
+class CMemSpyContainer;
+class CMemSpyDocument;
+
+
+class CMemSpyAppUi : public CAknAppUi, public MMemSpyContainerObserver, public MCoeControlObserver, public MMemSpyEngineObserver, public MMemSpyDeviceWideOperationDialogObserver
+ {
+public:
+ CMemSpyAppUi( CMemSpyEngine& aEngine );
+ ~CMemSpyAppUi();
+ void ConstructL();
+
+public: // API
+ CMemSpyDocument& MemSpyDocument();
+ const CMemSpyDocument& MemSpyDocument() const;
+ inline CMemSpyContainer& Container() { return *iAppContainer; }
+
+private: // From Avkon
+ void HandleStatusPaneSizeChange();
+
+private: // From MCoeControlObserver
+ void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType);
+
+private: // From MEikMenuObserver
+ void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+private: // From CEikAppUi
+ void HandleForegroundEventL(TBool aForeground);
+ void HandleCommandL(TInt aCommand);
+ TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+
+private: // From MMemSpyContainerObserver
+ void HandleThreadSelectedL( const CMemSpyThread& aThread );
+
+private: // From MMemSpyEngineObserver
+ void HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext );
+
+private: // From MMemSpyDeviceWideOperationDialogObserver
+ void DWOperationStarted();
+ void DWOperationCancelled();
+ void DWOperationCompleted();
+
+private: // Internal methods
+ void UpdateCBAL();
+ void InitiateMemSpyClientServerOperationL( TInt aOpCode );
+ void SetViewServerTimeOutStatus( TBool aEnabled );
+
+private: // Command handlers
+ void OnCmdBackL();
+ void OnCmdExitL();
+ void OnCmdOpenL();
+ void OnCmdAboutL();
+
+ // Output
+ void OnCmdOutputToDebugL();
+ void OnCmdOutputToFileL();
+
+ // Phone-information
+ void OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::TOperation aOp );
+ void OnCmdPhoneInformationOperationKernelContainersL();
+
+ // Automatic capture
+ void OnCmdAutoCaptureToggleL();
+ void OnCmdAutoCaptureRetryTimeL();
+ void OnCmdAutoCaptureOperationTypeL();
+
+ // Misc
+ void OnCmdToolsBitmapsSaveToMemoryCardL();
+ void OnCmdToolsSendToBackgroundL();
+ void OnCmdToolsBringToForegroundL();
+
+private: // Auto capture related
+ static TInt AutoCaptureCallBack( TAny* aSelf );
+ void AutoCaptureCallBackL();
+
+private: // Member data
+ CMemSpyEngine& iEngine;
+ CMemSpyContainer* iAppContainer;
+
+ // For phone information dialog
+ TBool iRunningDeviceWideOperation;
+
+ // For auto-capture
+ TInt iAutoCaptureTimerPeriod;
+ CMemSpyDeviceWideOperations::TOperation iAutoCaptureOperationType;
+ CPeriodic* iAutoCaptureTimer;
+ };
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYCONTAINER_H
+#define MEMSPYCONTAINER_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+#include "MemSpyViewObserver.h"
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyProcess;
+class CMemSpyThread;
+class CMemSpyThreadInfoItemBase;
+class CMemSpyEngineObjectContainer;
+class MMemSpyContainerObserver;
+
+
+class CMemSpyContainer : public CCoeControl, public MMemSpyViewObserver
+ {
+public:
+ CMemSpyContainer( CMemSpyEngine& aEngine, MMemSpyContainerObserver& aObserver );
+ ~CMemSpyContainer();
+ void ConstructL( const TRect& aRect );
+
+public: // API
+ inline TMemSpyViewType ActiveViewType() const { return iActiveView->ViewType(); }
+ inline CMemSpyViewBase& ActiveView() const { return *iActiveView; }
+
+public: // API
+ void NavigateToParentViewL();
+ void NavigateToChildViewL();
+ void HandleCommandL( TInt aCommand );
+ void SetNewActiveViewL( CMemSpyViewBase* aNewView );
+
+public: // Command handlers
+ void OnCmdViewRefreshL();
+
+private: // From CCoeControl
+ void SizeChanged();
+ TInt CountComponentControls() const;
+ CCoeControl* ComponentControl(TInt aIndex) const;
+ void Draw(const TRect& aRect) const;
+ TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+
+private: // From MMemSpyViewObserver
+ void HandleMemSpyViewEventL( TViewEventType aEvent, TMemSpyViewType aViewType, CMemSpyViewBase& aReportingView, TAny* aContext );
+
+private: // Internal methods
+ CMemSpyViewBase* PrepareTopLevelViewL();
+
+private: // Member data
+ CMemSpyEngine& iEngine;
+ MMemSpyContainerObserver& iObserver;
+ CMemSpyViewBase* iActiveView;
+ CMemSpyViewBase* iPreviousView;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyContainerObserver.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYCONTAINEROBSERVER_H
+#define MEMSPYCONTAINEROBSERVER_H
+
+// Classes referenced
+class CMemSpyThread;
+
+
+class MMemSpyContainerObserver
+ {
+public:
+ virtual void HandleThreadSelectedL( const CMemSpyThread& aThread ) = 0;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyDeviceWideOperationDialog.h Wed Oct 13 14:32:52 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:
+*
+*/
+
+#ifndef MEMSPYDEVICEWIDEOPERATIONDIALOG_H
+#define MEMSPYDEVICEWIDEOPERATIONDIALOG_H
+
+// System includes
+#include <AknProgressDialog.h>
+#include <AknWaitDialog.h>
+
+// Engine includes
+#include <memspy/engine/memspydevicewideoperations.h>
+
+// Classes referenced
+class CMemSpyEngine;
+
+class MMemSpyDeviceWideOperationDialogObserver
+ {
+public:
+ virtual void DWOperationStarted() = 0;
+ virtual void DWOperationCancelled() = 0;
+ virtual void DWOperationCompleted() = 0;
+ };
+
+
+class CMemSpyDeviceWideOperationDialog : public CBase, public MProgressDialogCallback, public MMemSpyDeviceWideOperationsObserver
+ {
+public:
+ static void ExecuteLD( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver, CMemSpyDeviceWideOperations::TOperation aOperation );
+ ~CMemSpyDeviceWideOperationDialog();
+
+private:
+ CMemSpyDeviceWideOperationDialog( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver );
+ void ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation );
+
+public: // API
+ void Cancel();
+
+private: // From MProgressDialogCallback
+ void DialogDismissedL( TInt aButtonId );
+
+private: // From MMemSpyDeviceWideOperationsObserver
+ void HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 );
+
+private: // Internal methods
+ void SetDialogCaptionL( const TDesC& aText );
+
+private: // Member data
+ CMemSpyEngine& iEngine;
+ MMemSpyDeviceWideOperationDialogObserver& iObserver;
+ TBool iForcedCancel;
+ CEikProgressInfo* iProgressInfo;
+ CAknProgressDialog* iProgressDialog;
+ CMemSpyDeviceWideOperations* iOperation;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyDocument.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYDOCUMENT_H
+#define MEMSPYDOCUMENT_H
+
+// System includes
+#include <AknDoc.h>
+
+// Classes referenced
+class CMemSpyEngine;
+class CEikAppUi;
+class CMemSpySettings;
+
+
+class CMemSpyDocument : public CAknDocument
+ {
+public: // Constructors and destructor
+ static CMemSpyDocument* NewL(CEikApplication& aApp);
+ ~CMemSpyDocument();
+
+private:
+ CMemSpyDocument(CEikApplication& aApp);
+ void ConstructL();
+
+public:
+ CMemSpyEngine& Engine();
+ const CMemSpyEngine& Engine() const;
+ CMemSpySettings& Settings();
+ const CMemSpySettings& Settings() const;
+
+private: // Framework
+ CEikAppUi* CreateAppUiL();
+
+private: // Data members
+ CMemSpyEngine* iEngine;
+ CMemSpySettings* iSettings;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyExportBitmapsToMemoryCardDialog.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYEXPORTBITMAPSTOMEMORYCARDDIALOG_H
+#define MEMSPYEXPORTBITMAPSTOMEMORYCARDDIALOG_H
+
+// System includes
+#include <AknProgressDialog.h>
+#include <AknWaitDialog.h>
+#include <imageconversion.h>
+
+// Classes referenced
+class CMemSpyEngineFbServBitmap;
+class CMemSpyEngineFbServBitmapArray;
+
+
+
+class CMemSpyExportBitmapsToMemoryCardDialog : public CActive, public MProgressDialogCallback
+ {
+public:
+ static CMemSpyExportBitmapsToMemoryCardDialog* NewL( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps );
+ ~CMemSpyExportBitmapsToMemoryCardDialog();
+
+private:
+ CMemSpyExportBitmapsToMemoryCardDialog( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps );
+ void ConstructL();
+
+public: // API
+ void Cancel();
+ static TBool CheckMemoryCardAvailableL( RFs& aFsSession );
+
+private: // From CActive
+ void RunL();
+ void DoCancel();
+ TInt RunError(TInt aError);
+
+private: // From MProgressDialogCallback
+ void DialogDismissedL( TInt aButtonId );
+
+private: // Internal methods
+ void CompleteSelf( TInt aError );
+ void ExportBitmapL( const CMemSpyEngineFbServBitmap& aBitmap );
+ void IdentifyBmpMimeTypeL();
+ void PruneExistingBitmapFilesL();
+ void PrepareFolderNameSpecL();
+ TBool TryToExportSingleBitmapL();
+
+private: // Member data
+ RFs& iFsSession;
+ const CMemSpyEngineFbServBitmapArray& iBitmaps;
+ TInt iBitmapIndex;
+ TBool iDialogDismissed;
+ CEikProgressInfo* iProgressInfo;
+ CAknProgressDialog* iProgressDialog;
+ CImageEncoder* iEncoder;
+ HBufC8* iBmpMimeType;
+ HBufC* iFolderName;
+ RFileExtensionMIMETypeArray iMimeTypeArray;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpySettings.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYSETTINGS_H
+#define MEMSPYSETTINGS_H
+
+// System includes
+#include <e32base.h>
+#include <badesca.h>
+#include <f32file.h>
+
+// Engine includes
+#include <memspy/engine/memspyengineoutputsink.h>
+
+// Classes referenced
+class CMemSpyEngine;
+
+
+class CMemSpySettings : public CBase
+ {
+public:
+ static CMemSpySettings* NewL( RFs& aFsSession, CMemSpyEngine& aEngine );
+ ~CMemSpySettings();
+
+private:
+ CMemSpySettings( RFs& aFsSession, CMemSpyEngine& aEngine );
+ void ConstructL();
+
+public: // API
+ inline RFs& FsSession() { return iFsSession; }
+ void StoreSettingsL();
+
+private: // Settings methods
+ void RestoreSettingsL();
+ void GetSettingsFileNameL( TDes& aFileName );
+ void GetSettingsPathL( TDes& aPath );
+ RFile SettingsFileLC( TBool aReplace = EFalse );
+
+private: // Data members
+ RFs& iFsSession;
+ CMemSpyEngine& iEngine;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyUiUtils.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYUIUTILS_H
+#define MEMSPYUIUTILS_H
+
+// System includes
+#include <e32std.h>
+
+// Engine includes
+#include <memspy/engine/memspyengineutils.h>
+
+
+class MemSpyUiUtils : public MemSpyEngineUtils
+ {
+public:
+ static void Format( TDes& aBuf, TInt aResourceId, ...);
+ static void GetErrorText( TDes& aBuf, TInt aError );
+ };
+
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewBase.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWBASE_H
+#define MEMSPYVIEWBASE_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+#include <memspyui.rsg>
+
+// User includes
+#include "MemSpy.hrh"
+#include "MemSpyViewType.h"
+#include "MemSpyViewObserver.h"
+#include "MemSpySettings.h"
+
+// Classes referenced
+class CMemSpyEngine;
+class CMemSpyContainer;
+class MMemSpyViewObserver;
+
+
+class CMemSpyViewBase : public CCoeControl, public MCoeControlObserver, public MEikListBoxObserver
+ {
+public:
+ CMemSpyViewBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ ~CMemSpyViewBase();
+ virtual void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // API
+ virtual TMemSpyViewType ViewType() const = 0;
+ virtual CMemSpyViewBase* PrepareParentViewL();
+ virtual CMemSpyViewBase* PrepareChildViewL();
+ virtual void RefreshL();
+ virtual TBool HandleCommandL( TInt aCommand );
+
+public: // Menu framework
+ virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+ virtual TUint MenuCascadeResourceId() const;
+ virtual TInt MenuCascadeCommandId() const;
+
+private: // Command handlers
+ virtual void OnCmdViewOutputToSinkL();
+
+protected: // Construction support
+ void SetTitleL( const TDesC& aText );
+ TPtrC TitleL() const;
+ virtual CEikListBox* ConstructListBoxL();
+ virtual void SetListBoxModelL() = 0;
+
+protected: // Internal framework
+ virtual void HandleListBoxItemActionedL( TInt aIndex );
+ virtual void HandleListBoxItemSelectedL( TInt aIndex );
+
+protected: // Event reporting
+ void ReportEventL( MMemSpyViewObserver::TViewEventType aEvent, TAny* aContext = NULL );
+ void SetListBoxCurrentItemIndexL( TInt aIndex );
+
+protected: // Utility methods
+ CMemSpyContainer& Container();
+ CMemSpySettings& Settings();
+ const CMemSpySettings& Settings() const;
+
+public: // From CCoeControl
+ TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+
+protected: // From CCoeControl
+ void Draw( const TRect& aRect ) const;
+ void SizeChanged();
+ void FocusChanged( TDrawNow aDrawNow );
+ TInt CountComponentControls() const;
+ CCoeControl* ComponentControl( TInt aIndex ) const;
+
+protected: // From MCoeControlObserver
+ void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );
+
+protected: // From MEikListBoxObserver
+ void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType);
+
+protected: // Member data
+ CMemSpyEngine& iEngine;
+ MMemSpyViewObserver& iObserver;
+ //
+ CEikListBox* iListBox;
+
+private:
+ CMemSpySettings* iSettings;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewChunkList.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWCHUNKLIST_H
+#define MEMSPYVIEWCHUNKLIST_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+class CMemSpyEngineChunkList;
+class CMemSpyEngineChunkEntry;
+
+
+
+
+class CMemSpyViewChunkBase : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewChunkBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList* aList );
+ ~CMemSpyViewChunkBase();
+
+public: // From CMemSpyViewBase
+ TBool HandleCommandL( TInt aCommand );
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_CHUNK_LIST; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdChunk; }
+
+protected: // Command handlers
+ void OnCmdListingL();
+
+protected: // Data members
+ CMemSpyEngineChunkList* iList;
+ };
+
+
+
+
+class CMemSpyViewChunkList : public CMemSpyViewChunkBase
+ {
+public:
+ CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aIndex );
+ void HandleListBoxItemSelectedL( TInt aIndex );
+
+private: // Data members
+ CMemSpyEngineChunkEntry* iCurrentChunk;
+ };
+
+
+
+class CMemSpyViewChunkDetails : public CMemSpyViewChunkBase
+ {
+public:
+ CMemSpyViewChunkDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList, CMemSpyEngineChunkEntry& aSelectedChunk );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // Data members
+ CMemSpyEngineChunkEntry& iChunk;
+ };
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewCodeSegList.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWCODESEGLIST_H
+#define MEMSPYVIEWCODESEGLIST_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+class CMemSpyEngineCodeSegList;
+class CMemSpyEngineCodeSegEntry;
+
+
+class CMemSpyViewCodeSegBase : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewCodeSegBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList* aList );
+ ~CMemSpyViewCodeSegBase();
+
+public: // From CMemSpyViewBase
+ TBool HandleCommandL( TInt aCommand );
+ void RefreshL();
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_CODESEG_LIST; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdCodeSeg; }
+
+protected: // Command handlers
+ void OnCmdCodeSegmentListingL();
+ void OnCmdShowItemsAllL();
+ void OnCmdShowItemsGlobalDataL();
+ void OnCmdFilterByCapabilityL( TCapability aCapability, TBool aAllBinaries );
+
+protected: // Data members
+ CMemSpyEngineCodeSegList* iList;
+ };
+
+
+
+
+class CMemSpyViewCodeSegList : public CMemSpyViewCodeSegBase
+ {
+public:
+ CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aIndex );
+ void HandleListBoxItemSelectedL( TInt aIndex );
+
+private: // Data members
+ CMemSpyEngineCodeSegEntry* iCurrentCodeSegment;
+ };
+
+
+
+class CMemSpyViewCodeSegDetails : public CMemSpyViewCodeSegBase
+ {
+public:
+ CMemSpyViewCodeSegDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList, CMemSpyEngineCodeSegEntry& aSelectedCodeSegment );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // Data members
+ CMemSpyEngineCodeSegEntry& iCodeSegment;
+ };
+
+
+
+
+
+
+class TMemSpyViewCodeSegFilter
+ {
+public:
+ inline TMemSpyViewCodeSegFilter( TCapability aCapability, TBool aAllBinaries = ETrue )
+ : iCapability( aCapability ), iAllBinaries( aAllBinaries )
+ {
+ }
+
+public:
+ static TBool FilterItem( const CMemSpyEngineCodeSegEntry*& aItem, TAny* aRune );
+
+private:
+ TCapability iCapability;
+ TBool iAllBinaries;
+ };
+
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewDriveInfo.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWDRIVEINFO_H
+#define MEMSPYVIEWDRIVEINFO_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// Engine includes
+#include <memspy/engine/memspyenginehelperfilesystem.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+
+
+
+
+class CMemSpyViewDriveInfoBase : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewDriveInfoBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ ~CMemSpyViewDriveInfoBase();
+ void BaseConstructL();
+
+public: // From CMemSpyViewBase
+ TBool HandleCommandL( TInt aCommand );
+
+protected: // Data members
+ CMemSpyEngineDriveList* iList;
+ };
+
+
+
+
+class CMemSpyViewDriveList : public CMemSpyViewDriveInfoBase, public MMemSpyEngineDriveListObserver
+ {
+public:
+ CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From CMemSpyViewBase
+ void RefreshL();
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aIndex );
+ void HandleListBoxItemSelectedL( TInt aIndex );
+
+private: // From MMemSpyEngineDriveListObserver
+ void HandleDriveListChangedL( const CMemSpyEngineDriveList& aList );
+
+private: // Data members
+ TBool iUseDriveNumber;
+ TDriveNumber iDriveNumber;
+ CMemSpyEngineDriveEntry* iCurrentDrive;
+ };
+
+
+
+class CMemSpyViewDriveInfo : public CMemSpyViewDriveInfoBase, public MMemSpyEngineDriveEntryObserver
+ {
+public:
+ CMemSpyViewDriveInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // From MMemSpyEngineDriveEntryObserver
+ void HandleDriveEntryChangedL( const CMemSpyEngineDriveEntry& aEntry );
+
+private: // Data members
+ const TDriveNumber iDriveNumber;
+ CMemSpyEngineDriveEntry* iDriveInfo;
+ };
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewECom.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWECOM_H
+#define MEMSPYVIEWECOM_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+#include <eikimage.h>
+#include <AknDialog.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Engine includes
+#include <memspy/engine/memspyenginehelperecom.h>
+
+
+class CMemSpyViewECom : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewECom( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aIndex );
+ void HandleListBoxItemSelectedL( TInt aIndex );
+
+private: // Data members
+ CMemSpyEngineEComCategory* iCurrent;
+ };
+
+
+
+class CMemSpyViewEComCategory : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewEComCategory( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComCategory& aCategory );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aIndex );
+ void HandleListBoxItemSelectedL( TInt aIndex );
+
+private: // Data members
+ CMemSpyEngineEComCategory& iCategory;
+ CMemSpyEngineEComInterface* iCurrent;
+ };
+
+
+
+
+class CMemSpyViewEComInterface : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewEComInterface( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComInterface& aInterface );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aIndex );
+ void HandleListBoxItemSelectedL( TInt aIndex );
+
+private: // Data members
+ CMemSpyEngineEComInterface& iInterface;
+ CMemSpyEngineEComImplementation* iCurrent;
+ };
+
+
+
+
+
+
+class CMemSpyViewEComImplementation : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewEComImplementation( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComImplementation& aImplementation );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // Data members
+ CMemSpyEngineEComImplementation& iImplementation;
+ };
+
+
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewFBServBitmaps.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWFBSERVBITMAPS_H
+#define MEMSPYVIEWFBSERVBITMAPS_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+#include <eikimage.h>
+#include <AknDialog.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Engine includes
+#include <memspy/engine/memspyenginehelperfbserv.h>
+
+
+
+class CMemSpyViewFBServBase : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewFBServBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps );
+ ~CMemSpyViewFBServBase();
+
+public: // From CMemSpyViewBase
+ TBool HandleCommandL( TInt aCommand );
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_IMAGES; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdImages; }
+
+protected: // Command handlers
+ void OnCmdSlideShowL();
+ void OnCmdExportToMemoryCardL();
+ void OnCmdImageListingL();
+
+protected: // Data members
+ CMemSpyEngineFbServBitmapArray* iBitmaps;
+ };
+
+
+
+
+
+class CMemSpyViewFBServBitmaps : public CMemSpyViewFBServBase, public MMemSpyEngineFbSerbBitmapArrayObserver
+ {
+public:
+ CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps );
+ ~CMemSpyViewFBServBitmaps();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From MMemSpyEngineFbSerbBitmapArrayObserver
+ void HandleFbServBitmapArrayEventL( TEvent aEvent );
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aIndex );
+ void HandleListBoxItemSelectedL( TInt aIndex );
+
+private: // Idle timer update
+ static TInt IdleUpdateListBoxModel( TAny* aSelf );
+ void DoIdleUpdateListBoxModelL();
+
+private: // Data members
+ RArray<TInt> iBitmapHandles;
+ CMemSpyEngineFbServBitmap* iCurrentBitmap;
+ CPeriodic* iIdleResetListboxTimer;
+ };
+
+
+
+class CMemSpyViewFBServBitmapInfo : public CMemSpyViewFBServBase
+ {
+public:
+ CMemSpyViewFBServBitmapInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aIndex );
+
+private: // Data members
+ CMemSpyEngineFbServBitmap& iBitmapObject;
+ };
+
+
+
+
+class CMemSpyViewFBServBitmapViewer : public CMemSpyViewFBServBase
+ {
+public:
+ CMemSpyViewFBServBitmapViewer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap );
+ ~CMemSpyViewFBServBitmapViewer();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ CEikListBox* ConstructListBoxL();
+
+private: // From CCoeControl
+ void Draw(const TRect& aRect) const;
+ void SizeChanged();
+ TInt CountComponentControls() const;
+ CCoeControl* ComponentControl( TInt aIndex ) const;
+
+private: // Data members
+ CMemSpyEngineFbServBitmap& iBitmapObject;
+ CEikImage* iImage;
+ TRect iBorderRect;
+ };
+
+
+
+
+
+class CMemSpyViewFBServSlideshow : public CAknDialog
+ {
+public:
+ static void NewLD( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex );
+ ~CMemSpyViewFBServSlideshow();
+
+private:
+ CMemSpyViewFBServSlideshow( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex );
+ void ConstructL();
+
+private:
+ void PreLayoutDynInitL();
+ TBool OkToExitL(TInt aButtonId);
+
+private: // Idle timer update
+ static TInt IdleUpdate( TAny* aSelf );
+ void ShowNextImageL();
+
+private: // Data members
+ CMemSpyEngineFbServBitmapArray& iBitmaps;
+ TInt& iIndex;
+ CPeriodic* iTimer;
+ };
+
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewHeapTracking.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWHEAPTRACKING_H
+#define MEMSPYVIEWHEAPTRACKING_H
+
+// System includes
+#include <hal.h>
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// Engine includes
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerobserver.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+
+
+class CMemSpyViewHeapTracking : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver
+ {
+public:
+ CMemSpyViewHeapTracking( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ ~CMemSpyViewHeapTracking();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+public:
+ static TInt AsyncStopTimerCallback( TAny* aParam );
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // From MMemSpyEngineHelperSysMemTrackerObserver
+ void HandleCyclesResetL();
+ void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+ void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Internal methods
+ TInt IndexByViewType( TMemSpyViewType aType );
+ void SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode aMode, TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
+ TInt AsyncStopTimerCallback();
+
+private: // Enum
+ enum TMemSpyViewHeapTrackingState
+ {
+ EMemSpyViewHeapTrackingStateIdle = 0,
+ EMemSpyViewHeapTrackingStateTimerOn,
+ EMemSpyViewHeapTrackingStateSingleOn
+ };
+
+private: // Data
+ TMemSpyEngineHelperSysMemTrackerConfig iOriginalConfig;
+ TMemSpyViewHeapTrackingState iState;
+ CAsyncCallBack* iStopTimerCallBack;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewHeapTrackingResults.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWHEAPTRACKINGRESULTS_H
+#define MEMSPYVIEWHEAPTRACKINGRESULTS_H
+
+// System includes
+#include <hal.h>
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// Engine includes
+#include <memspy/engine/memspyenginehelpersysmemtrackerobserver.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+class CMemSpyEngineHelperSysMemTrackerCycle;
+class CMemSpyEngineHelperSysMemTrackerCycleChange;
+
+
+class CMemSpyViewHeapTrackingResults : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver
+ {
+public:
+ CMemSpyViewHeapTrackingResults( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ ~CMemSpyViewHeapTrackingResults();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // From MMemSpyEngineHelperSysMemTrackerObserver
+ void HandleCyclesResetL();
+ void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+ void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+ };
+
+
+
+
+
+
+
+class CMemSpyViewHeapTrackingResultsCycleInfo : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver
+ {
+public:
+ CMemSpyViewHeapTrackingResultsCycleInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+ ~CMemSpyViewHeapTrackingResultsCycleInfo();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // From MMemSpyEngineHelperSysMemTrackerObserver
+ void HandleCyclesResetL();
+ void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+ void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+ const CMemSpyEngineHelperSysMemTrackerCycle& iCycle;
+ };
+
+
+
+
+
+/*
+class CMemSpyViewHeapTrackingResultsChangeDescriptor : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver
+ {
+public:
+ CMemSpyViewHeapTrackingResultsChangeDescriptor( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle, const CMemSpyEngineHelperSysMemTrackerCycleChange& aChangeDescriptor, TInt aIndex );
+ ~CMemSpyViewHeapTrackingResultsChangeDescriptor();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // From MMemSpyEngineHelperSysMemTrackerObserver
+ void HandleCyclesResetL();
+ void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+ void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
+
+private: // Data members
+ const CMemSpyEngineHelperSysMemTrackerCycle& iCycle;
+ const CMemSpyEngineHelperSysMemTrackerCycleChange& iChangeDescriptor;
+ TInt iIndex; // For selection rune when moving to parent view
+ };
+*/
+
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewHeapTrackingSettings.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWHEAPTRACKINGSETTINGS_H
+#define MEMSPYVIEWHEAPTRACKINGSETTINGS_H
+
+// System includes
+#include <hal.h>
+#include <coecntrl.h>
+#include <aknlists.h>
+#include <aknsettingitemlist.h>
+#include <akncheckboxsettingpage.h>
+#include <AknQueryDialog.h>
+
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+
+
+class CMemSpyViewHeapTrackingSettings : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewHeapTrackingSettings( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ ~CMemSpyViewHeapTrackingSettings();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // Internal methods
+ static void PrepareItemBufL( TDes& aBuf, const TDesC& aCaption, TBool aStatus, TBool aHeapCategorySelected );
+ };
+
+
+
+
+class CSWMTCategorySelectionCheckBoxSettingItem : public CAknSettingItem
+ {
+public:
+ CSWMTCategorySelectionCheckBoxSettingItem( TInt aIdentifier, TInt& aCategories );
+ virtual ~CSWMTCategorySelectionCheckBoxSettingItem();
+
+public:
+ CSelectionItemList* ItemArray() const;
+
+protected:
+ void CompleteConstructionL();
+ void StoreL();
+ void LoadL();
+ void HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType );
+
+private:
+ void AddNewItemToArrayL(const TDesC& aLabel);
+
+private:
+ CSelectionItemList* iItemArray;
+ HBufC* iSettingText;
+ TInt& iExtCategories;
+ };
+
+
+
+
+
+
+class CMemSpySWMTCategorySelectionCheckBoxSettingPage : public CAknCheckBoxSettingPage
+ {
+ public:
+ CMemSpySWMTCategorySelectionCheckBoxSettingPage( TInt aResourceID, CSelectionItemList* aItemArray );
+ public: // New functions
+ void UpdateCba();
+ };
+
+
+
+
+
+
+class CMemSpyAllowEmptyDataDialog : public CAknTextQueryDialog
+ {
+ public:
+ CMemSpyAllowEmptyDataDialog( TDes& aText, const TTone& aTone = ENoTone );
+ protected: // from CAknTextQueryDialog
+ void UpdateLeftSoftKeyL();
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewKernel.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWKERNEL_H
+#define MEMSPYVIEWKERNEL_H
+
+// System includes
+#include <hal.h>
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+
+
+class CMemSpyViewKernel : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewKernel( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ ~CMemSpyViewKernel();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // Internal methods
+ static TInt IndexByViewType( TMemSpyViewType aType );
+
+private: // Data members
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewKernelContainers.h Wed Oct 13 14:32:52 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:
+*
+*/
+
+#ifndef MEMSPYVIEWKERNELCONTAINERS_H
+#define MEMSPYVIEWKERNELCONTAINERS_H
+
+// System includes
+#include <hal.h>
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+class CMemSpyEngineGenericKernelObjectContainer;
+
+
+class CMemSpyViewKernelContainers : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewKernelContainers( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ ~CMemSpyViewKernelContainers();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_KERNEL_CONTAINERS; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdKernelContainers; }
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ TBool HandleCommandL( TInt aCommand );
+
+private: // Command handlers
+ void OnCmdOutputAllContainerContentsL();
+
+private: // Internal methods
+
+private: // Data members
+ CMemSpyEngineGenericKernelObjectContainer* iModel;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewKernelHeap.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWKERNELHEAP_H
+#define MEMSPYVIEWKERNELHEAP_H
+
+// System includes
+#include <hal.h>
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+class CMemSpyEngineGenericKernelObjectContainer;
+
+
+class CMemSpyViewKernelHeap : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewKernelHeap( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ ~CMemSpyViewKernelHeap();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_KERNEL_HEAP; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdKernelHeap; }
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ TBool HandleCommandL( TInt aCommand );
+
+private: // Command handlers
+ void OnCmdDumpKernelHeapL();
+
+private: // Internal methods
+
+private: // Data members
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewKernelObjects.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWKERNELOBJECTS_H
+#define MEMSPYVIEWKERNELOBJECTS_H
+
+// System includes
+#include <hal.h>
+#include <coecntrl.h>
+#include <aknlists.h>
+#include <AknTabObserver.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// Classes referenced
+class CMemSpyEngineGenericKernelObjectContainer;
+class CMemSpyEngineGenericKernelObjectList;
+class CAknNavigationDecorator;
+class CAknNavigationControlContainer;
+class CAknTabGroup;
+
+
+class CMemSpyViewKernelObjects : public CMemSpyViewBase, public MAknTabObserver
+ {
+public:
+ CMemSpyViewKernelObjects( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TMemSpyDriverContainerType aObjectType );
+ ~CMemSpyViewKernelObjects();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ CEikListBox* ConstructListBoxL();
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_KERNEL_OBJECTS; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdKernelObjects; }
+ void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ TBool HandleCommandL( TInt aCommand );
+
+private: // From CCoeControl
+ TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+
+private: // From MAknTabObserver
+ void TabChangedL( TInt aIndex );
+
+private: // Command handlers
+ void OnCmdTerminateL();
+ void OnCmdSwitchToL();
+ void OnCmdEndL();
+ void OnCmdPanicL();
+
+private: // Internal methods
+ void CreateTabsL();
+ void DetailsL();
+ void AppendFormatString( TPtr& aPtr, TRefByValue<const TDesC> aFmt, ... );
+
+private: // Data members
+ CMemSpyEngineGenericKernelObjectContainer* iModel;
+ CDesCArrayFlat* iItems;
+ TMemSpyDriverContainerType iObjectType;
+ CMemSpyEngineGenericKernelObjectList* iObjectList;
+ CAknNavigationDecorator* iNavDecorator;
+ CAknNavigationControlContainer* iNavContainer;
+ CAknTabGroup* iTabs;
+ TInt iCurrItemIndex;
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewMainMenu.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWMAINMENU_H
+#define MEMSPYVIEWMAINMENU_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+class CMemSpyProcess;
+
+
+class CMemSpyViewMainMenu : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewMainMenu( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // Internal methods
+ static TInt IndexByViewType( TMemSpyViewType aType );
+
+private: // Data members
+ };
+
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewMemoryTrackingAutoStartConfig.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWMEMORYTRACKINGAUTOSTARTCONFIG_H
+#define MEMSPYVIEWMEMORYTRACKINGAUTOSTARTCONFIG_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+#include <ecom/ecom.h>
+#include <xml/contenthandler.h> // MContentHandler mix in class
+#include <xml/parser.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Literal constants
+_LIT( KMemSpyProcessMemoryTrackingAutoStartConfigSearchPath, "E:\\MemSpy\\" );
+_LIT( KMemSpyProcessMemoryTrackingAutoStartConfigFileName, "MemSpyProcessMemoryTrackingAutoStartConfig.xml" );
+
+// Classes referenced
+class CCnvCharacterSetConverter;
+
+// Namespaces referenced
+using namespace Xml;
+
+
+class CMemSpyViewMemoryTrackingAutoStartConfig : public CMemSpyViewBase, public MContentHandler
+ {
+public:
+ CMemSpyViewMemoryTrackingAutoStartConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ ~CMemSpyViewMemoryTrackingAutoStartConfig();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ TBool HandleCommandL( TInt aCommand );
+ void HandleListBoxItemActionedL( TInt aIndex );
+ void SetListBoxModelL();
+ void RefreshL();
+
+public: // Menu framework
+ void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+ TUint MenuCascadeResourceId() const;
+ TInt MenuCascadeCommandId() const;
+
+private: // Command handlers
+ void OnCmdItemAddL();
+ void OnCmdItemEditL();
+ void OnCmdItemDeleteL();
+ void OnCmdItemDeleteAllL();
+ void OnCmdItemImportL();
+
+private: // Internal methods
+ TUid ShowDialogL( TUid aUid );
+ void SaveChangesL();
+ static TUid ValidateProcessUid( const TDesC& aUid );
+
+private: // Internal XML methods
+ void FindXmlInstallTimeL();
+ void FindXmlUserSuppliedL();
+ HBufC* FindEComXmlFileNameLC();
+ void ConvertL( const TDesC8& aInput, TDes16& aOutput );
+ void ParseL( const TDesC& aFileName );
+
+private: // XML helper functions
+ void OnSectionProcessL( const RAttributeArray& aAttributes );
+
+private: // From MContentHandler
+ void OnStartDocumentL( const RDocumentParameters& aDocParam, TInt aErrorCode );
+ void OnEndDocumentL( TInt aErrorCode );
+ void OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode );
+ void OnEndElementL( const RTagInfo& aElement, TInt aErrorCode );
+ void OnContentL( const TDesC8& aBytes, TInt aErrorCode );
+ void OnStartPrefixMappingL( const RString& aPrefix, const RString& aUri, TInt aErrorCode );
+ void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode );
+ void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode );
+ void OnSkippedEntityL( const RString& aName, TInt aErrorCode );
+ void OnProcessingInstructionL( const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode );
+ void OnError( TInt aErrorCode );
+ TAny* GetExtendedInterface( const TInt32 aUid );
+
+private: // Data members
+ RArray< TUid > iProcessUids;
+ TInt iParserErrorCode;
+ TInt iCharconvConverterState;
+ TBool iSeenMasterSection;
+ CParser* iParser;
+ CCnvCharacterSetConverter* iConverter;
+ HBufC* iXMLFileNameInstallTime;
+ HBufC* iXMLFileNameUserSupplied;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewObserver.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWOBSERVER_H
+#define MEMSPYVIEWOBSERVER_H
+
+// User includes
+#include "MemSpyViewType.h"
+
+// Classes referenced
+class CMemSpyViewBase;
+
+class MMemSpyViewObserver
+ {
+public: // Enumerations
+ enum TViewEventType
+ {
+ EEventItemActioned = 0,
+ EEventItemSelected
+ };
+
+public: // From MMemSpyViewObserver
+ virtual void HandleMemSpyViewEventL( TViewEventType aEvent, TMemSpyViewType aViewType, CMemSpyViewBase& aReportingView, TAny* aContext ) = 0;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewOpenFiles.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWOPENFILES_H
+#define MEMSPYVIEWOPENFILES_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+
+
+class CMemSpyViewOpenFiles : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewOpenFiles( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ ~CMemSpyViewOpenFiles();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ CEikListBox* ConstructListBoxL();
+ void RefreshL();
+ TBool HandleCommandL( TInt aCommand );
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // Command handlers
+ void OnCmdListOpenFilesL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aCurrentIndex );
+
+private: // Internal
+ static TBool CompareTEntryObjects( const TEntry& aLeft, const TEntry& aRight );
+
+private: // Data members
+ RArray<TThreadId> iThreadIds;
+ const TThreadId* iActionedThreadId;
+ RArray<TEntry> iFileNames;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewProcesses.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWPROCESSES_H
+#define MEMSPYVIEWPROCESSES_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+class CMemSpyProcess;
+class CAknSearchField;
+
+
+class CMemSpyViewProcesses : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess );
+ ~CMemSpyViewProcesses();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // API
+ CMemSpyProcess& CurrentProcess() const;
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+ TBool HandleCommandL( TInt aCommand );
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_PROCESS; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdProcess; }
+ void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+private: // Command handlers
+
+ // Sorting
+ void OnCmdSortByIdL();
+ void OnCmdSortByNameL();
+ void OnCmdSortByThreadCountL();
+ void OnCmdSortByCodeSegsL();
+ void OnCmdSortByHeapUsageL();
+ void OnCmdSortByStackUsageL();
+
+ // Info
+ void OnCmdInfoSummaryL();
+ void OnCmdInfoHandlesL();
+
+ // Ending
+ void OnCmdEndTerminateL();
+ void OnCmdEndPanicL();
+ void OnCmdEndKillL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aIndex );
+ void HandleListBoxItemSelectedL( TInt aIndex );
+
+private: // From CCoeControl
+ void SizeChanged();
+ TInt CountComponentControls() const;
+ CCoeControl* ComponentControl( TInt aIndex ) const;
+ TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+ void FocusChanged( TDrawNow /*aDrawNow*/ );
+
+private: // From MCoeControlObserver
+ void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
+
+private: // Internal methods
+ void SelectListBoxItemByFindTextL();
+
+private: // Data members
+ CMemSpyProcess* iCurrentProcess;
+ CAknSearchField* iSearchField;
+ HBufC* iMatcherBuffer;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewRAMInfo.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWRAMINFO_H
+#define MEMSPYVIEWRAMINFO_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+
+
+class CMemSpyViewRAMInfo : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewRAMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+ TBool HandleCommandL( TInt aCommand );
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_RAM; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdRAM; }
+
+private: // Command handlers
+ void OnCmdSetIconCacheStatusL( TBool aEnabled );
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // Data members
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewROMInfo.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWROMINFO_H
+#define MEMSPYVIEWROMINFO_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+
+
+class CMemSpyViewROMInfo : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewROMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // Data members
+ };
+
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewServerList.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWSERVERLIST_H
+#define MEMSPYVIEWSERVERLIST_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+class CMemSpyEngineServerList;
+class CMemSpyEngineServerEntry;
+
+
+class CMemSpyViewServerList : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewServerList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ ~CMemSpyViewServerList();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TBool HandleCommandL( TInt aCommand );
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_SERVER_LIST; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdServerList; }
+
+private: // Command handlers
+ void OnCmdServerListSortByNameL();
+ void OnCmdServerListSortBySessionCountL();
+ void OnCmdServerListOutputSummaryL();
+ void OnCmdServerListOutputDetailedL();
+ void OnCmdServerListOutputGenericL( TBool aDetailed );
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aCurrentIndex );
+
+private: // Data members
+ CMemSpyEngineServerList* iList;
+ const CMemSpyEngineServerEntry* iActionedItem;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewSystemConfig.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWSYSTEMCONFIG_H
+#define MEMSPYVIEWSYSTEMCONFIG_H
+
+// System includes
+#include <hal.h>
+#include <f32file.h>
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+
+
+class CMemSpyViewSystemConfig : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewSystemConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ ~CMemSpyViewSystemConfig();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // Internal enumerations
+
+ enum TMemSpyDisplayMode
+ {
+ ENone,
+ EGray2,
+ EGray4,
+ EGray16,
+ EGray256,
+ EColor16,
+ EColor256,
+ EColor64K,
+ EColor16M,
+ ERgb,
+ EColor4K,
+ EColor16MU,
+ EColor16MA,
+ EColor16MAP,
+ EColorLast
+ };
+
+private: // Internal methods
+ static void GetManufacturer( TDes& aBuf );
+ static void GetDeviceFamily( TDes& aBuf );
+ static void GetCPU( TDes& aBuf );
+ static void GetCPUABI( TDes& aBuf );
+ static void GetStartupReason( TDes& aBuf );
+ static void GetKeyboard( TDes& aBuf );
+ static void GetMachineUid( TDes& aBuf );
+ static void GetDisplayType( TDes& aBuf );
+ static void GetDisplayMode( TDes& aBuf, TMemSpyDisplayMode aMode );
+ //
+ static TInt GetHALValue( HALData::TAttribute aAttribute, TInt& aValue );
+ TInt GetHALValueAsStringL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL );
+ TInt GetHALValueAsNumericL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL, TInt aWidth = -1 );
+ TInt GetHALValueAsHexL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL );
+ TInt GetHALValueAsYesNoL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL );
+ TInt GetHALValueAsDriveLetterL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL );
+
+private:
+ void AddItemL( const TDesC& aCaption, const TDesC& aValue, const TDesC* aSuffix = NULL );
+ void AddItemL( TDriveNumber aDrive, const TDesC& aCaption, const TDesC* aSuffix = NULL );
+
+private: // Data members
+ CDesCArrayFlat* iModel;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewThreadInfoItemActiveObject.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWTHREADINFOITEMACTIVEOBJECT_H
+#define MEMSPYVIEWTHREADINFOITEMACTIVEOBJECT_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewThreadInfoItemGeneric.h"
+
+// Classes referenced
+class CMemSpyEngineActiveObjectArray;
+
+
+
+class CMemSpyViewThreadInfoItemActiveObjectBase : public CMemSpyViewThreadInfoItemGeneric
+ {
+public:
+ CMemSpyViewThreadInfoItemActiveObjectBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+
+public: // From CMemSpyViewBase
+ TBool HandleCommandL( TInt aCommand );
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_ACTIVE_OBJECTS; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdActiveObject; }
+ void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+protected:
+ CMemSpyEngineActiveObjectArray& ActiveObjectArray() const;
+
+private: // Command handlers
+ void OnCmdWriteAOListingL();
+ };
+
+
+
+class CMemSpyViewThreadInfoItemActiveObject : public CMemSpyViewThreadInfoItemActiveObjectBase
+ {
+public:
+ CMemSpyViewThreadInfoItemActiveObject( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareChildViewL();
+ };
+
+
+
+
+class CMemSpyViewThreadInfoItemActiveObjectDetails : public CMemSpyViewThreadInfoItemActiveObjectBase
+ {
+public:
+ CMemSpyViewThreadInfoItemActiveObjectDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, TAny* aObjectAddress );
+
+public: // From CMemSpyViewBase
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // Data members
+ TAny* iObjectAddress;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewThreadInfoItemChunk.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWTHREADINFOITEMCHUNK_H
+#define MEMSPYVIEWTHREADINFOITEMCHUNK_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewThreadInfoItemGeneric.h"
+
+
+class CMemSpyViewThreadInfoItemChunk : public CMemSpyViewThreadInfoItemGeneric
+ {
+public:
+ CMemSpyViewThreadInfoItemChunk( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+
+private: // From CMemSpyViewBase
+ CMemSpyViewBase* PrepareChildViewL();
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewThreadInfoItemCodeSeg.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWTHREADINFOITEMCODESEG_H
+#define MEMSPYVIEWTHREADINFOITEMCODESEG_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewThreadInfoItemGeneric.h"
+
+
+class CMemSpyViewThreadInfoItemCodeSeg : public CMemSpyViewThreadInfoItemGeneric
+ {
+public:
+ CMemSpyViewThreadInfoItemCodeSeg( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+
+public: // From CMemSpyViewBase
+ TBool HandleCommandL( TInt aCommand );
+
+private: // From CMemSpyViewBase
+ CMemSpyViewBase* PrepareChildViewL();
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewThreadInfoItemGeneralInfo.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWTHREADINFOITEMGENERALINFO_H
+#define MEMSPYVIEWTHREADINFOITEMGENERALINFO_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewThreadInfoItemGeneric.h"
+
+
+class CMemSpyViewThreadInfoItemGeneralInfo : public CMemSpyViewThreadInfoItemGeneric
+ {
+public:
+ CMemSpyViewThreadInfoItemGeneralInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+
+public: // From CMemSpyViewBase
+ TBool HandleCommandL( TInt aCommand );
+ void HandleListBoxItemActionedL( TInt aCurrentIndex );
+
+private: // Command handlers
+ void OnCmdToggleKernelEventHooksL();
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewThreadInfoItemGeneric.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWTHREADINFOITEMGENERIC_H
+#define MEMSPYVIEWTHREADINFOITEMGENERIC_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// Engine includes
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+class CAknWaitDialog;
+class CMemSpyProcess;
+class CMemSpyThread;
+class CMemSpyThreadInfoContainer;
+class CMemSpyThreadInfoItemBase;
+
+
+class CMemSpyViewThreadInfoItemGeneric : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewThreadInfoItemGeneric( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aInfoContainer, TMemSpyThreadInfoItemType aType );
+ ~CMemSpyViewThreadInfoItemGeneric();
+
+public: // From CMemSpyViewBase
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // API
+ CMemSpyProcess& Process() const;
+ CMemSpyThread& Thread() const;
+ CMemSpyThreadInfoContainer& Container() const;
+ CMemSpyThreadInfoItemBase& InfoItem() const;
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+ TBool HandleCommandL( TInt aCommand );
+
+protected: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aCurrentIndex );
+ void HandleListBoxItemSelectedL( TInt aCurrentIndex );
+
+private: // Internal methods
+ void ShowWaitNoteL();
+ void DestroyWaitNote();
+ static TInt CheckForItemConstructionComplete( TAny* aSelf );
+
+protected: // Member data
+ CMemSpyThreadInfoContainer& iContainer;
+ CMemSpyThreadInfoItemBase* iInfoItem;
+
+private: // Member data
+ CAknWaitDialog* iWaitNote;
+ CPeriodic* iWaitConstructionChecker;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewThreadInfoItemHeap.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWTHREADINFOITEMHEAP_H
+#define MEMSPYVIEWTHREADINFOITEMHEAP_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewThreadInfoItemGeneric.h"
+
+
+class CMemSpyViewThreadInfoItemHeap : public CMemSpyViewThreadInfoItemGeneric
+ {
+public:
+ CMemSpyViewThreadInfoItemHeap( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+
+public: // From CMemSpyViewBase
+ TBool HandleCommandL( TInt aCommand );
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_HEAP; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdHeap; }
+ void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+private: // Command handlers
+ void OnCmdHeapDataL();
+ void OnCmdHeapCellListingL();
+ void OnCmdHeapInfoL();
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewThreadInfoItemList.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWTHREADINFOITEMLIST_H
+#define MEMSPYVIEWTHREADINFOITEMLIST_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+
+// Classes referenced
+class CMemSpyProcess;
+class CMemSpyThread;
+class CMemSpyThreadInfoItemBase;
+
+
+class CMemSpyViewThreadInfoItemList : public CMemSpyViewBase, public MMemSpyThreadInfoContainerObserver
+ {
+public:
+ CMemSpyViewThreadInfoItemList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThread& 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
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+ TBool HandleCommandL( TInt aCommand );
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_THREAD; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdThread; }
+ void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+private: // Command handlers
+ void OnCmdInfoHandlesL();
+
+private: // From MMemSpyThreadInfoContainerObserver
+ void HandleMemSpyEngineInfoContainerEventL( TEvent aEvent, TMemSpyThreadInfoItemType aType );
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aCurrentIndex );
+ void HandleListBoxItemSelectedL( TInt aCurrentIndex );
+ static TInt IdleUpdateListBoxModel( TAny* aSelf );
+ void DoIdleUpdateListBoxModelL();
+
+private: // Member data
+ CMemSpyThread& iThread;
+ CMemSpyThreadInfoItemBase* iCurrentInfoItem;
+ CPeriodic* iIdleResetListboxTimer;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewThreadInfoItemMemoryTracking.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWTHREADINFOITEMMEMORYTRACKING_H
+#define MEMSPYVIEWTHREADINFOITEMMEMORYTRACKING_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// Engine includes
+#include <memspy/engine/memspyengineprocessmemorytracker.h>
+
+// User includes
+#include "MemSpyViewThreadInfoItemGeneric.h"
+
+// Classes referenced
+class CMemSpyEngineProcessMemoryTracker;
+
+
+class CMemSpyViewThreadInfoItemMemoryTracking : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver
+ {
+public:
+ CMemSpyViewThreadInfoItemMemoryTracking( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+ TBool HandleCommandL( TInt aCommand );
+ TInt IndexByViewType( TMemSpyViewType aType );
+ void HandleListBoxItemActionedL( TInt aIndex );
+ void RefreshL();
+ void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_MEMORY_TRACKING; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdMemoryTracking; }
+
+private: // From MMemSpyEngineProcessMemoryTrackerObserver
+ void HandleMemoryTrackingStartedL();
+ void HandleMemoryTrackingStoppedL();
+ void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
+
+private: // Command handlers
+ void OnCmdTrackingStartL();
+ void OnCmdTrackingStopL();
+ void OnCmdHWMResetL();
+ void OnCmdTotalWithSharedMemL();
+ void OnCmdTotalWithoutSharedMemL();
+ };
+
+
+class CMemSpyViewThreadInfoItemMemoryTrackingCurrent : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver
+ {
+public:
+ CMemSpyViewThreadInfoItemMemoryTrackingCurrent( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ void RefreshL();
+ void SetListBoxModelL();
+
+private: // From MMemSpyEngineProcessMemoryTrackerObserver
+ void HandleMemoryTrackingStartedL() { }
+ void HandleMemoryTrackingStoppedL() { }
+ void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
+ };
+
+
+
+class CMemSpyViewThreadInfoItemMemoryTrackingHWM : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver
+ {
+public:
+ CMemSpyViewThreadInfoItemMemoryTrackingHWM( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ TBool HandleCommandL( TInt aCommand );
+ void RefreshL();
+ void SetListBoxModelL();
+
+private: // From MMemSpyEngineProcessMemoryTrackerObserver
+ void HandleMemoryTrackingStartedL() { }
+ void HandleMemoryTrackingStoppedL() { }
+ void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_MEMORY_TRACKING_HWM; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdMemoryTrackingHWM; }
+
+private: // Command handlers
+ void OnCmdHWMResetL();
+ };
+
+
+
+
+class CMemSpyViewThreadInfoItemMemoryTrackingPeak : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver
+ {
+public:
+ CMemSpyViewThreadInfoItemMemoryTrackingPeak( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ TBool HandleCommandL( TInt aCommand );
+ void RefreshL();
+ void SetListBoxModelL();
+
+private: // From MMemSpyEngineProcessMemoryTrackerObserver
+ void HandleMemoryTrackingStartedL() { }
+ void HandleMemoryTrackingStoppedL() { }
+ void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewThreadInfoItemServer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWTHREADINFOITEMSERVER_H
+#define MEMSPYVIEWTHREADINFOITEMSERVER_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+#include <badesca.h>
+
+// User includes
+#include "MemSpyViewThreadInfoItemGeneric.h"
+
+// Classes referenced
+class TMemSpyDriverHandleInfoGeneric;
+
+
+
+class CMemSpyViewThreadInfoItemServer : public CMemSpyViewThreadInfoItemGeneric
+ {
+public:
+ CMemSpyViewThreadInfoItemServer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+
+public: // From CMemSpyViewBase
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TBool HandleCommandL( TInt aCommand );
+ void HandleListBoxItemSelectedL( TInt aCurrentIndex );
+
+public: // From CMemSpyViewBase
+ CMemSpyViewBase* PrepareChildViewL();
+
+private: // Data members
+ TMemSpyDriverHandleInfoGeneric iCurrentInfoItemDetails;
+ };
+
+
+
+class CMemSpyViewThreadInfoItemServerDetails : public CMemSpyViewThreadInfoItemGeneric
+ {
+public:
+ CMemSpyViewThreadInfoItemServerDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails );
+
+public: // From CMemSpyViewBase
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TBool HandleCommandL( TInt aCommand );
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareChildViewL();
+ CMemSpyViewBase* PrepareParentViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aCurrentIndex );
+ void HandleListBoxItemSelectedL( TInt aCurrentIndex );
+
+private: // Internal methods
+
+private: // Member data
+ const TMemSpyDriverHandleInfoGeneric iInfoItemDetails;
+ };
+
+
+
+class CMemSpyViewThreadInfoItemServerSessions : public CMemSpyViewThreadInfoItemGeneric
+ {
+public:
+ CMemSpyViewThreadInfoItemServerSessions( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails );
+
+public: // From CMemSpyViewBase
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ TBool HandleCommandL( TInt aCommand );
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+
+private: // Member data
+ const TMemSpyDriverHandleInfoGeneric iInfoItemDetails;
+ };
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewThreadInfoItemStack.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWTHREADINFOITEMSTACK_H
+#define MEMSPYVIEWTHREADINFOITEMSTACK_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewThreadInfoItemGeneric.h"
+
+
+class CMemSpyViewThreadInfoItemStack : public CMemSpyViewThreadInfoItemGeneric
+ {
+public:
+ CMemSpyViewThreadInfoItemStack( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+
+public: // From CMemSpyViewBase
+ TBool HandleCommandL( TInt aCommand );
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_STACK; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdStack; }
+ void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+private: // Command handlers
+ void OnCmdDeviceStackSummaryL();
+ void OnCmdStackInfoL();
+ void OnCmdStackDataUserL();
+ void OnCmdStackDataKernelL();
+ void OnCmdStackDataUserAllThreadsL();
+ void OnCmdStackDataKernelAllThreadsL();
+ void OnCmdStackWatchForHighWatermarkL();
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewThreads.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWTHREADS_H
+#define MEMSPYVIEWTHREADS_H
+
+// System includes
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+class CMemSpyProcess;
+class CMemSpyThread;
+
+
+class CMemSpyViewThreads : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewThreads( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess );
+ ~CMemSpyViewThreads();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // API
+ const CMemSpyProcess& Process() const;
+ CMemSpyThread& CurrentThread();
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_THREAD; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdThread; }
+ void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+public: // From CMemSpyViewBase
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+ TBool HandleCommandL( TInt aCommand );
+
+private: // Command handlers
+ void OnCmdEndKillL();
+ void OnCmdEndTerminateL();
+ void OnCmdEndPanicL();
+ void OnCmdSetPriorityL( TInt aCommand );
+ void OnCmdInfoHandlesL();
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ void HandleListBoxItemActionedL( TInt aCurrentIndex );
+ void HandleListBoxItemSelectedL( TInt aCurrentIndex );
+
+private: // Member data
+ CMemSpyProcess& iParentProcess;
+ CMemSpyThread* iCurrentThread;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewType.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MEMSPYVIEWTYPE_H
+#define MEMSPYVIEWTYPE_H
+
+// System includes
+#include <e32std.h>
+
+// Enumerations
+enum TMemSpyViewType
+ {
+ EMemSpyViewTypeNone = -1,
+ EMemSpyViewTypeMainMenu = 0,
+ EMemSpyViewTypeProcesses,
+ EMemSpyViewTypeRAMInfo,
+ EMemSpyViewTypeROMInfo,
+ EMemSpyViewTypeServerList,
+ EMemSpyViewTypeOpenFiles,
+ EMemSpyViewTypeFBServBitmaps,
+ EMemSpyViewTypeFBServBitmapInfo,
+ EMemSpyViewTypeFBServBitmapViewer,
+ EMemSpyViewTypeCodeSegmentList,
+ EMemSpyViewTypeCodeSegmentDetails,
+ EMemSpyViewTypeChunkList,
+ EMemSpyViewTypeChunkDetails,
+ EMemSpyViewTypeSystemConfig,
+ EMemSpyViewTypeKernel,
+ EMemSpyViewTypeKernelContainers,
+ EMemSpyViewTypeKernelObjects,
+ EMemSpyViewTypeKernelHeap,
+ EMemSpyViewTypeDriveSummary,
+ EMemSpyViewTypeDriveInfo,
+ EMemSpyViewTypeECom,
+ EMemSpyViewTypeEComCategory,
+ EMemSpyViewTypeEComInterface,
+ EMemSpyViewTypeEComImplementation,
+ EMemSpyViewTypeThreads,
+ EMemSpyViewTypeThreadInfoItemList,
+ EMemSpyViewTypeThreadInfoItemHeap,
+ EMemSpyViewTypeThreadInfoItemStack,
+ EMemSpyViewTypeThreadInfoItemChunk,
+ EMemSpyViewTypeThreadInfoItemCodeSeg,
+ EMemSpyViewTypeThreadInfoItemServer,
+ EMemSpyViewTypeThreadInfoItemServerDetails,
+ EMemSpyViewTypeThreadInfoItemServerSessions,
+ EMemSpyViewTypeThreadInfoItemSession,
+ EMemSpyViewTypeThreadInfoItemSemaphore,
+ EMemSpyViewTypeThreadInfoItemMutex,
+ EMemSpyViewTypeThreadInfoItemTimer,
+ EMemSpyViewTypeThreadInfoItemLDD,
+ EMemSpyViewTypeThreadInfoItemPDD,
+ EMemSpyViewTypeThreadInfoItemLogicalChannel,
+ EMemSpyViewTypeThreadInfoItemChangeNotifier,
+ EMemSpyViewTypeThreadInfoItemUndertaker,
+ EMemSpyViewTypeThreadInfoItemMessageQueue,
+ EMemSpyViewTypeThreadInfoItemConditionalVariable,
+ EMemSpyViewTypeThreadInfoItemOpenFiles,
+ EMemSpyViewTypeThreadInfoItemActiveObject,
+ EMemSpyViewTypeThreadInfoItemActiveObjectDetails,
+ EMemSpyViewTypeThreadInfoItemGeneralInfo,
+ EMemSpyViewTypeThreadInfoItemOtherThreads,
+ EMemSpyViewTypeThreadInfoItemOtherProcesses,
+ EMemSpyViewTypeThreadInfoItemOwnedThreadHandles,
+ EMemSpyViewTypeThreadInfoItemOwnedProcessHandles,
+ EMemSpyViewTypeHeapTracking,
+ EMemSpyViewTypeHeapTrackingSettings,
+ EMemSpyViewTypeHeapTrackingResults,
+ EMemSpyViewTypeHeapTrackingResultsCycleInfo,
+ EMemSpyViewTypeHeapTrackingResultsCycleChangeDescriptor,
+ EMemSpyViewTypeThreadInfoItemMemoryTracking,
+ EMemSpyViewTypeThreadInfoItemMemoryTrackingAutoStartConfig,
+ EMemSpyViewTypeThreadInfoItemMemoryTrackingStatistics,
+ EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent,
+ EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM,
+ EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak,
+ EMemSpyViewTypeWindowGroups
+ };
+
+
+class MemSpyViewTypeUtils
+ {
+public:
+ static TBool IsOpenableItem( TMemSpyViewType aType );
+ static TBool IsThreadInfoItem( TMemSpyViewType aType );
+ static TBool IsExitableView( TMemSpyViewType aType );
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/MemSpyViewWindowGroups.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYVIEWWINDOWGROUPS_H
+#define MEMSPYVIEWWINDOWGROUPS_H
+
+// System includes
+#include <hal.h>
+#include <coecntrl.h>
+#include <aknlists.h>
+
+// Engine includes
+#include <memspy/engine/memspyenginehelperwindowserver.h>
+
+// User includes
+#include "MemSpyViewBase.h"
+
+// Classes referenced
+
+
+class CMemSpyViewWindowGroups : public CMemSpyViewBase
+ {
+public:
+ CMemSpyViewWindowGroups( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
+ ~CMemSpyViewWindowGroups();
+ void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+
+public: // From CMemSpyViewBase
+ CEikListBox* ConstructListBoxL();
+ void RefreshL();
+ TMemSpyViewType ViewType() const;
+ CMemSpyViewBase* PrepareParentViewL();
+ CMemSpyViewBase* PrepareChildViewL();
+
+public: // Menu framework
+ TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_WINDOW_GROUPS; }
+ TInt MenuCascadeCommandId() const { return EMemSpyCmdWindowGroups; }
+
+private: // From CMemSpyViewBase
+ void SetListBoxModelL();
+ TBool HandleCommandL( TInt aCommand );
+
+private: // Command handlers
+ void OnCmdSwitchToL();
+ void OnCmdEndL( TInt aCommand );
+
+private: // Internal methods
+ void DetailsL();
+ void AppendFormatString( TPtr& aPtr, TRefByValue<const TDesC> aFmt, ... );
+
+private: // Data members
+ MMemSpyEngineWindowGroupList* iWindowGroupList;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/include/viewcli.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,166 @@
+// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies 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 __VIEWCLI_H__
+#define __VIEWCLI_H__
+
+#include <e32base.h>
+#include <gdi.h>
+#include <vwsdef.h>
+
+//
+// Forward declarations.
+//
+
+class RVwsSession;
+class CVwsSessionEventHandler;
+class MVwsAppStarter;
+
+class MVwsSessionWrapperObserver
+/**
+The MVwsSessionObserver specifies an interface through which server events to be handled by the owner of
+a client session are notified
+
+@publishedAll
+@deprecated
+*/
+//@internalTechnology @released
+
+ {
+public:
+
+ /**
+ * Handles the view event aEvent for a view added through the client session being observed.
+ * Handles events for all the views added by the client.
+ */
+ virtual void HandleViewEventL(const TVwsViewEvent& aEvent)=0;
+ };
+
+
+class CVwsSessionWrapper : public CBase
+/**
+The CVwsSessionWrapper class mediates access to the view server client session which it creates, and wraps in
+support for notification of server events. A session observer will be called back with server events if
+it maintains an outstanding request for asynchronous event notification.
+
+@publishedPartner
+@released
+*/
+//@internalTechnology @released
+
+ {
+public:
+ IMPORT_C static CVwsSessionWrapper* NewL();
+ IMPORT_C static CVwsSessionWrapper* NewLC();
+ IMPORT_C static CVwsSessionWrapper* NewL(MVwsSessionWrapperObserver& aObserver);
+ IMPORT_C static CVwsSessionWrapper* NewLC(MVwsSessionWrapperObserver& aObserver);
+ IMPORT_C ~CVwsSessionWrapper();
+ IMPORT_C static TInt StartViewServer(MVwsAppStarter& aAppStarter);
+ IMPORT_C TInt ShutdownViewServer();
+ IMPORT_C TInt AddView(const TVwsViewId& aViewId);
+ IMPORT_C TInt RemoveView(const TVwsViewId& aViewId) const;
+ IMPORT_C TInt SetSystemDefaultView(const TVwsViewId& aViewId,TInt aMode);
+ IMPORT_C TInt SetSystemDefaultView(const TVwsViewId& aViewId);
+ IMPORT_C TInt ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage);
+ IMPORT_C TInt ActivateViewViaViewEvent(const TVwsViewIdAndMessage& aViewIdAndMessage);
+ IMPORT_C TInt RequestCustomMessage(TDes8& aMessageBufPtr) const;
+ IMPORT_C void QueueAsyncRequest();
+ IMPORT_C TInt StartApp(TUid aAppToStart);
+ IMPORT_C TInt DeactivateActiveView();
+ IMPORT_C TInt DeactivateActiveViewIfOwnerMatch();
+ IMPORT_C TInt NotifyNextDeactivation(const TVwsViewId& aViewId);
+ IMPORT_C TInt NotifyNextDeactivation();
+ IMPORT_C TInt NotifyNextActivation(const TVwsViewId& aViewId);
+ IMPORT_C TInt NotifyNextActivation();
+ IMPORT_C TInt SetDefaultView(const TVwsViewId& aViewId,TInt aMode) const;
+ IMPORT_C TInt SetDefaultView(const TVwsViewId& aViewId) const;
+ IMPORT_C TInt GetSystemDefaultView(TVwsViewId& aViewId);
+ IMPORT_C TInt CreateActivateViewEvent(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage);
+ IMPORT_C TInt SetClientRequestTimeOut(TTimeIntervalMicroSeconds32 aDuration);
+ IMPORT_C TInt SetServerEventTimeOut(TTimeIntervalMicroSeconds32 aDuration);
+ IMPORT_C TInt EnableServerEventTimeOut(TBool aEnable);
+ IMPORT_C TInt CheckSourceOfViewSwitch(TBool& aResult,const TSecurityPolicy& aSecurityPolicy,const char* aDiagnostic);
+ IMPORT_C TInt EnableServerBlankScreen(TBool aEnable);
+ IMPORT_C TInt EnableExternalViewSwitches(TBool aEnable);
+ IMPORT_C void ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TRequestStatus& aStatus);
+ IMPORT_C TInt SetCrossCheckUid(const TUid& aCrossCheckUid);
+ IMPORT_C TInt SetWindowBackgroundColor(const TRgb& aBgColor);
+public:
+ /**
+ @internalComponent
+ @released
+ */
+ IMPORT_C TInt ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TInt aCustomControl);
+ /**
+ @internalComponent
+ @released
+ */
+ IMPORT_C void ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TRequestStatus& aStatus, TInt aCustomControl);
+ /**
+ @internalComponent
+ @released
+ */IMPORT_C TInt CreateActivateViewEvent(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TInt aCustomControl);
+ /**
+ @internalComponent
+ @released
+ */
+ IMPORT_C TInt GetCurrentActiveViewInSystem(TVwsViewId& aActiveViewId);
+private:
+ CVwsSessionWrapper();
+ CVwsSessionWrapper(MVwsSessionWrapperObserver& aObserver);
+ void ConstructL();
+ TInt CheckCreateViewServerSession();
+ TBool IsSchedulerRunning();
+private:
+ RVwsSession* iVwsSession;
+ CVwsSessionEventHandler* iViewEventHandler;
+ MVwsSessionWrapperObserver* iObserver;
+ };
+
+
+//
+// Panic.
+//
+/**
+@internalComponent
+*/
+enum TVwsPanic
+ {
+ EVwsCreateScheduler=1,
+ EVwsThreadRename
+ };
+
+/**
+@internalComponent
+*/
+GLREF_C void Panic(TVwsPanic aPanic);
+
+/**
+Server thread start.
+
+@internalComponent
+*/
+GLDEF_C TInt ViewServerThreadStart(TAny* aPtr);
+
+/**
+@internalComponent
+*/
+struct SVwsCommandLine
+ {
+ MVwsAppStarter* iAppStarter;
+ };
+
+
+#endif
--- a/memspyui/memspyui.pro Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-TEMPLATE = subdirs
-
-DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT QT_NO_DEBUG
-
-SUBDIRS = group \
- ui/hb
--- a/memspyui/rom/memspyui.iby Wed Sep 15 12:13:45 2010 +0300
+++ b/memspyui/rom/memspyui.iby Wed Oct 13 14:32:52 2010 +0300
@@ -22,8 +22,11 @@
S60_APP_EXE(MemSpyUI)
S60_APP_AIF_ICONS(MemSpyUI)
S60_APP_RESOURCE(MemSpyUI)
-SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,MemSpyUI)
-data=ZPRIVATE\10003a3f\import\APPS\MemSpyUI_reg.RSC Private\10003a3f\import\Apps\MemSpyUI_reg.rsc
+#ifdef S60_UPGRADABLE_APP_REG_RSC
+ S60_UPGRADABLE_APP_REG_RSC(MemSpyUI)
+#else
+ S60_APP_AIF_RSC(MemSpyUI)
+#endif
data=ZPRIVATE\2002129F\MemSpyEComInterfaceIds.xml \private\2002129F\MemSpyEComInterfaceIds.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyApp.cpp Wed Oct 13 14:32:52 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 "MemSpyApp.h"
+
+// System includes
+#include <eikstart.h>
+
+// User includes
+#include "MemSpyDocument.h"
+
+
+
+TUid CMemSpyApp::AppDllUid() const
+ {
+ return KUidMemSpy;
+ }
+
+
+CApaDocument* CMemSpyApp::CreateDocumentL()
+ {
+ return CMemSpyDocument::NewL( *this );
+ }
+
+
+EXPORT_C CApaApplication* NewApplication()
+ {
+ return new CMemSpyApp;
+ }
+
+
+GLDEF_C TInt E32Main()
+ {
+ return EikStart::RunApplication(NewApplication);
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyAppUi.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,721 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyAppUi.h"
+
+// System includes
+#include <AknQueryDialog.h>
+#include <aknmessagequerydialog.h>
+#include <aknradiobuttonsettingpage.h>
+#include <eikaufty.h>
+#include <eikmenub.h>
+#include <avkon.hrh>
+#include <barsread.h>
+#include <f32file.h>
+#include <apgtask.h>
+#include <memspyui.rsg>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyenginehelperthread.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperkernelcontainers.h>
+#include <memspy/engine/memspyenginehelperfbserv.h>
+#include <memspyengineclientinterface.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+#include <memspy/engine/memspyenginehelperkernelcontainers.h>
+
+// User includes
+#include "MemSpyContainer.h"
+#include "MemSpyDocument.h"
+#include "MemSpySettings.h"
+#include "MemSpyDeviceWideOperationDialog.h"
+#include "MemSpyViewRAMInfo.h" // for aknicon config check
+#include "MemSpyExportBitmapsToMemoryCardDialog.h"
+#include "MemSpy.hrh"
+#include "viewcli.h"
+
+// Constants
+const TInt KMemSpyDefaultAutoCaptureTimerPeriod = 60;
+const TUint32 KMemSpyEikSrvSID = 0x10003a4a;
+
+
+CMemSpyAppUi::CMemSpyAppUi( CMemSpyEngine& aEngine )
+: iEngine( aEngine ), iAutoCaptureTimerPeriod( KMemSpyDefaultAutoCaptureTimerPeriod ), iAutoCaptureOperationType( CMemSpyDeviceWideOperations::EPerEntityHeapInfo )
+ {
+ iEngine.SetObserver( this );
+ }
+
+
+CMemSpyAppUi::~CMemSpyAppUi()
+ {
+ RDebug::Printf( "[MemSpy] MemSpy is now closing." );
+ //
+ delete iAutoCaptureTimer;
+ //
+ if (iAppContainer)
+ {
+ RemoveFromStack( iAppContainer );
+ delete iAppContainer;
+ }
+ //
+ iEngine.SetObserver( NULL );
+ SetViewServerTimeOutStatus( ETrue );
+ }
+
+
+void CMemSpyAppUi::ConstructL()
+ {
+ BaseConstructL( EAknEnableSkin );
+ //
+ iAppContainer = new (ELeave) CMemSpyContainer( iEngine, *this );
+ iAppContainer->SetMopParent(this);
+ iAppContainer->ConstructL( ClientRect() );
+ iAppContainer->SetObserver( this );
+ iAppContainer->SetFocus( ETrue );
+ AddToStackL( iAppContainer );
+ //
+ iAutoCaptureTimer = CPeriodic::NewL( CActive::EPriorityIdle );
+ //
+ iEikonEnv->SetSystem( ETrue );
+ //
+ SetViewServerTimeOutStatus( EFalse );
+ }
+
+
+CMemSpyDocument& CMemSpyAppUi::MemSpyDocument()
+ {
+ CMemSpyDocument* doc = static_cast< CMemSpyDocument* >( Document() );
+ return *doc;
+ }
+
+
+const CMemSpyDocument& CMemSpyAppUi::MemSpyDocument() const
+ {
+ const CMemSpyDocument* doc = static_cast< const CMemSpyDocument* >( Document() );
+ return *doc;
+ }
+
+
+void CMemSpyAppUi::HandleStatusPaneSizeChange()
+ {
+ iAppContainer->SetRect( ClientRect() );
+ }
+
+
+void CMemSpyAppUi::HandleControlEventL( CCoeControl* aControl, TCoeEvent /*aEventType*/ )
+ {
+ if ( aControl == iAppContainer )
+ {
+ UpdateCBAL();
+ }
+ }
+
+
+void CMemSpyAppUi::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
+ {
+ CMemSpyViewBase& view = iAppContainer->ActiveView();
+ const TMemSpyViewType viewType = iAppContainer->ActiveViewType();
+ //
+ const TBool openableView = MemSpyViewTypeUtils::IsOpenableItem( viewType );
+ const TBool exitable = MemSpyViewTypeUtils::IsExitableView( viewType );
+ //
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - START - aResourceId: 0x%08x (%8d), iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d, viewType: %d, openableView: %d, exitable: %d", aResourceId, aResourceId, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive(), viewType, openableView, exitable );
+#endif
+ //
+ if ( aResourceId == R_MEMSPY_MENUPANE )
+ {
+ const TInt count = aMenuPane->NumberOfItemsInPane();
+ for( TInt i=0; i<count; i++ )
+ {
+ TBool dimItem = EFalse;
+ CEikMenuPaneItem::SData& menuPaneMetaData = aMenuPane->ItemDataByIndexL( i );
+
+ // If the command is inside the view-specific range then we'll hide it
+ // unless the view and command id matches.
+ const TBool isViewSpecific = ( menuPaneMetaData.iCommandId >= KMemSpyMenuCommandViewSpecific );
+ if ( isViewSpecific )
+ {
+ // Check whether this view requires this command item.
+ dimItem = ( view.MenuCascadeCommandId() != menuPaneMetaData.iCommandId );
+ }
+
+ aMenuPane->SetItemDimmed( menuPaneMetaData.iCommandId, dimItem );
+ }
+
+ aMenuPane->SetItemDimmed( EMemSpyCmdOpen, !openableView );
+ aMenuPane->SetItemDimmed( EAknSoftkeyBack, exitable );
+ aMenuPane->SetItemDimmed( EAknCmdExit, !exitable );
+ }
+ else if ( aResourceId == R_MEMSPY_MENUPANE_TOOLS )
+ {
+ const TBool inOpenFilesView = ( viewType == EMemSpyViewTypeOpenFiles );
+ aMenuPane->SetItemDimmed( EMemSpyCmdToolsListOpenFiles, !inOpenFilesView );
+ }
+ else if ( aResourceId == R_MEMSPY_MENUPANE_VIEW )
+ {
+ // Hide the refresh item when in the thread info container view
+ aMenuPane->SetItemDimmed( EMemSpyCmdViewRefresh, viewType == EMemSpyViewTypeThreadInfoItemList );
+ aMenuPane->SetItemDimmed( EMemSpyCmdViewOutputToSink, viewType == EMemSpyViewTypeThreadInfoItemList );
+ }
+ else if ( aResourceId == R_MEMSPY_MENUPANE_OUTPUT )
+ {
+ const TMemSpySinkType currentSink = iEngine.SinkType();
+ aMenuPane->SetItemDimmed( EMemSpyCmdOutputToDebug, currentSink == ESinkTypeDebug );
+ aMenuPane->SetItemDimmed( EMemSpyCmdOutputToFile, currentSink == ESinkTypeFile );
+ }
+ else if ( aResourceId == R_MEMSPY_MENUPANE_AUTO_CAPTURE )
+ {
+ // Change the auto-capture toggle caption appropriately...
+ TInt resId = R_MEMSPY_AUTO_CAPTURE_ENABLE;
+ if ( iAutoCaptureTimer->IsActive() )
+ {
+ resId = R_MEMSPY_AUTO_CAPTURE_DISABLE;
+ }
+ aMenuPane->SetItemTextL( EMemSpyCmdAutoCaptureToggle, resId );
+ }
+
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - sending to view..." );
+#endif
+
+ view.DynInitMenuPaneL( aResourceId, aMenuPane );
+
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - END - aResourceId: 0x%08x (%8d), iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d, viewType: %d, openableView: %d, exitable: %d", aResourceId, aResourceId, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive(), viewType, openableView, exitable );
+#endif
+ }
+
+
+TKeyResponse CMemSpyAppUi::HandleKeyEventL( const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ )
+ {
+ return EKeyWasNotConsumed;
+ }
+
+
+void CMemSpyAppUi::HandleCommandL( TInt aCommand )
+ {
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::HandleCommandL() - START - aCommand: %8d, iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", aCommand, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
+#endif
+
+ switch ( aCommand )
+ {
+ case EAknSoftkeyBack:
+ OnCmdBackL();
+ break;
+
+ case EEikCmdExit:
+ case EAknCmdExit:
+ case EAknSoftkeyExit:
+ OnCmdExitL();
+ break;
+
+ case EMemSpyCmdOpen:
+ OnCmdOpenL();
+ break;
+
+ case EMemSpyCmdOutputToDebug:
+ OnCmdOutputToDebugL();
+ break;
+ case EMemSpyCmdOutputToFile:
+ OnCmdOutputToFileL();
+ break;
+
+ case EMemSpyCmdToolsAbout:
+ OnCmdAboutL();
+ break;
+ //
+ case EMemSpyCmdPhoneInfoGeneralSummary:
+ OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralSummary );
+ break;
+ case EMemSpyCmdPhoneInfoGeneralDetailed:
+ OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralDetailed );
+ break;
+ case EMemSpyCmdPhoneInfoGeneralHandles:
+ OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralHandles );
+ break;
+ case EMemSpyCmdPhoneInfoGeneralKernelContainers:
+ OnCmdPhoneInformationOperationKernelContainersL();
+ break;
+ //
+ case EMemSpyCmdPhoneInfoHeapInfoSummary:
+ OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapInfo );
+ break;
+ case EMemSpyCmdPhoneInfoHeapInfoCompact:
+ OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceHeapInfoCompact );
+ break;
+ case EMemSpyCmdPhoneInfoHeapCellListing:
+ OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapCellListing );
+ break;
+ case EMemSpyCmdPhoneInfoHeapDump:
+ OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapData );
+ break;
+ //
+ case EMemSpyCmdPhoneInfoStackInfo:
+ OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackInfo );
+ break;
+ case EMemSpyCmdPhoneInfoStackInfoCompact:
+ OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceStackInfoCompact );
+ break;
+ case EMemSpyCmdPhoneInfoStackDumpUser:
+ OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataUser );
+ break;
+ case EMemSpyCmdPhoneInfoStackDumpKernel:
+ OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataKernel );
+ break;
+
+ case EMemSpyCmdAutoCaptureToggle:
+ OnCmdAutoCaptureToggleL();
+ break;
+ case EMemSpyCmdAutoCaptureRetryTime:
+ OnCmdAutoCaptureRetryTimeL();
+ break;
+ case EMemSpyCmdAutoCaptureOperationType:
+ OnCmdAutoCaptureOperationTypeL();
+ break;
+
+ default:
+ iAppContainer->HandleCommandL( aCommand );
+ break;
+ }
+
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::HandleCommandL() - END - aCommand: %8d, iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", aCommand, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
+#endif
+ }
+
+
+void CMemSpyAppUi::HandleForegroundEventL( TBool aForeground)
+ {
+ // Refresh the container when coming to the foreground
+ if ( aForeground )
+ {
+ iAppContainer->OnCmdViewRefreshL();
+ }
+ }
+
+
+void CMemSpyAppUi::HandleThreadSelectedL( const CMemSpyThread& /*aThread*/ )
+ {
+ MEikAppUiFactory* appUiFactory = (iEikonEnv)->AppUiFactory();
+ appUiFactory->MenuBar()->TryDisplayMenuBarL();
+ }
+
+
+void CMemSpyAppUi::HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext )
+ {
+ if ( aEvent == MMemSpyEngineObserver::EHandleThreadsOrProcessesChanged )
+ {
+ // Get the original container
+ const CMemSpyEngineObjectContainer& oldContainer = *reinterpret_cast< CMemSpyEngineObjectContainer* >( aContext );
+ (void) oldContainer;
+
+ // Refresh the container
+ iAppContainer->OnCmdViewRefreshL();
+ }
+ else if ( aEvent == MMemSpyEngineObserver::EHandleClientServerOperationRequest )
+ {
+ const TInt function = reinterpret_cast<TInt>( aContext );
+ InitiateMemSpyClientServerOperationL( function );
+ }
+ }
+
+
+void CMemSpyAppUi::DWOperationStarted()
+ {
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationStarted() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
+#endif
+
+ iRunningDeviceWideOperation = ETrue;
+
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationStarted() - END - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
+#endif
+ }
+
+
+void CMemSpyAppUi::DWOperationCancelled()
+ {
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCancelled() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
+#endif
+
+ iAutoCaptureTimer->Cancel();
+
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCancelled() - END - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
+#endif
+ }
+
+
+void CMemSpyAppUi::DWOperationCompleted()
+ {
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCompleted() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
+#endif
+
+ iRunningDeviceWideOperation = EFalse;
+
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCompleted() - END - iAutoCaptureTimer is active: %d", iAutoCaptureTimer->IsActive() );
+#endif
+ }
+
+
+void CMemSpyAppUi::UpdateCBAL()
+ {
+ CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
+ const TMemSpyViewType viewType = iAppContainer->ActiveViewType();
+ //
+ if ( MemSpyViewTypeUtils::IsExitableView( viewType ) )
+ {
+ cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_EXIT );
+ }
+ else
+ {
+ cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+ }
+
+ cba->MakeVisible( ETrue );
+ cba->DrawNow();
+ }
+
+
+void CMemSpyAppUi::InitiateMemSpyClientServerOperationL( TInt aOpCode )
+ {
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::InitiateMemSpyClientServerOperationL() - START - aOpCode: %d", aOpCode );
+#endif
+
+ switch( aOpCode )
+ {
+ case EMemSpyClientServerOpSummaryInfo:
+ HandleCommandL( EMemSpyCmdPhoneInfoGeneralSummary );
+ break;
+ case EMemSpyClientServerOpSummaryInfoDetailed:
+ HandleCommandL( EMemSpyCmdPhoneInfoGeneralDetailed );
+ break;
+ //
+ case EMemSpyClientServerOpHeapInfo:
+ HandleCommandL( EMemSpyCmdPhoneInfoHeapInfoSummary );
+ break;
+ case EMemSpyClientServerOpHeapCellListing:
+ HandleCommandL( EMemSpyCmdPhoneInfoHeapCellListing );
+ break;
+ case EMemSpyClientServerOpHeapData:
+ HandleCommandL( EMemSpyCmdPhoneInfoHeapDump );
+ break;
+ //
+ case EMemSpyClientServerOpStackInfo:
+ HandleCommandL( EMemSpyCmdPhoneInfoStackInfo );
+ break;
+ case EMemSpyClientServerOpStackDataUser:
+ HandleCommandL( EMemSpyCmdPhoneInfoStackDumpUser );
+ break;
+ case EMemSpyClientServerOpStackDataKernel:
+ HandleCommandL( EMemSpyCmdPhoneInfoStackDumpKernel );
+ break;
+ //
+ case EMemSpyClientServerOpBitmapsSave:
+ OnCmdToolsBitmapsSaveToMemoryCardL();
+ break;
+ case EMemSpyClientServerOpSendToBackground:
+ OnCmdToolsSendToBackgroundL();
+ break;
+ case EMemSpyClientServerOpBringToForeground:
+ OnCmdToolsBringToForegroundL();
+ break;
+ case EMemSpyClientServerOpExit:
+ OnCmdExitL();
+ break;
+ //
+ default:
+ User::Leave( KErrNotSupported );
+ break;
+ }
+
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::InitiateMemSpyClientServerOperationL() - END - aOpCode: %d", aOpCode );
+#endif
+ }
+
+
+void CMemSpyAppUi::SetViewServerTimeOutStatus( TBool aEnabled )
+ {
+ TRAP_IGNORE(
+ iEngine.HelperProcess().ImpersonateL( KMemSpyEikSrvSID );
+ //
+ CVwsSessionWrapper* ses = CVwsSessionWrapper::NewLC();
+ ses->EnableServerEventTimeOut( aEnabled );
+ CleanupStack::PopAndDestroy( ses );
+ //
+ iEngine.HelperProcess().ImpersonateL( 0 );
+ );
+ }
+
+
+void CMemSpyAppUi::OnCmdBackL()
+ {
+ const TMemSpyViewType viewType = iAppContainer->ActiveViewType();
+ //
+ if ( !MemSpyViewTypeUtils::IsExitableView( viewType ) )
+ {
+ // Should go back one view
+ iAppContainer->NavigateToParentViewL();
+ }
+ }
+
+
+void CMemSpyAppUi::OnCmdExitL()
+ {
+ Exit();
+ }
+
+
+void CMemSpyAppUi::OnCmdOpenL()
+ {
+ const TMemSpyViewType viewType = iAppContainer->ActiveViewType();
+ //
+ if ( !MemSpyViewTypeUtils::IsOpenableItem( viewType ) )
+ {
+ // Should go back one view
+ iAppContainer->NavigateToChildViewL();
+ }
+ }
+
+
+void CMemSpyAppUi::OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::TOperation aOp )
+ {
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdPhoneInformationOperationL() - START - aOp: %d, iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", aOp, iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
+#endif
+
+ if ( !iRunningDeviceWideOperation )
+ {
+ CMemSpyDeviceWideOperationDialog::ExecuteLD( iEngine, *this, aOp );
+ }
+
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdPhoneInformationOperationL() - END - aOp: %d, iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", aOp, iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
+#endif
+ }
+
+
+void CMemSpyAppUi::OnCmdPhoneInformationOperationKernelContainersL()
+ {
+ CMemSpyEngineGenericKernelObjectContainer* list = iEngine.HelperKernelContainers().ObjectsAllL();
+ CleanupStack::PushL( list );
+ iEngine.HelperKernelContainers().OutputL( *list );
+ CleanupStack::PopAndDestroy( list );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+void CMemSpyAppUi::OnCmdAutoCaptureToggleL()
+ {
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdAutoCaptureToggleL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
+#endif
+
+ if ( iAutoCaptureTimer->IsActive() )
+ {
+ iAutoCaptureTimer->Cancel();
+ }
+ else
+ {
+ iAutoCaptureTimer->Cancel();
+ //
+ const TTimeIntervalMicroSeconds32 interval( iAutoCaptureTimerPeriod * 1000000 );
+ iAutoCaptureTimer->Start( 0, interval, TCallBack(AutoCaptureCallBack, this) );
+ }
+
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdAutoCaptureToggleL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
+#endif
+ }
+
+
+void CMemSpyAppUi::OnCmdAutoCaptureRetryTimeL()
+ {
+ CAknNumberQueryDialog* dialog = new(ELeave) CAknNumberQueryDialog( iAutoCaptureTimerPeriod );
+ dialog->ExecuteLD( R_MEMSPY_DEVICE_WIDE_SETTINGS );
+ }
+
+
+void CMemSpyAppUi::OnCmdAutoCaptureOperationTypeL()
+ {
+ CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( R_MEMSPY_AUTO_CAPTURE_OPERATION_TYPES );
+ CleanupStack::PushL(items);
+ //
+ TInt currentItem = iAutoCaptureOperationType;
+ //
+ CAknRadioButtonSettingPage* dialog = new(ELeave) CAknRadioButtonSettingPage( R_MEMSPY_AUTO_CAPTURE_OPERATION_TYPES_SETTINGS_PAGE, currentItem, items );
+ if ( dialog->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
+ {
+ iAutoCaptureOperationType = static_cast< CMemSpyDeviceWideOperations::TOperation >( currentItem );
+ }
+ //
+ CleanupStack::PopAndDestroy( items );
+ }
+
+
+TInt CMemSpyAppUi::AutoCaptureCallBack( TAny* aSelf )
+ {
+ CMemSpyAppUi* self = reinterpret_cast< CMemSpyAppUi* >( aSelf );
+ TRAPD( err, self->AutoCaptureCallBackL() );
+ //
+ const TBool callMeBackAgain = ( err == KErrNone );
+ return callMeBackAgain;
+ }
+
+
+void CMemSpyAppUi::AutoCaptureCallBackL()
+ {
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::AutoCaptureCallBackL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
+#endif
+
+ OnCmdPhoneInformationOperationL( iAutoCaptureOperationType );
+
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyAppUi::AutoCaptureCallBackL() - END - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
+#endif
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+void CMemSpyAppUi::OnCmdOutputToDebugL()
+ {
+ iEngine.InstallSinkL( ESinkTypeDebug );
+ MemSpyDocument().Settings().StoreSettingsL();
+ }
+
+
+void CMemSpyAppUi::OnCmdOutputToFileL()
+ {
+ iEngine.InstallSinkL( ESinkTypeFile );
+ MemSpyDocument().Settings().StoreSettingsL();
+ }
+
+
+
+
+
+
+
+
+
+
+
+void CMemSpyAppUi::OnCmdAboutL()
+ {
+ CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog;
+ dialog->ExecuteLD( R_MEMSPYUI_ABOUT_DIALOG );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+void CMemSpyAppUi::OnCmdToolsBitmapsSaveToMemoryCardL()
+ {
+ // Get bitmap handles
+ RArray<TInt> handles;
+ CleanupClosePushL( handles );
+ iEngine.HelperFbServ().GetArrayOfBitmapHandlesL( handles );
+
+ // Build bitmap list
+ CMemSpyEngineFbServBitmapArray* array = CMemSpyEngineFbServBitmapArray::NewL( handles );
+ CleanupStack::PopAndDestroy( &handles );
+ CleanupStack::PushL( array );
+
+ // Export...
+ CMemSpyExportBitmapsToMemoryCardDialog* dialog = CMemSpyExportBitmapsToMemoryCardDialog::NewL( iCoeEnv->FsSession(), *array );
+
+ // All done
+ CleanupStack::PopAndDestroy( array );
+ }
+
+
+void CMemSpyAppUi::OnCmdToolsSendToBackgroundL()
+ {
+ TApaTask task( iCoeEnv->WsSession() );
+ task.SendToBackground();
+ }
+
+
+void CMemSpyAppUi::OnCmdToolsBringToForegroundL()
+ {
+ iCoeEnv->BringOwnerToFront();
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,222 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyContainer.h"
+
+// System includes
+#include <eikrted.h> // for example label control
+#include <txtrich.h>
+#include <apgtask.h>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+
+// User includes
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyContainerObserver.h"
+
+
+
+
+CMemSpyContainer::CMemSpyContainer( CMemSpyEngine& aEngine, MMemSpyContainerObserver& aObserver )
+: iEngine( aEngine ), iObserver( aObserver )
+ {
+ }
+
+
+CMemSpyContainer::~CMemSpyContainer()
+ {
+ delete iPreviousView;
+ delete iActiveView;
+ }
+
+
+void CMemSpyContainer::ConstructL(const TRect& aRect)
+ {
+ CreateWindowL();
+ SetRect(aRect);
+ PrepareTopLevelViewL();
+ ActivateL();
+ }
+
+
+void CMemSpyContainer::NavigateToParentViewL()
+ {
+ CMemSpyViewBase* parentView = iActiveView->PrepareParentViewL();
+ //
+ if ( parentView == NULL )
+ {
+ // Parent can be null, in which case, revert to top-level view
+ PrepareTopLevelViewL();
+ }
+ else
+ {
+ SetNewActiveViewL( parentView );
+ }
+ }
+
+
+void CMemSpyContainer::NavigateToChildViewL()
+ {
+ CMemSpyViewBase* childView = iActiveView->PrepareChildViewL();
+ //
+ if ( childView != NULL )
+ {
+ SetNewActiveViewL( childView );
+ }
+ }
+
+
+void CMemSpyContainer::HandleCommandL( TInt aCommand )
+ {
+ switch( aCommand )
+ {
+ case EMemSpyCmdViewRefresh:
+ OnCmdViewRefreshL();
+ break;
+ default:
+ if ( iActiveView )
+ {
+ iActiveView->HandleCommandL( aCommand );
+ }
+ break;
+ }
+ }
+
+
+void CMemSpyContainer::OnCmdViewRefreshL()
+ {
+ if ( iActiveView )
+ {
+ TRAPD(err, iActiveView->RefreshL());
+ if ( err != KErrNone )
+ {
+ // Error during view refreshing (perhaps the thread doesn't exist anymore).
+ // Try to replace the active view with its parent...
+ NavigateToParentViewL();
+ }
+ }
+ }
+
+
+void CMemSpyContainer::SizeChanged()
+ {
+ if ( iActiveView )
+ {
+ iActiveView->SetRect( Rect() );
+ }
+ }
+
+
+TInt CMemSpyContainer::CountComponentControls() const
+ {
+ return 1;
+ }
+
+
+CCoeControl* CMemSpyContainer::ComponentControl(TInt /*aIndex*/) const
+ {
+ return iActiveView;
+ }
+
+
+void CMemSpyContainer::Draw(const TRect& aRect) const
+ {
+ CWindowGc& gc = SystemGc();
+ //
+ gc.SetPenStyle(CGraphicsContext::ENullPen);
+ gc.SetBrushColor(KRgbGray);
+ gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
+ gc.DrawRect(aRect);
+ }
+
+
+TKeyResponse CMemSpyContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
+ {
+ TKeyResponse response = EKeyWasNotConsumed;
+ //
+ if ( iActiveView )
+ {
+ response = iActiveView->OfferKeyEventL( aKeyEvent, aType );
+ }
+ //
+ return response;
+ }
+
+
+void CMemSpyContainer::HandleMemSpyViewEventL( TViewEventType aEvent, TMemSpyViewType /*aViewType*/, CMemSpyViewBase& aReportingView, TAny* /*aContext*/ )
+ {
+ if ( aEvent == EEventItemActioned )
+ {
+ // Get the view to generate a child
+ CMemSpyViewBase* child = aReportingView.PrepareChildViewL();
+ if ( child == NULL )
+ {
+ // View doesn't have a child - treat it as item activation and
+ // report event to observer.
+
+ }
+ else
+ {
+ // Child view becomes the active one
+ SetNewActiveViewL( child );
+ }
+ }
+ }
+
+
+CMemSpyViewBase* CMemSpyContainer::PrepareTopLevelViewL()
+ {
+ CMemSpyViewMainMenu* view = new(ELeave) CMemSpyViewMainMenu( iEngine, *this );
+ CleanupStack::PushL( view );
+ view->ConstructL( Rect(), *this );
+ SetNewActiveViewL( view );
+ CleanupStack::Pop( view );
+ return view;
+ }
+
+
+void CMemSpyContainer::SetNewActiveViewL( CMemSpyViewBase* aNewView )
+ {
+ delete iPreviousView;
+ //
+ iPreviousView = iActiveView;
+ if ( iPreviousView )
+ {
+ iPreviousView->MakeVisible( EFalse );
+ iPreviousView->SetFocus( EFalse );
+ }
+ //
+ iActiveView = aNewView;
+ iActiveView->RefreshL();
+ iActiveView->SetFocus( ETrue );
+ //
+ ReportEventL( MCoeControlObserver::EEventStateChanged );
+ }
+
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyDeviceWideOperationDialog.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyDeviceWideOperationDialog.h"
+
+// System includes
+#include <eikprogi.h>
+#include <AknWaitDialog.h>
+#include <AknQueryDialog.h>
+#include <coemain.h>
+#include <eikenv.h>
+#include <avkon.hrh>
+#include <memspyui.rsg>
+
+
+CMemSpyDeviceWideOperationDialog::CMemSpyDeviceWideOperationDialog( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver )
+: iEngine( aEngine ), iObserver( aObserver )
+ {
+ }
+
+
+CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog()
+ {
+#ifdef _DEBUG
+ RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - START - iForcedCancel: %d", iForcedCancel );
+#endif
+
+#ifdef _DEBUG
+ RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - deleting operation...: 0x%08x", iOperation );
+#endif
+ delete iOperation;
+
+#ifdef _DEBUG
+ RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - deleting dialog...: 0x%08x", iProgressDialog );
+#endif
+ iProgressInfo = NULL;
+ delete iProgressDialog;
+
+#ifdef _DEBUG
+ RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - sending EDialogDismissed to observer..." );
+#endif
+
+ iObserver.DWOperationCompleted();
+
+#ifdef _DEBUG
+ RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - END" );
+#endif
+ }
+
+
+void CMemSpyDeviceWideOperationDialog::ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation )
+ {
+#ifdef _DEBUG
+ RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - START" );
+#endif
+
+ iOperation = CMemSpyDeviceWideOperations::NewL( iEngine, *this, aOperation );
+
+#ifdef _DEBUG
+ RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - constructed operation..." );
+#endif
+
+ ASSERT( iProgressDialog == NULL );
+ iProgressDialog = new( ELeave ) CAknProgressDialog( reinterpret_cast< CEikDialog** >( &iProgressDialog ), ETrue );
+ iProgressDialog->PrepareLC( R_MEMSPY_DEVICE_WIDE_OPERATION_PROGRESS_DIALOG );
+ iProgressDialog->SetCallback( this );
+ iProgressDialog->SetGloballyCapturing( ETrue );
+ //
+ iProgressInfo = iProgressDialog->GetProgressInfoL();
+ iProgressInfo->SetFinalValue( iOperation->TotalOperationSize() );
+ //
+ iProgressDialog->RunLD();
+
+#ifdef _DEBUG
+ RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - END" );
+#endif
+ }
+
+void CMemSpyDeviceWideOperationDialog::ExecuteLD( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver, CMemSpyDeviceWideOperations::TOperation aOperation )
+ {
+ CMemSpyDeviceWideOperationDialog* self = new(ELeave) CMemSpyDeviceWideOperationDialog( aEngine, aObserver );
+ CleanupStack::PushL( self );
+ self->ExecuteL( aOperation );
+ CleanupStack::PopAndDestroy( self );
+ }
+
+
+void CMemSpyDeviceWideOperationDialog::Cancel()
+ {
+#ifdef _DEBUG
+ RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::Cancel() - START - iOperation: 0x%08x, iForcedCancel: %d", iOperation, iForcedCancel );
+#endif
+
+ iForcedCancel = ETrue;
+ //
+ if ( iOperation )
+ {
+ iOperation->Cancel();
+ }
+ //
+ iObserver.DWOperationCancelled();
+
+#ifdef _DEBUG
+ RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::Cancel() - END" );
+#endif
+ }
+
+
+void CMemSpyDeviceWideOperationDialog::DialogDismissedL( TInt aButtonId )
+ {
+#ifdef _DEBUG
+ RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::DialogDismissedL() - START - aButtonId: %d, iForcedCancel: %d", aButtonId, iForcedCancel );
+#else
+ (void) aButtonId;
+#endif
+
+ Cancel();
+
+#ifdef _DEBUG
+ RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::DialogDismissedL() - END - aButtonId: %d, iForcedCancel: %d", aButtonId, iForcedCancel );
+#endif
+ }
+
+
+void CMemSpyDeviceWideOperationDialog::HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 )
+ {
+#ifdef _DEBUG
+ RDebug::Print( _L("[MemSpy] CMemSpyDeviceWideOperationDialog::HandleDeviceWideOperationEvent() - START - aEvent: %d, iProgressDialog: 0x%08x, aParam1: %d, aParam2: %S"), aEvent, iProgressDialog, aParam1, &aParam2 );
+#endif
+
+ switch( aEvent )
+ {
+ case MMemSpyDeviceWideOperationsObserver::EOperationSized:
+ break;
+ case MMemSpyDeviceWideOperationsObserver::EOperationStarting:
+ iObserver.DWOperationStarted();
+ break;
+ case MMemSpyDeviceWideOperationsObserver::EOperationProgressStart:
+ ASSERT( iProgressDialog != NULL );
+ SetDialogCaptionL( aParam2 );
+ break;
+ case MMemSpyDeviceWideOperationsObserver::EOperationProgressEnd:
+ ASSERT( iProgressDialog != NULL );
+ iProgressInfo->IncrementAndDraw( aParam1 );
+ break;
+ case MMemSpyDeviceWideOperationsObserver::EOperationCancelled:
+ break;
+ case MMemSpyDeviceWideOperationsObserver::EOperationCompleting:
+ {
+ ASSERT( iProgressDialog != NULL );
+ const TInt finalValue = iProgressInfo->Info().iFinalValue;
+ iProgressInfo->SetAndDraw( finalValue );
+ break;
+ }
+ case MMemSpyDeviceWideOperationsObserver::EOperationCompleted:
+ if ( iProgressDialog )
+ {
+ iProgressDialog->ProcessFinishedL();
+ }
+ break;
+ default:
+ break;
+ }
+
+#ifdef _DEBUG
+ RDebug::Print( _L("[MemSpy] CMemSpyDeviceWideOperationDialog::HandleDeviceWideOperationEvent() - END - aEvent: %d, aParam1: %d, aParam2: %S"), aEvent, aParam1, &aParam2 );
+#endif
+ }
+
+
+void CMemSpyDeviceWideOperationDialog::SetDialogCaptionL( const TDesC& aText )
+ {
+ if ( aText.Length() )
+ {
+ iProgressDialog->SetTextL( aText );
+ iProgressDialog->DrawNow();
+ }
+ }
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyDocument.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyDocument.h"
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+
+// User includes
+#include "MemSpyAppUi.h"
+#include "MemSpySettings.h"
+
+
+CMemSpyDocument::CMemSpyDocument(CEikApplication& aApp)
+: CAknDocument(aApp)
+ {
+ }
+
+
+CMemSpyDocument::~CMemSpyDocument()
+ {
+ delete iSettings;
+ delete iEngine;
+ }
+
+
+void CMemSpyDocument::ConstructL()
+ {
+ RFs& fsSession = CCoeEnv::Static()->FsSession();
+ //
+ iEngine = CMemSpyEngine::NewL( fsSession );
+ iSettings = CMemSpySettings::NewL( fsSession, *iEngine );
+ }
+
+
+CMemSpyDocument* CMemSpyDocument::NewL(CEikApplication& aApp)
+ {
+ CMemSpyDocument* self = new (ELeave) CMemSpyDocument( aApp );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+
+CMemSpyEngine& CMemSpyDocument::Engine()
+ {
+ return *iEngine;
+ }
+
+
+const CMemSpyEngine& CMemSpyDocument::Engine() const
+ {
+ return *iEngine;
+ }
+
+
+CMemSpySettings& CMemSpyDocument::Settings()
+ {
+ return *iSettings;
+ }
+
+
+const CMemSpySettings& CMemSpyDocument::Settings() const
+ {
+ return *iSettings;
+ }
+
+
+CEikAppUi* CMemSpyDocument::CreateAppUiL()
+ {
+ return new (ELeave) CMemSpyAppUi( *iEngine );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyExportBitmapsToMemoryCardDialog.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,328 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyExportBitmapsToMemoryCardDialog.h"
+
+// System includes
+#include <eikprogi.h>
+#include <AknWaitDialog.h>
+#include <AknQueryDialog.h>
+#include <coemain.h>
+#include <eikenv.h>
+#include <avkon.hrh>
+#include <memspyui.rsg>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperstack.h>
+#include <memspy/engine/memspyenginehelperthread.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperfbserv.h>
+
+// Driver includes
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// Literal constants
+_LIT( KMemSpyBitmapExportFolderAndFileName, "e:\\MemSpy\\Images\\%04d%02d%02d_%02d.%02d.%02d\\");
+
+
+CMemSpyExportBitmapsToMemoryCardDialog::CMemSpyExportBitmapsToMemoryCardDialog( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps )
+: CActive(EPriorityIdle), iFsSession(aFsSession), iBitmaps(aBitmaps)
+ {
+ CActiveScheduler::Add(this);
+ }
+
+
+CMemSpyExportBitmapsToMemoryCardDialog::~CMemSpyExportBitmapsToMemoryCardDialog()
+ {
+ Cancel();
+ //
+ delete iProgressDialog;
+ //
+ iMimeTypeArray.ResetAndDestroy();
+ iMimeTypeArray.Close();
+ //
+ if ( iEncoder )
+ {
+ iEncoder->Cancel();
+ }
+ delete iEncoder;
+ delete iFolderName;
+ delete iBmpMimeType;
+ }
+
+
+void CMemSpyExportBitmapsToMemoryCardDialog::ConstructL()
+ {
+ // Check card is ready
+ if ( CheckMemoryCardAvailableL( iFsSession ) == EFalse )
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ // Get mime type for BMP file
+ IdentifyBmpMimeTypeL();
+
+ // Prepare unique empty folder
+ PrepareFolderNameSpecL();
+
+ // Prepare UI stuff
+ iProgressDialog = new( ELeave ) CAknProgressDialog( reinterpret_cast< CEikDialog** >( &iProgressDialog ) );
+ iProgressDialog->SetCallback( this );
+ iProgressDialog->SetGloballyCapturing( ETrue );
+ iProgressDialog->PrepareLC( R_MEMSPY_EXPORT_TO_MEMORYCARD_DIALOG );
+ //
+ iProgressInfo = iProgressDialog->GetProgressInfoL( );
+ iProgressInfo->SetFinalValue( iBitmaps.Count() );
+ //
+ iProgressDialog->MakeVisible( ETrue ); // Visible right away
+ //
+ iDialogDismissed = EFalse;
+ iProgressInfo->SetAndDraw( 0 );
+
+ // Start the process rolling...
+ CompleteSelf(KErrNone);
+
+ //
+ iProgressDialog->RunLD( );
+ }
+
+
+CMemSpyExportBitmapsToMemoryCardDialog* CMemSpyExportBitmapsToMemoryCardDialog::NewL( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps )
+ {
+ CMemSpyExportBitmapsToMemoryCardDialog* self = new(ELeave) CMemSpyExportBitmapsToMemoryCardDialog( aFsSession, aBitmaps );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+void CMemSpyExportBitmapsToMemoryCardDialog::Cancel()
+ {
+ CActive::Cancel();
+ }
+
+
+TBool CMemSpyExportBitmapsToMemoryCardDialog::CheckMemoryCardAvailableL( RFs& aFsSession )
+ {
+ TBool available = EFalse;
+ //
+ TDriveInfo driveInfo;
+ if ( aFsSession.Drive( driveInfo, EDriveE ) == KErrNone )
+ {
+ // Other checks needed?
+ available = ETrue;
+ }
+ //
+ return available;
+ }
+
+
+void CMemSpyExportBitmapsToMemoryCardDialog::RunL()
+ {
+ const TInt error = iStatus.Int();
+ User::LeaveIfError( error );
+
+ if ( !iDialogDismissed )
+ {
+ // Do we have more items to process?
+ if ( TryToExportSingleBitmapL() )
+ {
+ _LIT(KTextFormat, "Saving image\n%d/%d");
+ TBuf<128> buf;
+ buf.Format( KTextFormat, iBitmapIndex, iBitmaps.Count() );
+ //
+ iProgressDialog->SetTextL( buf );
+ iProgressInfo->SetAndDraw( iBitmapIndex );
+ iProgressDialog->DrawDeferred();
+ }
+ else
+ {
+ // We're done - RunL will not be called again
+ if (iProgressInfo)
+ {
+ const TInt finalValue = iProgressInfo->Info().iFinalValue;
+ iProgressInfo->SetAndDraw( finalValue );
+ //
+ delete iProgressDialog;
+ iProgressDialog = NULL;
+ //
+ delete this;
+ }
+ }
+
+ User::ResetInactivityTime();
+ }
+ else
+ {
+ delete iProgressDialog;
+ iProgressDialog = NULL;
+ //
+ delete this;
+ }
+ }
+
+
+void CMemSpyExportBitmapsToMemoryCardDialog::DoCancel()
+ {
+ if ( iEncoder )
+ {
+ iEncoder->Cancel();
+ }
+
+ iDialogDismissed = ETrue;
+ }
+
+
+TInt CMemSpyExportBitmapsToMemoryCardDialog::RunError( TInt /*aError*/ )
+ {
+ TRAP_IGNORE(
+
+ // Try the next image
+ if ( TryToExportSingleBitmapL() == EFalse )
+ {
+ iDialogDismissed = ETrue;
+ delete this;
+ }
+ );
+ //
+ return KErrNone;
+ }
+
+
+void CMemSpyExportBitmapsToMemoryCardDialog::DialogDismissedL( TInt /*aButtonId*/ )
+ {
+ iDialogDismissed = ETrue;
+ iProgressDialog = NULL;
+ }
+
+
+void CMemSpyExportBitmapsToMemoryCardDialog::CompleteSelf( TInt aError )
+ {
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, aError );
+ SetActive();
+ }
+
+
+void CMemSpyExportBitmapsToMemoryCardDialog::ExportBitmapL( const CMemSpyEngineFbServBitmap& aBitmap )
+ {
+ // Create a filename
+ TFileName fileName( *iFolderName );
+ aBitmap.GetExportableFileNameL( fileName );
+
+ // Create encoder object...
+ CImageEncoder* encoder = CImageEncoder::FileNewL( iFsSession, fileName, *iBmpMimeType );
+ delete iEncoder;
+ iEncoder = encoder;
+
+ // Start operation
+ iEncoder->Convert( &iStatus, aBitmap.Bitmap() );
+ SetActive();
+ }
+
+
+void CMemSpyExportBitmapsToMemoryCardDialog::IdentifyBmpMimeTypeL()
+ {
+ _LIT(KBmpExtension, ".bmp");
+ CImageEncoder::GetFileTypesL( iMimeTypeArray );
+ //
+ const TInt count = iMimeTypeArray.Count();
+ //
+ for( TInt i=0; i<count; i++ )
+ {
+ CFileExtensionMIMEType* extension = iMimeTypeArray[ i ];
+ if ( extension->FileExtension().FindF( KBmpExtension ) >= 0 )
+ {
+ // Found it - save mime type info
+ iBmpMimeType = extension->MIMEType().AllocL();
+ iMimeTypeArray.ResetAndDestroy();
+ iMimeTypeArray.Close();
+ return;
+ }
+ }
+ //
+ User::Leave( KErrNotFound );
+ }
+
+
+void CMemSpyExportBitmapsToMemoryCardDialog::PrepareFolderNameSpecL()
+ {
+ delete iFolderName;
+ iFolderName = NULL;
+
+ // Make a unique filename format specifier.
+ TTime now;
+ now.HomeTime();
+ const TDateTime dt( now.DateTime() );
+
+ // Build it up...
+ iFolderName = HBufC::NewL( KMaxFileName );
+ TPtr pName( iFolderName->Des() );
+ pName.Format( KMemSpyBitmapExportFolderAndFileName, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second());
+
+ // Create directory
+ const TInt error = iFsSession.MkDirAll( pName );
+ User::LeaveIfError( error );
+ }
+
+
+TBool CMemSpyExportBitmapsToMemoryCardDialog::TryToExportSingleBitmapL()
+ {
+ TBool startedExport = EFalse;
+
+ const TInt count = iBitmaps.Count();
+ for( ; ( iBitmapIndex < count ) && ( startedExport == EFalse ); iBitmapIndex++ )
+ {
+ const CMemSpyEngineFbServBitmap& memSpyBitmap = iBitmaps.At( iBitmapIndex );
+ const CFbsBitmap& fbsBitmap = memSpyBitmap.Bitmap();
+ const TSize size( fbsBitmap.SizeInPixels() );
+
+ // We don't want to export bitmaps which have a zero-pixel dimension.
+ if ( size.iHeight > 0 && size.iWidth > 0 )
+ {
+ // This completes the object's request status and will therefore
+ // result in a further call to RunL() when the export to BMP
+ // is completed.
+ ExportBitmapL( memSpyBitmap );
+
+ // And indicate we managed to start an operation...
+ startedExport = ETrue;
+ }
+ }
+ //
+ return startedExport;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpySettings.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,273 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpySettings.h"
+
+// System includes
+#include <e32svr.h>
+#include <s32file.h>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyenginelogger.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelpersysmemtracker.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
+// Constants
+_LIT( KMemSpySettingsFileName, "settings.dat" );
+
+// Version 03 dumped some of the system wide memory tracker settings
+const TInt KMemSpySettingsFileFormatVersion = 6;
+
+
+CMemSpySettings::CMemSpySettings( RFs& aFsSession, CMemSpyEngine& aEngine )
+: iFsSession( aFsSession ), iEngine( aEngine )
+ {
+ }
+
+
+CMemSpySettings::~CMemSpySettings()
+ {
+ TRACE( RDebug::Printf( "CMemSpySettings::~CMemSpySettings() - START" ) );
+ TRAP_IGNORE( StoreSettingsL() );
+ TRACE( RDebug::Printf( "CMemSpySettings::~CMemSpySettings() - END" ) );
+ }
+
+
+void CMemSpySettings::ConstructL()
+ {
+ TRACE( RDebug::Print( _L("CMemSpySettings::ConstructL() - START") ) );
+
+ TRAP_IGNORE( RestoreSettingsL() );
+
+ TRACE( RDebug::Print( _L("CMemSpySettings::ConstructL() - END") ) );
+ }
+
+
+CMemSpySettings* CMemSpySettings::NewL( RFs& aFsSession, CMemSpyEngine& aEngine )
+ {
+ CMemSpySettings* self = new(ELeave) CMemSpySettings( aFsSession, aEngine );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+void CMemSpySettings::GetSettingsFileNameL( TDes& aFileName )
+ {
+ GetSettingsPathL( aFileName );
+ aFileName.Append( KMemSpySettingsFileName );
+ TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsFileNameL() - aFileName: %S"), &aFileName ) );
+ }
+
+
+void CMemSpySettings::GetSettingsPathL( TDes& aPath )
+ {
+ TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsPathL() - START") ) );
+ aPath.Zero();
+
+ // Get private data cage path
+ TInt err = iFsSession.PrivatePath( aPath );
+ TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsPathL() - priv path err: %d"), err ) );
+ User::LeaveIfError( err );
+
+ // Combine with C: drive
+ const TDriveUnit cDrive( EDriveC );
+ const TDriveName cDriveName( cDrive.Name() );
+ aPath.Insert( 0, cDriveName );
+
+ iFsSession.MkDirAll( aPath );
+ TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsPathL() - END - %S"), &aPath ) );
+ }
+
+
+RFile CMemSpySettings::SettingsFileLC( TBool aReplace )
+ {
+ TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - START - aReplace: %d"), aReplace ) );
+
+ TFileName* fileName = new(ELeave) TFileName();
+ CleanupStack::PushL( fileName );
+ GetSettingsFileNameL( *fileName );
+ TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - fileName: %S"), fileName ) );
+
+ RFile file;
+ TInt error = KErrNone;
+ //
+ if ( aReplace )
+ {
+ error = file.Replace( iFsSession, *fileName, EFileWrite );
+ TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - replace err: %d"), error ) );
+ }
+ else
+ {
+ error = file.Open( iFsSession, *fileName, EFileWrite );
+ TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - open err: %d"), error ) );
+ //
+ if ( error == KErrNotFound )
+ {
+ error = file.Create( iFsSession, *fileName, EFileWrite );
+ }
+ }
+ //
+ User::LeaveIfError( error );
+ CleanupStack::PopAndDestroy( fileName );
+ CleanupClosePushL( file );
+ //
+ TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - END") ) );
+ return file;
+ }
+
+
+void CMemSpySettings::StoreSettingsL()
+ {
+ TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - START" ) );
+
+ RFile file = SettingsFileLC( ETrue );
+ RFileWriteStream stream( file );
+ CleanupStack::Pop(); // file
+ CleanupClosePushL( stream );
+
+ // Verion info
+ stream.WriteInt32L( KMemSpySettingsFileFormatVersion );
+
+ // Engine settings
+ TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - sinkType: %d", iEngine.SinkType() ) );
+ stream.WriteUint8L( iEngine.SinkType() );
+
+ // Get SWMT config
+ CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
+ TMemSpyEngineHelperSysMemTrackerConfig swmtConfig;
+ swmt.GetConfig( swmtConfig );
+
+ // Write SWMT settings
+ stream.WriteInt32L( swmtConfig.TimerPeriod().Int() );
+ stream.WriteUint8L( swmtConfig.DumpData() );
+
+ // Write memory tracking auto-start process list
+ const RArray<TUid>& processUidList = iEngine.HelperProcess().MemoryTrackingAutoStartProcessList();
+ stream.WriteInt32L( processUidList.Count() );
+ for( TInt i=0; i<processUidList.Count(); i++ )
+ {
+ const TUid uid = processUidList[ i ];
+ TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - process tracker uid[%02d]: 0x%08x", i, uid.iUid ) );
+ stream << uid;
+ }
+
+ // Write memory tracking categories
+ stream.WriteInt32L( swmtConfig.iEnabledCategories );
+
+ // Write heap tracking thread name filter
+ stream.WriteInt32L( swmtConfig.iThreadNameFilter.Length() );
+ if ( swmtConfig.iThreadNameFilter.Length() > 0 )
+ {
+ stream.WriteL( swmtConfig.iThreadNameFilter, swmtConfig.iThreadNameFilter.Length() );
+ }
+
+ // Write mode
+ stream.WriteInt32L( swmtConfig.iMode );
+
+ stream.CommitL();
+ CleanupStack::PopAndDestroy( &stream ); // Closes file
+ TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - END - sinkType: %d", iEngine.SinkType() ) );
+ }
+
+
+void CMemSpySettings::RestoreSettingsL()
+ {
+ TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - START - current engine sinkType: %d", iEngine.SinkType() ) );
+
+ RFile file = SettingsFileLC();
+ RFileReadStream stream( file );
+ CleanupStack::Pop(); // file
+ CleanupClosePushL( stream );
+
+ // Version info
+ const TInt version = stream.ReadInt32L(); // discarded for now
+ TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - version: %d", version ) );
+
+ // Engine settings
+ TMemSpySinkType type = static_cast< TMemSpySinkType >( stream.ReadUint8L() );
+ TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - read sinkType: %d", type ) );
+ iEngine.InstallSinkL( type );
+
+ // Set SWMT config
+ TMemSpyEngineHelperSysMemTrackerConfig swmtConfig;
+ swmtConfig.iTimerPeriod = TTimeIntervalMicroSeconds32( stream.ReadInt32L() );
+ swmtConfig.iDumpData = static_cast< TBool >( stream.ReadUint8L() );
+
+ if ( version < 3 )
+ {
+ // Restore but ignore old delta tracker settings which aren't used anymore
+ //
+ /* iHeapDeltaTrackerIncludeKernel =*/ static_cast< TBool >( stream.ReadUint8L() );
+ /* iHeapDeltaTrackerCheckAllocCellCounts =*/ static_cast< TBool >( stream.ReadUint8L() );
+ /* iHeapDeltaTrackerCheckFreeCellCounts =*/ static_cast< TBool >( stream.ReadUint8L() );
+ }
+
+ // Restore memory tracking auto-start process uids if file format supports it...
+ if ( version >= 2 )
+ {
+ RArray<TUid> list;
+ CleanupClosePushL( list );
+ //
+ const TInt count = stream.ReadInt32L();
+ for( TInt i=0; i<count; i++ )
+ {
+ TUid processUid;
+ stream >> processUid;
+ //
+ TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - process tracker uid[%02d]: 0x%08x", i, processUid.iUid ) );
+ User::LeaveIfError( list.Append( processUid ) );
+ }
+ //
+ CMemSpyEngineHelperProcess& processHelper = iEngine.HelperProcess();
+ processHelper.SetMemoryTrackingAutoStartProcessListL( list );
+ CleanupStack::PopAndDestroy( &list );
+ }
+
+ // Restore memory tracking categories
+ if ( version > 3 )
+ {
+ swmtConfig.iEnabledCategories = stream.ReadInt32L();
+ }
+
+ // Write heap tracking thread name filter
+ if ( version > 4 )
+ {
+ TInt len = stream.ReadInt32L();
+ if ( len > 0 )
+ {
+ stream.ReadL( swmtConfig.iThreadNameFilter, len );
+ }
+ }
+
+ // Write mode
+ if ( version > 5 )
+ {
+ swmtConfig.iMode = (TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode)stream.ReadInt32L();
+ }
+
+ CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
+ swmt.SetConfigL( swmtConfig );
+
+ CleanupStack::PopAndDestroy( &stream ); // Closes file
+ TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - END - engine sink type: %d", iEngine.SinkType() ) );
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyUiUtils.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyUiUtils.h"
+
+// System includes
+#include <coemain.h>
+#include <memspyui.rsg>
+
+
+
+
+void MemSpyUiUtils::Format( TDes& aBuf, TInt aResourceId, ...)
+ {
+ VA_LIST list;
+ VA_START(list,aResourceId);
+ TBuf<128> format;
+ CCoeEnv::Static()->ReadResource( format, aResourceId );
+ aBuf.FormatList( format, list );
+ }
+
+
+void MemSpyUiUtils::GetErrorText( TDes& aBuf, TInt aError )
+ {
+ if ( aError == KErrNotSupported )
+ {
+ _LIT( KMemSpyErrorText, "Not Supported" );
+ aBuf = KMemSpyErrorText;
+ }
+ else if ( aError == KErrNotReady )
+ {
+ _LIT( KMemSpyErrorText, "Not Ready" );
+ aBuf = KMemSpyErrorText;
+ }
+ else if ( aError == KErrNotFound )
+ {
+ _LIT( KMemSpyErrorText, "Missing" );
+ aBuf = KMemSpyErrorText;
+ }
+ else if ( aError == KErrGeneral )
+ {
+ _LIT( KMemSpyErrorText, "General Error" );
+ aBuf = KMemSpyErrorText;
+ }
+ else
+ {
+ _LIT( KMemSpyItemValueError, "Error: %d" );
+ aBuf.Format( KMemSpyItemValueError, aError );
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewBase.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,413 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewBase.h"
+
+// System includes
+#include <eikrted.h> // for example label control
+#include <txtrich.h>
+#include <apgtask.h>
+#include <akntitle.h>
+#include <akncontext.h>
+#include <aknnavi.h>
+#include <eiklbx.h>
+#include <eiklbm.h>
+#include <avkon.hrh>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineoutputsink.h>
+
+// User includes
+#include "MemSpyAppUi.h"
+#include "MemSpyDocument.h"
+#include "MemSpyContainer.h"
+#include "MemSpyContainerObserver.h"
+
+
+
+
+CMemSpyViewBase::CMemSpyViewBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: iEngine( aEngine ), iObserver( aObserver )
+ {
+ }
+
+
+CMemSpyViewBase::~CMemSpyViewBase()
+ {
+ delete iListBox;
+ }
+
+
+void CMemSpyViewBase::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* /*aSelectionRune*/ )
+ {
+ iSettings = &static_cast< CMemSpyAppUi* >( iEikonEnv->EikAppUi() )->MemSpyDocument().Settings();
+ //
+ User::LeaveIfError( SetParent( &aContainer ) );
+ SetContainerWindowL( aContainer );
+
+ SetComponentsToInheritVisibility( ETrue );
+
+ iListBox = ConstructListBoxL();
+ if ( iListBox )
+ {
+ iListBox->SetFocus( ETrue );
+ }
+
+ SetRect( aRect );
+ ActivateL();
+ }
+
+
+void CMemSpyViewBase::SetTitleL( const TDesC& aText )
+ {
+ CEikStatusPane* statusPane = static_cast<CAknAppUi*> ( iEikonEnv->EikAppUi() )->StatusPane();
+ CAknTitlePane* title = static_cast<CAknTitlePane*> ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+ title->SetTextL( aText );
+ }
+
+
+TPtrC CMemSpyViewBase::TitleL() const
+ {
+ TPtrC ret( KNullDesC );
+ //
+ CEikStatusPane* statusPane = static_cast<CAknAppUi*> ( iEikonEnv->EikAppUi() )->StatusPane();
+ CAknTitlePane* title = static_cast<CAknTitlePane*> ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+ if ( title->Text() )
+ {
+ ret.Set( *title->Text() );
+ }
+ //
+ return ret;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewBase::PrepareParentViewL()
+ {
+ return NULL;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewBase::PrepareChildViewL()
+ {
+ return NULL;
+ }
+
+
+void CMemSpyViewBase::RefreshL()
+ {
+ if ( iListBox )
+ {
+ iListBox->UpdateScrollBarsL();
+ }
+
+ DrawDeferred();
+ }
+
+
+TBool CMemSpyViewBase::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch( aCommand )
+ {
+ case EMemSpyCmdViewOutputToSink:
+ OnCmdViewOutputToSinkL();
+ break;
+ default:
+ handled = EFalse;
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewBase::DynInitMenuPaneL( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ )
+ {
+ }
+
+
+TUint CMemSpyViewBase::MenuCascadeResourceId() const
+ {
+ return 0;
+ }
+
+
+TInt CMemSpyViewBase::MenuCascadeCommandId() const
+ {
+ return 0;
+ }
+
+
+void CMemSpyViewBase::OnCmdViewOutputToSinkL()
+ {
+ if ( iListBox )
+ {
+ // Prepare sink
+ CMemSpyEngineOutputSink& sink = iEngine.Sink();
+ HBufC* name = MemSpyEngineUtils::CleanupTextLC( TitleL() );
+ sink.OutputSectionHeadingL( *name, TChar('-') );
+ CleanupStack::PopAndDestroy( name );
+ sink.OutputPrefixSetLC( _L(" ") ); // Slight insertion
+
+ // Get text from underlying listbox model...
+ MTextListBoxModel* model = static_cast< MTextListBoxModel* >( iListBox->Model() );
+ const TInt count = model->NumberOfItems();
+
+ // First pass to get max lengths
+ TInt maxLengthCaption = 0;
+ TInt maxLengthValue = 0;
+
+ for( TInt j=0; j<count; j++ )
+ {
+ const TPtrC pItem( model->ItemText( j ) );
+ const TInt length = pItem.Length();
+
+ // Check if its split or not?
+ const TInt splitPos = pItem.FindF( _L("\t\t") );
+ if ( splitPos > 0 )
+ {
+ maxLengthCaption = Max( maxLengthCaption, splitPos );
+ maxLengthValue = Max( maxLengthValue, length - splitPos + 1 );
+ }
+ else
+ {
+ maxLengthCaption = Max( maxLengthCaption, length );
+ }
+ }
+
+ // Second pass - real this time - to print the values
+ HBufC* line = HBufC::NewLC( ( maxLengthCaption + maxLengthValue ) + 20 );
+ TPtr pLine( line->Des() );
+ //
+ for( TInt i=0; i<count; i++ )
+ {
+ const TPtrC pItem( model->ItemText( i ) );
+ const TInt length = pItem.Length();
+ //
+ TPtrC pCaption( KNullDesC );
+ TPtrC pValue( KNullDesC );
+ //
+ const TInt splitPos = pItem.FindF( _L("\t\t") );
+ if ( splitPos > 0 )
+ {
+ pCaption.Set( pItem.Left( splitPos ) );
+ pValue.Set( pItem.Mid( splitPos + 1 ) );
+ }
+ else
+ {
+ pCaption.Set( pItem );
+ }
+
+ // Remove initial tabs in caption
+ HBufC* caption = MemSpyEngineUtils::CleanupTextLC( pCaption );
+
+ // Create value item & replace any further tabs
+ HBufC* value = MemSpyEngineUtils::CleanupTextLC( pValue );
+
+ // Now format the final line, with padding.
+ pLine.Justify( *caption, maxLengthCaption + 3, ELeft, TChar(' ') );
+ pLine.Append( *value );
+ CleanupStack::PopAndDestroy( 2, caption );
+
+ // Sink output
+ sink.OutputLineL( pLine );
+ }
+
+ // Remove prefix & tidy up
+ CleanupStack::PopAndDestroy( line );
+ sink.OutputBlankLineL();
+ CleanupStack::PopAndDestroy(); // clear prefix
+ }
+ }
+
+
+CEikListBox* CMemSpyViewBase::ConstructListBoxL()
+ {
+ delete iListBox;
+ iListBox = NULL;
+ CAknSettingStyleListBox* listbox = new(ELeave) CAknSettingStyleListBox();
+ iListBox = listbox;
+ //
+ listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling );
+ listbox->SetContainerWindowL( *this );
+ listbox->CreateScrollBarFrameL( ETrue );
+ SetListBoxModelL();
+ listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+ listbox->SetListBoxObserver( this );
+ listbox->SetObserver( this );
+ listbox->SetComponentsToInheritVisibility( ETrue );
+ //
+ return listbox;
+ }
+
+
+void CMemSpyViewBase::HandleListBoxItemActionedL( TInt /*aIndex*/ )
+ {
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewBase::HandleListBoxItemSelectedL( TInt /*aIndex*/ )
+ {
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+void CMemSpyViewBase::ReportEventL( MMemSpyViewObserver::TViewEventType aEvent, TAny* aContext )
+ {
+ iObserver.HandleMemSpyViewEventL( aEvent, ViewType(), *this, aContext );
+ }
+
+
+void CMemSpyViewBase::SetListBoxCurrentItemIndexL( TInt aIndex )
+ {
+ if ( iListBox )
+ {
+ iListBox->SetCurrentItemIndex( aIndex );
+ HandleListBoxItemSelectedL( aIndex );
+ }
+ }
+
+
+CMemSpyContainer& CMemSpyViewBase::Container()
+ {
+ CMemSpyAppUi* appUi = static_cast< CMemSpyAppUi* >( iEikonEnv->EikAppUi() );
+ return appUi->Container();
+ }
+
+
+CMemSpySettings& CMemSpyViewBase::Settings()
+ {
+ return *iSettings;
+ }
+
+
+const CMemSpySettings& CMemSpyViewBase::Settings() const
+ {
+ return *iSettings;
+ }
+
+
+void CMemSpyViewBase::Draw( const TRect& aRect ) const
+ {
+ CWindowGc& gc = SystemGc();
+ //
+ gc.SetPenStyle( CGraphicsContext::ENullPen );
+ gc.SetBrushColor( KRgbWhite );
+ gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+ gc.DrawRect( aRect );
+ }
+
+
+void CMemSpyViewBase::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() );
+ }
+ }
+
+
+void CMemSpyViewBase::FocusChanged(TDrawNow /*aDrawNow*/)
+ {
+ if ( iListBox )
+ {
+ iListBox->SetFocus( IsFocused() );
+ }
+ }
+
+
+TInt CMemSpyViewBase::CountComponentControls() const
+ {
+ TInt count = 0;
+ if ( iListBox )
+ {
+ ++count;
+ }
+ //
+ return count;
+ }
+
+
+CCoeControl* CMemSpyViewBase::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+
+TKeyResponse CMemSpyViewBase::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
+ {
+ TKeyResponse resp = EKeyWasNotConsumed;
+ if ( iListBox )
+ {
+ resp = iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ //
+ if ( resp == EKeyWasNotConsumed && aType == EEventKeyDown && aKeyEvent.iCode == EKeyBackspace )
+ {
+ // When backspace is pushed, go to the parent view
+ CMemSpyAppUi* appUi = static_cast< CMemSpyAppUi* >( iEikonEnv->EikAppUi() );
+ appUi->Container().NavigateToParentViewL();
+ resp = EKeyWasConsumed;
+ }
+ //
+ return resp;
+ }
+
+
+void CMemSpyViewBase::HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType )
+ {
+ if ( aControl == iListBox )
+ {
+ if ( aEventType == MCoeControlObserver::EEventStateChanged )
+ {
+ const TInt index = iListBox->CurrentItemIndex();
+ HandleListBoxItemSelectedL( index );
+ }
+ }
+ }
+
+
+void CMemSpyViewBase::HandleListBoxEventL( CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
+ {
+ const TInt index = iListBox->CurrentItemIndex();
+ //
+ switch (aEventType)
+ {
+ case EEventItemActioned:
+ case EEventEnterKeyPressed:
+ case EEventItemDoubleClicked:
+ HandleListBoxItemActionedL( index );
+ break;
+
+ default:
+ break;
+ }
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewChunkList.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,346 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewChunkList.h"
+
+// System includes
+#include <memspyui.rsg>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewMainMenu.h"
+
+
+
+CMemSpyViewChunkBase::CMemSpyViewChunkBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList* aList )
+: CMemSpyViewBase( aEngine, aObserver ), iList( aList )
+ {
+ }
+
+
+CMemSpyViewChunkBase::~CMemSpyViewChunkBase()
+ {
+ delete iList;
+ }
+
+
+TBool CMemSpyViewChunkBase::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdChunkSortByName:
+ iList->SortByNameL();
+ CMemSpyViewBase::RefreshL();
+ break;
+ case EMemSpyCmdChunkSortBySize:
+ iList->SortBySizeL();
+ CMemSpyViewBase::RefreshL();
+ break;
+ case EMemSpyCmdChunkListing:
+ OnCmdListingL();
+ break;
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewChunkBase::OnCmdListingL()
+ {
+ // Begin a new data stream
+ _LIT( KMemSpyContext, "Chunk List" );
+ _LIT( KMemSpyFolder, "Chunks" );
+ iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
+
+ // Set prefix for overall listing
+ _LIT( KOverallPrefix, "Chunk List - " );
+ iEngine.Sink().OutputPrefixSetLC( KOverallPrefix );
+
+ // Create header
+ CMemSpyEngineChunkList::OutputDataColumnsL( iEngine );
+
+ // List items
+ const TInt count = iList->Count();
+ for(TInt i=0; i<count; i++)
+ {
+ const CMemSpyEngineChunkEntry& entry = iList->At( i );
+ //
+ entry.OutputDataL( iEngine.HelperChunk() );
+ }
+
+ // Tidy up
+ CleanupStack::PopAndDestroy(); // prefix
+
+ // End data stream
+ iEngine.Sink().DataStreamEndL();
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewChunkList::CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewChunkBase( aEngine, aObserver, NULL )
+ {
+ }
+
+
+CMemSpyViewChunkList::CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList )
+: CMemSpyViewChunkBase( aEngine, aObserver, &aList )
+ {
+ }
+
+
+void CMemSpyViewChunkList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Chunks" );
+ SetTitleL( KTitle );
+
+ if ( iList == NULL )
+ {
+ // Prepare code segment list
+ iList = iEngine.HelperChunk().ListL();
+ }
+
+ // Finish construction
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ if ( aSelectionRune != NULL )
+ {
+ iCurrentChunk = reinterpret_cast< CMemSpyEngineChunkEntry* >( aSelectionRune );
+ const TInt index = iList->ItemIndex( *iCurrentChunk );
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+
+ iListBox->DrawDeferred();
+ }
+
+
+TMemSpyViewType CMemSpyViewChunkList::ViewType() const
+ {
+ return EMemSpyViewTypeChunkList;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewChunkList::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewChunkList::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = new(ELeave) CMemSpyViewChunkDetails( iEngine, iObserver, *iList, *iCurrentChunk );
+
+ // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
+ // This object is about to die in any case.
+ iList = NULL;
+
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+void CMemSpyViewChunkList::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( iList );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewChunkList::HandleListBoxItemActionedL( TInt aIndex )
+ {
+ const TInt count = iList->Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineChunkEntry& chunk = iList->At( aIndex );
+ iCurrentChunk = &chunk;
+ }
+ else
+ {
+ iCurrentChunk = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewChunkList::HandleListBoxItemSelectedL( TInt aIndex )
+ {
+ const TInt count = iList->Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineChunkEntry& chunk = iList->At( aIndex );
+ iCurrentChunk = &chunk;
+ }
+ else
+ {
+ iCurrentChunk = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewChunkDetails::CMemSpyViewChunkDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList, CMemSpyEngineChunkEntry& aSelectedChunk )
+: CMemSpyViewChunkBase( aEngine, aObserver, &aList ), iChunk( aSelectedChunk )
+ {
+ }
+
+
+void CMemSpyViewChunkDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Chunk Details" );
+ SetTitleL( KTitle );
+
+ // Finish construction
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+void CMemSpyViewChunkDetails::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewChunkDetails::ViewType() const
+ {
+ return EMemSpyViewTypeChunkDetails;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewChunkDetails::PrepareParentViewL()
+ {
+ CMemSpyViewChunkList* parent = new(ELeave) CMemSpyViewChunkList( iEngine, iObserver, *iList );
+
+ // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
+ // This object is about to die in any case.
+ iList = NULL;
+
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), &iChunk );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+void CMemSpyViewChunkDetails::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( &iChunk );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewCodeSegList.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,500 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewCodeSegList.h"
+
+// System includes
+#include <memspyui.rsg>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyViewThreads.h"
+#include "MemSpyContainerObserver.h"
+#include "MemSpyExportBitmapsToMemoryCardDialog.h"
+
+
+
+CMemSpyViewCodeSegBase::CMemSpyViewCodeSegBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList* aList )
+: CMemSpyViewBase( aEngine, aObserver ), iList( aList )
+ {
+ }
+
+
+CMemSpyViewCodeSegBase::~CMemSpyViewCodeSegBase()
+ {
+ delete iList;
+ }
+
+
+TBool CMemSpyViewCodeSegBase::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdCodeSegSortByName:
+ iList->SortByFileNameL();
+ CMemSpyViewBase::RefreshL();
+ break;
+ case EMemSpyCmdCodeSegSortByCodeSize:
+ iList->SortByCodeSizeL();
+ CMemSpyViewBase::RefreshL();
+ break;
+ case EMemSpyCmdCodeSegSortByDataSize:
+ iList->SortByDataSizeL();
+ CMemSpyViewBase::RefreshL();
+ break;
+ case EMemSpyCmdCodeSegSortByUid:
+ iList->SortByUidsL();
+ CMemSpyViewBase::RefreshL();
+ break;
+ case EMemSpyCmdCodeSegListing:
+ OnCmdCodeSegmentListingL();
+ break;
+ case EMemSpyCmdCodeSegShowItemsAll:
+ OnCmdShowItemsAllL();
+ break;
+ case EMemSpyCmdCodeSegShowItemsGlobalData:
+ OnCmdShowItemsGlobalDataL();
+ break;
+
+ case EMemSpyCmdCodeSegShowCapsWithTCBProcess:
+ case EMemSpyCmdCodeSegShowCapsWithTCBAll:
+ OnCmdFilterByCapabilityL( ECapabilityTCB, aCommand == EMemSpyCmdCodeSegShowCapsWithTCBAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithCommDDProcess:
+ case EMemSpyCmdCodeSegShowCapsWithCommDDAll:
+ OnCmdFilterByCapabilityL( ECapabilityCommDD, aCommand == EMemSpyCmdCodeSegShowCapsWithCommDDAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithPowerMgmtProcess:
+ case EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll:
+ OnCmdFilterByCapabilityL( ECapabilityPowerMgmt, aCommand == EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithMultimediaDDProcess:
+ case EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll:
+ OnCmdFilterByCapabilityL( ECapabilityMultimediaDD, aCommand == EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithReadDeviceDataProcess:
+ case EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll:
+ OnCmdFilterByCapabilityL( ECapabilityReadDeviceData, aCommand == EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataProcess:
+ case EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll:
+ OnCmdFilterByCapabilityL( ECapabilityWriteDeviceData, aCommand == EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithDRMProcess:
+ case EMemSpyCmdCodeSegShowCapsWithDRMAll:
+ OnCmdFilterByCapabilityL( ECapabilityDRM, aCommand == EMemSpyCmdCodeSegShowCapsWithDRMAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithTrustedUIProcess:
+ case EMemSpyCmdCodeSegShowCapsWithTrustedUIAll:
+ OnCmdFilterByCapabilityL( ECapabilityTrustedUI, aCommand == EMemSpyCmdCodeSegShowCapsWithTrustedUIAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithProtServProcess:
+ case EMemSpyCmdCodeSegShowCapsWithProtServAll:
+ OnCmdFilterByCapabilityL( ECapabilityProtServ, aCommand == EMemSpyCmdCodeSegShowCapsWithProtServAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithDiskAdminProcess:
+ case EMemSpyCmdCodeSegShowCapsWithDiskAdminAll:
+ OnCmdFilterByCapabilityL( ECapabilityDiskAdmin, aCommand == EMemSpyCmdCodeSegShowCapsWithDiskAdminAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithNetworkControlProcess:
+ case EMemSpyCmdCodeSegShowCapsWithNetworkControlAll:
+ OnCmdFilterByCapabilityL( ECapabilityNetworkControl, aCommand == EMemSpyCmdCodeSegShowCapsWithNetworkControlAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithAllFilesProcess:
+ case EMemSpyCmdCodeSegShowCapsWithAllFilesAll:
+ OnCmdFilterByCapabilityL( ECapabilityAllFiles, aCommand == EMemSpyCmdCodeSegShowCapsWithAllFilesAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithSwEventProcess:
+ case EMemSpyCmdCodeSegShowCapsWithSwEventAll:
+ OnCmdFilterByCapabilityL( ECapabilitySwEvent, aCommand == EMemSpyCmdCodeSegShowCapsWithSwEventAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithNetworkServicesProcess:
+ case EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll:
+ OnCmdFilterByCapabilityL( ECapabilityNetworkServices, aCommand == EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithLocalServicesProcess:
+ case EMemSpyCmdCodeSegShowCapsWithLocalServicesAll:
+ OnCmdFilterByCapabilityL( ECapabilityLocalServices, aCommand == EMemSpyCmdCodeSegShowCapsWithLocalServicesAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithReadUserDataProcess:
+ case EMemSpyCmdCodeSegShowCapsWithReadUserDataAll:
+ OnCmdFilterByCapabilityL( ECapabilityReadUserData, aCommand == EMemSpyCmdCodeSegShowCapsWithReadUserDataAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithWriteUserDataProcess:
+ case EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll:
+ OnCmdFilterByCapabilityL( ECapabilityWriteUserData, aCommand == EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithLocationProcess:
+ case EMemSpyCmdCodeSegShowCapsWithLocationAll:
+ OnCmdFilterByCapabilityL( ECapabilityLocation, aCommand == EMemSpyCmdCodeSegShowCapsWithLocationAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithSurroundingsDDProcess:
+ case EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll:
+ OnCmdFilterByCapabilityL( ECapabilitySurroundingsDD, aCommand == EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll );
+ break;
+ case EMemSpyCmdCodeSegShowCapsWithUserEnvProcess:
+ case EMemSpyCmdCodeSegShowCapsWithUserEnvAll:
+ OnCmdFilterByCapabilityL( ECapabilityUserEnvironment, aCommand == EMemSpyCmdCodeSegShowCapsWithUserEnvAll );
+ break;
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewCodeSegBase::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+void CMemSpyViewCodeSegBase::OnCmdCodeSegmentListingL()
+ {
+ // Begin a new data stream
+ _LIT( KMemSpyContext, "CodeSeg List - " );
+ _LIT( KMemSpyFolder, "CodeSegs" );
+ iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
+
+ // Set prefix for overall listing
+ _LIT(KOverallPrefix, "CodeSeg List - ");
+ iEngine.Sink().OutputPrefixSetLC( KOverallPrefix );
+
+ // Create header
+ CMemSpyEngineCodeSegList::OutputDataColumnsL( iEngine );
+
+ // List items
+ const TInt count = iList->Count();
+ for(TInt i=0; i<count; i++)
+ {
+ const CMemSpyEngineCodeSegEntry& entry = iList->At( i );
+ //
+ entry.OutputDataL( iEngine.HelperCodeSegment() );
+ }
+
+ // Tidy up
+ CleanupStack::PopAndDestroy(); // prefix
+
+ // End data stream
+ iEngine.Sink().DataStreamEndL();
+ }
+
+
+void CMemSpyViewCodeSegBase::OnCmdShowItemsAllL()
+ {
+ iList->ShowAllL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+void CMemSpyViewCodeSegBase::OnCmdShowItemsGlobalDataL()
+ {
+ iList->ShowOnlyEntriesWithGlobalDataL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+void CMemSpyViewCodeSegBase::OnCmdFilterByCapabilityL( TCapability aCapability, TBool aAllBinaries )
+ {
+ TMemSpyViewCodeSegFilter filterLogic( aCapability, aAllBinaries );
+ TMemSpyEngineVisibiltyFunction<CMemSpyEngineCodeSegEntry> filterFunction( TMemSpyViewCodeSegFilter::FilterItem, &filterLogic );
+ iList->ShowL( filterFunction );
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewCodeSegList::CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewCodeSegBase( aEngine, aObserver, NULL )
+ {
+ }
+
+
+CMemSpyViewCodeSegList::CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList )
+: CMemSpyViewCodeSegBase( aEngine, aObserver, &aList )
+ {
+ }
+
+
+void CMemSpyViewCodeSegList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Code Segments" );
+ SetTitleL( KTitle );
+
+ if ( iList == NULL )
+ {
+ // Prepare code segment list
+ iList = iEngine.HelperCodeSegment().CodeSegmentListL();
+ iList->SortByCodeSizeL();
+ }
+
+ // Finish construction
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ if ( aSelectionRune != NULL )
+ {
+ iCurrentCodeSegment = reinterpret_cast< CMemSpyEngineCodeSegEntry* >( aSelectionRune );
+ const TInt index = iList->ItemIndex( *iCurrentCodeSegment );
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+
+ iListBox->DrawDeferred();
+ }
+
+
+TMemSpyViewType CMemSpyViewCodeSegList::ViewType() const
+ {
+ return EMemSpyViewTypeCodeSegmentList;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewCodeSegList::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewCodeSegList::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = new(ELeave) CMemSpyViewCodeSegDetails( iEngine, iObserver, *iList, *iCurrentCodeSegment );
+
+ // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
+ // This object is about to die in any case.
+ iList = NULL;
+
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+void CMemSpyViewCodeSegList::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( iList );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewCodeSegList::HandleListBoxItemActionedL( TInt aIndex )
+ {
+ const TInt count = iList->Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineCodeSegEntry& codeSeg = iList->At( aIndex );
+ iCurrentCodeSegment = &codeSeg;
+ }
+ else
+ {
+ iCurrentCodeSegment = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewCodeSegList::HandleListBoxItemSelectedL( TInt aIndex )
+ {
+ const TInt count = iList->Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineCodeSegEntry& codeSeg = iList->At( aIndex );
+ iCurrentCodeSegment = &codeSeg;
+ }
+ else
+ {
+ iCurrentCodeSegment = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewCodeSegDetails::CMemSpyViewCodeSegDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList, CMemSpyEngineCodeSegEntry& aSelectedCodeSegment )
+: CMemSpyViewCodeSegBase( aEngine, aObserver, &aList ), iCodeSegment( aSelectedCodeSegment )
+ {
+ }
+
+
+void CMemSpyViewCodeSegDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Code Segment Details" );
+ SetTitleL( KTitle );
+
+ // Finish construction
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+void CMemSpyViewCodeSegDetails::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewCodeSegDetails::ViewType() const
+ {
+ return EMemSpyViewTypeCodeSegmentDetails;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewCodeSegDetails::PrepareParentViewL()
+ {
+ CMemSpyViewCodeSegList* parent = new(ELeave) CMemSpyViewCodeSegList( iEngine, iObserver, *iList );
+
+ // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
+ // This object is about to die in any case.
+ iList = NULL;
+
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), &iCodeSegment );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+void CMemSpyViewCodeSegDetails::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( &iCodeSegment );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TBool TMemSpyViewCodeSegFilter::FilterItem( const CMemSpyEngineCodeSegEntry*& aItem, TAny* aRune )
+ {
+ TMemSpyViewCodeSegFilter* self = reinterpret_cast< TMemSpyViewCodeSegFilter* >( aRune );
+
+ TBool match = aItem->HasCapability( self->iCapability );
+ if ( match && self->iAllBinaries == EFalse )
+ {
+ // We're only looking for EXE's...
+ TParsePtrC parser( aItem->FileName() );
+ const TPtrC pExtension( parser.Ext() );
+ _LIT(KProcessExtension, ".exe");
+ //
+ match = ( pExtension.CompareF( KProcessExtension ) == 0 );
+ }
+ //
+ return match;
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewDriveInfo.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,381 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewDriveInfo.h"
+
+// System includes
+#include <memspyui.rsg>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperfilesystem.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewMainMenu.h"
+
+
+
+CMemSpyViewDriveInfoBase::CMemSpyViewDriveInfoBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+CMemSpyViewDriveInfoBase::~CMemSpyViewDriveInfoBase()
+ {
+ if ( iList )
+ {
+ iList->SetObserver( NULL );
+ }
+ //
+ delete iList;
+ }
+
+
+void CMemSpyViewDriveInfoBase::BaseConstructL()
+ {
+ iList = iEngine.HelperFileSystem().DriveListL();
+ }
+
+
+TBool CMemSpyViewDriveInfoBase::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewDriveList::CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewDriveInfoBase( aEngine, aObserver ), iUseDriveNumber( EFalse ), iDriveNumber( EDriveA )
+ {
+ }
+
+
+CMemSpyViewDriveList::CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber )
+: CMemSpyViewDriveInfoBase( aEngine, aObserver ), iUseDriveNumber( ETrue ), iDriveNumber( aDriveNumber )
+ {
+ }
+
+
+void CMemSpyViewDriveList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ BaseConstructL();
+
+ _LIT( KTitle, "Drive Summary" );
+ SetTitleL( KTitle );
+
+ // Start watching list
+ iList->SetObserver( this );
+
+ // Finish construction
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ if ( iUseDriveNumber )
+ {
+#ifdef _DEBUG
+ RDebug::Printf( "CMemSpyViewDriveList::ConstructL() - iDriveNumber: %c:", iDriveNumber + 'A' );
+#endif
+ iCurrentDrive = iList->EntryByDriveNumber( iDriveNumber );
+
+#ifdef _DEBUG
+ RDebug::Printf( "CMemSpyViewDriveList::ConstructL() - iCurrentDrive: 0x%08x", iCurrentDrive );
+#endif
+ if ( iCurrentDrive )
+ {
+ const TInt index = iList->ItemIndex( *iCurrentDrive );
+#ifdef _DEBUG
+ RDebug::Printf( "CMemSpyViewDriveList::ConstructL() - index: %d", index );
+#endif
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+ }
+
+ iListBox->DrawDeferred();
+ }
+
+
+TMemSpyViewType CMemSpyViewDriveList::ViewType() const
+ {
+ return EMemSpyViewTypeDriveSummary;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewDriveList::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ //
+ if ( parent )
+ {
+ iList->SetObserver( NULL );
+ }
+ //
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewDriveList::PrepareChildViewL()
+ {
+ ASSERT( iCurrentDrive );
+ CMemSpyViewBase* child = new(ELeave) CMemSpyViewDriveInfo( iEngine, iObserver, iCurrentDrive->DriveNumber() );
+
+ // Stop watching list
+ if ( child )
+ {
+ iList->SetObserver( NULL );
+ }
+
+ // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
+ // This object is about to die in any case.
+ iList = NULL;
+
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+void CMemSpyViewDriveList::RefreshL()
+ {
+ if ( iList )
+ {
+ iList->SetObserver( NULL );
+ }
+ //
+ CMemSpyEngineDriveList* list = iEngine.HelperFileSystem().DriveListL();
+ delete iList;
+ iList = list;
+ iList->SetObserver( this );
+ //
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+void CMemSpyViewDriveList::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( iList );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewDriveList::HandleListBoxItemActionedL( TInt aIndex )
+ {
+ const TInt count = iList->Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineDriveEntry& entry = iList->At( aIndex );
+ iCurrentDrive = &entry;
+ }
+ else
+ {
+ iCurrentDrive = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewDriveList::HandleListBoxItemSelectedL( TInt aIndex )
+ {
+ const TInt count = iList->Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineDriveEntry& entry = iList->At( aIndex );
+ iCurrentDrive = &entry;
+ }
+ else
+ {
+ iCurrentDrive = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+void CMemSpyViewDriveList::HandleDriveListChangedL( const CMemSpyEngineDriveList& /*aList*/ )
+ {
+ RefreshL();
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewDriveInfo::CMemSpyViewDriveInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber )
+: CMemSpyViewDriveInfoBase( aEngine, aObserver ), iDriveNumber( aDriveNumber )
+ {
+ }
+
+
+void CMemSpyViewDriveInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ BaseConstructL();
+ //
+ iDriveInfo = iList->EntryByDriveNumber( iDriveNumber );
+ if ( !iDriveInfo )
+ {
+ User::Leave( KErrNotFound );
+ }
+ iDriveInfo->SetObserver( this );
+
+ _LIT( KTitleFormat, "Drive %S Info" );
+ const TDriveName name( iDriveInfo->DriveUnit().Name() );
+ TName title;
+ title.Format( KTitleFormat, &name );
+ SetTitleL( title );
+
+ // Finish construction
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+void CMemSpyViewDriveInfo::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewDriveInfo::ViewType() const
+ {
+ return EMemSpyViewTypeDriveInfo;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewDriveInfo::PrepareParentViewL()
+ {
+ ASSERT( iDriveInfo );
+ CMemSpyViewDriveList* parent = new(ELeave) CMemSpyViewDriveList( iEngine, iObserver, iDriveInfo->DriveNumber() );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( parent );
+ //
+ if ( parent )
+ {
+ iDriveInfo->SetObserver( NULL );
+ }
+ //
+ return parent;
+ }
+
+
+void CMemSpyViewDriveInfo::SetListBoxModelL()
+ {
+ if ( iDriveInfo )
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( iDriveInfo );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+ }
+
+
+void CMemSpyViewDriveInfo::HandleDriveEntryChangedL( const CMemSpyEngineDriveEntry& /*aEntry*/ )
+ {
+ RefreshL();
+ }
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewECom.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,475 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewECom.h"
+
+// System includes
+#include <memspyui.rsg>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyenginehelperecom.h>
+
+// User includes
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyContainerObserver.h"
+
+
+
+CMemSpyViewECom::CMemSpyViewECom( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+void CMemSpyViewECom::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "ECom" );
+ SetTitleL( KTitle );
+
+ // Finish construction
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ // Select first item
+ TInt index = KErrNotFound;
+ if ( aSelectionRune != NULL )
+ {
+ iCurrent = reinterpret_cast< CMemSpyEngineEComCategory* >( aSelectionRune );
+ index = iEngine.HelperECom().IndexOf( *iCurrent );
+ }
+
+ if ( index >= 0 && index < iEngine.HelperECom().Count() )
+ {
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ iListBox->DrawDeferred();
+ }
+ }
+
+
+void CMemSpyViewECom::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewECom::ViewType() const
+ {
+ return EMemSpyViewTypeECom;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewECom::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewECom::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComCategory( iEngine, iObserver, *iCurrent );
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+void CMemSpyViewECom::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( &iEngine.HelperECom() );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewECom::HandleListBoxItemActionedL( TInt aIndex )
+ {
+ const TInt count = iEngine.HelperECom().Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineEComCategory& category = iEngine.HelperECom().At( aIndex );
+ iCurrent = &category;
+ }
+ else
+ {
+ iCurrent = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewECom::HandleListBoxItemSelectedL( TInt aIndex )
+ {
+ const TInt count = iEngine.HelperECom().Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineEComCategory& category = iEngine.HelperECom().At( aIndex );
+ iCurrent = &category;
+ }
+ else
+ {
+ iCurrent = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewEComCategory::CMemSpyViewEComCategory( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComCategory& aCategory )
+: CMemSpyViewBase( aEngine, aObserver ), iCategory( aCategory )
+ {
+ }
+
+
+void CMemSpyViewEComCategory::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ SetTitleL( iCategory.Name() );
+
+ // Finish construction
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ // Select first item
+ TInt index = KErrNotFound;
+ if ( aSelectionRune != NULL )
+ {
+ iCurrent = reinterpret_cast< CMemSpyEngineEComInterface* >( aSelectionRune );
+ index = iCategory.IndexOf( *iCurrent );
+ }
+
+ if ( index >= 0 && index < iCategory.Count() )
+ {
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ iListBox->DrawDeferred();
+ }
+ }
+
+
+void CMemSpyViewEComCategory::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewEComCategory::ViewType() const
+ {
+ return EMemSpyViewTypeEComCategory;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewEComCategory::PrepareParentViewL()
+ {
+ CMemSpyViewECom* parent = new(ELeave) CMemSpyViewECom( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), &iCategory );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewEComCategory::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComInterface( iEngine, iObserver, *iCurrent );
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+void CMemSpyViewEComCategory::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( &iCategory );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewEComCategory::HandleListBoxItemActionedL( TInt aIndex )
+ {
+ const TInt count = iCategory.Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineEComInterface& entry = iCategory.At( aIndex );
+ iCurrent = &entry;
+ }
+ else
+ {
+ iCurrent = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewEComCategory::HandleListBoxItemSelectedL( TInt aIndex )
+ {
+ const TInt count = iCategory.Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineEComInterface& entry = iCategory.At( aIndex );
+ iCurrent = &entry;
+ }
+ else
+ {
+ iCurrent = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewEComInterface::CMemSpyViewEComInterface( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComInterface& aInterface )
+: CMemSpyViewBase( aEngine, aObserver ), iInterface( aInterface )
+ {
+ }
+
+
+void CMemSpyViewEComInterface::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ SetTitleL( iInterface.Name() );
+
+ // Finish construction
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ // Select first item
+ TInt index = KErrNotFound;
+ if ( aSelectionRune != NULL )
+ {
+ iCurrent = reinterpret_cast< CMemSpyEngineEComImplementation* >( aSelectionRune );
+ index = iInterface.IndexOf( *iCurrent );
+ }
+
+ if ( index >= 0 && index < iInterface.Count() )
+ {
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ iListBox->DrawDeferred();
+ }
+ }
+
+
+void CMemSpyViewEComInterface::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewEComInterface::ViewType() const
+ {
+ return EMemSpyViewTypeEComInterface;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewEComInterface::PrepareParentViewL()
+ {
+ CMemSpyViewEComCategory* parent = new(ELeave) CMemSpyViewEComCategory( iEngine, iObserver, iInterface.Category() );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), &iInterface );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewEComInterface::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComImplementation( iEngine, iObserver, *iCurrent );
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+void CMemSpyViewEComInterface::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( &iInterface );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewEComInterface::HandleListBoxItemActionedL( TInt aIndex )
+ {
+ const TInt count = iInterface.Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineEComImplementation& entry = iInterface.At( aIndex );
+ iCurrent = &entry;
+ }
+ else
+ {
+ iCurrent = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewEComInterface::HandleListBoxItemSelectedL( TInt aIndex )
+ {
+ const TInt count = iInterface.Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineEComImplementation& entry = iInterface.At( aIndex );
+ iCurrent = &entry;
+ }
+ else
+ {
+ iCurrent = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewEComImplementation::CMemSpyViewEComImplementation( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComImplementation& aImplementation )
+: CMemSpyViewBase( aEngine, aObserver ), iImplementation( aImplementation )
+ {
+ }
+
+
+void CMemSpyViewEComImplementation::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ SetTitleL( iImplementation.Name() );
+
+ // Finish construction
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ // Select first item
+ if ( iImplementation.MdcaCount() )
+ {
+ iListBox->SetCurrentItemIndex( 0 );
+ HandleListBoxItemSelectedL( 0 );
+ iListBox->DrawDeferred();
+ }
+ }
+
+
+void CMemSpyViewEComImplementation::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewEComImplementation::ViewType() const
+ {
+ return EMemSpyViewTypeEComImplementation;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewEComImplementation::PrepareParentViewL()
+ {
+ CMemSpyViewEComInterface* parent = new(ELeave) CMemSpyViewEComInterface( iEngine, iObserver, iImplementation.Interface() );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), &iImplementation );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+void CMemSpyViewEComImplementation::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( &iImplementation );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewFBServBitmaps.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,746 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewFBServBitmaps.h"
+
+// System includes
+#include <memspyui.rsg>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyViewThreads.h"
+#include "MemSpyContainerObserver.h"
+#include "MemSpyExportBitmapsToMemoryCardDialog.h"
+
+// Constants
+const TInt KMemSpyIdleResetListboxTimerPeriod = 500000;
+const TInt KMemSpyImageSlideshowPeriod = 1000000;
+
+
+
+CMemSpyViewFBServBase::CMemSpyViewFBServBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps )
+: CMemSpyViewBase( aEngine, aObserver ), iBitmaps( aBitmaps )
+ {
+ }
+
+
+CMemSpyViewFBServBase::~CMemSpyViewFBServBase()
+ {
+#ifdef _DEBUG
+ RDebug::Printf("CMemSpyViewFBServBase::~CMemSpyViewFBServBase() - deleting bitmaps: 0x%08x", iBitmaps );
+#endif
+ delete iBitmaps;
+ }
+
+
+TBool CMemSpyViewFBServBase::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdImagesSlideshow:
+ OnCmdSlideShowL();
+ break;
+#ifndef __WINS__
+ case EMemSpyCmdImagesSaveAllToMemoryCard:
+ OnCmdExportToMemoryCardL();
+ break;
+#endif
+ case EMemSpyCmdImagesListing:
+ OnCmdImageListingL();
+ break;
+
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewFBServBase::OnCmdSlideShowL()
+ {
+ TInt index = 0;
+ CMemSpyViewFBServSlideshow::NewLD( *iBitmaps, index );
+
+ // Select the item that was last displayed
+ const TInt count = iBitmaps->Count();
+ if ( iListBox && index >= 0 && index < count )
+ {
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ DrawDeferred();
+ }
+ }
+
+
+void CMemSpyViewFBServBase::OnCmdExportToMemoryCardL()
+ {
+ // Deletes itself
+ CMemSpyExportBitmapsToMemoryCardDialog::NewL( iCoeEnv->FsSession(), *iBitmaps );
+ }
+
+
+void CMemSpyViewFBServBase::OnCmdImageListingL()
+ {
+ // Begin a new data stream
+ _LIT( KMemSpyContext, "Bitmap List - " );
+ _LIT( KMemSpyFolder, "Bitmaps" );
+ iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
+
+ // Set prefix for overall listing
+ _LIT(KOverallPrefix, "Bitmap List - ");
+ iEngine.Sink().OutputPrefixSetLC( KOverallPrefix );
+
+ // Create header
+ CMemSpyEngineFbServBitmap::OutputDataColumnsL( iEngine );
+
+ // List items
+ const TInt count = iBitmaps->Count();
+ for(TInt i=0; i<count; i++)
+ {
+ const CMemSpyEngineFbServBitmap& bitmap = iBitmaps->At( i );
+ //
+ bitmap.OutputDataL( iEngine );
+ }
+
+ // Tidy up
+ CleanupStack::PopAndDestroy(); // prefix
+
+ // End data stream
+ iEngine.Sink().DataStreamEndL();
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewFBServBase( aEngine, aObserver, NULL )
+ {
+#ifdef _DEBUG
+ RDebug::Printf("CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps(1) - iBitmaps is: 0x%08x", iBitmaps );
+#endif
+ }
+
+
+CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps )
+: CMemSpyViewFBServBase( aEngine, aObserver, aBitmaps )
+ {
+#ifdef _DEBUG
+ RDebug::Printf("CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps(2) - iBitmaps is: 0x%08x", iBitmaps );
+#endif
+ }
+
+
+CMemSpyViewFBServBitmaps::~CMemSpyViewFBServBitmaps()
+ {
+ delete iIdleResetListboxTimer;
+ iBitmapHandles.Close();
+ }
+
+
+void CMemSpyViewFBServBitmaps::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Font & Bitmap Server" );
+ SetTitleL( KTitle );
+
+ if ( iBitmaps == NULL )
+ {
+ // Prepare bitmap handles
+ iEngine.HelperFbServ().GetArrayOfBitmapHandlesL( iBitmapHandles );
+
+ // Create bitmap array - construction occurs asynchronously
+ iBitmaps = CMemSpyEngineFbServBitmapArray::NewL( CActive::EPriorityIdle, iBitmapHandles, *this );
+ }
+
+ // Finish construction
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ // Create idle listbox refresh timer
+ if ( iBitmaps->Count() == 0 )
+ {
+ iIdleResetListboxTimer = CPeriodic::NewL( CActive::EPriorityLow );
+ }
+ else
+ {
+ if ( aSelectionRune != NULL )
+ {
+ iCurrentBitmap = reinterpret_cast< CMemSpyEngineFbServBitmap* >( aSelectionRune );
+ const TInt index = iBitmaps->BitmapIndexByHandle( iCurrentBitmap->Handle() );
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+
+ iListBox->DrawDeferred();
+ }
+ }
+
+
+void CMemSpyViewFBServBitmaps::RefreshL()
+ {
+#ifdef _DEBUG
+ RDebug::Printf("CMemSpyViewFBServBitmaps::RefreshL() - iBitmaps->Count(): %d", iBitmaps->Count());
+#endif
+
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewFBServBitmaps::ViewType() const
+ {
+ return EMemSpyViewTypeFBServBitmaps;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewFBServBitmaps::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewFBServBitmaps::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = new(ELeave) CMemSpyViewFBServBitmapInfo( iEngine, iObserver, iBitmaps, *iCurrentBitmap );
+
+ // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
+ // This object is about to die in any case.
+ iBitmaps = NULL;
+
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+void CMemSpyViewFBServBitmaps::HandleFbServBitmapArrayEventL( TEvent aEvent )
+ {
+ if ( aEvent == EBitmapItemsCreated )
+ {
+ }
+ else if ( aEvent == EBitmapArrayConstructionComplete )
+ {
+ }
+ //
+ iIdleResetListboxTimer->Cancel();
+ iIdleResetListboxTimer->Start( KMemSpyIdleResetListboxTimerPeriod/2, KMemSpyIdleResetListboxTimerPeriod, TCallBack( IdleUpdateListBoxModel, this ) );
+ }
+
+
+void CMemSpyViewFBServBitmaps::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( iBitmaps );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewFBServBitmaps::HandleListBoxItemActionedL( TInt aIndex )
+ {
+ const TInt count = iBitmaps->Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineFbServBitmap& bitmap = iBitmaps->At( aIndex );
+ iCurrentBitmap = &bitmap;
+ }
+ else
+ {
+ iCurrentBitmap = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewFBServBitmaps::HandleListBoxItemSelectedL( TInt aIndex )
+ {
+ const TInt count = iBitmaps->Count();
+ if ( aIndex >= 0 && aIndex < count )
+ {
+ CMemSpyEngineFbServBitmap& bitmap = iBitmaps->At( aIndex );
+ iCurrentBitmap = &bitmap;
+ }
+ else
+ {
+ iCurrentBitmap = NULL;
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+TInt CMemSpyViewFBServBitmaps::IdleUpdateListBoxModel( TAny* aSelf )
+ {
+ CMemSpyViewFBServBitmaps* self = reinterpret_cast< CMemSpyViewFBServBitmaps* >( aSelf );
+ TRAP_IGNORE( self->DoIdleUpdateListBoxModelL() );
+ return EFalse;
+ }
+
+
+void CMemSpyViewFBServBitmaps::DoIdleUpdateListBoxModelL()
+ {
+ // Try to maintain current item selection if at all possible.
+ TInt handle = 0;
+ if ( iCurrentBitmap )
+ {
+ handle = iCurrentBitmap->Handle();
+ iCurrentBitmap = NULL;
+ }
+
+ // Update list box & model
+ iListBox->HandleItemAdditionL();
+ iListBox->DrawDeferred();
+
+ // Try to select previous item if it is still available
+ const TInt index = iBitmaps->BitmapIndexByHandle( handle );
+ if ( index >= 0 && index < iBitmaps->Count() )
+ {
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+
+ iIdleResetListboxTimer->Cancel();
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewFBServBitmapInfo::CMemSpyViewFBServBitmapInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap )
+: CMemSpyViewFBServBase( aEngine, aObserver, aBitmaps ), iBitmapObject( aSelectedBitmap )
+ {
+#ifdef _DEBUG
+ RDebug::Printf("CMemSpyViewFBServBitmapInfo::CMemSpyViewFBServBitmapInfo() - iBitmaps is: 0x%08x", iBitmaps );
+#endif
+ }
+
+
+void CMemSpyViewFBServBitmapInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Bitmap Details" );
+ SetTitleL( KTitle );
+
+ // Finish construction
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ if ( iBitmaps->Count() )
+ {
+ iListBox->SetCurrentItemIndex( 0 );
+ HandleListBoxItemSelectedL( 0 );
+ }
+ }
+
+
+void CMemSpyViewFBServBitmapInfo::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewFBServBitmapInfo::ViewType() const
+ {
+ return EMemSpyViewTypeFBServBitmapInfo;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewFBServBitmapInfo::PrepareParentViewL()
+ {
+ CMemSpyViewFBServBitmaps* parent = new(ELeave) CMemSpyViewFBServBitmaps( iEngine, iObserver, iBitmaps );
+
+ // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
+ // This object is about to die in any case.
+ iBitmaps = NULL;
+
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), &iBitmapObject );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewFBServBitmapInfo::PrepareChildViewL()
+ {
+ CMemSpyViewFBServBitmapViewer* child = new(ELeave) CMemSpyViewFBServBitmapViewer( iEngine, iObserver, iBitmaps, iBitmapObject );
+
+ // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
+ // This object is about to die in any case.
+ iBitmaps = NULL;
+
+ CleanupStack::PushL( child );
+ CEikAppUi* appUi = static_cast< CEikAppUi* >( iEikonEnv->AppUi() );
+ const TRect rect( TPoint( 0, 0 ), appUi->ClientRect().Size() );
+ child->ConstructL( rect, *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+void CMemSpyViewFBServBitmapInfo::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( &iBitmapObject );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewFBServBitmapInfo::HandleListBoxItemActionedL( TInt aIndex )
+ {
+ // Only report the event if its the first item that was actioned
+ if ( aIndex == 0 )
+ {
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewFBServBitmapViewer::CMemSpyViewFBServBitmapViewer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap )
+: CMemSpyViewFBServBase( aEngine, aObserver, aBitmaps ), iBitmapObject( aSelectedBitmap )
+ {
+#ifdef _DEBUG
+ RDebug::Printf("CMemSpyViewFBServBitmapViewer::CMemSpyViewFBServBitmapViewer() - iBitmaps is: 0x%08x", iBitmaps );
+#endif
+ }
+
+
+CMemSpyViewFBServBitmapViewer::~CMemSpyViewFBServBitmapViewer()
+ {
+ delete iImage;
+ }
+
+
+void CMemSpyViewFBServBitmapViewer::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Bitmap Preview" );
+ SetTitleL( KTitle );
+
+ // Finish construction
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ // Prepare image
+ iImage = new(ELeave) CEikImage();
+ iImage->SetContainerWindowL( *this );
+ iImage->SetPicture( &iBitmapObject.Bitmap(), NULL );
+ iImage->SetPictureOwnedExternally( ETrue );
+ SizeChanged();
+ }
+
+
+void CMemSpyViewFBServBitmapViewer::RefreshL()
+ {
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewFBServBitmapViewer::ViewType() const
+ {
+ return EMemSpyViewTypeFBServBitmapViewer;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewFBServBitmapViewer::PrepareParentViewL()
+ {
+ CMemSpyViewFBServBitmapInfo* parent = new(ELeave) CMemSpyViewFBServBitmapInfo( iEngine, iObserver, iBitmaps, iBitmapObject );
+
+ // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
+ // This object is about to die in any case.
+ iBitmaps = NULL;
+
+ CleanupStack::PushL( parent );
+ CEikAppUi* appUi = static_cast< CEikAppUi* >( iEikonEnv->AppUi() );
+ const TRect rect( TPoint( 0, 0 ), appUi->ClientRect().Size() );
+ parent->ConstructL( rect, *Parent() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+void CMemSpyViewFBServBitmapViewer::SetListBoxModelL()
+ {
+ }
+
+
+CEikListBox* CMemSpyViewFBServBitmapViewer::ConstructListBoxL()
+ {
+ return NULL;
+ }
+
+
+void CMemSpyViewFBServBitmapViewer::Draw( const TRect& /*aRect*/ ) const
+ {
+ CWindowGc& gc = SystemGc();
+ //
+ gc.SetPenStyle( CGraphicsContext::ENullPen );
+ gc.SetBrushColor( KRgbWhite );
+ gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+ gc.DrawRect( Rect() );
+ //
+ gc.SetBrushColor( KRgbBlack );
+ gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+ gc.DrawRect( iBorderRect );
+ }
+
+
+void CMemSpyViewFBServBitmapViewer::SizeChanged()
+ {
+ TRect rect( Rect() );
+ TSize size( rect.Size() );
+ //
+ TSize bitmapSize( iBitmapObject.Bitmap().SizeInPixels() );
+
+ // Try to center image, if possible.
+ if ( bitmapSize.iWidth < size.iWidth )
+ {
+ const TInt offset = ( size.iWidth - bitmapSize.iWidth) / 2;
+ rect.Move( offset, 0 );
+ size.iWidth = bitmapSize.iWidth;
+ }
+ if ( bitmapSize.iHeight < size.iHeight )
+ {
+ const TInt offset = ( size.iHeight - bitmapSize.iHeight) / 2;
+ rect.Move( 0, offset );
+ size.iHeight = bitmapSize.iHeight;
+ }
+ //
+ rect.SetSize( size );
+ if ( iImage )
+ {
+ iImage->SetRect( rect );
+ }
+ iBorderRect = rect;
+ iBorderRect.Grow( 2, 2 );
+ }
+
+
+TInt CMemSpyViewFBServBitmapViewer::CountComponentControls() const
+ {
+ TInt count = 0;
+ //
+ if ( iImage )
+ {
+ ++count;
+ }
+ //
+ return count;
+ }
+
+
+CCoeControl* CMemSpyViewFBServBitmapViewer::ComponentControl( TInt /*aIndex*/ ) const
+ {
+ return iImage;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewFBServSlideshow::CMemSpyViewFBServSlideshow( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex )
+: iBitmaps( aBitmaps ), iIndex( aIndex )
+ {
+ }
+
+
+CMemSpyViewFBServSlideshow::~CMemSpyViewFBServSlideshow()
+ {
+ delete iTimer;
+ }
+
+
+void CMemSpyViewFBServSlideshow::ConstructL()
+ {
+ iTimer = CPeriodic::NewL( CActive::EPriorityLow );
+ iTimer->Start( KMemSpyImageSlideshowPeriod, KMemSpyImageSlideshowPeriod, TCallBack( IdleUpdate, this ) );
+ }
+
+
+void CMemSpyViewFBServSlideshow::NewLD( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex )
+ {
+ CMemSpyViewFBServSlideshow* self = new(ELeave) CMemSpyViewFBServSlideshow( aBitmaps, aIndex );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ //
+ self->ExecuteLD( R_MEMSPY_IMAGE_SLIDESHOW );
+ }
+
+
+void CMemSpyViewFBServSlideshow::PreLayoutDynInitL()
+ {
+ ShowNextImageL();
+ }
+
+
+TBool CMemSpyViewFBServSlideshow::OkToExitL( TInt /*aButtonId*/ )
+ {
+ return ETrue;
+ }
+
+
+TInt CMemSpyViewFBServSlideshow::IdleUpdate( TAny* aSelf )
+ {
+ CMemSpyViewFBServSlideshow* self = reinterpret_cast< CMemSpyViewFBServSlideshow* >( aSelf );
+ TRAP_IGNORE( self->ShowNextImageL() );
+ return EFalse;
+ }
+
+
+void CMemSpyViewFBServSlideshow::ShowNextImageL()
+ {
+ CEikImage* imageControl = static_cast< CEikImage* >( Control(EMemSpyCtrlIdSlideShowImage) );
+
+ // Get the right image
+ const TInt imageCount = iBitmaps.Count();
+ if ( iIndex < imageCount )
+ {
+ CMemSpyEngineFbServBitmap& bitmap = iBitmaps.At( iIndex );
+ imageControl->SetPicture( &bitmap.Bitmap(), NULL );
+ imageControl->SetPictureOwnedExternally( ETrue );
+
+ // Prepare title
+ const TSize size( bitmap.Bitmap().SizeInPixels() );
+ _LIT(KTitleFormat, "%3d x %3d");
+ TBuf<128> title;
+ title.Format( KTitleFormat, size.iWidth, size.iHeight );
+ SetTitleL( title );
+ //
+ User::ResetInactivityTime();
+ //
+ Layout();
+ //
+ ++iIndex;
+ }
+ else
+ {
+ // Dismiss myself.
+ delete this;
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewHeapTracking.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,435 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewHeapTracking.h"
+
+// System includes
+#include <hal.h>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelpersysmemtracker.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyContainerObserver.h"
+#include "MemSpyViewHeapTrackingSettings.h"
+#include "MemSpyViewHeapTrackingResults.h"
+
+
+CMemSpyViewHeapTracking::CMemSpyViewHeapTracking( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver ),
+ iState( EMemSpyViewHeapTrackingStateIdle )
+ {
+ if ( iEngine.HelperSysMemTracker().IsActive() )
+ {
+ iState = EMemSpyViewHeapTrackingStateTimerOn;
+ }
+ }
+
+
+CMemSpyViewHeapTracking::~CMemSpyViewHeapTracking()
+ {
+ delete iStopTimerCallBack;
+ iEngine.HelperSysMemTracker().RemoveObserver( this );
+ }
+
+
+void CMemSpyViewHeapTracking::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "System-Wide Memory Tracking" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ // Backup current config because it may be overwritten with Basic/Full mode settings.
+ CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
+ TMemSpyEngineHelperSysMemTrackerConfig config;
+ swmt.GetConfig( config );
+ iOriginalConfig = config;
+
+ if ( config.iMode != TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom )
+ {
+ // Set config. Needed for updating config for Basic or Full mode.
+ SetConfigByModeL( config.iMode, config );
+ }
+
+ // Make sure the correct item is selected
+ TInt index = 0;
+ if ( aSelectionRune != NULL )
+ {
+ const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune);
+ index = IndexByViewType( viewType );
+ }
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+
+
+void CMemSpyViewHeapTracking::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewHeapTracking::ViewType() const
+ {
+ return EMemSpyViewTypeHeapTracking;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewHeapTracking::PrepareParentViewL()
+ {
+
+ // Save custom settings even if mode is Basic or Full
+ TRAP_IGNORE(
+ CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
+ TMemSpyEngineHelperSysMemTrackerConfig config;
+ swmt.GetConfig( config );
+ config.iEnabledCategories = iOriginalConfig.iEnabledCategories;
+ config.iThreadNameFilter = iOriginalConfig.iThreadNameFilter;
+ config.iDumpData = iOriginalConfig.iDumpData;
+ swmt.SetConfigL( config );
+ Settings().StoreSettingsL();
+ );
+
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewHeapTracking::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+ const TInt index = iListBox->CurrentItemIndex();
+
+ // Get current config
+ CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
+ TMemSpyEngineHelperSysMemTrackerConfig config;
+ swmt.GetConfig( config );
+
+ //
+ if ( index == 0 )
+ {
+ // This is the start/stop toggle so we don't make a child view
+ child = NULL;
+
+ // ... instead we either start or stop the tracker
+ if ( !iEngine.HelperSysMemTracker().IsActive() )
+ {
+ iState = EMemSpyViewHeapTrackingStateSingleOn;
+ // Setting observer to be able to stop SWMT after first cycle is completed
+ iEngine.HelperSysMemTracker().SetObserver( this );
+ iEngine.HelperSysMemTracker().StartL();
+ }
+
+ // Redraw listbox
+ RefreshL();
+ }
+ else if ( index == 1 )
+ {
+ // This is the start/stop toggle so we don't make a child view
+ child = NULL;
+
+ // ... instead we either start or stop the tracker
+ if ( iEngine.HelperSysMemTracker().IsActive() && iState == EMemSpyViewHeapTrackingStateTimerOn )
+ {
+ iState = EMemSpyViewHeapTrackingStateIdle;
+ iEngine.HelperSysMemTracker().StopL();
+ }
+ else if ( iState == EMemSpyViewHeapTrackingStateIdle )
+ {
+ iState = EMemSpyViewHeapTrackingStateTimerOn;
+ iEngine.HelperSysMemTracker().StartL();
+ }
+
+ // Redraw listbox
+ RefreshL();
+ }
+ else if ( index == 2 )
+ {
+ switch ( config.iMode )
+ {
+ case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic:
+ {
+ // Set Full mode
+ SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull, config );
+ break;
+ }
+ case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull:
+ {
+ // Set Custom mode
+ SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom, config );
+ break;
+ }
+ case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom:
+ {
+ // Set Basic mode
+ SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic, config );
+ break;
+ }
+ default: break;
+ }
+
+ // Redraw listbox
+ RefreshL();
+ }
+ else if ( index == 3 )
+ {
+ if ( config.iMode == TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom )
+ {
+ child = new(ELeave) CMemSpyViewHeapTrackingSettings( iEngine, iObserver );
+ }
+ else
+ {
+ child = new(ELeave) CMemSpyViewHeapTrackingResults( iEngine, iObserver );
+ }
+ }
+ else if ( index == 4 )
+ {
+ child = new(ELeave) CMemSpyViewHeapTrackingResults( iEngine, iObserver );
+ }
+ if ( child )
+ {
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ }
+
+ //
+ return child;
+ }
+
+
+void CMemSpyViewHeapTracking::SetListBoxModelL()
+ {
+ CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
+ CleanupStack::PushL( model );
+
+ TBuf<KMaxFullName + 1> item;
+
+ // Get current config
+ CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
+ TMemSpyEngineHelperSysMemTrackerConfig config;
+ swmt.GetConfig( config );
+
+ // 1st item
+ _LIT( KItem1FormatEnable, "\tGet dump now" );
+ model->AppendL( KItem1FormatEnable );
+
+
+ // 1st item
+ if ( iEngine.HelperSysMemTracker().IsActive() && iState == EMemSpyViewHeapTrackingStateTimerOn )
+ {
+ _LIT( KItem1FormatEnable, "\tStop timer\t\t%d (sec)" );
+ TName item;
+ item.Format( KItem1FormatEnable, config.iTimerPeriod.Int() / 1000000 );
+ model->AppendL( item );
+ }
+ else
+ {
+ _LIT( KItem1FormatEnable, "\tStart timer\t\t%d (sec)" );
+ TName item;
+ item.Format( KItem1FormatEnable, config.iTimerPeriod.Int() / 1000000 );
+ model->AppendL( item );
+ }
+
+ // 2nd item
+ switch ( config.iMode )
+ {
+ case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic:
+ {
+ _LIT( KItem2Format, "\tTracking mode\t\tBasic" );
+ model->AppendL( KItem2Format );
+ break;
+ }
+ case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull:
+ {
+ _LIT( KItem2Format, "\tTracking mode\t\tFull" );
+ model->AppendL( KItem2Format );
+ break;
+ }
+ case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom:
+ {
+ _LIT( KItem2Format, "\tTracking mode\t\tCustom" );
+ model->AppendL( KItem2Format );
+
+ // 3rd item
+ TFullName item;
+ if ( config.DumpData() &&
+ config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap )
+ {
+ _LIT( KItem3Format, "\tSettings\t\t%d categ., dump" );
+ item.Format( KItem3Format, config.EnabledCategoryCount() );
+ }
+ else
+ {
+ _LIT( KItem3Format, "\tSettings\t\t%d categories" );
+ item.Format( KItem3Format, config.EnabledCategoryCount() );
+ }
+ model->AppendL( item );
+ break;
+ }
+ default: break;
+ }
+
+ // 4th item
+ const TInt cycleCount = iEngine.HelperSysMemTracker().MdcaCount();
+ if ( cycleCount )
+ {
+ _LIT( KItem2Format, "\tResults\t\t%d cycles" );
+ TFullName item;
+ item.Format( KItem2Format, cycleCount );
+ model->AppendL( item );
+ }
+ else
+ {
+ _LIT( KItem2Format, "\tResults\t\tNo results" );
+ model->AppendL( KItem2Format );
+ }
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+ CleanupStack::Pop( model );
+ }
+
+
+void CMemSpyViewHeapTracking::HandleCyclesResetL()
+ {
+ }
+
+
+void CMemSpyViewHeapTracking::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+ {
+ }
+
+
+void CMemSpyViewHeapTracking::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+ {
+ // Stopping SWMT does not work directly from this function.
+ // It has to be made asynchronously.
+ iStopTimerCallBack = new (ELeave) CAsyncCallBack( TCallBack( CMemSpyViewHeapTracking::AsyncStopTimerCallback, this ), CActive::EPriorityStandard );
+ iStopTimerCallBack->CallBack();
+ }
+
+
+TInt CMemSpyViewHeapTracking::IndexByViewType( TMemSpyViewType aType )
+ {
+ // Get current config
+ CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
+ TMemSpyEngineHelperSysMemTrackerConfig config;
+ swmt.GetConfig( config );
+
+ TInt index = 0;
+ //
+ switch( aType )
+ {
+ default:
+ case EMemSpyViewTypeHeapTrackingResults:
+ {
+ if ( config.iMode == TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom )
+ {
+ index = 4;
+ }
+ else
+ {
+ index = 3;
+ }
+ break;
+ }
+ case EMemSpyViewTypeHeapTrackingSettings:
+ index = 3;
+ break;
+ }
+ //
+ return index;
+ }
+
+
+void CMemSpyViewHeapTracking::SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode aMode, TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
+ {
+ switch ( aMode )
+ {
+ case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic:
+ {
+ aConfig.iMode = aMode;
+ aConfig.iEnabledCategories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap |
+ TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks |
+ TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData |
+ TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory;
+ aConfig.iDumpData = EFalse;
+ break;
+ }
+ case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull:
+ {
+ aConfig.iMode = aMode;
+ aConfig.iEnabledCategories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
+ aConfig.iDumpData = ETrue;
+ aConfig.iThreadNameFilter = KNullDesC;
+ break;
+ }
+ case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom:
+ {
+ aConfig.iMode = aMode;
+ aConfig.iEnabledCategories = iOriginalConfig.iEnabledCategories;
+ aConfig.iDumpData = iOriginalConfig.iDumpData;
+ aConfig.iThreadNameFilter = iOriginalConfig.iThreadNameFilter;
+ break;
+ }
+ default: User::Leave( KErrArgument );
+ }
+ // Push changes to SWMT
+ CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
+ swmt.SetConfigL( aConfig );
+ Settings().StoreSettingsL();
+ }
+
+
+TInt CMemSpyViewHeapTracking::AsyncStopTimerCallback( TAny* aParam )
+ {
+ CMemSpyViewHeapTracking* view = static_cast<CMemSpyViewHeapTracking*>( aParam );
+ return view->AsyncStopTimerCallback();
+ }
+
+
+TInt CMemSpyViewHeapTracking::AsyncStopTimerCallback()
+ {
+ iState = EMemSpyViewHeapTrackingStateIdle;
+ iEngine.HelperSysMemTracker().RemoveObserver( this );
+ TRAP_IGNORE(
+ iEngine.HelperSysMemTracker().StopL();
+ RefreshL();
+ );
+ delete iStopTimerCallBack;
+ iStopTimerCallBack = NULL;
+ return KErrNone;
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewHeapTrackingResults.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,434 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewHeapTrackingResults.h"
+
+// System includes
+#include <hal.h>
+#ifdef __EPOC32__
+#include <e32rom.h>
+#endif
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerenums.h>
+#include <memspy/engine/memspyenginehelpersysmemtracker.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+#include <memspyui.rsg>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyContainer.h"
+#include "MemSpyViewHeapTracking.h"
+#include "MemSpyContainerObserver.h"
+
+
+CMemSpyViewHeapTrackingResults::CMemSpyViewHeapTrackingResults( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ iEngine.HelperSysMemTracker().SetObserver( this );
+ }
+
+
+CMemSpyViewHeapTrackingResults::~CMemSpyViewHeapTrackingResults()
+ {
+ iEngine.HelperSysMemTracker().RemoveObserver( this );
+ }
+
+
+void CMemSpyViewHeapTrackingResults::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Results Summary" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ // Make sure the correct item is selected
+ const TInt cycleNumber = ((TInt) aSelectionRune);
+ const TInt maxCycle = iEngine.HelperSysMemTracker().MdcaCount();
+ if ( cycleNumber > 0 && cycleNumber <= maxCycle )
+ {
+ iListBox->SetCurrentItemIndex( cycleNumber - 1 );
+ HandleListBoxItemSelectedL( cycleNumber );
+ }
+ }
+
+
+void CMemSpyViewHeapTrackingResults::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewHeapTrackingResults::ViewType() const
+ {
+ return EMemSpyViewTypeHeapTrackingResults;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewHeapTrackingResults::PrepareParentViewL()
+ {
+ CMemSpyViewHeapTracking* parent = new(ELeave) CMemSpyViewHeapTracking( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ //
+ iEngine.HelperSysMemTracker().RemoveObserver( this );
+ //
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewHeapTrackingResults::PrepareChildViewL()
+ {
+ const TInt index = iListBox->CurrentItemIndex();
+ //
+ CMemSpyViewBase* child = NULL;
+ if ( index >= 0 )
+ {
+ const CMemSpyEngineHelperSysMemTrackerCycle* cycle = iEngine.HelperSysMemTracker().CompletedCycles()[ index ];
+ //
+ child = new(ELeave) CMemSpyViewHeapTrackingResultsCycleInfo( iEngine, iObserver, *cycle );
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ //
+ iEngine.HelperSysMemTracker().RemoveObserver( this );
+ }
+ //
+ return child;
+ }
+
+
+void CMemSpyViewHeapTrackingResults::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ MDesCArray* contents = &iEngine.HelperSysMemTracker();
+ listbox->Model()->SetItemTextArray( contents );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewHeapTrackingResults::HandleCyclesResetL()
+ {
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+void CMemSpyViewHeapTrackingResults::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+ {
+ }
+
+
+void CMemSpyViewHeapTrackingResults::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+ {
+ SetListBoxCurrentItemIndexL( iEngine.HelperSysMemTracker().MdcaCount() - 1 );
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewHeapTrackingResultsCycleInfo::CMemSpyViewHeapTrackingResultsCycleInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+: CMemSpyViewBase( aEngine, aObserver ), iCycle( aCycle )
+ {
+ iEngine.HelperSysMemTracker().SetObserver( this );
+ }
+
+
+CMemSpyViewHeapTrackingResultsCycleInfo::~CMemSpyViewHeapTrackingResultsCycleInfo()
+ {
+ iEngine.HelperSysMemTracker().RemoveObserver( this );
+ }
+
+
+void CMemSpyViewHeapTrackingResultsCycleInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitleFormat, "Cycle Summary [%04d]" );
+ TBuf<30> buf;
+ buf.Format( KTitleFormat, iCycle.CycleNumber() );
+ SetTitleL( buf );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ // Make sure the correct item is selected
+ const TInt index = ((TInt) aSelectionRune);
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+
+
+void CMemSpyViewHeapTrackingResultsCycleInfo::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewHeapTrackingResultsCycleInfo::ViewType() const
+ {
+ return EMemSpyViewTypeHeapTrackingResultsCycleInfo;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewHeapTrackingResultsCycleInfo::PrepareParentViewL()
+ {
+ CMemSpyViewHeapTrackingResults* parent = new(ELeave) CMemSpyViewHeapTrackingResults( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) iCycle.CycleNumber() );
+ CleanupStack::Pop( parent );
+ //
+ iEngine.HelperSysMemTracker().RemoveObserver( this );
+ //
+ return parent;
+ }
+
+
+void CMemSpyViewHeapTrackingResultsCycleInfo::SetListBoxModelL()
+ {
+ MDesCArray& model = const_cast< MDesCArray& >( static_cast< const MDesCArray&>( iCycle ) );
+ //
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( &model );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewHeapTrackingResultsCycleInfo::HandleCyclesResetL()
+ {
+ Container().NavigateToParentViewL();
+ }
+
+
+void CMemSpyViewHeapTrackingResultsCycleInfo::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+ {
+ }
+
+
+void CMemSpyViewHeapTrackingResultsCycleInfo::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
+ {
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+
+
+
+CMemSpyViewHeapTrackingResultsChangeDescriptor::CMemSpyViewHeapTrackingResultsChangeDescriptor( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle, const CMemSpyEngineHelperSysMemTrackerCycleChange& aChangeDescriptor, TInt aIndex )
+: CMemSpyViewBase( aEngine, aObserver ), iCycle( aCycle ), iChangeDescriptor( aChangeDescriptor ), iIndex( aIndex )
+ {
+ iEngine.HelperSysMemTracker().SetObserver( this );
+ }
+
+
+CMemSpyViewHeapTrackingResultsChangeDescriptor::~CMemSpyViewHeapTrackingResultsChangeDescriptor()
+ {
+ iEngine.HelperSysMemTracker().RemoveObserver( this );
+ }
+
+
+void CMemSpyViewHeapTrackingResultsChangeDescriptor::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ TBuf<30> buf;
+ if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeHeapUser )
+ {
+ _LIT( KTitleFormat, "User Heap Change [%04d]" );
+ buf.Format( KTitleFormat, iCycle.CycleNumber() );
+ }
+ else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeHeapKernel )
+ {
+ _LIT( KTitleFormat, "Kernel Heap Change [%04d]" );
+ buf.Format( KTitleFormat, iCycle.CycleNumber() );
+ }
+ else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeChunk )
+ {
+ _LIT( KTitleFormat, "Chunk Change [%04d]" );
+ buf.Format( KTitleFormat, iCycle.CycleNumber() );
+ }
+ else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeRamDrive )
+ {
+ _LIT( KTitleFormat, "RAM Drive Change [%04d]" );
+ buf.Format( KTitleFormat, iCycle.CycleNumber() );
+ }
+ else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeStack )
+ {
+ _LIT( KTitleFormat, "Stack Change [%04d]" );
+ buf.Format( KTitleFormat, iCycle.CycleNumber() );
+ }
+ else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeGlobalData )
+ {
+ _LIT( KTitleFormat, "Global Data Change [%04d]" );
+ buf.Format( KTitleFormat, iCycle.CycleNumber() );
+ }
+ else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeCode )
+ {
+ _LIT( KTitleFormat, "RAM-Loaded Code Change [%04d]" );
+ buf.Format( KTitleFormat, iCycle.CycleNumber() );
+ }
+ else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeHandle )
+ {
+ _LIT( KTitleFormat, "Handle Change [%04d]" );
+ buf.Format( KTitleFormat, iCycle.CycleNumber() );
+ }
+ else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeOpenFile )
+ {
+ _LIT( KTitleFormat, "Open File Change [%04d]" );
+ buf.Format( KTitleFormat, iCycle.CycleNumber() );
+ }
+ else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeDiskSpace )
+ {
+ _LIT( KTitleFormat, "Disk Space Change [%04d]" );
+ buf.Format( KTitleFormat, iCycle.CycleNumber() );
+ }
+ else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeBitmap )
+ {
+ _LIT( KTitleFormat, "Bitmap Change [%04d]" );
+ buf.Format( KTitleFormat, iCycle.CycleNumber() );
+ }
+ //
+ SetTitleL( buf );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+void CMemSpyViewHeapTrackingResultsChangeDescriptor::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewHeapTrackingResultsChangeDescriptor::ViewType() const
+ {
+ return EMemSpyViewTypeHeapTrackingResultsCycleChangeDescriptor;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewHeapTrackingResultsChangeDescriptor::PrepareParentViewL()
+ {
+ CMemSpyViewHeapTrackingResultsCycleInfo* parent = new(ELeave) CMemSpyViewHeapTrackingResultsCycleInfo( iEngine, iObserver, iCycle );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) iIndex );
+ CleanupStack::Pop( parent );
+ //
+ iEngine.HelperSysMemTracker().RemoveObserver( this );
+ //
+ return parent;
+ }
+
+
+void CMemSpyViewHeapTrackingResultsChangeDescriptor::SetListBoxModelL()
+ {
+ MDesCArray& model = const_cast< MDesCArray& >( static_cast< const MDesCArray&>( iChangeDescriptor ) );
+ //
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( &model );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewHeapTrackingResultsChangeDescriptor::HandleCyclesResetL()
+ {
+ CMemSpyViewHeapTrackingResults* mainResultsMenu = new(ELeave) CMemSpyViewHeapTrackingResults( iEngine, iObserver );
+ CleanupStack::PushL( mainResultsMenu );
+ mainResultsMenu->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( mainResultsMenu );
+ //
+ Container().SetNewActiveViewL( mainResultsMenu );
+ }
+
+
+void CMemSpyViewHeapTrackingResultsChangeDescriptor::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+ {
+ }
+
+
+void CMemSpyViewHeapTrackingResultsChangeDescriptor::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
+ {
+ }
+*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewHeapTrackingSettings.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,422 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewHeapTrackingSettings.h"
+
+// System includes
+#include <hal.h>
+#ifdef __EPOC32__
+#include <e32rom.h>
+#endif
+#include <AknQueryDialog.h>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelpersysmemtracker.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+#include <memspyui.rsg>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpySettings.h"
+#include "MemSpyViewHeapTracking.h"
+#include "MemSpyContainerObserver.h"
+
+
+CMemSpyViewHeapTrackingSettings::CMemSpyViewHeapTrackingSettings( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+CMemSpyViewHeapTrackingSettings::~CMemSpyViewHeapTrackingSettings()
+ {
+ }
+
+
+void CMemSpyViewHeapTrackingSettings::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Settings" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+void CMemSpyViewHeapTrackingSettings::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewHeapTrackingSettings::ViewType() const
+ {
+ return EMemSpyViewTypeHeapTrackingSettings;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewHeapTrackingSettings::PrepareParentViewL()
+ {
+ CMemSpyViewHeapTracking* parent = new(ELeave) CMemSpyViewHeapTracking( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewHeapTrackingSettings::PrepareChildViewL()
+ {
+ const TInt index = iListBox->CurrentItemIndex();
+
+ // Get current config
+ CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
+ TMemSpyEngineHelperSysMemTrackerConfig config;
+ swmt.GetConfig( config );
+
+ // This view abuses the child view callback to toggle field values and/or
+ // display settings dialogs.
+ if ( index == 0 )
+ {
+ TInt period = config.iTimerPeriod.Int() / 1000000;
+ CAknNumberQueryDialog* dialog = new(ELeave) CAknNumberQueryDialog( period );
+ if ( dialog->ExecuteLD( R_MEMSPY_HEAP_TRACKER_TIMER_PERIOD ) )
+ {
+ config.iTimerPeriod = period * 1000000;
+ }
+ }
+ else if ( index == 1 )
+ {
+ TInt categories( config.iEnabledCategories );
+ CSWMTCategorySelectionCheckBoxSettingItem* settingItem = new (ELeave) CSWMTCategorySelectionCheckBoxSettingItem( 0, categories );
+ CleanupStack::PushL( settingItem );
+ settingItem->ConstructL( EFalse,
+ 0,
+ _L("SWMT Categories"),
+ NULL,
+ R_MEMSPYUI_SWMT_CATEGORIES_SETTING_PAGE,
+ EAknCtPopupSettingList,
+ NULL,
+ NULL );
+
+ CMemSpySWMTCategorySelectionCheckBoxSettingPage* dlg = new(ELeave) CMemSpySWMTCategorySelectionCheckBoxSettingPage( R_MEMSPYUI_SWMT_CATEGORIES_SETTING_PAGE, settingItem->ItemArray() );
+ dlg->SetSettingPageObserver( settingItem );
+ if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+ {
+ config.iEnabledCategories = categories;
+ }
+ CleanupStack::PopAndDestroy( settingItem );
+ }
+ else if ( index == 2 )
+ {
+ config.iDumpData = !config.iDumpData;
+ }
+ else if ( index == 3 )
+ {
+ TName nameFilter;
+ nameFilter.Copy( config.iThreadNameFilter );
+ CMemSpyAllowEmptyDataDialog* dialog = new (ELeave) CMemSpyAllowEmptyDataDialog( nameFilter );
+ if ( dialog->ExecuteLD( R_MEMSPY_HEAP_TRACKER_NAME_FILTER ) )
+ {
+ config.iThreadNameFilter = nameFilter;
+ }
+ }
+
+ // Push changes to SWMT
+ swmt.SetConfigL( config );
+ Settings().StoreSettingsL();
+
+ RefreshL();
+ return NULL;
+ }
+
+
+void CMemSpyViewHeapTrackingSettings::SetListBoxModelL()
+ {
+ CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
+ CleanupStack::PushL( model );
+
+ TBuf<KMaxFullName + 1> item;
+
+ // Get current config
+ CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
+ TMemSpyEngineHelperSysMemTrackerConfig config;
+ swmt.GetConfig( config );
+
+ // 1st item
+ _LIT( KItem1Format, "\tTracking timer period\t\t%d (sec)" );
+ item.Format( KItem1Format, config.iTimerPeriod.Int() / 1000000 );
+ model->AppendL( item );
+
+ // 2nd item
+ _LIT( KItem3Format, "\tCategories\t\t%d selected" );
+ item.Format( KItem3Format, config.EnabledCategoryCount() );
+ model->AppendL( item );
+
+ // following items are related only to User Heap category,
+ // so hide them if User Heap is not selected
+ if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap )
+ {
+ // 3th item
+ _LIT( KItem2Format, "\tDump data" );
+ PrepareItemBufL( item, KItem2Format, config.iDumpData, config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap && config.iThreadNameFilter.Length() > 0 );
+ model->AppendL( item );
+
+ // 4th item
+ if ( config.iDumpData )
+ {
+ _LIT( KItem4Format, "\tHeap data thread filter\t\t%S" );
+ if ( config.iThreadNameFilter.Length() > 0 )
+ {
+ item.Format( KItem4Format, &config.iThreadNameFilter );
+ }
+ else
+ {
+ item.Format( KItem4Format, &_L("No filtering") );
+ }
+ model->AppendL( item );
+ }
+ }
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+ CleanupStack::Pop( model );
+ }
+
+
+void CMemSpyViewHeapTrackingSettings::PrepareItemBufL( TDes& aBuf, const TDesC& aCaption, TBool aStatus, TBool aHeapCategorySelected )
+ {
+ aBuf.Copy( aCaption );
+ //
+ if ( aStatus )
+ {
+ if ( aHeapCategorySelected )
+ {
+ _LIT( KItemEnabled, "\t\tCustom" );
+ aBuf.Append( KItemEnabled );
+ }
+ else
+ {
+ _LIT( KItemEnabled, "\t\tAll user heaps" );
+ aBuf.Append( KItemEnabled );
+ }
+ }
+ else
+ {
+ _LIT( KItemDisabled, "\t\tDisabled" );
+ aBuf.Append( KItemDisabled );
+ }
+ }
+
+
+
+
+
+
+
+
+
+// --------------------------------------------------------------------------------------------
+
+CSWMTCategorySelectionCheckBoxSettingItem::CSWMTCategorySelectionCheckBoxSettingItem( TInt aIdentifier, TInt& aCategories ):
+ CAknSettingItem(aIdentifier), iExtCategories( aCategories )
+ {
+ }
+
+
+CSWMTCategorySelectionCheckBoxSettingItem::~CSWMTCategorySelectionCheckBoxSettingItem()
+ {
+ delete iSettingText;
+ if( iItemArray )
+ {
+ iItemArray->ResetAndDestroy();
+ delete iItemArray;
+ }
+ }
+
+
+CSelectionItemList* CSWMTCategorySelectionCheckBoxSettingItem::ItemArray() const
+ {
+ return iItemArray;
+ }
+
+
+void CSWMTCategorySelectionCheckBoxSettingItem::AddNewItemToArrayL(const TDesC& aLabel)
+ {
+ TBuf<64> buf;
+ buf.Copy( aLabel );
+ CSelectableItem* item = new (ELeave) CSelectableItem( buf, EFalse );
+ CleanupStack::PushL( item );
+ item->ConstructL();
+ iItemArray->AppendL( item ); // Ownership is transferred
+ CleanupStack::Pop(); // item
+ }
+
+
+void CSWMTCategorySelectionCheckBoxSettingItem::CompleteConstructionL()
+ {
+ SetEmptyItemTextL(_L("Nothing selected"));
+ iItemArray = new(ELeave) CSelectionItemList(16);
+ AddNewItemToArrayL( _L("User Heap") ); // 0
+ AddNewItemToArrayL( _L("Kernel Heap") ); // 1
+ AddNewItemToArrayL( _L("User Stacks") ); // 2
+ AddNewItemToArrayL( _L("Global Data") ); // 3
+ AddNewItemToArrayL( _L("Disk Usage") ); // 4
+ AddNewItemToArrayL( _L("Open Files") ); // 5
+ AddNewItemToArrayL( _L("RAM-loaded Code") ); // 6
+ AddNewItemToArrayL( _L("System Memory") ); // 7
+ AddNewItemToArrayL( _L("Local Chunks") ); // 8
+ AddNewItemToArrayL( _L("Global Chunks") ); // 9
+ AddNewItemToArrayL( _L("RAM Drive") ); // 10
+ AddNewItemToArrayL( _L("FileServer Cache") );// 11
+ AddNewItemToArrayL( _L("Kernel Handles") ); // 12
+ AddNewItemToArrayL( _L("Bitmap Handles") ); // 13
+ AddNewItemToArrayL( _L("Window Groups") ); // 14
+ }
+
+
+void CSWMTCategorySelectionCheckBoxSettingItem::StoreL()
+ {
+ iExtCategories = 0;
+ if ( iItemArray->At( 11 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache;
+ if ( iItemArray->At( 13 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles;
+ if ( iItemArray->At( 0 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap;
+ if ( iItemArray->At( 1 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap;
+ if ( iItemArray->At( 8 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks;
+ if ( iItemArray->At( 9 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks;
+ if ( iItemArray->At( 10 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive;
+ if ( iItemArray->At( 2 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks;
+ if ( iItemArray->At( 3 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData;
+ if ( iItemArray->At( 6 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode;
+ if ( iItemArray->At( 12 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles;
+ if ( iItemArray->At( 5 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles;
+ if ( iItemArray->At( 4 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage;
+ if ( iItemArray->At( 7 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory;
+ if ( iItemArray->At( 14 )->SelectionStatus() )
+ iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups;
+ }
+
+
+void CSWMTCategorySelectionCheckBoxSettingItem::LoadL()
+ {
+ iItemArray->At( 11 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache );
+ iItemArray->At( 13 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles );
+ iItemArray->At( 0 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap );
+ iItemArray->At( 1 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap );
+ iItemArray->At( 8 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks );
+ iItemArray->At( 9 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks );
+ iItemArray->At( 10 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive );
+ iItemArray->At( 2 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks );
+ iItemArray->At( 3 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData );
+ iItemArray->At( 6 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode );
+ iItemArray->At( 12 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles );
+ iItemArray->At( 5 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles );
+ iItemArray->At( 4 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage );
+ iItemArray->At( 7 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory );
+ iItemArray->At( 14 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups );
+ }
+
+
+void CSWMTCategorySelectionCheckBoxSettingItem::HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType )
+ {
+ switch( aEventType )
+ {
+ case EEventSettingOked:
+ {
+ // If settings oked, save new values
+ StoreL();
+ break;
+ }
+ case EEventSettingCancelled:
+ {
+ // If setting is cancelled, load old values
+ LoadL();
+ break;
+ }
+ case EEventSettingChanged:
+ {
+ // If setting has changed, update CBA visibility
+ static_cast<CMemSpySWMTCategorySelectionCheckBoxSettingPage*>( aSettingPage )->UpdateCba();
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ CAknSettingItem::HandleSettingPageEventL( aSettingPage, aEventType );
+ }
+
+
+CMemSpySWMTCategorySelectionCheckBoxSettingPage::CMemSpySWMTCategorySelectionCheckBoxSettingPage(TInt aResourceID, CSelectionItemList* aItemArray )
+ : CAknCheckBoxSettingPage( aResourceID, aItemArray )
+ {
+ }
+
+
+void CMemSpySWMTCategorySelectionCheckBoxSettingPage::UpdateCba()
+ {
+ // Cache the pointer to button group container
+ CEikButtonGroupContainer* cba = Cba();
+ // Left softkey should be visible if there are items selected,
+ // i.e. the selection index array has items.
+ TBool visible( ListBoxControl()->View()->SelectionIndexes()->Count() > 0 );
+ // Resolve left softkey command id
+ TInt leftId( cba->ButtonGroup()->CommandId( 0 ) );
+ // Check if left softkey visibility has changed
+ if( visible != cba->IsCommandVisible( leftId ) )
+ {
+ // Left softkey visibility has changed, update it
+ cba->MakeCommandVisible( leftId, visible );
+ }
+ }
+
+
+
+
+CMemSpyAllowEmptyDataDialog::CMemSpyAllowEmptyDataDialog( TDes& aText, const TTone& aTone )
+ : CAknTextQueryDialog( aText, aTone )
+ {
+ }
+
+
+void CMemSpyAllowEmptyDataDialog::UpdateLeftSoftKeyL()
+ {
+ MakeLeftSoftkeyVisible( ETrue );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewKernel.cpp Wed Oct 13 14:32:52 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:
+*
+*/
+
+#include "MemSpyViewKernel.h"
+
+// System includes
+#include <hal.h>
+#ifdef __EPOC32__
+#include <e32rom.h>
+#endif
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyContainerObserver.h"
+#include "MemSpyViewKernelHeap.h"
+#include "MemSpyViewKernelContainers.h"
+
+
+
+CMemSpyViewKernel::CMemSpyViewKernel( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+CMemSpyViewKernel::~CMemSpyViewKernel()
+ {
+ }
+
+
+void CMemSpyViewKernel::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Kernel" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ // Make sure the correct item is selected
+ const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune);
+ const TInt index = IndexByViewType( viewType );
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+
+
+void CMemSpyViewKernel::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewKernel::ViewType() const
+ {
+ return EMemSpyViewTypeKernel;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewKernel::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewKernel::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+ const TInt index = iListBox->CurrentItemIndex();
+ //
+ if ( index == 0 )
+ {
+ child = new(ELeave) CMemSpyViewKernelContainers( iEngine, iObserver );
+ }
+ else if ( index == 1 )
+ {
+ child = new(ELeave) CMemSpyViewKernelHeap( iEngine, iObserver );
+ }
+
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+void CMemSpyViewKernel::SetListBoxModelL()
+ {
+ CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
+ CleanupStack::PushL( model );
+
+ TBuf<KMaxFullName + 1> item;
+
+ // 1st item = Processes
+ _LIT( KItem1Format, "\tObjects" );
+ item.Format( KItem1Format );
+ model->AppendL( item );
+
+ // 2nd item = System Config
+ _LIT( KItem2Format, "\tHeap" );
+ model->AppendL( KItem2Format );
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+ CleanupStack::Pop( model );
+ }
+
+
+TInt CMemSpyViewKernel::IndexByViewType( TMemSpyViewType aType )
+ {
+ TInt index = 0;
+ //
+ switch( aType )
+ {
+ default:
+ case EMemSpyViewTypeKernelContainers:
+ index = 0;
+ break;
+ case EMemSpyViewTypeKernelHeap:
+ index = 1;
+ break;
+ }
+ //
+ return index;
+ }
+
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewKernelContainers.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewKernelContainers.h"
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperkernelcontainers.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewKernel.h"
+#include "MemSpyContainerObserver.h"
+#include "MemSpyViewKernelObjects.h"
+
+// Literal constants
+
+
+
+CMemSpyViewKernelContainers::CMemSpyViewKernelContainers( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+CMemSpyViewKernelContainers::~CMemSpyViewKernelContainers()
+ {
+ delete iModel;
+ }
+
+
+void CMemSpyViewKernelContainers::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Kernel Objects" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+void CMemSpyViewKernelContainers::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewKernelContainers::ViewType() const
+ {
+ return EMemSpyViewTypeKernelContainers;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewKernelContainers::PrepareParentViewL()
+ {
+ CMemSpyViewKernel* parent = new(ELeave) CMemSpyViewKernel( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewKernelContainers::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+ const TInt index = iListBox->CurrentItemIndex();
+ child = new(ELeave) CMemSpyViewKernelObjects( iEngine, iObserver, iModel->At( index ).Type() );
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+void CMemSpyViewKernelContainers::SetListBoxModelL()
+ {
+ // Take ownership of new model
+ CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers();
+ CMemSpyEngineGenericKernelObjectContainer* model = kernelContainerManager.ObjectsAllL();
+ delete iModel;
+ iModel = model;
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+TBool CMemSpyViewKernelContainers::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdKernelContainersOutput:
+ OnCmdOutputAllContainerContentsL();
+ break;
+
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewKernelContainers::OnCmdOutputAllContainerContentsL()
+ {
+ CMemSpyEngineOutputSink& sink = iEngine.Sink();
+ iModel->OutputL( sink );
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewKernelHeap.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyViewKernelHeap.h"
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyengineoutputlist.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewKernel.h"
+#include "MemSpyContainerObserver.h"
+
+// Literal constants
+
+
+
+CMemSpyViewKernelHeap::CMemSpyViewKernelHeap( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+CMemSpyViewKernelHeap::~CMemSpyViewKernelHeap()
+ {
+ }
+
+
+void CMemSpyViewKernelHeap::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Kernel Heap" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+void CMemSpyViewKernelHeap::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewKernelHeap::ViewType() const
+ {
+ return EMemSpyViewTypeKernelHeap;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewKernelHeap::PrepareParentViewL()
+ {
+ CMemSpyViewKernel* parent = new(ELeave) CMemSpyViewKernel( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewKernelHeap::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+ return child;
+ }
+
+
+void CMemSpyViewKernelHeap::SetListBoxModelL()
+ {
+ // Get list contents
+ TMemSpyHeapInfo heapInfo;
+ iEngine.HelperHeap().GetHeapInfoKernelL( heapInfo );
+ CMemSpyEngineOutputList* list = iEngine.HelperHeap().NewHeapSummaryShortLC( heapInfo );
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( list );
+ listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+ CleanupStack::Pop( list );
+ }
+
+
+TBool CMemSpyViewKernelHeap::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdKernelHeapDump:
+ OnCmdDumpKernelHeapL();
+ break;
+
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewKernelHeap::OnCmdDumpKernelHeapL()
+ {
+ iEngine.HelperHeap().OutputHeapDataKernelL();
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewKernelObjects.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,851 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewKernelObjects.h"
+
+// System includes
+#include <eikspane.h>
+#include <aknnavide.h>
+#include <akntabgrp.h>
+#include <eikclbd.h>
+#include <AknQueryDialog.h>
+#include <aknnotewrappers.h>
+#include <apgwgnam.h>
+#include <aknmessagequerydialog.h>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperkernelcontainers.h>
+#include <memspy/engine/memspyenginehelperserver.h>
+#include <memspy/engine/memspyenginehelpercondvar.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewKernel.h"
+#include "MemSpyContainerObserver.h"
+#include "MemSpyViewKernelContainers.h"
+
+const TInt KMaxInfoLength = 128;
+
+CMemSpyViewKernelObjects::CMemSpyViewKernelObjects( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TMemSpyDriverContainerType aObjectType )
+: CMemSpyViewBase( aEngine, aObserver ),
+ iObjectType( aObjectType ),
+ iCurrItemIndex( KErrNotFound )
+ {
+ }
+
+
+CMemSpyViewKernelObjects::~CMemSpyViewKernelObjects()
+ {
+ if ( iNavContainer && iNavDecorator )
+ {
+ iNavContainer->Pop( iNavDecorator );
+ delete iNavDecorator;
+ }
+ delete iModel;
+ delete iItems;
+ delete iObjectList;
+ }
+
+
+void CMemSpyViewKernelObjects::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Kernel Objects" );
+ SetTitleL( KTitle );
+ iItems = new(ELeave) CDesCArrayFlat(5);
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ CreateTabsL();
+ }
+
+
+CEikListBox* CMemSpyViewKernelObjects::ConstructListBoxL()
+ {
+ delete iListBox;
+ iListBox = NULL;
+ CAknSingleStyleListBox* listbox = new (ELeave) CAknSingleStyleListBox();
+ iListBox = listbox;
+ listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling );
+ listbox->SetContainerWindowL( *this );
+ listbox->CreateScrollBarFrameL( ETrue );
+ SetListBoxModelL();
+ listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+ listbox->SetListBoxObserver( this );
+ listbox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);
+ listbox->SetObserver( this );
+ return listbox;
+ }
+
+
+void CMemSpyViewKernelObjects::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewKernelObjects::ViewType() const
+ {
+ return EMemSpyViewTypeKernelObjects;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewKernelObjects::PrepareParentViewL()
+ {
+ if ( iNavContainer && iNavDecorator )
+ {
+ iNavContainer->Pop( iNavDecorator );
+ delete iNavDecorator;
+ iNavDecorator = NULL;
+ }
+ CMemSpyViewBase* parent = new(ELeave) CMemSpyViewKernelContainers( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewKernelObjects::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+ if ( iListBox &&
+ iListBox->Model()->NumberOfItems() &&
+ iListBox->CurrentItemIndex() > KErrNotFound )
+ {
+ DetailsL();
+ }
+ return child;
+ }
+
+
+void CMemSpyViewKernelObjects::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
+ {
+ if ( aResourceId == R_MEMSPY_MENUPANE )
+ {
+ if ( iObjectType > EMemSpyDriverContainerTypeProcess )
+ {
+ // Display Terminate, Switch to, End and Panic
+ // commands only for Threads and processes
+ aMenuPane->SetItemDimmed( EMemSpyCmdKernelObjects, ETrue );
+ }
+ }
+ }
+
+
+void CMemSpyViewKernelObjects::SetListBoxModelL()
+ {
+ _LIT( KLineFormatSpec, "\t%S" );
+
+ // Take ownership of new model
+ CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers();
+ CMemSpyEngineGenericKernelObjectContainer* model = kernelContainerManager.ObjectsAllL();
+
+ delete iModel;
+ iModel = model;
+
+ iItems->Reset();
+ delete iObjectList;
+ iObjectList = NULL;
+ iObjectList = kernelContainerManager.ObjectsForSpecificContainerL( iObjectType );
+
+ // TODO: CMemSpyEngineGenericKernelObjectList could inherit MDesCArray like
+ // CMemSpyEngineGenericKernelObjectContainer does. iObjectList could then be passed
+ // to listbox model:
+ // listbox->Model()->SetItemTextArray( iObjectList );
+
+ TName item;
+ TName name;
+ for ( TInt i = 0; i < iObjectList->Count(); i++ )
+ {
+ name.Copy( iObjectList->At( i ).iName );
+ item.Format( KLineFormatSpec, &name );
+ iItems->AppendL( item );
+ }
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( iItems );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+TBool CMemSpyViewKernelObjects::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdKernelObjectTerminate:
+ {
+ TRAPD( err, OnCmdTerminateL() );
+ if ( err )
+ {
+ CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
+ note->ExecuteLD( _L("Cannot terminate task") );
+ }
+ break;
+ }
+ case EMemSpyCmdKernelObjectSwitchTo:
+ {
+ TRAPD( err, OnCmdSwitchToL() );
+ if ( err )
+ {
+ CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
+ note->ExecuteLD( _L("Cannot bring to foreground") );
+ }
+ break;
+ }
+ case EMemSpyCmdKernelObjectEnd:
+ {
+ TRAPD( err, OnCmdEndL() );
+ if ( err )
+ {
+ CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
+ note->ExecuteLD( _L("Cannot end task") );
+ }
+ break;
+ }
+ case EMemSpyCmdKernelObjectPanic:
+ {
+ TRAPD( err, OnCmdPanicL() );
+ if ( err )
+ {
+ CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
+ note->ExecuteLD( _L("Cannot panic task") );
+ }
+ break;
+ }
+ default:
+ {
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ }
+ //
+ return handled;
+ }
+
+
+TKeyResponse CMemSpyViewKernelObjects::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
+ {
+ TKeyResponse resp = EKeyWasNotConsumed;
+ if ( iTabs && ( aKeyEvent.iScanCode == EStdKeyRightArrow || aKeyEvent.iScanCode == EStdKeyLeftArrow ) )
+ {
+ resp = iTabs->OfferKeyEventL( aKeyEvent, aType );
+ }
+ else
+ {
+ resp = CMemSpyViewBase::OfferKeyEventL( aKeyEvent, aType );
+ }
+ return resp;
+ }
+
+
+void CMemSpyViewKernelObjects::TabChangedL( TInt /*aIndex*/ )
+ {
+ iObjectType = (TMemSpyDriverContainerType)iTabs->ActiveTabId();
+ RefreshL();
+ }
+
+
+void CMemSpyViewKernelObjects::OnCmdTerminateL()
+ {
+ 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->TerminateL();
+ }
+ }
+ 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.TerminateL();
+ RefreshL();
+ }
+ break;
+ }
+ default:
+ {
+ // Programming error
+ __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) );
+ }
+ }
+ }
+
+
+void CMemSpyViewKernelObjects::OnCmdSwitchToL()
+ {
+ TInt wgCount;
+ RWsSession wsSession;
+ User::LeaveIfError( wsSession.Connect() );
+ CleanupClosePushL( wsSession );
+ User::LeaveIfError( wgCount = wsSession.NumWindowGroups() );
+ RArray<RWsSession::TWindowGroupChainInfo> wgArray;
+ CleanupClosePushL( wgArray );
+ User::LeaveIfError( wsSession.WindowGroupList( &wgArray ) );
+ TApaTask task( wsSession );
+ TBool brought( EFalse );
+ TInt wgId( KErrNotFound );
+ TThreadId threadId;
+ switch ( iObjectType )
+ {
+ case EMemSpyDriverContainerTypeThread:
+ {
+ TThreadId currentThreadId( iObjectList->At( iListBox->CurrentItemIndex() ).iId );
+
+ // loop trough all window groups and see if a thread id matches
+ while( !brought && wgCount-- )
+ {
+ wgId = wgArray[wgCount].iId;
+ User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) );
+ if ( threadId == currentThreadId )
+ {
+ CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId );
+ task.SetWgId( wgId );
+ if ( !wgName->Hidden() && task.Exists() )
+ {
+ task.BringToForeground();
+ brought = ETrue;
+ }
+ CleanupStack::PopAndDestroy( wgName );
+ }
+ }
+ break;
+ }
+ case EMemSpyDriverContainerTypeProcess:
+ {
+ CMemSpyEngineObjectContainer& container = iEngine.Container();
+ TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId );
+ CMemSpyProcess& process = container.ProcessByIdL( id );
+
+ // loop trough threads in a process
+ for ( TInt i = 0; i < process.MdcaCount(); i++ )
+ {
+ TInt wgCountLocal = wgCount;
+
+ // loop trough all window groups and see if a thread id matches
+ while( !brought && wgCountLocal-- )
+ {
+ wgId = wgArray[wgCountLocal].iId;
+ User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) );
+ if ( threadId == process.At( i ).Id() )
+ {
+ CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId );
+ task.SetWgId( wgId );
+ if ( !wgName->Hidden() && task.Exists() )
+ {
+ task.BringToForeground();
+ brought = ETrue;
+ }
+ CleanupStack::PopAndDestroy( wgName );
+ }
+ }
+ }
+
+ break;
+ }
+ default:
+ {
+ // Programming error
+ __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) );
+ }
+ }
+ if ( !brought )
+ {
+ // Error handling in HandleCommandL
+ User::Leave( KErrGeneral );
+ }
+ CleanupStack::PopAndDestroy( 2 ); //wgArray,wsSession
+ }
+
+
+void CMemSpyViewKernelObjects::OnCmdEndL()
+ {
+ 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->KillL();
+ }
+ }
+ 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.KillL();
+ RefreshL();
+ }
+
+ break;
+ }
+ default:
+ {
+ // 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()
+ {
+ CEikStatusPane* statusPane = static_cast<CAknAppUi*> ( iEikonEnv->EikAppUi() )->StatusPane();
+ TUid uid;
+ uid.iUid = EEikStatusPaneUidNavi;
+ iNavDecorator = ((CAknNavigationControlContainer*)(statusPane->ControlL(uid)))->Top();
+
+ if ( !iNavDecorator )
+ {
+ iNavContainer = (CAknNavigationControlContainer*)statusPane->ControlL(uid);
+ iNavDecorator = iNavContainer->CreateTabGroupL();
+
+ iTabs = ( CAknTabGroup* )iNavDecorator->DecoratedControl();
+ iTabs->SetTabFixedWidthL( KTabWidthWithThreeLongTabs );
+
+ for ( TInt i = 0; i < iModel->Count(); i++ )
+ {
+ const CMemSpyEngineGenericKernelObjectList& item = iModel->At( i );
+ iTabs->AddTabL( item.Type(), item.TypeAsString( item.Type() ) );
+ }
+ iTabs->SetActiveTabById( iObjectType );
+ iTabs->SetObserver( this );
+ iNavContainer->PushL( *iNavDecorator );
+ }
+ }
+
+
+void CMemSpyViewKernelObjects::DetailsL()
+ {
+ HBufC* messageBuf = HBufC::NewLC( 40960 );
+ TPtr messagePtr = messageBuf->Des();
+
+ const TMemSpyDriverHandleInfoGeneric& selectedObject = iObjectList->At( iListBox->CurrentItemIndex() );
+
+ // General attributes:
+ TFullName name;
+ name.Copy( selectedObject.iNameDetail );
+ AppendFormatString( messagePtr, _L("Name: %S\n"), &name );
+ name.Zero();
+ name.Copy( selectedObject.iName );
+ AppendFormatString( messagePtr, _L("FullName: %S\n"), &name );
+ name.Zero();
+ AppendFormatString( messagePtr, _L("AccessCount: %d\n"), selectedObject.iAccessCount );
+ AppendFormatString( messagePtr, _L("UniqueID: %d\n"), selectedObject.iUniqueID );
+ AppendFormatString( messagePtr, _L("Protection: %u\n"), selectedObject.iProtection );
+ AppendFormatString( messagePtr, _L("OwnrAddr: 0x%08X\n"), selectedObject.iAddressOfKernelOwner );
+ AppendFormatString( messagePtr, _L("KernelAddr: 0x%08X"), selectedObject.iHandle );
+
+ // Object type specific attributes:
+ switch ( selectedObject.iType )
+ {
+ case EMemSpyDriverContainerTypeUnknown:
+ {
+ break;
+ }
+ case EMemSpyDriverContainerTypeThread:
+ {
+ AppendFormatString( messagePtr, _L("\nOwnrPrAddr: 0x%08X\n"), selectedObject.iAddressOfOwningProcess );
+ AppendFormatString( messagePtr, _L("ThreadID: %d\n"), selectedObject.iId );
+ AppendFormatString( messagePtr, _L("Priority: %d\n"), selectedObject.iPriority );
+ TFullName procName;
+ procName.Copy( selectedObject.iNameOfOwner );
+ AppendFormatString( messagePtr, _L("Proc: %S"), &procName );
+ procName.Zero();
+ break;
+ }
+ case EMemSpyDriverContainerTypeProcess:
+ {
+ AppendFormatString( messagePtr, _L("\nOwnrPrAddr: 0x%08X\n"), selectedObject.iAddressOfOwningProcess );
+ AppendFormatString( messagePtr, _L("CreatorId: %u\n"), selectedObject.iCreatorId );
+ AppendFormatString( messagePtr, _L("Attributes: 0x%08X\n"), selectedObject.iAttributes );
+ AppendFormatString( messagePtr, _L("StckChnk: 0x%08X\n"), selectedObject.iAddressOfDataBssStackChunk );
+ AppendFormatString( messagePtr, _L("ProcessID: %d\n"), selectedObject.iId );
+ AppendFormatString( messagePtr, _L("Priority: %d\n"), selectedObject.iPriority );
+ AppendFormatString( messagePtr, _L("SecurityZone: %d"), selectedObject.iSecurityZone );
+ CMemSpyEngineObjectContainer& container = iEngine.Container();
+ TProcessId id( selectedObject.iId );
+ TRAP_IGNORE(
+ CMemSpyProcess& process = container.ProcessByIdL( id );
+ AppendFormatString( messagePtr, _L("\nSID: 0x%08X\n"), process.SID() );
+ AppendFormatString( messagePtr, _L("VID: 0x%08X\n"), process.VID() );
+ AppendFormatString( messagePtr, _L("UID1: 0x%08X\n"), process.UIDs()[0].iUid );
+ AppendFormatString( messagePtr, _L("UID2: 0x%08X\n"), process.UIDs()[1].iUid );
+ AppendFormatString( messagePtr, _L("UID3: 0x%08X\n"), process.UIDs()[2].iUid );
+ AppendFormatString( messagePtr, _L("Caps: 0x%08X%08X"), process.Capabilities().iCaps[0], process.Capabilities().iCaps[1]);
+ );
+ break;
+ }
+ case EMemSpyDriverContainerTypeChunk:
+ {
+ AppendFormatString( messagePtr, _L("\nOwnrPrAddr: 0x%08X\n"), selectedObject.iAddressOfOwningProcess );
+ AppendFormatString( messagePtr, _L("Size: %d\n"), selectedObject.iSize );
+ AppendFormatString( messagePtr, _L("MaxSize: %d\n"), selectedObject.iMaxSize );
+ AppendFormatString( messagePtr, _L("Bottom: %d\n"), selectedObject.iBottom );
+ AppendFormatString( messagePtr, _L("Top: %d\n"), selectedObject.iTop );
+ AppendFormatString( messagePtr, _L("Attr: 0x%08X\n"), selectedObject.iAttributes );
+ AppendFormatString( messagePtr, _L("Start: %d\n"), selectedObject.iStartPos );
+ AppendFormatString( messagePtr, _L("CntrlID: %u\n"), selectedObject.iControllingOwner );
+ AppendFormatString( messagePtr, _L("Restrictions: %u\n"), selectedObject.iRestrictions );
+ AppendFormatString( messagePtr, _L("MapAttr: %u\n"), selectedObject.iMapAttr );
+ AppendFormatString( messagePtr, _L("Type: %u\n"), selectedObject.iChunkType );
+ TFullName procName;
+ procName.Copy( selectedObject.iNameOfOwner );
+ AppendFormatString( messagePtr, _L("Proc: %S"), &procName );
+ procName.Zero();
+ // OwnerAddr iAddressOfKernelOwner already listed
+ // ProcAddr iAddressOfOwningProcess already listed
+ break;
+ }
+ case EMemSpyDriverContainerTypeLibrary:
+ {
+ AppendFormatString( messagePtr, _L("\nMapCount: %d\n"), selectedObject.iMapCount );
+ AppendFormatString( messagePtr, _L("State: %u\n"), selectedObject.iState );
+ AppendFormatString( messagePtr, _L("CodeSeg: 0x%08X"), selectedObject.iAddressOfCodeSeg );
+ break;
+ }
+ case EMemSpyDriverContainerTypeSemaphore:
+ {
+ AppendFormatString( messagePtr, _L("\nCount: %d\n"), selectedObject.iCount );
+ AppendFormatString( messagePtr, _L("Resetting: %u"), selectedObject.iResetting );
+ break;
+ }
+ case EMemSpyDriverContainerTypeMutex:
+ {
+ AppendFormatString( messagePtr, _L("\nHoldCount: %d\n"), selectedObject.iCount );
+ AppendFormatString( messagePtr, _L("WaitCount: %d\n"), selectedObject.iWaitCount );
+ AppendFormatString( messagePtr, _L("Resetting: %u\n"), selectedObject.iResetting );
+ AppendFormatString( messagePtr, _L("Order: %u"), selectedObject.iOrder );
+ break;
+ }
+ case EMemSpyDriverContainerTypeTimer:
+ {
+ AppendFormatString( messagePtr, _L("\nState: %d\n"), selectedObject.iTimerState );
+ AppendFormatString( messagePtr, _L("Type: %d"), selectedObject.iTimerType );
+ break;
+ }
+ case EMemSpyDriverContainerTypeServer:
+ {
+ // Owner == ThrdAddr
+ AppendFormatString( messagePtr, _L("\nThrdAddr: 0x%08X\n"), selectedObject.iAddressOfOwningThread );
+ TFullName thrName;
+ thrName.Copy( selectedObject.iNameOfOwner );
+ AppendFormatString( messagePtr, _L("Thr: %S\n"), &thrName );
+ thrName.Zero();
+ AppendFormatString( messagePtr, _L("Type: %d\n"), selectedObject.iSessionType );
+ TBuf8<55>buf;
+ RArray<TMemSpyDriverServerSessionInfo> sessions;
+ CleanupClosePushL( sessions );
+ iEngine.HelperServer().GetServerSessionsL( selectedObject, sessions );
+ const TInt count = sessions.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ const TMemSpyDriverServerSessionInfo& session = sessions[ i ];
+ AppendFormatString( messagePtr, _L("SessAddr: 0x%08X\n"), session.iAddress );
+ TFullName sessName;
+ sessName.Copy( session.iName );
+ AppendFormatString( messagePtr, _L("Sess: %S\n"), &sessName );
+ }
+ CleanupStack::PopAndDestroy( &sessions );
+ break;
+ }
+ case EMemSpyDriverContainerTypeSession:
+ {
+ // Server == SvrAddr
+ AppendFormatString( messagePtr, _L("\nServer: 0x%08X\n"), selectedObject.iAddressOfServer );
+ TFullName srvName;
+ srvName.Copy( selectedObject.iName );
+ AppendFormatString( messagePtr, _L("Srv: %S\n"), &srvName );
+ srvName.Zero();
+ // Session: not supported
+ AppendFormatString( messagePtr, _L("AccCount: %u\n"), selectedObject.iTotalAccessCount );
+ AppendFormatString( messagePtr, _L("SesType: %u\n"), selectedObject.iSessionType );
+ AppendFormatString( messagePtr, _L("SvrType: %u\n"), selectedObject.iSvrSessionType );
+ AppendFormatString( messagePtr, _L("MsgCount: %d\n"), selectedObject.iMsgCount );
+ AppendFormatString( messagePtr, _L("MsgLimit: %d"), selectedObject.iMsgLimit );
+ break;
+ }
+ case EMemSpyDriverContainerTypeLogicalDevice:
+ {
+ AppendFormatString( messagePtr,
+ _L("\nVersion: %d.%d.%d\n"),
+ selectedObject.iVersion.iMajor,
+ selectedObject.iVersion.iMinor,
+ selectedObject.iVersion.iBuild );
+ AppendFormatString( messagePtr, _L("ParseMask: 0x%08X\n"), selectedObject.iParseMask );
+ AppendFormatString( messagePtr, _L("UnitsMask: 0x%08X\n"), selectedObject.iUnitsMask );
+ AppendFormatString( messagePtr, _L("Open channels: %d"), selectedObject.iOpenChannels );
+ break;
+ }
+ case EMemSpyDriverContainerTypePhysicalDevice:
+ {
+ AppendFormatString( messagePtr,
+ _L("\nVersion: %d.%d.%d\n"),
+ selectedObject.iVersion.iMajor,
+ selectedObject.iVersion.iMinor,
+ selectedObject.iVersion.iBuild );
+ AppendFormatString( messagePtr, _L("UnitsMask: 0x%08X\n"), selectedObject.iUnitsMask );
+ AppendFormatString( messagePtr, _L("CodeSeg: 0x%08X"), selectedObject.iAddressOfCodeSeg );
+ break;
+ }
+ case EMemSpyDriverContainerTypeLogicalChannel:
+ {
+ // No other details
+ break;
+ }
+ case EMemSpyDriverContainerTypeChangeNotifier:
+ {
+ AppendFormatString( messagePtr, _L("\nChanges: %u\n"), selectedObject.iChanges );
+ // Thread == ThrdAddr
+ AppendFormatString( messagePtr, _L("ThrdAddr: 0x%08X\n"), selectedObject.iAddressOfOwningThread );
+ TFullName thrName;
+ thrName.Copy( selectedObject.iNameOfOwner );
+ AppendFormatString( messagePtr, _L("Thr: %S"), &thrName );
+ thrName.Zero();
+ break;
+ }
+ case EMemSpyDriverContainerTypeUndertaker:
+ {
+ // Thread == ThrdAddr
+ AppendFormatString( messagePtr, _L("\nThrdAddr: 0x%08X\n"), selectedObject.iAddressOfOwningThread );
+ TFullName thrName;
+ thrName.Copy( selectedObject.iNameOfOwner );
+ AppendFormatString( messagePtr, _L("Thr: %S"), &thrName );
+ thrName.Zero();
+ break;
+ }
+ case EMemSpyDriverContainerTypeMsgQueue:
+ {
+ // No other details
+ break;
+ }
+ case EMemSpyDriverContainerTypePropertyRef:
+ {
+ /*
+ Not listing details here, as propertyRef is not listed in TaskMgr.
+ Following propertyRef attributes are available at engine side.
+
+ IsReady
+ Type
+ Category
+ Key
+ RefCount
+ ThreadId
+ CreatorSID
+ */
+ break;
+ }
+ case EMemSpyDriverContainerTypeCondVar:
+ {
+ AppendFormatString( messagePtr, _L("\nResetting: %u\n"), selectedObject.iResetting );
+ // Using iAddressOfOwningThread for mutex
+ AppendFormatString( messagePtr, _L("Mutex: 0x%08X\n"), selectedObject.iAddressOfOwningThread );
+ // Using iNameOfOwner for mutex
+ TFullName mtxName;
+ mtxName.Copy( selectedObject.iNameOfOwner );
+ AppendFormatString( messagePtr, _L("Mtx: %S\n"), &mtxName );
+ mtxName.Zero();
+ AppendFormatString( messagePtr, _L("WaitCount: %d\n"), selectedObject.iWaitCount );
+
+ RArray<TMemSpyDriverCondVarSuspendedThreadInfo> threads;
+ CleanupClosePushL( threads );
+ iEngine.HelperCondVar().GetCondVarSuspendedThreadsL( selectedObject, threads );
+ const TInt count = threads.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ const TMemSpyDriverCondVarSuspendedThreadInfo& thr = threads[ i ];
+ AppendFormatString( messagePtr, _L("SuspThrdAddr: 0x%08X\n"), thr.iAddress );
+ TFullName thrName;
+ thrName.Copy( thr.iName );
+ AppendFormatString( messagePtr, _L("Thr: %S\n"), &thrName );
+ }
+ CleanupStack::PopAndDestroy( &threads );
+ break;
+ }
+ default:
+ {
+ // Programming error
+ __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) );
+ }
+ }
+
+ CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog( CAknQueryDialog::ENoTone );
+ dialog->PrepareLC( R_MEMSPY_KERNEL_OBJECT_DETAILS_DIALOG );
+ TFileName headerText;
+ headerText.Copy( selectedObject.iName );
+ dialog->SetHeaderTextL( headerText );
+ dialog->SetMessageTextL(messagePtr);
+ dialog->RunLD();
+ CleanupStack::PopAndDestroy( messageBuf );
+ }
+
+
+void CMemSpyViewKernelObjects::AppendFormatString( TPtr& aPtr, TRefByValue<const TDesC> aFmt, ... )
+ {
+ TBuf<KMaxInfoLength> infoString;
+ VA_LIST list;
+ VA_START ( list, aFmt );
+ infoString.FormatList( aFmt, list );
+ aPtr.Append( infoString );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewMainMenu.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,300 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewMainMenu.h"
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+
+// User includes
+#include "MemSpyContainerObserver.h"
+#include "MemSpyViewProcesses.h"
+#include "MemSpyViewRAMInfo.h"
+#include "MemSpyViewROMInfo.h"
+#include "MemSpyViewServerList.h"
+#include "MemSpyViewOpenFiles.h"
+#include "MemSpyViewFBServBitmaps.h"
+#include "MemSpyViewSystemConfig.h"
+#include "MemSpyViewCodeSegList.h"
+#include "MemSpyViewChunkList.h"
+#include "MemSpyViewKernel.h"
+#include "MemSpyViewHeapTracking.h"
+#include "MemSpyViewDriveInfo.h"
+#include "MemSpyViewECom.h"
+#include "MemSpyViewMemoryTrackingAutoStartConfig.h"
+#include "MemSpyViewWindowGroups.h"
+
+// System includes
+#include <aknnotewrappers.h>
+
+
+CMemSpyViewMainMenu::CMemSpyViewMainMenu( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+void CMemSpyViewMainMenu::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "MemSpy" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ // Make sure the correct item is selected
+ const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune);
+ const TInt index = IndexByViewType( viewType );
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+
+
+void CMemSpyViewMainMenu::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewMainMenu::ViewType() const
+ {
+ return EMemSpyViewTypeMainMenu;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewMainMenu::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+ const TInt index = iListBox->CurrentItemIndex();
+
+#ifdef __WINS__
+ // threads & process view is not supported in the emulator environment
+ if ( index == 0 )
+ {
+ CAknInformationNote* note = new (ELeave) CAknInformationNote;
+ note->ExecuteLD(_L("Not supported in the emulator, try Kernel -> Objects view"));
+ return NULL;
+ }
+#endif
+
+ if ( index == 0 )
+ {
+ child = new(ELeave) CMemSpyViewProcesses( iEngine, iObserver );
+ }
+ else if ( index == 1 )
+ {
+ child = new(ELeave) CMemSpyViewRAMInfo( iEngine, iObserver );
+ }
+ else if ( index == 2 )
+ {
+ child = new(ELeave) CMemSpyViewROMInfo( iEngine, iObserver );
+ }
+ else if ( index == 3 )
+ {
+ child = new(ELeave) CMemSpyViewFBServBitmaps( iEngine, iObserver );
+ }
+ else if ( index == 4 )
+ {
+ child = new(ELeave) CMemSpyViewServerList( iEngine, iObserver );
+ }
+ else if ( index == 5 )
+ {
+ child = new(ELeave) CMemSpyViewChunkList( iEngine, iObserver );
+ }
+ else if ( index == 6 )
+ {
+ child = new(ELeave) CMemSpyViewCodeSegList( iEngine, iObserver );
+ }
+ else if ( index == 7 )
+ {
+ child = new(ELeave) CMemSpyViewOpenFiles( iEngine, iObserver );
+ }
+ else if ( index == 8 )
+ {
+ child = new(ELeave) CMemSpyViewSystemConfig( iEngine, iObserver );
+ }
+ else if ( index == 9 )
+ {
+ child = new(ELeave) CMemSpyViewKernel( iEngine, iObserver );
+ }
+ else if ( index == 10 )
+ {
+ child = new(ELeave) CMemSpyViewHeapTracking( iEngine, iObserver );
+ }
+ else if ( index == 11 )
+ {
+ child = new(ELeave) CMemSpyViewMemoryTrackingAutoStartConfig( iEngine, iObserver );
+ }
+ else if ( index == 12 )
+ {
+ child = new(ELeave) CMemSpyViewDriveList( iEngine, iObserver );
+ }
+ else if ( index == 13 )
+ {
+ child = new(ELeave) CMemSpyViewECom( iEngine, iObserver );
+ }
+ else if ( index == 14 )
+ {
+ child = new(ELeave) CMemSpyViewWindowGroups( iEngine, iObserver );
+ }
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+void CMemSpyViewMainMenu::SetListBoxModelL()
+ {
+ CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
+ CleanupStack::PushL( model );
+
+ TBuf<KMaxFullName + 1> item;
+
+ // 1st item = Processes
+ _LIT(KItem1Format, "\tProcesses & Threads");
+ item.Format( KItem1Format );
+ model->AppendL( item );
+
+ // 2nd item = RAM info
+ _LIT(KItem2Format, "\tRAM Info");
+ model->AppendL( KItem2Format );
+
+ // 3rd item = ROM info
+ _LIT(KItem3Format, "\tROM Info");
+ model->AppendL( KItem3Format );
+
+ // 4th item = FBServ Bitmaps
+ _LIT(KItem4Format, "\tFont & Bitmap\nServer");
+ model->AppendL( KItem4Format );
+
+ // 5th item = Servers
+ _LIT(KItem5Format, "\tServers");
+ item.Format( KItem5Format);
+ model->AppendL( item );
+
+ // 6th item = Chunks
+ _LIT(KItem6Format, "\tChunks");
+ model->AppendL( KItem6Format );
+
+ // 7th item = Code Segments
+ _LIT(KItem7Format, "\tCode Segments");
+ model->AppendL( KItem7Format );
+
+ // 8th item = Open Files
+ _LIT(KItem8Format, "\tOpen Files");
+ model->AppendL( KItem8Format );
+
+ // 9th item = System Config
+ _LIT(KItem9Format, "\tSystem\nConfiguration");
+ model->AppendL( KItem9Format );
+
+ // 10th item = Kernel
+ _LIT(KItem10Format, "\tKernel");
+ model->AppendL( KItem10Format );
+
+ // 11th item = Heap Tracking
+ _LIT(KItem11Format, "\tSystem-Wide Memory Tracking");
+ model->AppendL( KItem11Format );
+
+ // 12th item = Process-specific Tracking
+ _LIT(KItem12Format, "\tProcess-Specific Memory Tracking");
+ model->AppendL( KItem12Format );
+
+ // 13th item = Drive Info
+ _LIT(KItem13Format, "\tDrive Summary");
+ model->AppendL( KItem13Format );
+
+ // 14th item = ECOM
+ _LIT(KItem14Format, "\tECom");
+ model->AppendL( KItem14Format );
+
+ // 15th item = Window Groups
+ _LIT(KItem15Format, "\tWindow Groups");
+ model->AppendL( KItem15Format );
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+ CleanupStack::Pop( model );
+ }
+
+
+TInt CMemSpyViewMainMenu::IndexByViewType( TMemSpyViewType aType )
+ {
+ TInt index = 0;
+ //
+ switch( aType )
+ {
+ default:
+ case EMemSpyViewTypeProcesses:
+ index = 0;
+ break;
+ case EMemSpyViewTypeRAMInfo:
+ index = 1;
+ break;
+ case EMemSpyViewTypeROMInfo:
+ index = 2;
+ break;
+ case EMemSpyViewTypeFBServBitmaps:
+ index = 3;
+ break;
+ case EMemSpyViewTypeServerList:
+ index = 4;
+ break;
+ case EMemSpyViewTypeChunkList:
+ index = 5;
+ break;
+ case EMemSpyViewTypeCodeSegmentList:
+ index = 6;
+ break;
+ case EMemSpyViewTypeOpenFiles:
+ index = 7;
+ break;
+ case EMemSpyViewTypeSystemConfig:
+ index = 8;
+ break;
+ case EMemSpyViewTypeKernel:
+ index = 9;
+ break;
+ case EMemSpyViewTypeHeapTracking:
+ index = 10;
+ break;
+ case EMemSpyViewTypeThreadInfoItemMemoryTrackingAutoStartConfig:
+ index = 11;
+ break;
+ case EMemSpyViewTypeDriveSummary:
+ index = 12;
+ break;
+ case EMemSpyViewTypeECom:
+ index = 13;
+ break;
+ case EMemSpyViewTypeWindowGroups:
+ index = 14;
+ break;
+ }
+ //
+ return index;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewMemoryTrackingAutoStartConfig.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,570 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewMemoryTrackingAutoStartConfig.h"
+
+// System includes
+#include <AknQueryDialog.h>
+#include <charconv.h>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyengineprocessmemorytracker.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyContainerObserver.h"
+
+// Literal constants
+_LIT8( KMemSpyProcessMemoryTrackerXmlFileMimeType, "text/xml" );
+_LIT8( KMemSpyXmlSpec_MasterSection, "memspy_process_memory_tracking" );
+_LIT8( KMemSpyXmlSpec_EntryProcess, "process" );
+_LIT8( KMemSpyXmlSpec_EntryProcess_SID, "sid" );
+_LIT8( KMemSpyXmlSpec_HexPrefix, "0x" );
+
+
+
+CMemSpyViewMemoryTrackingAutoStartConfig::CMemSpyViewMemoryTrackingAutoStartConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+CMemSpyViewMemoryTrackingAutoStartConfig::~CMemSpyViewMemoryTrackingAutoStartConfig()
+ {
+ iProcessUids.Close();
+ //
+ delete iParser;
+ delete iConverter;
+ //
+ delete iXMLFileNameInstallTime;
+ delete iXMLFileNameUserSupplied;
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ // We only convert from UTF-8 to UTF-16
+ iParser = CParser::NewL( KMemSpyProcessMemoryTrackerXmlFileMimeType, *this );
+ iConverter = CCnvCharacterSetConverter::NewL();
+ if ( iConverter->PrepareToConvertToOrFromL( KCharacterSetIdentifierUtf8, iEngine.FsSession() ) == CCnvCharacterSetConverter::ENotAvailable )
+ {
+ User::Leave(KErrNotFound);
+ }
+
+ // Search for standard files
+ FindXmlInstallTimeL();
+ FindXmlUserSuppliedL();
+
+ // Copy items to our own temporary list...
+ const RArray<TUid>& list = iEngine.HelperProcess().MemoryTrackingAutoStartProcessList();
+ for( TInt i=0; i<list.Count(); i++ )
+ {
+ User::LeaveIfError( iProcessUids.Append( list[ i ] ) );
+ }
+
+ // Reset the title
+ _LIT( KCustomTitle, "Process-Specific Memory Tracking" );
+ SetTitleL( KCustomTitle );
+ }
+
+
+TMemSpyViewType CMemSpyViewMemoryTrackingAutoStartConfig::ViewType() const
+ {
+ return EMemSpyViewTypeThreadInfoItemMemoryTrackingAutoStartConfig;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewMemoryTrackingAutoStartConfig::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+
+ return parent;
+ }
+
+
+TBool CMemSpyViewMemoryTrackingAutoStartConfig::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdMemoryTrackingAutoStartItemAdd:
+ OnCmdItemAddL();
+ break;
+ case EMemSpyCmdMemoryTrackingAutoStartItemEdit:
+ OnCmdItemEditL();
+ break;
+ case EMemSpyCmdMemoryTrackingAutoStartItemDelete:
+ OnCmdItemDeleteL();
+ break;
+ case EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll:
+ OnCmdItemDeleteAllL();
+ break;
+ case EMemSpyCmdMemoryTrackingAutoStartItemImport:
+ OnCmdItemImportL();
+ break;
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::HandleListBoxItemActionedL( TInt /*aIndex*/ )
+ {
+ OnCmdItemEditL();
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::SetListBoxModelL()
+ {
+ CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
+ CleanupStack::PushL( model );
+
+ TBuf<128> buf;
+ _LIT( KProcUidFormatSpec, "\t0x%08x" );
+
+ const TInt count = iProcessUids.Count();
+ for( TInt i=0; i<count; i++ )
+ {
+ const TUid procUid = iProcessUids[ i ];
+ //
+ buf.Format( KProcUidFormatSpec, procUid.iUid );
+ model->AppendL( buf );
+ }
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+ CleanupStack::Pop( model );
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ iListBox->HandleItemAdditionL();
+ iListBox->DrawDeferred();
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
+ {
+ if ( aResourceId == MenuCascadeResourceId() )
+ {
+ const TInt count = iProcessUids.Count();
+ const TInt index = iListBox->CurrentItemIndex();
+
+ // We cannot edit an item if none exists
+ aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemEdit, ( count == 0 || index < 0 || index > count - 1 ) );
+ aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemDelete, ( count == 0 || index < 0 || index > count - 1 ) );
+ aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll, ( count <= 1 || index > count - 1 ) );
+
+ // We can only import items if an XML file is available
+ const TBool xmlAvailable = ( iXMLFileNameInstallTime->Length() || iXMLFileNameUserSupplied->Length() );
+ aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemImport, !xmlAvailable );
+ }
+ }
+
+
+TUint CMemSpyViewMemoryTrackingAutoStartConfig::MenuCascadeResourceId() const
+ {
+ return R_MEMSPY_MENUPANE_MEMORY_TRACKING_AUTOSTART;
+ }
+
+
+TInt CMemSpyViewMemoryTrackingAutoStartConfig::MenuCascadeCommandId() const
+ {
+ return EMemSpyCmdMemoryTrackingAutoStart;
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemAddL()
+ {
+ const TUid uid = ShowDialogL( KNullUid );
+ if ( uid != KNullUid )
+ {
+ User::LeaveIfError( iProcessUids.Append( uid ) );
+ SaveChangesL();
+ RefreshL();
+ iListBox->HandleItemAdditionL();
+ iListBox->DrawDeferred();
+ }
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemEditL()
+ {
+ const TInt index = iListBox->CurrentItemIndex();
+ if ( index >= 0 && index < iProcessUids.Count() )
+ {
+ TUid processUid = iProcessUids[ index ];
+ processUid = ShowDialogL( processUid );
+ //
+ if ( processUid != KNullUid )
+ {
+ iProcessUids[ index ] = processUid;
+ SaveChangesL();
+ RefreshL();
+ iListBox->HandleItemAdditionL();
+ iListBox->DrawDeferred();
+ }
+ }
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemDeleteL()
+ {
+ const TInt index = iListBox->CurrentItemIndex();
+ if ( index >= 0 && index < iProcessUids.Count() )
+ {
+ iProcessUids.Remove( index );
+ SaveChangesL();
+ RefreshL();
+ iListBox->HandleItemRemovalL();
+ iListBox->DrawDeferred();
+
+ const TInt newIndex = index - 1;
+ const TInt count = iProcessUids.Count();
+ if ( newIndex >=0 && newIndex < count )
+ {
+ iListBox->SetCurrentItemIndex( index );
+ }
+ }
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemDeleteAllL()
+ {
+ iProcessUids.Reset();
+ SaveChangesL();
+ RefreshL();
+ iListBox->HandleItemRemovalL();
+ iListBox->DrawDeferred();
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemImportL()
+ {
+ if ( iXMLFileNameInstallTime->Length() )
+ {
+ CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
+ if ( importDialog->ExecuteLD( R_MEMSPY_MEMORY_TRACKING_IMPORT_FROM_INSTALLED_XML_DIALOG ) )
+ {
+ TRAP_IGNORE( ParseL( *iXMLFileNameInstallTime ) );
+ }
+ }
+ if ( iXMLFileNameUserSupplied->Length() )
+ {
+ CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
+ if ( importDialog->ExecuteLD( R_MEMSPY_MEMORY_TRACKING_IMPORT_FROM_USERDEFINED_XML_DIALOG ) )
+ {
+ TRAP_IGNORE( ParseL( *iXMLFileNameUserSupplied ) );
+ }
+ }
+
+ SaveChangesL();
+ RefreshL();
+ iListBox->HandleItemRemovalL();
+ iListBox->DrawDeferred();
+ }
+
+
+TUid CMemSpyViewMemoryTrackingAutoStartConfig::ShowDialogL( TUid aUid )
+ {
+ TUid uid = KNullUid;
+ //
+ _LIT( KProcessUidFormat, "%x" );
+ TBuf<128> buf;
+ buf.Format( KProcessUidFormat, aUid );
+ //
+ CAknTextQueryDialog* dialog = new(ELeave) CAknTextQueryDialog( buf );
+ const TBool dialogActioned = ( dialog->ExecuteLD( R_MEMSPY_MEMORY_TRACKING_PROCESS_UID_DIALOG ) );
+ //
+ if ( dialogActioned )
+ {
+ // Validate the text
+ uid = ValidateProcessUid( buf );
+ }
+ //
+ return uid;
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::SaveChangesL()
+ {
+ iEngine.HelperProcess().SetMemoryTrackingAutoStartProcessListL( iProcessUids );
+ Settings().StoreSettingsL();
+ }
+
+
+TUid CMemSpyViewMemoryTrackingAutoStartConfig::ValidateProcessUid( const TDesC& aUid )
+ {
+ TUid ret = KNullUid;
+ TBool isValid = ETrue;
+ //
+ const TInt length = aUid.Length();
+ for( TInt i=0; i<length && isValid; i++ )
+ {
+ const TChar charValue = aUid[ i ];
+ //
+ switch( charValue )
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case 'a':
+ case 'A':
+ case 'b':
+ case 'B':
+ case 'c':
+ case 'C':
+ case 'd':
+ case 'D':
+ case 'e':
+ case 'E':
+ case 'f':
+ case 'F':
+ break;
+ default:
+ isValid = EFalse;
+ break;
+ }
+ }
+ //
+ if ( isValid )
+ {
+ TUint32 val = 0;
+ TLex lexer( aUid );
+ if ( lexer.Val( val, EHex ) == KErrNone )
+ {
+ ret.iUid = val;
+ }
+ }
+ //
+ return ret;
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::FindXmlInstallTimeL()
+ {
+ RFs& fsSession = iEngine.FsSession();
+ //
+ TFileName* fileName = new(ELeave) TFileName();
+ CleanupStack::PushL( fileName );
+ //
+ fsSession.PrivatePath( *fileName );
+ //
+ TFindFile findFile( fsSession );
+ if ( findFile.FindByPath( KMemSpyProcessMemoryTrackingAutoStartConfigFileName, fileName ) == KErrNone )
+ {
+ iXMLFileNameInstallTime = findFile.File().AllocL();
+ }
+ else
+ {
+ iXMLFileNameInstallTime = KNullDesC().AllocL();
+ RDebug::Print( _L("CMemSpyViewMemoryTrackingAutoStartConfig::FindXmlInstallTimeL() - NO FILE FOUND") );
+ }
+ //
+ CleanupStack::PopAndDestroy( fileName );
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::FindXmlUserSuppliedL()
+ {
+ TFindFile findFile( iEngine.FsSession() );
+ if ( findFile.FindByPath( KMemSpyProcessMemoryTrackingAutoStartConfigFileName, &KMemSpyProcessMemoryTrackingAutoStartConfigSearchPath ) == KErrNone )
+ {
+ iXMLFileNameUserSupplied = findFile.File().AllocL();
+ }
+ else
+ {
+ iXMLFileNameUserSupplied = KNullDesC().AllocL();
+ RDebug::Print( _L("CMemSpyViewMemoryTrackingAutoStartConfig::FindXmlUserSuppliedL() - NO FILE FOUND") );
+ }
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::ParseL( const TDesC& aFileName )
+ {
+ Xml::ParseL( *iParser, iEngine.FsSession(), aFileName );
+ //
+ const TInt error = iParserErrorCode;
+ iParserErrorCode = KErrNone;
+ //
+ User::LeaveIfError( error );
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnSectionProcessL( const RAttributeArray& aAttributes )
+ {
+ TUid uid = KNullUid;
+ TBool gotSID = EFalse;
+ //
+ const TInt count = aAttributes.Count();
+ for( TInt i=0; i<count; i++ )
+ {
+ const TPtrC8 attrib( aAttributes[ i ].Attribute().LocalName().DesC() );
+ const TPtrC8 value( aAttributes[ i ].Value().DesC() );
+ //
+ if ( attrib.CompareF( KMemSpyXmlSpec_EntryProcess_SID ) == 0 )
+ {
+ if ( gotSID )
+ {
+ User::LeaveIfError( KErrCorrupt );
+ }
+ else
+ {
+ if ( value.Length() >= 8 )
+ {
+ TRadix radix = EDecimal;
+ TPtrC8 pValue( value );
+ //
+ if ( value.Length() == 10 && value.Left( 2 ) == KMemSpyXmlSpec_HexPrefix )
+ {
+ pValue.Set( value.Mid( 2 ) );
+ radix = EHex;
+ }
+ //
+ TUint32 uidVal = 0;
+ TLex8 lexer( pValue );
+ const TInt err = lexer.Val( uidVal, radix );
+ User::LeaveIfError( err );
+ uid.iUid = uidVal;
+ gotSID = ETrue;
+ }
+ }
+ }
+ }
+ //
+ if ( gotSID )
+ {
+ User::LeaveIfError( iProcessUids.Append( uid ) );
+ }
+ else
+ {
+ User::Leave( KErrCorrupt );
+ }
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnStartDocumentL( const RDocumentParameters& /*aDocParam*/, TInt aErrorCode )
+ {
+ User::LeaveIfError( aErrorCode );
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnEndDocumentL( TInt aErrorCode )
+ {
+ User::LeaveIfError( aErrorCode );
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode )
+ {
+ User::LeaveIfError( aErrorCode );
+ //
+ const TPtrC8 name( aElement.LocalName().DesC() );
+ //
+ if ( name.CompareF( KMemSpyXmlSpec_MasterSection ) == 0 )
+ {
+ iSeenMasterSection = ETrue;
+ }
+ else if ( iSeenMasterSection && name.CompareF( KMemSpyXmlSpec_EntryProcess ) == 0 )
+ {
+ OnSectionProcessL( aAttributes );
+ }
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnEndElementL( const RTagInfo& /*aElement*/, TInt aErrorCode )
+ {
+ User::LeaveIfError( aErrorCode );
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnContentL( const TDesC8& /*aBytes*/, TInt aErrorCode )
+ {
+ User::LeaveIfError( aErrorCode );
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnStartPrefixMappingL( const RString& /*aPrefix*/, const RString& /*aUri*/, TInt aErrorCode )
+ {
+ User::LeaveIfError( aErrorCode );
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnEndPrefixMappingL( const RString& /*aPrefix*/, TInt aErrorCode )
+ {
+ User::LeaveIfError( aErrorCode );
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnIgnorableWhiteSpaceL( const TDesC8& /*aBytes*/, TInt aErrorCode )
+ {
+ User::LeaveIfError( aErrorCode );
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnSkippedEntityL( const RString& /*aName*/, TInt aErrorCode )
+ {
+ User::LeaveIfError( aErrorCode );
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnProcessingInstructionL( const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, TInt aErrorCode )
+ {
+ User::LeaveIfError( aErrorCode );
+ }
+
+
+void CMemSpyViewMemoryTrackingAutoStartConfig::OnError( TInt aErrorCode )
+ {
+ iParserErrorCode = aErrorCode;
+ }
+
+
+TAny* CMemSpyViewMemoryTrackingAutoStartConfig::GetExtendedInterface( const TInt32 /*aUid*/ )
+ {
+ return NULL;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewOpenFiles.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,274 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewOpenFiles.h"
+
+// System includes
+#include <AknIconArray.h>
+#include <eikdef.h>
+#include <eikclbd.h>
+#include <aknconsts.h>
+#include <gulicon.h>
+#include <avkon.mbg>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewThreads.h"
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyContainerObserver.h"
+
+
+
+
+CMemSpyViewOpenFiles::CMemSpyViewOpenFiles( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+CMemSpyViewOpenFiles::~CMemSpyViewOpenFiles()
+ {
+ iThreadIds.Close();
+ iFileNames.Close();
+ }
+
+
+void CMemSpyViewOpenFiles::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Open Files" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+CEikListBox* CMemSpyViewOpenFiles::ConstructListBoxL()
+ {
+ delete iListBox;
+ iListBox = NULL;
+ CAknDoubleGraphicStyleListBox* listbox = new (ELeave) CAknDoubleGraphicStyleListBox();
+ iListBox = listbox;
+ //
+ listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling );
+ listbox->SetContainerWindowL( *this );
+ listbox->CreateScrollBarFrameL( ETrue );
+ SetListBoxModelL();
+ listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+ listbox->SetListBoxObserver( this );
+ listbox->SetObserver( this );
+
+ // Create icon array
+ CAknIconArray* iconArray = new (ELeave) CAknIconArray(1);
+ CleanupStack::PushL( iconArray );
+
+ // Create bitmap
+ CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
+ CleanupStack::PushL( bitmap );
+ const TInt error1 = bitmap->Create( TSize(10,10), EColor16M );
+ User::LeaveIfError( error1 );
+
+ // Create mask
+ CFbsBitmap* mask = new(ELeave) CFbsBitmap();
+ CleanupStack::PushL( mask );
+ const TInt error2 = mask->Create( TSize(10,10), EColor16M );
+ User::LeaveIfError( error2 );
+
+ // Create icon & transfer bitmap
+ CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
+ CleanupStack::Pop( 2, bitmap );
+ CleanupStack::PushL( icon );
+
+ // Transfer icon to array
+ iconArray->AppendL( icon );
+ CleanupStack::Pop( icon );
+
+ // Give icon array to listbox
+ static_cast<CEikFormattedCellListBox*>(iListBox)->ItemDrawer()->FormattedCellData()->SetIconArrayL(iconArray);
+ CleanupStack::Pop( iconArray );
+ //
+ return listbox;
+ }
+
+
+void CMemSpyViewOpenFiles::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewOpenFiles::ViewType() const
+ {
+ return EMemSpyViewTypeOpenFiles;
+ }
+
+
+TBool CMemSpyViewOpenFiles::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdToolsListOpenFiles:
+ OnCmdListOpenFilesL();
+ break;
+
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewOpenFiles::OnCmdListOpenFilesL()
+ {
+ iEngine.ListOpenFilesL();
+ }
+
+
+CMemSpyViewBase* CMemSpyViewOpenFiles::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewOpenFiles::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+
+ // First, try to find the selected thread
+ if ( iActionedThreadId )
+ {
+ // Try to create a view of the thread in question
+ CMemSpyProcess* process = NULL;
+ CMemSpyThread* thread = NULL;
+ const TInt error = iEngine.Container().ProcessAndThreadByThreadId( *iActionedThreadId, process, thread );
+ if ( error == KErrNone && thread != NULL )
+ {
+ child = new(ELeave) CMemSpyViewThreads( iEngine, iObserver, thread->Process() );
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent(), thread );
+ CleanupStack::Pop( child );
+ }
+ }
+ //
+ return child;
+ }
+
+
+void CMemSpyViewOpenFiles::SetListBoxModelL()
+ {
+ _LIT(KLineFormatSpec, "%d\t%S\t%S %S");
+
+ CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
+ CleanupStack::PushL( model );
+
+ TBuf<KMaxFullName + 50> item;
+ TMemSpySizeText valueBuf;
+ TBuf<64> timeBuf;
+
+ iFileNames.Reset();
+ iThreadIds.Reset();
+ iActionedThreadId = NULL;
+
+ RFs& fsSession = iCoeEnv->FsSession();
+ TOpenFileScan scanner( fsSession );
+
+ CFileList* list = NULL;
+ scanner.NextL( list );
+
+ TIdentityRelation<TEntry> comparer( CompareTEntryObjects );
+
+ while( list != NULL )
+ {
+ CleanupStack::PushL( list );
+
+ const TInt entryCount = list->Count();
+ for(TInt i=0; i<entryCount; i++)
+ {
+ const TEntry& entry = (*list)[ i ];
+
+ // Check for duplicates
+ const TInt foundIndex = iFileNames.Find( entry, comparer );
+ if ( foundIndex == KErrNotFound )
+ {
+ // Get time and size format strings
+ valueBuf = MemSpyUiUtils::FormatSizeText( entry.iSize );
+ MemSpyUiUtils::FormatTimeL( timeBuf, entry.iModified );
+
+ // Get just file name
+ TParsePtrC parser( entry.iName );
+ const TPtrC pJustName( parser.NameAndExt() );
+
+ // Create item
+ item.Format( KLineFormatSpec, 0, &pJustName, &valueBuf, &timeBuf );
+ model->AppendL( item );
+ iThreadIds.AppendL( scanner.ThreadId() );
+ iFileNames.AppendL( entry );
+ }
+ }
+
+ CleanupStack::PopAndDestroy( list );
+ list = NULL;
+ scanner.NextL( list );
+ }
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+ CleanupStack::Pop( model );
+ }
+
+
+void CMemSpyViewOpenFiles::HandleListBoxItemActionedL( TInt aCurrentIndex )
+ {
+ if ( aCurrentIndex >= 0 && aCurrentIndex < iThreadIds.Count() )
+ {
+ iActionedThreadId = &iThreadIds[ aCurrentIndex ];
+ }
+ else
+ {
+ iActionedThreadId = NULL;
+ }
+
+ // Notify observer about an item being 'fired'
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+TBool CMemSpyViewOpenFiles::CompareTEntryObjects( const TEntry& aLeft, const TEntry& aRight )
+ {
+ return ( aLeft.iName.CompareF( aRight.iName ) == 0 );
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewProcesses.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,513 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewProcesses.h"
+
+// System includes
+#include <aknsfld.h>
+#include <AknQueryDialog.h>
+#include <memspyui.rsg>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+
+// User includes
+#include "MemSpyViewThreads.h"
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyContainerObserver.h"
+
+// Constants
+const TInt KMemSpyMaxSearchTextLength = 30;
+const TInt KMemSpyMaxSearchTextLengthWithWildcards = KMemSpyMaxSearchTextLength + 4;
+
+
+
+CMemSpyViewProcesses::CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+CMemSpyViewProcesses::CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess )
+: CMemSpyViewBase( aEngine, aObserver ), iCurrentProcess( &aProcess )
+ {
+ iCurrentProcess->Open();
+ }
+
+
+CMemSpyViewProcesses::~CMemSpyViewProcesses()
+ {
+ if ( iCurrentProcess )
+ {
+ iCurrentProcess->Close();
+ }
+ //
+ delete iSearchField;
+ delete iMatcherBuffer;
+ }
+
+
+void CMemSpyViewProcesses::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Processes\n& Threads" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ //
+ iMatcherBuffer = HBufC::NewL( KMemSpyMaxSearchTextLengthWithWildcards );
+ //
+ iSearchField = CAknSearchField::NewL( *this, CAknSearchField::ESearch, NULL, KMemSpyMaxSearchTextLength );
+ iSearchField->SetObserver( this );
+ iSearchField->SetFocus( ETrue );
+ iSearchField->SetComponentsToInheritVisibility( ETrue );
+ //
+ CMemSpyEngineObjectContainer& container = iEngine.Container();
+ if ( aSelectionRune )
+ {
+ CMemSpyProcess* selectedItem = reinterpret_cast< CMemSpyProcess* >( aSelectionRune );
+ const TInt index = container.ProcessIndexById( selectedItem->Id() );
+ if ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
+ {
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+ }
+ else if ( container.Count() > 0 )
+ {
+ iListBox->SetCurrentItemIndex( 0 );
+ HandleListBoxItemSelectedL( 0 );
+ }
+ //
+ SizeChanged();
+ ActivateL();
+ }
+
+
+CMemSpyProcess& CMemSpyViewProcesses::CurrentProcess() const
+ {
+ __ASSERT_ALWAYS( iCurrentProcess != NULL, User::Invariant() );
+ return *iCurrentProcess;
+ }
+
+
+void CMemSpyViewProcesses::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewProcesses::ViewType() const
+ {
+ return EMemSpyViewTypeProcesses;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewProcesses::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewProcesses::PrepareChildViewL()
+ {
+ CMemSpyViewThreads* child = new(ELeave) CMemSpyViewThreads( iEngine, iObserver, *iCurrentProcess );
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+void CMemSpyViewProcesses::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
+ {
+ if ( aResourceId == MenuCascadeResourceId() )
+ {
+ CMemSpyProcess& process = CurrentProcess();
+ const TBool hide = ( iEngine.Container().Count() == 0 ) || process.IsDead();
+ //
+ aMenuPane->SetItemDimmed( EMemSpyCmdProcessInfo, hide );
+ aMenuPane->SetItemDimmed( EMemSpyCmdProcessEnd, hide );
+ }
+ }
+
+
+TBool CMemSpyViewProcesses::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ // Sorting
+ case EMemSpyCmdProcessSortById:
+ OnCmdSortByIdL();
+ break;
+ case EMemSpyCmdProcessSortByName:
+ OnCmdSortByNameL();
+ break;
+ case EMemSpyCmdProcessSortByThreadCount:
+ OnCmdSortByThreadCountL();
+ break;
+ case EMemSpyCmdProcessSortByCodeSegs:
+ OnCmdSortByCodeSegsL();
+ break;
+ case EMemSpyCmdProcessSortByHeapUsage:
+ OnCmdSortByHeapUsageL();
+ break;
+ case EMemSpyCmdProcessSortByStackUsage:
+ OnCmdSortByStackUsageL();
+ break;
+ // End
+ case EMemSpyCmdProcessEndTerminate:
+ OnCmdEndTerminateL();
+ break;
+ case EMemSpyCmdProcessEndKill:
+ OnCmdEndKillL();
+ break;
+ case EMemSpyCmdProcessEndPanic:
+ OnCmdEndPanicL();
+ break;
+ // Info
+ case EMemSpyCmdProcessInfoSummary:
+ OnCmdInfoSummaryL();
+ break;
+ case EMemSpyCmdProcessInfoHandles:
+ OnCmdInfoHandlesL();
+ break;
+
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewProcesses::OnCmdSortByIdL()
+ {
+ iEngine.Container().SortById();
+ RefreshL();
+ }
+
+
+void CMemSpyViewProcesses::OnCmdSortByNameL()
+ {
+ iEngine.Container().SortByName();
+ RefreshL();
+ }
+
+
+void CMemSpyViewProcesses::OnCmdSortByThreadCountL()
+ {
+ iEngine.Container().SortByThreadCount();
+ RefreshL();
+ }
+
+
+void CMemSpyViewProcesses::OnCmdSortByCodeSegsL()
+ {
+ iEngine.Container().SortByCodeSegs();
+ RefreshL();
+ }
+
+
+void CMemSpyViewProcesses::OnCmdSortByHeapUsageL()
+ {
+ iEngine.Container().SortByHeapUsage();
+ RefreshL();
+ }
+
+
+void CMemSpyViewProcesses::OnCmdSortByStackUsageL()
+ {
+ iEngine.Container().SortByStackUsage();
+ RefreshL();
+ }
+
+
+void CMemSpyViewProcesses::OnCmdInfoSummaryL()
+ {
+ CMemSpyProcess& process = CurrentProcess();
+ iEngine.HelperProcess().OutputProcessInfoL( process );
+ }
+
+
+void CMemSpyViewProcesses::OnCmdInfoHandlesL()
+ {
+ CMemSpyProcess& process = CurrentProcess();
+ //
+ const TInt threadCount = process.Count();
+ for( TInt i=0; i<threadCount; i++ )
+ {
+ CMemSpyThread& thread = process.At( i );
+ thread.InfoContainerForceSyncronousConstructionL().PrintL();
+ }
+ }
+
+
+void CMemSpyViewProcesses::OnCmdEndTerminateL()
+ {
+ TBool doTerminate = ETrue;
+ CMemSpyProcess& process = CurrentProcess();
+ //
+ if ( process.IsSystemPermanent() || process.IsSystemCritical() )
+ {
+ CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
+ doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
+ }
+ //
+ if ( doTerminate )
+ {
+ process.TerminateL();
+ RefreshL();
+ }
+ }
+
+
+void CMemSpyViewProcesses::OnCmdEndPanicL()
+ {
+ TBool doTerminate = ETrue;
+ CMemSpyProcess& process = CurrentProcess();
+ //
+ 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();
+ }
+ }
+
+
+void CMemSpyViewProcesses::OnCmdEndKillL()
+ {
+ TBool doTerminate = ETrue;
+ CMemSpyProcess& process = CurrentProcess();
+ //
+ if ( process.IsSystemPermanent() || process.IsSystemCritical() )
+ {
+ CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
+ doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
+ }
+ //
+ if ( doTerminate )
+ {
+ process.KillL();
+ RefreshL();
+ }
+ }
+
+
+
+
+void CMemSpyViewProcesses::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( &iEngine.Container() );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewProcesses::HandleListBoxItemActionedL( TInt /*aIndex*/ )
+ {
+ // Notify observer about an item being 'fired'
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewProcesses::HandleListBoxItemSelectedL( TInt aIndex )
+ {
+ if ( iCurrentProcess )
+ {
+ iCurrentProcess->Close();
+ }
+
+ // Obtain the process that corresponds to the selected item
+ CMemSpyEngineObjectContainer& container = iEngine.Container();
+ CMemSpyProcess& process = container.At( aIndex );
+ iCurrentProcess = &process;
+ iCurrentProcess->Open();
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+void CMemSpyViewProcesses::SizeChanged()
+ {
+ const TRect rect( Rect() );
+
+ if ( iListBox && iSearchField )
+ {
+ const TInt lafIndex_H = 1;
+ AknLayoutUtils::LayoutControl( iListBox, rect, AknLayout::list_gen_pane( lafIndex_H ) );
+ AknLayoutUtils::LayoutControl( iSearchField, rect, AknLayout::find_pane() );
+ }
+ else
+ {
+ CMemSpyViewBase::SizeChanged();
+ }
+
+/*
+ // Search field
+ TSize searchFieldSize( iSearchField->MinimumSize() ); // BALLS: search field doesn't implement minimum size correctly?!?!?
+ searchFieldSize.SetWidth( rect.Width() );
+ const TRect searchFieldRect( TPoint( rect.iTl.iX, rect.iBr.iY ), searchFieldSize );
+ iSearchField->SetRect( searchFieldRect );
+
+ // Listbox
+ TSize listBoxSize( rect.Size() - TSize( 0, searchFieldSize.iHeight ) );
+ iListBox->SetRect( rect.iTl, listBoxSize );
+*/
+ }
+
+
+TInt CMemSpyViewProcesses::CountComponentControls() const
+ {
+ TInt count = 0;
+ //
+ if ( iListBox != NULL )
+ {
+ ++count;
+ }
+ if ( iSearchField != NULL )
+ {
+ ++count;
+ }
+ //
+ return count;
+ }
+
+
+CCoeControl* CMemSpyViewProcesses::ComponentControl( TInt aIndex ) const
+ {
+ CCoeControl* ret = iListBox;
+ //
+ if ( aIndex == 1 )
+ {
+ ret = iSearchField;
+ }
+ //
+ return ret;
+ }
+
+
+TKeyResponse CMemSpyViewProcesses::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
+ {
+ TKeyResponse resp = EKeyWasNotConsumed;
+ //
+ if ( aType == EEventKey )
+ {
+ switch( aKeyEvent.iCode )
+ {
+ case EKeyUpArrow:
+ case EKeyDownArrow:
+ case EKeyEnter:
+ case EKeyOK:
+ if ( iListBox )
+ {
+ resp = iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ break;
+ default:
+ break;
+ }
+ //
+ if ( resp == EKeyWasNotConsumed )
+ {
+ // Do we need to show the find field?
+ resp = iSearchField->OfferKeyEventL( aKeyEvent, aType );
+ }
+ }
+ //
+ return resp;
+ }
+
+
+void CMemSpyViewProcesses::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
+ {
+ CMemSpyViewBase::HandleControlEventL( aControl, aEventType );
+ //
+ if ( aEventType == MCoeControlObserver::EEventStateChanged )
+ {
+ if ( aControl == iSearchField )
+ {
+ SelectListBoxItemByFindTextL();
+ }
+ }
+ }
+
+
+void CMemSpyViewProcesses::FocusChanged( TDrawNow /*aDrawNow*/ )
+ {
+ if ( iListBox )
+ {
+ iListBox->SetFocus( IsFocused() );
+ }
+ if ( iSearchField )
+ {
+ iSearchField->SetFocus( IsFocused() );
+ }
+ }
+
+
+void CMemSpyViewProcesses::SelectListBoxItemByFindTextL()
+ {
+ _LIT( KMemSpyWildcardCharacter, "*" );
+
+ TPtr pBuffer( iMatcherBuffer->Des() );
+ iSearchField->GetSearchText( pBuffer );
+ //pBuffer.Insert( 0, KMemSpyWildcardCharacter );
+ pBuffer.Append( KMemSpyWildcardCharacter );
+
+ CMemSpyEngineObjectContainer& container = iEngine.Container();
+ const TInt count = container.Count();
+ //
+ TInt index = 0;
+ while( index < count )
+ {
+ CMemSpyProcess& process = container.At( index );
+ const TPtrC processName( process.Name() );
+ //
+ if ( processName.MatchF( pBuffer ) >= 0 )
+ {
+ HandleListBoxItemSelectedL( index );
+ iListBox->ScrollToMakeItemVisible( index );
+ iListBox->SetCurrentItemIndexAndDraw( index );
+ return;
+ }
+
+ ++index;
+ }
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewRAMInfo.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,211 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewRAMInfo.h"
+
+// System includes
+#include <hal.h>
+#include <aknnotedialog.h>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperram.h>
+#include <memspy/engine/memspyengineutils.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyContainerObserver.h"
+
+
+
+
+
+
+CMemSpyViewRAMInfo::CMemSpyViewRAMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+void CMemSpyViewRAMInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "RAM Info" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+void CMemSpyViewRAMInfo::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewRAMInfo::ViewType() const
+ {
+ return EMemSpyViewTypeRAMInfo;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewRAMInfo::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewRAMInfo::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+ return child;
+ }
+
+
+void CMemSpyViewRAMInfo::SetListBoxModelL()
+ {
+ CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
+ CleanupStack::PushL( model );
+
+ TBuf<KMaxFullName + 1> item;
+
+ TInt value;
+ TMemSpySizeText size;
+ TMemoryInfoV1Buf memInfoBuf;
+ UserHal::MemoryInfo( memInfoBuf );
+ const TMemoryInfoV1 memInfo( memInfoBuf() );
+
+ // 1st item = Total RAM
+ _LIT(KItem1Format, "\tTotal RAM\t\t%S");
+ size = MemSpyUiUtils::FormatSizeText( memInfo.iTotalRamInBytes );
+ item.Format( KItem1Format, &size );
+ model->AppendL( item );
+
+ // 2nd item = Max free RAM
+ _LIT(KItem2Format, "\tMax Free RAM\t\t%S");
+ size = MemSpyUiUtils::FormatSizeText( memInfo.iMaxFreeRamInBytes );
+ item.Format( KItem2Format, &size );
+ model->AppendL( item );
+
+ // 3rd item = Free RAM
+ _LIT(KItem3Format, "\tFree RAM\t\t%S (%S)");
+ const TMemSpyPercentText freeRamPercentage( MemSpyEngineUtils::FormatPercentage( TReal( memInfo.iTotalRamInBytes ), TReal( memInfo.iFreeRamInBytes ) ) );
+ size = MemSpyUiUtils::FormatSizeText( memInfo.iFreeRamInBytes );
+ item.Format( KItem3Format, &size, &freeRamPercentage );
+ model->AppendL( item );
+
+ // 4th item = RAM disk info
+ _LIT(KItem4Format, "\tRAM Disk Size\t\t%S");
+ size = MemSpyUiUtils::FormatSizeText( memInfo.iInternalDiskRamInBytes );
+ item.Format( KItem4Format, &size );
+ model->AppendL( item );
+
+ // 5th item = Max RAM disk size
+ _LIT(KItem5Format, "\tMax RAM Disk Size\t\t%S");
+ HAL::Get( HALData::EMaxRAMDriveSize, value );
+ size = MemSpyUiUtils::FormatSizeText( value );
+ item.Format( KItem5Format, &size );
+ model->AppendL( item );
+
+ // 6th item = RAM page size
+ _LIT(KItem6Format, "\tMemory Page Size\t\t%S");
+ HAL::Get( HALData::EMemoryPageSize, value );
+ size = MemSpyUiUtils::FormatSizeText( value );
+ item.Format( KItem6Format, &size );
+ model->AppendL( item );
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+ CleanupStack::Pop( model );
+ }
+
+
+TBool CMemSpyViewRAMInfo::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ if ( iEngine.HelperRAM().IsAknIconCacheConfigurable() )
+ {
+ switch ( aCommand )
+ {
+ case EMemSpyCmdRAMAvkonIconCacheDisabled:
+ OnCmdSetIconCacheStatusL( EFalse );
+ break;
+ case EMemSpyCmdRAMAvkonIconCacheEnabled:
+ OnCmdSetIconCacheStatusL( ETrue );
+ break;
+
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ }
+ else
+ {
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewRAMInfo::OnCmdSetIconCacheStatusL( TBool aEnabled )
+ {
+ ASSERT( iEngine.HelperRAM().IsAknIconCacheConfigurable() );
+ //
+ const TInt64 savedAmount = iEngine.HelperRAM().SetAknIconCacheStatusL( aEnabled );
+ if ( !aEnabled )
+ {
+ TBuf<128> buf;
+ //
+ if ( savedAmount != 0 )
+ {
+ _LIT(KSavedAmountFormatBuffer, "Saved %S of RAM");
+ const TMemSpySizeText savedAmountString( MemSpyEngineUtils::FormatSizeText( savedAmount, 0, EFalse ) );
+ buf.Format( KSavedAmountFormatBuffer, &savedAmountString );
+ }
+ else
+ {
+ _LIT(KDidNotSaveAnyRAM, "Operation did not save any RAM");
+ buf.Copy( KDidNotSaveAnyRAM );
+ }
+
+ // Show dialog
+ CAknNoteDialog* note = new( ELeave ) CAknNoteDialog( CAknNoteDialog::ENoTone );
+ CleanupStack::PushL( note );
+ note->SetTextWrapping( ETrue );
+ note->PrepareLC( R_MEMSPY_RAM_MEMORY_DELTA_DIALOG );
+ note->SetTextL( buf );
+ CleanupStack::Pop( note );
+ note->RunLD();
+ }
+ //
+ RefreshL();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewROMInfo.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,270 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewROMInfo.h"
+
+// System includes
+#include <hal.h>
+#ifdef __EPOC32__
+#include <e32rom.h>
+#endif
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyContainerObserver.h"
+
+// Remap of E32 DP constants, needed so MemSpy can still build on v9.1
+enum TMemSpyDemandPagingKernelConfigFlags
+ {
+ EMemSpyKernelConfigPagingPolicyMask = 3<<5,
+ EMemSpyKernelConfigPagingPolicyNoPaging = 0<<5,
+ EMemSpyKernelConfigPagingPolicyAlwaysPage = 1<<5,
+ EMemSpyKernelConfigPagingPolicyDefaultUnpaged = 2<<5,
+ EMemSpyKernelConfigPagingPolicyDefaultPaged = 3<<5,
+ };
+
+
+
+CMemSpyViewROMInfo::CMemSpyViewROMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+void CMemSpyViewROMInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "ROM Info" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+void CMemSpyViewROMInfo::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewROMInfo::ViewType() const
+ {
+ return EMemSpyViewTypeROMInfo;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewROMInfo::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewROMInfo::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+ return child;
+ }
+
+
+void CMemSpyViewROMInfo::SetListBoxModelL()
+ {
+ CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
+ CleanupStack::PushL( model );
+
+ TBuf<KMaxFullName + 1> item;
+
+ TInt value = 0;
+ TMemSpySizeText valueBuf;
+ TMemSpySizeText valueBuf2;
+
+ // 1st item = Total RAM
+ _LIT(KItem1Format, "\tROM Size (HAL)\t\t%S");
+ HAL::Get( HALData::EMemoryROM, value );
+ valueBuf = MemSpyUiUtils::FormatSizeText( value );
+ item.Format( KItem1Format, &valueBuf );
+ model->AppendL( item );
+
+#ifdef __EPOC32__
+ TBuf<128> buf2;
+ _LIT( KTimeFormatSpecLocal, "%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B" );
+ const TUint main_start = UserSvr::RomHeaderAddress();
+ TRomHeader* romHeader = (TRomHeader*) main_start;
+
+ _LIT(KItem2Format, "\tROM Size (Header)\t\t%S");
+ valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iRomSize ) );
+ item.Format( KItem2Format, &valueBuf );
+ model->AppendL( item );
+
+ _LIT(KItem2aFormat, "\tROM Page Size\t\t%S");
+ HAL::Get( HALData::EMemoryPageSize, value );
+ valueBuf = MemSpyUiUtils::FormatSizeText( value );
+ item.Format( KItem2aFormat, &valueBuf );
+ model->AppendL( item );
+
+ _LIT(KItem10Format, "\tVersion\t\tv%2d.%02d.%06d");
+ item.Format( KItem10Format, romHeader->iVersion.iMajor, romHeader->iVersion.iMinor, romHeader->iVersion.iBuild );
+ model->AppendL( item );
+
+ _LIT(KItem3Format, "\tTimestamp\t\t%S");
+ TTime time( romHeader->iTime );
+ time.FormatL( buf2, KTimeFormatSpecLocal );
+ item.Format( KItem3Format, &buf2 );
+ model->AppendL( item );
+
+ _LIT(KItem4Format, "\tAddress Range\t\t%S - %S");
+ MemSpyUiUtils::FormatHex( valueBuf, romHeader->iRomBase );
+ MemSpyUiUtils::FormatHex( valueBuf2, (romHeader->iRomBase + romHeader->iRomSize ));
+ item.Format( KItem4Format, &valueBuf, &valueBuf2 );
+ model->AppendL( item );
+
+ _LIT(KItem5Format, "\tPrimary File Address\t\t%S");
+ MemSpyUiUtils::FormatHex( valueBuf, romHeader->iPrimaryFile );
+ item.Format( KItem5Format, &valueBuf );
+ model->AppendL( item );
+
+ _LIT(KItem6Format, "\tSecondary File Address\t\t%S");
+ MemSpyUiUtils::FormatHex( valueBuf, romHeader->iSecondaryFile );
+ item.Format( KItem6Format, &valueBuf );
+ model->AppendL( item );
+
+ _LIT(KItem7Format, "\tChecksum\t\t%S");
+ MemSpyUiUtils::FormatHex( valueBuf, romHeader->iCheckSum );
+ item.Format( KItem7Format, &valueBuf );
+ model->AppendL( item );
+
+ _LIT(KItem8Format, "\tKernel Config Flags\t\t%S");
+ MemSpyUiUtils::FormatHex( valueBuf, romHeader->iKernelConfigFlags );
+ item.Format( KItem8Format, &valueBuf );
+ model->AppendL( item );
+
+ if ( romHeader->iKernelConfigFlags & EKernelConfigIpcV1Available )
+ {
+ _LIT(KItem8aFormat, "\tIPC v1 Available\t\tYes");
+ item.Copy( KItem8aFormat );
+ model->AppendL( item );
+ }
+ if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecEnforcement )
+ {
+ _LIT(KItem8bFormat, "\tPlatSec Enforcement\t\tYes");
+ item.Copy( KItem8bFormat );
+ model->AppendL( item );
+ }
+ if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecDiagnostics )
+ {
+ _LIT(KItem8cFormat, "\tPlatSec Diagnostics\t\tYes");
+ item.Copy( KItem8cFormat );
+ model->AppendL( item );
+ }
+ if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecProcessIsolation )
+ {
+ _LIT(KItem8dFormat, "\tPlatSec Process Isolation\t\tYes");
+ item.Copy( KItem8dFormat );
+ model->AppendL( item );
+ }
+ if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecEnforceSysBin )
+ {
+ _LIT(KItem8eFormat, "\tEnforce \\Sys\\Bin\\\t\tYes");
+ item.Copy( KItem8eFormat );
+ model->AppendL( item );
+ }
+
+ const TUint32 pagingPolicy = ( romHeader->iKernelConfigFlags & EMemSpyKernelConfigPagingPolicyMask );
+#ifdef _DEBUG
+ RDebug::Printf( "pagingPolicy: %u (0x%08x)", pagingPolicy, pagingPolicy );
+#endif
+ _LIT(KItem8eFormat, "\tDemand Paging\t\t%S");
+ //
+ if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyNoPaging )
+ {
+ _LIT( KDemandPagingPolicyNoPaging, "No Paging" );
+ item.Format( KItem8eFormat, &KDemandPagingPolicyNoPaging );
+ }
+ else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyAlwaysPage )
+ {
+ _LIT( KDemandPagingPolicyAlwaysPage, "Always Paging" );
+ item.Format( KItem8eFormat, &KDemandPagingPolicyAlwaysPage);
+ }
+ else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyDefaultUnpaged )
+ {
+ _LIT( KDemandPagingPolicyDefaultUnpaged, "Default Unpaged" );
+ item.Format( KItem8eFormat, &KDemandPagingPolicyDefaultUnpaged);
+ }
+ else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyDefaultPaged )
+ {
+ _LIT( KDemandPagingPolicyDefaultPaged, "Default Paged" );
+ item.Format( KItem8eFormat, &KDemandPagingPolicyDefaultPaged );
+ }
+ //
+ model->AppendL( item );
+
+ _LIT(KItem9Format, "\tSection Header Address\t\t%S");
+ MemSpyUiUtils::FormatHex( valueBuf, romHeader->iRomSectionHeader );
+ item.Format( KItem9Format, &valueBuf );
+ model->AppendL( item );
+
+ _LIT(KItem11Format, "\tCompressed Size\t\t%S");
+ valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iCompressedSize ) );
+ item.Format( KItem11Format, &valueBuf );
+ model->AppendL( item );
+
+ _LIT(KItem12Format, "\tUncompressed Size\t\t%S");
+ valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iUncompressedSize ) );
+ item.Format( KItem12Format, &valueBuf );
+ model->AppendL( item );
+
+ _LIT(KItem13Format, "\tDisabled Caps. #1\t\t%S");
+ MemSpyUiUtils::FormatHex( valueBuf, romHeader->iDisabledCapabilities[0] );
+ item.Format( KItem13Format, &valueBuf );
+ model->AppendL( item );
+
+ _LIT(KItem14Format, "\tDisabled Caps. #2\t\t%S");
+ MemSpyUiUtils::FormatHex( valueBuf, romHeader->iDisabledCapabilities[1] );
+ item.Format( KItem14Format, &valueBuf );
+ model->AppendL( item );
+
+ for(TInt i=0; i<TRomHeader::KNumTraceMask; i++)
+ {
+ _LIT(KItem15Format, "\tTrace Mask #%d\t\t%S");
+ MemSpyUiUtils::FormatHex( valueBuf, romHeader->iTraceMask[i] );
+ item.Format( KItem15Format, i+1, &valueBuf );
+ model->AppendL( item );
+ }
+
+#endif
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+ CleanupStack::Pop( model );
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewServerList.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyViewServerList.h"
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperserver.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyViewThreads.h"
+#include "MemSpyContainerObserver.h"
+
+
+
+
+CMemSpyViewServerList::CMemSpyViewServerList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+CMemSpyViewServerList::~CMemSpyViewServerList()
+ {
+ delete iList;
+ }
+
+
+void CMemSpyViewServerList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Running Servers" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+TBool CMemSpyViewServerList::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdServerListSortByName:
+ OnCmdServerListSortByNameL();
+ break;
+ case EMemSpyCmdServerListSortBySessionCount:
+ OnCmdServerListSortBySessionCountL();
+ break;
+ case EMemSpyCmdServerListOutputListCSV:
+ OnCmdServerListOutputSummaryL();
+ break;
+ case EMemSpyCmdServerListOutputListDetailed:
+ OnCmdServerListOutputDetailedL();
+ break;
+
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewServerList::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewServerList::ViewType() const
+ {
+ return EMemSpyViewTypeServerList;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewServerList::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewServerList::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+
+ // First, try to find the selected thread
+ if ( iActionedItem )
+ {
+ // Try to create a view of the thread in question
+ CMemSpyProcess* process = NULL;
+ CMemSpyThread* thread = NULL;
+ //
+ const TInt error = iEngine.Container().ProcessAndThreadByThreadId( iActionedItem->Id(), process, thread );
+ //
+ if ( error == KErrNone && thread != NULL )
+ {
+ child = new(ELeave) CMemSpyViewThreads( iEngine, iObserver, thread->Process() );
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent(), thread );
+ CleanupStack::Pop( child );
+ }
+ }
+ //
+ return child;
+ }
+
+
+void CMemSpyViewServerList::SetListBoxModelL()
+ {
+ delete iList;
+ iList = NULL;
+ iList = iEngine.HelperServer().ServerListL();
+ //
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( iList );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewServerList::HandleListBoxItemActionedL( TInt aCurrentIndex )
+ {
+ if ( aCurrentIndex >= 0 && aCurrentIndex < iList->Count() )
+ {
+ const CMemSpyEngineServerEntry& serverInfo = iList->At( aCurrentIndex );
+ iActionedItem = &serverInfo;
+ }
+ else
+ {
+ iActionedItem = NULL;
+ }
+
+ // Notify observer about an item being 'fired'
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewServerList::OnCmdServerListSortByNameL()
+ {
+ iList->SortByNameL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+void CMemSpyViewServerList::OnCmdServerListSortBySessionCountL()
+ {
+ iList->SortBySessionCountL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+void CMemSpyViewServerList::OnCmdServerListOutputSummaryL()
+ {
+ OnCmdServerListOutputGenericL( EFalse );
+ }
+
+
+void CMemSpyViewServerList::OnCmdServerListOutputDetailedL()
+ {
+ OnCmdServerListOutputGenericL( ETrue );
+ }
+
+
+void CMemSpyViewServerList::OnCmdServerListOutputGenericL( TBool aDetailed )
+ {
+ // Begin a new data stream
+ _LIT( KMemSpyContext, "Server List - " );
+ _LIT( KMemSpyFolder, "Servers" );
+ iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
+
+ // Set prefix for overall listing
+ iEngine.Sink().OutputPrefixSetLC( KMemSpyContext );
+
+ // Create header
+ CMemSpyEngineServerList::OutputDataColumnsL( iEngine, aDetailed );
+
+ // List items
+ const TInt count = iList->Count();
+ for(TInt i=0; i<count; i++)
+ {
+ const CMemSpyEngineServerEntry& server = iList->At( i );
+ //
+ server.OutputDataL( iEngine.HelperServer(), aDetailed );
+ }
+
+ // Tidy up
+ CleanupStack::PopAndDestroy(); // prefix
+
+ // End data stream
+ iEngine.Sink().DataStreamEndL();
+ }
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewSystemConfig.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,883 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewSystemConfig.h"
+
+// System includes
+#include <hal.h>
+#include <bautils.h>
+#include <eikenv.h>
+#ifdef __EPOC32__
+#include <e32rom.h>
+#endif
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperfilesystem.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyContainerObserver.h"
+
+// Literal constants
+_LIT( KMemSpyItemValueNotKnown, "Unknown" );
+
+
+
+CMemSpyViewSystemConfig::CMemSpyViewSystemConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+CMemSpyViewSystemConfig::~CMemSpyViewSystemConfig()
+ {
+ delete iModel;
+ }
+
+
+void CMemSpyViewSystemConfig::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "System Configuration" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+void CMemSpyViewSystemConfig::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewSystemConfig::ViewType() const
+ {
+ return EMemSpyViewTypeSystemConfig;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewSystemConfig::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewSystemConfig::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+ return child;
+ }
+
+
+void CMemSpyViewSystemConfig::SetListBoxModelL()
+ {
+ CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
+ delete iModel;
+ iModel = model;
+
+ TBuf<128> valueBuf;
+ TInt value = 0;
+ TInt value2 = 0;
+ TMemSpySizeText sizeBuf;
+
+ //
+ _LIT(KItem1Format, "Manufacturer");
+ GetManufacturer( valueBuf );
+ AddItemL( KItem1Format, valueBuf );
+
+ //
+ _LIT(KItem2Format, "Machine Uid");
+ GetMachineUid( valueBuf );
+ AddItemL( KItem2Format, valueBuf );
+
+ //
+ _LIT(KItem1aFormat, "Model Uid");
+ GetHALValueAsHexL( HALData::EModel, KItem1aFormat );
+
+ //
+ _LIT(KItem2aFormat, "Device Family");
+ GetDeviceFamily( valueBuf );
+ AddItemL( KItem2aFormat, valueBuf );
+
+ //
+ _LIT(KItem2bFormat, "Device Family Rev.");
+ GetHALValueAsNumericL( HALData::EDeviceFamilyRev, KItem2bFormat );
+
+ //
+ _LIT(KItem3Format, "Hardware Rev.");
+ GetHALValueAsNumericL( HALData::EManufacturerHardwareRev, KItem3Format );
+
+ //
+ _LIT(KItem4Format, "Software Rev.");
+ GetHALValueAsNumericL( HALData::EManufacturerSoftwareRev, KItem4Format );
+
+ //
+ _LIT(KItem5Format, "Software Build");
+ GetHALValueAsNumericL( HALData::EManufacturerSoftwareBuild, KItem5Format );
+
+ //
+ _LIT(KItem6Format, "CPU");
+ GetCPU( valueBuf );
+ AddItemL( KItem6Format, valueBuf );
+
+ //
+ _LIT(KItem7Format, "CPU ABI");
+ GetCPUABI( valueBuf );
+ AddItemL( KItem7Format, valueBuf );
+
+ //
+ _LIT(KItem8Format, "CPU Speed");
+ _LIT(KItem8Suffix, "KHz");
+ GetHALValueAsNumericL( HALData::ECPUSpeed, KItem8Format, &KItem8Suffix );
+
+ //
+ _LIT(KItem8aFormat, "Floating Point Support");
+ GetHALValueAsYesNoL( HALData::EHardwareFloatingPoint, KItem8aFormat );
+
+ //
+ _LIT(KItem8bFormat, "System Tick Period");
+ _LIT(KItem8bSuffix, "ms");
+ GetHALValueAsNumericL( HALData::ESystemTickPeriod, KItem8bFormat, &KItem8bSuffix );
+
+ //
+ _LIT(KItem8cFormat, "Nano Tick Period");
+ _LIT(KItem8cSuffix, "us");
+ GetHALValueAsNumericL( HALData::ENanoTickPeriod, KItem8cFormat, &KItem8cSuffix );
+
+ //
+ _LIT(KItem9Format, "Startup Reason");
+ GetStartupReason( valueBuf );
+ AddItemL( KItem9Format, valueBuf );
+
+ //
+ _LIT(KItem10Format, "Language");
+ GetHALValueAsNumericL( HALData::ELanguageIndex, KItem10Format, NULL, 4 );
+
+ //
+ _LIT(KItem10aFormat, "Locale");
+ GetHALValueAsNumericL( HALData::ELocaleLoaded, KItem10aFormat, NULL, 4 );
+
+ //
+ _LIT(KItem11aFormat, "Clipboard Drive");
+ GetHALValueAsDriveLetterL( HALData::EClipboardDrive, KItem11aFormat );
+
+ //
+ _LIT(KItem11bFormat, "System Drive (Hal)");
+ GetHALValueAsDriveLetterL( HALData::ESystemDrive, KItem11bFormat );
+
+ //
+ _LIT(KItem11cFormat, "System Drive (F32)");
+ TDriveNumber systemDrive = CMemSpyEngineHelperFileSystem::GetSystemDrive();
+ AddItemL( systemDrive, KItem11cFormat );
+
+ //
+ _LIT(KItem11dFormat, "System Drive (Bafl)");
+ value = BaflUtils::GetSystemDrive( systemDrive );
+ if ( value == KErrNone )
+ {
+ AddItemL( systemDrive, KItem11dFormat );
+ }
+ else
+ {
+ MemSpyUiUtils::GetErrorText( valueBuf, value );
+ AddItemL( KItem11dFormat, valueBuf );
+ }
+
+ //
+ _LIT(KItem12Format, "Display Type");
+ GetDisplayType( valueBuf );
+ AddItemL( KItem12Format, valueBuf );
+ //
+ _LIT(KItem12aCaption, "Display Size");
+ _LIT(KItem12aFormat, "%d x %d");
+ value = value2 = 0;
+ GetHALValue( HALData::EDisplayXPixels, value );
+ GetHALValue( HALData::EDisplayYPixels, value2 );
+ valueBuf.Format( KItem12aFormat, value, value2 );
+ AddItemL( KItem12aCaption, valueBuf );
+
+ //
+ _LIT(KItem13Format, "Display Depth");
+ _LIT(KItem13Suffix, "bpp");
+ GetHALValueAsNumericL( HALData::EDisplayBitsPerPixel, KItem13Format, &KItem13Suffix );
+
+ //
+ _LIT(KItem14Format, "Display Mode Count");
+ GetHALValueAsNumericL( HALData::EDisplayNumModes, KItem14Format );
+
+ //
+ _LIT(KItem14aFormat, "Current Mode");
+ GetHALValueAsNumericL( HALData::EDisplayMode, KItem14aFormat );
+
+ //
+ _LIT(KItem15Format, "Display Address");
+ GetHALValueAsHexL( HALData::EDisplayMemoryAddress, KItem15Format );
+
+ //
+ _LIT(KItem16Format, "Screen Count");
+ GetHALValueAsNumericL( HALData::EDisplayNumberOfScreens, KItem16Format );
+
+ //
+ _LIT(KItem17Format, "Eikon Def. Disp. Mode");
+ GetDisplayMode( valueBuf, static_cast<TMemSpyDisplayMode>( CEikonEnv::Static()->DefaultDisplayMode() ) );
+ AddItemL( KItem17Format, valueBuf );
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+ iModel = NULL;
+ }
+
+
+void CMemSpyViewSystemConfig::GetManufacturer( TDes& aBuf )
+ {
+ TInt value = KErrGeneral;
+ GetHALValue( HALData::EManufacturer, value );
+ //
+ switch( value )
+ {
+ case HALData::EManufacturer_Ericsson:
+ {
+ _LIT( KName, "Ericsson" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EManufacturer_Motorola:
+ {
+ _LIT( KName, "Motorola" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EManufacturer_Nokia:
+ {
+ _LIT( KName, "Nokia" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EManufacturer_Panasonic:
+ {
+ _LIT( KName, "Panasonic" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EManufacturer_Psion:
+ {
+ _LIT( KName, "Psion" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EManufacturer_Intel:
+ {
+ _LIT( KName, "Intel" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EManufacturer_Cogent:
+ {
+ _LIT( KName, "Cogent" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EManufacturer_Cirrus:
+ {
+ _LIT( KName, "Cirrus" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EManufacturer_Linkup:
+ {
+ _LIT( KName, "Linkup" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EManufacturer_TexasInstruments:
+ {
+ _LIT( KName, "Texas Instruments" );
+ aBuf.Copy( KName );
+ }
+ break;
+ default:
+ aBuf.Copy( KMemSpyItemValueNotKnown );
+ break;
+ }
+ }
+
+
+void CMemSpyViewSystemConfig::GetDisplayMode( TDes& aBuf, TMemSpyDisplayMode aMode )
+ {
+ switch( aMode )
+ {
+ case ENone:
+ {
+ _LIT( KName, "ENone" );
+ aBuf.Copy( KName );
+ }
+ case EGray2:
+ {
+ _LIT( KName, "EGray2" );
+ aBuf.Copy( KName );
+ }
+ case EGray4:
+ {
+ _LIT( KName, "EGray4" );
+ aBuf.Copy( KName );
+ }
+ case EGray16:
+ {
+ _LIT( KName, "EGray16" );
+ aBuf.Copy( KName );
+ }
+ case EGray256:
+ {
+ _LIT( KName, "EGray256" );
+ aBuf.Copy( KName );
+ }
+ case EColor16:
+ {
+ _LIT( KName, "EColor16" );
+ aBuf.Copy( KName );
+ }
+ case EColor256:
+ {
+ _LIT( KName, "EColor256" );
+ aBuf.Copy( KName );
+ }
+ case EColor64K:
+ {
+ _LIT( KName, "EColor64K" );
+ aBuf.Copy( KName );
+ }
+ case EColor16M:
+ {
+ _LIT( KName, "EColor16M" );
+ aBuf.Copy( KName );
+ }
+ case ERgb:
+ {
+ _LIT( KName, "ERgb" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case EColor4K:
+ {
+ _LIT( KName, "EColor4K" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case EColor16MU:
+ {
+ _LIT( KName, "EColor16MU" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case EColor16MA:
+ {
+ _LIT( KName, "EColor16MA" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case EColor16MAP:
+ {
+ _LIT( KName, "EColor16MAP" );
+ aBuf.Copy( KName );
+ }
+ break;
+ default:
+ aBuf.Copy( KMemSpyItemValueNotKnown );
+ break;
+ }
+ }
+
+
+void CMemSpyViewSystemConfig::GetDeviceFamily( TDes& aBuf )
+ {
+ TInt value = KErrGeneral;
+ GetHALValue( HALData::EDeviceFamily, value );
+ //
+ switch( value )
+ {
+ case HALData::EDeviceFamily_Crystal:
+ {
+ _LIT( KName, "Crystal" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EDeviceFamily_Pearl:
+ {
+ _LIT( KName, "Pearl" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EDeviceFamily_Quartz:
+ {
+ _LIT( KName, "Quartz" );
+ aBuf.Copy( KName );
+ }
+ break;
+ default:
+ aBuf.Copy( KMemSpyItemValueNotKnown );
+ break;
+ }
+ }
+
+
+void CMemSpyViewSystemConfig::GetCPU( TDes& aBuf )
+ {
+ TInt value = KErrGeneral;
+ GetHALValue( HALData::ECPU, value );
+ //
+ switch( value )
+ {
+ case HALData::ECPU_ARM:
+ {
+ _LIT( KName, "ARM" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::ECPU_MCORE:
+ {
+ _LIT( KName, "mCORE" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::ECPU_X86:
+ {
+ _LIT( KName, "X86" );
+ aBuf.Copy( KName );
+ }
+ break;
+ default:
+ aBuf.Copy( KMemSpyItemValueNotKnown );
+ break;
+ }
+ }
+
+
+void CMemSpyViewSystemConfig::GetCPUABI( TDes& aBuf )
+ {
+ TInt value = KErrGeneral;
+ GetHALValue( HALData::ECPUABI, value );
+ //
+ switch( value )
+ {
+ case HALData::ECPUABI_ARM4:
+ {
+ _LIT( KName, "ARM4" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::ECPUABI_ARMI:
+ {
+ _LIT( KName, "ARMI" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::ECPUABI_THUMB:
+ {
+ _LIT( KName, "ARM4" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::ECPUABI_MCORE:
+ {
+ _LIT( KName, "mCORE" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::ECPUABI_MSVC:
+ {
+ _LIT( KName, "MSVC" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::ECPUABI_ARM5T:
+ {
+ _LIT( KName, "ARM5T" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::ECPUABI_X86:
+ {
+ _LIT( KName, "X86" );
+ aBuf.Copy( KName );
+ }
+ break;
+ default:
+ aBuf.Copy( KMemSpyItemValueNotKnown );
+ break;
+ }
+ }
+
+
+void CMemSpyViewSystemConfig::GetStartupReason( TDes& aBuf )
+ {
+ TInt value = KErrGeneral;
+ GetHALValue( HALData::ESystemStartupReason, value );
+ //
+ switch( value )
+ {
+ case HALData::ESystemStartupReason_Cold:
+ {
+ _LIT( KName, "Cold" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::ESystemStartupReason_Warm:
+ {
+ _LIT( KName, "Warm" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::ESystemStartupReason_Fault:
+ {
+ _LIT( KName, "Fault" );
+ aBuf.Copy( KName );
+ }
+ break;
+ default:
+ aBuf.Copy( KMemSpyItemValueNotKnown );
+ break;
+ }
+ }
+
+
+void CMemSpyViewSystemConfig::GetKeyboard( TDes& aBuf )
+ {
+ _LIT(KComma, ", ");
+ TInt value = KErrGeneral;
+ GetHALValue( HALData::EKeyboard, value );
+ //
+ aBuf.Zero();
+ if ( value & EKeyboard_Keypad )
+ {
+ _LIT( KName, "Keypad" );
+ aBuf.Copy( KName );
+ }
+
+
+ if ( value & EKeyboard_Full )
+ {
+ if ( aBuf.Length() )
+ {
+ aBuf.Append( KComma );
+ }
+
+ _LIT( KName, "Full Keyboard" );
+ aBuf.Copy( KName );
+ }
+
+ if ( !aBuf.Length() )
+ {
+ aBuf.Copy( KMemSpyItemValueNotKnown );
+ }
+ }
+
+
+void CMemSpyViewSystemConfig::GetMachineUid( TDes& aBuf )
+ {
+ TInt value = KErrGeneral;
+ GetHALValue( HALData::EMachineUid, value );
+ //
+ switch( value )
+ {
+ case HALData::EMachineUid_Series5mx:
+ {
+ _LIT( KName, "Series 5mx" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_Brutus:
+ {
+ _LIT( KName, "Brutus" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_Cogent:
+ {
+ _LIT( KName, "Cogent" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_Win32Emulator:
+ {
+ _LIT( KName, "Win32 Emulator" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_WinC:
+ {
+ _LIT( KName, "WINC" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_CL7211_Eval:
+ {
+ _LIT( KName, "CL7211" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_LinkUp:
+ {
+ _LIT( KName, "LinkUp" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_Assabet:
+ {
+ _LIT( KName, "Assabet" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_IQ80310:
+ {
+ _LIT( KName, "IQ80310" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_Lubbock:
+ {
+ _LIT( KName, "Lubbock" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_Integrator:
+ {
+ _LIT( KName, "Integrator" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_Helen:
+ {
+ _LIT( KName, "Helen" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_X86PC:
+ {
+ _LIT( KName, "X86PC" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_OmapH2:
+ {
+ _LIT( KName, "OmapH2" );
+ aBuf.Copy( KName );
+ }
+ break;
+ case HALData::EMachineUid_OmapH4:
+ {
+ _LIT( KName, "OmapH4" );
+ aBuf.Copy( KName );
+ }
+ break;
+ default:
+ {
+ _LIT( KName, "0x%08x" );
+ aBuf.Format( KName, value );
+ }
+ break;
+ }
+ }
+
+
+void CMemSpyViewSystemConfig::GetDisplayType( TDes& aBuf )
+ {
+ TInt value = KErrGeneral;
+ GetHALValue( HALData::EDisplayIsMono, value );
+ //
+ if ( value == 0 )
+ {
+ _LIT( KName, "Colour" );
+ aBuf.Copy( KName );
+ }
+ else if ( value == 1 )
+ {
+ _LIT( KName, "Mono" );
+ aBuf.Copy( KName );
+ }
+ else
+ {
+ MemSpyUiUtils::GetErrorText( aBuf, value );
+ }
+ }
+
+
+TInt CMemSpyViewSystemConfig::GetHALValue( HALData::TAttribute aAttribute, TInt& aValue )
+ {
+ aValue = KErrGeneral;
+ const TInt error = HAL::Get( aAttribute, aValue );
+
+#ifdef _DEBUG
+ if ( error != KErrNone )
+ {
+ RDebug::Printf("CMemSpyViewSystemConfig::GetHALValue() - aAttribute: %3d, error: %d, value: %d", aAttribute, error, aValue);
+ }
+#endif
+
+ return error;
+ }
+
+
+TInt CMemSpyViewSystemConfig::GetHALValueAsNumericL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix, TInt aWidth )
+ {
+ TBuf<20> valueBuf;
+ TInt value = 0;
+ //
+ const TInt error = GetHALValue( aAttribute, value );
+ if ( error == KErrNone )
+ {
+ if ( aWidth > 0 && aWidth < 12 )
+ {
+ valueBuf.NumFixedWidthUC( (TUint) value, EDecimal, aWidth );
+ }
+ else
+ {
+ valueBuf.Num( value );
+ }
+
+ AddItemL( aCaption, valueBuf, aSuffix );
+ }
+ else
+ {
+ MemSpyUiUtils::GetErrorText( valueBuf, error );
+ AddItemL( aCaption, valueBuf );
+ }
+ //
+ return error;
+ }
+
+
+TInt CMemSpyViewSystemConfig::GetHALValueAsHexL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix )
+ {
+ TBuf<20> valueBuf;
+ TInt value = 0;
+ //
+ const TInt error = GetHALValue( aAttribute, value );
+ if ( error == KErrNone )
+ {
+ MemSpyEngineUtils::FormatHex( valueBuf, value );
+ AddItemL( aCaption, valueBuf, aSuffix );
+ }
+ else
+ {
+ MemSpyUiUtils::GetErrorText( valueBuf, error );
+ AddItemL( aCaption, valueBuf );
+ }
+ //
+ return error;
+ }
+
+
+TInt CMemSpyViewSystemConfig::GetHALValueAsYesNoL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix )
+ {
+ TBuf<20> valueBuf;
+ TInt value = 0;
+ //
+ const TInt error = GetHALValue( aAttribute, value );
+ if ( error == KErrNone || error == KErrNotSupported )
+ {
+ _LIT(KYes, "Yes");
+ _LIT(KNo, "No");
+ _LIT(KError, "Error: %d");
+
+ if ( error < KErrNone )
+ {
+ valueBuf.Format( KError, error );
+ }
+ else if ( value == EFalse )
+ {
+ valueBuf.Copy( KNo );
+ }
+ else if ( error == KErrNone )
+ {
+ valueBuf.Copy( KYes );
+ }
+
+ AddItemL( aCaption, valueBuf, aSuffix );
+ }
+ else
+ {
+ MemSpyUiUtils::GetErrorText( valueBuf, error );
+ AddItemL( aCaption, valueBuf );
+ }
+ //
+ return error;
+ }
+
+
+TInt CMemSpyViewSystemConfig::GetHALValueAsDriveLetterL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix )
+ {
+ TInt value = 0;
+ const TInt error = GetHALValue( aAttribute, value );
+ //
+ if ( error == KErrNone && ( value >= EDriveA && value <= EDriveZ ) )
+ {
+ AddItemL( (TDriveNumber) value, aCaption, aSuffix );
+ }
+ else
+ {
+ _LIT( KItemNotSet, "Not Defined");
+ AddItemL( aCaption, KItemNotSet );
+ }
+ //
+ return error;
+ }
+
+
+void CMemSpyViewSystemConfig::AddItemL( const TDesC& aCaption, const TDesC& aValue, const TDesC* aSuffix )
+ {
+ _LIT(KItemFormat, "\t%S\t\t%S");
+ //
+ TBuf<KMaxFullName> item;
+ item.Format( KItemFormat, &aCaption, &aValue );
+ if ( aSuffix )
+ {
+ _LIT(KSpace, " ");
+ item.Append( KSpace );
+ item.Append( *aSuffix );
+ }
+ //
+ iModel->AppendL( item );
+ }
+
+
+void CMemSpyViewSystemConfig::AddItemL( TDriveNumber aDrive, const TDesC& aCaption, const TDesC* aSuffix )
+ {
+ TBuf<20> valueBuf;
+ //
+ const TDriveUnit drive( aDrive );
+ valueBuf.Copy( drive.Name() );
+ //
+ AddItemL( aCaption, valueBuf, aSuffix );
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewThreadInfoItemActiveObject.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,241 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewThreadInfoItemActiveObject.h"
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperactiveobject.h>
+
+// User includes
+#include "MemSpyContainerObserver.h"
+
+
+
+CMemSpyViewThreadInfoItemActiveObjectBase::CMemSpyViewThreadInfoItemActiveObjectBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
+: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeActiveObject )
+ {
+ }
+
+
+TBool CMemSpyViewThreadInfoItemActiveObjectBase::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdActiveObjectListing:
+ OnCmdWriteAOListingL();
+ break;
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewThreadInfoItemActiveObjectBase::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
+ {
+ if ( aResourceId == R_MEMSPY_MENUPANE )
+ {
+ aMenuPane->SetItemDimmed( EMemSpyCmdActiveObject, Thread().IsDead() );
+ }
+ }
+
+
+CMemSpyEngineActiveObjectArray& CMemSpyViewThreadInfoItemActiveObjectBase::ActiveObjectArray() const
+ {
+ CMemSpyThreadInfoActiveObjects* activeObjectArray = static_cast< CMemSpyThreadInfoActiveObjects* >( iInfoItem );
+ return activeObjectArray->Array();
+ }
+
+
+void CMemSpyViewThreadInfoItemActiveObjectBase::OnCmdWriteAOListingL()
+ {
+ CMemSpyEngineActiveObjectArray& objects = ActiveObjectArray();
+
+ // Begin a new data stream
+ _LIT( KMemSpyContext, "Active Object List - " );
+ _LIT( KMemSpyFolder, "Active Objects" );
+ iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
+
+ // Set prefix for overall listing
+ iEngine.Sink().OutputPrefixSetLC( KMemSpyContext );
+
+ // Create header
+ CMemSpyEngineActiveObjectArray::OutputDataColumnsL( iEngine );
+
+ // List items
+ const TInt count = objects.Count();
+ for(TInt i=0; i<count; i++)
+ {
+ const CMemSpyEngineActiveObject& object = objects.At( i );
+ //
+ object.OutputDataL( iEngine );
+ }
+
+ // Tidy up
+ CleanupStack::PopAndDestroy(); // prefix
+
+ // End data stream
+ iEngine.Sink().DataStreamEndL();
+ }
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewThreadInfoItemActiveObject::CMemSpyViewThreadInfoItemActiveObject( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
+: CMemSpyViewThreadInfoItemActiveObjectBase( aEngine, aObserver, aContainer )
+ {
+ }
+
+
+void CMemSpyViewThreadInfoItemActiveObject::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ // Causes list of server's to be prepared
+ CMemSpyViewThreadInfoItemActiveObjectBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ _LIT( KTitle, "Active Objects" );
+ SetTitleL( KTitle );
+
+ // Try to select the correct server
+ CMemSpyThreadInfoHandleObjectBase* infoItem = static_cast< CMemSpyThreadInfoHandleObjectBase* >( iInfoItem );
+ TInt selectedIndex = 0;
+ if ( aSelectionRune )
+ {
+ CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray();
+ const TInt index = activeObjectArray.ObjectIndexByAddress( aSelectionRune );
+ if ( index >= 0 && index < activeObjectArray.Count() )
+ {
+ selectedIndex = index + 1;
+ }
+ }
+
+ // Select item
+ if ( infoItem->DetailsCount() > 0 )
+ {
+ iListBox->SetCurrentItemIndex( selectedIndex );
+ HandleListBoxItemSelectedL( selectedIndex );
+ }
+ }
+
+
+TMemSpyViewType CMemSpyViewThreadInfoItemActiveObject::ViewType() const
+ {
+ return EMemSpyViewTypeThreadInfoItemActiveObject;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemActiveObject::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+
+ // Get current entry address
+ TInt index = iListBox->CurrentItemIndex();
+ if ( index > 0 )
+ {
+ --index;
+ CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray();
+ //
+ if ( index >= 0 && index < activeObjectArray.MdcaCount() )
+ {
+ CMemSpyEngineActiveObject& object = activeObjectArray.At( index );
+ TAny* aoAddress = object.Address();
+ //
+ child = new(ELeave) CMemSpyViewThreadInfoItemActiveObjectDetails( iEngine, iObserver, iInfoItem->Container(), aoAddress );
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent(), NULL );
+ CleanupStack::Pop( child );
+ }
+ }
+ //
+ return child;
+ }
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewThreadInfoItemActiveObjectDetails::CMemSpyViewThreadInfoItemActiveObjectDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, TAny* aObjectAddress )
+: CMemSpyViewThreadInfoItemActiveObjectBase( aEngine, aObserver, aContainer ), iObjectAddress( aObjectAddress )
+ {
+ }
+
+
+void CMemSpyViewThreadInfoItemActiveObjectDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ CMemSpyViewThreadInfoItemActiveObjectBase::ConstructL( aRect, aContainer, aSelectionRune );
+
+ _LIT( KTitle, "Active Object Details" );
+ SetTitleL( KTitle );
+ }
+
+
+TMemSpyViewType CMemSpyViewThreadInfoItemActiveObjectDetails::ViewType() const
+ {
+ return EMemSpyViewTypeThreadInfoItemActiveObjectDetails;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemActiveObjectDetails::PrepareParentViewL()
+ {
+ CMemSpyViewThreadInfoItemActiveObject* parent = new(ELeave) CMemSpyViewThreadInfoItemActiveObject( iEngine, iObserver, iInfoItem->Container() );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), iObjectAddress );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+void CMemSpyViewThreadInfoItemActiveObjectDetails::SetListBoxModelL()
+ {
+ // Try to find the right entry
+ CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray();
+ const TInt index = activeObjectArray.ObjectIndexByAddress( iObjectAddress );
+ User::LeaveIfError( index );
+ CMemSpyEngineActiveObject& object = activeObjectArray.At( index );
+ //
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( &object );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewThreadInfoItemChunk.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyViewThreadInfoItemChunk.h"
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperchunk.h>
+
+// User includes
+#include "MemSpyContainerObserver.h"
+#include "MemSpyViewChunkList.h"
+
+
+
+CMemSpyViewThreadInfoItemChunk::CMemSpyViewThreadInfoItemChunk( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
+: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeChunk )
+ {
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemChunk::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+
+ // Get the code segment list
+ CMemSpyThreadInfoChunk* chunkInfoItem = static_cast< CMemSpyThreadInfoChunk* >( iInfoItem );
+ CMemSpyEngineChunkList* list = &chunkInfoItem->List();
+
+ // Get the current code segment that corresponds to our currently focused list item.
+ const TInt index = iListBox->CurrentItemIndex();
+ if ( index >= 0 && index < list->Count() )
+ {
+ CMemSpyEngineChunkEntry& entry = list->At( index );
+ child = new(ELeave) CMemSpyViewChunkDetails( iEngine, iObserver, *list, entry );
+
+ // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
+ // This object is about to die in any case.
+ chunkInfoItem->NullifyList();
+
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ }
+
+ return child;
+ }
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewThreadInfoItemCodeSeg.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyViewThreadInfoItemCodeSeg.h"
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelpercodesegment.h>
+
+// User includes
+#include "MemSpyContainerObserver.h"
+#include "MemSpyViewCodeSegList.h"
+
+
+
+CMemSpyViewThreadInfoItemCodeSeg::CMemSpyViewThreadInfoItemCodeSeg( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
+: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeCodeSeg )
+ {
+ }
+
+
+TBool CMemSpyViewThreadInfoItemCodeSeg::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ return handled;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemCodeSeg::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+
+ // Get the code segment list
+ CMemSpyThreadInfoCodeSeg* codeSegInfoItem = static_cast< CMemSpyThreadInfoCodeSeg* >( iInfoItem );
+ CMemSpyEngineCodeSegList* list = &codeSegInfoItem->List();
+
+ // Get the current code segment that corresponds to our currently focused list item.
+ const TInt index = iListBox->CurrentItemIndex();
+ if ( index >= 0 && index < list->Count() )
+ {
+ CMemSpyEngineCodeSegEntry& entry = list->At( index );
+ child = new(ELeave) CMemSpyViewCodeSegDetails( iEngine, iObserver, *list, entry );
+
+ // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
+ // This object is about to die in any case.
+ codeSegInfoItem->NullifyList();
+
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ }
+
+ return child;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewThreadInfoItemGeneralInfo.cpp Wed Oct 13 14:32:52 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 "MemSpyViewThreadInfoItemGeneralInfo.h"
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+
+// User includes
+#include "MemSpyContainerObserver.h"
+#include "MemSpyViewThreads.h"
+#include "MemSpyViewThreadInfoItemHeap.h"
+
+
+
+CMemSpyViewThreadInfoItemGeneralInfo::CMemSpyViewThreadInfoItemGeneralInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
+: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeGeneralInfo )
+ {
+ }
+
+
+TBool CMemSpyViewThreadInfoItemGeneralInfo::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+
+
+void CMemSpyViewThreadInfoItemGeneralInfo::HandleListBoxItemActionedL( TInt /*aIndex*/ )
+ {
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewThreadInfoItemGeneric.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,315 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewThreadInfoItemGeneric.h"
+
+// System includes
+#include <AknWaitDialog.h>
+#include <memspyui.rsg>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+
+// User includes
+#include "MemSpyContainerObserver.h"
+#include "MemSpyViewThreadInfoItemList.h"
+
+// Constants
+const TInt KMemSpyConstructionCheckerTimerPeriod = 500000; // 1/2 second
+
+
+
+CMemSpyViewThreadInfoItemGeneric::CMemSpyViewThreadInfoItemGeneric( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aInfoContainer, TMemSpyThreadInfoItemType aType )
+: CMemSpyViewBase( aEngine, aObserver ), iContainer( aInfoContainer )
+ {
+ iContainer.Thread().Process().Open();
+ iContainer.Thread().Open();
+ iContainer.Open();
+ //
+ iInfoItem = &iContainer.Item( aType );
+ __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() );
+ iInfoItem->Open();
+ }
+
+
+CMemSpyViewThreadInfoItemGeneric::~CMemSpyViewThreadInfoItemGeneric()
+ {
+ if ( iInfoItem )
+ {
+ iInfoItem->Close();
+ }
+ //
+ DestroyWaitNote();
+ //
+ iContainer.Close();
+ iContainer.Thread().Close();
+ iContainer.Thread().Process().Close();
+ }
+
+
+void CMemSpyViewThreadInfoItemGeneric::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ const TPtrC pTitle( iInfoItem->Name().Mid( 1 ) );
+ SetTitleL( pTitle );
+ //
+ if ( iInfoItem->IsReady() == EFalse )
+ {
+#ifdef _DEBUG
+ RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::ConstructL() - show wait note - item not ready, iType: %d", iInfoItem->Type() );
+#endif
+
+ // Wait for engine data to be made ready...
+ ShowWaitNoteL();
+ }
+
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+CMemSpyProcess& CMemSpyViewThreadInfoItemGeneric::Process() const
+ {
+ return iContainer.Thread().Process();
+ }
+
+
+CMemSpyThread& CMemSpyViewThreadInfoItemGeneric::Thread() const
+ {
+ return iContainer.Thread();
+ }
+
+
+CMemSpyThreadInfoContainer& CMemSpyViewThreadInfoItemGeneric::Container() const
+ {
+ return iContainer;
+ }
+
+
+CMemSpyThreadInfoItemBase& CMemSpyViewThreadInfoItemGeneric::InfoItem() const
+ {
+ __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() );
+ return *iInfoItem;
+ }
+
+
+void CMemSpyViewThreadInfoItemGeneric::RefreshL()
+ {
+ iInfoItem->RebuildL();
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewThreadInfoItemGeneric::ViewType() const
+ {
+ TMemSpyViewType type = EMemSpyViewTypeNone;
+ //
+ switch( iInfoItem->Type() )
+ {
+ case EMemSpyThreadInfoItemTypeHeap:
+ type = EMemSpyViewTypeThreadInfoItemHeap;
+ break;
+ case EMemSpyThreadInfoItemTypeStack:
+ type = EMemSpyViewTypeThreadInfoItemStack;
+ break;
+ case EMemSpyThreadInfoItemTypeChunk:
+ type = EMemSpyViewTypeThreadInfoItemChunk;
+ break;
+ case EMemSpyThreadInfoItemTypeCodeSeg:
+ type = EMemSpyViewTypeThreadInfoItemCodeSeg;
+ break;
+ case EMemSpyThreadInfoItemTypeServer:
+ type = EMemSpyViewTypeThreadInfoItemServer;
+ break;
+ case EMemSpyThreadInfoItemTypeSession:
+ type = EMemSpyViewTypeThreadInfoItemSession;
+ break;
+ case EMemSpyThreadInfoItemTypeSemaphore:
+ type = EMemSpyViewTypeThreadInfoItemSemaphore;
+ break;
+ case EMemSpyThreadInfoItemTypeMutex:
+ type = EMemSpyViewTypeThreadInfoItemMutex;
+ break;
+ case EMemSpyThreadInfoItemTypeTimer:
+ type = EMemSpyViewTypeThreadInfoItemTimer;
+ break;
+ case EMemSpyThreadInfoItemTypeLDD:
+ type = EMemSpyViewTypeThreadInfoItemLDD;
+ break;
+ case EMemSpyThreadInfoItemTypePDD:
+ type = EMemSpyViewTypeThreadInfoItemPDD;
+ break;
+ case EMemSpyThreadInfoItemTypeLogicalChannel:
+ type = EMemSpyViewTypeThreadInfoItemLogicalChannel;
+ break;
+ case EMemSpyThreadInfoItemTypeChangeNotifier:
+ type = EMemSpyViewTypeThreadInfoItemChangeNotifier;
+ break;
+ case EMemSpyThreadInfoItemTypeUndertaker:
+ type = EMemSpyViewTypeThreadInfoItemUndertaker;
+ break;
+ case EMemSpyThreadInfoItemTypeMessageQueue:
+ type = EMemSpyViewTypeThreadInfoItemMessageQueue;
+ break;
+ case EMemSpyThreadInfoItemTypeConditionalVariable:
+ type = EMemSpyViewTypeThreadInfoItemConditionalVariable;
+ break;
+ case EMemSpyThreadInfoItemTypeOpenFiles:
+ type = EMemSpyViewTypeThreadInfoItemOpenFiles;
+ break;
+ case EMemSpyThreadInfoItemTypeActiveObject:
+ type = EMemSpyViewTypeThreadInfoItemActiveObject;
+ break;
+ case EMemSpyThreadInfoItemTypeGeneralInfo:
+ type = EMemSpyViewTypeThreadInfoItemGeneralInfo;
+ break;
+ case EMemSpyThreadInfoItemTypeOtherThreads:
+ type = EMemSpyViewTypeThreadInfoItemOtherThreads;
+ break;
+ case EMemSpyThreadInfoItemTypeOtherProcesses:
+ type = EMemSpyViewTypeThreadInfoItemOtherProcesses;
+ break;
+ case EMemSpyThreadInfoItemTypeOwnedThreadHandles:
+ type = EMemSpyViewTypeThreadInfoItemOwnedThreadHandles;
+ break;
+ case EMemSpyThreadInfoItemTypeOwnedProcessHandles:
+ type = EMemSpyViewTypeThreadInfoItemOwnedProcessHandles;
+ break;
+
+ default:
+ __ASSERT_DEBUG( EFalse, User::Invariant() );
+ break;
+ }
+ //
+ return type;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareParentViewL()
+ {
+ CMemSpyViewThreadInfoItemList* parent = new(ELeave) CMemSpyViewThreadInfoItemList( iEngine, iObserver, Thread() );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), iInfoItem );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareChildViewL()
+ {
+ __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() );
+ CMemSpyViewBase* child = NULL;
+ //
+ return child;
+ }
+
+
+TBool CMemSpyViewThreadInfoItemGeneric::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ return handled;
+ }
+
+
+void CMemSpyViewThreadInfoItemGeneric::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( iInfoItem );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewThreadInfoItemGeneric::HandleListBoxItemActionedL( TInt /*aIndex*/ )
+ {
+ // Notify observer about an item being 'fired'
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewThreadInfoItemGeneric::HandleListBoxItemSelectedL( TInt /*aIndex*/ )
+ {
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+
+void CMemSpyViewThreadInfoItemGeneric::ShowWaitNoteL()
+ {
+ // Ugly, but I'm not adding an observer mechanism just for this wait dialog.
+ __ASSERT_ALWAYS( iWaitConstructionChecker == NULL, User::Invariant() );
+ iWaitConstructionChecker = CPeriodic::NewL( CActive::EPriorityLow );
+ iWaitConstructionChecker->Start( KMemSpyConstructionCheckerTimerPeriod,
+ KMemSpyConstructionCheckerTimerPeriod,
+ TCallBack( CheckForItemConstructionComplete, this ) );
+
+ if ( !iWaitNote )
+ {
+ iWaitNote = new ( ELeave ) CAknWaitDialog( reinterpret_cast<CEikDialog**> ( &iWaitNote ), ETrue );
+ iWaitNote->ExecuteDlgLD( CAknNoteDialog::ENoTone, R_MEMSPY_PREPARING_INFO_ITEM_CONTAINER_WAIT_NOTE );
+ }
+ }
+
+
+void CMemSpyViewThreadInfoItemGeneric::DestroyWaitNote()
+ {
+#ifdef _DEBUG
+ RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::DestroyWaitNote() - START" );
+#endif
+ //
+ delete iWaitConstructionChecker;
+ iWaitConstructionChecker = NULL;
+ //
+ if ( iWaitNote )
+ {
+ TRAP_IGNORE( iWaitNote->ProcessFinishedL() ); // deletes the dialog
+ iWaitNote = NULL;
+ }
+ //
+#ifdef _DEBUG
+ RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::DestroyWaitNote() - END" );
+#endif
+ }
+
+
+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() );
+#endif
+ //
+ TBool callAgain = ETrue;
+ if ( self.iInfoItem->IsReady() )
+ {
+ self.DestroyWaitNote();
+ callAgain = EFalse;
+ }
+ //
+ return callAgain;
+ }
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewThreadInfoItemHeap.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyViewThreadInfoItemHeap.h"
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+
+// User includes
+#include "MemSpyContainerObserver.h"
+#include "MemSpyViewThreads.h"
+#include "MemSpyViewThreadInfoItemHeap.h"
+
+
+
+CMemSpyViewThreadInfoItemHeap::CMemSpyViewThreadInfoItemHeap( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
+: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeHeap )
+ {
+ }
+
+
+TBool CMemSpyViewThreadInfoItemHeap::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+#ifndef __WINS__
+ case EMemSpyCmdHeapDataDump:
+ OnCmdHeapDataL();
+ break;
+#endif
+ case EMemSpyCmdHeapCellListing:
+ OnCmdHeapCellListingL();
+ break;
+ case EMemSpyCmdHeapInfoThread:
+ OnCmdHeapInfoL();
+ break;
+
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewThreadInfoItemHeap::OnCmdHeapDataL()
+ {
+ iEngine.HelperHeap().OutputHeapDataUserL( Thread() );
+ }
+
+
+void CMemSpyViewThreadInfoItemHeap::OnCmdHeapCellListingL()
+ {
+ iEngine.HelperHeap().OutputCellListingUserL( Thread() );
+ }
+
+
+void CMemSpyViewThreadInfoItemHeap::OnCmdHeapInfoL()
+ {
+ iEngine.HelperHeap().OutputHeapInfoUserL( Thread() );
+ }
+
+
+void CMemSpyViewThreadInfoItemHeap::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
+ {
+ if ( aResourceId == R_MEMSPY_MENUPANE )
+ {
+ aMenuPane->SetItemDimmed( EMemSpyCmdHeap, Thread().IsDead() );
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewThreadInfoItemList.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,336 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewThreadInfoItemList.h"
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+
+// User includes
+#include "MemSpyContainerObserver.h"
+#include "MemSpyViewThreads.h"
+#include "MemSpyViewThreadInfoItemHeap.h"
+#include "MemSpyViewThreadInfoItemStack.h"
+#include "MemSpyViewThreadInfoItemChunk.h"
+#include "MemSpyViewThreadInfoItemCodeSeg.h"
+#include "MemSpyViewThreadInfoItemServer.h"
+#include "MemSpyViewThreadInfoItemActiveObject.h"
+#include "MemSpyViewThreadInfoItemGeneralInfo.h"
+#include "MemSpyViewThreadInfoItemMemoryTracking.h"
+
+// Constants
+const TInt KMemSpyIdleResetListboxTimerPeriod = 250000;
+
+
+CMemSpyViewThreadInfoItemList::CMemSpyViewThreadInfoItemList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThread& aThread )
+: CMemSpyViewBase( aEngine, aObserver ), iThread( aThread )
+ {
+ iThread.Process().Open();
+ iThread.Open();
+ }
+
+
+CMemSpyViewThreadInfoItemList::~CMemSpyViewThreadInfoItemList()
+ {
+ delete iIdleResetListboxTimer;
+
+ TRAP_IGNORE(
+ CMemSpyThreadInfoContainer& container = iThread.InfoContainerL();
+ container.ObserverRemove( *this );
+ );
+
+ if ( iCurrentInfoItem )
+ {
+ iCurrentInfoItem->Close();
+ }
+
+ iThread.Process().Close();
+ iThread.Close();
+ }
+
+
+
+void CMemSpyViewThreadInfoItemList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Thread Objects" );
+ SetTitleL( KTitle );
+ //
+ iIdleResetListboxTimer = CPeriodic::NewL( CActive::EPriorityIdle );
+ //
+ CMemSpyThreadInfoContainer& container = iThread.InfoContainerL();
+ container.ObserverAddL( *this );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ //
+ if ( aSelectionRune )
+ {
+ CMemSpyThreadInfoItemBase* selectedItem = reinterpret_cast< CMemSpyThreadInfoItemBase* >( aSelectionRune );
+ const TInt index = container.InfoItemIndexByType( selectedItem->Type() );
+ if ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
+ {
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+ }
+ else if ( container.MdcaCount() > 0 )
+ {
+ iListBox->SetCurrentItemIndex( 0 );
+ HandleListBoxItemSelectedL( 0 );
+ }
+ }
+
+
+const CMemSpyProcess& CMemSpyViewThreadInfoItemList::Process() const
+ {
+ return iThread.Process();
+ }
+
+
+const CMemSpyThread& CMemSpyViewThreadInfoItemList::Thread() const
+ {
+ return iThread;
+ }
+
+
+const CMemSpyThreadInfoItemBase& CMemSpyViewThreadInfoItemList::CurrentInfoItem() const
+ {
+ __ASSERT_ALWAYS( iCurrentInfoItem != NULL, User::Invariant() );
+ return *iCurrentInfoItem;
+ }
+
+
+void CMemSpyViewThreadInfoItemList::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewThreadInfoItemList::ViewType() const
+ {
+ return EMemSpyViewTypeThreadInfoItemList;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemList::PrepareParentViewL()
+ {
+ CMemSpyViewBase* parent = new(ELeave) CMemSpyViewThreads( iEngine, iObserver, iThread.Process() );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), &iThread );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+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();
+ //
+ switch( type )
+ {
+ case EMemSpyThreadInfoItemTypeHeap:
+ child = new(ELeave) CMemSpyViewThreadInfoItemHeap( iEngine, iObserver, iThread.InfoContainerL() );
+ break;
+ case EMemSpyThreadInfoItemTypeStack:
+ child = new(ELeave) CMemSpyViewThreadInfoItemStack( iEngine, iObserver, iThread.InfoContainerL() );
+ break;
+ case EMemSpyThreadInfoItemTypeChunk:
+ child = new(ELeave) CMemSpyViewThreadInfoItemChunk( iEngine, iObserver, iThread.InfoContainerL() );
+ break;
+ case EMemSpyThreadInfoItemTypeCodeSeg:
+ child = new(ELeave) CMemSpyViewThreadInfoItemCodeSeg( iEngine, iObserver, iThread.InfoContainerL() );
+ break;
+ case EMemSpyThreadInfoItemTypeServer:
+ child = new(ELeave) CMemSpyViewThreadInfoItemServer( iEngine, iObserver, iThread.InfoContainerL() );
+ break;
+ case EMemSpyThreadInfoItemTypeActiveObject:
+ child = new(ELeave) CMemSpyViewThreadInfoItemActiveObject( iEngine, iObserver, iThread.InfoContainerL() );
+ break;
+ case EMemSpyThreadInfoItemTypeGeneralInfo:
+ child = new(ELeave) CMemSpyViewThreadInfoItemGeneralInfo( iEngine, iObserver, iThread.InfoContainerL() );
+ break;
+ case EMemSpyThreadInfoItemTypeMemoryTracking:
+ child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, iThread.InfoContainerL() );
+ break;
+ case EMemSpyThreadInfoItemTypeSession:
+ case EMemSpyThreadInfoItemTypeSemaphore:
+ case EMemSpyThreadInfoItemTypeMutex:
+ case EMemSpyThreadInfoItemTypeTimer:
+ case EMemSpyThreadInfoItemTypeLDD:
+ case EMemSpyThreadInfoItemTypePDD:
+ case EMemSpyThreadInfoItemTypeLogicalChannel:
+ case EMemSpyThreadInfoItemTypeChangeNotifier:
+ case EMemSpyThreadInfoItemTypeUndertaker:
+ case EMemSpyThreadInfoItemTypeMessageQueue:
+ case EMemSpyThreadInfoItemTypeConditionalVariable:
+ case EMemSpyThreadInfoItemTypeOpenFiles:
+ case EMemSpyThreadInfoItemTypeOtherThreads:
+ case EMemSpyThreadInfoItemTypeOtherProcesses:
+ case EMemSpyThreadInfoItemTypeOwnedThreadHandles:
+ case EMemSpyThreadInfoItemTypeOwnedProcessHandles:
+ child = new(ELeave) CMemSpyViewThreadInfoItemGeneric( iEngine, iObserver, iThread.InfoContainerL(), type );
+ break;
+
+ default:
+ __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0) );
+ break;
+ }
+ //
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+TBool CMemSpyViewThreadInfoItemList::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdThreadInfoHandles:
+ OnCmdInfoHandlesL();
+ break;
+
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewThreadInfoItemList::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
+ {
+ if ( aResourceId == R_MEMSPY_MENUPANE )
+ {
+ aMenuPane->SetItemDimmed( EMemSpyCmdThread, iThread.IsDead() );
+ }
+ else if ( aResourceId == MenuCascadeResourceId() )
+ {
+ // Always remove these items - they are only shown in the master thread view
+ aMenuPane->SetItemDimmed( EMemSpyCmdThreadSetPriority, ETrue );
+ aMenuPane->SetItemDimmed( EMemSpyCmdThreadEnd, ETrue );
+ }
+ }
+
+
+void CMemSpyViewThreadInfoItemList::OnCmdInfoHandlesL()
+ {
+ iThread.InfoContainerForceSyncronousConstructionL().PrintL();
+ }
+
+
+void CMemSpyViewThreadInfoItemList::HandleMemSpyEngineInfoContainerEventL( TEvent aEvent, TMemSpyThreadInfoItemType aType )
+ {
+ if ( aEvent == EInfoItemChanged )
+ {
+ }
+ else if ( aEvent == EInfoItemDestroyed )
+ {
+ if ( iCurrentInfoItem && iCurrentInfoItem->Type() == aType )
+ {
+ iCurrentInfoItem->Close();
+ iCurrentInfoItem = NULL;
+ }
+ }
+
+ iIdleResetListboxTimer->Cancel();
+ iIdleResetListboxTimer->Start( KMemSpyIdleResetListboxTimerPeriod, KMemSpyIdleResetListboxTimerPeriod, TCallBack( IdleUpdateListBoxModel, this ) );
+ }
+
+
+void CMemSpyViewThreadInfoItemList::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( &iThread.InfoContainerL() );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewThreadInfoItemList::HandleListBoxItemActionedL( TInt /*aIndex*/ )
+ {
+ // Notify observer about an item being 'fired'
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewThreadInfoItemList::HandleListBoxItemSelectedL( TInt aIndex )
+ {
+ if ( iCurrentInfoItem )
+ {
+ CMemSpyThreadInfoItemBase* item = iCurrentInfoItem;
+ iCurrentInfoItem = NULL;
+ item->Close();
+ }
+
+ // Identify the type of item to display...
+ iCurrentInfoItem = &iThread.InfoContainerL().Item( aIndex );
+ iCurrentInfoItem->Open();
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+TInt CMemSpyViewThreadInfoItemList::IdleUpdateListBoxModel( TAny* aSelf )
+ {
+ CMemSpyViewThreadInfoItemList* self = reinterpret_cast< CMemSpyViewThreadInfoItemList* >( aSelf );
+ TRAP_IGNORE( self->DoIdleUpdateListBoxModelL() );
+ return EFalse;
+ }
+
+
+void CMemSpyViewThreadInfoItemList::DoIdleUpdateListBoxModelL()
+ {
+ CMemSpyThreadInfoContainer& container = iThread.InfoContainerL();
+
+ // Try to maintain current item selection if at all possible.
+ TMemSpyThreadInfoItemType type = EMemSpyThreadInfoItemTypeHeap;
+ if ( iCurrentInfoItem )
+ {
+ type = iCurrentInfoItem->Type();
+ }
+
+ // Update list box & model
+ SetListBoxModelL();
+ iListBox->HandleItemAdditionL();
+ RefreshL();
+
+ // Try to select previous item if it is still available
+ const TInt index = container.InfoItemIndexByType( type );
+ if ( index >= 0 && index < container.MdcaCount() )
+ {
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+
+ iIdleResetListboxTimer->Cancel();
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewThreadInfoItemMemoryTracking.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,664 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewThreadInfoItemMemoryTracking.h"
+
+// System includes
+#include <AknQueryDialog.h>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyengineprocessmemorytracker.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+
+// User includes
+#include "MemSpyContainerObserver.h"
+
+
+CMemSpyViewThreadInfoItemMemoryTracking::CMemSpyViewThreadInfoItemMemoryTracking( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
+: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking )
+ {
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTracking::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingObserverAddL( *this );
+
+ // Reset the title
+ _LIT( KCustomTitle, "Memory Statistics" );
+ SetTitleL( KCustomTitle );
+
+ // Select the appropriate view
+ const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune );
+ const TInt index = IndexByViewType( viewType );
+ //
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::ConstructL() - aSelectionRune: 0x%08x, viewType: %d, index: %d", aSelectionRune, viewType, index );
+#endif
+ //
+ if ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
+ {
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+ }
+
+
+TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTracking::ViewType() const
+ {
+ return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatistics;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTracking::PrepareParentViewL()
+ {
+ CMemSpyViewBase* parent = CMemSpyViewThreadInfoItemGeneric::PrepareParentViewL();
+
+ // Stop observing changes
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingObserverRemove( *this );
+
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTracking::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+ //
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ const TInt index = iListBox->CurrentItemIndex();
+ if ( index == 1 )
+ {
+ child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingCurrent( iEngine, iObserver, Container() );
+ }
+ else if ( index == 2 )
+ {
+ child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingHWM( iEngine, iObserver, Container() );
+ }
+ else if ( index == 3 )
+ {
+ child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingPeak( iEngine, iObserver, Container() );
+ }
+ //
+ if ( child )
+ {
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+
+ // Stop observing changes
+ item->TrackingObserverRemove( *this );
+ }
+ //
+ return child;
+ }
+
+
+TBool CMemSpyViewThreadInfoItemMemoryTracking::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdMemoryTrackingStart:
+ OnCmdTrackingStartL();
+ break;
+ case EMemSpyCmdMemoryTrackingStop:
+ OnCmdTrackingStopL();
+ break;
+ case EMemSpyCmdMemoryTrackingHWMReset:
+ OnCmdHWMResetL();
+ break;
+ case EMemSpyCmdMemoryTrackingTotalWithSharedMem:
+ OnCmdTotalWithSharedMemL();
+ break;
+ case EMemSpyCmdMemoryTrackingTotalWithoutSharedMem:
+ OnCmdTotalWithoutSharedMemL();
+ break;
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+TInt CMemSpyViewThreadInfoItemMemoryTracking::IndexByViewType( TMemSpyViewType aType )
+ {
+ TInt index = 0;
+ //
+ switch( aType )
+ {
+ default:
+ case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent:
+ index = 1;
+ break;
+ case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM:
+ index = 2;
+ break;
+ case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak:
+ index = 3;
+ break;
+ }
+ //
+ return index;
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTracking::HandleListBoxItemActionedL( TInt aIndex )
+ {
+ if ( aIndex == 0 )
+ {
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ if ( item->TrackingActive() )
+ {
+ OnCmdTrackingStopL();
+ }
+ else
+ {
+ OnCmdTrackingStartL();
+ }
+ }
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+
+ // Ensure we refresh the listbox content
+ iListBox->DrawDeferred();
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTracking::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ iListBox->DrawDeferred();
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTracking::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
+ {
+ if ( aResourceId == MenuCascadeResourceId() )
+ {
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ //
+ if ( !item->TrackerExists() || item->TrackingActive() )
+ {
+ aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingStart, ETrue );
+ }
+ else
+ {
+ aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingStop, ETrue );
+ }
+ //
+ if ( item->TotalIncludesSharedMemory() )
+ {
+ aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingTotalWithSharedMem, ETrue );
+ }
+ else
+ {
+ aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingTotalWithoutSharedMem, ETrue );
+ }
+
+ aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingHWMReset, Thread().IsDead() );
+ }
+ else if ( aResourceId == R_MEMSPY_MENUPANE )
+ {
+ aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTracking, Thread().IsDead() );
+ aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStart, Thread().IsDead() );
+ }
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryTrackingStartedL()
+ {
+ RefreshL();
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryTrackingStoppedL()
+ {
+ RefreshL();
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
+ {
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL() - START - this: 0x%08x", this );
+#endif
+
+ CMemSpyViewBase::RefreshL();
+ iListBox->DrawDeferred();
+
+#ifdef _DEBUG
+ RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL() - END - this: 0x%08x", this );
+#endif
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTrackingStartL()
+ {
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingStartL();
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTrackingStopL()
+ {
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingStopL();
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdHWMResetL()
+ {
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingResetHWML();
+ RefreshL();
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTotalWithSharedMemL()
+ {
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingSetTotalIncludesSharedMemoryL( ETrue );
+ RefreshL();
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTotalWithoutSharedMemL()
+ {
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingSetTotalIncludesSharedMemoryL( EFalse );
+ RefreshL();
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewThreadInfoItemMemoryTrackingCurrent::CMemSpyViewThreadInfoItemMemoryTrackingCurrent( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
+: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking )
+ {
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
+
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingObserverAddL( *this );
+
+ // Reset the title
+ _LIT( KCustomTitle, "Current Statistics" );
+ SetTitleL( KCustomTitle );
+ }
+
+
+TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingCurrent::ViewType() const
+ {
+ return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingCurrent::PrepareParentViewL()
+ {
+ CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+
+ // Stop observing changes
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingObserverRemove( *this );
+
+ return parent;
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::SetListBoxModelL()
+ {
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ MDesCArray* model = &item->InfoCurrent();
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
+ {
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewThreadInfoItemMemoryTrackingHWM::CMemSpyViewThreadInfoItemMemoryTrackingHWM( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
+: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking )
+ {
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTrackingHWM::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
+
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingObserverAddL( *this );
+
+ // Reset the title
+ _LIT( KCustomTitle, "HWM Statistics" );
+ SetTitleL( KCustomTitle );
+ }
+
+
+TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingHWM::ViewType() const
+ {
+ return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingHWM::PrepareParentViewL()
+ {
+ CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+
+ // Stop observing changes
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingObserverRemove( *this );
+
+ return parent;
+ }
+
+
+TBool CMemSpyViewThreadInfoItemMemoryTrackingHWM::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdMemoryTrackingHWMReset:
+ OnCmdHWMResetL();
+ break;
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTrackingHWM::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTrackingHWM::SetListBoxModelL()
+ {
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ MDesCArray* model = &item->InfoHWM();
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTrackingHWM::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
+ {
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTrackingHWM::OnCmdHWMResetL()
+ {
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingResetHWML();
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewThreadInfoItemMemoryTrackingPeak::CMemSpyViewThreadInfoItemMemoryTrackingPeak( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
+: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking )
+ {
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTrackingPeak::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
+
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingObserverAddL( *this );
+
+ // Reset the title
+ _LIT( KCustomTitle, "Peak Statistics" );
+ SetTitleL( KCustomTitle );
+ }
+
+
+TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingPeak::ViewType() const
+ {
+ return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingPeak::PrepareParentViewL()
+ {
+ CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+
+ // Stop observing changes
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ item->TrackingObserverRemove( *this );
+
+ return parent;
+ }
+
+
+TBool CMemSpyViewThreadInfoItemMemoryTrackingPeak::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTrackingPeak::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTrackingPeak::SetListBoxModelL()
+ {
+ CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
+ MDesCArray* model = &item->InfoPeak();
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewThreadInfoItemMemoryTrackingPeak::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
+ {
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewThreadInfoItemServer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,391 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewThreadInfoItemServer.h"
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperheap.h>
+#include <memspy/engine/memspyenginehelperserver.h>
+
+// User includes
+#include "MemSpyContainerObserver.h"
+
+// Constants
+const TInt KMemSpyServerSessionsIndex = 2;
+
+
+
+CMemSpyViewThreadInfoItemServer::CMemSpyViewThreadInfoItemServer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
+: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeServer )
+ {
+ }
+
+
+void CMemSpyViewThreadInfoItemServer::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ // Causes list of server's to be prepared
+ CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
+
+ _LIT( KTitle, "Server List" );
+ SetTitleL( KTitle );
+
+#ifdef _DEBUG
+ RDebug::Printf( "CMemSpyViewThreadInfoItemServer::ConstructL() - aSelectionRune: 0x%08x", aSelectionRune );
+#endif
+
+ // Try to select the correct server
+ CMemSpyThreadInfoHandleObjectBase* infoItem = static_cast< CMemSpyThreadInfoHandleObjectBase* >( iInfoItem );
+ TInt selectedIndex = 0;
+ if ( aSelectionRune )
+ {
+ // Treat the rune as a handle, and try to look it up
+ selectedIndex = infoItem->DetailsIndexByHandle( aSelectionRune );
+ }
+
+ // Select item
+ if ( infoItem->DetailsCount() > 0 )
+ {
+ iListBox->SetCurrentItemIndex( selectedIndex );
+ HandleListBoxItemSelectedL( selectedIndex );
+ }
+ }
+
+
+TBool CMemSpyViewThreadInfoItemServer::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ return handled;
+ }
+
+
+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 )
+ {
+ // Identify the type of item to display...
+ CMemSpyThreadInfoHandleObjectBase* infoItem = static_cast< CMemSpyThreadInfoHandleObjectBase* >( iInfoItem );
+ iCurrentInfoItemDetails = infoItem->DetailsAt( aIndex );
+
+#ifdef _DEBUG
+ RDebug::Printf( "CMemSpyViewThreadInfoItemServer::HandleListBoxItemSelectedL() - iCurrentInfoItemDetails.iHandle: 0x%08x", iCurrentInfoItemDetails.iHandle );
+#endif
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewThreadInfoItemServerDetails::CMemSpyViewThreadInfoItemServerDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails )
+: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeServer ), iInfoItemDetails( aInfoItemDetails )
+ {
+ }
+
+
+void CMemSpyViewThreadInfoItemServerDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ // Causes list of server's to be prepared
+ CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
+
+ _LIT( KTitle, "Server Details" );
+ SetTitleL( KTitle );
+
+ // Try to select the correct server
+ TInt selectedIndex = 0;
+ if ( aSelectionRune )
+ {
+ // Presence of non-null item means that we came from the "Server sessions" list
+ selectedIndex = KMemSpyServerSessionsIndex;
+ }
+
+ // Select item
+ iListBox->SetCurrentItemIndex( selectedIndex );
+ HandleListBoxItemSelectedL( selectedIndex );
+ }
+
+
+TBool CMemSpyViewThreadInfoItemServerDetails::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ return handled;
+ }
+
+
+TMemSpyViewType CMemSpyViewThreadInfoItemServerDetails::ViewType() const
+ {
+ return EMemSpyViewTypeThreadInfoItemServerDetails;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemServerDetails::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+ const TInt currentIndex = iListBox->CurrentItemIndex();
+ //
+ if ( currentIndex == KMemSpyServerSessionsIndex )
+ {
+ CMemSpyViewThreadInfoItemServerSessions* serverSessions = new(ELeave) CMemSpyViewThreadInfoItemServerSessions( iEngine, iObserver, iInfoItem->Container(), iInfoItemDetails );
+ CleanupStack::PushL( serverSessions );
+ serverSessions->ConstructL( Rect(), *Parent(), NULL );
+ CleanupStack::Pop( serverSessions );
+ child = serverSessions;
+ }
+ //
+ return child;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemServerDetails::PrepareParentViewL()
+ {
+ CMemSpyViewThreadInfoItemServer* parent = new(ELeave) CMemSpyViewThreadInfoItemServer( iEngine, iObserver, iInfoItem->Container() );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), iInfoItemDetails.iHandle );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+void CMemSpyViewThreadInfoItemServerDetails::SetListBoxModelL()
+ {
+ CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(4);
+ CleanupStack::PushL( model );
+
+ TBuf<KMaxFullName + 1> item;
+
+ // 1st item = session type
+ const TPtrC pServerSessionType = CMemSpyThreadInfoServer::SessionType( iInfoItemDetails.iSessionType );
+ _LIT(KItem1Format, "\tServer Type\t\t%S");
+ item.Format( KItem1Format, &pServerSessionType );
+ model->AppendL( item );
+
+ // 2nd item = session count
+ _LIT(KItem2Format, "\tConnected Sessions\t\t%d");
+ item.Format( KItem2Format, iInfoItemDetails.iCount );
+ model->AppendL( item );
+
+ // 3rd item = view sessions
+ if ( iInfoItem->Container().MdcaCount() > 0 )
+ {
+ _LIT(KItem3Format, "\tView Sessions");
+ model->AppendL( KItem3Format );
+ }
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+ CleanupStack::Pop( model );
+ }
+
+
+void CMemSpyViewThreadInfoItemServerDetails::HandleListBoxItemActionedL( TInt /*aIndex*/ )
+ {
+ // Notify observer about an item being 'fired'
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewThreadInfoItemServerDetails::HandleListBoxItemSelectedL( TInt /*aIndex*/ )
+ {
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyViewThreadInfoItemServerSessions::CMemSpyViewThreadInfoItemServerSessions( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails )
+: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeServer ), iInfoItemDetails( aInfoItemDetails )
+ {
+ }
+
+
+void CMemSpyViewThreadInfoItemServerSessions::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
+ //
+ _LIT( KTitle, "Connected Session List" );
+ SetTitleL( KTitle );
+ }
+
+
+TBool CMemSpyViewThreadInfoItemServerSessions::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ return handled;
+ }
+
+
+TMemSpyViewType CMemSpyViewThreadInfoItemServerSessions::ViewType() const
+ {
+ return EMemSpyViewTypeThreadInfoItemServerSessions;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreadInfoItemServerSessions::PrepareParentViewL()
+ {
+ CMemSpyViewThreadInfoItemServerDetails* parent = new(ELeave) CMemSpyViewThreadInfoItemServerDetails( iEngine, iObserver, iInfoItem->Container(), iInfoItemDetails );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), this );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+void CMemSpyViewThreadInfoItemServerSessions::SetListBoxModelL()
+ {
+ CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(4);
+ CleanupStack::PushL( model );
+
+ // Get handles
+ RArray<TMemSpyDriverServerSessionInfo> sessions;
+ CleanupClosePushL( sessions );
+ iEngine.HelperServer().GetServerSessionsL( iInfoItemDetails, sessions );
+
+ // Prepare items
+ TBuf<KMaxFullName + 1> item;
+ const TInt count = sessions.Count();
+ for( TInt i=0; i<count; i++ )
+ {
+ _LIT(KInsertTab, "\t");
+
+ const TMemSpyDriverServerSessionInfo& session = sessions[ i ];
+ item.Zero();
+
+ if ( session.iOwnerType == TMemSpyDriverServerSessionInfo::EOwnerThread )
+ {
+ // Find the thread object
+ CMemSpyThread* thread = NULL;
+ CMemSpyProcess* process = NULL;
+ //
+ const TInt error = iEngine.Container().ProcessAndThreadByThreadId( session.iOwnerId, process, thread );
+ //
+ if ( error == KErrNone )
+ {
+ item.Append( process->Name() );
+ item.Append( KInsertTab );
+ item.Append( KInsertTab );
+ item.Append( thread->Name() );
+ }
+ }
+ else if ( session.iOwnerType == TMemSpyDriverServerSessionInfo::EOwnerProcess )
+ {
+ // Find the process object
+ CMemSpyProcess* process = NULL;
+ TRAPD( error, process = &iEngine.Container().ProcessByIdL( session.iOwnerId ) );
+ if ( error == KErrNone )
+ {
+ item.Append( process->Name() );
+ }
+ }
+
+ if ( !item.Length() )
+ {
+ // Fall-back case
+ item.Copy( session.iName );
+ }
+
+ // Add item
+ item.Insert( 0, KInsertTab );
+ model->AppendL( item );
+ }
+ CleanupStack::PopAndDestroy( &sessions );
+
+ // Set up list box
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( model );
+ listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+ CleanupStack::Pop( model );
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewThreadInfoItemStack.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyViewThreadInfoItemStack.h"
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspy/engine/memspyenginehelperstack.h>
+
+// User includes
+#include "MemSpyContainerObserver.h"
+#include "MemSpyViewThreads.h"
+#include "MemSpyViewThreadInfoItemHeap.h"
+
+
+
+CMemSpyViewThreadInfoItemStack::CMemSpyViewThreadInfoItemStack( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
+: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeStack )
+ {
+ }
+
+
+TBool CMemSpyViewThreadInfoItemStack::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+#ifndef __WINS__
+ case EMemSpyCmdStackDataUser:
+ OnCmdStackDataUserL();
+ break;
+ case EMemSpyCmdStackDataKernel:
+ OnCmdStackDataKernelL();
+ break;
+#endif
+ case EMemSpyCmdStackInfoThread:
+ OnCmdStackInfoL();
+ break;
+
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewThreadInfoItemStack::OnCmdStackInfoL()
+ {
+ iEngine.HelperStack().OutputStackInfoL( Thread() );
+ }
+
+
+void CMemSpyViewThreadInfoItemStack::OnCmdStackDataUserL()
+ {
+ iEngine.HelperStack().OutputStackDataL( Thread(), EMemSpyDriverDomainUser );
+ }
+
+
+void CMemSpyViewThreadInfoItemStack::OnCmdStackDataKernelL()
+ {
+ iEngine.HelperStack().OutputStackDataL( Thread(), EMemSpyDriverDomainKernel );
+ }
+
+
+void CMemSpyViewThreadInfoItemStack::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
+ {
+ if ( aResourceId == R_MEMSPY_MENUPANE )
+ {
+ aMenuPane->SetItemDimmed( EMemSpyCmdStack, Thread().IsDead() );
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewThreads.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,355 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewThreads.h"
+
+// System includes
+#include <AknQueryDialog.h>
+#include <memspyui.rsg>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectprocess.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
+#include <memspy/engine/memspyenginehelperprocess.h>
+
+// User includes
+#include "MemSpyContainerObserver.h"
+#include "MemSpyViewProcesses.h"
+#include "MemSpyViewThreadInfoItemList.h"
+
+
+
+
+CMemSpyViewThreads::CMemSpyViewThreads( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess )
+: CMemSpyViewBase( aEngine, aObserver ), iParentProcess( aProcess )
+ {
+ iParentProcess.Open();
+ }
+
+
+CMemSpyViewThreads::~CMemSpyViewThreads()
+ {
+ iParentProcess.Close();
+ if ( iCurrentThread )
+ {
+ iCurrentThread->Close();
+ }
+ }
+
+
+void CMemSpyViewThreads::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Threads" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ //
+ if ( aSelectionRune )
+ {
+ CMemSpyThread* selectedItem = reinterpret_cast< CMemSpyThread* >( aSelectionRune );
+ const TInt index = iParentProcess.ThreadIndexById( selectedItem->Id() );
+ if ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
+ {
+ iListBox->SetCurrentItemIndex( index );
+ HandleListBoxItemSelectedL( index );
+ }
+ }
+ else if ( iParentProcess.Count() > 0 )
+ {
+ iListBox->SetCurrentItemIndex( 0 );
+ HandleListBoxItemSelectedL( 0 );
+ }
+ }
+
+
+const CMemSpyProcess& CMemSpyViewThreads::Process() const
+ {
+ return iParentProcess;
+ }
+
+
+CMemSpyThread& CMemSpyViewThreads::CurrentThread()
+ {
+ __ASSERT_ALWAYS( iCurrentThread != NULL, User::Invariant() );
+ return *iCurrentThread;
+ }
+
+
+void CMemSpyViewThreads::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewThreads::ViewType() const
+ {
+ return EMemSpyViewTypeThreads;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreads::PrepareParentViewL()
+ {
+ CMemSpyViewProcesses* parent = new(ELeave) CMemSpyViewProcesses( iEngine, iObserver, iParentProcess );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), &iParentProcess );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewThreads::PrepareChildViewL()
+ {
+ CMemSpyViewThreadInfoItemList* child = new(ELeave) CMemSpyViewThreadInfoItemList( iEngine, iObserver, *iCurrentThread );
+ CleanupStack::PushL( child );
+ child->ConstructL( Rect(), *Parent() );
+ CleanupStack::Pop( child );
+ return child;
+ }
+
+
+void CMemSpyViewThreads::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
+ {
+ if ( aResourceId == R_MEMSPY_MENUPANE )
+ {
+ CMemSpyThread& thread = CurrentThread();
+ aMenuPane->SetItemDimmed( EMemSpyCmdThread, thread.IsDead() );
+ }
+ }
+
+
+TBool CMemSpyViewThreads::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdThreadEndKill:
+ OnCmdEndKillL();
+ break;
+ case EMemSpyCmdThreadEndTerminate:
+ OnCmdEndTerminateL();
+ break;
+ case EMemSpyCmdThreadEndPanic:
+ OnCmdEndPanicL();
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteVeryLow:
+ case EMemSpyCmdThreadSetPriorityAbsoluteLowNormal:
+ case EMemSpyCmdThreadSetPriorityAbsoluteLow:
+ case EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal:
+ case EMemSpyCmdThreadSetPriorityAbsoluteBackground:
+ case EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal:
+ case EMemSpyCmdThreadSetPriorityAbsoluteForeground:
+ case EMemSpyCmdThreadSetPriorityAbsoluteHighNormal:
+ case EMemSpyCmdThreadSetPriorityAbsoluteHigh:
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime1:
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime2:
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime3:
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime4:
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime5:
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime6:
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime7:
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime8:
+ OnCmdSetPriorityL( aCommand );
+ break;
+
+ case EMemSpyCmdThreadInfoHandles:
+ OnCmdInfoHandlesL();
+ break;
+
+ default:
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewThreads::OnCmdEndKillL()
+ {
+ TBool doTerminate = ETrue;
+ CMemSpyThread& thread = CurrentThread();
+ //
+ if ( thread.IsSystemPermanent() )
+ {
+ CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
+ doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
+ }
+ //
+ if ( doTerminate )
+ {
+ thread.KillL();
+ RefreshL();
+ }
+ }
+
+
+void CMemSpyViewThreads::OnCmdEndTerminateL()
+ {
+ TBool doTerminate = ETrue;
+ CMemSpyThread& thread = CurrentThread();
+ //
+ if ( thread.IsSystemPermanent() || thread.IsSystemCritical() )
+ {
+ CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
+ doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
+ }
+ //
+ if ( doTerminate )
+ {
+ thread.TerminateL();
+ RefreshL();
+ }
+ }
+
+
+void CMemSpyViewThreads::OnCmdEndPanicL()
+ {
+ TBool doTerminate = ETrue;
+ CMemSpyThread& thread = CurrentThread();
+ //
+ 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();
+ }
+ }
+
+
+void CMemSpyViewThreads::OnCmdSetPriorityL( TInt aCommand )
+ {
+ TThreadPriority pri = EPriorityAbsoluteBackground;
+ switch( aCommand )
+ {
+ case EMemSpyCmdThreadSetPriorityAbsoluteVeryLow:
+ pri = EPriorityAbsoluteVeryLow;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteLowNormal:
+ pri = EPriorityAbsoluteLowNormal;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteLow:
+ pri = EPriorityAbsoluteLow;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal:
+ pri = EPriorityAbsoluteBackgroundNormal;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteBackground:
+ pri = EPriorityAbsoluteBackground;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal:
+ pri = EPriorityAbsoluteForegroundNormal;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteForeground:
+ pri = EPriorityAbsoluteForeground;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteHighNormal:
+ pri = EPriorityAbsoluteHighNormal;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteHigh:
+ pri = EPriorityAbsoluteHigh;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime1:
+ pri = EPriorityAbsoluteRealTime1;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime2:
+ pri = EPriorityAbsoluteRealTime2;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime3:
+ pri = EPriorityAbsoluteRealTime3;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime4:
+ pri = EPriorityAbsoluteRealTime4;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime5:
+ pri = EPriorityAbsoluteRealTime5;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime6:
+ pri = EPriorityAbsoluteRealTime6;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime7:
+ pri = EPriorityAbsoluteRealTime7;
+ break;
+ case EMemSpyCmdThreadSetPriorityAbsoluteRealTime8:
+ pri = EPriorityAbsoluteRealTime8;
+ break;
+ }
+
+#ifdef _DEBUG
+ RDebug::Printf( "CMemSpyViewThreads::OnCmdSetPriorityL() - pri: %d", pri );
+#endif
+
+ CMemSpyThread& thread = CurrentThread();
+ thread.SetPriorityL( pri );
+ RefreshL();
+
+#ifdef _DEBUG
+ RDebug::Printf( "CMemSpyViewThreads::OnCmdSetPriorityL() - END" );
+#endif
+ }
+
+
+void CMemSpyViewThreads::OnCmdInfoHandlesL()
+ {
+ CMemSpyThread& thread = CurrentThread();
+ thread.InfoContainerForceSyncronousConstructionL().PrintL();
+ }
+
+
+void CMemSpyViewThreads::SetListBoxModelL()
+ {
+ CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( &iParentProcess );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+void CMemSpyViewThreads::HandleListBoxItemActionedL( TInt /*aIndex*/ )
+ {
+ // Notify observer about an item being 'fired'
+ ReportEventL( MMemSpyViewObserver::EEventItemActioned );
+ }
+
+
+void CMemSpyViewThreads::HandleListBoxItemSelectedL( TInt aIndex )
+ {
+ if ( iCurrentThread )
+ {
+ iCurrentThread->Close();
+ }
+
+ // Obtain the thread that corresponds to the selected item
+ CMemSpyThread& thread = iParentProcess.At( aIndex );
+ iCurrentThread = &thread;
+ iCurrentThread->Open();
+
+ // Notify observer about item selection
+ ReportEventL( MMemSpyViewObserver::EEventItemSelected );
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewType.cpp Wed Oct 13 14:32:52 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 "MemSpyViewType.h"
+
+
+
+
+TBool MemSpyViewTypeUtils::IsOpenableItem( TMemSpyViewType aType )
+ {
+ TBool openable = EFalse;
+ //
+ switch( aType )
+ {
+ case EMemSpyViewTypeMainMenu:
+ case EMemSpyViewTypeProcesses:
+ case EMemSpyViewTypeServerList:
+ case EMemSpyViewTypeThreads:
+ case EMemSpyViewTypeThreadInfoItemList:
+ case EMemSpyViewTypeThreadInfoItemServer:
+ case EMemSpyViewTypeThreadInfoItemSession:
+ openable = ETrue;
+ break;
+ default:
+ break;
+ }
+ //
+ return openable;
+ }
+
+
+TBool MemSpyViewTypeUtils::IsThreadInfoItem( TMemSpyViewType aType )
+ {
+ TBool infoItem = ETrue;
+ //
+ switch( aType )
+ {
+ case EMemSpyViewTypeMainMenu:
+ case EMemSpyViewTypeRAMInfo:
+ case EMemSpyViewTypeROMInfo:
+ case EMemSpyViewTypeServerList:
+ case EMemSpyViewTypeOpenFiles:
+ case EMemSpyViewTypeProcesses:
+ case EMemSpyViewTypeThreads:
+ case EMemSpyViewTypeThreadInfoItemList:
+ infoItem = EFalse;
+ break;
+ default:
+ break;
+ }
+ //
+ return infoItem;
+ }
+
+
+TBool MemSpyViewTypeUtils::IsExitableView( TMemSpyViewType aType )
+ {
+ TBool ret = EFalse;
+ //
+ switch( aType )
+ {
+ case EMemSpyViewTypeMainMenu:
+ ret = ETrue;
+ break;
+ default:
+ break;
+ }
+ //
+ return ret;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/source/MemSpyViewWindowGroups.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "MemSpyViewWindowGroups.h"
+
+// System includes
+#include <eikclbd.h>
+#include <aknmessagequerydialog.h>
+#include <aknnotewrappers.h>
+
+// Engine includes
+#include <memspy/engine/memspyengine.h>
+#include <memspy/engine/memspyengineobjectcontainer.h>
+#include <memspy/engine/memspyengineobjectthread.h>
+
+// User includes
+#include "MemSpyUiUtils.h"
+#include "MemSpyViewMainMenu.h"
+#include "MemSpyContainerObserver.h"
+
+// Literal constants
+const TInt KMaxInfoLength = 128;
+
+
+CMemSpyViewWindowGroups::CMemSpyViewWindowGroups( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
+: CMemSpyViewBase( aEngine, aObserver )
+ {
+ }
+
+
+CMemSpyViewWindowGroups::~CMemSpyViewWindowGroups()
+ {
+ delete iWindowGroupList;
+ }
+
+
+void CMemSpyViewWindowGroups::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+ {
+ _LIT( KTitle, "Window Groups" );
+ SetTitleL( KTitle );
+ //
+ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+ }
+
+
+CEikListBox* CMemSpyViewWindowGroups::ConstructListBoxL()
+ {
+ delete iListBox;
+ iListBox = NULL;
+ CAknSingleNumberStyleListBox* listbox = new (ELeave) CAknSingleNumberStyleListBox();
+ iListBox = listbox;
+ listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling );
+ listbox->SetContainerWindowL( *this );
+ listbox->CreateScrollBarFrameL( ETrue );
+ SetListBoxModelL();
+ listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+ listbox->SetListBoxObserver( this );
+ listbox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+ listbox->SetObserver( this );
+ return listbox;
+ }
+
+void CMemSpyViewWindowGroups::RefreshL()
+ {
+ SetListBoxModelL();
+ CMemSpyViewBase::RefreshL();
+ }
+
+
+TMemSpyViewType CMemSpyViewWindowGroups::ViewType() const
+ {
+ return EMemSpyViewTypeWindowGroups;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewWindowGroups::PrepareParentViewL()
+ {
+ CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
+ CleanupStack::PushL( parent );
+ parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
+ CleanupStack::Pop( parent );
+ return parent;
+ }
+
+
+CMemSpyViewBase* CMemSpyViewWindowGroups::PrepareChildViewL()
+ {
+ CMemSpyViewBase* child = NULL;
+ if ( iListBox &&
+ iListBox->Model()->NumberOfItems() &&
+ iListBox->CurrentItemIndex() > KErrNotFound )
+ {
+ DetailsL();
+ }
+ return child;
+ }
+
+
+void CMemSpyViewWindowGroups::SetListBoxModelL()
+ {
+ // Take ownership of new model
+ MMemSpyEngineHelperWindowServer& windowServerManager = iEngine.HelperWindowServer();
+ MMemSpyEngineWindowGroupList* windowGroupList = windowServerManager.WindowGroupListL();
+ delete iWindowGroupList;
+ iWindowGroupList = windowGroupList;
+
+ // Set up list box
+ CAknSingleNumberStyleListBox* listbox = static_cast< CAknSingleNumberStyleListBox* >( iListBox );
+ listbox->Model()->SetItemTextArray( iWindowGroupList );
+ listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+
+TBool CMemSpyViewWindowGroups::HandleCommandL( TInt aCommand )
+ {
+ TBool handled = ETrue;
+ //
+ switch ( aCommand )
+ {
+ case EMemSpyCmdWindowGroupTerminate:
+ {
+ TRAPD( err, OnCmdEndL( aCommand ) );
+ CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
+ if ( err )
+ {
+ note->ExecuteLD( _L("Cannot terminate task") );
+ }
+ else
+ {
+ note->ExecuteLD( _L("Task terminated") );
+ }
+ break;
+ }
+ case EMemSpyCmdWindowGroupSwitchTo:
+ {
+ TRAPD( err, OnCmdSwitchToL() );
+ if ( err )
+ {
+ CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
+ note->ExecuteLD( _L("Cannot bring to foreground") );
+ }
+ break;
+ }
+ case EMemSpyCmdWindowGroupEnd:
+ {
+ TRAPD( err, OnCmdEndL( aCommand ) );
+ CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
+ if ( err )
+ {
+ note->ExecuteLD( _L("Cannot end task") );
+ }
+ else
+ {
+ note->ExecuteLD( _L("Task exited") );
+ }
+ break;
+ }
+ case EMemSpyCmdWindowGroupPanic:
+ {
+ TRAPD( err, OnCmdEndL( aCommand ) );
+ CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
+ if ( err )
+ {
+ note->ExecuteLD( _L("Cannot panic task") );
+ }
+ else
+ {
+ note->ExecuteLD( _L("Task panic'ed") );
+ }
+ break;
+ }
+ default:
+ {
+ handled = CMemSpyViewBase::HandleCommandL( aCommand );
+ break;
+ }
+ }
+ //
+ return handled;
+ }
+
+
+void CMemSpyViewWindowGroups::OnCmdSwitchToL()
+ {
+ MMemSpyEngineHelperWindowServer& windowServerManager = iEngine.HelperWindowServer();
+ TInt id = iWindowGroupList->At( iListBox->CurrentItemIndex() ).iId;
+ windowServerManager.SwitchToL( id );
+ }
+
+
+void CMemSpyViewWindowGroups::OnCmdEndL( TInt aCommand )
+ {
+ TBool doTerminate = ETrue;
+
+ CMemSpyEngineObjectContainer& container = iEngine.Container();
+ TThreadId id = iWindowGroupList->At( iListBox->CurrentItemIndex() ).iThreadId;
+
+ // 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 )
+ {
+ switch ( aCommand )
+ {
+ case EMemSpyCmdWindowGroupTerminate:
+ {
+ thread->TerminateL();
+ break;
+ }
+ case EMemSpyCmdWindowGroupEnd:
+ {
+ thread->KillL();
+ break;
+ }
+ case EMemSpyCmdWindowGroupPanic:
+ {
+ thread->PanicL();
+ break;
+ }
+ default:
+ {
+ // Programming error
+ __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) );
+ }
+ }
+ }
+ }
+ RefreshL();
+ }
+
+
+void CMemSpyViewWindowGroups::DetailsL()
+ {
+ HBufC* messageBuf = HBufC::NewLC( 4096 );
+ TPtr messagePtr = messageBuf->Des();
+
+ // Fetch data from helper
+ TMemSpyEngineWindowGroupDetails selectedObject;
+ MMemSpyEngineHelperWindowServer& windowServerManager = iEngine.HelperWindowServer();
+ TInt id = iWindowGroupList->At( iListBox->CurrentItemIndex() ).iId;
+ windowServerManager.GetWindowGroupDetailsL( id, selectedObject );
+
+ // Append info to string buffer
+ AppendFormatString( messagePtr, _L("WG ID: %d\n"), selectedObject.iId );
+ AppendFormatString( messagePtr, _L("Client ThreadId: %Lu\n"), selectedObject.iThreadId.Id() );
+ TFullName name;
+ name.Copy( selectedObject.iFullName );
+ AppendFormatString( messagePtr, _L("Thr: %S\n"), &name );
+ name.Zero();
+ AppendFormatString( messagePtr, _L("Priority: %d\n"), selectedObject.iPriority );
+ AppendFormatString( messagePtr, _L("Handle: 0x%08X\n"), selectedObject.iWindowGroupHandle );
+ name.Copy( selectedObject.iName );
+ AppendFormatString( messagePtr, _L("Name: %S\n"), &name );
+ name.Zero();
+ AppendFormatString( messagePtr, _L("UID: 0x%08X\n"), selectedObject.iUID );
+ AppendFormatString( messagePtr, _L("IsBusy: %d\n"), selectedObject.iIsBusy );
+ AppendFormatString( messagePtr, _L("IsSystem: %d\n"), selectedObject.iIsSystem );
+ AppendFormatString( messagePtr, _L("IsHidden: %d\n"), selectedObject.iIsHidden );
+ name.Copy( selectedObject.iCaption );
+ AppendFormatString( messagePtr, _L("Caption: %S\n"), &name );
+ name.Zero();
+ name.Copy( selectedObject.iDocName );
+ AppendFormatString( messagePtr, _L("Docname: %S"), &name );
+ name.Zero();
+
+ // Display the buffer on a dialog
+ CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog( CAknQueryDialog::ENoTone );
+ dialog->PrepareLC( R_MEMSPY_KERNEL_OBJECT_DETAILS_DIALOG );
+ TFileName headerText;
+ headerText.Copy( selectedObject.iFullName );
+ dialog->SetHeaderTextL( headerText );
+ dialog->SetMessageTextL( messagePtr );
+ dialog->RunLD();
+
+ CleanupStack::PopAndDestroy( messageBuf );
+ }
+
+
+void CMemSpyViewWindowGroups::AppendFormatString( TPtr& aPtr, TRefByValue<const TDesC> aFmt, ... )
+ {
+ TBuf<KMaxInfoLength> infoString;
+ VA_LIST list;
+ VA_START ( list, aFmt );
+ infoString.FormatList( aFmt, list );
+ aPtr.Append( infoString );
+ }
+
+
--- a/memspyui/ui/avkon/group/MemSpyCapabilities.mmh Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-CAPABILITY ReadUserData WriteUserData ReadDeviceData WriteDeviceData SwEvent PowerMgmt
--- a/memspyui/ui/avkon/group/bld.inf Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_MMPFILES
-memspyui.mmp
--- a/memspyui/ui/avkon/group/memspyui.mmp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#include <bldvariant.hrh>
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-TARGET memspyui.exe
-TARGETTYPE exe
-UID 0x100039CE 0x2002129F
-VENDORID VID_DEFAULT
-SMPSAFE
-
-EPOCSTACKSIZE 0x4000
-EPOCHEAPSIZE 0x100000 0x4000000
-
-#include "MemSpyCapabilities.mmh"
-
-SOURCEPATH ../src
-source MemSpyApp.cpp
-source MemSpyAppUi.cpp
-source MemSpyDocument.cpp
-source MemSpyContainer.cpp
-source MemSpyDeviceWideOperationDialog.cpp
-source MemSpyExportBitmapsToMemoryCardDialog.cpp
-source MemSpyUiUtils.cpp
-source MemSpySettings.cpp
-//
-source MemSpyViewBase.cpp
-source MemSpyViewMainMenu.cpp
-source MemSpyViewType.cpp
-source MemSpyViewProcesses.cpp
-source MemSpyViewServerList.cpp
-/*
-source MemSpyViewOpenFiles.cpp
-source MemSpyViewRAMInfo.cpp
-source MemSpyViewROMInfo.cpp
-source MemSpyViewFBServBitmaps.cpp
-source MemSpyViewSystemConfig.cpp
-source MemSpyViewCodeSegList.cpp
-source MemSpyViewChunkList.cpp
-*/
-source MemSpyViewKernel.cpp
-source MemSpyViewKernelContainers.cpp
-source MemSpyViewKernelHeap.cpp
-source MemSpyViewKernelObjects.cpp
-/*
-source MemSpyViewDriveInfo.cpp
-source MemSpyViewECom.cpp
-*/
-source MemSpyViewThreads.cpp
-source MemSpyViewThreadInfoItemList.cpp
-source MemSpyViewThreadInfoItemGeneric.cpp
-source MemSpyViewThreadInfoItemHeap.cpp
-source MemSpyViewThreadInfoItemStack.cpp
-source MemSpyViewThreadInfoItemCodeSeg.cpp
-source MemSpyViewThreadInfoItemChunk.cpp
-source MemSpyViewThreadInfoItemServer.cpp
-source MemSpyViewThreadInfoItemActiveObject.cpp
-source MemSpyViewThreadInfoItemGeneralInfo.cpp
-
-source MemSpyViewHeapTracking.cpp
-source MemSpyViewHeapTrackingResults.cpp
-source MemSpyViewHeapTrackingSettings.cpp
-/*
-source MemSpyViewThreadInfoItemMemoryTracking.cpp
-source MemSpyViewMemoryTrackingAutoStartConfig.cpp
-source MemSpyViewWindowGroups.cpp
-source MemSpyViewKernelObjects.cpp
-*/
-
-USERINCLUDE ../inc
-
-APP_LAYER_SYSTEMINCLUDE
-
-
-START RESOURCE ../../../data/memspyui.rss
-HEADER
-TARGETPATH APP_RESOURCE_DIR
-END
-
-START RESOURCE ../../../data/memspyui_reg.rss
-DEPENDS memspyui.rsg
-TARGETPATH /private/10003a3f/import/apps
-END
-
-LIBRARY fbscli.lib imageconversion.lib estor.lib apgrfx.lib
-LIBRARY euser.lib apparc.lib cone.lib eikcore.lib
-LIBRARY eikcoctl.lib avkon.lib etext.lib eikctl.lib
-LIBRARY efsrv.lib bafl.lib egul.lib hal.lib
-LIBRARY cdlengine.lib xmlframework.lib charconv.lib viewcli.lib
-LIBRARY eikdlg.lib ws32.lib bitgdi.lib
-
-LIBRARY MemSpyClient.lib
-LIBRARY memspydriverclient.lib
-LIBRARY memspyengine.lib
--- a/memspyui/ui/avkon/inc/MemSpy.hrh Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,246 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPY_HRH
-#define MEMSPY_HRH
-
-#define KMemSpyMenuCommandBase 50000
-#define KMemSpyMenuCommandViewSpecific (KMemSpyMenuCommandBase + 10000)
-
-enum TMemSpyCommandIds
- {
- ////////////////////////////////
- // GENERIC MENU COMMANDS
- ////////////////////////////////
- EMemSpyCmdOpen = KMemSpyMenuCommandBase,
- //
- EMemSpyCmdView,
- EMemSpyCmdViewRefresh,
- EMemSpyCmdViewOutputToSink,
- //
- EMemSpyCmdTools,
- EMemSpyCmdToolsListOpenFiles,
- EMemSpyCmdToolsAbout,
- //
- EMemSpyCmdPhoneInfo,
- EMemSpyCmdPhoneInfoGeneral,
- EMemSpyCmdPhoneInfoGeneralSummary,
- EMemSpyCmdPhoneInfoGeneralDetailed,
- EMemSpyCmdPhoneInfoGeneralHandles,
- EMemSpyCmdPhoneInfoGeneralKernelContainers,
- EMemSpyCmdPhoneInfoHeap,
- EMemSpyCmdPhoneInfoHeapInfoSummary,
- EMemSpyCmdPhoneInfoHeapInfoCompact,
- EMemSpyCmdPhoneInfoHeapCellListing,
- EMemSpyCmdPhoneInfoHeapDump,
- EMemSpyCmdPhoneInfoStack,
- EMemSpyCmdPhoneInfoStackInfo,
- EMemSpyCmdPhoneInfoStackInfoCompact,
- EMemSpyCmdPhoneInfoStackDumpUser,
- EMemSpyCmdPhoneInfoStackDumpKernel,
- //
- EMemSpyCmdAutoCapture,
- EMemSpyCmdAutoCaptureToggle,
- EMemSpyCmdAutoCaptureRetryTime,
- EMemSpyCmdAutoCaptureOperationType,
-
- ////////////////////////////////
- // VIEW SPECIFIC MENU COMMANDS
- ////////////////////////////////
- EMemSpyCmdProcess = KMemSpyMenuCommandViewSpecific,
- EMemSpyCmdProcessInfo,
- EMemSpyCmdProcessInfoSummary,
- EMemSpyCmdProcessInfoHandles,
- EMemSpyCmdProcessSort,
- EMemSpyCmdProcessSortById,
- EMemSpyCmdProcessSortByName,
- EMemSpyCmdProcessSortByThreadCount,
- EMemSpyCmdProcessSortByCodeSegs,
- EMemSpyCmdProcessSortByHeapUsage,
- EMemSpyCmdProcessSortByStackUsage,
- EMemSpyCmdProcessEnd,
- EMemSpyCmdProcessEndKill,
- EMemSpyCmdProcessEndPanic,
- EMemSpyCmdProcessEndTerminate,
- //
- EMemSpyCmdThread,
- EMemSpyCmdThreadEnd,
- EMemSpyCmdThreadEndKill,
- EMemSpyCmdThreadEndPanic,
- EMemSpyCmdThreadEndTerminate,
- EMemSpyCmdThreadSetPriority,
- EMemSpyCmdThreadSetPriorityAbsoluteVeryLow,
- EMemSpyCmdThreadSetPriorityAbsoluteLowNormal,
- EMemSpyCmdThreadSetPriorityAbsoluteLow,
- EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal,
- EMemSpyCmdThreadSetPriorityAbsoluteBackground,
- EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal,
- EMemSpyCmdThreadSetPriorityAbsoluteForeground,
- EMemSpyCmdThreadSetPriorityAbsoluteHighNormal,
- EMemSpyCmdThreadSetPriorityAbsoluteHigh,
- EMemSpyCmdThreadSetPriorityAbsoluteRealTime1,
- EMemSpyCmdThreadSetPriorityAbsoluteRealTime2,
- EMemSpyCmdThreadSetPriorityAbsoluteRealTime3,
- EMemSpyCmdThreadSetPriorityAbsoluteRealTime4,
- EMemSpyCmdThreadSetPriorityAbsoluteRealTime5,
- EMemSpyCmdThreadSetPriorityAbsoluteRealTime6,
- EMemSpyCmdThreadSetPriorityAbsoluteRealTime7,
- EMemSpyCmdThreadSetPriorityAbsoluteRealTime8,
- EMemSpyCmdThreadInfo,
- EMemSpyCmdThreadInfoHandles,
- //
- EMemSpyCmdOutput,
- EMemSpyCmdOutputToDebug,
- EMemSpyCmdOutputToFile,
- //
- EMemSpyCmdHeap,
- EMemSpyCmdHeapInfoThread,
- EMemSpyCmdHeapData,
- EMemSpyCmdHeapCellListing,
- EMemSpyCmdHeapDataDump,
- //
- EMemSpyCmdStack,
- EMemSpyCmdStackInfoThread,
- EMemSpyCmdStackData,
- EMemSpyCmdStackDataUser,
- EMemSpyCmdStackDataKernel,
- //
- EMemSpyCmdChunk,
- EMemSpyCmdChunkSort,
- EMemSpyCmdChunkSortByName,
- EMemSpyCmdChunkSortBySize,
- EMemSpyCmdChunkListing,
- //
- EMemSpyCmdCodeSeg,
- EMemSpyCmdCodeSegShow,
- EMemSpyCmdCodeSegShowItemsAll,
- EMemSpyCmdCodeSegShowItemsGlobalData,
- EMemSpyCmdCodeSegShowCaps,
- EMemSpyCmdCodeSegShowCapsWithTCBProcess,
- EMemSpyCmdCodeSegShowCapsWithTCBAll,
- EMemSpyCmdCodeSegShowCapsWithCommDDProcess,
- EMemSpyCmdCodeSegShowCapsWithCommDDAll,
- EMemSpyCmdCodeSegShowCapsWithPowerMgmtProcess,
- EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll,
- EMemSpyCmdCodeSegShowCapsWithMultimediaDDProcess,
- EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll,
- EMemSpyCmdCodeSegShowCapsWithReadDeviceDataProcess,
- EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll,
- EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataProcess,
- EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll,
- EMemSpyCmdCodeSegShowCapsWithDRMProcess,
- EMemSpyCmdCodeSegShowCapsWithDRMAll,
- EMemSpyCmdCodeSegShowCapsWithTrustedUIProcess,
- EMemSpyCmdCodeSegShowCapsWithTrustedUIAll,
- EMemSpyCmdCodeSegShowCapsWithProtServProcess,
- EMemSpyCmdCodeSegShowCapsWithProtServAll,
- EMemSpyCmdCodeSegShowCapsWithDiskAdminProcess,
- EMemSpyCmdCodeSegShowCapsWithDiskAdminAll,
- EMemSpyCmdCodeSegShowCapsWithNetworkControlProcess,
- EMemSpyCmdCodeSegShowCapsWithNetworkControlAll,
- EMemSpyCmdCodeSegShowCapsWithAllFilesProcess,
- EMemSpyCmdCodeSegShowCapsWithAllFilesAll,
- EMemSpyCmdCodeSegShowCapsWithSwEventProcess,
- EMemSpyCmdCodeSegShowCapsWithSwEventAll,
- EMemSpyCmdCodeSegShowCapsWithNetworkServicesProcess,
- EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll,
- EMemSpyCmdCodeSegShowCapsWithLocalServicesProcess,
- EMemSpyCmdCodeSegShowCapsWithLocalServicesAll,
- EMemSpyCmdCodeSegShowCapsWithReadUserDataProcess,
- EMemSpyCmdCodeSegShowCapsWithReadUserDataAll,
- EMemSpyCmdCodeSegShowCapsWithWriteUserDataProcess,
- EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll,
- EMemSpyCmdCodeSegShowCapsWithLocationProcess,
- EMemSpyCmdCodeSegShowCapsWithLocationAll,
- EMemSpyCmdCodeSegShowCapsWithSurroundingsDDProcess,
- EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll,
- EMemSpyCmdCodeSegShowCapsWithUserEnvProcess,
- EMemSpyCmdCodeSegShowCapsWithUserEnvAll,
- EMemSpyCmdCodeSegSort,
- EMemSpyCmdCodeSegSortByName,
- EMemSpyCmdCodeSegSortByCodeSize,
- EMemSpyCmdCodeSegSortByDataSize,
- EMemSpyCmdCodeSegSortByUid,
- EMemSpyCmdCodeSegListing,
- //
- EMemSpyCmdImages,
- EMemSpyCmdImagesSlideshow,
- EMemSpyCmdImagesSaveAllToMemoryCard,
- EMemSpyCmdImagesListing,
- //
- EMemSpyCmdActiveObject,
- EMemSpyCmdActiveObjectListing,
- //
- EMemSpyCmdServerList,
- EMemSpyCmdServerListOutput,
- EMemSpyCmdServerListOutputListCSV,
- EMemSpyCmdServerListOutputListDetailed,
- EMemSpyCmdServerListSort,
- EMemSpyCmdServerListSortByName,
- EMemSpyCmdServerListSortBySessionCount,
- //
- EMemSpyCmdKernelContainers,
- EMemSpyCmdKernelContainersOutput,
- EMemSpyCmdKernelObjects,
- EMemSpyCmdKernelObjectTerminate,
- EMemSpyCmdKernelObjectSwitchTo,
- EMemSpyCmdKernelObjectEnd,
- EMemSpyCmdKernelObjectPanic,
-
- //
- EMemSpyCmdKernelHeap,
- EMemSpyCmdKernelHeapDump,
- //
- EMemSpyCmdRAM,
- EMemSpyCmdRAMAvkonIconCacheDisabled,
- EMemSpyCmdRAMAvkonIconCacheEnabled,
- //
- EMemSpyCmdBTrace,
- EMemSpyCmdBTraceCaptureToggle,
- //
- EMemSpyCmdMemoryTracking,
- EMemSpyCmdMemoryTrackingStart,
- EMemSpyCmdMemoryTrackingStop,
- EMemSpyCmdMemoryTrackingAutoStart,
- EMemSpyCmdMemoryTrackingAutoStartItemAdd,
- EMemSpyCmdMemoryTrackingAutoStartItemEdit,
- EMemSpyCmdMemoryTrackingAutoStartItemDelete,
- EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll,
- EMemSpyCmdMemoryTrackingAutoStartItemImport,
- EMemSpyCmdMemoryTrackingHWM,
- EMemSpyCmdMemoryTrackingHWMReset,
- EMemSpyCmdMemoryTrackingTotalWithSharedMem,
- EMemSpyCmdMemoryTrackingTotalWithoutSharedMem,
-
- //
- EMemSpyCmdWindowGroups,
- EMemSpyCmdWindowGroupTerminate,
- EMemSpyCmdWindowGroupSwitchTo,
- EMemSpyCmdWindowGroupEnd,
- EMemSpyCmdWindowGroupPanic
- };
-
-enum TMemSpyControlIds
- {
- EMemSpyCtrlIdProgressNote = 1000,
- EMemSpyCtrlIdSlideShowImage,
- EMemSpyCtrlIdWaitNote
- };
-
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyApp.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYAPP_H
-#define MEMSPYAPP_H
-
-// System includes
-#include <aknapp.h>
-
-// Constants
-const TUid KUidMemSpy = { 0x2002129F };
-
-
-class CMemSpyApp : public CAknApplication
- {
-private: // From CApaApplication
- CApaDocument* CreateDocumentL();
- TUid AppDllUid() const;
- };
-
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyAppUi.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYAPPUI_H
-#define MEMSPYAPPUI_H
-
-// System includes
-#include <eikapp.h>
-#include <eikdoc.h>
-#include <e32std.h>
-#include <coeccntx.h>
-#include <aknappui.h>
-#include <coecobs.h>
-
-// User includes
-#include "MemSpyDeviceWideOperationDialog.h"
-#include "MemSpyContainerObserver.h"
-#include <memspy/engine/memspyengineobserver.h>
-#include "MemSpySettings.h"
-
-// Classes referenced
-class CEikMenuBar;
-class CMemSpyEngine;
-class CMemSpyContainer;
-class CMemSpyDocument;
-
-//cigasto
-class RMemSpySession;
-
-
-class CMemSpyAppUi : public CAknAppUi, public MMemSpyContainerObserver, public MCoeControlObserver, public MMemSpyEngineObserver//, public MMemSpyDeviceWideOperationDialogObserver
- {
-public:
- //CMemSpyAppUi( CMemSpyEngine& aEngine );
- CMemSpyAppUi( RMemSpySession& aMemSpySession );
- ~CMemSpyAppUi();
- void ConstructL();
-
-public: // API
- CMemSpyDocument& MemSpyDocument();
- const CMemSpyDocument& MemSpyDocument() const;
- inline CMemSpyContainer& Container() { return *iAppContainer; }
-
-private: // From Avkon
- void HandleStatusPaneSizeChange();
-
-private: // From MCoeControlObserver
- void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType);
-
-private: // From MEikMenuObserver
- void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
-
-private: // From CEikAppUi
- void HandleForegroundEventL(TBool aForeground);
- void HandleCommandL(TInt aCommand);
- TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
-
-private: // From MMemSpyContainerObserver
- void HandleThreadSelectedL( const CMemSpyThread& aThread );
-
-private: // From MMemSpyEngineObserver
- void HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext );
-
-private: // From MMemSpyDeviceWideOperationDialogObserver
- void DWOperationStarted();
- void DWOperationCancelled();
- void DWOperationCompleted();
-
-private: // Internal methods
- void UpdateCBAL();
- void InitiateMemSpyClientServerOperationL( TInt aOpCode );
- void SetViewServerTimeOutStatus( TBool aEnabled );
-
-private: // Command handlers
- void OnCmdBackL();
- void OnCmdExitL();
- void OnCmdOpenL();
- void OnCmdAboutL();
-
- // Output
- void OnCmdOutputToDebugL();
- void OnCmdOutputToFileL();
-
- // Phone-information
- //void OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::TOperation aOp );
- void OnCmdPhoneInformationOperationL( TDeviceWideOperation aOperation );
- void OnCmdPhoneInformationOperationKernelContainersL();
-
- // Automatic capture
- void OnCmdAutoCaptureToggleL();
- void OnCmdAutoCaptureRetryTimeL();
- void OnCmdAutoCaptureOperationTypeL();
-
- // Misc
- void OnCmdToolsBitmapsSaveToMemoryCardL();
- void OnCmdToolsSendToBackgroundL();
- void OnCmdToolsBringToForegroundL();
-
-private: // Auto capture related
- static TInt AutoCaptureCallBack( TAny* aSelf );
- void AutoCaptureCallBackL();
-
-private: // Member data
- //CMemSpyEngine& iEngine;
- RMemSpySession& iMemSpySession;
- CMemSpyContainer* iAppContainer;
- CMemSpySettings* iSettings;
-
- // For phone information dialog
- TBool iRunningDeviceWideOperation;
-
- // For auto-capture
- TInt iAutoCaptureTimerPeriod;
- CMemSpyDeviceWideOperations::TOperation iAutoCaptureOperationType;
- CPeriodic* iAutoCaptureTimer;
- };
-
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyContainer.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYCONTAINER_H
-#define MEMSPYCONTAINER_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-#include "MemSpyViewObserver.h"
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyProcess;
-class CMemSpyThread;
-class CMemSpyThreadInfoItemBase;
-class CMemSpyEngineObjectContainer;
-class MMemSpyContainerObserver;
-//cigasto
-class RMemSpySession;
-
-class CMemSpyContainer : public CCoeControl, public MMemSpyViewObserver
- {
-public:
- //CMemSpyContainer( CMemSpyEngine& aEngine, MMemSpyContainerObserver& aObserver );
- CMemSpyContainer( RMemSpySession& aSession, MMemSpyContainerObserver& aObserver );
- ~CMemSpyContainer();
- void ConstructL( const TRect& aRect );
-
-public: // API
- inline TMemSpyViewType ActiveViewType() const { return iActiveView->ViewType(); }
- inline CMemSpyViewBase& ActiveView() const { return *iActiveView; }
-
-public: // API
- void NavigateToParentViewL();
- void NavigateToChildViewL();
- void HandleCommandL( TInt aCommand );
- void SetNewActiveViewL( CMemSpyViewBase* aNewView );
-
-public: // Command handlers
- void OnCmdViewRefreshL();
-
-private: // From CCoeControl
- void SizeChanged();
- TInt CountComponentControls() const;
- CCoeControl* ComponentControl(TInt aIndex) const;
- void Draw(const TRect& aRect) const;
- TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
-
-private: // From MMemSpyViewObserver
- void HandleMemSpyViewEventL( TViewEventType aEvent, TMemSpyViewType aViewType, CMemSpyViewBase& aReportingView, TAny* aContext );
-
-private: // Internal methods
- CMemSpyViewBase* PrepareTopLevelViewL();
-
-private: // Member data
- //CMemSpyEngine& iEngine;
- RMemSpySession& iMemSpySession;
- MMemSpyContainerObserver& iObserver;
- CMemSpyViewBase* iActiveView;
- CMemSpyViewBase* iPreviousView;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyContainerObserver.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYCONTAINEROBSERVER_H
-#define MEMSPYCONTAINEROBSERVER_H
-
-// Classes referenced
-class CMemSpyThread;
-
-
-class MMemSpyContainerObserver
- {
-public:
- virtual void HandleThreadSelectedL( const CMemSpyThread& aThread ) = 0;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyDeviceWideOperationDialog.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYDEVICEWIDEOPERATIONDIALOG_H
-#define MEMSPYDEVICEWIDEOPERATIONDIALOG_H
-
-// System includes
-#include <AknProgressDialog.h>
-#include <AknWaitDialog.h>
-#include <e32cmn.h>
-
-// Engine includes
-#include <memspy/engine/memspydevicewideoperations.h>
-#include <memspyengineclientinterface.h>
-#include <memspysession.h>
-
-//#include "MemSpyAppUi.h"
-
-// Classes referenced
-//class RMemSpySession;
-
-enum TDeviceWideOperation
-{
- OutputPhoneInfo = 0,
-
- OutputDetailedPhoneInfo,
-
- OutputHeapInfo,
-
- OutputCompactHeapInfo,
-
- OutputHeapCellListing,
-
- OutputHeapData,
-
- OutputStackInfo,
-
- OutputCompactStackInfo,
-
- OutputUserStackData,
-
- OutputKernelStackData
-};
-
-
-class MMemSpyDeviceWideOperationDialogObserver
- {
-public:
- virtual void DWOperationStarted() = 0;
- virtual void DWOperationCancelled() = 0;
- virtual void DWOperationCompleted() = 0;
- };
-
-
-class CMemSpyDwoProgressTracker : public CActive, public MProgressDialogCallback
-{
-public:
- CMemSpyDwoProgressTracker(RMemSpySession &aSession);
-
- virtual ~CMemSpyDwoProgressTracker();
-
- void Start();
-
- void Cancel();
-
- TMemSpyDeviceWideOperationProgress Progress() { return iProgress; }
-
- CAknProgressDialog* ProgressDialog() { return iProgressDialog; }
-
- void UpdateProcessDialogL( TInt aProgress, const TDesC& aProgressText );
-
-protected: // from CActive
-
- void DialogDismissedL(TInt aButtonId);
-
- virtual void RunL();
-
- virtual void DoCancel();
-
- virtual TInt RunError(TInt aError);
-
-private:
- TMemSpyDeviceWideOperationProgress iProgress;
- RMemSpySession iSession;
-
- CEikProgressInfo* iProgressInfo;
- CAknProgressDialog* iProgressDialog;
-};
-
-
-
-
-
-
-class CMemSpyDwoTracker : public CActive
-{
-public:
- CMemSpyDwoTracker(RMemSpySession &aSession, TDeviceWideOperation aOperation);
-
- virtual ~CMemSpyDwoTracker();
-
- void Start();
-
- void Cancel();
-
-protected: // from CActive
-
- virtual void RunL();
-
- virtual void DoCancel();
-
- virtual TInt RunError(TInt aError);
-
-private:
- RMemSpySession iSession;
- CMemSpyDwoProgressTracker *iProgressTracker;
- TDeviceWideOperation iOperation;
-};
-
-
-
-
-
-
-
-class CMemSpyDeviceWideOperationDialog : public CBase, public MProgressDialogCallback, public MMemSpyDeviceWideOperationsObserver
- {
-public:
- //static void ExecuteLD( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver, CMemSpyDeviceWideOperations::TOperation aOperation );
- //static void ExecuteLD( RMemSpySession& aSession, MMemSpyDeviceWideOperationDialogObserver& aObserver, CMemSpyDeviceWideOperations::TOperation aOperation );
- static void ExecuteLD( RMemSpySession& aSession, TDeviceWideOperation aOp );
- ~CMemSpyDeviceWideOperationDialog();
-
- //added
- static CMemSpyDwoTracker* CreateDeviceWideOperation( RMemSpySession& aSession, TDeviceWideOperation aOp );
-
-private:
- //CMemSpyDeviceWideOperationDialog( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver );
- //CMemSpyDeviceWideOperationDialog( RMemSpySession& aSession, MMemSpyDeviceWideOperationDialogObserver& aObserver );
- CMemSpyDeviceWideOperationDialog( RMemSpySession& aSession );
- //void ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation );
- void ExecuteL( TDeviceWideOperation aOp );
-
-public: // API
- void Cancel();
-
-private: // From MProgressDialogCallback
- void DialogDismissedL( TInt aButtonId );
-
-private: // From MMemSpyDeviceWideOperationsObserver
- void HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 );
-
-private: // Internal methods
- void SetDialogCaptionL( const TDesC& aText );
-
-private: // Member data
- //CMemSpyEngine& iEngine;
- RMemSpySession iSession;
- //MMemSpyDeviceWideOperationDialogObserver& iObserver;
- TBool iForcedCancel;
- CEikProgressInfo* iProgressInfo;
- CAknProgressDialog* iProgressDialog;
- CMemSpyDeviceWideOperations* iOperation;
- };
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyDocument.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYDOCUMENT_H
-#define MEMSPYDOCUMENT_H
-
-// System includes
-#include <AknDoc.h>
-
-// Classes referenced
-class CMemSpyEngine;
-class CEikAppUi;
-class CMemSpySettings;
-//cigasto
-class RMemSpySession;
-
-
-class CMemSpyDocument : public CAknDocument
- {
-public: // Constructors and destructor
- static CMemSpyDocument* NewL(CEikApplication& aApp);
- ~CMemSpyDocument();
-
-private:
- CMemSpyDocument(CEikApplication& aApp);
- void ConstructL();
-
-public:
-// CMemSpyEngine& Engine();
-// const CMemSpyEngine& Engine() const;
- CMemSpySettings& Settings();
- const CMemSpySettings& Settings() const;
-
-private: // Framework
- CEikAppUi* CreateAppUiL();
-
-private: // Data members
-// CMemSpyEngine* iEngine;
- CMemSpySettings* iSettings;
- //cigasto
- RMemSpySession* iMemSpySession;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyExportBitmapsToMemoryCardDialog.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYEXPORTBITMAPSTOMEMORYCARDDIALOG_H
-#define MEMSPYEXPORTBITMAPSTOMEMORYCARDDIALOG_H
-
-// System includes
-#include <AknProgressDialog.h>
-#include <AknWaitDialog.h>
-#include <imageconversion.h>
-
-// Classes referenced
-class CMemSpyEngineFbServBitmap;
-class CMemSpyEngineFbServBitmapArray;
-
-
-
-class CMemSpyExportBitmapsToMemoryCardDialog : public CActive, public MProgressDialogCallback
- {
-public:
- static CMemSpyExportBitmapsToMemoryCardDialog* NewL( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps );
- ~CMemSpyExportBitmapsToMemoryCardDialog();
-
-private:
- CMemSpyExportBitmapsToMemoryCardDialog( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps );
- void ConstructL();
-
-public: // API
- void Cancel();
- static TBool CheckMemoryCardAvailableL( RFs& aFsSession );
-
-private: // From CActive
- void RunL();
- void DoCancel();
- TInt RunError(TInt aError);
-
-private: // From MProgressDialogCallback
- void DialogDismissedL( TInt aButtonId );
-
-private: // Internal methods
- void CompleteSelf( TInt aError );
- void ExportBitmapL( const CMemSpyEngineFbServBitmap& aBitmap );
- void IdentifyBmpMimeTypeL();
- void PruneExistingBitmapFilesL();
- void PrepareFolderNameSpecL();
- TBool TryToExportSingleBitmapL();
-
-private: // Member data
- RFs& iFsSession;
- const CMemSpyEngineFbServBitmapArray& iBitmaps;
- TInt iBitmapIndex;
- TBool iDialogDismissed;
- CEikProgressInfo* iProgressInfo;
- CAknProgressDialog* iProgressDialog;
- CImageEncoder* iEncoder;
- HBufC8* iBmpMimeType;
- HBufC* iFolderName;
- RFileExtensionMIMETypeArray iMimeTypeArray;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpySettings.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYSETTINGS_H
-#define MEMSPYSETTINGS_H
-
-// System includes
-#include <e32base.h>
-#include <badesca.h>
-#include <f32file.h>
-
-// Engine includes
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-// Classes referenced
-class CMemSpyEngine;
-
-//cigasto
-class RMemSpySession;
-
-
-class CMemSpySettings : public CBase
- {
-public:
- //static CMemSpySettings* NewL( RFs& aFsSession, CMemSpyEngine& aEngine );
- static CMemSpySettings* NewL( RFs& aFsSession, RMemSpySession& aSession );
- ~CMemSpySettings();
-
-private:
- //CMemSpySettings( RFs& aFsSession, CMemSpyEngine& aEngine );
- CMemSpySettings( RFs& aFsSession, RMemSpySession& aSession );
- void ConstructL();
-
-public: // API
- inline RFs& FsSession() { return iFsSession; }
- void StoreSettingsL();
-
- void SetSinkType( TMemSpySinkType aType ) { iSinkType = aType; }
-
-private: // Settings methods
- void RestoreSettingsL();
- void GetSettingsFileNameL( TDes& aFileName );
- void GetSettingsPathL( TDes& aPath );
- RFile SettingsFileLC( TBool aReplace = EFalse );
-
-private: // Data members
- RFs& iFsSession;
- RMemSpySession& iMemSpySession;
-
-private: //Settings
- TMemSpySinkType iSinkType;
- TMemSpyEngineHelperSysMemTrackerConfig iSwmtConfig;
- RArray<TUid> iUidList;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyUiUtils.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYUIUTILS_H
-#define MEMSPYUIUTILS_H
-
-// System includes
-#include <e32std.h>
-#include <e32const.h>
-
-// Engine includes
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-
-typedef TBuf<20> TMemSpySizeText;
-
-_LIT( KTab, "\t" );
-
-//ThreadInfoItemList view types
-_LIT( KTypeUnknown, "Unknown Type" );
-_LIT( KGeneral, "General" );
-_LIT( KHeap, "Heap" );
-_LIT( KStack, "Stack" );
-_LIT( KChunks, "Chunks" );
-_LIT( KCodeSegs, "Code Segments" );
-_LIT( KOpenFiles, "Open Files" );
-_LIT( KActiveObjects, "Active Objects" );
-_LIT( KThreadHandlers, "Handlers to other Threads" );
-_LIT( KProcessHandlers, "Handlers to other Processes" );
-_LIT( KServers, "Servers running in Thread" );
-_LIT( KConnections, "Client <> Server Connections" );
-_LIT( KSemaphores, "Semaphores" );
-_LIT( KThreadReferences, "References in Thread" );
-_LIT( KProcessReferences, "References in Process" );
-_LIT( KMutexes, "Mutexes" );
-_LIT( KTimers, "Timers" );
-_LIT( KDD, "Logical DD Channels" );
-_LIT( KChangeNotif, "Change Notifiers" );
-_LIT( KUndertakers, "Undertakers" );
-_LIT( KLogicalDrivers, "Logical Device Drivers" );
-_LIT( KPhysicalDrivers, "Physical Device Drivers" );
-
-//Kernel Object types
-_LIT( KTypeThread, "Thread" );
-_LIT( KTypeProcess, "Process" );
-_LIT( KTypeChunk, "Chunk" );
-_LIT( KTypeLibrary, "Library" );
-_LIT( KTypeSemaphore, "Semaphore" );
-_LIT( KTypeMutex, "Mutex" );
-_LIT( KTypeTimer, "Timer" );
-_LIT( KTypeServer, "Server" );
-_LIT( KTypeSession, "Session" );
-_LIT( KTypeLogicalDevice, "Logical Device" );
-_LIT( KTypePhysicalDevice, "Physical Device" );
-_LIT( KTypeLogicalChannel, "Logical Channel" );
-_LIT( KTypeChangeNotifier, "Change Notifier" );
-_LIT( KTypeUndertaker, "Undertaker" );
-_LIT( KTypeMsgQueue, "Msg. Queue" );
-_LIT( KTypePropertyRef, "Property Ref." );
-_LIT( KTypeCondVar, "Conditional Var." );
-
-
-class MemSpyUiUtils : public MemSpyEngineUtils
- {
-public:
- static void Format( TDes& aBuf, TInt aResourceId, ...);
- static void GetErrorText( TDes& aBuf, TInt aError );
- static HBufC* FormatItem( const TDesC& aCaption );
- static TDesC& ThreadInfoItemNameByType( TMemSpyThreadInfoItemType aType );
- static void AppendPriority( TDes& aDes, TProcessPriority aPriority );
- static void AppendExitInfo( TDes& aDes, TExitType aType, TInt aExitReason, const TDesC& aExitCategory );
- static void AppendExitType( TDes& aDes, TExitType aType );
-
- //for Kernel Objects
- static TPtrC TypeAsString( TMemSpyDriverContainerType aType );
- static TMemSpySizeText FormatSizeText( const TInt64& aValue, TInt aDecimalPlaces, TBool aExtraRounding = EFalse );
- };
-
-
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewBase.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWBASE_H
-#define MEMSPYVIEWBASE_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-#include <memspyui.rsg>
-
-// User includes
-#include "MemSpy.hrh"
-#include "MemSpyViewType.h"
-#include "MemSpyViewObserver.h"
-#include "MemSpySettings.h"
-
-// Classes referenced
-class CMemSpyEngine;
-class CMemSpyContainer;
-class MMemSpyViewObserver;
-//cigasto
-class RMemSpySession;
-
-class CMemSpyViewBase : public CCoeControl, public MCoeControlObserver, public MEikListBoxObserver
- {
-public:
- //CMemSpyViewBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- CMemSpyViewBase( RMemSpySession& aSession, MMemSpyViewObserver& aObserver );
- ~CMemSpyViewBase();
- virtual void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // API
- virtual TMemSpyViewType ViewType() const = 0;
- virtual CMemSpyViewBase* PrepareParentViewL();
- virtual CMemSpyViewBase* PrepareChildViewL();
- virtual void RefreshL();
- virtual TBool HandleCommandL( TInt aCommand );
-
-public: // Menu framework
- virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
- virtual TUint MenuCascadeResourceId() const;
- virtual TInt MenuCascadeCommandId() const;
-
-private: // Command handlers
- virtual void OnCmdViewOutputToSinkL();
-
-protected: // Construction support
- void SetTitleL( const TDesC& aText );
- TPtrC TitleL() const;
- virtual CEikListBox* ConstructListBoxL();
- virtual void SetListBoxModelL() = 0;
-
-protected: // Internal framework
- virtual void HandleListBoxItemActionedL( TInt aIndex );
- virtual void HandleListBoxItemSelectedL( TInt aIndex );
-
-protected: // Event reporting
- void ReportEventL( MMemSpyViewObserver::TViewEventType aEvent, TAny* aContext = NULL );
- void SetListBoxCurrentItemIndexL( TInt aIndex );
-
-protected: // Utility methods
- CMemSpyContainer& Container();
- CMemSpySettings& Settings();
- const CMemSpySettings& Settings() const;
-
-public: // From CCoeControl
- TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
-
-protected: // From CCoeControl
- void Draw( const TRect& aRect ) const;
- void SizeChanged();
- void FocusChanged( TDrawNow aDrawNow );
- TInt CountComponentControls() const;
- CCoeControl* ComponentControl( TInt aIndex ) const;
-
-protected: // From MCoeControlObserver
- void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );
-
-protected: // From MEikListBoxObserver
- void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType);
-
-protected: // Member data
- //CMemSpyEngine& iEngine;
- RMemSpySession& iMemSpySession;
- MMemSpyViewObserver& iObserver;
- //
- CEikListBox* iListBox;
-
-private:
- CMemSpySettings* iSettings;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewChunkList.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWCHUNKLIST_H
-#define MEMSPYVIEWCHUNKLIST_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-class CMemSpyEngineChunkList;
-class CMemSpyEngineChunkEntry;
-
-
-
-
-class CMemSpyViewChunkBase : public CMemSpyViewBase
- {
-public:
- CMemSpyViewChunkBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList* aList );
- ~CMemSpyViewChunkBase();
-
-public: // From CMemSpyViewBase
- TBool HandleCommandL( TInt aCommand );
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_CHUNK_LIST; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdChunk; }
-
-protected: // Command handlers
- void OnCmdListingL();
-
-protected: // Data members
- CMemSpyEngineChunkList* iList;
- };
-
-
-
-
-class CMemSpyViewChunkList : public CMemSpyViewChunkBase
- {
-public:
- CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aIndex );
- void HandleListBoxItemSelectedL( TInt aIndex );
-
-private: // Data members
- CMemSpyEngineChunkEntry* iCurrentChunk;
- };
-
-
-
-class CMemSpyViewChunkDetails : public CMemSpyViewChunkBase
- {
-public:
- CMemSpyViewChunkDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList, CMemSpyEngineChunkEntry& aSelectedChunk );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // Data members
- CMemSpyEngineChunkEntry& iChunk;
- };
-
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewCodeSegList.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWCODESEGLIST_H
-#define MEMSPYVIEWCODESEGLIST_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-class CMemSpyEngineCodeSegList;
-class CMemSpyEngineCodeSegEntry;
-
-
-class CMemSpyViewCodeSegBase : public CMemSpyViewBase
- {
-public:
- CMemSpyViewCodeSegBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList* aList );
- ~CMemSpyViewCodeSegBase();
-
-public: // From CMemSpyViewBase
- TBool HandleCommandL( TInt aCommand );
- void RefreshL();
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_CODESEG_LIST; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdCodeSeg; }
-
-protected: // Command handlers
- void OnCmdCodeSegmentListingL();
- void OnCmdShowItemsAllL();
- void OnCmdShowItemsGlobalDataL();
- void OnCmdFilterByCapabilityL( TCapability aCapability, TBool aAllBinaries );
-
-protected: // Data members
- CMemSpyEngineCodeSegList* iList;
- };
-
-
-
-
-class CMemSpyViewCodeSegList : public CMemSpyViewCodeSegBase
- {
-public:
- CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aIndex );
- void HandleListBoxItemSelectedL( TInt aIndex );
-
-private: // Data members
- CMemSpyEngineCodeSegEntry* iCurrentCodeSegment;
- };
-
-
-
-class CMemSpyViewCodeSegDetails : public CMemSpyViewCodeSegBase
- {
-public:
- CMemSpyViewCodeSegDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList, CMemSpyEngineCodeSegEntry& aSelectedCodeSegment );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // Data members
- CMemSpyEngineCodeSegEntry& iCodeSegment;
- };
-
-
-
-
-
-
-class TMemSpyViewCodeSegFilter
- {
-public:
- inline TMemSpyViewCodeSegFilter( TCapability aCapability, TBool aAllBinaries = ETrue )
- : iCapability( aCapability ), iAllBinaries( aAllBinaries )
- {
- }
-
-public:
- static TBool FilterItem( const CMemSpyEngineCodeSegEntry*& aItem, TAny* aRune );
-
-private:
- TCapability iCapability;
- TBool iAllBinaries;
- };
-
-
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewDriveInfo.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWDRIVEINFO_H
-#define MEMSPYVIEWDRIVEINFO_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// Engine includes
-#include <memspy/engine/memspyenginehelperfilesystem.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-
-
-
-
-class CMemSpyViewDriveInfoBase : public CMemSpyViewBase
- {
-public:
- CMemSpyViewDriveInfoBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- ~CMemSpyViewDriveInfoBase();
- void BaseConstructL();
-
-public: // From CMemSpyViewBase
- TBool HandleCommandL( TInt aCommand );
-
-protected: // Data members
- CMemSpyEngineDriveList* iList;
- };
-
-
-
-
-class CMemSpyViewDriveList : public CMemSpyViewDriveInfoBase, public MMemSpyEngineDriveListObserver
- {
-public:
- CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // From CMemSpyViewBase
- void RefreshL();
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aIndex );
- void HandleListBoxItemSelectedL( TInt aIndex );
-
-private: // From MMemSpyEngineDriveListObserver
- void HandleDriveListChangedL( const CMemSpyEngineDriveList& aList );
-
-private: // Data members
- TBool iUseDriveNumber;
- TDriveNumber iDriveNumber;
- CMemSpyEngineDriveEntry* iCurrentDrive;
- };
-
-
-
-class CMemSpyViewDriveInfo : public CMemSpyViewDriveInfoBase, public MMemSpyEngineDriveEntryObserver
- {
-public:
- CMemSpyViewDriveInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // From MMemSpyEngineDriveEntryObserver
- void HandleDriveEntryChangedL( const CMemSpyEngineDriveEntry& aEntry );
-
-private: // Data members
- const TDriveNumber iDriveNumber;
- CMemSpyEngineDriveEntry* iDriveInfo;
- };
-
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewECom.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWECOM_H
-#define MEMSPYVIEWECOM_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-#include <eikimage.h>
-#include <AknDialog.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Engine includes
-#include <memspy/engine/memspyenginehelperecom.h>
-
-
-class CMemSpyViewECom : public CMemSpyViewBase
- {
-public:
- CMemSpyViewECom( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aIndex );
- void HandleListBoxItemSelectedL( TInt aIndex );
-
-private: // Data members
- CMemSpyEngineEComCategory* iCurrent;
- };
-
-
-
-class CMemSpyViewEComCategory : public CMemSpyViewBase
- {
-public:
- CMemSpyViewEComCategory( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComCategory& aCategory );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aIndex );
- void HandleListBoxItemSelectedL( TInt aIndex );
-
-private: // Data members
- CMemSpyEngineEComCategory& iCategory;
- CMemSpyEngineEComInterface* iCurrent;
- };
-
-
-
-
-class CMemSpyViewEComInterface : public CMemSpyViewBase
- {
-public:
- CMemSpyViewEComInterface( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComInterface& aInterface );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aIndex );
- void HandleListBoxItemSelectedL( TInt aIndex );
-
-private: // Data members
- CMemSpyEngineEComInterface& iInterface;
- CMemSpyEngineEComImplementation* iCurrent;
- };
-
-
-
-
-
-
-class CMemSpyViewEComImplementation : public CMemSpyViewBase
- {
-public:
- CMemSpyViewEComImplementation( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComImplementation& aImplementation );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // Data members
- CMemSpyEngineEComImplementation& iImplementation;
- };
-
-
-
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewFBServBitmaps.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWFBSERVBITMAPS_H
-#define MEMSPYVIEWFBSERVBITMAPS_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-#include <eikimage.h>
-#include <AknDialog.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Engine includes
-#include <memspy/engine/memspyenginehelperfbserv.h>
-
-
-
-class CMemSpyViewFBServBase : public CMemSpyViewBase
- {
-public:
- CMemSpyViewFBServBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps );
- ~CMemSpyViewFBServBase();
-
-public: // From CMemSpyViewBase
- TBool HandleCommandL( TInt aCommand );
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_IMAGES; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdImages; }
-
-protected: // Command handlers
- void OnCmdSlideShowL();
- void OnCmdExportToMemoryCardL();
- void OnCmdImageListingL();
-
-protected: // Data members
- CMemSpyEngineFbServBitmapArray* iBitmaps;
- };
-
-
-
-
-
-class CMemSpyViewFBServBitmaps : public CMemSpyViewFBServBase, public MMemSpyEngineFbSerbBitmapArrayObserver
- {
-public:
- CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps );
- ~CMemSpyViewFBServBitmaps();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // From MMemSpyEngineFbSerbBitmapArrayObserver
- void HandleFbServBitmapArrayEventL( TEvent aEvent );
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aIndex );
- void HandleListBoxItemSelectedL( TInt aIndex );
-
-private: // Idle timer update
- static TInt IdleUpdateListBoxModel( TAny* aSelf );
- void DoIdleUpdateListBoxModelL();
-
-private: // Data members
- RArray<TInt> iBitmapHandles;
- CMemSpyEngineFbServBitmap* iCurrentBitmap;
- CPeriodic* iIdleResetListboxTimer;
- };
-
-
-
-class CMemSpyViewFBServBitmapInfo : public CMemSpyViewFBServBase
- {
-public:
- CMemSpyViewFBServBitmapInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aIndex );
-
-private: // Data members
- CMemSpyEngineFbServBitmap& iBitmapObject;
- };
-
-
-
-
-class CMemSpyViewFBServBitmapViewer : public CMemSpyViewFBServBase
- {
-public:
- CMemSpyViewFBServBitmapViewer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap );
- ~CMemSpyViewFBServBitmapViewer();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- CEikListBox* ConstructListBoxL();
-
-private: // From CCoeControl
- void Draw(const TRect& aRect) const;
- void SizeChanged();
- TInt CountComponentControls() const;
- CCoeControl* ComponentControl( TInt aIndex ) const;
-
-private: // Data members
- CMemSpyEngineFbServBitmap& iBitmapObject;
- CEikImage* iImage;
- TRect iBorderRect;
- };
-
-
-
-
-
-class CMemSpyViewFBServSlideshow : public CAknDialog
- {
-public:
- static void NewLD( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex );
- ~CMemSpyViewFBServSlideshow();
-
-private:
- CMemSpyViewFBServSlideshow( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex );
- void ConstructL();
-
-private:
- void PreLayoutDynInitL();
- TBool OkToExitL(TInt aButtonId);
-
-private: // Idle timer update
- static TInt IdleUpdate( TAny* aSelf );
- void ShowNextImageL();
-
-private: // Data members
- CMemSpyEngineFbServBitmapArray& iBitmaps;
- TInt& iIndex;
- CPeriodic* iTimer;
- };
-
-
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewHeapTracking.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWHEAPTRACKING_H
-#define MEMSPYVIEWHEAPTRACKING_H
-
-// System includes
-#include <hal.h>
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// Engine includes
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerobserver.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-class RMemSpySession;
-
-
-class CMemSpyViewHeapTracking : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver
- {
-public:
- CMemSpyViewHeapTracking( RMemSpySession& aSession, MMemSpyViewObserver& aObserver );
- ~CMemSpyViewHeapTracking();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-public:
- static TInt AsyncStopTimerCallback( TAny* aParam );
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // From MMemSpyEngineHelperSysMemTrackerObserver
- void HandleCyclesResetL();
- void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
- void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Internal methods
- TInt IndexByViewType( TMemSpyViewType aType );
- void SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode aMode, TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
- TInt AsyncStopTimerCallback();
- void GetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
- void SetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
-
-private: // Enum
- enum TMemSpyViewHeapTrackingState
- {
- EMemSpyViewHeapTrackingStateIdle = 0,
- EMemSpyViewHeapTrackingStateTimerOn,
- EMemSpyViewHeapTrackingStateSingleOn
- };
-
-private: // Data
- TMemSpyEngineHelperSysMemTrackerConfig iOriginalConfig;
- TMemSpyViewHeapTrackingState iState;
- CAsyncCallBack* iStopTimerCallBack;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewHeapTrackingResults.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWHEAPTRACKINGRESULTS_H
-#define MEMSPYVIEWHEAPTRACKINGRESULTS_H
-
-// System includes
-#include <hal.h>
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// Engine includes
-#include <memspy/engine/memspyenginehelpersysmemtrackerobserver.h>
-#include <memspy/api/memspyapimemorytrackingcycle.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-class CMemSpyEngineHelperSysMemTrackerCycle;
-class CMemSpyEngineHelperSysMemTrackerCycleChange;
-class RMemSpySession;
-
-class CMemSpyViewHeapTrackingResults : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver
- {
-public:
- //CMemSpyViewHeapTrackingResults( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- CMemSpyViewHeapTrackingResults( RMemSpySession& aSession, MMemSpyViewObserver& aObserver );
- ~CMemSpyViewHeapTrackingResults();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // From MMemSpyEngineHelperSysMemTrackerObserver
- void HandleCyclesResetL();
- void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
- void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-private:
- RArray<CMemSpyApiMemoryTrackingCycle*> iCycles;
- };
-
-
-
-
-
-
-
-class CMemSpyViewHeapTrackingResultsCycleInfo : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver
- {
-public:
- // CMemSpyViewHeapTrackingResultsCycleInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
- CMemSpyViewHeapTrackingResultsCycleInfo( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, const CMemSpyApiMemoryTrackingCycle& aCycle );
- ~CMemSpyViewHeapTrackingResultsCycleInfo();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // From MMemSpyEngineHelperSysMemTrackerObserver
- void HandleCyclesResetL();
- void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
- void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
- //const CMemSpyEngineHelperSysMemTrackerCycle& iCycle;
- const CMemSpyApiMemoryTrackingCycle& iCycle;
- };
-
-
-
-
-
-/*
-class CMemSpyViewHeapTrackingResultsChangeDescriptor : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver
- {
-public:
- CMemSpyViewHeapTrackingResultsChangeDescriptor( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle, const CMemSpyEngineHelperSysMemTrackerCycleChange& aChangeDescriptor, TInt aIndex );
- ~CMemSpyViewHeapTrackingResultsChangeDescriptor();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // From MMemSpyEngineHelperSysMemTrackerObserver
- void HandleCyclesResetL();
- void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
- void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle );
-
-private: // Data members
- const CMemSpyEngineHelperSysMemTrackerCycle& iCycle;
- const CMemSpyEngineHelperSysMemTrackerCycleChange& iChangeDescriptor;
- TInt iIndex; // For selection rune when moving to parent view
- };
-*/
-
-
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewHeapTrackingSettings.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWHEAPTRACKINGSETTINGS_H
-#define MEMSPYVIEWHEAPTRACKINGSETTINGS_H
-
-// System includes
-#include <hal.h>
-#include <coecntrl.h>
-#include <aknlists.h>
-#include <aknsettingitemlist.h>
-#include <akncheckboxsettingpage.h>
-#include <AknQueryDialog.h>
-
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-class RMemSpySession;
-
-
-class CMemSpyViewHeapTrackingSettings : public CMemSpyViewBase
- {
-public:
- //CMemSpyViewHeapTrackingSettings( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- CMemSpyViewHeapTrackingSettings( RMemSpySession& aSession, MMemSpyViewObserver& aObserver );
- ~CMemSpyViewHeapTrackingSettings();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
- void GetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
- void SetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig );
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // Internal methods
- static void PrepareItemBufL( TDes& aBuf, const TDesC& aCaption, TBool aStatus, TBool aHeapCategorySelected );
- };
-
-
-
-
-class CSWMTCategorySelectionCheckBoxSettingItem : public CAknSettingItem
- {
-public:
- CSWMTCategorySelectionCheckBoxSettingItem( TInt aIdentifier, TInt& aCategories );
- virtual ~CSWMTCategorySelectionCheckBoxSettingItem();
-
-public:
- CSelectionItemList* ItemArray() const;
-
-protected:
- void CompleteConstructionL();
- void StoreL();
- void LoadL();
- void HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType );
-
-private:
- void AddNewItemToArrayL(const TDesC& aLabel);
-
-private:
- CSelectionItemList* iItemArray;
- HBufC* iSettingText;
- TInt& iExtCategories;
- };
-
-
-
-
-
-
-class CMemSpySWMTCategorySelectionCheckBoxSettingPage : public CAknCheckBoxSettingPage
- {
- public:
- CMemSpySWMTCategorySelectionCheckBoxSettingPage( TInt aResourceID, CSelectionItemList* aItemArray );
- public: // New functions
- void UpdateCba();
- };
-
-
-
-
-
-
-class CMemSpyAllowEmptyDataDialog : public CAknTextQueryDialog
- {
- public:
- CMemSpyAllowEmptyDataDialog( TDes& aText, const TTone& aTone = ENoTone );
- protected: // from CAknTextQueryDialog
- void UpdateLeftSoftKeyL();
- };
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewKernel.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWKERNEL_H
-#define MEMSPYVIEWKERNEL_H
-
-// System includes
-#include <hal.h>
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-class RMemSpySession;
-
-class CMemSpyViewKernel : public CMemSpyViewBase
- {
-public:
- CMemSpyViewKernel( RMemSpySession& aSession, MMemSpyViewObserver& aObserver );
- ~CMemSpyViewKernel();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // Internal methods
- static TInt IndexByViewType( TMemSpyViewType aType );
-
-private: // Data members
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewKernelContainers.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWKERNELCONTAINERS_H
-#define MEMSPYVIEWKERNELCONTAINERS_H
-
-// System includes
-#include <hal.h>
-#include <coecntrl.h>
-#include <aknlists.h>
-#include <BADESCA.H>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-#include <memspy/driver/memspydriverenumerationsshared.h>
-#include <memspy/api/memspyapikernelobject.h>
-
-// Classes referenced
-class CMemSpyEngineGenericKernelObjectContainer;
-
-class RMemSpySession;
-
-class CMemSpyViewKernelContainers : public CMemSpyViewBase
- {
-public:
- CMemSpyViewKernelContainers( RMemSpySession& aSession, MMemSpyViewObserver& aObserver );
- ~CMemSpyViewKernelContainers();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
- TPtrC TypeAsString( TMemSpyDriverContainerType aType );
-
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_KERNEL_CONTAINERS; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdKernelContainers; }
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- TBool HandleCommandL( TInt aCommand );
-
-private: // Command handlers
- void OnCmdOutputAllContainerContentsL();
-
-private: // Internal methods
-
-private: // Data members
- //CMemSpyEngineGenericKernelObjectContainer* iModel;
- RArray<CMemSpyApiKernelObject*> iKernelObjects; //array of raw items data
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewKernelHeap.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWKERNELHEAP_H
-#define MEMSPYVIEWKERNELHEAP_H
-
-// System includes
-#include <hal.h>
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-#include <memspy/api/memspyapiheap.h>
-
-// Classes referenced
-class CMemSpyEngineGenericKernelObjectContainer;
-
-class RMemSpySession;
-
-class CMemSpyViewKernelHeap : public CMemSpyViewBase
- {
-public:
- CMemSpyViewKernelHeap( RMemSpySession& aSession, MMemSpyViewObserver& aObserver );
- ~CMemSpyViewKernelHeap();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_KERNEL_HEAP; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdKernelHeap; }
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- TBool HandleCommandL( TInt aCommand );
-
-private: // Command handlers
- void OnCmdDumpKernelHeapL();
-
-private: // Internal methods
- //CDesCArrayFlat* FormatModel( RArray<CMemSpyApiHeap*> &aHeap );
- CDesCArrayFlat* FormatModel( CMemSpyApiHeap* aHeap );
- HBufC* FormatItem( const TDesC& aCaption, const TDesC& aValue );
- HBufC* FormatItem( const TDesC& aCaption, TInt aValue );
- HBufC* FormatItem( const TDesC& aCaption, TUint aValue );
- HBufC* FormatItem( const TDesC& aCaption, const TInt64& aValue );
- HBufC* FormatItem( const TDesC& aCaption, TAny* aValue );
- HBufC* FormatItem( const TDesC& aCaption, TUint* aValue );
- HBufC* FormatItem( const TDesC& aCaption, TUint8* aValue );
- HBufC* FormatPercentageItem( const TDesC& aCaption, TReal aOneHundredPercentValue, TReal aValue );
-
-private: // Data members
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewKernelObjects.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWKERNELOBJECTS_H
-#define MEMSPYVIEWKERNELOBJECTS_H
-
-// System includes
-#include <hal.h>
-#include <coecntrl.h>
-#include <aknlists.h>
-#include <AknTabObserver.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-#include <memspy/driver/memspydriverenumerationsshared.h>
-#include <memspy/api/memspyapikernelobjectitem.h>
-
-// Classes referenced
-class CMemSpyEngineGenericKernelObjectContainer;
-class CMemSpyEngineGenericKernelObjectList;
-class CAknNavigationDecorator;
-class CAknNavigationControlContainer;
-class CAknTabGroup;
-
-class RMemSpySession;
-
-class CMemSpyViewKernelObjects : public CMemSpyViewBase, public MAknTabObserver
- {
-public:
- //CMemSpyViewKernelObjects( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TMemSpyDriverContainerType aObjectType );
- CMemSpyViewKernelObjects( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TMemSpyDriverContainerType aObjectType );
- ~CMemSpyViewKernelObjects();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- CEikListBox* ConstructListBoxL();
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_KERNEL_OBJECTS; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdKernelObjects; }
- void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- TBool HandleCommandL( TInt aCommand );
-
-private: // From CCoeControl
- TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
-
-private: // From MAknTabObserver
- void TabChangedL( TInt aIndex );
-
-private: // Command handlers
- void OnCmdTerminateL();
- void OnCmdSwitchToL();
- void OnCmdEndL();
- void OnCmdPanicL();
-
-private: // Internal methods
- void CreateTabsL();
- void DetailsL();
- void AppendFormatString( TPtr& aPtr, TRefByValue<const TDesC> aFmt, ... );
-
-private: // Data members
- //CMemSpyEngineGenericKernelObjectContainer* iModel;
- CDesCArrayFlat* iItems;
- TMemSpyDriverContainerType iObjectType;
- CMemSpyEngineGenericKernelObjectList* iObjectList;
- CAknNavigationDecorator* iNavDecorator;
- CAknNavigationControlContainer* iNaviPane;
- CAknNavigationControlContainer* iNavContainer;
- CAknTabGroup* iTabs;
- TInt iCurrItemIndex;
- CDesCArrayFlat* iModel;
- RArray<CMemSpyApiKernelObjectItem*> iKernelObjectItems;
- };
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewMainMenu.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWMAINMENU_H
-#define MEMSPYVIEWMAINMENU_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-class CMemSpyProcess;
-
-//cigasto
-class RMemSpySession;
-
-class CMemSpyViewMainMenu : public CMemSpyViewBase
- {
-public:
- //CMemSpyViewMainMenu( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- CMemSpyViewMainMenu( RMemSpySession& aSession, MMemSpyViewObserver& aObserver );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // Internal methods
- static TInt IndexByViewType( TMemSpyViewType aType );
-
-private: // Data members
- };
-
-
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewMemoryTrackingAutoStartConfig.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWMEMORYTRACKINGAUTOSTARTCONFIG_H
-#define MEMSPYVIEWMEMORYTRACKINGAUTOSTARTCONFIG_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-#include <ecom/ecom.h>
-#include <xml/contenthandler.h> // MContentHandler mix in class
-#include <xml/parser.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Literal constants
-_LIT( KMemSpyProcessMemoryTrackingAutoStartConfigSearchPath, "E:\\MemSpy\\" );
-_LIT( KMemSpyProcessMemoryTrackingAutoStartConfigFileName, "MemSpyProcessMemoryTrackingAutoStartConfig.xml" );
-
-// Classes referenced
-class CCnvCharacterSetConverter;
-
-// Namespaces referenced
-using namespace Xml;
-
-
-class CMemSpyViewMemoryTrackingAutoStartConfig : public CMemSpyViewBase, public MContentHandler
- {
-public:
- CMemSpyViewMemoryTrackingAutoStartConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- ~CMemSpyViewMemoryTrackingAutoStartConfig();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- TBool HandleCommandL( TInt aCommand );
- void HandleListBoxItemActionedL( TInt aIndex );
- void SetListBoxModelL();
- void RefreshL();
-
-public: // Menu framework
- void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
- TUint MenuCascadeResourceId() const;
- TInt MenuCascadeCommandId() const;
-
-private: // Command handlers
- void OnCmdItemAddL();
- void OnCmdItemEditL();
- void OnCmdItemDeleteL();
- void OnCmdItemDeleteAllL();
- void OnCmdItemImportL();
-
-private: // Internal methods
- TUid ShowDialogL( TUid aUid );
- void SaveChangesL();
- static TUid ValidateProcessUid( const TDesC& aUid );
-
-private: // Internal XML methods
- void FindXmlInstallTimeL();
- void FindXmlUserSuppliedL();
- HBufC* FindEComXmlFileNameLC();
- void ConvertL( const TDesC8& aInput, TDes16& aOutput );
- void ParseL( const TDesC& aFileName );
-
-private: // XML helper functions
- void OnSectionProcessL( const RAttributeArray& aAttributes );
-
-private: // From MContentHandler
- void OnStartDocumentL( const RDocumentParameters& aDocParam, TInt aErrorCode );
- void OnEndDocumentL( TInt aErrorCode );
- void OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode );
- void OnEndElementL( const RTagInfo& aElement, TInt aErrorCode );
- void OnContentL( const TDesC8& aBytes, TInt aErrorCode );
- void OnStartPrefixMappingL( const RString& aPrefix, const RString& aUri, TInt aErrorCode );
- void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode );
- void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode );
- void OnSkippedEntityL( const RString& aName, TInt aErrorCode );
- void OnProcessingInstructionL( const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode );
- void OnError( TInt aErrorCode );
- TAny* GetExtendedInterface( const TInt32 aUid );
-
-private: // Data members
- RArray< TUid > iProcessUids;
- TInt iParserErrorCode;
- TInt iCharconvConverterState;
- TBool iSeenMasterSection;
- CParser* iParser;
- CCnvCharacterSetConverter* iConverter;
- HBufC* iXMLFileNameInstallTime;
- HBufC* iXMLFileNameUserSupplied;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewObserver.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWOBSERVER_H
-#define MEMSPYVIEWOBSERVER_H
-
-// User includes
-#include "MemSpyViewType.h"
-
-// Classes referenced
-class CMemSpyViewBase;
-
-class MMemSpyViewObserver
- {
-public: // Enumerations
- enum TViewEventType
- {
- EEventItemActioned = 0,
- EEventItemSelected
- };
-
-public: // From MMemSpyViewObserver
- virtual void HandleMemSpyViewEventL( TViewEventType aEvent, TMemSpyViewType aViewType, CMemSpyViewBase& aReportingView, TAny* aContext ) = 0;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewOpenFiles.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWOPENFILES_H
-#define MEMSPYVIEWOPENFILES_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-
-
-class CMemSpyViewOpenFiles : public CMemSpyViewBase
- {
-public:
- CMemSpyViewOpenFiles( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- ~CMemSpyViewOpenFiles();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- CEikListBox* ConstructListBoxL();
- void RefreshL();
- TBool HandleCommandL( TInt aCommand );
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // Command handlers
- void OnCmdListOpenFilesL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aCurrentIndex );
-
-private: // Internal
- static TBool CompareTEntryObjects( const TEntry& aLeft, const TEntry& aRight );
-
-private: // Data members
- RArray<TThreadId> iThreadIds;
- const TThreadId* iActionedThreadId;
- RArray<TEntry> iFileNames;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewProcesses.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWPROCESSES_H
-#define MEMSPYVIEWPROCESSES_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-#include <memspy/api/memspyapiprocess.h>
-
-// Classes referenced
-class CMemSpyProcess;
-class CAknSearchField;
-class RMemSpySession;
-
-class CMemSpyViewProcesses : public CMemSpyViewBase
- {
-public:
- //CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- //CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess );
- CMemSpyViewProcesses( RMemSpySession& aSession, MMemSpyViewObserver& aObserver );
-// CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess );
- CMemSpyViewProcesses( RMemSpySession& aEngine, MMemSpyViewObserver& aObserver, TProcessId aId );
- ~CMemSpyViewProcesses();
- //void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TProcessId aSelectionRune = NULL );
-
-public: // API
- CMemSpyProcess& CurrentProcess() const;
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
- TBool HandleCommandL( TInt aCommand );
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_PROCESS; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdProcess; }
- void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
-
-private: // Command handlers
-
- // Sorting
- void OnCmdSortByIdL();
- void OnCmdSortByNameL();
- void OnCmdSortByThreadCountL();
- void OnCmdSortByCodeSegsL();
- void OnCmdSortByHeapUsageL();
- void OnCmdSortByStackUsageL();
-
- // Info
- void OnCmdInfoSummaryL();
- void OnCmdInfoHandlesL();
-
- // Ending
- void OnCmdEndTerminateL();
- void OnCmdEndPanicL();
- void OnCmdEndKillL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aIndex );
- void HandleListBoxItemSelectedL( TInt aIndex );
-
-private: // From CCoeControl
- void SizeChanged();
- TInt CountComponentControls() const;
- CCoeControl* ComponentControl( TInt aIndex ) const;
- TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
- void FocusChanged( TDrawNow /*aDrawNow*/ );
-
-private: // From MCoeControlObserver
- void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
-
-private: // Internal methods
- void SelectListBoxItemByFindTextL();
-
- CDesCArrayFlat* FormatModel( RArray<CMemSpyApiProcess*> aProcesses );
- void AppendPriority( TDes& aDes, TProcessPriority aPriority );
- void AppendExitInfo( TDes& aDes, TExitType aType, TInt aExitReason, const TDesC& aExitCategory );
- void AppendExitType( TDes& aDes, TExitType aType );
-
-private: // Data members
- CMemSpyProcess* iCurrentProcess;
- TProcessId iCurrentProcessId;
- CAknSearchField* iSearchField;
- HBufC* iMatcherBuffer;
- RArray<CMemSpyApiProcess*> iProcesses; //cigasto
- CDesCArrayFlat* iModel;
- CDesCArrayFlat* model;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewRAMInfo.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWRAMINFO_H
-#define MEMSPYVIEWRAMINFO_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-
-
-class CMemSpyViewRAMInfo : public CMemSpyViewBase
- {
-public:
- CMemSpyViewRAMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
- TBool HandleCommandL( TInt aCommand );
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_RAM; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdRAM; }
-
-private: // Command handlers
- void OnCmdSetIconCacheStatusL( TBool aEnabled );
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // Data members
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewROMInfo.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWROMINFO_H
-#define MEMSPYVIEWROMINFO_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-
-
-class CMemSpyViewROMInfo : public CMemSpyViewBase
- {
-public:
- CMemSpyViewROMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // Data members
- };
-
-
-#endif
-
--- a/memspyui/ui/avkon/inc/MemSpyViewServerList.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWSERVERLIST_H
-#define MEMSPYVIEWSERVERLIST_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-#include <memspy/api/memspyapiserver.h>
-#include <memspysession.h>
-
-// Classes referenced
-class CMemSpyEngineServerList;
-class CMemSpyEngineServerEntry;
-class RMemSpySession;
-
-class CMemSpyViewServerList : public CMemSpyViewBase
- {
-public:
- //CMemSpyViewServerList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- CMemSpyViewServerList( RMemSpySession& aSession, MMemSpyViewObserver& aObserver );
- ~CMemSpyViewServerList();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TBool HandleCommandL( TInt aCommand );
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_SERVER_LIST; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdServerList; }
-
-private: // Command handlers
- void OnCmdServerListSortByNameL();
- void OnCmdServerListSortBySessionCountL();
- void OnCmdServerListOutputSummaryL();
- void OnCmdServerListOutputDetailedL();
- void OnCmdServerListOutputGenericL( TBool aDetailed );
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aCurrentIndex );
-
-private: // Data members
- CMemSpyEngineServerList* iList;
- const CMemSpyEngineServerEntry* iActionedItem;
- TInt iActionedItemIndex;
- RArray<CMemSpyApiServer*> iServers;
- CDesCArrayFlat* iModel;
- TSortType iSort;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewSystemConfig.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWSYSTEMCONFIG_H
-#define MEMSPYVIEWSYSTEMCONFIG_H
-
-// System includes
-#include <hal.h>
-#include <f32file.h>
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-
-
-class CMemSpyViewSystemConfig : public CMemSpyViewBase
- {
-public:
- CMemSpyViewSystemConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- ~CMemSpyViewSystemConfig();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // Internal enumerations
-
- enum TMemSpyDisplayMode
- {
- ENone,
- EGray2,
- EGray4,
- EGray16,
- EGray256,
- EColor16,
- EColor256,
- EColor64K,
- EColor16M,
- ERgb,
- EColor4K,
- EColor16MU,
- EColor16MA,
- EColor16MAP,
- EColorLast
- };
-
-private: // Internal methods
- static void GetManufacturer( TDes& aBuf );
- static void GetDeviceFamily( TDes& aBuf );
- static void GetCPU( TDes& aBuf );
- static void GetCPUABI( TDes& aBuf );
- static void GetStartupReason( TDes& aBuf );
- static void GetKeyboard( TDes& aBuf );
- static void GetMachineUid( TDes& aBuf );
- static void GetDisplayType( TDes& aBuf );
- static void GetDisplayMode( TDes& aBuf, TMemSpyDisplayMode aMode );
- //
- static TInt GetHALValue( HALData::TAttribute aAttribute, TInt& aValue );
- TInt GetHALValueAsStringL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL );
- TInt GetHALValueAsNumericL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL, TInt aWidth = -1 );
- TInt GetHALValueAsHexL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL );
- TInt GetHALValueAsYesNoL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL );
- TInt GetHALValueAsDriveLetterL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL );
-
-private:
- void AddItemL( const TDesC& aCaption, const TDesC& aValue, const TDesC* aSuffix = NULL );
- void AddItemL( TDriveNumber aDrive, const TDesC& aCaption, const TDesC* aSuffix = NULL );
-
-private: // Data members
- CDesCArrayFlat* iModel;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemActiveObject.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWTHREADINFOITEMACTIVEOBJECT_H
-#define MEMSPYVIEWTHREADINFOITEMACTIVEOBJECT_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewThreadInfoItemGeneric.h"
-
-// Classes referenced
-class CMemSpyEngineActiveObjectArray;
-class RMemSpySession;
-
-
-class CMemSpyViewThreadInfoItemActiveObjectBase : public CMemSpyViewThreadInfoItemGeneric
- {
-public:
- CMemSpyViewThreadInfoItemActiveObjectBase( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
-
-public: // From CMemSpyViewBase
- TBool HandleCommandL( TInt aCommand );
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_ACTIVE_OBJECTS; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdActiveObject; }
- void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
-
-protected:
- CMemSpyEngineActiveObjectArray& ActiveObjectArray() const;
-
-private: // Command handlers
- void OnCmdWriteAOListingL();
- };
-
-
-
-class CMemSpyViewThreadInfoItemActiveObject : public CMemSpyViewThreadInfoItemActiveObjectBase
- {
-public:
- CMemSpyViewThreadInfoItemActiveObject( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareChildViewL();
- };
-
-
-
-
-class CMemSpyViewThreadInfoItemActiveObjectDetails : public CMemSpyViewThreadInfoItemActiveObjectBase
- {
-public:
- CMemSpyViewThreadInfoItemActiveObjectDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, TAny* aObjectAddress );
-
-public: // From CMemSpyViewBase
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // Data members
- TAny* iObjectAddress;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemChunk.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWTHREADINFOITEMCHUNK_H
-#define MEMSPYVIEWTHREADINFOITEMCHUNK_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewThreadInfoItemGeneric.h"
-
-class RMemSpySession;
-
-class CMemSpyViewThreadInfoItemChunk : public CMemSpyViewThreadInfoItemGeneric
- {
-public:
- CMemSpyViewThreadInfoItemChunk( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
-
-private: // From CMemSpyViewBase
- CMemSpyViewBase* PrepareChildViewL();
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemCodeSeg.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWTHREADINFOITEMCODESEG_H
-#define MEMSPYVIEWTHREADINFOITEMCODESEG_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewThreadInfoItemGeneric.h"
-
-class RMemSpySession;
-
-class CMemSpyViewThreadInfoItemCodeSeg : public CMemSpyViewThreadInfoItemGeneric
- {
-public:
- CMemSpyViewThreadInfoItemCodeSeg( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
-
-public: // From CMemSpyViewBase
- TBool HandleCommandL( TInt aCommand );
-
-private: // From CMemSpyViewBase
- CMemSpyViewBase* PrepareChildViewL();
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneralInfo.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWTHREADINFOITEMGENERALINFO_H
-#define MEMSPYVIEWTHREADINFOITEMGENERALINFO_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewThreadInfoItemGeneric.h"
-
-class CMemSpyThreadInfoContainer;
-class CMemSpyThreadInfoItemBase;
-class RMemSpySession;
-
-class CMemSpyViewThreadInfoItemGeneralInfo : public CMemSpyViewThreadInfoItemGeneric
- {
-public:
- CMemSpyViewThreadInfoItemGeneralInfo( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
-
-public: // From CMemSpyViewBase
- TBool HandleCommandL( TInt aCommand );
- void HandleListBoxItemActionedL( TInt aCurrentIndex );
-
-private: // Command handlers
- void OnCmdToggleKernelEventHooksL();
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneric.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWTHREADINFOITEMGENERIC_H
-#define MEMSPYVIEWTHREADINFOITEMGENERIC_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// Engine includes
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/api/memspyapithreadinfoitem.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-class CAknWaitDialog;
-class CMemSpyProcess;
-class CMemSpyThread;
-class CMemSpyThreadInfoContainer;
-class CMemSpyThreadInfoItemBase;
-class RMemSpySession;
-
-class CMemSpyViewThreadInfoItemGeneric : public CMemSpyViewBase
- {
-public:
- //CMemSpyViewThreadInfoItemGeneric( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aInfoContainer, TMemSpyThreadInfoItemType aType );
- CMemSpyViewThreadInfoItemGeneric( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcessId, TThreadId aId, TMemSpyThreadInfoItemType aType );
- ~CMemSpyViewThreadInfoItemGeneric();
-
-public: // From CMemSpyViewBase
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // API
- CMemSpyProcess& Process() const;
- CMemSpyThread& Thread() const;
- CMemSpyThreadInfoContainer& Container() const;
- CMemSpyThreadInfoItemBase& InfoItem() const;
- TThreadId ThreadId() { return iThreadId; }
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
- TBool HandleCommandL( TInt aCommand );
-
-protected: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aCurrentIndex );
- void HandleListBoxItemSelectedL( TInt aCurrentIndex );
-
-private: // Internal methods
- void ShowWaitNoteL();
- void DestroyWaitNote();
- static TInt CheckForItemConstructionComplete( TAny* aSelf );
-
-protected: // Member data
- //CMemSpyThreadInfoContainer& iContainer;
- //CMemSpyThreadInfoItemBase* iInfoItem;
-
-private: // Member data
- CAknWaitDialog* iWaitNote;
- CPeriodic* iWaitConstructionChecker;
-
- RArray<CMemSpyApiThreadInfoItem*> iThreadInfoItems; //cigasto
- CDesCArrayFlat* iModel;
- TThreadId iThreadId;
- TProcessId iParentProcessId;
- TMemSpyThreadInfoItemType iType;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemHeap.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWTHREADINFOITEMHEAP_H
-#define MEMSPYVIEWTHREADINFOITEMHEAP_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewThreadInfoItemGeneric.h"
-
-class RMemSpySession;
-
-class CMemSpyViewThreadInfoItemHeap : public CMemSpyViewThreadInfoItemGeneric
- {
-public:
- CMemSpyViewThreadInfoItemHeap( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
-
-public: // From CMemSpyViewBase
- TBool HandleCommandL( TInt aCommand );
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_HEAP; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdHeap; }
- void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
-
-private: // Command handlers
- void OnCmdHeapDataL();
- void OnCmdHeapCellListingL();
- void OnCmdHeapInfoL();
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemList.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWTHREADINFOITEMLIST_H
-#define MEMSPYVIEWTHREADINFOITEMLIST_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-
-// Classes referenced
-class CMemSpyProcess;
-class CMemSpyThread;
-class CMemSpyThreadInfoItemBase;
-class RMemSpySession;
-
-class CMemSpyViewThreadInfoItemList : public CMemSpyViewBase, public MMemSpyThreadInfoContainerObserver
- {
-public:
- //CMemSpyViewThreadInfoItemList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThread& aThread );
- CMemSpyViewThreadInfoItemList( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcess, TThreadId aThread );
- ~CMemSpyViewThreadInfoItemList();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TMemSpyThreadInfoItemType iType);
-
-public: // API
- const CMemSpyThreadInfoItemBase& CurrentInfoItem() const;
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
- TBool HandleCommandL( TInt aCommand );
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_THREAD; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdThread; }
- void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
-
-private: // Command handlers
- void OnCmdInfoHandlesL();
-
-private: // From MMemSpyThreadInfoContainerObserver
- void HandleMemSpyEngineInfoContainerEventL( TEvent aEvent, TMemSpyThreadInfoItemType aType );
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aCurrentIndex );
- void HandleListBoxItemSelectedL( TInt aCurrentIndex );
- static TInt IdleUpdateListBoxModel( TAny* aSelf );
- void DoIdleUpdateListBoxModelL();
-
-private: // Member data
- //CMemSpyThread& iThread;
- TThreadId iThreadId;
- TProcessId iParentProcessId;
- CMemSpyThreadInfoItemBase* iCurrentInfoItem;
- TInt iCurrentInfoItemId;
- CPeriodic* iIdleResetListboxTimer;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemMemoryTracking.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWTHREADINFOITEMMEMORYTRACKING_H
-#define MEMSPYVIEWTHREADINFOITEMMEMORYTRACKING_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// Engine includes
-#include <memspy/engine/memspyengineprocessmemorytracker.h>
-
-// User includes
-#include "MemSpyViewThreadInfoItemGeneric.h"
-
-// Classes referenced
-class CMemSpyEngineProcessMemoryTracker;
-
-
-class CMemSpyViewThreadInfoItemMemoryTracking : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver
- {
-public:
- CMemSpyViewThreadInfoItemMemoryTracking( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
- TBool HandleCommandL( TInt aCommand );
- TInt IndexByViewType( TMemSpyViewType aType );
- void HandleListBoxItemActionedL( TInt aIndex );
- void RefreshL();
- void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_MEMORY_TRACKING; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdMemoryTracking; }
-
-private: // From MMemSpyEngineProcessMemoryTrackerObserver
- void HandleMemoryTrackingStartedL();
- void HandleMemoryTrackingStoppedL();
- void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
-
-private: // Command handlers
- void OnCmdTrackingStartL();
- void OnCmdTrackingStopL();
- void OnCmdHWMResetL();
- void OnCmdTotalWithSharedMemL();
- void OnCmdTotalWithoutSharedMemL();
- };
-
-
-class CMemSpyViewThreadInfoItemMemoryTrackingCurrent : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver
- {
-public:
- CMemSpyViewThreadInfoItemMemoryTrackingCurrent( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- void RefreshL();
- void SetListBoxModelL();
-
-private: // From MMemSpyEngineProcessMemoryTrackerObserver
- void HandleMemoryTrackingStartedL() { }
- void HandleMemoryTrackingStoppedL() { }
- void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
- };
-
-
-
-class CMemSpyViewThreadInfoItemMemoryTrackingHWM : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver
- {
-public:
- CMemSpyViewThreadInfoItemMemoryTrackingHWM( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- TBool HandleCommandL( TInt aCommand );
- void RefreshL();
- void SetListBoxModelL();
-
-private: // From MMemSpyEngineProcessMemoryTrackerObserver
- void HandleMemoryTrackingStartedL() { }
- void HandleMemoryTrackingStoppedL() { }
- void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_MEMORY_TRACKING_HWM; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdMemoryTrackingHWM; }
-
-private: // Command handlers
- void OnCmdHWMResetL();
- };
-
-
-
-
-class CMemSpyViewThreadInfoItemMemoryTrackingPeak : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver
- {
-public:
- CMemSpyViewThreadInfoItemMemoryTrackingPeak( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- TBool HandleCommandL( TInt aCommand );
- void RefreshL();
- void SetListBoxModelL();
-
-private: // From MMemSpyEngineProcessMemoryTrackerObserver
- void HandleMemoryTrackingStartedL() { }
- void HandleMemoryTrackingStoppedL() { }
- void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared );
- };
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemServer.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWTHREADINFOITEMSERVER_H
-#define MEMSPYVIEWTHREADINFOITEMSERVER_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-#include <badesca.h>
-
-// User includes
-#include "MemSpyViewThreadInfoItemGeneric.h"
-
-// Classes referenced
-class TMemSpyDriverHandleInfoGeneric;
-class RMemSpySession;
-
-class CMemSpyViewThreadInfoItemServer : public CMemSpyViewThreadInfoItemGeneric
- {
-public:
- CMemSpyViewThreadInfoItemServer( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
-
-public: // From CMemSpyViewBase
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TBool HandleCommandL( TInt aCommand );
- void HandleListBoxItemSelectedL( TInt aCurrentIndex );
-
-public: // From CMemSpyViewBase
- CMemSpyViewBase* PrepareChildViewL();
-
-private: // Data members
- TMemSpyDriverHandleInfoGeneric iCurrentInfoItemDetails;
- };
-
-
-
-class CMemSpyViewThreadInfoItemServerDetails : public CMemSpyViewThreadInfoItemGeneric
- {
-public:
- CMemSpyViewThreadInfoItemServerDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails );
-
-public: // From CMemSpyViewBase
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TBool HandleCommandL( TInt aCommand );
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareChildViewL();
- CMemSpyViewBase* PrepareParentViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aCurrentIndex );
- void HandleListBoxItemSelectedL( TInt aCurrentIndex );
-
-private: // Internal methods
-
-private: // Member data
- const TMemSpyDriverHandleInfoGeneric iInfoItemDetails;
- };
-
-
-
-class CMemSpyViewThreadInfoItemServerSessions : public CMemSpyViewThreadInfoItemGeneric
- {
-public:
- CMemSpyViewThreadInfoItemServerSessions( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails );
-
-public: // From CMemSpyViewBase
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- TBool HandleCommandL( TInt aCommand );
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
-
-private: // Member data
- const TMemSpyDriverHandleInfoGeneric iInfoItemDetails;
- };
-
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemStack.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWTHREADINFOITEMSTACK_H
-#define MEMSPYVIEWTHREADINFOITEMSTACK_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// User includes
-#include "MemSpyViewThreadInfoItemGeneric.h"
-
-class RMemSpySession;
-
-class CMemSpyViewThreadInfoItemStack : public CMemSpyViewThreadInfoItemGeneric
- {
-public:
- CMemSpyViewThreadInfoItemStack( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
-
-public: // From CMemSpyViewBase
- TBool HandleCommandL( TInt aCommand );
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_STACK; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdStack; }
- void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
-
-private: // Command handlers
- void OnCmdDeviceStackSummaryL();
- void OnCmdStackInfoL();
- void OnCmdStackDataUserL();
- void OnCmdStackDataKernelL();
- void OnCmdStackDataUserAllThreadsL();
- void OnCmdStackDataKernelAllThreadsL();
- void OnCmdStackWatchForHighWatermarkL();
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewThreads.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWTHREADS_H
-#define MEMSPYVIEWTHREADS_H
-
-// System includes
-#include <coecntrl.h>
-#include <aknlists.h>
-#include <e32const.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-#include <memspy/api/memspyapithread.h>
-
-// Classes referenced
-class CMemSpyProcess;
-class CMemSpyThread;
-class RMemSpySession;
-
-class CMemSpyViewThreads : public CMemSpyViewBase
- {
-public:
- //CMemSpyViewThreads( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess );
- CMemSpyViewThreads( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aId, TThreadId aThreadId );
- ~CMemSpyViewThreads();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // API
- //const CMemSpyProcess& Process() const;
- //CMemSpyThread& CurrentThread();
- TProcessId Process() const;
- TThreadId CurrentThread();
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_THREAD; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdThread; }
- void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
-
-public: // From CMemSpyViewBase
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
- TBool HandleCommandL( TInt aCommand );
-
-private: // Command handlers
- void OnCmdEndKillL();
- void OnCmdEndTerminateL();
- void OnCmdEndPanicL();
- void OnCmdSetPriorityL( TInt aCommand );
- void OnCmdInfoHandlesL();
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- void HandleListBoxItemActionedL( TInt aCurrentIndex );
- void HandleListBoxItemSelectedL( TInt aCurrentIndex );
- void AppendPriority( TDes& aDes, TThreadPriority aPriority );
-
-private: // Member data
- //CMemSpyProcess& iParentProcess;
- //CMemSpyThread* iCurrentThread;
- TThreadId iCurrentThreadId;
- TProcessId iParentProcessId;
-
- RArray<CMemSpyApiThread*> iThreads;
- CDesCArrayFlat* iModel;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewType.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWTYPE_H
-#define MEMSPYVIEWTYPE_H
-
-// System includes
-#include <e32std.h>
-
-// Enumerations
-enum TMemSpyViewType
- {
- EMemSpyViewTypeNone = -1,
- EMemSpyViewTypeMainMenu = 0,
- EMemSpyViewTypeProcesses,
- EMemSpyViewTypeRAMInfo,
- EMemSpyViewTypeROMInfo,
- EMemSpyViewTypeServerList,
- EMemSpyViewTypeOpenFiles,
- EMemSpyViewTypeFBServBitmaps,
- EMemSpyViewTypeFBServBitmapInfo,
- EMemSpyViewTypeFBServBitmapViewer,
- EMemSpyViewTypeCodeSegmentList,
- EMemSpyViewTypeCodeSegmentDetails,
- EMemSpyViewTypeChunkList,
- EMemSpyViewTypeChunkDetails,
- EMemSpyViewTypeSystemConfig,
- EMemSpyViewTypeKernel,
- EMemSpyViewTypeKernelContainers,
- EMemSpyViewTypeKernelObjects,
- EMemSpyViewTypeKernelHeap,
- EMemSpyViewTypeDriveSummary,
- EMemSpyViewTypeDriveInfo,
- EMemSpyViewTypeECom,
- EMemSpyViewTypeEComCategory,
- EMemSpyViewTypeEComInterface,
- EMemSpyViewTypeEComImplementation,
- EMemSpyViewTypeThreads,
- EMemSpyViewTypeThreadInfoItemList,
- EMemSpyViewTypeThreadInfoItemHeap,
- EMemSpyViewTypeThreadInfoItemStack,
- EMemSpyViewTypeThreadInfoItemChunk,
- EMemSpyViewTypeThreadInfoItemCodeSeg,
- EMemSpyViewTypeThreadInfoItemServer,
- EMemSpyViewTypeThreadInfoItemServerDetails,
- EMemSpyViewTypeThreadInfoItemServerSessions,
- EMemSpyViewTypeThreadInfoItemSession,
- EMemSpyViewTypeThreadInfoItemSemaphore,
- EMemSpyViewTypeThreadInfoItemMutex,
- EMemSpyViewTypeThreadInfoItemTimer,
- EMemSpyViewTypeThreadInfoItemLDD,
- EMemSpyViewTypeThreadInfoItemPDD,
- EMemSpyViewTypeThreadInfoItemLogicalChannel,
- EMemSpyViewTypeThreadInfoItemChangeNotifier,
- EMemSpyViewTypeThreadInfoItemUndertaker,
- EMemSpyViewTypeThreadInfoItemMessageQueue,
- EMemSpyViewTypeThreadInfoItemConditionalVariable,
- EMemSpyViewTypeThreadInfoItemOpenFiles,
- EMemSpyViewTypeThreadInfoItemActiveObject,
- EMemSpyViewTypeThreadInfoItemActiveObjectDetails,
- EMemSpyViewTypeThreadInfoItemGeneralInfo,
- EMemSpyViewTypeThreadInfoItemOtherThreads,
- EMemSpyViewTypeThreadInfoItemOtherProcesses,
- EMemSpyViewTypeThreadInfoItemOwnedThreadHandles,
- EMemSpyViewTypeThreadInfoItemOwnedProcessHandles,
- EMemSpyViewTypeHeapTracking,
- EMemSpyViewTypeHeapTrackingSettings,
- EMemSpyViewTypeHeapTrackingResults,
- EMemSpyViewTypeHeapTrackingResultsCycleInfo,
- EMemSpyViewTypeHeapTrackingResultsCycleChangeDescriptor,
- EMemSpyViewTypeThreadInfoItemMemoryTracking,
- EMemSpyViewTypeThreadInfoItemMemoryTrackingAutoStartConfig,
- EMemSpyViewTypeThreadInfoItemMemoryTrackingStatistics,
- EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent,
- EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM,
- EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak,
- EMemSpyViewTypeWindowGroups
- };
-
-
-class MemSpyViewTypeUtils
- {
-public:
- static TBool IsOpenableItem( TMemSpyViewType aType );
- static TBool IsThreadInfoItem( TMemSpyViewType aType );
- static TBool IsExitableView( TMemSpyViewType aType );
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/MemSpyViewWindowGroups.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEWWINDOWGROUPS_H
-#define MEMSPYVIEWWINDOWGROUPS_H
-
-// System includes
-#include <hal.h>
-#include <coecntrl.h>
-#include <aknlists.h>
-
-// Engine includes
-#include <memspy/engine/memspyenginehelperwindowserver.h>
-
-// User includes
-#include "MemSpyViewBase.h"
-
-// Classes referenced
-
-
-class CMemSpyViewWindowGroups : public CMemSpyViewBase
- {
-public:
- CMemSpyViewWindowGroups( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
- ~CMemSpyViewWindowGroups();
- void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
-
-public: // From CMemSpyViewBase
- CEikListBox* ConstructListBoxL();
- void RefreshL();
- TMemSpyViewType ViewType() const;
- CMemSpyViewBase* PrepareParentViewL();
- CMemSpyViewBase* PrepareChildViewL();
-
-public: // Menu framework
- TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_WINDOW_GROUPS; }
- TInt MenuCascadeCommandId() const { return EMemSpyCmdWindowGroups; }
-
-private: // From CMemSpyViewBase
- void SetListBoxModelL();
- TBool HandleCommandL( TInt aCommand );
-
-private: // Command handlers
- void OnCmdSwitchToL();
- void OnCmdEndL( TInt aCommand );
-
-private: // Internal methods
- void DetailsL();
- void AppendFormatString( TPtr& aPtr, TRefByValue<const TDesC> aFmt, ... );
-
-private: // Data members
- MMemSpyEngineWindowGroupList* iWindowGroupList;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/inc/viewcli.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies 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 __VIEWCLI_H__
-#define __VIEWCLI_H__
-
-#include <e32base.h>
-#include <gdi.h>
-#include <vwsdef.h>
-
-//
-// Forward declarations.
-//
-
-class RVwsSession;
-class CVwsSessionEventHandler;
-class MVwsAppStarter;
-
-class MVwsSessionWrapperObserver
-/**
-The MVwsSessionObserver specifies an interface through which server events to be handled by the owner of
-a client session are notified
-
-@publishedAll
-@deprecated
-*/
-//@internalTechnology @released
-
- {
-public:
-
- /**
- * Handles the view event aEvent for a view added through the client session being observed.
- * Handles events for all the views added by the client.
- */
- virtual void HandleViewEventL(const TVwsViewEvent& aEvent)=0;
- };
-
-
-class CVwsSessionWrapper : public CBase
-/**
-The CVwsSessionWrapper class mediates access to the view server client session which it creates, and wraps in
-support for notification of server events. A session observer will be called back with server events if
-it maintains an outstanding request for asynchronous event notification.
-
-@publishedPartner
-@released
-*/
-//@internalTechnology @released
-
- {
-public:
- IMPORT_C static CVwsSessionWrapper* NewL();
- IMPORT_C static CVwsSessionWrapper* NewLC();
- IMPORT_C static CVwsSessionWrapper* NewL(MVwsSessionWrapperObserver& aObserver);
- IMPORT_C static CVwsSessionWrapper* NewLC(MVwsSessionWrapperObserver& aObserver);
- IMPORT_C ~CVwsSessionWrapper();
- IMPORT_C static TInt StartViewServer(MVwsAppStarter& aAppStarter);
- IMPORT_C TInt ShutdownViewServer();
- IMPORT_C TInt AddView(const TVwsViewId& aViewId);
- IMPORT_C TInt RemoveView(const TVwsViewId& aViewId) const;
- IMPORT_C TInt SetSystemDefaultView(const TVwsViewId& aViewId,TInt aMode);
- IMPORT_C TInt SetSystemDefaultView(const TVwsViewId& aViewId);
- IMPORT_C TInt ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage);
- IMPORT_C TInt ActivateViewViaViewEvent(const TVwsViewIdAndMessage& aViewIdAndMessage);
- IMPORT_C TInt RequestCustomMessage(TDes8& aMessageBufPtr) const;
- IMPORT_C void QueueAsyncRequest();
- IMPORT_C TInt StartApp(TUid aAppToStart);
- IMPORT_C TInt DeactivateActiveView();
- IMPORT_C TInt DeactivateActiveViewIfOwnerMatch();
- IMPORT_C TInt NotifyNextDeactivation(const TVwsViewId& aViewId);
- IMPORT_C TInt NotifyNextDeactivation();
- IMPORT_C TInt NotifyNextActivation(const TVwsViewId& aViewId);
- IMPORT_C TInt NotifyNextActivation();
- IMPORT_C TInt SetDefaultView(const TVwsViewId& aViewId,TInt aMode) const;
- IMPORT_C TInt SetDefaultView(const TVwsViewId& aViewId) const;
- IMPORT_C TInt GetSystemDefaultView(TVwsViewId& aViewId);
- IMPORT_C TInt CreateActivateViewEvent(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage);
- IMPORT_C TInt SetClientRequestTimeOut(TTimeIntervalMicroSeconds32 aDuration);
- IMPORT_C TInt SetServerEventTimeOut(TTimeIntervalMicroSeconds32 aDuration);
- IMPORT_C TInt EnableServerEventTimeOut(TBool aEnable);
- IMPORT_C TInt CheckSourceOfViewSwitch(TBool& aResult,const TSecurityPolicy& aSecurityPolicy,const char* aDiagnostic);
- IMPORT_C TInt EnableServerBlankScreen(TBool aEnable);
- IMPORT_C TInt EnableExternalViewSwitches(TBool aEnable);
- IMPORT_C void ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TRequestStatus& aStatus);
- IMPORT_C TInt SetCrossCheckUid(const TUid& aCrossCheckUid);
- IMPORT_C TInt SetWindowBackgroundColor(const TRgb& aBgColor);
-public:
- /**
- @internalComponent
- @released
- */
- IMPORT_C TInt ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TInt aCustomControl);
- /**
- @internalComponent
- @released
- */
- IMPORT_C void ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TRequestStatus& aStatus, TInt aCustomControl);
- /**
- @internalComponent
- @released
- */IMPORT_C TInt CreateActivateViewEvent(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TInt aCustomControl);
- /**
- @internalComponent
- @released
- */
- IMPORT_C TInt GetCurrentActiveViewInSystem(TVwsViewId& aActiveViewId);
-private:
- CVwsSessionWrapper();
- CVwsSessionWrapper(MVwsSessionWrapperObserver& aObserver);
- void ConstructL();
- TInt CheckCreateViewServerSession();
- TBool IsSchedulerRunning();
-private:
- RVwsSession* iVwsSession;
- CVwsSessionEventHandler* iViewEventHandler;
- MVwsSessionWrapperObserver* iObserver;
- };
-
-
-//
-// Panic.
-//
-/**
-@internalComponent
-*/
-enum TVwsPanic
- {
- EVwsCreateScheduler=1,
- EVwsThreadRename
- };
-
-/**
-@internalComponent
-*/
-GLREF_C void Panic(TVwsPanic aPanic);
-
-/**
-Server thread start.
-
-@internalComponent
-*/
-GLDEF_C TInt ViewServerThreadStart(TAny* aPtr);
-
-/**
-@internalComponent
-*/
-struct SVwsCommandLine
- {
- MVwsAppStarter* iAppStarter;
- };
-
-
-#endif
--- a/memspyui/ui/avkon/src/MemSpyApp.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyApp.h"
-
-// System includes
-#include <eikstart.h>
-
-// User includes
-#include "MemSpyDocument.h"
-
-
-
-TUid CMemSpyApp::AppDllUid() const
- {
- return KUidMemSpy;
- }
-
-
-CApaDocument* CMemSpyApp::CreateDocumentL()
- {
- return CMemSpyDocument::NewL( *this );
- }
-
-
-EXPORT_C CApaApplication* NewApplication()
- {
- return new CMemSpyApp;
- }
-
-
-GLDEF_C TInt E32Main()
- {
- return EikStart::RunApplication(NewApplication);
- }
-
--- a/memspyui/ui/avkon/src/MemSpyAppUi.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,761 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyAppUi.h"
-
-// System includes
-#include <AknQueryDialog.h>
-#include <aknmessagequerydialog.h>
-#include <aknradiobuttonsettingpage.h>
-#include <eikaufty.h>
-#include <eikmenub.h>
-#include <avkon.hrh>
-#include <barsread.h>
-#include <f32file.h>
-#include <apgtask.h>
-#include <memspyui.rsg>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyenginehelperthread.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperkernelcontainers.h>
-#include <memspy/engine/memspyenginehelperfbserv.h>
-#include <memspyengineclientinterface.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-#include <memspy/engine/memspyenginehelperkernelcontainers.h>
-//cigasto
-#include <memspysession.h>
-
-// User includes
-#include "MemSpyContainer.h"
-#include "MemSpyDocument.h"
-#include "MemSpySettings.h"
-#include "MemSpyDeviceWideOperationDialog.h"
-#include "MemSpyViewRAMInfo.h" // for aknicon config check
-#include "MemSpyExportBitmapsToMemoryCardDialog.h"
-#include "MemSpy.hrh"
-#include "viewcli.h"
-
-// Constants
-const TInt KMemSpyDefaultAutoCaptureTimerPeriod = 60;
-const TUint32 KMemSpyEikSrvSID = 0x10003a4a;
-
-/*
-CMemSpyAppUi::CMemSpyAppUi( CMemSpyEngine& aEngine )
-: iEngine( aEngine ), iAutoCaptureTimerPeriod( KMemSpyDefaultAutoCaptureTimerPeriod ), iAutoCaptureOperationType( CMemSpyDeviceWideOperations::EPerEntityHeapInfo )
- {
- iEngine.SetObserver( this );
- }
-*/
-CMemSpyAppUi::CMemSpyAppUi( RMemSpySession &aSession )
-: iMemSpySession( aSession ), iAutoCaptureTimerPeriod( KMemSpyDefaultAutoCaptureTimerPeriod ), iAutoCaptureOperationType( CMemSpyDeviceWideOperations::EPerEntityHeapInfo )
- {
- //iEngine.SetObserver( this );
- }
-
-CMemSpyAppUi::~CMemSpyAppUi()
- {
- RDebug::Printf( "[MemSpy] MemSpy is now closing." );
- //
- delete iAutoCaptureTimer;
- //
- if (iAppContainer)
- {
- RemoveFromStack( iAppContainer );
- delete iAppContainer;
- }
- //
- //iEngine.SetObserver( NULL );
- SetViewServerTimeOutStatus( ETrue );
- }
-
-
-void CMemSpyAppUi::ConstructL()
- {
- BaseConstructL( EAknEnableSkin );
- //
- //iAppContainer = new (ELeave) CMemSpyContainer( iEngine, *this );
- iAppContainer = new (ELeave) CMemSpyContainer( iMemSpySession, *this );
- iAppContainer->SetMopParent(this);
- iAppContainer->ConstructL( ClientRect() );
- iAppContainer->SetObserver( this );
- iAppContainer->SetFocus( ETrue );
- AddToStackL( iAppContainer );
- //
- iAutoCaptureTimer = CPeriodic::NewL( CActive::EPriorityIdle );
- //
- iEikonEnv->SetSystem( ETrue );
- //
- SetViewServerTimeOutStatus( EFalse );
- }
-
-
-CMemSpyDocument& CMemSpyAppUi::MemSpyDocument()
- {
- CMemSpyDocument* doc = static_cast< CMemSpyDocument* >( Document() );
- return *doc;
- }
-
-
-const CMemSpyDocument& CMemSpyAppUi::MemSpyDocument() const
- {
- const CMemSpyDocument* doc = static_cast< const CMemSpyDocument* >( Document() );
- return *doc;
- }
-
-
-void CMemSpyAppUi::HandleStatusPaneSizeChange()
- {
- iAppContainer->SetRect( ClientRect() );
- }
-
-
-void CMemSpyAppUi::HandleControlEventL( CCoeControl* aControl, TCoeEvent /*aEventType*/ )
- {
- if ( aControl == iAppContainer )
- {
- UpdateCBAL();
- }
- }
-
-
-void CMemSpyAppUi::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
- {
- CMemSpyViewBase& view = iAppContainer->ActiveView();
- const TMemSpyViewType viewType = iAppContainer->ActiveViewType();
- //
- const TBool openableView = MemSpyViewTypeUtils::IsOpenableItem( viewType );
- const TBool exitable = MemSpyViewTypeUtils::IsExitableView( viewType );
- //
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - START - aResourceId: 0x%08x (%8d), iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d, viewType: %d, openableView: %d, exitable: %d", aResourceId, aResourceId, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive(), viewType, openableView, exitable );
-#endif
- //
- if ( aResourceId == R_MEMSPY_MENUPANE )
- {
- const TInt count = aMenuPane->NumberOfItemsInPane();
- for( TInt i=0; i<count; i++ )
- {
- TBool dimItem = EFalse;
- CEikMenuPaneItem::SData& menuPaneMetaData = aMenuPane->ItemDataByIndexL( i );
-
- // If the command is inside the view-specific range then we'll hide it
- // unless the view and command id matches.
- const TBool isViewSpecific = ( menuPaneMetaData.iCommandId >= KMemSpyMenuCommandViewSpecific );
- if ( isViewSpecific )
- {
- // Check whether this view requires this command item.
- dimItem = ( view.MenuCascadeCommandId() != menuPaneMetaData.iCommandId );
- }
-
- aMenuPane->SetItemDimmed( menuPaneMetaData.iCommandId, dimItem );
- }
-
- aMenuPane->SetItemDimmed( EMemSpyCmdOpen, !openableView );
- aMenuPane->SetItemDimmed( EAknSoftkeyBack, exitable );
- aMenuPane->SetItemDimmed( EAknCmdExit, !exitable );
- }
- else if ( aResourceId == R_MEMSPY_MENUPANE_TOOLS )
- {
- const TBool inOpenFilesView = ( viewType == EMemSpyViewTypeOpenFiles );
- aMenuPane->SetItemDimmed( EMemSpyCmdToolsListOpenFiles, !inOpenFilesView );
- }
- else if ( aResourceId == R_MEMSPY_MENUPANE_VIEW )
- {
- // Hide the refresh item when in the thread info container view
- aMenuPane->SetItemDimmed( EMemSpyCmdViewRefresh, viewType == EMemSpyViewTypeThreadInfoItemList );
- aMenuPane->SetItemDimmed( EMemSpyCmdViewOutputToSink, viewType == EMemSpyViewTypeThreadInfoItemList );
- }
- else if ( aResourceId == R_MEMSPY_MENUPANE_OUTPUT )
- {
- TMemSpySinkType currentSink;
- iMemSpySession.GetOutputSink( currentSink );
- aMenuPane->SetItemDimmed( EMemSpyCmdOutputToDebug, currentSink == ESinkTypeDebug );
- aMenuPane->SetItemDimmed( EMemSpyCmdOutputToFile, currentSink == ESinkTypeFile );
- }
- else if ( aResourceId == R_MEMSPY_MENUPANE_AUTO_CAPTURE )
- {
- // Change the auto-capture toggle caption appropriately...
- TInt resId = R_MEMSPY_AUTO_CAPTURE_ENABLE;
- if ( iAutoCaptureTimer->IsActive() )
- {
- resId = R_MEMSPY_AUTO_CAPTURE_DISABLE;
- }
- aMenuPane->SetItemTextL( EMemSpyCmdAutoCaptureToggle, resId );
- }
-
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - sending to view..." );
-#endif
-
- view.DynInitMenuPaneL( aResourceId, aMenuPane );
-
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - END - aResourceId: 0x%08x (%8d), iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d, viewType: %d, openableView: %d, exitable: %d", aResourceId, aResourceId, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive(), viewType, openableView, exitable );
-#endif
- }
-
-
-TKeyResponse CMemSpyAppUi::HandleKeyEventL( const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ )
- {
- return EKeyWasNotConsumed;
- }
-
-
-void CMemSpyAppUi::HandleCommandL( TInt aCommand )
- {
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::HandleCommandL() - START - aCommand: %8d, iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", aCommand, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
-#endif
-
- switch ( aCommand )
- {
- case EAknSoftkeyBack:
- OnCmdBackL();
- break;
-
- case EEikCmdExit:
- case EAknCmdExit:
- case EAknSoftkeyExit:
- OnCmdExitL();
- break;
-
- case EMemSpyCmdOpen:
- OnCmdOpenL();
- break;
-
- case EMemSpyCmdOutputToDebug:
- OnCmdOutputToDebugL();
- break;
- case EMemSpyCmdOutputToFile:
- OnCmdOutputToFileL();
- break;
-
- case EMemSpyCmdToolsAbout:
- OnCmdAboutL();
- break;
- //
- case EMemSpyCmdPhoneInfoGeneralSummary:
- //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralSummary );
- OnCmdPhoneInformationOperationL( OutputPhoneInfo );
- break;
- case EMemSpyCmdPhoneInfoGeneralDetailed:
- //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralDetailed );
- OnCmdPhoneInformationOperationL( OutputDetailedPhoneInfo );
- break;
- /*
- case EMemSpyCmdPhoneInfoGeneralHandles:
- OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralHandles );
- break;
- case EMemSpyCmdPhoneInfoGeneralKernelContainers:
- OnCmdPhoneInformationOperationKernelContainersL();
- break;
- //
- */
- case EMemSpyCmdPhoneInfoHeapInfoSummary:
- //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapInfo );
- OnCmdPhoneInformationOperationL (OutputHeapInfo );
- break;
- case EMemSpyCmdPhoneInfoHeapInfoCompact:
- //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceHeapInfoCompact );
- OnCmdPhoneInformationOperationL( OutputCompactHeapInfo );
- break;
- case EMemSpyCmdPhoneInfoHeapCellListing:
- //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapCellListing );
- OnCmdPhoneInformationOperationL( OutputHeapCellListing );
- break;
-
- case EMemSpyCmdPhoneInfoHeapDump:
- //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapData );
- OnCmdPhoneInformationOperationL( OutputHeapData );
- break;
- //
- case EMemSpyCmdPhoneInfoStackInfo:
- //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackInfo );
- OnCmdPhoneInformationOperationL( OutputStackInfo );
- break;
- case EMemSpyCmdPhoneInfoStackInfoCompact:
- //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceStackInfoCompact );
- OnCmdPhoneInformationOperationL( OutputCompactStackInfo );
- break;
- case EMemSpyCmdPhoneInfoStackDumpUser:
- //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataUser );
- OnCmdPhoneInformationOperationL( OutputUserStackData );
- break;
- case EMemSpyCmdPhoneInfoStackDumpKernel:
- //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataKernel );
- OnCmdPhoneInformationOperationL( OutputKernelStackData );
- break;
-
- case EMemSpyCmdAutoCaptureToggle:
- OnCmdAutoCaptureToggleL();
- break;
- case EMemSpyCmdAutoCaptureRetryTime:
- OnCmdAutoCaptureRetryTimeL();
- break;
- case EMemSpyCmdAutoCaptureOperationType:
- OnCmdAutoCaptureOperationTypeL();
- break;
-
- default:
- iAppContainer->HandleCommandL( aCommand );
- break;
- }
-
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::HandleCommandL() - END - aCommand: %8d, iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", aCommand, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
-#endif
- }
-
-
-void CMemSpyAppUi::HandleForegroundEventL( TBool aForeground)
- {
- // Refresh the container when coming to the foreground
- if ( aForeground )
- {
- iAppContainer->OnCmdViewRefreshL();
- }
- }
-
-
-void CMemSpyAppUi::HandleThreadSelectedL( const CMemSpyThread& /*aThread*/ )
- {
- MEikAppUiFactory* appUiFactory = (iEikonEnv)->AppUiFactory();
- appUiFactory->MenuBar()->TryDisplayMenuBarL();
- }
-
-
-void CMemSpyAppUi::HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext )
- {
- if ( aEvent == MMemSpyEngineObserver::EHandleThreadsOrProcessesChanged )
- {
- // Get the original container
- const CMemSpyEngineObjectContainer& oldContainer = *reinterpret_cast< CMemSpyEngineObjectContainer* >( aContext );
- (void) oldContainer;
-
- // Refresh the container
- iAppContainer->OnCmdViewRefreshL();
- }
- else if ( aEvent == MMemSpyEngineObserver::EHandleClientServerOperationRequest )
- {
- const TInt function = reinterpret_cast<TInt>( aContext );
- InitiateMemSpyClientServerOperationL( function );
- }
- }
-
-
-void CMemSpyAppUi::DWOperationStarted()
- {
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationStarted() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
-#endif
-
- iRunningDeviceWideOperation = ETrue;
-
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationStarted() - END - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
-#endif
- }
-
-
-void CMemSpyAppUi::DWOperationCancelled()
- {
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCancelled() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
-#endif
-
- iAutoCaptureTimer->Cancel();
-
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCancelled() - END - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
-#endif
- }
-
-
-void CMemSpyAppUi::DWOperationCompleted()
- {
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCompleted() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
-#endif
-
- iRunningDeviceWideOperation = EFalse;
-
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCompleted() - END - iAutoCaptureTimer is active: %d", iAutoCaptureTimer->IsActive() );
-#endif
- }
-
-
-void CMemSpyAppUi::UpdateCBAL()
- {
- CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
- const TMemSpyViewType viewType = iAppContainer->ActiveViewType();
- //
- if ( MemSpyViewTypeUtils::IsExitableView( viewType ) )
- {
- cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_EXIT );
- }
- else
- {
- cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
- }
-
- cba->MakeVisible( ETrue );
- cba->DrawNow();
- }
-
-
-void CMemSpyAppUi::InitiateMemSpyClientServerOperationL( TInt aOpCode )
- {
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::InitiateMemSpyClientServerOperationL() - START - aOpCode: %d", aOpCode );
-#endif
-
- switch( aOpCode )
- {
- case EMemSpyClientServerOpSummaryInfo:
- HandleCommandL( EMemSpyCmdPhoneInfoGeneralSummary );
- break;
- case EMemSpyClientServerOpSummaryInfoDetailed:
- HandleCommandL( EMemSpyCmdPhoneInfoGeneralDetailed );
- break;
- //
- case EMemSpyClientServerOpHeapInfo:
- HandleCommandL( EMemSpyCmdPhoneInfoHeapInfoSummary );
- break;
- case EMemSpyClientServerOpHeapCellListing:
- HandleCommandL( EMemSpyCmdPhoneInfoHeapCellListing );
- break;
- case EMemSpyClientServerOpHeapData:
- HandleCommandL( EMemSpyCmdPhoneInfoHeapDump );
- break;
- //
- case EMemSpyClientServerOpStackInfo:
- HandleCommandL( EMemSpyCmdPhoneInfoStackInfo );
- break;
- case EMemSpyClientServerOpStackDataUser:
- HandleCommandL( EMemSpyCmdPhoneInfoStackDumpUser );
- break;
- case EMemSpyClientServerOpStackDataKernel:
- HandleCommandL( EMemSpyCmdPhoneInfoStackDumpKernel );
- break;
- //
- case EMemSpyClientServerOpBitmapsSave:
- OnCmdToolsBitmapsSaveToMemoryCardL();
- break;
- case EMemSpyClientServerOpSendToBackground:
- OnCmdToolsSendToBackgroundL();
- break;
- case EMemSpyClientServerOpBringToForeground:
- OnCmdToolsBringToForegroundL();
- break;
- case EMemSpyClientServerOpExit:
- OnCmdExitL();
- break;
- //
- default:
- User::Leave( KErrNotSupported );
- break;
- }
-
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::InitiateMemSpyClientServerOperationL() - END - aOpCode: %d", aOpCode );
-#endif
- }
-
-
-void CMemSpyAppUi::SetViewServerTimeOutStatus( TBool aEnabled )
- {
- /* TODO
- iMemSpySession.SetServerTimeOutStatus( KMemSpyEikSrvSID, aEnabled );
- */
- /*
- TRAP_IGNORE(
- iEngine.HelperProcess().ImpersonateL( KMemSpyEikSrvSID );
- //
- CVwsSessionWrapper* ses = CVwsSessionWrapper::NewLC();
- ses->EnableServerEventTimeOut( aEnabled );
- CleanupStack::PopAndDestroy( ses );
- //
- iEngine.HelperProcess().ImpersonateL( 0 );
- );
- */
- }
-
-
-void CMemSpyAppUi::OnCmdBackL()
- {
- const TMemSpyViewType viewType = iAppContainer->ActiveViewType();
- //
- if ( !MemSpyViewTypeUtils::IsExitableView( viewType ) )
- {
- // Should go back one view
- iAppContainer->NavigateToParentViewL();
- }
- }
-
-
-void CMemSpyAppUi::OnCmdExitL()
- {
- Exit();
- }
-
-
-void CMemSpyAppUi::OnCmdOpenL()
- {
- const TMemSpyViewType viewType = iAppContainer->ActiveViewType();
- //
- if ( MemSpyViewTypeUtils::IsOpenableItem( viewType ) )
- {
- // Should go back one view
- iAppContainer->NavigateToChildViewL();
- }
- }
-
-
-void CMemSpyAppUi::OnCmdPhoneInformationOperationL( TDeviceWideOperation aOperation )
- {
- //
- //CMemSpyDeviceWideOperationDialog::ExecuteLD( iMemSpySession, aOperation );
- CMemSpyDwoTracker* tracker = CMemSpyDeviceWideOperationDialog::CreateDeviceWideOperation( iMemSpySession, aOperation );
- tracker->Start();
- /*
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdPhoneInformationOperationL() - START - aOp: %d, iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", aOp, iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
-#endif
-
- if ( !iRunningDeviceWideOperation )
- {
- CMemSpyDeviceWideOperationDialog::ExecuteLD( iMemSpySession, *this, aOp );
- }
-
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdPhoneInformationOperationL() - END - aOp: %d, iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", aOp, iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
-#endif
- */
- }
-
-
-void CMemSpyAppUi::OnCmdPhoneInformationOperationKernelContainersL()
- {
- /* TODO
- iMemSpySession.OutputKernelObjects();
- */
- /*
- CMemSpyEngineGenericKernelObjectContainer* list = iEngine.HelperKernelContainers().ObjectsAllL();
- CleanupStack::PushL( list );
- iEngine.HelperKernelContainers().OutputL( *list );
- CleanupStack::PopAndDestroy( list );
- */
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-void CMemSpyAppUi::OnCmdAutoCaptureToggleL()
- {
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdAutoCaptureToggleL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
-#endif
-
- if ( iAutoCaptureTimer->IsActive() )
- {
- iAutoCaptureTimer->Cancel();
- }
- else
- {
- iAutoCaptureTimer->Cancel();
- //
- const TTimeIntervalMicroSeconds32 interval( iAutoCaptureTimerPeriod * 1000000 );
- iAutoCaptureTimer->Start( 0, interval, TCallBack(AutoCaptureCallBack, this) );
- }
-
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdAutoCaptureToggleL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
-#endif
- }
-
-
-void CMemSpyAppUi::OnCmdAutoCaptureRetryTimeL()
- {
- CAknNumberQueryDialog* dialog = new(ELeave) CAknNumberQueryDialog( iAutoCaptureTimerPeriod );
- dialog->ExecuteLD( R_MEMSPY_DEVICE_WIDE_SETTINGS );
- }
-
-
-void CMemSpyAppUi::OnCmdAutoCaptureOperationTypeL()
- {
- CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( R_MEMSPY_AUTO_CAPTURE_OPERATION_TYPES );
- CleanupStack::PushL(items);
- //
- TInt currentItem = iAutoCaptureOperationType;
- //
- CAknRadioButtonSettingPage* dialog = new(ELeave) CAknRadioButtonSettingPage( R_MEMSPY_AUTO_CAPTURE_OPERATION_TYPES_SETTINGS_PAGE, currentItem, items );
- if ( dialog->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
- {
- iAutoCaptureOperationType = static_cast< CMemSpyDeviceWideOperations::TOperation >( currentItem );
- }
- //
- CleanupStack::PopAndDestroy( items );
- }
-
-
-TInt CMemSpyAppUi::AutoCaptureCallBack( TAny* aSelf )
- {
- CMemSpyAppUi* self = reinterpret_cast< CMemSpyAppUi* >( aSelf );
- TRAPD( err, self->AutoCaptureCallBackL() );
- //
- const TBool callMeBackAgain = ( err == KErrNone );
- return callMeBackAgain;
- }
-
-
-void CMemSpyAppUi::AutoCaptureCallBackL()
- {
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::AutoCaptureCallBackL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
-#endif
-
- // OnCmdPhoneInformationOperationL( iAutoCaptureOperationType );
-
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyAppUi::AutoCaptureCallBackL() - END - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
-#endif
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-void CMemSpyAppUi::OnCmdOutputToDebugL()
- {
- iMemSpySession.SwitchOutputSinkL( ESinkTypeDebug ); //set in engine
- MemSpyDocument().Settings().SetSinkType( ESinkTypeDebug ); //set in settings
- }
-
-
-void CMemSpyAppUi::OnCmdOutputToFileL()
- {
- iMemSpySession.SwitchOutputSinkL( ESinkTypeFile ); //set in engine
- MemSpyDocument().Settings().SetSinkType( ESinkTypeFile ); //set in settings
- }
-
-
-
-
-
-
-
-
-
-
-
-void CMemSpyAppUi::OnCmdAboutL()
- {
- CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog;
- dialog->ExecuteLD( R_MEMSPYUI_ABOUT_DIALOG );
- }
-
-
-
-
-
-
-
-
-
-
-
-
-void CMemSpyAppUi::OnCmdToolsBitmapsSaveToMemoryCardL()
- {
- /* TODO
- // Get bitmap handles
- RArray<TInt> handles;
- CleanupClosePushL( handles );
- iEngine.HelperFbServ().GetArrayOfBitmapHandlesL( handles );
-
- // Build bitmap list
- CMemSpyEngineFbServBitmapArray* array = CMemSpyEngineFbServBitmapArray::NewL( handles );
- CleanupStack::PopAndDestroy( &handles );
- CleanupStack::PushL( array );
-
- // Export...
- CMemSpyExportBitmapsToMemoryCardDialog* dialog = CMemSpyExportBitmapsToMemoryCardDialog::NewL( iCoeEnv->FsSession(), *array );
-
- // All done
- CleanupStack::PopAndDestroy( array );
- */
- }
-
-
-void CMemSpyAppUi::OnCmdToolsSendToBackgroundL()
- {
- TApaTask task( iCoeEnv->WsSession() );
- task.SendToBackground();
- }
-
-
-void CMemSpyAppUi::OnCmdToolsBringToForegroundL()
- {
- iCoeEnv->BringOwnerToFront();
- }
-
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyContainer.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,227 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyContainer.h"
-
-// System includes
-#include <eikrted.h> // for example label control
-#include <txtrich.h>
-#include <apgtask.h>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-
-// User includes
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyContainerObserver.h"
-
-
-
-/*
-CMemSpyContainer::CMemSpyContainer( CMemSpyEngine& aEngine, MMemSpyContainerObserver& aObserver )
-: iEngine( aEngine ), iObserver( aObserver )
- {
- }
-*/
-CMemSpyContainer::CMemSpyContainer( RMemSpySession& aSession, MMemSpyContainerObserver& aObserver )
-: iMemSpySession( aSession ), iObserver( aObserver )
- {
- }
-
-CMemSpyContainer::~CMemSpyContainer()
- {
- delete iPreviousView;
- delete iActiveView;
- }
-
-
-void CMemSpyContainer::ConstructL(const TRect& aRect)
- {
- CreateWindowL();
- SetRect(aRect);
- PrepareTopLevelViewL();
- ActivateL();
- }
-
-
-void CMemSpyContainer::NavigateToParentViewL()
- {
- CMemSpyViewBase* parentView = iActiveView->PrepareParentViewL();
- //
- if ( parentView == NULL )
- {
- // Parent can be null, in which case, revert to top-level view
- PrepareTopLevelViewL();
- }
- else
- {
- SetNewActiveViewL( parentView );
- }
- }
-
-
-void CMemSpyContainer::NavigateToChildViewL()
- {
- CMemSpyViewBase* childView = iActiveView->PrepareChildViewL();
- //
- if ( childView != NULL )
- {
- SetNewActiveViewL( childView );
- }
- }
-
-
-void CMemSpyContainer::HandleCommandL( TInt aCommand )
- {
- switch( aCommand )
- {
- case EMemSpyCmdViewRefresh:
- OnCmdViewRefreshL();
- break;
- default:
- if ( iActiveView )
- {
- iActiveView->HandleCommandL( aCommand );
- }
- break;
- }
- }
-
-
-void CMemSpyContainer::OnCmdViewRefreshL()
- {
- if ( iActiveView )
- {
- TRAPD(err, iActiveView->RefreshL());
- if ( err != KErrNone )
- {
- // Error during view refreshing (perhaps the thread doesn't exist anymore).
- // Try to replace the active view with its parent...
- NavigateToParentViewL();
- }
- }
- }
-
-
-void CMemSpyContainer::SizeChanged()
- {
- if ( iActiveView )
- {
- iActiveView->SetRect( Rect() );
- }
- }
-
-
-TInt CMemSpyContainer::CountComponentControls() const
- {
- return 1;
- }
-
-
-CCoeControl* CMemSpyContainer::ComponentControl(TInt /*aIndex*/) const
- {
- return iActiveView;
- }
-
-
-void CMemSpyContainer::Draw(const TRect& aRect) const
- {
- CWindowGc& gc = SystemGc();
- //
- gc.SetPenStyle(CGraphicsContext::ENullPen);
- gc.SetBrushColor(KRgbGray);
- gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
- gc.DrawRect(aRect);
- }
-
-
-TKeyResponse CMemSpyContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
- {
- TKeyResponse response = EKeyWasNotConsumed;
- //
- if ( iActiveView )
- {
- response = iActiveView->OfferKeyEventL( aKeyEvent, aType );
- }
- //
- return response;
- }
-
-
-void CMemSpyContainer::HandleMemSpyViewEventL( TViewEventType aEvent, TMemSpyViewType /*aViewType*/, CMemSpyViewBase& aReportingView, TAny* /*aContext*/ )
- {
- if ( aEvent == EEventItemActioned )
- {
- // Get the view to generate a child
- CMemSpyViewBase* child = aReportingView.PrepareChildViewL();
- if ( child == NULL )
- {
- // View doesn't have a child - treat it as item activation and
- // report event to observer.
-
- }
- else
- {
- // Child view becomes the active one
- SetNewActiveViewL( child );
- }
- }
- }
-
-
-CMemSpyViewBase* CMemSpyContainer::PrepareTopLevelViewL()
- {
- //CMemSpyViewMainMenu* view = new(ELeave) CMemSpyViewMainMenu( iEngine, *this );
- CMemSpyViewMainMenu* view = new(ELeave) CMemSpyViewMainMenu( iMemSpySession, *this );
- CleanupStack::PushL( view );
- view->ConstructL( Rect(), *this );
- SetNewActiveViewL( view );
- CleanupStack::Pop( view );
- return view;
- }
-
-
-void CMemSpyContainer::SetNewActiveViewL( CMemSpyViewBase* aNewView )
- {
- delete iPreviousView;
- //
- iPreviousView = iActiveView;
- if ( iPreviousView )
- {
- iPreviousView->MakeVisible( EFalse );
- iPreviousView->SetFocus( EFalse );
- }
- //
- iActiveView = aNewView;
- iActiveView->RefreshL();
- iActiveView->SetFocus( ETrue );
- //
- ReportEventL( MCoeControlObserver::EEventStateChanged );
- }
-
-
-
-
-
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyDeviceWideOperationDialog.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,387 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyDeviceWideOperationDialog.h"
-
-// System includes
-#include <eikprogi.h>
-#include <AknWaitDialog.h>
-#include <AknQueryDialog.h>
-#include <coemain.h>
-#include <eikenv.h>
-#include <avkon.hrh>
-#include <memspyui.rsg>
-
-#include <memspysession.h>
-
-/*
-CMemSpyDeviceWideOperationDialog::CMemSpyDeviceWideOperationDialog( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver )
-: iEngine( aEngine ), iObserver( aObserver )
- {
- }
-
-CMemSpyDeviceWideOperationDialog::CMemSpyDeviceWideOperationDialog( RMemSpySession& aSession, MMemSpyDeviceWideOperationDialogObserver& aObserver )
-: iSession( aSession ), iObserver( aObserver )
- {
- }
-*/
-
-CMemSpyDeviceWideOperationDialog::CMemSpyDeviceWideOperationDialog( RMemSpySession& aSession )
-: iSession( aSession )
- {
- }
-
-
-CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog()
- {
-#ifdef _DEBUG
- RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - START - iForcedCancel: %d", iForcedCancel );
-#endif
-
-#ifdef _DEBUG
- RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - deleting operation...: 0x%08x", iOperation );
-#endif
- delete iOperation;
-
-#ifdef _DEBUG
- RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - deleting dialog...: 0x%08x", iProgressDialog );
-#endif
- iProgressInfo = NULL;
- delete iProgressDialog;
-
-#ifdef _DEBUG
- RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - sending EDialogDismissed to observer..." );
-#endif
-
- //iObserver.DWOperationCompleted(); //TODO
-
-#ifdef _DEBUG
- RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - END" );
-#endif
- }
-
-
-//void CMemSpyDeviceWideOperationDialog::ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation )
-void CMemSpyDeviceWideOperationDialog::ExecuteL( TDeviceWideOperation aOp )
- {
- /*
-#ifdef _DEBUG
- RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - START" );
-#endif
-
- iOperation = CMemSpyDeviceWideOperations::NewL( iEngine, *this, aOperation );
-
-#ifdef _DEBUG
- RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - constructed operation..." );
-#endif
-
- ASSERT( iProgressDialog == NULL );
- iProgressDialog = new( ELeave ) CAknProgressDialog( reinterpret_cast< CEikDialog** >( &iProgressDialog ), ETrue );
- iProgressDialog->PrepareLC( R_MEMSPY_DEVICE_WIDE_OPERATION_PROGRESS_DIALOG );
- iProgressDialog->SetCallback( this );
- iProgressDialog->SetGloballyCapturing( ETrue );
- //
- iProgressInfo = iProgressDialog->GetProgressInfoL();
- iProgressInfo->SetFinalValue( iOperation->TotalOperationSize() );
- //
- iProgressDialog->RunLD();
-
-#ifdef _DEBUG
- RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - END" );
-#endif
- */
- }
-
-void CMemSpyDeviceWideOperationDialog::ExecuteLD( RMemSpySession& aSession, TDeviceWideOperation aOp )
- {
- //CMemSpyDeviceWideOperationDialog* self = new(ELeave) CMemSpyDeviceWideOperationDialog( aSession, aObserver );
- CMemSpyDeviceWideOperationDialog* self = new(ELeave) CMemSpyDeviceWideOperationDialog( aSession );
- CleanupStack::PushL( self );
- self->ExecuteL( aOp );
- CleanupStack::PopAndDestroy( self );
- }
-
-
-void CMemSpyDeviceWideOperationDialog::Cancel()
- {
-#ifdef _DEBUG
- RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::Cancel() - START - iOperation: 0x%08x, iForcedCancel: %d", iOperation, iForcedCancel );
-#endif
-
- iForcedCancel = ETrue;
- //
- if ( iOperation )
- {
- iOperation->Cancel();
- }
- //
- //iObserver.DWOperationCancelled();
-
-#ifdef _DEBUG
- RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::Cancel() - END" );
-#endif
- }
-
-
-void CMemSpyDeviceWideOperationDialog::DialogDismissedL( TInt aButtonId )
- {
-#ifdef _DEBUG
- RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::DialogDismissedL() - START - aButtonId: %d, iForcedCancel: %d", aButtonId, iForcedCancel );
-#else
- (void) aButtonId;
-#endif
-
- Cancel();
-
-#ifdef _DEBUG
- RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::DialogDismissedL() - END - aButtonId: %d, iForcedCancel: %d", aButtonId, iForcedCancel );
-#endif
- }
-
-
-void CMemSpyDeviceWideOperationDialog::HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 )
- {
-#ifdef _DEBUG
- RDebug::Print( _L("[MemSpy] CMemSpyDeviceWideOperationDialog::HandleDeviceWideOperationEvent() - START - aEvent: %d, iProgressDialog: 0x%08x, aParam1: %d, aParam2: %S"), aEvent, iProgressDialog, aParam1, &aParam2 );
-#endif
-
- switch( aEvent )
- {
- case MMemSpyDeviceWideOperationsObserver::EOperationSized:
- break;
- case MMemSpyDeviceWideOperationsObserver::EOperationStarting:
- //iObserver.DWOperationStarted();
- break;
- case MMemSpyDeviceWideOperationsObserver::EOperationProgressStart:
- ASSERT( iProgressDialog != NULL );
- SetDialogCaptionL( aParam2 );
- break;
- case MMemSpyDeviceWideOperationsObserver::EOperationProgressEnd:
- ASSERT( iProgressDialog != NULL );
- iProgressInfo->IncrementAndDraw( aParam1 );
- break;
- case MMemSpyDeviceWideOperationsObserver::EOperationCancelled:
- break;
- case MMemSpyDeviceWideOperationsObserver::EOperationCompleting:
- {
- ASSERT( iProgressDialog != NULL );
- const TInt finalValue = iProgressInfo->Info().iFinalValue;
- iProgressInfo->SetAndDraw( finalValue );
- break;
- }
- case MMemSpyDeviceWideOperationsObserver::EOperationCompleted:
- if ( iProgressDialog )
- {
- iProgressDialog->ProcessFinishedL();
- }
- break;
- default:
- break;
- }
-
-#ifdef _DEBUG
- RDebug::Print( _L("[MemSpy] CMemSpyDeviceWideOperationDialog::HandleDeviceWideOperationEvent() - END - aEvent: %d, aParam1: %d, aParam2: %S"), aEvent, aParam1, &aParam2 );
-#endif
- }
-
-
-void CMemSpyDeviceWideOperationDialog::SetDialogCaptionL( const TDesC& aText )
- {
- if ( aText.Length() )
- {
- iProgressDialog->SetTextL( aText );
- iProgressDialog->DrawNow();
- }
- }
-
-CMemSpyDwoTracker* CMemSpyDeviceWideOperationDialog::CreateDeviceWideOperation( RMemSpySession& aSession, TDeviceWideOperation aOp )
-{
- return new CMemSpyDwoTracker( aSession, aOp );
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyDwoProgressTracker::CMemSpyDwoProgressTracker(RMemSpySession &aSession)
- : CActive( EPriorityStandard ), iSession( aSession )
- {
- CActiveScheduler::Add(this);
- }
-
-CMemSpyDwoProgressTracker::~CMemSpyDwoProgressTracker()
- {
- Cancel();
- }
-
-void CMemSpyDwoProgressTracker::Start()
- {
- ASSERT( iProgressDialog == NULL );
- iProgressDialog = new( ELeave ) CAknProgressDialog( reinterpret_cast< CEikDialog** >( &iProgressDialog ), ETrue );
- iProgressDialog->PrepareLC( R_MEMSPY_DEVICE_WIDE_OPERATION_PROGRESS_DIALOG );
- iProgressDialog->SetCallback( this );
- iProgressDialog->SetGloballyCapturing( ETrue );
- iProgressInfo = iProgressDialog->GetProgressInfoL();
-
- iSession.NotifyDeviceWideOperationProgress( iProgress, iStatus );
-
- UpdateProcessDialogL( iProgress.Progress(), iProgress.Description() );
-
- SetActive();
-
- iProgressDialog->RunLD();
- }
-
-void CMemSpyDwoProgressTracker::Cancel()
- {
- }
-
-void CMemSpyDwoProgressTracker::RunL()
- {
- // If an error occurred handle it in RunError().
- User::LeaveIfError(iStatus.Int());
-
- // Resubmit the request immediately
- iSession.NotifyDeviceWideOperationProgress( iProgress, iStatus );
-
- SetActive();
-
- UpdateProcessDialogL( iProgress.Progress(), iProgress.Description() );
- }
-
-void CMemSpyDwoProgressTracker::DoCancel()
- {
- }
-
-TInt CMemSpyDwoProgressTracker::RunError(TInt aError)
- {
- // KErrNotReady and KErrCancel errors are OK, they just notify
- // us about the outstanding notification request that won't be
- // processed.
- return KErrNone;
- }
-
-void CMemSpyDwoProgressTracker::UpdateProcessDialogL( TInt aProgress, const TDesC& aProgressText )
- {
- if(iProgressDialog)
- {
- iProgressDialog->SetTextL( aProgressText );
- }
-
- if(iProgressInfo)
- {
- iProgressInfo->SetAndDraw( aProgress );
- }
- }
-
-void CMemSpyDwoProgressTracker::DialogDismissedL(TInt aButtonId)
- {
- iProgressDialog = NULL;
- iProgressInfo = NULL;
-
- Cancel();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyDwoTracker::CMemSpyDwoTracker( RMemSpySession &aSession, TDeviceWideOperation aOperation )
-: CActive( EPriorityStandard ),
- iSession( aSession ),
- iProgressTracker(new CMemSpyDwoProgressTracker( aSession )),
- iOperation( aOperation )
- {
- CActiveScheduler::Add(this);
- }
-
-CMemSpyDwoTracker::~CMemSpyDwoTracker()
- {
- Cancel();
-
- delete iProgressTracker;
- }
-
-void CMemSpyDwoTracker::Start()
-{
- void (RMemSpySession::*functions[])(TRequestStatus&) = {
- &RMemSpySession::OutputPhoneInfo,
- &RMemSpySession::OutputDetailedPhoneInfo,
- &RMemSpySession::OutputHeapInfo,
- &RMemSpySession::OutputCompactHeapInfo,
- &RMemSpySession::OutputHeapCellListing,
- &RMemSpySession::OutputHeapData,
- &RMemSpySession::OutputStackInfo,
- &RMemSpySession::OutputCompactStackInfo,
- &RMemSpySession::OutputUserStackData,
- &RMemSpySession::OutputKernelStackData };
-
- (iSession.*functions[iOperation])(iStatus);
-
- SetActive();
-
- iProgressTracker->Start();
-}
-
-void CMemSpyDwoTracker::Cancel()
-{
-}
-
-void CMemSpyDwoTracker::RunL()
- {
- // If an error occurred handle it in RunError().
- User::LeaveIfError(iStatus.Int());
-
- if( !IsActive() )
- {
- iProgressTracker->ProgressDialog()->ProcessFinishedL();
- }
- }
-
-void CMemSpyDwoTracker::DoCancel()
-{
- // Cancel progress tracker
- iProgressTracker->Cancel();
-
- iSession.CancelDeviceWideOperationL();
-}
-
-TInt CMemSpyDwoTracker::RunError(TInt aError)
-{
- // Emit the finished(false) signal to notify user
- // operation was canceled
- //emit finished(false); //TODO:
-
- return KErrNone;
-}
--- a/memspyui/ui/avkon/src/MemSpyDocument.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyDocument.h"
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-
-// User includes
-#include "MemSpyAppUi.h"
-#include "MemSpySettings.h"
-
-//cigasto
-#include <memspysession.h>
-
-
-CMemSpyDocument::CMemSpyDocument(CEikApplication& aApp)
-: CAknDocument(aApp)
- {
- }
-
-
-CMemSpyDocument::~CMemSpyDocument()
- {
- delete iSettings;
- iMemSpySession->Close();
- }
-
-
-void CMemSpyDocument::ConstructL()
- {
- RFs& fsSession = CCoeEnv::Static()->FsSession();
- //cigasto
- //iEngine = CMemSpyEngine::NewL( fsSession );
-
- iMemSpySession = new (ELeave) RMemSpySession();
- //RMemSpySession iMemSpySession;
- TInt error = iMemSpySession->Connect();
- if(error != KErrNotFound)
- {
- User::LeaveIfError( error );
- }
-
- //iSettings = CMemSpySettings::NewL( fsSession, *iEngine );
- iSettings = CMemSpySettings::NewL( fsSession, *iMemSpySession );
- }
-
-
-CMemSpyDocument* CMemSpyDocument::NewL(CEikApplication& aApp)
- {
- CMemSpyDocument* self = new (ELeave) CMemSpyDocument( aApp );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop();
-
- return self;
- }
-
-/*
-CMemSpyEngine& CMemSpyDocument::Engine()
- {
- return *iEngine;
- }
-
-
-const CMemSpyEngine& CMemSpyDocument::Engine() const
- {
- return *iEngine;
- }
-*/
-
-CMemSpySettings& CMemSpyDocument::Settings()
- {
- return *iSettings;
- }
-
-
-const CMemSpySettings& CMemSpyDocument::Settings() const
- {
- return *iSettings;
- }
-
-
-CEikAppUi* CMemSpyDocument::CreateAppUiL()
- {
- //return new (ELeave) CMemSpyAppUi( *iEngine );
- return new (ELeave) CMemSpyAppUi( *iMemSpySession );
- }
-
--- a/memspyui/ui/avkon/src/MemSpyExportBitmapsToMemoryCardDialog.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,328 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyExportBitmapsToMemoryCardDialog.h"
-
-// System includes
-#include <eikprogi.h>
-#include <AknWaitDialog.h>
-#include <AknQueryDialog.h>
-#include <coemain.h>
-#include <eikenv.h>
-#include <avkon.hrh>
-#include <memspyui.rsg>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperstack.h>
-#include <memspy/engine/memspyenginehelperthread.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperfbserv.h>
-
-// Driver includes
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// Literal constants
-_LIT( KMemSpyBitmapExportFolderAndFileName, "e:\\MemSpy\\Images\\%04d%02d%02d_%02d.%02d.%02d\\");
-
-
-CMemSpyExportBitmapsToMemoryCardDialog::CMemSpyExportBitmapsToMemoryCardDialog( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps )
-: CActive(EPriorityIdle), iFsSession(aFsSession), iBitmaps(aBitmaps)
- {
- CActiveScheduler::Add(this);
- }
-
-
-CMemSpyExportBitmapsToMemoryCardDialog::~CMemSpyExportBitmapsToMemoryCardDialog()
- {
- Cancel();
- //
- delete iProgressDialog;
- //
- iMimeTypeArray.ResetAndDestroy();
- iMimeTypeArray.Close();
- //
- if ( iEncoder )
- {
- iEncoder->Cancel();
- }
- delete iEncoder;
- delete iFolderName;
- delete iBmpMimeType;
- }
-
-
-void CMemSpyExportBitmapsToMemoryCardDialog::ConstructL()
- {
- // Check card is ready
- if ( CheckMemoryCardAvailableL( iFsSession ) == EFalse )
- {
- User::Leave( KErrNotReady );
- }
-
- // Get mime type for BMP file
- IdentifyBmpMimeTypeL();
-
- // Prepare unique empty folder
- PrepareFolderNameSpecL();
-
- // Prepare UI stuff
- iProgressDialog = new( ELeave ) CAknProgressDialog( reinterpret_cast< CEikDialog** >( &iProgressDialog ) );
- iProgressDialog->SetCallback( this );
- iProgressDialog->SetGloballyCapturing( ETrue );
- iProgressDialog->PrepareLC( R_MEMSPY_EXPORT_TO_MEMORYCARD_DIALOG );
- //
- iProgressInfo = iProgressDialog->GetProgressInfoL( );
- iProgressInfo->SetFinalValue( iBitmaps.Count() );
- //
- iProgressDialog->MakeVisible( ETrue ); // Visible right away
- //
- iDialogDismissed = EFalse;
- iProgressInfo->SetAndDraw( 0 );
-
- // Start the process rolling...
- CompleteSelf(KErrNone);
-
- //
- iProgressDialog->RunLD( );
- }
-
-
-CMemSpyExportBitmapsToMemoryCardDialog* CMemSpyExportBitmapsToMemoryCardDialog::NewL( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps )
- {
- CMemSpyExportBitmapsToMemoryCardDialog* self = new(ELeave) CMemSpyExportBitmapsToMemoryCardDialog( aFsSession, aBitmaps );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-
-void CMemSpyExportBitmapsToMemoryCardDialog::Cancel()
- {
- CActive::Cancel();
- }
-
-
-TBool CMemSpyExportBitmapsToMemoryCardDialog::CheckMemoryCardAvailableL( RFs& aFsSession )
- {
- TBool available = EFalse;
- //
- TDriveInfo driveInfo;
- if ( aFsSession.Drive( driveInfo, EDriveE ) == KErrNone )
- {
- // Other checks needed?
- available = ETrue;
- }
- //
- return available;
- }
-
-
-void CMemSpyExportBitmapsToMemoryCardDialog::RunL()
- {
- const TInt error = iStatus.Int();
- User::LeaveIfError( error );
-
- if ( !iDialogDismissed )
- {
- // Do we have more items to process?
- if ( TryToExportSingleBitmapL() )
- {
- _LIT(KTextFormat, "Saving image\n%d/%d");
- TBuf<128> buf;
- buf.Format( KTextFormat, iBitmapIndex, iBitmaps.Count() );
- //
- iProgressDialog->SetTextL( buf );
- iProgressInfo->SetAndDraw( iBitmapIndex );
- iProgressDialog->DrawDeferred();
- }
- else
- {
- // We're done - RunL will not be called again
- if (iProgressInfo)
- {
- const TInt finalValue = iProgressInfo->Info().iFinalValue;
- iProgressInfo->SetAndDraw( finalValue );
- //
- delete iProgressDialog;
- iProgressDialog = NULL;
- //
- delete this;
- }
- }
-
- User::ResetInactivityTime();
- }
- else
- {
- delete iProgressDialog;
- iProgressDialog = NULL;
- //
- delete this;
- }
- }
-
-
-void CMemSpyExportBitmapsToMemoryCardDialog::DoCancel()
- {
- if ( iEncoder )
- {
- iEncoder->Cancel();
- }
-
- iDialogDismissed = ETrue;
- }
-
-
-TInt CMemSpyExportBitmapsToMemoryCardDialog::RunError( TInt /*aError*/ )
- {
- TRAP_IGNORE(
-
- // Try the next image
- if ( TryToExportSingleBitmapL() == EFalse )
- {
- iDialogDismissed = ETrue;
- delete this;
- }
- );
- //
- return KErrNone;
- }
-
-
-void CMemSpyExportBitmapsToMemoryCardDialog::DialogDismissedL( TInt /*aButtonId*/ )
- {
- iDialogDismissed = ETrue;
- iProgressDialog = NULL;
- }
-
-
-void CMemSpyExportBitmapsToMemoryCardDialog::CompleteSelf( TInt aError )
- {
- TRequestStatus* status = &iStatus;
- User::RequestComplete( status, aError );
- SetActive();
- }
-
-
-void CMemSpyExportBitmapsToMemoryCardDialog::ExportBitmapL( const CMemSpyEngineFbServBitmap& aBitmap )
- {
- // Create a filename
- TFileName fileName( *iFolderName );
- aBitmap.GetExportableFileNameL( fileName );
-
- // Create encoder object...
- CImageEncoder* encoder = CImageEncoder::FileNewL( iFsSession, fileName, *iBmpMimeType );
- delete iEncoder;
- iEncoder = encoder;
-
- // Start operation
- iEncoder->Convert( &iStatus, aBitmap.Bitmap() );
- SetActive();
- }
-
-
-void CMemSpyExportBitmapsToMemoryCardDialog::IdentifyBmpMimeTypeL()
- {
- _LIT(KBmpExtension, ".bmp");
- CImageEncoder::GetFileTypesL( iMimeTypeArray );
- //
- const TInt count = iMimeTypeArray.Count();
- //
- for( TInt i=0; i<count; i++ )
- {
- CFileExtensionMIMEType* extension = iMimeTypeArray[ i ];
- if ( extension->FileExtension().FindF( KBmpExtension ) >= 0 )
- {
- // Found it - save mime type info
- iBmpMimeType = extension->MIMEType().AllocL();
- iMimeTypeArray.ResetAndDestroy();
- iMimeTypeArray.Close();
- return;
- }
- }
- //
- User::Leave( KErrNotFound );
- }
-
-
-void CMemSpyExportBitmapsToMemoryCardDialog::PrepareFolderNameSpecL()
- {
- delete iFolderName;
- iFolderName = NULL;
-
- // Make a unique filename format specifier.
- TTime now;
- now.HomeTime();
- const TDateTime dt( now.DateTime() );
-
- // Build it up...
- iFolderName = HBufC::NewL( KMaxFileName );
- TPtr pName( iFolderName->Des() );
- pName.Format( KMemSpyBitmapExportFolderAndFileName, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second());
-
- // Create directory
- const TInt error = iFsSession.MkDirAll( pName );
- User::LeaveIfError( error );
- }
-
-
-TBool CMemSpyExportBitmapsToMemoryCardDialog::TryToExportSingleBitmapL()
- {
- TBool startedExport = EFalse;
-
- const TInt count = iBitmaps.Count();
- for( ; ( iBitmapIndex < count ) && ( startedExport == EFalse ); iBitmapIndex++ )
- {
- const CMemSpyEngineFbServBitmap& memSpyBitmap = iBitmaps.At( iBitmapIndex );
- const CFbsBitmap& fbsBitmap = memSpyBitmap.Bitmap();
- const TSize size( fbsBitmap.SizeInPixels() );
-
- // We don't want to export bitmaps which have a zero-pixel dimension.
- if ( size.iHeight > 0 && size.iWidth > 0 )
- {
- // This completes the object's request status and will therefore
- // result in a further call to RunL() when the export to BMP
- // is completed.
- ExportBitmapL( memSpyBitmap );
-
- // And indicate we managed to start an operation...
- startedExport = ETrue;
- }
- }
- //
- return startedExport;
- }
-
-
-
-
-
-
-
-
-
-
-
-
--- a/memspyui/ui/avkon/src/MemSpySettings.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,300 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpySettings.h"
-
-// System includes
-#include <e32svr.h>
-#include <s32file.h>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyenginelogger.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelpersysmemtracker.h>
-
-#include <memspysession.h>
-
-// Constants
-_LIT( KMemSpySettingsFileName, "settings.dat" ); //file or avkon client settings
-
-// Version 03 dumped some of the system wide memory tracker settings
-const TInt KMemSpySettingsFileFormatVersion = 6;
-
-CMemSpySettings::CMemSpySettings( RFs& aFsSession, RMemSpySession& aSession )
-: iFsSession( aFsSession ), iMemSpySession( aSession )
- {
- }
-
-
-CMemSpySettings::~CMemSpySettings()
- {
- TRACE( RDebug::Printf( "CMemSpySettings::~CMemSpySettings() - START" ) );
- TRAP_IGNORE( StoreSettingsL() );
- TRACE( RDebug::Printf( "CMemSpySettings::~CMemSpySettings() - END" ) );
- }
-
-
-void CMemSpySettings::ConstructL()
- {
- TRACE( RDebug::Print( _L("CMemSpySettings::ConstructL() - START") ) );
-
- TRAP_IGNORE( RestoreSettingsL() );
-
- TRACE( RDebug::Print( _L("CMemSpySettings::ConstructL() - END") ) );
- }
-
-CMemSpySettings* CMemSpySettings::NewL( RFs& aFsSession, RMemSpySession& aSession )
- {
- CMemSpySettings* self = new(ELeave) CMemSpySettings( aFsSession, aSession );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-void CMemSpySettings::GetSettingsFileNameL( TDes& aFileName )
- {
- GetSettingsPathL( aFileName );
- aFileName.Append( KMemSpySettingsFileName );
- TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsFileNameL() - aFileName: %S"), &aFileName ) );
- }
-
-
-void CMemSpySettings::GetSettingsPathL( TDes& aPath )
- {
- TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsPathL() - START") ) );
- aPath.Zero();
-
- // Get private data cage path
- TInt err = iFsSession.PrivatePath( aPath );
- TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsPathL() - priv path err: %d"), err ) );
- User::LeaveIfError( err );
-
- // Combine with C: drive
- const TDriveUnit cDrive( EDriveC );
- const TDriveName cDriveName( cDrive.Name() );
- aPath.Insert( 0, cDriveName );
-
- iFsSession.MkDirAll( aPath );
- TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsPathL() - END - %S"), &aPath ) );
- }
-
-RFile CMemSpySettings::SettingsFileLC( TBool aReplace )
- {
- TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - START - aReplace: %d"), aReplace ) );
-
- TFileName* fileName = new(ELeave) TFileName();
- CleanupStack::PushL( fileName );
- GetSettingsFileNameL( *fileName );
- TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - fileName: %S"), fileName ) );
-
- RFile file;
- TInt error = KErrNone;
- //
- if ( aReplace )
- {
- error = file.Replace( iFsSession, *fileName, EFileWrite );
- TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - replace err: %d"), error ) );
- }
- else
- {
- error = file.Open( iFsSession, *fileName, EFileWrite );
- TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - open err: %d"), error ) );
- //
- if ( error == KErrNotFound )
- {
- error = file.Create( iFsSession, *fileName, EFileWrite );
- }
- }
- //
- User::LeaveIfError( error );
- CleanupStack::PopAndDestroy( fileName );
- CleanupClosePushL( file );
- //
- TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - END") ) );
- return file;
- }
-
-
-void CMemSpySettings::StoreSettingsL()
- {
- TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - START" ) );
-
- RFile file = SettingsFileLC( ETrue );
- RFileWriteStream stream( file );
- CleanupStack::Pop(); // file
- CleanupClosePushL( stream );
-
- // Verion info
- stream.WriteInt32L( KMemSpySettingsFileFormatVersion );
-
- stream.WriteUint8L( iSinkType );
-
-
- // Get SWMT config
- //CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
- //TMemSpyEngineHelperSysMemTrackerConfig swmtConfig;
- //swmt.GetConfig( swmtConfig );
-
- // Write SWMT settings
- //stream.WriteInt32L( swmtConfig.TimerPeriod().Int() );
- //stream.WriteUint8L( swmtConfig.DumpData() );
-
- stream.WriteInt32L( iSwmtConfig.TimerPeriod().Int() );
- stream.WriteUint8L( iSwmtConfig.DumpData() );
-
- // Write memory tracking auto-start process list
- /*
- const RArray<TUid>& processUidList = iEngine.HelperProcess().MemoryTrackingAutoStartProcessList();
- stream.WriteInt32L( processUidList.Count() );
- for( TInt i=0; i<processUidList.Count(); i++ )
- {
- const TUid uid = processUidList[ i ];
- TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - process tracker uid[%02d]: 0x%08x", i, uid.iUid ) );
- stream << uid;
- }
- */
- stream.WriteInt32L( iUidList.Count() );
- for( TInt i = 0; i < iUidList.Count(); i++ )
- {
- const TUid uid = iUidList[ i ];
- TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - process tracker uid[%02d]: 0x%08x", i, uid.iUid ) );
- stream << uid;
- }
-
- // Write memory tracking categories
- //stream.WriteInt32L( swmtConfig.iEnabledCategories );
- stream.WriteInt32L( iSwmtConfig.iEnabledCategories );
-
- // Write heap tracking thread name filter
- //stream.WriteInt32L( swmtConfig.iThreadNameFilter.Length() );
- stream.WriteInt32L( iSwmtConfig.iThreadNameFilter.Length() );
-
- /*
- if ( swmtConfig.iThreadNameFilter.Length() > 0 )
- {
- stream.WriteL( swmtConfig.iThreadNameFilter, swmtConfig.iThreadNameFilter.Length() );
- }
-
- // Write mode
- stream.WriteInt32L( swmtConfig.iMode );
- */
- if ( iSwmtConfig.iThreadNameFilter.Length() > 0 )
- {
- stream.WriteL( iSwmtConfig.iThreadNameFilter, iSwmtConfig.iThreadNameFilter.Length() );
- }
-
- // Write mode
- stream.WriteInt32L( iSwmtConfig.iMode );
-
- stream.CommitL();
- CleanupStack::PopAndDestroy( &stream ); // Closes file
- }
-
-void CMemSpySettings::RestoreSettingsL()
- {
- RFile file = SettingsFileLC();
- RFileReadStream stream( file );
- CleanupStack::Pop(); // file
- CleanupClosePushL( stream );
-
- // Version info
- const TInt version = stream.ReadInt32L(); // discarded for now
- TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - version: %d", version ) );
-
- // Engine settings
- TMemSpySinkType type = static_cast< TMemSpySinkType >( stream.ReadUint8L() );
- TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - read sinkType: %d", type ) );
-
- //iEngine.InstallSinkL( type );
- //iMemSpySession.SwitchOutputSink( type ); //TODO: to argue to set stuf in engine from here
-
- // Set SWMT config
- TMemSpyEngineHelperSysMemTrackerConfig swmtConfig;
- swmtConfig.iTimerPeriod = TTimeIntervalMicroSeconds32( stream.ReadInt32L() );
- swmtConfig.iDumpData = static_cast< TBool >( stream.ReadUint8L() );
-
- if ( version < 3 )
- {
- // Restore but ignore old delta tracker settings which aren't used anymore
- //
- static_cast< TBool >( stream.ReadUint8L() );
- static_cast< TBool >( stream.ReadUint8L() );
- static_cast< TBool >( stream.ReadUint8L() );
- }
-
- // Restore memory tracking auto-start process uids if file format supports it...
- if ( version >= 2 )
- {
- RArray<TUid> list;
- CleanupClosePushL( list );
- //
- const TInt count = stream.ReadInt32L();
-
- //CArrayFixFlat<TUid>* list = new(ELeave)CArrayFixFlat<TUid>(count);
- //CleanupStack::PushL(list );
-
- for( TInt i=0; i<count; i++ )
- {
- TUid processUid;
- stream >> processUid;
- //
- User::LeaveIfError( list.Append( processUid ) );
- //list->AppendL( processUid );
- }
- //
- //CMemSpyEngineHelperProcess& processHelper = iEngine.HelperProcess();
- //processHelper.SetMemoryTrackingAutoStartProcessListL( list );
- //iMemSpySession.SetSwmtAutoStartProcessList( list );
- iUidList = list; //TODO: to get it into the engine
-
- CleanupStack::PopAndDestroy( &list );
- }
-
- // Restore memory tracking categories
- if ( version > 3 )
- {
- swmtConfig.iEnabledCategories = stream.ReadInt32L();
- }
-
- // Write heap tracking thread name filter
- if ( version > 4 )
- {
- TInt len = stream.ReadInt32L();
- if ( len > 0 )
- {
- stream.ReadL( swmtConfig.iThreadNameFilter, len );
- }
- }
-
- // Write mode
- if ( version > 5 )
- {
- swmtConfig.iMode = (TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode)stream.ReadInt32L();
- }
-
- //CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
- //swmt.SetConfigL( swmtConfig );
- //iMemSpySession.SetSwmtConfig( swmtConfig );
-
- iSwmtConfig = swmtConfig; //TODO: to get it into the engine
-
- CleanupStack::PopAndDestroy( &stream ); // Closes file
- }
-
-
--- a/memspyui/ui/avkon/src/MemSpyUiUtils.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,367 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyUiUtils.h"
-
-// System includes
-#include <coemain.h>
-#include <memspyui.rsg>
-
-
-
-
-void MemSpyUiUtils::Format( TDes& aBuf, TInt aResourceId, ...)
- {
- VA_LIST list;
- VA_START(list,aResourceId);
- TBuf<128> format;
- CCoeEnv::Static()->ReadResource( format, aResourceId );
- aBuf.FormatList( format, list );
- }
-
-
-void MemSpyUiUtils::GetErrorText( TDes& aBuf, TInt aError )
- {
- if ( aError == KErrNotSupported )
- {
- _LIT( KMemSpyErrorText, "Not Supported" );
- aBuf = KMemSpyErrorText;
- }
- else if ( aError == KErrNotReady )
- {
- _LIT( KMemSpyErrorText, "Not Ready" );
- aBuf = KMemSpyErrorText;
- }
- else if ( aError == KErrNotFound )
- {
- _LIT( KMemSpyErrorText, "Missing" );
- aBuf = KMemSpyErrorText;
- }
- else if ( aError == KErrGeneral )
- {
- _LIT( KMemSpyErrorText, "General Error" );
- aBuf = KMemSpyErrorText;
- }
- else
- {
- _LIT( KMemSpyItemValueError, "Error: %d" );
- aBuf.Format( KMemSpyItemValueError, aError );
- }
- }
-
-HBufC* MemSpyUiUtils::FormatItem( const TDesC& aCaption )
- {
- HBufC* retBuf = HBufC::NewL( 32 );
- TPtr pRetBuf( retBuf->Des() );
- pRetBuf.Zero();
- pRetBuf.Append( _L("\t") );
- pRetBuf.Append( aCaption );
- return retBuf;
- }
-
-TDesC& MemSpyUiUtils::ThreadInfoItemNameByType( TMemSpyThreadInfoItemType aType )
- {
- TPtrC pType( KTypeUnknown );
-
- switch( aType )
- {
- case EMemSpyThreadInfoItemTypeFirst:
- pType.Set(KGeneral);
- break;
- case EMemSpyThreadInfoItemTypeHeap:
- pType.Set(KHeap);
- break;
- case EMemSpyThreadInfoItemTypeStack:
- pType.Set(KStack);
- break;
- case EMemSpyThreadInfoItemTypeChunk:
- pType.Set(KChunks);
- break;
- case EMemSpyThreadInfoItemTypeCodeSeg:
- pType.Set(KCodeSegs);
- break;
- case EMemSpyThreadInfoItemTypeOpenFiles:
- pType.Set(KOpenFiles);
- break;
- case EMemSpyThreadInfoItemTypeActiveObject:
- pType.Set(KActiveObjects);
- break;
- case EMemSpyThreadInfoItemTypeOwnedThreadHandles:
- pType.Set(KThreadHandlers);
- break;
- case EMemSpyThreadInfoItemTypeOwnedProcessHandles:
- pType.Set(KProcessHandlers);
- break;
- case EMemSpyThreadInfoItemTypeServer:
- pType.Set(KServers);
- break;
- case EMemSpyThreadInfoItemTypeSession:
- pType.Set(KConnections);
- break;
- case EMemSpyThreadInfoItemTypeSemaphore:
- pType.Set(KSemaphores);
- break;
- case EMemSpyThreadInfoItemTypeOtherThreads:
- pType.Set(KThreadReferences);
- break;
- case EMemSpyThreadInfoItemTypeOtherProcesses:
- pType.Set(KProcessReferences);
- break;
- case EMemSpyThreadInfoItemTypeMutex:
- pType.Set(KMutexes);
- break;
- case EMemSpyThreadInfoItemTypeTimer:
- pType.Set(KTimers);
- break;
- case EMemSpyThreadInfoItemTypeLogicalChannel:
- pType.Set(KDD);
- break;
- case EMemSpyThreadInfoItemTypeChangeNotifier:
- pType.Set(KChangeNotif);
- break;
- case EMemSpyThreadInfoItemTypeUndertaker:
- pType.Set(KUndertakers);
- break;
- case EMemSpyThreadInfoItemTypeLDD:
- pType.Set(KLogicalDrivers);
- break;
- case EMemSpyThreadInfoItemTypePDD:
- pType.Set(KPhysicalDrivers);
- break;
-
- default:
- break;
- }
- return pType;
- }
-
-
-void MemSpyUiUtils::AppendPriority( TDes& aDes, TProcessPriority aPriority )
- {
- switch( aPriority )
- {
- case EPriorityLow:
- aDes += _L("[L]");
- break;
- case EPriorityBackground:
- aDes += _L("[B]");
- break;
- case EPriorityForeground:
- aDes += _L("[F]");
- break;
- case EPriorityHigh:
- aDes += _L("[H]");
- break;
- case EPriorityWindowServer:
- aDes += _L("[WS]");
- break;
- case EPriorityFileServer:
- aDes += _L("[FS]");
- break;
- case EPriorityRealTimeServer:
- aDes += _L("[RTS]");
- break;
- case EPrioritySupervisor:
- aDes += _L("[SUP]");
- break;
- default:
- aDes += _L("[?]");
- break;
- }
- }
-
-void MemSpyUiUtils::AppendExitInfo( TDes& aDes, TExitType aType, TInt aExitReason, const TDesC& aExitCategory )
- {
- aDes.Append( '[' );
- const TInt length = aDes.Length();
- AppendExitType( aDes, aType );
- aDes.SetLength( length + 1 ); // Remove all but the first letter
- aDes.Append( ']' );
-
- if ( aType == EExitKill || aType == EExitPending )
- {
- // Kill implies "clean" exit. Pending implies not yet dead.
- }
- else
- {
- TMemSpyTruncateOverflow overflow;
-
- // Terminate or Panic implies abnormal exit condition, so
- // show full exit info.
- _LIT( KAbnormalFormatSpec, " %S-%d" );
- aDes.AppendFormat( KAbnormalFormatSpec, &overflow, &aExitCategory, aExitReason );
- }
- }
-
-
-void MemSpyUiUtils::AppendExitType( TDes& aDes, TExitType aType )
- {
- _LIT( KExitTypeKilled, "Killed" );
- _LIT( KExitTypeTerminated, "Terminated" );
- _LIT( KExitTypePanicked, "Panicked" );
- _LIT( KExitTypePending, "Pending" );
-
- // Panic and Terminate are exceptional exit conditions.
- // Kill, is ironically, not an exceptional condition.
- switch( aType )
- {
- case EExitKill:
- aDes += KExitTypeKilled;
- break;
- case EExitTerminate:
- aDes += KExitTypeTerminated;
- break;
- case EExitPanic:
- aDes += KExitTypePanicked;
- break;
- default:
- case EExitPending:
- aDes += KExitTypePending;
- break;
- }
- }
-
-
-TPtrC MemSpyUiUtils::TypeAsString( TMemSpyDriverContainerType aType )
- {
- TPtrC pType( KTypeUnknown );
- //
- switch( aType )
- {
- case EMemSpyDriverContainerTypeThread:
- pType.Set( KTypeThread );
- break;
- case EMemSpyDriverContainerTypeProcess:
- pType.Set( KTypeProcess );
- break;
- case EMemSpyDriverContainerTypeChunk:
- pType.Set( KTypeChunk );
- break;
- case EMemSpyDriverContainerTypeLibrary:
- pType.Set( KTypeLibrary );
- break;
- case EMemSpyDriverContainerTypeSemaphore:
- pType.Set( KTypeSemaphore );
- break;
- case EMemSpyDriverContainerTypeMutex:
- pType.Set( KTypeMutex );
- break;
- case EMemSpyDriverContainerTypeTimer:
- pType.Set( KTypeTimer );
- break;
- case EMemSpyDriverContainerTypeServer:
- pType.Set( KTypeServer );
- break;
- case EMemSpyDriverContainerTypeSession:
- pType.Set( KTypeSession );
- break;
- case EMemSpyDriverContainerTypeLogicalDevice:
- pType.Set( KTypeLogicalDevice );
- break;
- case EMemSpyDriverContainerTypePhysicalDevice:
- pType.Set( KTypePhysicalDevice );
- break;
- case EMemSpyDriverContainerTypeLogicalChannel:
- pType.Set( KTypeLogicalChannel );
- break;
- case EMemSpyDriverContainerTypeChangeNotifier:
- pType.Set( KTypeChangeNotifier );
- break;
- case EMemSpyDriverContainerTypeUndertaker:
- pType.Set( KTypeUndertaker );
- break;
- case EMemSpyDriverContainerTypeMsgQueue:
- pType.Set( KTypeMsgQueue );
- break;
- case EMemSpyDriverContainerTypePropertyRef:
- pType.Set( KTypePropertyRef );
- break;
- case EMemSpyDriverContainerTypeCondVar:
- pType.Set( KTypeCondVar );
- break;
-
- default:
- break;
- }
- //
- return pType;
- }
-
-TMemSpySizeText MemSpyUiUtils::FormatSizeText( const TInt64& aValue, TInt aDecimalPlaces, TBool aExtraRounding )
- {
- _LIT(KFormatKilo, "%dK");
- _LIT(KFormatMega, "%SM");
- _LIT(KFormatGiga, "%SG");
-
- TMemSpySizeText buf;
- if ( aValue < 1024000 ) // If < 1000K
- {
- TInt sizeInK = 0;
-
- if ( aValue != 0 )
- {
- sizeInK = I64INT( (aValue + 512) >> 10 );
- if (sizeInK < 1)
- {
- sizeInK = 1;
- }
- if (sizeInK > 999)
- {
- sizeInK = 999;
- }
- }
-
- buf.Format( KFormatKilo, sizeInK );
- }
- else
- {
- TReal sizeInM = I64INT( aValue );
- sizeInM /= 1048576;
- if ( sizeInM < 1 )
- {
- sizeInM = 1;
- }
-
- TPtrC pFormat( KFormatMega );
- if ( sizeInM >= 1000 )
- {
- sizeInM /= 1024; // Size in G
- if (sizeInM < 1)
- {
- sizeInM = 1;
- }
-
- pFormat.Set( KFormatGiga );
- }
-
- if ( sizeInM > 999.9)
- {
- sizeInM = 999.9;
- }
-
- if ( aExtraRounding )
- {
- sizeInM += 0.499999;
- }
-
- TBuf<16> size;
- size.Num( sizeInM, TRealFormat( 14, aDecimalPlaces ) ); // Allow for "17179869184.0"G which is 2^64
- buf.Format( pFormat, &size );
- }
-
- return buf;
- }
--- a/memspyui/ui/avkon/src/MemSpyViewBase.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,422 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewBase.h"
-
-// System includes
-#include <eikrted.h> // for example label control
-#include <txtrich.h>
-#include <apgtask.h>
-#include <akntitle.h>
-#include <akncontext.h>
-#include <aknnavi.h>
-#include <eiklbx.h>
-#include <eiklbm.h>
-#include <avkon.hrh>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineutils.h>
-#include <memspy/engine/memspyengineoutputsink.h>
-
-// User includes
-#include "MemSpyAppUi.h"
-#include "MemSpyDocument.h"
-#include "MemSpyContainer.h"
-#include "MemSpyContainerObserver.h"
-
-
-
-/*
-CMemSpyViewBase::CMemSpyViewBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: iEngine( aEngine ), iObserver( aObserver )
- {
- }
-*/
-CMemSpyViewBase::CMemSpyViewBase( RMemSpySession& aSession, MMemSpyViewObserver& aObserver )
-: iMemSpySession( aSession ), iObserver( aObserver )
- {
- }
-
-
-CMemSpyViewBase::~CMemSpyViewBase()
- {
- delete iListBox;
- }
-
-
-void CMemSpyViewBase::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* /*aSelectionRune*/ )
- {
- iSettings = &static_cast< CMemSpyAppUi* >( iEikonEnv->EikAppUi() )->MemSpyDocument().Settings();
- //
- User::LeaveIfError( SetParent( &aContainer ) );
- SetContainerWindowL( aContainer );
-
- SetComponentsToInheritVisibility( ETrue );
-
- iListBox = ConstructListBoxL();
- if ( iListBox )
- {
- iListBox->SetFocus( ETrue );
- }
-
- SetRect( aRect );
- ActivateL();
- }
-
-
-void CMemSpyViewBase::SetTitleL( const TDesC& aText )
- {
- CEikStatusPane* statusPane = static_cast<CAknAppUi*> ( iEikonEnv->EikAppUi() )->StatusPane();
- CAknTitlePane* title = static_cast<CAknTitlePane*> ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
- title->SetTextL( aText );
- }
-
-
-TPtrC CMemSpyViewBase::TitleL() const
- {
- TPtrC ret( KNullDesC );
- //
- CEikStatusPane* statusPane = static_cast<CAknAppUi*> ( iEikonEnv->EikAppUi() )->StatusPane();
- CAknTitlePane* title = static_cast<CAknTitlePane*> ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
- if ( title->Text() )
- {
- ret.Set( *title->Text() );
- }
- //
- return ret;
- }
-
-
-CMemSpyViewBase* CMemSpyViewBase::PrepareParentViewL()
- {
- return NULL;
- }
-
-
-CMemSpyViewBase* CMemSpyViewBase::PrepareChildViewL()
- {
- return NULL;
- }
-
-
-void CMemSpyViewBase::RefreshL()
- {
- if ( iListBox )
- {
- iListBox->UpdateScrollBarsL();
- }
-
- DrawDeferred();
- }
-
-
-TBool CMemSpyViewBase::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch( aCommand )
- {
- case EMemSpyCmdViewOutputToSink:
- OnCmdViewOutputToSinkL();
- break;
- default:
- handled = EFalse;
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewBase::DynInitMenuPaneL( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ )
- {
- }
-
-
-TUint CMemSpyViewBase::MenuCascadeResourceId() const
- {
- return 0;
- }
-
-
-TInt CMemSpyViewBase::MenuCascadeCommandId() const
- {
- return 0;
- }
-
-
-void CMemSpyViewBase::OnCmdViewOutputToSinkL()
- {
- //cigasto so solve - outputs content of the listbox into the sink
- //to discuss format with Orbit
- /*
- if ( iListBox )
- {
- // Prepare sink
- CMemSpyEngineOutputSink& sink = iEngine.Sink();
- HBufC* name = MemSpyEngineUtils::CleanupTextLC( TitleL() );
- sink.OutputSectionHeadingL( *name, TChar('-') );
- CleanupStack::PopAndDestroy( name );
- sink.OutputPrefixSetLC( _L(" ") ); // Slight insertion
-
- // Get text from underlying listbox model...
- MTextListBoxModel* model = static_cast< MTextListBoxModel* >( iListBox->Model() );
- const TInt count = model->NumberOfItems();
-
- // First pass to get max lengths
- TInt maxLengthCaption = 0;
- TInt maxLengthValue = 0;
-
- for( TInt j=0; j<count; j++ )
- {
- const TPtrC pItem( model->ItemText( j ) );
- const TInt length = pItem.Length();
-
- // Check if its split or not?
- const TInt splitPos = pItem.FindF( _L("\t\t") );
- if ( splitPos > 0 )
- {
- maxLengthCaption = Max( maxLengthCaption, splitPos );
- maxLengthValue = Max( maxLengthValue, length - splitPos + 1 );
- }
- else
- {
- maxLengthCaption = Max( maxLengthCaption, length );
- }
- }
-
- // Second pass - real this time - to print the values
- HBufC* line = HBufC::NewLC( ( maxLengthCaption + maxLengthValue ) + 20 );
- TPtr pLine( line->Des() );
- //
- for( TInt i=0; i<count; i++ )
- {
- const TPtrC pItem( model->ItemText( i ) );
- const TInt length = pItem.Length();
- //
- TPtrC pCaption( KNullDesC );
- TPtrC pValue( KNullDesC );
- //
- const TInt splitPos = pItem.FindF( _L("\t\t") );
- if ( splitPos > 0 )
- {
- pCaption.Set( pItem.Left( splitPos ) );
- pValue.Set( pItem.Mid( splitPos + 1 ) );
- }
- else
- {
- pCaption.Set( pItem );
- }
-
- // Remove initial tabs in caption
- HBufC* caption = MemSpyEngineUtils::CleanupTextLC( pCaption );
-
- // Create value item & replace any further tabs
- HBufC* value = MemSpyEngineUtils::CleanupTextLC( pValue );
-
- // Now format the final line, with padding.
- pLine.Justify( *caption, maxLengthCaption + 3, ELeft, TChar(' ') );
- pLine.Append( *value );
- CleanupStack::PopAndDestroy( 2, caption );
-
- // Sink output
- sink.OutputLineL( pLine );
- }
-
- // Remove prefix & tidy up
- CleanupStack::PopAndDestroy( line );
- sink.OutputBlankLineL();
- CleanupStack::PopAndDestroy(); // clear prefix
- }
- */
- }
-
-
-CEikListBox* CMemSpyViewBase::ConstructListBoxL()
- {
- delete iListBox;
- iListBox = NULL;
- CAknSettingStyleListBox* listbox = new(ELeave) CAknSettingStyleListBox();
- iListBox = listbox;
- //
- listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling );
- listbox->SetContainerWindowL( *this );
- listbox->CreateScrollBarFrameL( ETrue );
- SetListBoxModelL();
- listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
- listbox->SetListBoxObserver( this );
- listbox->SetObserver( this );
- listbox->SetComponentsToInheritVisibility( ETrue );
- //
- return listbox;
- }
-
-
-void CMemSpyViewBase::HandleListBoxItemActionedL( TInt /*aIndex*/ )
- {
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewBase::HandleListBoxItemSelectedL( TInt /*aIndex*/ )
- {
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-
-
-void CMemSpyViewBase::ReportEventL( MMemSpyViewObserver::TViewEventType aEvent, TAny* aContext )
- {
- iObserver.HandleMemSpyViewEventL( aEvent, ViewType(), *this, aContext );
- }
-
-
-void CMemSpyViewBase::SetListBoxCurrentItemIndexL( TInt aIndex )
- {
- if ( iListBox )
- {
- iListBox->SetCurrentItemIndex( aIndex );
- HandleListBoxItemSelectedL( aIndex );
- }
- }
-
-
-CMemSpyContainer& CMemSpyViewBase::Container()
- {
- CMemSpyAppUi* appUi = static_cast< CMemSpyAppUi* >( iEikonEnv->EikAppUi() );
- return appUi->Container();
- }
-
-
-CMemSpySettings& CMemSpyViewBase::Settings()
- {
- return *iSettings;
- }
-
-
-const CMemSpySettings& CMemSpyViewBase::Settings() const
- {
- return *iSettings;
- }
-
-
-void CMemSpyViewBase::Draw( const TRect& aRect ) const
- {
- CWindowGc& gc = SystemGc();
- //
- gc.SetPenStyle( CGraphicsContext::ENullPen );
- gc.SetBrushColor( KRgbWhite );
- gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
- gc.DrawRect( aRect );
- }
-
-
-void CMemSpyViewBase::SizeChanged()
- {
- if ( iListBox )
- {
- iListBox->SetRect( Rect() );
- }
- }
-
-
-void CMemSpyViewBase::FocusChanged(TDrawNow /*aDrawNow*/)
- {
- if ( iListBox )
- {
- iListBox->SetFocus( IsFocused() );
- }
- }
-
-
-TInt CMemSpyViewBase::CountComponentControls() const
- {
- TInt count = 0;
- if ( iListBox )
- {
- ++count;
- }
- //
- return count;
- }
-
-
-CCoeControl* CMemSpyViewBase::ComponentControl(TInt aIndex) const
- {
- switch ( aIndex )
- {
- case 0:
- return iListBox;
- default:
- return NULL;
- }
- }
-
-
-TKeyResponse CMemSpyViewBase::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
- {
- TKeyResponse resp = EKeyWasNotConsumed;
- if ( iListBox )
- {
- resp = iListBox->OfferKeyEventL( aKeyEvent, aType );
- }
- //
- if ( resp == EKeyWasNotConsumed && aType == EEventKeyDown && aKeyEvent.iCode == EKeyBackspace )
- {
- // When backspace is pushed, go to the parent view
- CMemSpyAppUi* appUi = static_cast< CMemSpyAppUi* >( iEikonEnv->EikAppUi() );
- appUi->Container().NavigateToParentViewL();
- resp = EKeyWasConsumed;
- }
- //
- return resp;
- }
-
-
-void CMemSpyViewBase::HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType )
- {
- if ( aControl == iListBox )
- {
- if ( aEventType == MCoeControlObserver::EEventStateChanged )
- {
- const TInt index = iListBox->CurrentItemIndex();
- HandleListBoxItemSelectedL( index );
- }
- }
- }
-
-
-void CMemSpyViewBase::HandleListBoxEventL( CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
- {
- const TInt index = iListBox->CurrentItemIndex();
- //
- switch (aEventType)
- {
- case EEventItemActioned:
- case EEventEnterKeyPressed:
- case EEventItemDoubleClicked:
- HandleListBoxItemActionedL( index );
- break;
-
- default:
- break;
- }
- }
-
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewChunkList.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,346 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewChunkList.h"
-
-// System includes
-#include <memspyui.rsg>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewMainMenu.h"
-
-
-
-CMemSpyViewChunkBase::CMemSpyViewChunkBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList* aList )
-: CMemSpyViewBase( aEngine, aObserver ), iList( aList )
- {
- }
-
-
-CMemSpyViewChunkBase::~CMemSpyViewChunkBase()
- {
- delete iList;
- }
-
-
-TBool CMemSpyViewChunkBase::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdChunkSortByName:
- iList->SortByNameL();
- CMemSpyViewBase::RefreshL();
- break;
- case EMemSpyCmdChunkSortBySize:
- iList->SortBySizeL();
- CMemSpyViewBase::RefreshL();
- break;
- case EMemSpyCmdChunkListing:
- OnCmdListingL();
- break;
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewChunkBase::OnCmdListingL()
- {
- // Begin a new data stream
- _LIT( KMemSpyContext, "Chunk List" );
- _LIT( KMemSpyFolder, "Chunks" );
- iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
-
- // Set prefix for overall listing
- _LIT( KOverallPrefix, "Chunk List - " );
- iEngine.Sink().OutputPrefixSetLC( KOverallPrefix );
-
- // Create header
- CMemSpyEngineChunkList::OutputDataColumnsL( iEngine );
-
- // List items
- const TInt count = iList->Count();
- for(TInt i=0; i<count; i++)
- {
- const CMemSpyEngineChunkEntry& entry = iList->At( i );
- //
- entry.OutputDataL( iEngine.HelperChunk() );
- }
-
- // Tidy up
- CleanupStack::PopAndDestroy(); // prefix
-
- // End data stream
- iEngine.Sink().DataStreamEndL();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewChunkList::CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewChunkBase( aEngine, aObserver, NULL )
- {
- }
-
-
-CMemSpyViewChunkList::CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList )
-: CMemSpyViewChunkBase( aEngine, aObserver, &aList )
- {
- }
-
-
-void CMemSpyViewChunkList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Chunks" );
- SetTitleL( KTitle );
-
- if ( iList == NULL )
- {
- // Prepare code segment list
- iList = iEngine.HelperChunk().ListL();
- }
-
- // Finish construction
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- if ( aSelectionRune != NULL )
- {
- iCurrentChunk = reinterpret_cast< CMemSpyEngineChunkEntry* >( aSelectionRune );
- const TInt index = iList->ItemIndex( *iCurrentChunk );
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
-
- iListBox->DrawDeferred();
- }
-
-
-TMemSpyViewType CMemSpyViewChunkList::ViewType() const
- {
- return EMemSpyViewTypeChunkList;
- }
-
-
-CMemSpyViewBase* CMemSpyViewChunkList::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewChunkList::PrepareChildViewL()
- {
- CMemSpyViewBase* child = new(ELeave) CMemSpyViewChunkDetails( iEngine, iObserver, *iList, *iCurrentChunk );
-
- // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
- // This object is about to die in any case.
- iList = NULL;
-
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- return child;
- }
-
-
-void CMemSpyViewChunkList::SetListBoxModelL()
- {
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( iList );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewChunkList::HandleListBoxItemActionedL( TInt aIndex )
- {
- const TInt count = iList->Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineChunkEntry& chunk = iList->At( aIndex );
- iCurrentChunk = &chunk;
- }
- else
- {
- iCurrentChunk = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewChunkList::HandleListBoxItemSelectedL( TInt aIndex )
- {
- const TInt count = iList->Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineChunkEntry& chunk = iList->At( aIndex );
- iCurrentChunk = &chunk;
- }
- else
- {
- iCurrentChunk = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewChunkDetails::CMemSpyViewChunkDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList, CMemSpyEngineChunkEntry& aSelectedChunk )
-: CMemSpyViewChunkBase( aEngine, aObserver, &aList ), iChunk( aSelectedChunk )
- {
- }
-
-
-void CMemSpyViewChunkDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Chunk Details" );
- SetTitleL( KTitle );
-
- // Finish construction
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-void CMemSpyViewChunkDetails::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewChunkDetails::ViewType() const
- {
- return EMemSpyViewTypeChunkDetails;
- }
-
-
-CMemSpyViewBase* CMemSpyViewChunkDetails::PrepareParentViewL()
- {
- CMemSpyViewChunkList* parent = new(ELeave) CMemSpyViewChunkList( iEngine, iObserver, *iList );
-
- // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
- // This object is about to die in any case.
- iList = NULL;
-
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), &iChunk );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-void CMemSpyViewChunkDetails::SetListBoxModelL()
- {
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( &iChunk );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewCodeSegList.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,500 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewCodeSegList.h"
-
-// System includes
-#include <memspyui.rsg>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyViewThreads.h"
-#include "MemSpyContainerObserver.h"
-#include "MemSpyExportBitmapsToMemoryCardDialog.h"
-
-
-
-CMemSpyViewCodeSegBase::CMemSpyViewCodeSegBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList* aList )
-: CMemSpyViewBase( aEngine, aObserver ), iList( aList )
- {
- }
-
-
-CMemSpyViewCodeSegBase::~CMemSpyViewCodeSegBase()
- {
- delete iList;
- }
-
-
-TBool CMemSpyViewCodeSegBase::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdCodeSegSortByName:
- iList->SortByFileNameL();
- CMemSpyViewBase::RefreshL();
- break;
- case EMemSpyCmdCodeSegSortByCodeSize:
- iList->SortByCodeSizeL();
- CMemSpyViewBase::RefreshL();
- break;
- case EMemSpyCmdCodeSegSortByDataSize:
- iList->SortByDataSizeL();
- CMemSpyViewBase::RefreshL();
- break;
- case EMemSpyCmdCodeSegSortByUid:
- iList->SortByUidsL();
- CMemSpyViewBase::RefreshL();
- break;
- case EMemSpyCmdCodeSegListing:
- OnCmdCodeSegmentListingL();
- break;
- case EMemSpyCmdCodeSegShowItemsAll:
- OnCmdShowItemsAllL();
- break;
- case EMemSpyCmdCodeSegShowItemsGlobalData:
- OnCmdShowItemsGlobalDataL();
- break;
-
- case EMemSpyCmdCodeSegShowCapsWithTCBProcess:
- case EMemSpyCmdCodeSegShowCapsWithTCBAll:
- OnCmdFilterByCapabilityL( ECapabilityTCB, aCommand == EMemSpyCmdCodeSegShowCapsWithTCBAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithCommDDProcess:
- case EMemSpyCmdCodeSegShowCapsWithCommDDAll:
- OnCmdFilterByCapabilityL( ECapabilityCommDD, aCommand == EMemSpyCmdCodeSegShowCapsWithCommDDAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithPowerMgmtProcess:
- case EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll:
- OnCmdFilterByCapabilityL( ECapabilityPowerMgmt, aCommand == EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithMultimediaDDProcess:
- case EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll:
- OnCmdFilterByCapabilityL( ECapabilityMultimediaDD, aCommand == EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithReadDeviceDataProcess:
- case EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll:
- OnCmdFilterByCapabilityL( ECapabilityReadDeviceData, aCommand == EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataProcess:
- case EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll:
- OnCmdFilterByCapabilityL( ECapabilityWriteDeviceData, aCommand == EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithDRMProcess:
- case EMemSpyCmdCodeSegShowCapsWithDRMAll:
- OnCmdFilterByCapabilityL( ECapabilityDRM, aCommand == EMemSpyCmdCodeSegShowCapsWithDRMAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithTrustedUIProcess:
- case EMemSpyCmdCodeSegShowCapsWithTrustedUIAll:
- OnCmdFilterByCapabilityL( ECapabilityTrustedUI, aCommand == EMemSpyCmdCodeSegShowCapsWithTrustedUIAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithProtServProcess:
- case EMemSpyCmdCodeSegShowCapsWithProtServAll:
- OnCmdFilterByCapabilityL( ECapabilityProtServ, aCommand == EMemSpyCmdCodeSegShowCapsWithProtServAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithDiskAdminProcess:
- case EMemSpyCmdCodeSegShowCapsWithDiskAdminAll:
- OnCmdFilterByCapabilityL( ECapabilityDiskAdmin, aCommand == EMemSpyCmdCodeSegShowCapsWithDiskAdminAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithNetworkControlProcess:
- case EMemSpyCmdCodeSegShowCapsWithNetworkControlAll:
- OnCmdFilterByCapabilityL( ECapabilityNetworkControl, aCommand == EMemSpyCmdCodeSegShowCapsWithNetworkControlAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithAllFilesProcess:
- case EMemSpyCmdCodeSegShowCapsWithAllFilesAll:
- OnCmdFilterByCapabilityL( ECapabilityAllFiles, aCommand == EMemSpyCmdCodeSegShowCapsWithAllFilesAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithSwEventProcess:
- case EMemSpyCmdCodeSegShowCapsWithSwEventAll:
- OnCmdFilterByCapabilityL( ECapabilitySwEvent, aCommand == EMemSpyCmdCodeSegShowCapsWithSwEventAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithNetworkServicesProcess:
- case EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll:
- OnCmdFilterByCapabilityL( ECapabilityNetworkServices, aCommand == EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithLocalServicesProcess:
- case EMemSpyCmdCodeSegShowCapsWithLocalServicesAll:
- OnCmdFilterByCapabilityL( ECapabilityLocalServices, aCommand == EMemSpyCmdCodeSegShowCapsWithLocalServicesAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithReadUserDataProcess:
- case EMemSpyCmdCodeSegShowCapsWithReadUserDataAll:
- OnCmdFilterByCapabilityL( ECapabilityReadUserData, aCommand == EMemSpyCmdCodeSegShowCapsWithReadUserDataAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithWriteUserDataProcess:
- case EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll:
- OnCmdFilterByCapabilityL( ECapabilityWriteUserData, aCommand == EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithLocationProcess:
- case EMemSpyCmdCodeSegShowCapsWithLocationAll:
- OnCmdFilterByCapabilityL( ECapabilityLocation, aCommand == EMemSpyCmdCodeSegShowCapsWithLocationAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithSurroundingsDDProcess:
- case EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll:
- OnCmdFilterByCapabilityL( ECapabilitySurroundingsDD, aCommand == EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll );
- break;
- case EMemSpyCmdCodeSegShowCapsWithUserEnvProcess:
- case EMemSpyCmdCodeSegShowCapsWithUserEnvAll:
- OnCmdFilterByCapabilityL( ECapabilityUserEnvironment, aCommand == EMemSpyCmdCodeSegShowCapsWithUserEnvAll );
- break;
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewCodeSegBase::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-void CMemSpyViewCodeSegBase::OnCmdCodeSegmentListingL()
- {
- // Begin a new data stream
- _LIT( KMemSpyContext, "CodeSeg List - " );
- _LIT( KMemSpyFolder, "CodeSegs" );
- iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
-
- // Set prefix for overall listing
- _LIT(KOverallPrefix, "CodeSeg List - ");
- iEngine.Sink().OutputPrefixSetLC( KOverallPrefix );
-
- // Create header
- CMemSpyEngineCodeSegList::OutputDataColumnsL( iEngine );
-
- // List items
- const TInt count = iList->Count();
- for(TInt i=0; i<count; i++)
- {
- const CMemSpyEngineCodeSegEntry& entry = iList->At( i );
- //
- entry.OutputDataL( iEngine.HelperCodeSegment() );
- }
-
- // Tidy up
- CleanupStack::PopAndDestroy(); // prefix
-
- // End data stream
- iEngine.Sink().DataStreamEndL();
- }
-
-
-void CMemSpyViewCodeSegBase::OnCmdShowItemsAllL()
- {
- iList->ShowAllL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-void CMemSpyViewCodeSegBase::OnCmdShowItemsGlobalDataL()
- {
- iList->ShowOnlyEntriesWithGlobalDataL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-void CMemSpyViewCodeSegBase::OnCmdFilterByCapabilityL( TCapability aCapability, TBool aAllBinaries )
- {
- TMemSpyViewCodeSegFilter filterLogic( aCapability, aAllBinaries );
- TMemSpyEngineVisibiltyFunction<CMemSpyEngineCodeSegEntry> filterFunction( TMemSpyViewCodeSegFilter::FilterItem, &filterLogic );
- iList->ShowL( filterFunction );
- CMemSpyViewBase::RefreshL();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewCodeSegList::CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewCodeSegBase( aEngine, aObserver, NULL )
- {
- }
-
-
-CMemSpyViewCodeSegList::CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList )
-: CMemSpyViewCodeSegBase( aEngine, aObserver, &aList )
- {
- }
-
-
-void CMemSpyViewCodeSegList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Code Segments" );
- SetTitleL( KTitle );
-
- if ( iList == NULL )
- {
- // Prepare code segment list
- iList = iEngine.HelperCodeSegment().CodeSegmentListL();
- iList->SortByCodeSizeL();
- }
-
- // Finish construction
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- if ( aSelectionRune != NULL )
- {
- iCurrentCodeSegment = reinterpret_cast< CMemSpyEngineCodeSegEntry* >( aSelectionRune );
- const TInt index = iList->ItemIndex( *iCurrentCodeSegment );
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
-
- iListBox->DrawDeferred();
- }
-
-
-TMemSpyViewType CMemSpyViewCodeSegList::ViewType() const
- {
- return EMemSpyViewTypeCodeSegmentList;
- }
-
-
-CMemSpyViewBase* CMemSpyViewCodeSegList::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewCodeSegList::PrepareChildViewL()
- {
- CMemSpyViewBase* child = new(ELeave) CMemSpyViewCodeSegDetails( iEngine, iObserver, *iList, *iCurrentCodeSegment );
-
- // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
- // This object is about to die in any case.
- iList = NULL;
-
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- return child;
- }
-
-
-void CMemSpyViewCodeSegList::SetListBoxModelL()
- {
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( iList );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewCodeSegList::HandleListBoxItemActionedL( TInt aIndex )
- {
- const TInt count = iList->Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineCodeSegEntry& codeSeg = iList->At( aIndex );
- iCurrentCodeSegment = &codeSeg;
- }
- else
- {
- iCurrentCodeSegment = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewCodeSegList::HandleListBoxItemSelectedL( TInt aIndex )
- {
- const TInt count = iList->Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineCodeSegEntry& codeSeg = iList->At( aIndex );
- iCurrentCodeSegment = &codeSeg;
- }
- else
- {
- iCurrentCodeSegment = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewCodeSegDetails::CMemSpyViewCodeSegDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList, CMemSpyEngineCodeSegEntry& aSelectedCodeSegment )
-: CMemSpyViewCodeSegBase( aEngine, aObserver, &aList ), iCodeSegment( aSelectedCodeSegment )
- {
- }
-
-
-void CMemSpyViewCodeSegDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Code Segment Details" );
- SetTitleL( KTitle );
-
- // Finish construction
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-void CMemSpyViewCodeSegDetails::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewCodeSegDetails::ViewType() const
- {
- return EMemSpyViewTypeCodeSegmentDetails;
- }
-
-
-CMemSpyViewBase* CMemSpyViewCodeSegDetails::PrepareParentViewL()
- {
- CMemSpyViewCodeSegList* parent = new(ELeave) CMemSpyViewCodeSegList( iEngine, iObserver, *iList );
-
- // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
- // This object is about to die in any case.
- iList = NULL;
-
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), &iCodeSegment );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-void CMemSpyViewCodeSegDetails::SetListBoxModelL()
- {
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( &iCodeSegment );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TBool TMemSpyViewCodeSegFilter::FilterItem( const CMemSpyEngineCodeSegEntry*& aItem, TAny* aRune )
- {
- TMemSpyViewCodeSegFilter* self = reinterpret_cast< TMemSpyViewCodeSegFilter* >( aRune );
-
- TBool match = aItem->HasCapability( self->iCapability );
- if ( match && self->iAllBinaries == EFalse )
- {
- // We're only looking for EXE's...
- TParsePtrC parser( aItem->FileName() );
- const TPtrC pExtension( parser.Ext() );
- _LIT(KProcessExtension, ".exe");
- //
- match = ( pExtension.CompareF( KProcessExtension ) == 0 );
- }
- //
- return match;
- }
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewDriveInfo.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,381 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewDriveInfo.h"
-
-// System includes
-#include <memspyui.rsg>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperfilesystem.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewMainMenu.h"
-
-
-
-CMemSpyViewDriveInfoBase::CMemSpyViewDriveInfoBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aEngine, aObserver )
- {
- }
-
-
-CMemSpyViewDriveInfoBase::~CMemSpyViewDriveInfoBase()
- {
- if ( iList )
- {
- iList->SetObserver( NULL );
- }
- //
- delete iList;
- }
-
-
-void CMemSpyViewDriveInfoBase::BaseConstructL()
- {
- iList = iEngine.HelperFileSystem().DriveListL();
- }
-
-
-TBool CMemSpyViewDriveInfoBase::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewDriveList::CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewDriveInfoBase( aEngine, aObserver ), iUseDriveNumber( EFalse ), iDriveNumber( EDriveA )
- {
- }
-
-
-CMemSpyViewDriveList::CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber )
-: CMemSpyViewDriveInfoBase( aEngine, aObserver ), iUseDriveNumber( ETrue ), iDriveNumber( aDriveNumber )
- {
- }
-
-
-void CMemSpyViewDriveList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- BaseConstructL();
-
- _LIT( KTitle, "Drive Summary" );
- SetTitleL( KTitle );
-
- // Start watching list
- iList->SetObserver( this );
-
- // Finish construction
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- if ( iUseDriveNumber )
- {
-#ifdef _DEBUG
- RDebug::Printf( "CMemSpyViewDriveList::ConstructL() - iDriveNumber: %c:", iDriveNumber + 'A' );
-#endif
- iCurrentDrive = iList->EntryByDriveNumber( iDriveNumber );
-
-#ifdef _DEBUG
- RDebug::Printf( "CMemSpyViewDriveList::ConstructL() - iCurrentDrive: 0x%08x", iCurrentDrive );
-#endif
- if ( iCurrentDrive )
- {
- const TInt index = iList->ItemIndex( *iCurrentDrive );
-#ifdef _DEBUG
- RDebug::Printf( "CMemSpyViewDriveList::ConstructL() - index: %d", index );
-#endif
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
- }
-
- iListBox->DrawDeferred();
- }
-
-
-TMemSpyViewType CMemSpyViewDriveList::ViewType() const
- {
- return EMemSpyViewTypeDriveSummary;
- }
-
-
-CMemSpyViewBase* CMemSpyViewDriveList::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- //
- if ( parent )
- {
- iList->SetObserver( NULL );
- }
- //
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewDriveList::PrepareChildViewL()
- {
- ASSERT( iCurrentDrive );
- CMemSpyViewBase* child = new(ELeave) CMemSpyViewDriveInfo( iEngine, iObserver, iCurrentDrive->DriveNumber() );
-
- // Stop watching list
- if ( child )
- {
- iList->SetObserver( NULL );
- }
-
- // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
- // This object is about to die in any case.
- iList = NULL;
-
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- return child;
- }
-
-
-void CMemSpyViewDriveList::RefreshL()
- {
- if ( iList )
- {
- iList->SetObserver( NULL );
- }
- //
- CMemSpyEngineDriveList* list = iEngine.HelperFileSystem().DriveListL();
- delete iList;
- iList = list;
- iList->SetObserver( this );
- //
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-void CMemSpyViewDriveList::SetListBoxModelL()
- {
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( iList );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewDriveList::HandleListBoxItemActionedL( TInt aIndex )
- {
- const TInt count = iList->Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineDriveEntry& entry = iList->At( aIndex );
- iCurrentDrive = &entry;
- }
- else
- {
- iCurrentDrive = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewDriveList::HandleListBoxItemSelectedL( TInt aIndex )
- {
- const TInt count = iList->Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineDriveEntry& entry = iList->At( aIndex );
- iCurrentDrive = &entry;
- }
- else
- {
- iCurrentDrive = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-
-
-void CMemSpyViewDriveList::HandleDriveListChangedL( const CMemSpyEngineDriveList& /*aList*/ )
- {
- RefreshL();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewDriveInfo::CMemSpyViewDriveInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber )
-: CMemSpyViewDriveInfoBase( aEngine, aObserver ), iDriveNumber( aDriveNumber )
- {
- }
-
-
-void CMemSpyViewDriveInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- BaseConstructL();
- //
- iDriveInfo = iList->EntryByDriveNumber( iDriveNumber );
- if ( !iDriveInfo )
- {
- User::Leave( KErrNotFound );
- }
- iDriveInfo->SetObserver( this );
-
- _LIT( KTitleFormat, "Drive %S Info" );
- const TDriveName name( iDriveInfo->DriveUnit().Name() );
- TName title;
- title.Format( KTitleFormat, &name );
- SetTitleL( title );
-
- // Finish construction
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-void CMemSpyViewDriveInfo::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewDriveInfo::ViewType() const
- {
- return EMemSpyViewTypeDriveInfo;
- }
-
-
-CMemSpyViewBase* CMemSpyViewDriveInfo::PrepareParentViewL()
- {
- ASSERT( iDriveInfo );
- CMemSpyViewDriveList* parent = new(ELeave) CMemSpyViewDriveList( iEngine, iObserver, iDriveInfo->DriveNumber() );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( parent );
- //
- if ( parent )
- {
- iDriveInfo->SetObserver( NULL );
- }
- //
- return parent;
- }
-
-
-void CMemSpyViewDriveInfo::SetListBoxModelL()
- {
- if ( iDriveInfo )
- {
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( iDriveInfo );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
- }
-
-
-void CMemSpyViewDriveInfo::HandleDriveEntryChangedL( const CMemSpyEngineDriveEntry& /*aEntry*/ )
- {
- RefreshL();
- }
-
-
-
-
-
-
-
-
-
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewECom.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,475 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewECom.h"
-
-// System includes
-#include <memspyui.rsg>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyenginehelperecom.h>
-
-// User includes
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyContainerObserver.h"
-
-
-
-CMemSpyViewECom::CMemSpyViewECom( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aEngine, aObserver )
- {
- }
-
-
-void CMemSpyViewECom::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "ECom" );
- SetTitleL( KTitle );
-
- // Finish construction
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- // Select first item
- TInt index = KErrNotFound;
- if ( aSelectionRune != NULL )
- {
- iCurrent = reinterpret_cast< CMemSpyEngineEComCategory* >( aSelectionRune );
- index = iEngine.HelperECom().IndexOf( *iCurrent );
- }
-
- if ( index >= 0 && index < iEngine.HelperECom().Count() )
- {
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- iListBox->DrawDeferred();
- }
- }
-
-
-void CMemSpyViewECom::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewECom::ViewType() const
- {
- return EMemSpyViewTypeECom;
- }
-
-
-CMemSpyViewBase* CMemSpyViewECom::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewECom::PrepareChildViewL()
- {
- CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComCategory( iEngine, iObserver, *iCurrent );
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- return child;
- }
-
-
-void CMemSpyViewECom::SetListBoxModelL()
- {
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( &iEngine.HelperECom() );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewECom::HandleListBoxItemActionedL( TInt aIndex )
- {
- const TInt count = iEngine.HelperECom().Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineEComCategory& category = iEngine.HelperECom().At( aIndex );
- iCurrent = &category;
- }
- else
- {
- iCurrent = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewECom::HandleListBoxItemSelectedL( TInt aIndex )
- {
- const TInt count = iEngine.HelperECom().Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineEComCategory& category = iEngine.HelperECom().At( aIndex );
- iCurrent = &category;
- }
- else
- {
- iCurrent = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewEComCategory::CMemSpyViewEComCategory( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComCategory& aCategory )
-: CMemSpyViewBase( aEngine, aObserver ), iCategory( aCategory )
- {
- }
-
-
-void CMemSpyViewEComCategory::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- SetTitleL( iCategory.Name() );
-
- // Finish construction
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- // Select first item
- TInt index = KErrNotFound;
- if ( aSelectionRune != NULL )
- {
- iCurrent = reinterpret_cast< CMemSpyEngineEComInterface* >( aSelectionRune );
- index = iCategory.IndexOf( *iCurrent );
- }
-
- if ( index >= 0 && index < iCategory.Count() )
- {
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- iListBox->DrawDeferred();
- }
- }
-
-
-void CMemSpyViewEComCategory::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewEComCategory::ViewType() const
- {
- return EMemSpyViewTypeEComCategory;
- }
-
-
-CMemSpyViewBase* CMemSpyViewEComCategory::PrepareParentViewL()
- {
- CMemSpyViewECom* parent = new(ELeave) CMemSpyViewECom( iEngine, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), &iCategory );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewEComCategory::PrepareChildViewL()
- {
- CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComInterface( iEngine, iObserver, *iCurrent );
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- return child;
- }
-
-
-void CMemSpyViewEComCategory::SetListBoxModelL()
- {
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( &iCategory );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewEComCategory::HandleListBoxItemActionedL( TInt aIndex )
- {
- const TInt count = iCategory.Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineEComInterface& entry = iCategory.At( aIndex );
- iCurrent = &entry;
- }
- else
- {
- iCurrent = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewEComCategory::HandleListBoxItemSelectedL( TInt aIndex )
- {
- const TInt count = iCategory.Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineEComInterface& entry = iCategory.At( aIndex );
- iCurrent = &entry;
- }
- else
- {
- iCurrent = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewEComInterface::CMemSpyViewEComInterface( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComInterface& aInterface )
-: CMemSpyViewBase( aEngine, aObserver ), iInterface( aInterface )
- {
- }
-
-
-void CMemSpyViewEComInterface::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- SetTitleL( iInterface.Name() );
-
- // Finish construction
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- // Select first item
- TInt index = KErrNotFound;
- if ( aSelectionRune != NULL )
- {
- iCurrent = reinterpret_cast< CMemSpyEngineEComImplementation* >( aSelectionRune );
- index = iInterface.IndexOf( *iCurrent );
- }
-
- if ( index >= 0 && index < iInterface.Count() )
- {
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- iListBox->DrawDeferred();
- }
- }
-
-
-void CMemSpyViewEComInterface::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewEComInterface::ViewType() const
- {
- return EMemSpyViewTypeEComInterface;
- }
-
-
-CMemSpyViewBase* CMemSpyViewEComInterface::PrepareParentViewL()
- {
- CMemSpyViewEComCategory* parent = new(ELeave) CMemSpyViewEComCategory( iEngine, iObserver, iInterface.Category() );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), &iInterface );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewEComInterface::PrepareChildViewL()
- {
- CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComImplementation( iEngine, iObserver, *iCurrent );
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- return child;
- }
-
-
-void CMemSpyViewEComInterface::SetListBoxModelL()
- {
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( &iInterface );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewEComInterface::HandleListBoxItemActionedL( TInt aIndex )
- {
- const TInt count = iInterface.Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineEComImplementation& entry = iInterface.At( aIndex );
- iCurrent = &entry;
- }
- else
- {
- iCurrent = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewEComInterface::HandleListBoxItemSelectedL( TInt aIndex )
- {
- const TInt count = iInterface.Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineEComImplementation& entry = iInterface.At( aIndex );
- iCurrent = &entry;
- }
- else
- {
- iCurrent = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewEComImplementation::CMemSpyViewEComImplementation( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComImplementation& aImplementation )
-: CMemSpyViewBase( aEngine, aObserver ), iImplementation( aImplementation )
- {
- }
-
-
-void CMemSpyViewEComImplementation::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- SetTitleL( iImplementation.Name() );
-
- // Finish construction
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- // Select first item
- if ( iImplementation.MdcaCount() )
- {
- iListBox->SetCurrentItemIndex( 0 );
- HandleListBoxItemSelectedL( 0 );
- iListBox->DrawDeferred();
- }
- }
-
-
-void CMemSpyViewEComImplementation::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewEComImplementation::ViewType() const
- {
- return EMemSpyViewTypeEComImplementation;
- }
-
-
-CMemSpyViewBase* CMemSpyViewEComImplementation::PrepareParentViewL()
- {
- CMemSpyViewEComInterface* parent = new(ELeave) CMemSpyViewEComInterface( iEngine, iObserver, iImplementation.Interface() );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), &iImplementation );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-void CMemSpyViewEComImplementation::SetListBoxModelL()
- {
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( &iImplementation );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
--- a/memspyui/ui/avkon/src/MemSpyViewFBServBitmaps.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,746 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewFBServBitmaps.h"
-
-// System includes
-#include <memspyui.rsg>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyViewThreads.h"
-#include "MemSpyContainerObserver.h"
-#include "MemSpyExportBitmapsToMemoryCardDialog.h"
-
-// Constants
-const TInt KMemSpyIdleResetListboxTimerPeriod = 500000;
-const TInt KMemSpyImageSlideshowPeriod = 1000000;
-
-
-
-CMemSpyViewFBServBase::CMemSpyViewFBServBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps )
-: CMemSpyViewBase( aEngine, aObserver ), iBitmaps( aBitmaps )
- {
- }
-
-
-CMemSpyViewFBServBase::~CMemSpyViewFBServBase()
- {
-#ifdef _DEBUG
- RDebug::Printf("CMemSpyViewFBServBase::~CMemSpyViewFBServBase() - deleting bitmaps: 0x%08x", iBitmaps );
-#endif
- delete iBitmaps;
- }
-
-
-TBool CMemSpyViewFBServBase::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdImagesSlideshow:
- OnCmdSlideShowL();
- break;
-#ifndef __WINS__
- case EMemSpyCmdImagesSaveAllToMemoryCard:
- OnCmdExportToMemoryCardL();
- break;
-#endif
- case EMemSpyCmdImagesListing:
- OnCmdImageListingL();
- break;
-
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewFBServBase::OnCmdSlideShowL()
- {
- TInt index = 0;
- CMemSpyViewFBServSlideshow::NewLD( *iBitmaps, index );
-
- // Select the item that was last displayed
- const TInt count = iBitmaps->Count();
- if ( iListBox && index >= 0 && index < count )
- {
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- DrawDeferred();
- }
- }
-
-
-void CMemSpyViewFBServBase::OnCmdExportToMemoryCardL()
- {
- // Deletes itself
- CMemSpyExportBitmapsToMemoryCardDialog::NewL( iCoeEnv->FsSession(), *iBitmaps );
- }
-
-
-void CMemSpyViewFBServBase::OnCmdImageListingL()
- {
- // Begin a new data stream
- _LIT( KMemSpyContext, "Bitmap List - " );
- _LIT( KMemSpyFolder, "Bitmaps" );
- iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
-
- // Set prefix for overall listing
- _LIT(KOverallPrefix, "Bitmap List - ");
- iEngine.Sink().OutputPrefixSetLC( KOverallPrefix );
-
- // Create header
- CMemSpyEngineFbServBitmap::OutputDataColumnsL( iEngine );
-
- // List items
- const TInt count = iBitmaps->Count();
- for(TInt i=0; i<count; i++)
- {
- const CMemSpyEngineFbServBitmap& bitmap = iBitmaps->At( i );
- //
- bitmap.OutputDataL( iEngine );
- }
-
- // Tidy up
- CleanupStack::PopAndDestroy(); // prefix
-
- // End data stream
- iEngine.Sink().DataStreamEndL();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewFBServBase( aEngine, aObserver, NULL )
- {
-#ifdef _DEBUG
- RDebug::Printf("CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps(1) - iBitmaps is: 0x%08x", iBitmaps );
-#endif
- }
-
-
-CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps )
-: CMemSpyViewFBServBase( aEngine, aObserver, aBitmaps )
- {
-#ifdef _DEBUG
- RDebug::Printf("CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps(2) - iBitmaps is: 0x%08x", iBitmaps );
-#endif
- }
-
-
-CMemSpyViewFBServBitmaps::~CMemSpyViewFBServBitmaps()
- {
- delete iIdleResetListboxTimer;
- iBitmapHandles.Close();
- }
-
-
-void CMemSpyViewFBServBitmaps::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Font & Bitmap Server" );
- SetTitleL( KTitle );
-
- if ( iBitmaps == NULL )
- {
- // Prepare bitmap handles
- iEngine.HelperFbServ().GetArrayOfBitmapHandlesL( iBitmapHandles );
-
- // Create bitmap array - construction occurs asynchronously
- iBitmaps = CMemSpyEngineFbServBitmapArray::NewL( CActive::EPriorityIdle, iBitmapHandles, *this );
- }
-
- // Finish construction
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- // Create idle listbox refresh timer
- if ( iBitmaps->Count() == 0 )
- {
- iIdleResetListboxTimer = CPeriodic::NewL( CActive::EPriorityLow );
- }
- else
- {
- if ( aSelectionRune != NULL )
- {
- iCurrentBitmap = reinterpret_cast< CMemSpyEngineFbServBitmap* >( aSelectionRune );
- const TInt index = iBitmaps->BitmapIndexByHandle( iCurrentBitmap->Handle() );
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
-
- iListBox->DrawDeferred();
- }
- }
-
-
-void CMemSpyViewFBServBitmaps::RefreshL()
- {
-#ifdef _DEBUG
- RDebug::Printf("CMemSpyViewFBServBitmaps::RefreshL() - iBitmaps->Count(): %d", iBitmaps->Count());
-#endif
-
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewFBServBitmaps::ViewType() const
- {
- return EMemSpyViewTypeFBServBitmaps;
- }
-
-
-CMemSpyViewBase* CMemSpyViewFBServBitmaps::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewFBServBitmaps::PrepareChildViewL()
- {
- CMemSpyViewBase* child = new(ELeave) CMemSpyViewFBServBitmapInfo( iEngine, iObserver, iBitmaps, *iCurrentBitmap );
-
- // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
- // This object is about to die in any case.
- iBitmaps = NULL;
-
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- return child;
- }
-
-
-void CMemSpyViewFBServBitmaps::HandleFbServBitmapArrayEventL( TEvent aEvent )
- {
- if ( aEvent == EBitmapItemsCreated )
- {
- }
- else if ( aEvent == EBitmapArrayConstructionComplete )
- {
- }
- //
- iIdleResetListboxTimer->Cancel();
- iIdleResetListboxTimer->Start( KMemSpyIdleResetListboxTimerPeriod/2, KMemSpyIdleResetListboxTimerPeriod, TCallBack( IdleUpdateListBoxModel, this ) );
- }
-
-
-void CMemSpyViewFBServBitmaps::SetListBoxModelL()
- {
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( iBitmaps );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewFBServBitmaps::HandleListBoxItemActionedL( TInt aIndex )
- {
- const TInt count = iBitmaps->Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineFbServBitmap& bitmap = iBitmaps->At( aIndex );
- iCurrentBitmap = &bitmap;
- }
- else
- {
- iCurrentBitmap = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewFBServBitmaps::HandleListBoxItemSelectedL( TInt aIndex )
- {
- const TInt count = iBitmaps->Count();
- if ( aIndex >= 0 && aIndex < count )
- {
- CMemSpyEngineFbServBitmap& bitmap = iBitmaps->At( aIndex );
- iCurrentBitmap = &bitmap;
- }
- else
- {
- iCurrentBitmap = NULL;
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-
-
-TInt CMemSpyViewFBServBitmaps::IdleUpdateListBoxModel( TAny* aSelf )
- {
- CMemSpyViewFBServBitmaps* self = reinterpret_cast< CMemSpyViewFBServBitmaps* >( aSelf );
- TRAP_IGNORE( self->DoIdleUpdateListBoxModelL() );
- return EFalse;
- }
-
-
-void CMemSpyViewFBServBitmaps::DoIdleUpdateListBoxModelL()
- {
- // Try to maintain current item selection if at all possible.
- TInt handle = 0;
- if ( iCurrentBitmap )
- {
- handle = iCurrentBitmap->Handle();
- iCurrentBitmap = NULL;
- }
-
- // Update list box & model
- iListBox->HandleItemAdditionL();
- iListBox->DrawDeferred();
-
- // Try to select previous item if it is still available
- const TInt index = iBitmaps->BitmapIndexByHandle( handle );
- if ( index >= 0 && index < iBitmaps->Count() )
- {
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
-
- iIdleResetListboxTimer->Cancel();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewFBServBitmapInfo::CMemSpyViewFBServBitmapInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap )
-: CMemSpyViewFBServBase( aEngine, aObserver, aBitmaps ), iBitmapObject( aSelectedBitmap )
- {
-#ifdef _DEBUG
- RDebug::Printf("CMemSpyViewFBServBitmapInfo::CMemSpyViewFBServBitmapInfo() - iBitmaps is: 0x%08x", iBitmaps );
-#endif
- }
-
-
-void CMemSpyViewFBServBitmapInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Bitmap Details" );
- SetTitleL( KTitle );
-
- // Finish construction
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- if ( iBitmaps->Count() )
- {
- iListBox->SetCurrentItemIndex( 0 );
- HandleListBoxItemSelectedL( 0 );
- }
- }
-
-
-void CMemSpyViewFBServBitmapInfo::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewFBServBitmapInfo::ViewType() const
- {
- return EMemSpyViewTypeFBServBitmapInfo;
- }
-
-
-CMemSpyViewBase* CMemSpyViewFBServBitmapInfo::PrepareParentViewL()
- {
- CMemSpyViewFBServBitmaps* parent = new(ELeave) CMemSpyViewFBServBitmaps( iEngine, iObserver, iBitmaps );
-
- // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
- // This object is about to die in any case.
- iBitmaps = NULL;
-
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), &iBitmapObject );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewFBServBitmapInfo::PrepareChildViewL()
- {
- CMemSpyViewFBServBitmapViewer* child = new(ELeave) CMemSpyViewFBServBitmapViewer( iEngine, iObserver, iBitmaps, iBitmapObject );
-
- // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
- // This object is about to die in any case.
- iBitmaps = NULL;
-
- CleanupStack::PushL( child );
- CEikAppUi* appUi = static_cast< CEikAppUi* >( iEikonEnv->AppUi() );
- const TRect rect( TPoint( 0, 0 ), appUi->ClientRect().Size() );
- child->ConstructL( rect, *Parent() );
- CleanupStack::Pop( child );
- return child;
- }
-
-
-void CMemSpyViewFBServBitmapInfo::SetListBoxModelL()
- {
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( &iBitmapObject );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewFBServBitmapInfo::HandleListBoxItemActionedL( TInt aIndex )
- {
- // Only report the event if its the first item that was actioned
- if ( aIndex == 0 )
- {
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewFBServBitmapViewer::CMemSpyViewFBServBitmapViewer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap )
-: CMemSpyViewFBServBase( aEngine, aObserver, aBitmaps ), iBitmapObject( aSelectedBitmap )
- {
-#ifdef _DEBUG
- RDebug::Printf("CMemSpyViewFBServBitmapViewer::CMemSpyViewFBServBitmapViewer() - iBitmaps is: 0x%08x", iBitmaps );
-#endif
- }
-
-
-CMemSpyViewFBServBitmapViewer::~CMemSpyViewFBServBitmapViewer()
- {
- delete iImage;
- }
-
-
-void CMemSpyViewFBServBitmapViewer::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Bitmap Preview" );
- SetTitleL( KTitle );
-
- // Finish construction
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- // Prepare image
- iImage = new(ELeave) CEikImage();
- iImage->SetContainerWindowL( *this );
- iImage->SetPicture( &iBitmapObject.Bitmap(), NULL );
- iImage->SetPictureOwnedExternally( ETrue );
- SizeChanged();
- }
-
-
-void CMemSpyViewFBServBitmapViewer::RefreshL()
- {
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewFBServBitmapViewer::ViewType() const
- {
- return EMemSpyViewTypeFBServBitmapViewer;
- }
-
-
-CMemSpyViewBase* CMemSpyViewFBServBitmapViewer::PrepareParentViewL()
- {
- CMemSpyViewFBServBitmapInfo* parent = new(ELeave) CMemSpyViewFBServBitmapInfo( iEngine, iObserver, iBitmaps, iBitmapObject );
-
- // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
- // This object is about to die in any case.
- iBitmaps = NULL;
-
- CleanupStack::PushL( parent );
- CEikAppUi* appUi = static_cast< CEikAppUi* >( iEikonEnv->AppUi() );
- const TRect rect( TPoint( 0, 0 ), appUi->ClientRect().Size() );
- parent->ConstructL( rect, *Parent() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-void CMemSpyViewFBServBitmapViewer::SetListBoxModelL()
- {
- }
-
-
-CEikListBox* CMemSpyViewFBServBitmapViewer::ConstructListBoxL()
- {
- return NULL;
- }
-
-
-void CMemSpyViewFBServBitmapViewer::Draw( const TRect& /*aRect*/ ) const
- {
- CWindowGc& gc = SystemGc();
- //
- gc.SetPenStyle( CGraphicsContext::ENullPen );
- gc.SetBrushColor( KRgbWhite );
- gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
- gc.DrawRect( Rect() );
- //
- gc.SetBrushColor( KRgbBlack );
- gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
- gc.DrawRect( iBorderRect );
- }
-
-
-void CMemSpyViewFBServBitmapViewer::SizeChanged()
- {
- TRect rect( Rect() );
- TSize size( rect.Size() );
- //
- TSize bitmapSize( iBitmapObject.Bitmap().SizeInPixels() );
-
- // Try to center image, if possible.
- if ( bitmapSize.iWidth < size.iWidth )
- {
- const TInt offset = ( size.iWidth - bitmapSize.iWidth) / 2;
- rect.Move( offset, 0 );
- size.iWidth = bitmapSize.iWidth;
- }
- if ( bitmapSize.iHeight < size.iHeight )
- {
- const TInt offset = ( size.iHeight - bitmapSize.iHeight) / 2;
- rect.Move( 0, offset );
- size.iHeight = bitmapSize.iHeight;
- }
- //
- rect.SetSize( size );
- if ( iImage )
- {
- iImage->SetRect( rect );
- }
- iBorderRect = rect;
- iBorderRect.Grow( 2, 2 );
- }
-
-
-TInt CMemSpyViewFBServBitmapViewer::CountComponentControls() const
- {
- TInt count = 0;
- //
- if ( iImage )
- {
- ++count;
- }
- //
- return count;
- }
-
-
-CCoeControl* CMemSpyViewFBServBitmapViewer::ComponentControl( TInt /*aIndex*/ ) const
- {
- return iImage;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewFBServSlideshow::CMemSpyViewFBServSlideshow( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex )
-: iBitmaps( aBitmaps ), iIndex( aIndex )
- {
- }
-
-
-CMemSpyViewFBServSlideshow::~CMemSpyViewFBServSlideshow()
- {
- delete iTimer;
- }
-
-
-void CMemSpyViewFBServSlideshow::ConstructL()
- {
- iTimer = CPeriodic::NewL( CActive::EPriorityLow );
- iTimer->Start( KMemSpyImageSlideshowPeriod, KMemSpyImageSlideshowPeriod, TCallBack( IdleUpdate, this ) );
- }
-
-
-void CMemSpyViewFBServSlideshow::NewLD( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex )
- {
- CMemSpyViewFBServSlideshow* self = new(ELeave) CMemSpyViewFBServSlideshow( aBitmaps, aIndex );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- //
- self->ExecuteLD( R_MEMSPY_IMAGE_SLIDESHOW );
- }
-
-
-void CMemSpyViewFBServSlideshow::PreLayoutDynInitL()
- {
- ShowNextImageL();
- }
-
-
-TBool CMemSpyViewFBServSlideshow::OkToExitL( TInt /*aButtonId*/ )
- {
- return ETrue;
- }
-
-
-TInt CMemSpyViewFBServSlideshow::IdleUpdate( TAny* aSelf )
- {
- CMemSpyViewFBServSlideshow* self = reinterpret_cast< CMemSpyViewFBServSlideshow* >( aSelf );
- TRAP_IGNORE( self->ShowNextImageL() );
- return EFalse;
- }
-
-
-void CMemSpyViewFBServSlideshow::ShowNextImageL()
- {
- CEikImage* imageControl = static_cast< CEikImage* >( Control(EMemSpyCtrlIdSlideShowImage) );
-
- // Get the right image
- const TInt imageCount = iBitmaps.Count();
- if ( iIndex < imageCount )
- {
- CMemSpyEngineFbServBitmap& bitmap = iBitmaps.At( iIndex );
- imageControl->SetPicture( &bitmap.Bitmap(), NULL );
- imageControl->SetPictureOwnedExternally( ETrue );
-
- // Prepare title
- const TSize size( bitmap.Bitmap().SizeInPixels() );
- _LIT(KTitleFormat, "%3d x %3d");
- TBuf<128> title;
- title.Format( KTitleFormat, size.iWidth, size.iHeight );
- SetTitleL( title );
- //
- User::ResetInactivityTime();
- //
- Layout();
- //
- ++iIndex;
- }
- else
- {
- // Dismiss myself.
- delete this;
- }
- }
-
--- a/memspyui/ui/avkon/src/MemSpyViewHeapTracking.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,488 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewHeapTracking.h"
-
-// System includes
-#include <hal.h>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelpersysmemtracker.h>
-#include <memspysession.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyContainerObserver.h"
-#include "MemSpyViewHeapTrackingSettings.h"
-#include "MemSpyViewHeapTrackingResults.h"
-
-
-
-CMemSpyViewHeapTracking::CMemSpyViewHeapTracking( RMemSpySession& aSession, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aSession, aObserver ),
- iState( EMemSpyViewHeapTrackingStateIdle )
- {
- /*
- if ( iEngine.HelperSysMemTracker().IsActive() )
- {
- iState = EMemSpyViewHeapTrackingStateTimerOn;
- }
- */
- }
-
-
-CMemSpyViewHeapTracking::~CMemSpyViewHeapTracking()
- {
- delete iStopTimerCallBack;
- //iEngine.HelperSysMemTracker().RemoveObserver( this );
- }
-
-
-void CMemSpyViewHeapTracking::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "System-Wide Memory Tracking" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- // Backup current config because it may be overwritten with Basic/Full mode settings.
- TMemSpyEngineHelperSysMemTrackerConfig config;
-
- GetSwmtConfig( config );
-
- iOriginalConfig = config;
-
- if ( config.iMode != TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom )
- {
- // Set config. Needed for updating config for Basic or Full mode.
- SetConfigByModeL( config.iMode, config );
- }
-
- // Make sure the correct item is selected
- TInt index = 0;
- if ( aSelectionRune != NULL )
- {
- const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune);
- index = IndexByViewType( viewType );
- }
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
-
-
-void CMemSpyViewHeapTracking::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::SizeChanged();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewHeapTracking::ViewType() const
- {
- return EMemSpyViewTypeHeapTracking;
- }
-
-
-CMemSpyViewBase* CMemSpyViewHeapTracking::PrepareParentViewL()
- {
-
- // Save custom settings even if mode is Basic or Full
- TRAP_IGNORE(
- iMemSpySession.SetSwmtCategoriesL( iOriginalConfig.iEnabledCategories );
- iMemSpySession.SetSwmtFilter( iOriginalConfig.iThreadNameFilter );
- iMemSpySession.SetSwmtHeapDumpsEnabledL( iOriginalConfig.iDumpData );
- Settings().StoreSettingsL();
- );
-
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iMemSpySession, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewHeapTracking::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
- const TInt index = iListBox->CurrentItemIndex();
-
- // Get current config
- TMemSpyEngineHelperSysMemTrackerConfig config;
-
- GetSwmtConfig( config );
-
- //
- if ( index == 0 )
- {
- // This is the start/stop toggle so we don't make a child view
- child = NULL;
-
- // ... instead we either start or stop the tracker
- // if ( !iEngine.HelperSysMemTracker().IsActive() )
- if ( !iMemSpySession.IsSwmtRunningL() )
- {
- iState = EMemSpyViewHeapTrackingStateSingleOn;
- // Setting observer to be able to stop SWMT after first cycle is completed
- //iEngine.HelperSysMemTracker().SetObserver( this );
- iMemSpySession.ForceSwmtUpdateL();
- }
-
- // Redraw listbox
- RefreshL();
- }
- else if ( index == 1 )
- {
- // This is the start/stop toggle so we don't make a child view
- child = NULL;
-
- // ... instead we either start or stop the tracker
- if ( iMemSpySession.IsSwmtRunningL() && iState == EMemSpyViewHeapTrackingStateTimerOn )
- {
- iState = EMemSpyViewHeapTrackingStateIdle;
- iMemSpySession.StopSwmtTimerL();
-
- }
- else if ( iState == EMemSpyViewHeapTrackingStateIdle )
- {
- iState = EMemSpyViewHeapTrackingStateTimerOn;
- iMemSpySession.StartSwmtTimerL();
- }
-
- // Redraw listbox
- RefreshL();
- }
- else if ( index == 2 )
- {
- switch ( config.iMode )
- {
- case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic:
- {
- // Set Full mode
- SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull, config );
- break;
- }
- case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull:
- {
- // Set Custom mode
- SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom, config );
- break;
- }
- case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom:
- {
- // Set Basic mode
- SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic, config );
- break;
- }
- default: break;
- }
-
- // Redraw listbox
- RefreshL();
- }
- else if ( index == 3 )
- {
- if ( config.iMode == TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom )
- {
- child = new(ELeave) CMemSpyViewHeapTrackingSettings( iMemSpySession, iObserver );
- }
- else
- {
- child = new(ELeave) CMemSpyViewHeapTrackingResults( iMemSpySession, iObserver );
- }
- }
- else if ( index == 4 )
- {
- child = new(ELeave) CMemSpyViewHeapTrackingResults( iMemSpySession, iObserver );
- }
- if ( child )
- {
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- }
-
- //
- return child;
- }
-
-
-void CMemSpyViewHeapTracking::SetListBoxModelL()
- {
- CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
- CleanupStack::PushL( model );
-
- TBuf<KMaxFullName + 1> item;
-
- // Get current config
- TMemSpyEngineHelperSysMemTrackerConfig config;
-
- GetSwmtConfig( config );
-
- // 1st item
- _LIT( KItem1FormatEnable, "\tGet dump now" );
- model->AppendL( KItem1FormatEnable );
-
-
- // 1st item
- //if ( iEngine.HelperSysMemTracker().IsActive() && iState == EMemSpyViewHeapTrackingStateTimerOn )
- if ( iMemSpySession.IsSwmtRunningL() && iState == EMemSpyViewHeapTrackingStateTimerOn )
- {
- _LIT( KItem1FormatEnable, "\tStop timer\t\t%d (sec)" );
- TName item;
- item.Format( KItem1FormatEnable, config.iTimerPeriod.Int() / 1000000 );
- model->AppendL( item );
- }
- else
- {
- _LIT( KItem1FormatEnable, "\tStart timer\t\t%d (sec)" );
- TName item;
- item.Format( KItem1FormatEnable, config.iTimerPeriod.Int() / 1000000 );
- model->AppendL( item );
- }
-
- // 2nd item
- switch ( config.iMode )
- {
- case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic:
- {
- _LIT( KItem2Format, "\tTracking mode\t\tBasic" );
- model->AppendL( KItem2Format );
- break;
- }
- case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull:
- {
- _LIT( KItem2Format, "\tTracking mode\t\tFull" );
- model->AppendL( KItem2Format );
- break;
- }
- case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom:
- {
- _LIT( KItem2Format, "\tTracking mode\t\tCustom" );
- model->AppendL( KItem2Format );
-
- // 3rd item
- TFullName item;
- if ( config.iDumpData &&
- config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap )
- {
- _LIT( KItem3Format, "\tSettings\t\t%d categ., dump" );
-
- TInt count(0);
- for( TInt bit = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups; bit > 0; bit = bit >> 1 )
- {
- if ( bit & config.iEnabledCategories )
- {
- count++;
- }
- }
- item.Format( KItem3Format, count );
- }
- else
- {
- _LIT( KItem3Format, "\tSettings\t\t%d categories" );
- TInt count(0);
- for( TInt bit = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups; bit > 0; bit = bit >> 1 )
- {
- if ( bit & config.iEnabledCategories )
- {
- count++;
- }
- }
-
- item.Format( KItem3Format, count );
- }
- model->AppendL( item );
- break;
- }
- default: break;
- }
-
- // 4th item
- TInt cycleCount = iMemSpySession.GetSwmtCyclesCount();
-
- if ( cycleCount > 0 )
- {
- _LIT( KItem2Format, "\tResults\t\t%d cycles" );
- TFullName item;
- item.Format( KItem2Format, cycleCount );
- model->AppendL( item );
- }
- else
- {
- _LIT( KItem2Format, "\tResults\t\tNo results" );
- model->AppendL( KItem2Format );
- }
-
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
- CleanupStack::Pop( model );
- }
-
-void CMemSpyViewHeapTracking::HandleCyclesResetL()
- {
- }
-
-
-void CMemSpyViewHeapTracking::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
- {
- }
-
-
-void CMemSpyViewHeapTracking::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
- {
- // Stopping SWMT does not work directly from this function.
- // It has to be made asynchronously.
- // iStopTimerCallBack = new (ELeave) CAsyncCallBack( TCallBack( CMemSpyViewHeapTracking::AsyncStopTimerCallback, this ), CActive::EPriorityStandard );
- // iStopTimerCallBack->CallBack();
- }
-
-
-TInt CMemSpyViewHeapTracking::IndexByViewType( TMemSpyViewType aType )
- {
- // Get current config
- TMemSpyEngineHelperSysMemTrackerConfig config;
-
- GetSwmtConfig( config );
-
- TInt index = 0;
- //
- switch( aType )
- {
- default:
- case EMemSpyViewTypeHeapTrackingResults:
- {
- if ( config.iMode == TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom )
- {
- index = 4;
- }
- else
- {
- index = 3;
- }
- break;
- }
- case EMemSpyViewTypeHeapTrackingSettings:
- index = 3;
- break;
- }
- //
- return index;
- }
-
-
-void CMemSpyViewHeapTracking::SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode aMode, TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
- {
- switch ( aMode )
- {
- case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic:
- {
- aConfig.iMode = aMode;
- aConfig.iEnabledCategories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap |
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks |
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData |
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory;
- aConfig.iDumpData = EFalse;
- break;
- }
- case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull:
- {
- aConfig.iMode = aMode;
- aConfig.iEnabledCategories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
- aConfig.iDumpData = ETrue;
- aConfig.iThreadNameFilter = KNullDesC;
- break;
- }
- case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom:
- {
- aConfig.iMode = aMode;
- aConfig.iEnabledCategories = iOriginalConfig.iEnabledCategories;
- aConfig.iDumpData = iOriginalConfig.iDumpData;
- aConfig.iThreadNameFilter = iOriginalConfig.iThreadNameFilter;
- break;
- }
- default: User::Leave( KErrArgument );
- }
- // Push changes to SWMT
- SetSwmtConfig( aConfig );
- Settings().StoreSettingsL();
- }
-
-
-TInt CMemSpyViewHeapTracking::AsyncStopTimerCallback( TAny* aParam )
- {
- CMemSpyViewHeapTracking* view = static_cast<CMemSpyViewHeapTracking*>( aParam );
- return view->AsyncStopTimerCallback();
- }
-
-
-TInt CMemSpyViewHeapTracking::AsyncStopTimerCallback()
- {
- iState = EMemSpyViewHeapTrackingStateIdle;
- // iEngine.HelperSysMemTracker().RemoveObserver( this );
- TRAP_IGNORE(
- iMemSpySession.StopSwmtTimerL();
- RefreshL();
- );
- delete iStopTimerCallBack;
- iStopTimerCallBack = NULL;
- return KErrNone;
- }
-
-void CMemSpyViewHeapTracking::GetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
- {
- TInt categories = 0;
- iMemSpySession.GetSwmtCategoriesL( categories );
- aConfig.iEnabledCategories = categories;
-
- TInt timerPeriod = 0;
- iMemSpySession.GetSwmtTimerIntervalL( timerPeriod );
- aConfig.iTimerPeriod = timerPeriod;
-
- TBool dumpData = EFalse;
- iMemSpySession.GetSwmtHeapDumpsEnabledL( dumpData );
- aConfig.iDumpData = dumpData;
-
- TName threadNameFilter;
- iMemSpySession.GetSwmtFilter( threadNameFilter );
- aConfig.iThreadNameFilter = threadNameFilter;
-
- TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode mode;
- iMemSpySession.GetSwmtMode( mode );
- aConfig.iMode = mode;
- }
-
-void CMemSpyViewHeapTracking::SetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
- {
- iMemSpySession.SetSwmtMode( aConfig.iMode );
- iMemSpySession.SetSwmtCategoriesL( aConfig.iEnabledCategories );
- iMemSpySession.SetSwmtTimerIntervalL( aConfig.iTimerPeriod.Int() );
- iMemSpySession.SetSwmtHeapDumpsEnabledL( aConfig.iDumpData );
- iMemSpySession.SetSwmtFilter( aConfig.iThreadNameFilter );
- }
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewHeapTrackingResults.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,515 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewHeapTrackingResults.h"
-
-// System includes
-#include <hal.h>
-#ifdef __EPOC32__
-#include <e32rom.h>
-#endif
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackercycle.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackercyclechange.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerenums.h>
-#include <memspy/engine/memspyenginehelpersysmemtracker.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-#include <memspyui.rsg>
-#include <memspysession.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyContainer.h"
-#include "MemSpyViewHeapTracking.h"
-#include "MemSpyContainerObserver.h"
-
-
-_LIT( KCycle, "Cycle" );
-_LIT( KTime, "Time" );
-_LIT( KMemoryFree, "Memory Free" );
-_LIT( KMemoryChange, "Memory Change (vs. Last Cycle)" );
-_LIT( KNumOfChanges, "Number of Changes" );
-
-CMemSpyViewHeapTrackingResults::CMemSpyViewHeapTrackingResults( RMemSpySession& aSession, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aSession, aObserver )
- {
- //iEngine.HelperSysMemTracker().SetObserver( this );
- }
-
-
-CMemSpyViewHeapTrackingResults::~CMemSpyViewHeapTrackingResults()
- {
- //iEngine.HelperSysMemTracker().RemoveObserver( this );
- }
-
-
-void CMemSpyViewHeapTrackingResults::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Results Summary" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- // Make sure the correct item is selected
- const TInt cycleNumber = ((TInt) aSelectionRune);
- TInt maxCycle = iMemSpySession.GetSwmtCyclesCount();
- if ( cycleNumber > 0 && cycleNumber <= maxCycle )
- {
- iListBox->SetCurrentItemIndex( cycleNumber - 1 );
- HandleListBoxItemSelectedL( cycleNumber );
- }
- }
-
-
-void CMemSpyViewHeapTrackingResults::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewHeapTrackingResults::ViewType() const
- {
- return EMemSpyViewTypeHeapTrackingResults;
- }
-
-
-CMemSpyViewBase* CMemSpyViewHeapTrackingResults::PrepareParentViewL()
- {
- CMemSpyViewHeapTracking* parent = new(ELeave) CMemSpyViewHeapTracking( iMemSpySession, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- //
- // iEngine.HelperSysMemTracker().RemoveObserver( this );
- //
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewHeapTrackingResults::PrepareChildViewL()
- {
- const TInt index = iListBox->CurrentItemIndex();
- //
- CMemSpyViewBase* child = NULL;
-
- if ( index >= 0 )
- {
- //const CMemSpyEngineHelperSysMemTrackerCycle* cycle = iEngine.HelperSysMemTracker().CompletedCycles()[ index ];
- const CMemSpyApiMemoryTrackingCycle* cycle = iCycles[ index ];
- //
- child = new(ELeave) CMemSpyViewHeapTrackingResultsCycleInfo( iMemSpySession, iObserver, *cycle );
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- //
- //iEngine.HelperSysMemTracker().RemoveObserver( this );
- }
-
- //
- return child;
- }
-
-
-void CMemSpyViewHeapTrackingResults::SetListBoxModelL()
- {
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
-
- iMemSpySession.GetMemoryTrackingCyclesL( iCycles );
-
- CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( iCycles.Count());
-
- for ( TInt i = 0; i < iCycles.Count(); i++ )
- {
- HBufC* tempName = HBufC::NewL( iCycles[i]->Caption().Length() + 16 );
- CleanupStack::PushL( tempName );
- TPtr tempNamePtr( tempName->Des() );
-
- TBuf<KMaxName> temp;
- temp.Copy(iCycles[i]->Caption());
- tempNamePtr.Append( temp );
- model->AppendL( tempNamePtr );
-
- CleanupStack::PopAndDestroy( tempName );
- }
-
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewHeapTrackingResults::HandleCyclesResetL()
- {
- CMemSpyViewBase::RefreshL();
- }
-
-
-void CMemSpyViewHeapTrackingResults::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
- {
- }
-
-
-void CMemSpyViewHeapTrackingResults::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
- {
- TInt count = iMemSpySession.GetSwmtCyclesCount();
- SetListBoxCurrentItemIndexL( count - 1 );
- CMemSpyViewBase::RefreshL();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewHeapTrackingResultsCycleInfo::CMemSpyViewHeapTrackingResultsCycleInfo( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, const CMemSpyApiMemoryTrackingCycle& aCycle )
-: CMemSpyViewBase( aSession, aObserver ), iCycle( aCycle )
- {
- //iEngine.HelperSysMemTracker().SetObserver( this );
- }
-
-
-CMemSpyViewHeapTrackingResultsCycleInfo::~CMemSpyViewHeapTrackingResultsCycleInfo()
- {
- //iEngine.HelperSysMemTracker().RemoveObserver( this );
- }
-
-
-void CMemSpyViewHeapTrackingResultsCycleInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitleFormat, "Cycle Summary [%04d]" );
- TBuf<30> buf;
- buf.Format( KTitleFormat, iCycle.CycleNumber() );
- SetTitleL( buf );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- // Make sure the correct item is selected
- const TInt index = ((TInt) aSelectionRune);
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
-
-
-void CMemSpyViewHeapTrackingResultsCycleInfo::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewHeapTrackingResultsCycleInfo::ViewType() const
- {
- return EMemSpyViewTypeHeapTrackingResultsCycleInfo;
- }
-
-
-CMemSpyViewBase* CMemSpyViewHeapTrackingResultsCycleInfo::PrepareParentViewL()
- {
- CMemSpyViewHeapTrackingResults* parent = new(ELeave) CMemSpyViewHeapTrackingResults( iMemSpySession, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) iCycle.CycleNumber() );
- CleanupStack::Pop( parent );
- //
- //iEngine.HelperSysMemTracker().RemoveObserver( this );
- //
- return parent;
- }
-
-
-void CMemSpyViewHeapTrackingResultsCycleInfo::SetListBoxModelL()
- {
- CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( 6 );
-
- HBufC* buf = HBufC::NewL( 64 );
- TPtr pBuf( buf->Des() );
-
- TBuf<4> cycleBuf;
- _LIT( KCycleFormat, "%d");
- cycleBuf.Format( KCycleFormat, iCycle.CycleNumber() );
-
- pBuf.Zero();
- pBuf.Append( _L("\t") );
- pBuf.Append( KCycle );
- pBuf.Append( _L("\t\t") );
- pBuf.Append( cycleBuf );
- model->AppendL( pBuf );
-
- //time:
- TBuf<128> timeBuf;
- const TDateTime dt = iCycle.Time().DateTime();
- //
- _LIT( KTimeFormatSpec, "%04d%02d%02d %02d:%02d:%02d" );
- timeBuf.Format( KTimeFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second() );
- pBuf.Zero();
- pBuf.Append( _L("\t"));
- pBuf.Append( KTime );
- pBuf.Append( _L("\t\t") );
- pBuf.Append( timeBuf );
- model->AppendL( pBuf );
-
- TBuf<16> memoryFreeBuf;
- memoryFreeBuf.Format( KCycleFormat, iCycle.FreeMemory() );
- pBuf.Zero();
- pBuf.Append( _L("\t") );
- pBuf.Append( KMemoryFree );
- pBuf.Append( _L("\t\t") );
- pBuf.Append( memoryFreeBuf );
- model->AppendL( pBuf );
-
- memoryFreeBuf.Format( KCycleFormat, iCycle.MemoryDelta() );
- pBuf.Zero();
- pBuf.Append( _L("\t") );
- pBuf.Append( KMemoryChange );
- pBuf.Append( _L("\t\t") );
- pBuf.Append( memoryFreeBuf );
- model->AppendL( pBuf );
-
- cycleBuf.Format( KCycleFormat, iCycle.ChangeCount() );
- pBuf.Zero();
- pBuf.Append( _L("\t") );
- pBuf.Append( KNumOfChanges );
- pBuf.Append( _L("\t\t") );
- pBuf.Append( cycleBuf );
- model->AppendL( pBuf );
-
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewHeapTrackingResultsCycleInfo::HandleCyclesResetL()
- {
- Container().NavigateToParentViewL();
- }
-
-
-void CMemSpyViewHeapTrackingResultsCycleInfo::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
- {
- }
-
-
-void CMemSpyViewHeapTrackingResultsCycleInfo::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ )
- {
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/*
-
-
-
-CMemSpyViewHeapTrackingResultsChangeDescriptor::CMemSpyViewHeapTrackingResultsChangeDescriptor( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle, const CMemSpyEngineHelperSysMemTrackerCycleChange& aChangeDescriptor, TInt aIndex )
-: CMemSpyViewBase( aEngine, aObserver ), iCycle( aCycle ), iChangeDescriptor( aChangeDescriptor ), iIndex( aIndex )
- {
- iEngine.HelperSysMemTracker().SetObserver( this );
- }
-
-
-CMemSpyViewHeapTrackingResultsChangeDescriptor::~CMemSpyViewHeapTrackingResultsChangeDescriptor()
- {
- iEngine.HelperSysMemTracker().RemoveObserver( this );
- }
-
-
-void CMemSpyViewHeapTrackingResultsChangeDescriptor::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- TBuf<30> buf;
- if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeHeapUser )
- {
- _LIT( KTitleFormat, "User Heap Change [%04d]" );
- buf.Format( KTitleFormat, iCycle.CycleNumber() );
- }
- else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeHeapKernel )
- {
- _LIT( KTitleFormat, "Kernel Heap Change [%04d]" );
- buf.Format( KTitleFormat, iCycle.CycleNumber() );
- }
- else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeChunk )
- {
- _LIT( KTitleFormat, "Chunk Change [%04d]" );
- buf.Format( KTitleFormat, iCycle.CycleNumber() );
- }
- else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeRamDrive )
- {
- _LIT( KTitleFormat, "RAM Drive Change [%04d]" );
- buf.Format( KTitleFormat, iCycle.CycleNumber() );
- }
- else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeStack )
- {
- _LIT( KTitleFormat, "Stack Change [%04d]" );
- buf.Format( KTitleFormat, iCycle.CycleNumber() );
- }
- else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeGlobalData )
- {
- _LIT( KTitleFormat, "Global Data Change [%04d]" );
- buf.Format( KTitleFormat, iCycle.CycleNumber() );
- }
- else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeCode )
- {
- _LIT( KTitleFormat, "RAM-Loaded Code Change [%04d]" );
- buf.Format( KTitleFormat, iCycle.CycleNumber() );
- }
- else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeHandle )
- {
- _LIT( KTitleFormat, "Handle Change [%04d]" );
- buf.Format( KTitleFormat, iCycle.CycleNumber() );
- }
- else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeOpenFile )
- {
- _LIT( KTitleFormat, "Open File Change [%04d]" );
- buf.Format( KTitleFormat, iCycle.CycleNumber() );
- }
- else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeDiskSpace )
- {
- _LIT( KTitleFormat, "Disk Space Change [%04d]" );
- buf.Format( KTitleFormat, iCycle.CycleNumber() );
- }
- else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeBitmap )
- {
- _LIT( KTitleFormat, "Bitmap Change [%04d]" );
- buf.Format( KTitleFormat, iCycle.CycleNumber() );
- }
- //
- SetTitleL( buf );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-void CMemSpyViewHeapTrackingResultsChangeDescriptor::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewHeapTrackingResultsChangeDescriptor::ViewType() const
- {
- return EMemSpyViewTypeHeapTrackingResultsCycleChangeDescriptor;
- }
-
-
-CMemSpyViewBase* CMemSpyViewHeapTrackingResultsChangeDescriptor::PrepareParentViewL()
- {
- CMemSpyViewHeapTrackingResultsCycleInfo* parent = new(ELeave) CMemSpyViewHeapTrackingResultsCycleInfo( iEngine, iObserver, iCycle );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) iIndex );
- CleanupStack::Pop( parent );
- //
- iEngine.HelperSysMemTracker().RemoveObserver( this );
- //
- return parent;
- }
-
-
-void CMemSpyViewHeapTrackingResultsChangeDescriptor::SetListBoxModelL()
- {
- MDesCArray& model = const_cast< MDesCArray& >( static_cast< const MDesCArray&>( iChangeDescriptor ) );
- //
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( &model );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewHeapTrackingResultsChangeDescriptor::HandleCyclesResetL()
- {
- CMemSpyViewHeapTrackingResults* mainResultsMenu = new(ELeave) CMemSpyViewHeapTrackingResults( iEngine, iObserver );
- CleanupStack::PushL( mainResultsMenu );
- mainResultsMenu->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( mainResultsMenu );
- //
- Container().SetNewActiveViewL( mainResultsMenu );
- }
-
-
-void CMemSpyViewHeapTrackingResultsChangeDescriptor::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
- {
- }
-
-
-void CMemSpyViewHeapTrackingResultsChangeDescriptor::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle )
- {
- }
-*/
-
--- a/memspyui/ui/avkon/src/MemSpyViewHeapTrackingSettings.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,470 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewHeapTrackingSettings.h"
-
-// System includes
-#include <hal.h>
-#ifdef __EPOC32__
-#include <e32rom.h>
-#endif
-#include <AknQueryDialog.h>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelpersysmemtracker.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-#include <memspyui.rsg>
-#include <memspysession.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpySettings.h"
-#include "MemSpyViewHeapTracking.h"
-#include "MemSpyContainerObserver.h"
-
-/*
-CMemSpyViewHeapTrackingSettings::CMemSpyViewHeapTrackingSettings( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aEngine, aObserver )
- {
- }
-*/
-CMemSpyViewHeapTrackingSettings::CMemSpyViewHeapTrackingSettings( RMemSpySession& aSession, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aSession, aObserver )
- {
- }
-
-
-CMemSpyViewHeapTrackingSettings::~CMemSpyViewHeapTrackingSettings()
- {
- }
-
-
-void CMemSpyViewHeapTrackingSettings::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Settings" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-void CMemSpyViewHeapTrackingSettings::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::SizeChanged();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewHeapTrackingSettings::ViewType() const
- {
- return EMemSpyViewTypeHeapTrackingSettings;
- }
-
-
-CMemSpyViewBase* CMemSpyViewHeapTrackingSettings::PrepareParentViewL()
- {
- CMemSpyViewHeapTracking* parent = new(ELeave) CMemSpyViewHeapTracking( iMemSpySession, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewHeapTrackingSettings::PrepareChildViewL()
- {
- const TInt index = iListBox->CurrentItemIndex();
-
- // Get current config
- TMemSpyEngineHelperSysMemTrackerConfig config;
- GetSwmtConfig( config );
-
- // This view abuses the child view callback to toggle field values and/or
- // display settings dialogs.
- if ( index == 0 )
- {
- TInt period = config.iTimerPeriod.Int() / 1000000;
- CAknNumberQueryDialog* dialog = new(ELeave) CAknNumberQueryDialog( period );
- if ( dialog->ExecuteLD( R_MEMSPY_HEAP_TRACKER_TIMER_PERIOD ) )
- {
- config.iTimerPeriod = period * 1000000;
- }
- }
- else if ( index == 1 )
- {
- TInt categories( config.iEnabledCategories );
- CSWMTCategorySelectionCheckBoxSettingItem* settingItem = new (ELeave) CSWMTCategorySelectionCheckBoxSettingItem( 0, categories );
- CleanupStack::PushL( settingItem );
- settingItem->ConstructL( EFalse,
- 0,
- _L("SWMT Categories"),
- NULL,
- R_MEMSPYUI_SWMT_CATEGORIES_SETTING_PAGE,
- EAknCtPopupSettingList,
- NULL,
- NULL );
-
- CMemSpySWMTCategorySelectionCheckBoxSettingPage* dlg = new(ELeave) CMemSpySWMTCategorySelectionCheckBoxSettingPage( R_MEMSPYUI_SWMT_CATEGORIES_SETTING_PAGE, settingItem->ItemArray() );
- dlg->SetSettingPageObserver( settingItem );
- if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
- {
- config.iEnabledCategories = categories;
- }
- CleanupStack::PopAndDestroy( settingItem );
- }
- else if ( index == 2 )
- {
- config.iDumpData = !config.iDumpData;
- }
- else if ( index == 3 )
- {
- TName nameFilter;
- nameFilter.Copy( config.iThreadNameFilter );
- CMemSpyAllowEmptyDataDialog* dialog = new (ELeave) CMemSpyAllowEmptyDataDialog( nameFilter );
- if ( dialog->ExecuteLD( R_MEMSPY_HEAP_TRACKER_NAME_FILTER ) )
- {
- config.iThreadNameFilter = nameFilter;
- }
- }
-
- // Push changes to SWMT
- SetSwmtConfig( config );
- Settings().StoreSettingsL();
-
- RefreshL();
- return NULL;
- }
-
-
-void CMemSpyViewHeapTrackingSettings::SetListBoxModelL()
- {
- CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
- CleanupStack::PushL( model );
-
- TBuf<KMaxFullName + 1> item;
-
- // Get current config
- TMemSpyEngineHelperSysMemTrackerConfig config;
- GetSwmtConfig( config );
-
- // 1st item
- _LIT( KItem1Format, "\tTracking timer period\t\t%d (sec)" );
- item.Format( KItem1Format, config.iTimerPeriod.Int() / 1000000 );
- model->AppendL( item );
-
- // 2nd item
- _LIT( KItem3Format, "\tCategories\t\t%d selected" );
-
- TInt count(0);
- for( TInt bit = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups; bit > 0; bit = bit >> 1 )
- {
- if ( bit & config.iEnabledCategories )
- {
- count++;
- }
- }
-
- item.Format( KItem3Format, count );
- model->AppendL( item );
-
- // following items are related only to User Heap category,
- // so hide them if User Heap is not selected
- if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap )
- {
- // 3th item
- _LIT( KItem2Format, "\tDump data" );
- PrepareItemBufL( item, KItem2Format, config.iDumpData, config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap && config.iThreadNameFilter.Length() > 0 );
- model->AppendL( item );
-
- // 4th item
- if ( config.iDumpData )
- {
- _LIT( KItem4Format, "\tHeap data thread filter\t\t%S" );
- if ( config.iThreadNameFilter.Length() > 0 )
- {
- item.Format( KItem4Format, &config.iThreadNameFilter );
- }
- else
- {
- item.Format( KItem4Format, &_L("No filtering") );
- }
- model->AppendL( item );
- }
- }
-
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
- CleanupStack::Pop( model );
- }
-
-
-void CMemSpyViewHeapTrackingSettings::PrepareItemBufL( TDes& aBuf, const TDesC& aCaption, TBool aStatus, TBool aHeapCategorySelected )
- {
- aBuf.Copy( aCaption );
- //
- if ( aStatus )
- {
- if ( aHeapCategorySelected )
- {
- _LIT( KItemEnabled, "\t\tCustom" );
- aBuf.Append( KItemEnabled );
- }
- else
- {
- _LIT( KItemEnabled, "\t\tAll user heaps" );
- aBuf.Append( KItemEnabled );
- }
- }
- else
- {
- _LIT( KItemDisabled, "\t\tDisabled" );
- aBuf.Append( KItemDisabled );
- }
- }
-
-void CMemSpyViewHeapTrackingSettings::GetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
- {
- TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode mode;
- iMemSpySession.GetSwmtMode( mode );
- aConfig.iMode = mode;
-
- TInt categories = 0;
- iMemSpySession.GetSwmtCategoriesL( categories );
- aConfig.iEnabledCategories = categories;
-
- TInt timerPeriod = 0;
- iMemSpySession.GetSwmtTimerIntervalL( timerPeriod );
- aConfig.iTimerPeriod = timerPeriod;
-
- TBool dumpData = EFalse;
- iMemSpySession.GetSwmtHeapDumpsEnabledL( dumpData );
- aConfig.iDumpData = dumpData;
-
- TName threadNameFilter;
- iMemSpySession.GetSwmtFilter( threadNameFilter );
- aConfig.iThreadNameFilter = threadNameFilter;
- }
-
-void CMemSpyViewHeapTrackingSettings::SetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig )
- {
- iMemSpySession.SetSwmtMode( aConfig.iMode );
- iMemSpySession.SetSwmtCategoriesL( aConfig.iEnabledCategories );
- iMemSpySession.SetSwmtTimerIntervalL( aConfig.iTimerPeriod.Int() );
- iMemSpySession.SetSwmtHeapDumpsEnabledL( aConfig.iDumpData );
- iMemSpySession.SetSwmtFilter( aConfig.iThreadNameFilter );
- }
-
-
-
-
-
-
-
-
-
-
-// --------------------------------------------------------------------------------------------
-
-CSWMTCategorySelectionCheckBoxSettingItem::CSWMTCategorySelectionCheckBoxSettingItem( TInt aIdentifier, TInt& aCategories ):
- CAknSettingItem(aIdentifier), iExtCategories( aCategories )
- {
- }
-
-
-CSWMTCategorySelectionCheckBoxSettingItem::~CSWMTCategorySelectionCheckBoxSettingItem()
- {
- delete iSettingText;
- if( iItemArray )
- {
- iItemArray->ResetAndDestroy();
- delete iItemArray;
- }
- }
-
-
-CSelectionItemList* CSWMTCategorySelectionCheckBoxSettingItem::ItemArray() const
- {
- return iItemArray;
- }
-
-
-void CSWMTCategorySelectionCheckBoxSettingItem::AddNewItemToArrayL(const TDesC& aLabel)
- {
- TBuf<64> buf;
- buf.Copy( aLabel );
- CSelectableItem* item = new (ELeave) CSelectableItem( buf, EFalse );
- CleanupStack::PushL( item );
- item->ConstructL();
- iItemArray->AppendL( item ); // Ownership is transferred
- CleanupStack::Pop(); // item
- }
-
-
-void CSWMTCategorySelectionCheckBoxSettingItem::CompleteConstructionL()
- {
- SetEmptyItemTextL(_L("Nothing selected"));
- iItemArray = new(ELeave) CSelectionItemList(16);
- AddNewItemToArrayL( _L("User Heap") ); // 0
- AddNewItemToArrayL( _L("Kernel Heap") ); // 1
- AddNewItemToArrayL( _L("User Stacks") ); // 2
- AddNewItemToArrayL( _L("Global Data") ); // 3
- AddNewItemToArrayL( _L("Disk Usage") ); // 4
- AddNewItemToArrayL( _L("Open Files") ); // 5
- AddNewItemToArrayL( _L("RAM-loaded Code") ); // 6
- AddNewItemToArrayL( _L("System Memory") ); // 7
- AddNewItemToArrayL( _L("Local Chunks") ); // 8
- AddNewItemToArrayL( _L("Global Chunks") ); // 9
- AddNewItemToArrayL( _L("RAM Drive") ); // 10
- AddNewItemToArrayL( _L("FileServer Cache") );// 11
- AddNewItemToArrayL( _L("Kernel Handles") ); // 12
- AddNewItemToArrayL( _L("Bitmap Handles") ); // 13
- AddNewItemToArrayL( _L("Window Groups") ); // 14
- }
-
-
-void CSWMTCategorySelectionCheckBoxSettingItem::StoreL()
- {
- iExtCategories = 0;
- if ( iItemArray->At( 11 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache;
- if ( iItemArray->At( 13 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles;
- if ( iItemArray->At( 0 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap;
- if ( iItemArray->At( 1 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap;
- if ( iItemArray->At( 8 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks;
- if ( iItemArray->At( 9 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks;
- if ( iItemArray->At( 10 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive;
- if ( iItemArray->At( 2 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks;
- if ( iItemArray->At( 3 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData;
- if ( iItemArray->At( 6 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode;
- if ( iItemArray->At( 12 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles;
- if ( iItemArray->At( 5 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles;
- if ( iItemArray->At( 4 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage;
- if ( iItemArray->At( 7 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory;
- if ( iItemArray->At( 14 )->SelectionStatus() )
- iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups;
- }
-
-
-void CSWMTCategorySelectionCheckBoxSettingItem::LoadL()
- {
- iItemArray->At( 11 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache );
- iItemArray->At( 13 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles );
- iItemArray->At( 0 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap );
- iItemArray->At( 1 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap );
- iItemArray->At( 8 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks );
- iItemArray->At( 9 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks );
- iItemArray->At( 10 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive );
- iItemArray->At( 2 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks );
- iItemArray->At( 3 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData );
- iItemArray->At( 6 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode );
- iItemArray->At( 12 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles );
- iItemArray->At( 5 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles );
- iItemArray->At( 4 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage );
- iItemArray->At( 7 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory );
- iItemArray->At( 14 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups );
- }
-
-
-void CSWMTCategorySelectionCheckBoxSettingItem::HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType )
- {
- switch( aEventType )
- {
- case EEventSettingOked:
- {
- // If settings oked, save new values
- StoreL();
- break;
- }
- case EEventSettingCancelled:
- {
- // If setting is cancelled, load old values
- LoadL();
- break;
- }
- case EEventSettingChanged:
- {
- // If setting has changed, update CBA visibility
- static_cast<CMemSpySWMTCategorySelectionCheckBoxSettingPage*>( aSettingPage )->UpdateCba();
- break;
- }
- default:
- {
- break;
- }
- }
- CAknSettingItem::HandleSettingPageEventL( aSettingPage, aEventType );
- }
-
-
-CMemSpySWMTCategorySelectionCheckBoxSettingPage::CMemSpySWMTCategorySelectionCheckBoxSettingPage(TInt aResourceID, CSelectionItemList* aItemArray )
- : CAknCheckBoxSettingPage( aResourceID, aItemArray )
- {
- }
-
-
-void CMemSpySWMTCategorySelectionCheckBoxSettingPage::UpdateCba()
- {
- // Cache the pointer to button group container
- CEikButtonGroupContainer* cba = Cba();
- // Left softkey should be visible if there are items selected,
- // i.e. the selection index array has items.
- TBool visible( ListBoxControl()->View()->SelectionIndexes()->Count() > 0 );
- // Resolve left softkey command id
- TInt leftId( cba->ButtonGroup()->CommandId( 0 ) );
- // Check if left softkey visibility has changed
- if( visible != cba->IsCommandVisible( leftId ) )
- {
- // Left softkey visibility has changed, update it
- cba->MakeCommandVisible( leftId, visible );
- }
- }
-
-
-
-
-CMemSpyAllowEmptyDataDialog::CMemSpyAllowEmptyDataDialog( TDes& aText, const TTone& aTone )
- : CAknTextQueryDialog( aText, aTone )
- {
- }
-
-
-void CMemSpyAllowEmptyDataDialog::UpdateLeftSoftKeyL()
- {
- MakeLeftSoftkeyVisible( ETrue );
- }
--- a/memspyui/ui/avkon/src/MemSpyViewKernel.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewKernel.h"
-
-// System includes
-#include <hal.h>
-#ifdef __EPOC32__
-#include <e32rom.h>
-#endif
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspysession.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyContainerObserver.h"
-#include "MemSpyViewKernelHeap.h"
-#include "MemSpyViewKernelContainers.h"
-
-/*
-CMemSpyViewKernel::CMemSpyViewKernel( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aEngine, aObserver )
- {
- }
-*/
-
-CMemSpyViewKernel::CMemSpyViewKernel( RMemSpySession& aSession, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aSession, aObserver )
- {
- }
-
-
-CMemSpyViewKernel::~CMemSpyViewKernel()
- {
- }
-
-
-void CMemSpyViewKernel::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Kernel" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- // Make sure the correct item is selected
- const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune);
- const TInt index = IndexByViewType( viewType );
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
-
-
-void CMemSpyViewKernel::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewKernel::ViewType() const
- {
- return EMemSpyViewTypeKernel;
- }
-
-
-CMemSpyViewBase* CMemSpyViewKernel::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iMemSpySession, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewKernel::PrepareChildViewL()
- {
-
- CMemSpyViewBase* child = NULL;
- const TInt index = iListBox->CurrentItemIndex();
- //
- if ( index == 0 )
- {
- child = new(ELeave) CMemSpyViewKernelContainers( iMemSpySession, iObserver );
- }
- else if ( index == 1 )
- {
- child = new(ELeave) CMemSpyViewKernelHeap( iMemSpySession, iObserver );
- }
-
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- return child;
- }
-
-
-void CMemSpyViewKernel::SetListBoxModelL()
- {
- CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
- CleanupStack::PushL( model );
-
- TBuf<KMaxFullName + 1> item;
-
- // 1st item = Processes
- _LIT( KItem1Format, "\tObjects" );
- item.Format( KItem1Format );
- model->AppendL( item );
-
- // 2nd item = System Config
- _LIT( KItem2Format, "\tHeap" );
- model->AppendL( KItem2Format );
-
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
- CleanupStack::Pop( model );
- }
-
-
-TInt CMemSpyViewKernel::IndexByViewType( TMemSpyViewType aType )
- {
- TInt index = 0;
- //
- switch( aType )
- {
- default:
- case EMemSpyViewTypeKernelContainers:
- index = 0;
- break;
-
- case EMemSpyViewTypeKernelHeap:
- index = 1;
- break;
- }
-
- //
- return index;
- }
-
-
-
-
-
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewKernelContainers.h"
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperkernelcontainers.h>
-
-#include <memspysession.h>
-#include <memspy/api/memspyapiprocess.h>
-#include <memspy/engine/memspyengineutils.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewKernel.h"
-#include "MemSpyContainerObserver.h"
-#include "MemSpyViewKernelObjects.h"
-
-// Literal constants
-
-
-
-CMemSpyViewKernelContainers::CMemSpyViewKernelContainers( RMemSpySession& aSession, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aSession, aObserver )
- {
- }
-
-
-CMemSpyViewKernelContainers::~CMemSpyViewKernelContainers()
- {
- //delete iModel;
- }
-
-
-void CMemSpyViewKernelContainers::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Kernel Objects" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-void CMemSpyViewKernelContainers::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewKernelContainers::ViewType() const
- {
- return EMemSpyViewTypeKernelContainers;
- }
-
-
-CMemSpyViewBase* CMemSpyViewKernelContainers::PrepareParentViewL()
- {
- CMemSpyViewKernel* parent = new(ELeave) CMemSpyViewKernel( iMemSpySession, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewKernelContainers::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
- const TInt index = iListBox->CurrentItemIndex();
- //child = new(ELeave) CMemSpyViewKernelObjects( iEngine, iObserver, iModel->At( index ).Type() );
- child = new(ELeave) CMemSpyViewKernelObjects( iMemSpySession, iObserver, iKernelObjects[index]->Type() );
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- return child;
- }
-
-
-void CMemSpyViewKernelContainers::SetListBoxModelL()
- {
- iMemSpySession.GetKernelObjects( iKernelObjects );
-
- CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( iKernelObjects.Count() ); //array for formated items
-
- for( TInt i=0 ; i<iKernelObjects.Count() ; i++ )
- {
- TInt count = iKernelObjects[i]->Count();
- TInt size = iKernelObjects[i]->Size();
- const TMemSpySizeText sizeText( MemSpyUiUtils::FormatSizeText( size, 0 ) );
-
- HBufC* tempName = HBufC::NewL( iKernelObjects[i]->Name().Length() + 32 );
-
- CleanupStack::PushL( tempName );
- TPtr tempNamePtr( tempName->Des() );
- tempNamePtr.Copy( iKernelObjects[i]->Name() );
-
- _LIT(KNameFormat, "\t%S\t\t%d item");
- TPtr pName( tempName->Des() );
- //
- const TPtrC pType( MemSpyUiUtils::TypeAsString( iKernelObjects[i]->Type() ) );
- //
- pName.Format( KNameFormat, &pType, count );
- //
- if ( count == 0 || count > 1 )
- {
- pName.Append( _L("s") );
- }
-
- pName.AppendFormat( _L(", %S"), &sizeText );
-
- model->AppendL( pName );
-
- CleanupStack::PopAndDestroy( tempName); //---
- }
-
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-TBool CMemSpyViewKernelContainers::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdKernelContainersOutput:
- OnCmdOutputAllContainerContentsL();
- break;
-
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewKernelContainers::OnCmdOutputAllContainerContentsL()
- {
- iMemSpySession.OutputAllContainerContents();
- }
--- a/memspyui/ui/avkon/src/MemSpyViewKernelHeap.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,432 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewKernelHeap.h"
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyengineoutputlist.h>
-
-#include <memspysession.h>
-#include <memspy/api/memspyapiheap.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewKernel.h"
-#include "MemSpyContainerObserver.h"
-
-// Constants
-const TInt KMemSpyBufferSize = 20;
-
-// Literal constants
-_LIT(KMemSpyHexFormat, "0x%08x");
-_LIT(KMemSpyUnsignedFormat, "%u");
-_LIT(KMemSpyDecFormat, "%d");
-_LIT(KMemSpyLongFormat, "%Ld");
-_LIT(KMemSpyCaptionYes, "Yes");
-_LIT(KMemSpyCaptionNo, "No");
-
-
-CMemSpyViewKernelHeap::CMemSpyViewKernelHeap( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) //cigasto: remember to uncomment from MMP!
-: CMemSpyViewBase( aSession, aObserver )
- {
- }
-
-CMemSpyViewKernelHeap::~CMemSpyViewKernelHeap()
- {
- }
-
-
-void CMemSpyViewKernelHeap::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Kernel Heap" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-void CMemSpyViewKernelHeap::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewKernelHeap::ViewType() const
- {
- return EMemSpyViewTypeKernelHeap;
- }
-
-
-CMemSpyViewBase* CMemSpyViewKernelHeap::PrepareParentViewL()
- {
- CMemSpyViewKernel* parent = new(ELeave) CMemSpyViewKernel( iMemSpySession, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewKernelHeap::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
- return child;
- }
-
-
-void CMemSpyViewKernelHeap::SetListBoxModelL()
- {
- CMemSpyApiHeap* iHeap;
- iHeap = iMemSpySession.GetHeap( );
-
- CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( 22 );
-
- model = FormatModel( iHeap );
-
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
- }
-
-
-TBool CMemSpyViewKernelHeap::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdKernelHeapDump:
- OnCmdDumpKernelHeapL();
- break;
-
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewKernelHeap::OnCmdDumpKernelHeapL()
- {
- iMemSpySession.DumpKernelHeap();
- }
-
-
-//CDesCArrayFlat* CMemSpyViewKernelHeap::FormatModel( RArray<CMemSpyApiHeap*> &aHeap )
-CDesCArrayFlat* CMemSpyViewKernelHeap::FormatModel( CMemSpyApiHeap* aHeap )
- {
- CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( 2 );
-
- if (aHeap)
- {
- _LIT( KItem0, "Heap type" );
- _LIT( KItem1, "Heap size" );
- _LIT( KItem8b, "Heap base address" );
- _LIT( KItem1b, "Shared" );
- _LIT( KItem2, "Chunk size" );
- _LIT( KItem3, "Alloc. count" );
- _LIT( KItem4, "Free. count" );
- _LIT( KItem5, "Biggest alloc." );
- _LIT( KItem6, "Biggest free" );
- _LIT( KItem6a, "Total alloc." );
- _LIT( KItem6b, "Total free" );
- _LIT( KItem7, "Slack free space" );
- _LIT( KItem8a, "Fragmentation" );
- _LIT( KItem13, "Header size (A)" );
- _LIT( KItem14, "Header size (F)" );
- _LIT( KItem9a, "Overhead (alloc)" );
- _LIT( KItem9b, "Overhead (free)" );
- _LIT( KItem9c, "Overhead (total)" );
- _LIT( KItem9d, "Overhead" );
- _LIT( KItem10, "Min. length" );
- _LIT( KItem11, "Max. length" );
- _LIT( KItem12, "Debug Allocator Library" );
-
- HBufC* hItem = FormatItem( KItem0, aHeap->Type() );
- TPtr pItem(hItem->Des());
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem1, aHeap->Size() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- TUint address( aHeap->BaseAddress() );
- hItem = FormatItem( KItem8b, address );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- if(aHeap->Shared()) //Yes / No value formatting
- hItem = FormatItem( KItem1b, KMemSpyCaptionYes );
- else
- hItem = FormatItem( KItem1b, KMemSpyCaptionNo );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem2, aHeap->ChunkSize() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem3, aHeap->AllocationsCount() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem4, aHeap->FreeCount() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem5, aHeap->BiggestAllocation() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem6, aHeap->BiggestFree() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem6a, aHeap->TotalAllocations() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem6b, aHeap->TotalFree() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem7, aHeap->SlackFreeSpace() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- TReal iOneHundred( aHeap->Size() );
- TReal iValue( aHeap->Fragmentation() );
- hItem = FormatPercentageItem( KItem8a, iOneHundred, iValue );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem13, aHeap->HeaderSizeA() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem14, aHeap->HeaderSizeF() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem9a, aHeap->AllocationOverhead() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem9b, aHeap->FreeOverhead() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem9c, aHeap->TotalOverhead() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- TReal iOverhead( aHeap->Overhead() );
- hItem = FormatPercentageItem( KItem9d, iOneHundred, iOverhead );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem10, aHeap->MinLength() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- hItem = FormatItem( KItem11, aHeap->MaxLength() );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
-
- if( aHeap->DebugAllocatorLibrary() )
- hItem = FormatItem( KItem12, KMemSpyCaptionYes );
- else
- hItem = FormatItem( KItem12, KMemSpyCaptionNo );
- pItem = hItem->Des();
- model->AppendL( pItem );
- pItem.Zero();
- }
- else
- {
- HBufC* hItem = FormatItem( _L("Not Found"), _L("") );
- TPtr pItem(hItem->Des());
- model->AppendL( pItem );
- pItem.Zero();
- }
-
- return model;
- }
-
-HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, const TDesC& aValue )
- {
- HBufC* retBuf = HBufC::NewL( KMaxName );
- TPtr pRetBuf( retBuf->Des() );
- pRetBuf.Zero();
- pRetBuf.Append( _L("\t") );
- pRetBuf.Append( aCaption );
- pRetBuf.Append( _L("\t\t") );
- pRetBuf.Append( aValue );
- return retBuf;
- }
-
-HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TInt aValue )
- {
- HBufC* retBuf = HBufC::NewL( KMaxName );
- TPtr pRetBuf( retBuf->Des() );
- pRetBuf.Zero();
-
- TBuf<KMemSpyBufferSize> val;
- val.Format( KMemSpyDecFormat, aValue );
-
- pRetBuf.Append( _L("\t") );
- pRetBuf.Append( aCaption );
- pRetBuf.Append( _L("\t\t") );
- pRetBuf.Append( val );
-
- return retBuf;
- }
-
-HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TUint aValue )
- {
- HBufC* retBuf = HBufC::NewL( KMaxName );
- TPtr pRetBuf( retBuf->Des() );
- pRetBuf.Zero();
-
- TBuf<KMemSpyBufferSize> val;
- //val.Format( KMemSpyDecFormat, aValue );
- val.Format( KMemSpyHexFormat, aValue );
-
- pRetBuf.Append( _L("\t") );
- pRetBuf.Append( aCaption );
- pRetBuf.Append( _L("\t\t") );
- pRetBuf.Append( val );
-
- return retBuf;
- }
-
-HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, const TInt64& aValue )
- {
- HBufC* retBuf = HBufC::NewL( KMaxName );
- TPtr pRetBuf( retBuf->Des() );
- pRetBuf.Zero();
-
- TBuf<KMemSpyBufferSize> val;
- val.Format( KMemSpyLongFormat, aValue );
-
- pRetBuf.Append( _L("\t") );
- pRetBuf.Append( aCaption );
- pRetBuf.Append( _L("\t\t") );
- pRetBuf.Append( val );
-
- return retBuf;
- }
-
-HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TAny* aValue )
- {
- HBufC* retBuf = HBufC::NewL( KMaxName );
- TPtr pRetBuf( retBuf->Des() );
- pRetBuf.Zero();
-
- TBuf<KMemSpyBufferSize> val;
- val.Format( KMemSpyHexFormat, aValue );
-
- pRetBuf.Append( _L("\t") );
- pRetBuf.Append( aCaption );
- pRetBuf.Append( _L("\t\t") );
- pRetBuf.Append( val );
-
- return retBuf;
- }
-
-HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TUint* aValue )
- {
- HBufC* retBuf = HBufC::NewL( KMaxName );
- TPtr pRetBuf( retBuf->Des() );
- pRetBuf.Zero();
-
- TBuf<KMemSpyBufferSize> val;
- val.Format( KMemSpyHexFormat, aValue );
-
- pRetBuf.Append( _L("\t") );
- pRetBuf.Append( aCaption );
- pRetBuf.Append( _L("\t\t") );
- pRetBuf.Append( val );
-
- return retBuf;
- }
-
-HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TUint8* aValue )
- {
- HBufC* retBuf = HBufC::NewL( KMaxName );
- TPtr pRetBuf( retBuf->Des() );
- pRetBuf.Zero();
-
- TBuf<KMemSpyBufferSize> val;
- val.Format( KMemSpyHexFormat, aValue );
-
- pRetBuf.Append( _L("\t") );
- pRetBuf.Append( aCaption );
- pRetBuf.Append( _L("\t\t") );
- pRetBuf.Append( val );
-
- return retBuf;
- }
-
-HBufC* CMemSpyViewKernelHeap::FormatPercentageItem( const TDesC& aCaption, TReal aOneHundredPercentValue, TReal aValue )
- {
- HBufC* retBuf = HBufC::NewL( KMaxName ); //buffer for formatted item
- TPtr pRetBuf( retBuf->Des() );
- pRetBuf.Zero();
-
- const TReal value = (TInt) (( aValue / aOneHundredPercentValue) * 100.0); // percentage value calculation
- _LIT(KPercentFormat, "%3.2f %%");
- TMemSpyPercentText val;
- val.Format( KPercentFormat, value );
-
- pRetBuf.Append( _L("\t") );
- pRetBuf.Append( aCaption );
- pRetBuf.Append( _L("\t\t") );
- pRetBuf.Append( val );
-
- return retBuf;
- }
--- a/memspyui/ui/avkon/src/MemSpyViewKernelObjects.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,875 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewKernelObjects.h"
-
-// System includes
-#include <eikspane.h>
-#include <aknnavide.h>
-#include <akntabgrp.h>
-#include <eikclbd.h>
-#include <AknQueryDialog.h>
-#include <aknnotewrappers.h>
-#include <apgwgnam.h>
-#include <aknmessagequerydialog.h>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperkernelcontainers.h>
-#include <memspy/engine/memspyenginehelperserver.h>
-#include <memspy/engine/memspyenginehelpercondvar.h>
-
-#include <memspysession.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewKernel.h"
-#include "MemSpyContainerObserver.h"
-#include "MemSpyViewKernelContainers.h"
-
-const TInt KMaxInfoLength = 128;
-
-/*
-CMemSpyViewKernelObjects::CMemSpyViewKernelObjects( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TMemSpyDriverContainerType aObjectType )
-: CMemSpyViewBase( aEngine, aObserver ),
- iObjectType( aObjectType ),
- iCurrItemIndex( KErrNotFound )
- {
- }
-*/
-CMemSpyViewKernelObjects::CMemSpyViewKernelObjects( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TMemSpyDriverContainerType aObjectType )
-: CMemSpyViewBase( aSession, aObserver ),
- iObjectType( aObjectType ),
- iCurrItemIndex( KErrNotFound )
- {
- }
-
-
-CMemSpyViewKernelObjects::~CMemSpyViewKernelObjects()
- {
- if ( iNavContainer && iNavDecorator )
- {
- iNavContainer->Pop( iNavDecorator );
- delete iNavDecorator;
- }
- delete iModel;
- delete iItems;
- delete iObjectList;
- }
-
-
-void CMemSpyViewKernelObjects::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Kernel Objects" );
- SetTitleL( KTitle );
- iItems = new(ELeave) CDesCArrayFlat(5);
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- CreateTabsL();
- }
-
-
-CEikListBox* CMemSpyViewKernelObjects::ConstructListBoxL()
- {
- delete iListBox;
- iListBox = NULL;
- CAknSingleStyleListBox* listbox = new (ELeave) CAknSingleStyleListBox();
- iListBox = listbox;
- listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling );
- listbox->SetContainerWindowL( *this );
- listbox->CreateScrollBarFrameL( ETrue );
- SetListBoxModelL();
- listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
- listbox->SetListBoxObserver( this );
- listbox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);
- listbox->SetObserver( this );
- return listbox;
- }
-
-
-void CMemSpyViewKernelObjects::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewKernelObjects::ViewType() const
- {
- return EMemSpyViewTypeKernelObjects;
- }
-
-
-CMemSpyViewBase* CMemSpyViewKernelObjects::PrepareParentViewL()
- {
- if ( iNaviPane && iNavDecorator )
- {
- iNaviPane->Pop( iNavDecorator );
- delete iNavDecorator;
- iNavDecorator = NULL;
- }
- //CMemSpyViewBase* parent = new(ELeave) CMemSpyViewKernelContainers( iEngine, iObserver );
- CMemSpyViewBase* parent = new(ELeave) CMemSpyViewKernelContainers( iMemSpySession, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewKernelObjects::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
- if ( iListBox &&
- iListBox->Model()->NumberOfItems() &&
- iListBox->CurrentItemIndex() > KErrNotFound )
- {
- DetailsL();
- }
- return child;
- }
-
-
-void CMemSpyViewKernelObjects::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
- {
- if ( aResourceId == R_MEMSPY_MENUPANE )
- {
- if ( iObjectType > EMemSpyDriverContainerTypeProcess )
- {
- // Display Terminate, Switch to, End and Panic
- // commands only for Threads and processes
- aMenuPane->SetItemDimmed( EMemSpyCmdKernelObjects, ETrue );
- }
- }
- }
-
-
-void CMemSpyViewKernelObjects::SetListBoxModelL()
- {
- //_LIT( KLineFormatSpec, "\t%S" );
- _LIT( KTab, "\t" );
-
- iMemSpySession.GetKernelObjectItems( iKernelObjectItems, iObjectType );
-
- iModel = new (ELeave) CDesC16ArrayFlat( iKernelObjectItems.Count() + 1 ); //array for formated items, +1 added there for 0 case - creating 0-sized array panics
-
- for ( TInt i = 0; i < iKernelObjectItems.Count(); i++ )
- {
- HBufC* tempName = HBufC::NewL( iKernelObjectItems[i]->Name().Length() + 16 );
- CleanupStack::PushL( tempName );
- TPtr tempNamePtr( tempName->Des() );
- tempNamePtr.Copy( KTab );
-
- TBuf<KMaxName> temp;
- temp.Copy(iKernelObjectItems[i]->Name());
- tempNamePtr.Append( temp );
- iModel->AppendL( tempNamePtr );
-
- CleanupStack::PopAndDestroy( tempName );
- }
-
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( iModel );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-TBool CMemSpyViewKernelObjects::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdKernelObjectTerminate:
- {
- TRAPD( err, OnCmdTerminateL() );
- if ( err )
- {
- CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
- note->ExecuteLD( _L("Cannot terminate task") );
- }
- break;
- }
- case EMemSpyCmdKernelObjectSwitchTo:
- {
- TRAPD( err, OnCmdSwitchToL() );
- if ( err )
- {
- CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
- note->ExecuteLD( _L("Cannot bring to foreground") );
- }
- break;
- }
- case EMemSpyCmdKernelObjectEnd:
- {
- TRAPD( err, OnCmdEndL() );
- if ( err )
- {
- CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
- note->ExecuteLD( _L("Cannot end task") );
- }
- break;
- }
- case EMemSpyCmdKernelObjectPanic:
- {
- TRAPD( err, OnCmdPanicL() );
- if ( err )
- {
- CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
- note->ExecuteLD( _L("Cannot panic task") );
- }
- break;
- }
- default:
- {
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- }
- //
- return handled;
- }
-
-
-TKeyResponse CMemSpyViewKernelObjects::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
- {
- TKeyResponse resp = EKeyWasNotConsumed;
- resp = CMemSpyViewBase::OfferKeyEventL( aKeyEvent, aType );
- //}
- return resp;
- }
-
-void CMemSpyViewKernelObjects::TabChangedL( TInt /*aIndex*/ )
- {
- }
-
-
-void CMemSpyViewKernelObjects::OnCmdTerminateL()
- {
- 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.EndThreadL( id, ETerminate );
- 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.EndProcessL( id, ETerminate );
- RefreshL();
- }
- }
- break;
- }
- default:
- {
- // Programming error
- __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) );
- }
- }
- }
-
-
-void CMemSpyViewKernelObjects::OnCmdSwitchToL()
- {
- TBool brought = EFalse;
- /*
- TInt wgCount;
- RWsSession wsSession;
- User::LeaveIfError( wsSession.Connect() );
- CleanupClosePushL( wsSession );
- User::LeaveIfError( wgCount = wsSession.NumWindowGroups() );
- RArray<RWsSession::TWindowGroupChainInfo> wgArray;
- CleanupClosePushL( wgArray );
- User::LeaveIfError( wsSession.WindowGroupList( &wgArray ) );
- TApaTask task( wsSession );
- TBool brought( EFalse );
- TInt wgId( KErrNotFound );
- TThreadId threadId;
- */
- switch ( iObjectType )
- {
- case EMemSpyDriverContainerTypeThread:
- {
- 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-- )
- {
- wgId = wgArray[wgCount].iId;
- User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) );
- if ( threadId == currentThreadId )
- {
- CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId );
- task.SetWgId( wgId );
- if ( !wgName->Hidden() && task.Exists() )
- {
- task.BringToForeground();
- brought = ETrue;
- }
- CleanupStack::PopAndDestroy( wgName );
- }
- }
- */
- break;
- }
- case EMemSpyDriverContainerTypeProcess:
- {
- 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++ )
- {
- TInt wgCountLocal = wgCount;
-
- // loop trough all window groups and see if a thread id matches
- while( !brought && wgCountLocal-- )
- {
- wgId = wgArray[wgCountLocal].iId;
- User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) );
- if ( threadId == process.At( i ).Id() )
- {
- CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId );
- task.SetWgId( wgId );
- if ( !wgName->Hidden() && task.Exists() )
- {
- task.BringToForeground();
- brought = ETrue;
- }
- CleanupStack::PopAndDestroy( wgName );
- }
- }
- }
- */
- break;
- }
- default:
- {
- // Programming error
- __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) );
- }
- }
- if ( !brought )
- {
- // Error handling in HandleCommandL
- User::Leave( KErrGeneral );
- }
- 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.EndThreadL( id, EKill );
- RefreshL();
- }
- }
-
-
- /*
- 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 )
- {
- //
- if ( thread->IsSystemPermanent() || thread->IsSystemCritical() )
- {
- CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
- doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
- }
- //
- if ( doTerminate )
- {
- 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.EndProcessL( id, EKill);
- RefreshL();
- }
- }
-
- /*
- 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 );
-
- if ( process.IsSystemPermanent() || process.IsSystemCritical() )
- {
- CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
- doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
- }
- if ( doTerminate )
- {
- 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.EndThreadL( 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.EndProcessL( id, EPanic );
- RefreshL();
- }
- }
-
- break;
- }
- default:
- {
- // Programming error
- __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) );
- }
- }
- }
-
-
-void CMemSpyViewKernelObjects::CreateTabsL()
- {
- TMemSpyDriverContainerType type = iObjectType;
- const TPtrC pType( MemSpyUiUtils::TypeAsString( type ) );
-
- CEikStatusPane* statusPane = static_cast<CAknAppUi*> ( iEikonEnv->EikAppUi() )->StatusPane();
- TUid uid;
- uid.iUid = EEikStatusPaneUidNavi;
- iNaviPane = ( CAknNavigationControlContainer * ) statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) );
- iNavDecorator=iNaviPane->CreateMessageLabelL( pType );
- iNaviPane->PushL(*iNavDecorator);
- }
-
-
-void CMemSpyViewKernelObjects::DetailsL()
- {
- HBufC* messageBuf = HBufC::NewLC( 40960 );
- TPtr messagePtr = messageBuf->Des();
-
- //const TMemSpyDriverHandleInfoGeneric& selectedObject = iObjectList->At( iListBox->CurrentItemIndex() );
- //iKernelObjectItems[iListBox->CurrentItemIndex];
-
- // General attributes:
- TFullName name;
- name.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameDetail() );
- AppendFormatString( messagePtr, _L("Name: %S\n"), &name );
- name.Zero();
- name.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->Name() );
- AppendFormatString( messagePtr, _L("FullName: %S\n"), &name );
- name.Zero();
- AppendFormatString( messagePtr, _L("AccessCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AccessCount() );
- AppendFormatString( messagePtr, _L("UniqueID: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->UniqueID() );
- AppendFormatString( messagePtr, _L("Protection: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Protection() );
- AppendFormatString( messagePtr, _L("OwnrAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfKernelOwner() );
- AppendFormatString( messagePtr, _L("KernelAddr: 0x%08X"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Handle() );
-
- // Object type specific attributes:
- switch ( iKernelObjectItems[iListBox->CurrentItemIndex()]->Type() )
- {
- case EMemSpyDriverContainerTypeUnknown:
- {
- break;
- }
- case EMemSpyDriverContainerTypeThread:
- {
- AppendFormatString( messagePtr, _L("\nOwnrPrAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningProcess() );
- AppendFormatString( messagePtr, _L("ThreadID: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Id() );
- AppendFormatString( messagePtr, _L("Priority: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Priority() );
- TFullName procName;
- procName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameOfOwner() );
- AppendFormatString( messagePtr, _L("Proc: %S"), &procName );
- procName.Zero();
- break;
- }
- case EMemSpyDriverContainerTypeProcess:
- {
- AppendFormatString( messagePtr, _L("\nOwnrPrAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningProcess() );
- AppendFormatString( messagePtr, _L("CreatorId: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->CreatorId() );
- AppendFormatString( messagePtr, _L("Attributes: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Attributes() );
- AppendFormatString( messagePtr, _L("StckChnk: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfDataBssStackChunk() );
- AppendFormatString( messagePtr, _L("ProcessID: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Id() );
- AppendFormatString( messagePtr, _L("Priority: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Priority() );
- AppendFormatString( messagePtr, _L("SecurityZone: %d"), iKernelObjectItems[iListBox->CurrentItemIndex()]->SecurityZone() );
- /* TODO: to solve process details
- CMemSpyEngineObjectContainer& container = iEngine.Container();
- TProcessId id( iKernelObjectItems[iListBox->CurrentItemIndex().iId );
- TRAP_IGNORE(
- CMemSpyProcess& process = container.ProcessByIdL( id );
- AppendFormatString( messagePtr, _L("\nSID: 0x%08X\n"), process.SID() );
- AppendFormatString( messagePtr, _L("VID: 0x%08X\n"), process.VID() );
- AppendFormatString( messagePtr, _L("UID1: 0x%08X\n"), process.UIDs()[0].iUid );
- AppendFormatString( messagePtr, _L("UID2: 0x%08X\n"), process.UIDs()[1].iUid );
- AppendFormatString( messagePtr, _L("UID3: 0x%08X\n"), process.UIDs()[2].iUid );
- AppendFormatString( messagePtr, _L("Caps: 0x%08X%08X"), process.Capabilities().iCaps[0], process.Capabilities().iCaps[1]);
- );
- */
- break;
- }
- case EMemSpyDriverContainerTypeChunk:
- {
- AppendFormatString( messagePtr, _L("\nOwnrPrAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningProcess() );
- AppendFormatString( messagePtr, _L("Size: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Size() );
- AppendFormatString( messagePtr, _L("MaxSize: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->MaxSize() );
- AppendFormatString( messagePtr, _L("Bottom: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Bottom() );
- AppendFormatString( messagePtr, _L("Top: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Top() );
- AppendFormatString( messagePtr, _L("Attr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Attributes() );
- AppendFormatString( messagePtr, _L("Start: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->StartPos() );
- AppendFormatString( messagePtr, _L("CntrlID: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->ControllingOwner() );
- AppendFormatString( messagePtr, _L("Restrictions: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Restrictions() );
- AppendFormatString( messagePtr, _L("MapAttr: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->MapAttr() );
- AppendFormatString( messagePtr, _L("Type: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->ChunkType() );
- TFullName procName;
- procName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameOfOwner() );
- AppendFormatString( messagePtr, _L("Proc: %S"), &procName );
- procName.Zero();
- // OwnerAddr iAddressOfKernelOwner already listed
- // ProcAddr iAddressOfOwningProcess already listed
- break;
- }
- case EMemSpyDriverContainerTypeLibrary:
- {
- AppendFormatString( messagePtr, _L("\nMapCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->MapCount() );
- AppendFormatString( messagePtr, _L("State: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->State() );
- AppendFormatString( messagePtr, _L("CodeSeg: 0x%08X"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfCodeSeg() );
- break;
- }
- case EMemSpyDriverContainerTypeSemaphore:
- {
- AppendFormatString( messagePtr, _L("\nCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Count() );
- AppendFormatString( messagePtr, _L("Resetting: %u"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Resetting() );
- break;
- }
- case EMemSpyDriverContainerTypeMutex:
- {
- AppendFormatString( messagePtr, _L("\nHoldCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Count() );
- AppendFormatString( messagePtr, _L("WaitCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->WaitCount() );
- AppendFormatString( messagePtr, _L("Resetting: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Resetting() );
- AppendFormatString( messagePtr, _L("Order: %u"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Order() );
- break;
- }
- case EMemSpyDriverContainerTypeTimer:
- {
- AppendFormatString( messagePtr, _L("\nState: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->TimerState() );
- AppendFormatString( messagePtr, _L("Type: %d"), iKernelObjectItems[iListBox->CurrentItemIndex()]->TimerType() );
- break;
- }
- case EMemSpyDriverContainerTypeServer:
- {
- // Owner == ThrdAddr
- AppendFormatString( messagePtr, _L("\nThrdAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningThread() );
- TFullName thrName;
- thrName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameOfOwner() );
- AppendFormatString( messagePtr, _L("Thr: %S\n"), &thrName );
- thrName.Zero();
- AppendFormatString( messagePtr, _L("Type: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->SessionType() );
- TBuf8<55>buf;
- /*
- RArray<TMemSpyDriverServerSessionInfo> sessions;
- CleanupClosePushL( sessions );
- iEngine.HelperServer().GetServerSessionsL( iKernelObjectItems[iListBox->CurrentItemIndex(), sessions );
- const TInt count = sessions.Count();
- for ( TInt i = 0; i < count; i++ )
- {
- const TMemSpyDriverServerSessionInfo& session = sessions[ i ];
- AppendFormatString( messagePtr, _L("SessAddr: 0x%08X\n"), session.iAddress );
- TFullName sessName;
- sessName.Copy( session.iName );
- AppendFormatString( messagePtr, _L("Sess: %S\n"), &sessName );
- }
- CleanupStack::PopAndDestroy( &sessions );
- */
- break;
- }
- case EMemSpyDriverContainerTypeSession:
- {
- // Server == SvrAddr
- AppendFormatString( messagePtr, _L("\nServer: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfServer() );
- TFullName srvName;
- srvName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->Name() );
- AppendFormatString( messagePtr, _L("Srv: %S\n"), &srvName );
- srvName.Zero();
- // Session: not supported
- AppendFormatString( messagePtr, _L("AccCount: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->TotalAccessCount() );
- AppendFormatString( messagePtr, _L("SesType: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->SessionType() );
- AppendFormatString( messagePtr, _L("SvrType: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->SvrSessionType() );
- AppendFormatString( messagePtr, _L("MsgCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->MsgCount() );
- AppendFormatString( messagePtr, _L("MsgLimit: %d"), iKernelObjectItems[iListBox->CurrentItemIndex()]->MsgLimit() );
- break;
- }
- case EMemSpyDriverContainerTypeLogicalDevice:
- {
- AppendFormatString( messagePtr,
- _L("\nVersion: %d.%d.%d\n"),
- /*
- iKernelObjectItems[iListBox->CurrentItemIndex()]->Version.iMajor, TODO: To solve this
- iKernelObjectItems[iListBox->CurrentItemIndex()]->Version.iMinor,
- iKernelObjectItems[iListBox->CurrentItemIndex()]->Version.iBuild );
- */
- iKernelObjectItems[iListBox->CurrentItemIndex()]->Version(),
- iKernelObjectItems[iListBox->CurrentItemIndex()]->Version(),
- iKernelObjectItems[iListBox->CurrentItemIndex()]->Version() );
- AppendFormatString( messagePtr, _L("ParseMask: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->ParseMask() );
- AppendFormatString( messagePtr, _L("UnitsMask: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->UnitsMask() );
- AppendFormatString( messagePtr, _L("Open channels: %d"), iKernelObjectItems[iListBox->CurrentItemIndex()]->OpenChannels() );
- break;
- }
- case EMemSpyDriverContainerTypePhysicalDevice:
- {
- AppendFormatString( messagePtr,
- _L("\nVersion: %d.%d.%d\n"),
- iKernelObjectItems[iListBox->CurrentItemIndex()]->Version(),
- iKernelObjectItems[iListBox->CurrentItemIndex()]->Version(),
- iKernelObjectItems[iListBox->CurrentItemIndex()]->Version() );
- AppendFormatString( messagePtr, _L("UnitsMask: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->UnitsMask() );
- AppendFormatString( messagePtr, _L("CodeSeg: 0x%08X"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfCodeSeg() );
- break;
- }
- case EMemSpyDriverContainerTypeLogicalChannel:
- {
- // No other details
- break;
- }
- case EMemSpyDriverContainerTypeChangeNotifier:
- {
- AppendFormatString( messagePtr, _L("\nChanges: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Changes() );
- // Thread == ThrdAddr
- AppendFormatString( messagePtr, _L("ThrdAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningThread() );
- TFullName thrName;
- thrName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameOfOwner() );
- AppendFormatString( messagePtr, _L("Thr: %S"), &thrName );
- thrName.Zero();
- break;
- }
- case EMemSpyDriverContainerTypeUndertaker:
- {
- // Thread == ThrdAddr
- AppendFormatString( messagePtr, _L("\nThrdAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningThread() );
- TFullName thrName;
- thrName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameOfOwner() );
- AppendFormatString( messagePtr, _L("Thr: %S"), &thrName );
- thrName.Zero();
- break;
- }
- case EMemSpyDriverContainerTypeMsgQueue:
- {
- // No other details
- break;
- }
- case EMemSpyDriverContainerTypePropertyRef:
- {
- /*
- Not listing details here, as propertyRef is not listed in TaskMgr.
- Following propertyRef attributes are available at engine side.
-
- IsReady
- Type
- Category
- Key
- RefCount
- ThreadId
- CreatorSID
- */
- break;
- }
- case EMemSpyDriverContainerTypeCondVar:
- {
- AppendFormatString( messagePtr, _L("\nResetting: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Resetting() );
- // Using iAddressOfOwningThread for mutex
- AppendFormatString( messagePtr, _L("Mutex: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningThread() );
- // Using iNameOfOwner for mutex
- TFullName mtxName;
- mtxName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameOfOwner() );
- AppendFormatString( messagePtr, _L("Mtx: %S\n"), &mtxName );
- mtxName.Zero();
- AppendFormatString( messagePtr, _L("WaitCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->WaitCount() );
- /*
- RArray<TMemSpyDriverCondVarSuspendedThreadInfo> threads;
- CleanupClosePushL( threads );
- iEngine.HelperCondVar().GetCondVarSuspendedThreadsL( iKernelObjectItems[iListBox->CurrentItemIndex(), threads );
- const TInt count = threads.Count();
- for ( TInt i = 0; i < count; i++ )
- {
- const TMemSpyDriverCondVarSuspendedThreadInfo& thr = threads[ i ];
- AppendFormatString( messagePtr, _L("SuspThrdAddr: 0x%08X\n"), thr.iAddress );
- TFullName thrName;
- thrName.Copy( thr.iName );
- AppendFormatString( messagePtr, _L("Thr: %S\n"), &thrName );
- }
- CleanupStack::PopAndDestroy( &threads );
- */
- break;
- }
- default:
- {
- // Programming error
- __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) );
- }
- }
-
- CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog( CAknQueryDialog::ENoTone );
- dialog->PrepareLC( R_MEMSPY_KERNEL_OBJECT_DETAILS_DIALOG );
- TFileName headerText;
- headerText.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->Name() );
- dialog->SetHeaderTextL( headerText );
- dialog->SetMessageTextL(messagePtr);
- dialog->RunLD();
- CleanupStack::PopAndDestroy( messageBuf );
- }
-
-
-void CMemSpyViewKernelObjects::AppendFormatString( TPtr& aPtr, TRefByValue<const TDesC> aFmt, ... )
- {
- TBuf<KMaxInfoLength> infoString;
- VA_LIST list;
- VA_START ( list, aFmt );
- infoString.FormatList( aFmt, list );
- aPtr.Append( infoString );
- }
-
--- a/memspyui/ui/avkon/src/MemSpyViewMainMenu.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,329 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewMainMenu.h"
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-
-// User includes
-#include "MemSpyContainerObserver.h"
-#include "MemSpyViewProcesses.h"
-#include "MemSpyViewRAMInfo.h"
-#include "MemSpyViewROMInfo.h"
-#include "MemSpyViewServerList.h"
-#include "MemSpyViewOpenFiles.h"
-#include "MemSpyViewFBServBitmaps.h"
-#include "MemSpyViewSystemConfig.h"
-#include "MemSpyViewCodeSegList.h"
-#include "MemSpyViewChunkList.h"
-#include "MemSpyViewKernel.h"
-#include "MemSpyViewHeapTracking.h"
-#include "MemSpyViewDriveInfo.h"
-#include "MemSpyViewECom.h"
-#include "MemSpyViewMemoryTrackingAutoStartConfig.h"
-#include "MemSpyViewWindowGroups.h"
-
-// System includes
-#include <aknnotewrappers.h>
-
-/*
-CMemSpyViewMainMenu::CMemSpyViewMainMenu( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aEngine, aObserver )
- {
- }
-*/
-CMemSpyViewMainMenu::CMemSpyViewMainMenu( RMemSpySession& aSession, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aSession, aObserver )
- {
- }
-
-void CMemSpyViewMainMenu::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "MemSpy" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- // Make sure the correct item is selected
- const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune);
- const TInt index = IndexByViewType( viewType );
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
-
-
-void CMemSpyViewMainMenu::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewMainMenu::ViewType() const
- {
- return EMemSpyViewTypeMainMenu;
- }
-
-
-CMemSpyViewBase* CMemSpyViewMainMenu::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
- const TInt index = iListBox->CurrentItemIndex();
-
-#ifdef __WINS__
- // threads & process view is not supported in the emulator environment
- if ( index == 0 )
- {
- CAknInformationNote* note = new (ELeave) CAknInformationNote;
- note->ExecuteLD(_L("Not supported in the emulator, try Kernel -> Objects view"));
- return NULL;
- }
-#endif
-
- if ( index == 0 )
- {
- child = new(ELeave) CMemSpyViewProcesses( iMemSpySession, iObserver );
- }
- else if ( index == 1 )
- {
- //child = new(ELeave) CMemSpyViewRAMInfo( iEngine, iObserver );
- child = new(ELeave) CMemSpyViewKernel( iMemSpySession, iObserver );
- }
- else if ( index == 2 )
- {
- child = new(ELeave) CMemSpyViewHeapTracking( iMemSpySession, iObserver );
- }
- else if ( index == 3 )
- {
- child = new(ELeave) CMemSpyViewServerList( iMemSpySession, iObserver );
- }
-
- /*
- else if ( index == 2 )
- {
- child = new(ELeave) CMemSpyViewROMInfo( iEngine, iObserver );
- }
- else if ( index == 3 )
- {
- child = new(ELeave) CMemSpyViewFBServBitmaps( iEngine, iObserver );
- }
- else if ( index == 4 )
- {
- child = new(ELeave) CMemSpyViewServerList( iEngine, iObserver );
- }
- else if ( index == 5 )
- {
- child = new(ELeave) CMemSpyViewChunkList( iEngine, iObserver );
- }
- else if ( index == 6 )
- {
- child = new(ELeave) CMemSpyViewCodeSegList( iEngine, iObserver );
- }
- else if ( index == 7 )
- {
- child = new(ELeave) CMemSpyViewOpenFiles( iEngine, iObserver );
- }
- else if ( index == 8 )
- {
- child = new(ELeave) CMemSpyViewSystemConfig( iEngine, iObserver );
- }
- else if ( index == 9 )
- {
- child = new(ELeave) CMemSpyViewKernel( iEngine, iObserver );
- }
- else if ( index == 10 )
- {
- child = new(ELeave) CMemSpyViewHeapTracking( iEngine, iObserver );
- }
- */
- /*
- else if ( index == 11 )
- {
- child = new(ELeave) CMemSpyViewMemoryTrackingAutoStartConfig( iEngine, iObserver );
- }
- else if ( index == 12 )
- {
- child = new(ELeave) CMemSpyViewDriveList( iEngine, iObserver );
- }
- else if ( index == 13 )
- {
- child = new(ELeave) CMemSpyViewECom( iEngine, iObserver );
- }
- else if ( index == 14 )
- {
- child = new(ELeave) CMemSpyViewWindowGroups( iEngine, iObserver );
- }
- */
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- return child;
- }
-
-
-void CMemSpyViewMainMenu::SetListBoxModelL()
- {
- CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
- CleanupStack::PushL( model );
-
- TBuf<KMaxFullName + 1> item;
-
-
- // 1st item = Processes
- _LIT(KItem1Format, "\tProcesses & Threads");
- item.Format( KItem1Format );
- model->AppendL( item );
-
- //some main view items temporary removed
- /*
- // 2nd item = RAM info
- _LIT(KItem2Format, "\tRAM Info");
- model->AppendL( KItem2Format );
-
- // 3rd item = ROM info
- _LIT(KItem3Format, "\tROM Info");
- model->AppendL( KItem3Format );
-
- // 4th item = FBServ Bitmaps
- _LIT(KItem4Format, "\tFont & Bitmap\nServer");
- model->AppendL( KItem4Format );
- */
-
- /*
- // 6th item = Chunks
- _LIT(KItem6Format, "\tChunks");
- model->AppendL( KItem6Format );
-
- // 7th item = Code Segments
- _LIT(KItem7Format, "\tCode Segments");
- model->AppendL( KItem7Format );
-
- // 8th item = Open Files
- _LIT(KItem8Format, "\tOpen Files");
- model->AppendL( KItem8Format );
-
- // 9th item = System Config
- _LIT(KItem9Format, "\tSystem\nConfiguration");
- model->AppendL( KItem9Format );
- */
-
- // 10th item = Kernel
- _LIT(KItem2Format, "\tKernel");
- model->AppendL( KItem2Format );
-
- // 11th item = Heap Tracking
- _LIT(KItem3Format, "\tSystem-Wide Memory Tracking");
- model->AppendL( KItem3Format );
-
- // 5th item = Servers
- _LIT(KItem4Format, "\tServers");
- model->AppendL( KItem4Format );
- /*
- // 12th item = Process-specific Tracking
- _LIT(KItem12Format, "\tProcess-Specific Memory Tracking");
- model->AppendL( KItem12Format );
-
- // 13th item = Drive Info
- _LIT(KItem13Format, "\tDrive Summary");
- model->AppendL( KItem13Format );
-
- // 14th item = ECOM
- _LIT(KItem14Format, "\tECom");
- model->AppendL( KItem14Format );
-
- // 15th item = Window Groups
- _LIT(KItem15Format, "\tWindow Groups");
- model->AppendL( KItem15Format );
- */
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
- CleanupStack::Pop( model );
- }
-
-
-TInt CMemSpyViewMainMenu::IndexByViewType( TMemSpyViewType aType )
- {
- TInt index = 0;
- //
- switch( aType )
- {
- default:
-
- case EMemSpyViewTypeProcesses:
- index = 0;
- break;
-/* case EMemSpyViewTypeRAMInfo:
- index = 1;
- break;
- case EMemSpyViewTypeROMInfo:
- index = 2;
- break;
- case EMemSpyViewTypeFBServBitmaps:
- index = 3;
- break;
- */
- /*
- case EMemSpyViewTypeChunkList:
- index = 5;
- break;
- case EMemSpyViewTypeCodeSegmentList:
- index = 6;
- break;
- case EMemSpyViewTypeOpenFiles:
- index = 7;
- break;
- case EMemSpyViewTypeSystemConfig:
- index = 8;
- break;*/
-
- case EMemSpyViewTypeKernel:
- index = 1 ;
- break;
- case EMemSpyViewTypeHeapTracking:
- index = 2;
- break;
- case EMemSpyViewTypeServerList:
- index = 3;
- break;
-
-
- /*case EMemSpyViewTypeThreadInfoItemMemoryTrackingAutoStartConfig:
- index = 11;
- break;
- case EMemSpyViewTypeDriveSummary:
- index = 12;
- break;
- case EMemSpyViewTypeECom:
- index = 13;
- break;
- case EMemSpyViewTypeWindowGroups:
- index = 14;
- break;*/
- }
- //
- return index;
- }
-
--- a/memspyui/ui/avkon/src/MemSpyViewMemoryTrackingAutoStartConfig.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,570 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewMemoryTrackingAutoStartConfig.h"
-
-// System includes
-#include <AknQueryDialog.h>
-#include <charconv.h>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyengineprocessmemorytracker.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyContainerObserver.h"
-
-// Literal constants
-_LIT8( KMemSpyProcessMemoryTrackerXmlFileMimeType, "text/xml" );
-_LIT8( KMemSpyXmlSpec_MasterSection, "memspy_process_memory_tracking" );
-_LIT8( KMemSpyXmlSpec_EntryProcess, "process" );
-_LIT8( KMemSpyXmlSpec_EntryProcess_SID, "sid" );
-_LIT8( KMemSpyXmlSpec_HexPrefix, "0x" );
-
-
-
-CMemSpyViewMemoryTrackingAutoStartConfig::CMemSpyViewMemoryTrackingAutoStartConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aEngine, aObserver )
- {
- }
-
-
-CMemSpyViewMemoryTrackingAutoStartConfig::~CMemSpyViewMemoryTrackingAutoStartConfig()
- {
- iProcessUids.Close();
- //
- delete iParser;
- delete iConverter;
- //
- delete iXMLFileNameInstallTime;
- delete iXMLFileNameUserSupplied;
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- // We only convert from UTF-8 to UTF-16
- iParser = CParser::NewL( KMemSpyProcessMemoryTrackerXmlFileMimeType, *this );
- iConverter = CCnvCharacterSetConverter::NewL();
- if ( iConverter->PrepareToConvertToOrFromL( KCharacterSetIdentifierUtf8, iEngine.FsSession() ) == CCnvCharacterSetConverter::ENotAvailable )
- {
- User::Leave(KErrNotFound);
- }
-
- // Search for standard files
- FindXmlInstallTimeL();
- FindXmlUserSuppliedL();
-
- // Copy items to our own temporary list...
- const RArray<TUid>& list = iEngine.HelperProcess().MemoryTrackingAutoStartProcessList();
- for( TInt i=0; i<list.Count(); i++ )
- {
- User::LeaveIfError( iProcessUids.Append( list[ i ] ) );
- }
-
- // Reset the title
- _LIT( KCustomTitle, "Process-Specific Memory Tracking" );
- SetTitleL( KCustomTitle );
- }
-
-
-TMemSpyViewType CMemSpyViewMemoryTrackingAutoStartConfig::ViewType() const
- {
- return EMemSpyViewTypeThreadInfoItemMemoryTrackingAutoStartConfig;
- }
-
-
-CMemSpyViewBase* CMemSpyViewMemoryTrackingAutoStartConfig::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
-
- return parent;
- }
-
-
-TBool CMemSpyViewMemoryTrackingAutoStartConfig::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdMemoryTrackingAutoStartItemAdd:
- OnCmdItemAddL();
- break;
- case EMemSpyCmdMemoryTrackingAutoStartItemEdit:
- OnCmdItemEditL();
- break;
- case EMemSpyCmdMemoryTrackingAutoStartItemDelete:
- OnCmdItemDeleteL();
- break;
- case EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll:
- OnCmdItemDeleteAllL();
- break;
- case EMemSpyCmdMemoryTrackingAutoStartItemImport:
- OnCmdItemImportL();
- break;
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::HandleListBoxItemActionedL( TInt /*aIndex*/ )
- {
- OnCmdItemEditL();
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::SetListBoxModelL()
- {
- CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
- CleanupStack::PushL( model );
-
- TBuf<128> buf;
- _LIT( KProcUidFormatSpec, "\t0x%08x" );
-
- const TInt count = iProcessUids.Count();
- for( TInt i=0; i<count; i++ )
- {
- const TUid procUid = iProcessUids[ i ];
- //
- buf.Format( KProcUidFormatSpec, procUid.iUid );
- model->AppendL( buf );
- }
-
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
- CleanupStack::Pop( model );
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- iListBox->HandleItemAdditionL();
- iListBox->DrawDeferred();
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
- {
- if ( aResourceId == MenuCascadeResourceId() )
- {
- const TInt count = iProcessUids.Count();
- const TInt index = iListBox->CurrentItemIndex();
-
- // We cannot edit an item if none exists
- aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemEdit, ( count == 0 || index < 0 || index > count - 1 ) );
- aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemDelete, ( count == 0 || index < 0 || index > count - 1 ) );
- aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll, ( count <= 1 || index > count - 1 ) );
-
- // We can only import items if an XML file is available
- const TBool xmlAvailable = ( iXMLFileNameInstallTime->Length() || iXMLFileNameUserSupplied->Length() );
- aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemImport, !xmlAvailable );
- }
- }
-
-
-TUint CMemSpyViewMemoryTrackingAutoStartConfig::MenuCascadeResourceId() const
- {
- return R_MEMSPY_MENUPANE_MEMORY_TRACKING_AUTOSTART;
- }
-
-
-TInt CMemSpyViewMemoryTrackingAutoStartConfig::MenuCascadeCommandId() const
- {
- return EMemSpyCmdMemoryTrackingAutoStart;
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemAddL()
- {
- const TUid uid = ShowDialogL( KNullUid );
- if ( uid != KNullUid )
- {
- User::LeaveIfError( iProcessUids.Append( uid ) );
- SaveChangesL();
- RefreshL();
- iListBox->HandleItemAdditionL();
- iListBox->DrawDeferred();
- }
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemEditL()
- {
- const TInt index = iListBox->CurrentItemIndex();
- if ( index >= 0 && index < iProcessUids.Count() )
- {
- TUid processUid = iProcessUids[ index ];
- processUid = ShowDialogL( processUid );
- //
- if ( processUid != KNullUid )
- {
- iProcessUids[ index ] = processUid;
- SaveChangesL();
- RefreshL();
- iListBox->HandleItemAdditionL();
- iListBox->DrawDeferred();
- }
- }
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemDeleteL()
- {
- const TInt index = iListBox->CurrentItemIndex();
- if ( index >= 0 && index < iProcessUids.Count() )
- {
- iProcessUids.Remove( index );
- SaveChangesL();
- RefreshL();
- iListBox->HandleItemRemovalL();
- iListBox->DrawDeferred();
-
- const TInt newIndex = index - 1;
- const TInt count = iProcessUids.Count();
- if ( newIndex >=0 && newIndex < count )
- {
- iListBox->SetCurrentItemIndex( index );
- }
- }
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemDeleteAllL()
- {
- iProcessUids.Reset();
- SaveChangesL();
- RefreshL();
- iListBox->HandleItemRemovalL();
- iListBox->DrawDeferred();
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemImportL()
- {
- if ( iXMLFileNameInstallTime->Length() )
- {
- CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
- if ( importDialog->ExecuteLD( R_MEMSPY_MEMORY_TRACKING_IMPORT_FROM_INSTALLED_XML_DIALOG ) )
- {
- TRAP_IGNORE( ParseL( *iXMLFileNameInstallTime ) );
- }
- }
- if ( iXMLFileNameUserSupplied->Length() )
- {
- CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
- if ( importDialog->ExecuteLD( R_MEMSPY_MEMORY_TRACKING_IMPORT_FROM_USERDEFINED_XML_DIALOG ) )
- {
- TRAP_IGNORE( ParseL( *iXMLFileNameUserSupplied ) );
- }
- }
-
- SaveChangesL();
- RefreshL();
- iListBox->HandleItemRemovalL();
- iListBox->DrawDeferred();
- }
-
-
-TUid CMemSpyViewMemoryTrackingAutoStartConfig::ShowDialogL( TUid aUid )
- {
- TUid uid = KNullUid;
- //
- _LIT( KProcessUidFormat, "%x" );
- TBuf<128> buf;
- buf.Format( KProcessUidFormat, aUid );
- //
- CAknTextQueryDialog* dialog = new(ELeave) CAknTextQueryDialog( buf );
- const TBool dialogActioned = ( dialog->ExecuteLD( R_MEMSPY_MEMORY_TRACKING_PROCESS_UID_DIALOG ) );
- //
- if ( dialogActioned )
- {
- // Validate the text
- uid = ValidateProcessUid( buf );
- }
- //
- return uid;
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::SaveChangesL()
- {
- iEngine.HelperProcess().SetMemoryTrackingAutoStartProcessListL( iProcessUids );
- Settings().StoreSettingsL();
- }
-
-
-TUid CMemSpyViewMemoryTrackingAutoStartConfig::ValidateProcessUid( const TDesC& aUid )
- {
- TUid ret = KNullUid;
- TBool isValid = ETrue;
- //
- const TInt length = aUid.Length();
- for( TInt i=0; i<length && isValid; i++ )
- {
- const TChar charValue = aUid[ i ];
- //
- switch( charValue )
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case 'a':
- case 'A':
- case 'b':
- case 'B':
- case 'c':
- case 'C':
- case 'd':
- case 'D':
- case 'e':
- case 'E':
- case 'f':
- case 'F':
- break;
- default:
- isValid = EFalse;
- break;
- }
- }
- //
- if ( isValid )
- {
- TUint32 val = 0;
- TLex lexer( aUid );
- if ( lexer.Val( val, EHex ) == KErrNone )
- {
- ret.iUid = val;
- }
- }
- //
- return ret;
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::FindXmlInstallTimeL()
- {
- RFs& fsSession = iEngine.FsSession();
- //
- TFileName* fileName = new(ELeave) TFileName();
- CleanupStack::PushL( fileName );
- //
- fsSession.PrivatePath( *fileName );
- //
- TFindFile findFile( fsSession );
- if ( findFile.FindByPath( KMemSpyProcessMemoryTrackingAutoStartConfigFileName, fileName ) == KErrNone )
- {
- iXMLFileNameInstallTime = findFile.File().AllocL();
- }
- else
- {
- iXMLFileNameInstallTime = KNullDesC().AllocL();
- RDebug::Print( _L("CMemSpyViewMemoryTrackingAutoStartConfig::FindXmlInstallTimeL() - NO FILE FOUND") );
- }
- //
- CleanupStack::PopAndDestroy( fileName );
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::FindXmlUserSuppliedL()
- {
- TFindFile findFile( iEngine.FsSession() );
- if ( findFile.FindByPath( KMemSpyProcessMemoryTrackingAutoStartConfigFileName, &KMemSpyProcessMemoryTrackingAutoStartConfigSearchPath ) == KErrNone )
- {
- iXMLFileNameUserSupplied = findFile.File().AllocL();
- }
- else
- {
- iXMLFileNameUserSupplied = KNullDesC().AllocL();
- RDebug::Print( _L("CMemSpyViewMemoryTrackingAutoStartConfig::FindXmlUserSuppliedL() - NO FILE FOUND") );
- }
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::ParseL( const TDesC& aFileName )
- {
- Xml::ParseL( *iParser, iEngine.FsSession(), aFileName );
- //
- const TInt error = iParserErrorCode;
- iParserErrorCode = KErrNone;
- //
- User::LeaveIfError( error );
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnSectionProcessL( const RAttributeArray& aAttributes )
- {
- TUid uid = KNullUid;
- TBool gotSID = EFalse;
- //
- const TInt count = aAttributes.Count();
- for( TInt i=0; i<count; i++ )
- {
- const TPtrC8 attrib( aAttributes[ i ].Attribute().LocalName().DesC() );
- const TPtrC8 value( aAttributes[ i ].Value().DesC() );
- //
- if ( attrib.CompareF( KMemSpyXmlSpec_EntryProcess_SID ) == 0 )
- {
- if ( gotSID )
- {
- User::LeaveIfError( KErrCorrupt );
- }
- else
- {
- if ( value.Length() >= 8 )
- {
- TRadix radix = EDecimal;
- TPtrC8 pValue( value );
- //
- if ( value.Length() == 10 && value.Left( 2 ) == KMemSpyXmlSpec_HexPrefix )
- {
- pValue.Set( value.Mid( 2 ) );
- radix = EHex;
- }
- //
- TUint32 uidVal = 0;
- TLex8 lexer( pValue );
- const TInt err = lexer.Val( uidVal, radix );
- User::LeaveIfError( err );
- uid.iUid = uidVal;
- gotSID = ETrue;
- }
- }
- }
- }
- //
- if ( gotSID )
- {
- User::LeaveIfError( iProcessUids.Append( uid ) );
- }
- else
- {
- User::Leave( KErrCorrupt );
- }
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnStartDocumentL( const RDocumentParameters& /*aDocParam*/, TInt aErrorCode )
- {
- User::LeaveIfError( aErrorCode );
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnEndDocumentL( TInt aErrorCode )
- {
- User::LeaveIfError( aErrorCode );
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode )
- {
- User::LeaveIfError( aErrorCode );
- //
- const TPtrC8 name( aElement.LocalName().DesC() );
- //
- if ( name.CompareF( KMemSpyXmlSpec_MasterSection ) == 0 )
- {
- iSeenMasterSection = ETrue;
- }
- else if ( iSeenMasterSection && name.CompareF( KMemSpyXmlSpec_EntryProcess ) == 0 )
- {
- OnSectionProcessL( aAttributes );
- }
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnEndElementL( const RTagInfo& /*aElement*/, TInt aErrorCode )
- {
- User::LeaveIfError( aErrorCode );
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnContentL( const TDesC8& /*aBytes*/, TInt aErrorCode )
- {
- User::LeaveIfError( aErrorCode );
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnStartPrefixMappingL( const RString& /*aPrefix*/, const RString& /*aUri*/, TInt aErrorCode )
- {
- User::LeaveIfError( aErrorCode );
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnEndPrefixMappingL( const RString& /*aPrefix*/, TInt aErrorCode )
- {
- User::LeaveIfError( aErrorCode );
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnIgnorableWhiteSpaceL( const TDesC8& /*aBytes*/, TInt aErrorCode )
- {
- User::LeaveIfError( aErrorCode );
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnSkippedEntityL( const RString& /*aName*/, TInt aErrorCode )
- {
- User::LeaveIfError( aErrorCode );
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnProcessingInstructionL( const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, TInt aErrorCode )
- {
- User::LeaveIfError( aErrorCode );
- }
-
-
-void CMemSpyViewMemoryTrackingAutoStartConfig::OnError( TInt aErrorCode )
- {
- iParserErrorCode = aErrorCode;
- }
-
-
-TAny* CMemSpyViewMemoryTrackingAutoStartConfig::GetExtendedInterface( const TInt32 /*aUid*/ )
- {
- return NULL;
- }
-
--- a/memspyui/ui/avkon/src/MemSpyViewOpenFiles.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,274 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewOpenFiles.h"
-
-// System includes
-#include <AknIconArray.h>
-#include <eikdef.h>
-#include <eikclbd.h>
-#include <aknconsts.h>
-#include <gulicon.h>
-#include <avkon.mbg>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewThreads.h"
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyContainerObserver.h"
-
-
-
-
-CMemSpyViewOpenFiles::CMemSpyViewOpenFiles( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aEngine, aObserver )
- {
- }
-
-
-CMemSpyViewOpenFiles::~CMemSpyViewOpenFiles()
- {
- iThreadIds.Close();
- iFileNames.Close();
- }
-
-
-void CMemSpyViewOpenFiles::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Open Files" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-CEikListBox* CMemSpyViewOpenFiles::ConstructListBoxL()
- {
- delete iListBox;
- iListBox = NULL;
- CAknDoubleGraphicStyleListBox* listbox = new (ELeave) CAknDoubleGraphicStyleListBox();
- iListBox = listbox;
- //
- listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling );
- listbox->SetContainerWindowL( *this );
- listbox->CreateScrollBarFrameL( ETrue );
- SetListBoxModelL();
- listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
- listbox->SetListBoxObserver( this );
- listbox->SetObserver( this );
-
- // Create icon array
- CAknIconArray* iconArray = new (ELeave) CAknIconArray(1);
- CleanupStack::PushL( iconArray );
-
- // Create bitmap
- CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
- CleanupStack::PushL( bitmap );
- const TInt error1 = bitmap->Create( TSize(10,10), EColor16M );
- User::LeaveIfError( error1 );
-
- // Create mask
- CFbsBitmap* mask = new(ELeave) CFbsBitmap();
- CleanupStack::PushL( mask );
- const TInt error2 = mask->Create( TSize(10,10), EColor16M );
- User::LeaveIfError( error2 );
-
- // Create icon & transfer bitmap
- CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
- CleanupStack::Pop( 2, bitmap );
- CleanupStack::PushL( icon );
-
- // Transfer icon to array
- iconArray->AppendL( icon );
- CleanupStack::Pop( icon );
-
- // Give icon array to listbox
- static_cast<CEikFormattedCellListBox*>(iListBox)->ItemDrawer()->FormattedCellData()->SetIconArrayL(iconArray);
- CleanupStack::Pop( iconArray );
- //
- return listbox;
- }
-
-
-void CMemSpyViewOpenFiles::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewOpenFiles::ViewType() const
- {
- return EMemSpyViewTypeOpenFiles;
- }
-
-
-TBool CMemSpyViewOpenFiles::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdToolsListOpenFiles:
- OnCmdListOpenFilesL();
- break;
-
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewOpenFiles::OnCmdListOpenFilesL()
- {
- iEngine.ListOpenFilesL();
- }
-
-
-CMemSpyViewBase* CMemSpyViewOpenFiles::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewOpenFiles::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
-
- // First, try to find the selected thread
- if ( iActionedThreadId )
- {
- // Try to create a view of the thread in question
- CMemSpyProcess* process = NULL;
- CMemSpyThread* thread = NULL;
- const TInt error = iEngine.Container().ProcessAndThreadByThreadId( *iActionedThreadId, process, thread );
- if ( error == KErrNone && thread != NULL )
- {
- child = new(ELeave) CMemSpyViewThreads( iEngine, iObserver, thread->Process() );
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent(), thread );
- CleanupStack::Pop( child );
- }
- }
- //
- return child;
- }
-
-
-void CMemSpyViewOpenFiles::SetListBoxModelL()
- {
- _LIT(KLineFormatSpec, "%d\t%S\t%S %S");
-
- CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
- CleanupStack::PushL( model );
-
- TBuf<KMaxFullName + 50> item;
- TMemSpySizeText valueBuf;
- TBuf<64> timeBuf;
-
- iFileNames.Reset();
- iThreadIds.Reset();
- iActionedThreadId = NULL;
-
- RFs& fsSession = iCoeEnv->FsSession();
- TOpenFileScan scanner( fsSession );
-
- CFileList* list = NULL;
- scanner.NextL( list );
-
- TIdentityRelation<TEntry> comparer( CompareTEntryObjects );
-
- while( list != NULL )
- {
- CleanupStack::PushL( list );
-
- const TInt entryCount = list->Count();
- for(TInt i=0; i<entryCount; i++)
- {
- const TEntry& entry = (*list)[ i ];
-
- // Check for duplicates
- const TInt foundIndex = iFileNames.Find( entry, comparer );
- if ( foundIndex == KErrNotFound )
- {
- // Get time and size format strings
- valueBuf = MemSpyUiUtils::FormatSizeText( entry.iSize );
- MemSpyUiUtils::FormatTimeL( timeBuf, entry.iModified );
-
- // Get just file name
- TParsePtrC parser( entry.iName );
- const TPtrC pJustName( parser.NameAndExt() );
-
- // Create item
- item.Format( KLineFormatSpec, 0, &pJustName, &valueBuf, &timeBuf );
- model->AppendL( item );
- iThreadIds.AppendL( scanner.ThreadId() );
- iFileNames.AppendL( entry );
- }
- }
-
- CleanupStack::PopAndDestroy( list );
- list = NULL;
- scanner.NextL( list );
- }
-
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
- CleanupStack::Pop( model );
- }
-
-
-void CMemSpyViewOpenFiles::HandleListBoxItemActionedL( TInt aCurrentIndex )
- {
- if ( aCurrentIndex >= 0 && aCurrentIndex < iThreadIds.Count() )
- {
- iActionedThreadId = &iThreadIds[ aCurrentIndex ];
- }
- else
- {
- iActionedThreadId = NULL;
- }
-
- // Notify observer about an item being 'fired'
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-TBool CMemSpyViewOpenFiles::CompareTEntryObjects( const TEntry& aLeft, const TEntry& aRight )
- {
- return ( aLeft.iName.CompareF( aRight.iName ) == 0 );
- }
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewProcesses.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,604 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewProcesses.h"
-
-// System includes
-#include <aknsfld.h>
-#include <AknQueryDialog.h>
-#include <memspyui.rsg>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspysession.h>
-#include <memspy/engine/memspyengineutils.h>
-
-// User includes
-#include "MemSpyViewThreads.h"
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyContainerObserver.h"
-#include "MemSpyUiUtils.h"
-
-// Constants
-const TInt KMemSpyMaxSearchTextLength = 30;
-const TInt KMemSpyMaxSearchTextLengthWithWildcards = KMemSpyMaxSearchTextLength + 4;
-
-
-CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aSession, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aSession, aObserver )
- {
- }
-
-CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aEngine, MMemSpyViewObserver& aObserver, TProcessId aId )
-: CMemSpyViewBase( aEngine, aObserver ), iCurrentProcessId( aId )
- {
- }
-
-CMemSpyViewProcesses::~CMemSpyViewProcesses()
- {
- iProcesses.Close();
- //delete iSearchField;
- delete iMatcherBuffer;
- }
-
-
-//void CMemSpyViewProcesses::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
-void CMemSpyViewProcesses::ConstructL( const TRect& aRect, CCoeControl& aContainer, TProcessId aSelectionRune )
- {
- iMemSpySession.GetProcessesL(iProcesses); // get processes array;
-
- _LIT( KTitle, "Processes\n& Threads" );
- SetTitleL( KTitle );
- //
- //CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- CMemSpyViewBase::ConstructL( aRect, aContainer );
- //
- iMatcherBuffer = HBufC::NewL( KMemSpyMaxSearchTextLengthWithWildcards );
- //
- /* TODO: to restore the Search field functionality
- iSearchField = CAknSearchField::NewL( *this, CAknSearchField::ESearch, NULL, KMemSpyMaxSearchTextLength );
-
- iSearchField->SetObserver( this );
- iSearchField->SetFocus( ETrue );
- iSearchField->SetComponentsToInheritVisibility( ETrue );
- */
- //
- if ( iCurrentProcessId > 0 )
- {
- TInt index = 0;
- // TProcessId selectedItem = aSelectionRune; //static_cast< TProcessId >( *aSelectionRune );
- for( TInt i=0; i<iProcesses.Count();i++)
- {
- if( iProcesses[i]->Id() == iCurrentProcessId )
- {
- index = i;
- }
- }
-
- if ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
- {
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
- }
- else if ( iProcesses.Count() > 0 )
- {
- iListBox->SetCurrentItemIndex( 0 );
- HandleListBoxItemSelectedL( 0 );
- }
- //
- SizeChanged();
- ActivateL();
- }
-
-
-CMemSpyProcess& CMemSpyViewProcesses::CurrentProcess() const
- {
- /*
- __ASSERT_ALWAYS( iCurrentProcess != NULL, User::Invariant() );
- return *iCurrentProcess;
- */
- }
-
-
-void CMemSpyViewProcesses::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewProcesses::ViewType() const
- {
- return EMemSpyViewTypeProcesses;
- }
-
-
-CMemSpyViewBase* CMemSpyViewProcesses::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iMemSpySession, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewProcesses::PrepareChildViewL()
- {
- CMemSpyViewThreads* child = new(ELeave) CMemSpyViewThreads( iMemSpySession, iObserver, iProcesses[iListBox->CurrentItemIndex()]->Id(), 0 );
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- return child;
-
- return 0;
- }
-
-
-void CMemSpyViewProcesses::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
- {
- if ( aResourceId == MenuCascadeResourceId() )
- {
- TInt index = iListBox->CurrentItemIndex( );
- const TBool hide = iProcesses[index]->IsDead() || iProcesses[index]->ThreadCount() == 0;
-
- //aMenuPane->SetItemDimmed( EMemSpyCmdProcessInfo, hide ); //to be added into API
- aMenuPane->SetItemDimmed( EMemSpyCmdProcessEnd, hide );
- }
- }
-
-
-TBool CMemSpyViewProcesses::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- // Sorting
- case EMemSpyCmdProcessSortById:
- OnCmdSortByIdL();
- break;
- case EMemSpyCmdProcessSortByName:
- OnCmdSortByNameL();
- break;
- case EMemSpyCmdProcessSortByThreadCount:
- OnCmdSortByThreadCountL();
- break;
- case EMemSpyCmdProcessSortByCodeSegs:
- OnCmdSortByCodeSegsL();
- break;
- case EMemSpyCmdProcessSortByHeapUsage:
- OnCmdSortByHeapUsageL();
- break;
- case EMemSpyCmdProcessSortByStackUsage:
- OnCmdSortByStackUsageL();
- break;
- // End
- case EMemSpyCmdProcessEndTerminate:
- OnCmdEndTerminateL();
- break;
- case EMemSpyCmdProcessEndKill:
- OnCmdEndKillL();
- break;
- case EMemSpyCmdProcessEndPanic:
- OnCmdEndPanicL();
- break;
- // Info
- case EMemSpyCmdProcessInfoSummary:
- OnCmdInfoSummaryL();
- break;
- case EMemSpyCmdProcessInfoHandles:
- OnCmdInfoHandlesL();
- break;
-
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewProcesses::OnCmdSortByIdL()
- {
- //iEngine.Container().SortById();
- RefreshL();
- }
-
-
-void CMemSpyViewProcesses::OnCmdSortByNameL()
- {
- //iEngine.Container().SortByName();
- RefreshL();
- }
-
-
-void CMemSpyViewProcesses::OnCmdSortByThreadCountL()
- {
- //iEngine.Container().SortByThreadCount();
- RefreshL();
- }
-
-
-void CMemSpyViewProcesses::OnCmdSortByCodeSegsL()
- {
- //iEngine.Container().SortByCodeSegs();
- RefreshL();
- }
-
-
-void CMemSpyViewProcesses::OnCmdSortByHeapUsageL()
- {
- //iEngine.Container().SortByHeapUsage();
- RefreshL();
- }
-
-
-void CMemSpyViewProcesses::OnCmdSortByStackUsageL()
- {
- // iEngine.Container().SortByStackUsage();
- RefreshL();
- }
-
-
-void CMemSpyViewProcesses::OnCmdInfoSummaryL()
- {
- //CMemSpyProcess& process = CurrentProcess();
- //iEngine.HelperProcess().OutputProcessInfoL( process );
- }
-
-
-void CMemSpyViewProcesses::OnCmdInfoHandlesL()
- {
- /*
- CMemSpyProcess& process = CurrentProcess();
- //
- const TInt threadCount = process.Count();
- for( TInt i=0; i<threadCount; i++ )
- {
- CMemSpyThread& thread = process.At( i );
- thread.InfoContainerForceSyncronousConstructionL().PrintL();
- }
- */
- }
-
-
-void CMemSpyViewProcesses::OnCmdEndTerminateL()
- {
- TBool system = ETrue;
- TBool doTerminate = ETrue;
- TInt err = KErrNone;
-
- iMemSpySession.ProcessSystemPermanentOrCritical( iCurrentProcessId, system );
-
- if ( system )
- {
- CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
- doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
- }
-
- if ( doTerminate )
- {
- TRAP( err, iMemSpySession.EndProcessL( iCurrentProcessId, ETerminate ) );
- if( err = KErrNone )
- RefreshL();
- }
- }
-
-
-void CMemSpyViewProcesses::OnCmdEndPanicL()
- {
- TBool system = ETrue;
- TBool doTerminate = ETrue;
- TInt err = KErrNone;
-
- iMemSpySession.ProcessSystemPermanentOrCritical( iCurrentProcessId, system );
-
- if ( system )
- {
- CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
- doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
- }
-
- if ( doTerminate )
- {
- TRAP( err, iMemSpySession.EndProcessL( iCurrentProcessId, EPanic ) );
- if( err == KErrNone )
- RefreshL();
- }
- }
-
-
-void CMemSpyViewProcesses::OnCmdEndKillL()
- {
- TBool system = ETrue;
- TBool doTerminate = ETrue;
- TInt err = KErrNone;
-
- iMemSpySession.ProcessSystemPermanentOrCritical( iCurrentProcessId, system );
-
- if ( system )
- {
- CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
- doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
- }
-
- if ( doTerminate )
- {
- TRAP( err, iMemSpySession.EndProcessL( iCurrentProcessId, EKill ) )
- if( err == KErrNone )
- RefreshL();
- }
- }
-
-
-
-
-void CMemSpyViewProcesses::SetListBoxModelL()
- {
- if( iProcesses.Count() > 0 )
- {
- iProcesses.Close();
- }
-
- iMemSpySession.GetProcessesL(iProcesses); // get processes array;
- iModel = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 1); //array for formated items
-
- _LIT( KTab, "\t" );
- iModel = FormatModel( iProcesses ); //TODO Format model method with advanced formatting
-
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- //listbox->Model()->SetItemTextArray( &iEngine.Container() );
- listbox->Model()->SetItemTextArray( iModel );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewProcesses::HandleListBoxItemActionedL( TInt /*aIndex*/ )
- {
- // Notify observer about an item being 'fired'
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewProcesses::HandleListBoxItemSelectedL( TInt aIndex )
- {
- iCurrentProcessId = iProcesses[aIndex]->Id();
- /*
- if ( iCurrentProcess )
- {
- iCurrentProcess->Close();
- }
-
- // Obtain the process that corresponds to the selected item
- CMemSpyEngineObjectContainer& container = iEngine.Container();
- CMemSpyProcess& process = container.At( aIndex );
- iCurrentProcess = &process;
-
- // Notify observer about item selection
- */
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-
-
-void CMemSpyViewProcesses::SizeChanged()
- {
- const TRect rect( Rect() );
- CMemSpyViewBase::SizeChanged();
- /*
- if ( iListBox && iSearchField )
- {
- const TInt lafIndex_H = 1;
- AknLayoutUtils::LayoutControl( iListBox, rect, AknLayout::list_gen_pane( lafIndex_H ) );
- AknLayoutUtils::LayoutControl( iSearchField, rect, AknLayout::find_pane() );
- }
- else
- {
- CMemSpyViewBase::SizeChanged();
- }
- */
-
-/*
- // Search field
- TSize searchFieldSize( iSearchField->MinimumSize() ); // BALLS: search field doesn't implement minimum size correctly?!?!?
- searchFieldSize.SetWidth( rect.Width() );
- const TRect searchFieldRect( TPoint( rect.iTl.iX, rect.iBr.iY ), searchFieldSize );
- iSearchField->SetRect( searchFieldRect );
-
- // Listbox
- TSize listBoxSize( rect.Size() - TSize( 0, searchFieldSize.iHeight ) );
- iListBox->SetRect( rect.iTl, listBoxSize );
-*/
- }
-
-
-TInt CMemSpyViewProcesses::CountComponentControls() const
- {
- TInt count = 0;
- //
- if ( iListBox != NULL )
- {
- ++count;
- }
- /*if ( iSearchField != NULL )
- {
- ++count;
- }*/
- //
- return count;
- }
-
-
-CCoeControl* CMemSpyViewProcesses::ComponentControl( TInt aIndex ) const
- {
- CCoeControl* ret = iListBox;
- //
- if ( aIndex == 1 )
- {
- //ret = iSearchField;
- }
- //
- return ret;
- }
-
-
-TKeyResponse CMemSpyViewProcesses::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
- {
- TKeyResponse resp = EKeyWasNotConsumed;
- //
- if ( aType == EEventKey )
- {
- switch( aKeyEvent.iCode )
- {
- case EKeyUpArrow:
- case EKeyDownArrow:
- case EKeyEnter:
- case EKeyOK:
- if ( iListBox )
- {
- resp = iListBox->OfferKeyEventL( aKeyEvent, aType );
- }
- break;
- default:
- break;
- }
- //
- if ( resp == EKeyWasNotConsumed )
- {
- // Do we need to show the find field?
- //resp = iSearchField->OfferKeyEventL( aKeyEvent, aType );
- }
- }
- //
- return resp;
- }
-
-
-void CMemSpyViewProcesses::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
- {
- CMemSpyViewBase::HandleControlEventL( aControl, aEventType );
- //
- if ( aEventType == MCoeControlObserver::EEventStateChanged )
- {
- /*
- if ( aControl == iSearchField )
- {
- SelectListBoxItemByFindTextL();
- }
- */
- }
- }
-
-
-void CMemSpyViewProcesses::FocusChanged( TDrawNow /*aDrawNow*/ )
- {
- if ( iListBox )
- {
- iListBox->SetFocus( IsFocused() );
- }
- /*if ( iSearchField )
- {
- iSearchField->SetFocus( IsFocused() );
- }
- */
- }
-
-
-void CMemSpyViewProcesses::SelectListBoxItemByFindTextL()
- {
- /*
- _LIT( KMemSpyWildcardCharacter, "*" );
-
- TPtr pBuffer( iMatcherBuffer->Des() );
- iSearchField->GetSearchText( pBuffer );
- //pBuffer.Insert( 0, KMemSpyWildcardCharacter );
- pBuffer.Append( KMemSpyWildcardCharacter );
-
- CMemSpyEngineObjectContainer& container = iEngine.Container();
- const TInt count = container.Count();
- //
- TInt index = 0;
- while( index < count )
- {
- CMemSpyProcess& process = container.At( index );
- const TPtrC processName( process.Name() );
- //
- if ( processName.MatchF( pBuffer ) >= 0 )
- {
- HandleListBoxItemSelectedL( index );
- iListBox->ScrollToMakeItemVisible( index );
- iListBox->SetCurrentItemIndexAndDraw( index );
- return;
- }
-
- ++index;
- }
- */
- }
-
-//Model formating methods
-//TODO: to be debbuged
-
-CDesCArrayFlat* CMemSpyViewProcesses::FormatModel( RArray<CMemSpyApiProcess*> aProcesses )
- {
- model = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 16 ); //array for formated items
- _LIT( KMemSpyProcessNameFormatSpecBasicName, " \t%S\t\t%8x, " );
-
- for( TInt i=0; i < aProcesses.Count(); i++ )
- {
- HBufC* tempName = HBufC::NewL( KMaxFullName ); //aProcesses[i]->Name().Length() + 16
- CleanupStack::PushL( tempName );
- TPtr tempNamePtr( tempName->Des() );
- tempNamePtr.Copy( aProcesses[i]->Name() );
-
- TBuf<10> priority;
- TProcessPriority tempPriority = aProcesses[i]->Priority();
- MemSpyUiUtils::AppendPriority( priority, tempPriority );
-
- // Convert the full name to the format we want in the UI
- TBuf<KMaxFullName + 60> name;
- TMemSpyTruncateOverflow overflow; //included from EngineUtils TODO: to consider if this is needed to be removed or left there
- TUint32 tempSID = aProcesses[i]->SID();
- name.AppendFormat( KMemSpyProcessNameFormatSpecBasicName, &overflow, tempName, tempSID ); //tempNamePtr
-
- if( aProcesses[i]->ExitType() != EExitPending ) // instead of IsDead() method
- {
- MemSpyUiUtils::AppendExitInfo( name, aProcesses[i]->ExitType(), aProcesses[i]->ExitReason(), aProcesses[i]->ExitCategory() );
- }
- else
- {
- _LIT( KMemSpyProcessNameFormatSpecAlive, "%2d thr, %S" );
- name.AppendFormat( KMemSpyProcessNameFormatSpecAlive, &overflow, aProcesses[i]->ThreadCount(), &priority );
- }
-
- model->AppendL( name );
-
- CleanupStack::PopAndDestroy( tempName );
- }
-
- return model;
- }
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewRAMInfo.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewRAMInfo.h"
-
-// System includes
-#include <hal.h>
-#include <aknnotedialog.h>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperram.h>
-#include <memspy/engine/memspyengineutils.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyContainerObserver.h"
-
-
-
-
-
-
-CMemSpyViewRAMInfo::CMemSpyViewRAMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aEngine, aObserver )
- {
- }
-
-
-void CMemSpyViewRAMInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "RAM Info" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-void CMemSpyViewRAMInfo::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewRAMInfo::ViewType() const
- {
- return EMemSpyViewTypeRAMInfo;
- }
-
-
-CMemSpyViewBase* CMemSpyViewRAMInfo::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewRAMInfo::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
- return child;
- }
-
-
-void CMemSpyViewRAMInfo::SetListBoxModelL()
- {
- CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
- CleanupStack::PushL( model );
-
- TBuf<KMaxFullName + 1> item;
-
- TInt value;
- TMemSpySizeText size;
- TMemoryInfoV1Buf memInfoBuf;
- UserHal::MemoryInfo( memInfoBuf );
- const TMemoryInfoV1 memInfo( memInfoBuf() );
-
- // 1st item = Total RAM
- _LIT(KItem1Format, "\tTotal RAM\t\t%S");
- size = MemSpyUiUtils::FormatSizeText( memInfo.iTotalRamInBytes );
- item.Format( KItem1Format, &size );
- model->AppendL( item );
-
- // 2nd item = Max free RAM
- _LIT(KItem2Format, "\tMax Free RAM\t\t%S");
- size = MemSpyUiUtils::FormatSizeText( memInfo.iMaxFreeRamInBytes );
- item.Format( KItem2Format, &size );
- model->AppendL( item );
-
- // 3rd item = Free RAM
- _LIT(KItem3Format, "\tFree RAM\t\t%S (%S)");
- const TMemSpyPercentText freeRamPercentage( MemSpyEngineUtils::FormatPercentage( TReal( memInfo.iTotalRamInBytes ), TReal( memInfo.iFreeRamInBytes ) ) );
- size = MemSpyUiUtils::FormatSizeText( memInfo.iFreeRamInBytes );
- item.Format( KItem3Format, &size, &freeRamPercentage );
- model->AppendL( item );
-
- // 4th item = RAM disk info
- _LIT(KItem4Format, "\tRAM Disk Size\t\t%S");
- size = MemSpyUiUtils::FormatSizeText( memInfo.iInternalDiskRamInBytes );
- item.Format( KItem4Format, &size );
- model->AppendL( item );
-
- // 5th item = Max RAM disk size
- _LIT(KItem5Format, "\tMax RAM Disk Size\t\t%S");
- HAL::Get( HALData::EMaxRAMDriveSize, value );
- size = MemSpyUiUtils::FormatSizeText( value );
- item.Format( KItem5Format, &size );
- model->AppendL( item );
-
- // 6th item = RAM page size
- _LIT(KItem6Format, "\tMemory Page Size\t\t%S");
- HAL::Get( HALData::EMemoryPageSize, value );
- size = MemSpyUiUtils::FormatSizeText( value );
- item.Format( KItem6Format, &size );
- model->AppendL( item );
-
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
- CleanupStack::Pop( model );
- }
-
-
-TBool CMemSpyViewRAMInfo::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- if ( iEngine.HelperRAM().IsAknIconCacheConfigurable() )
- {
- switch ( aCommand )
- {
- case EMemSpyCmdRAMAvkonIconCacheDisabled:
- OnCmdSetIconCacheStatusL( EFalse );
- break;
- case EMemSpyCmdRAMAvkonIconCacheEnabled:
- OnCmdSetIconCacheStatusL( ETrue );
- break;
-
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- }
- else
- {
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewRAMInfo::OnCmdSetIconCacheStatusL( TBool aEnabled )
- {
- ASSERT( iEngine.HelperRAM().IsAknIconCacheConfigurable() );
- //
- const TInt64 savedAmount = iEngine.HelperRAM().SetAknIconCacheStatusL( aEnabled );
- if ( !aEnabled )
- {
- TBuf<128> buf;
- //
- if ( savedAmount != 0 )
- {
- _LIT(KSavedAmountFormatBuffer, "Saved %S of RAM");
- const TMemSpySizeText savedAmountString( MemSpyEngineUtils::FormatSizeText( savedAmount, 0, EFalse ) );
- buf.Format( KSavedAmountFormatBuffer, &savedAmountString );
- }
- else
- {
- _LIT(KDidNotSaveAnyRAM, "Operation did not save any RAM");
- buf.Copy( KDidNotSaveAnyRAM );
- }
-
- // Show dialog
- CAknNoteDialog* note = new( ELeave ) CAknNoteDialog( CAknNoteDialog::ENoTone );
- CleanupStack::PushL( note );
- note->SetTextWrapping( ETrue );
- note->PrepareLC( R_MEMSPY_RAM_MEMORY_DELTA_DIALOG );
- note->SetTextL( buf );
- CleanupStack::Pop( note );
- note->RunLD();
- }
- //
- RefreshL();
- }
--- a/memspyui/ui/avkon/src/MemSpyViewROMInfo.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,270 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewROMInfo.h"
-
-// System includes
-#include <hal.h>
-#ifdef __EPOC32__
-#include <e32rom.h>
-#endif
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyContainerObserver.h"
-
-// Remap of E32 DP constants, needed so MemSpy can still build on v9.1
-enum TMemSpyDemandPagingKernelConfigFlags
- {
- EMemSpyKernelConfigPagingPolicyMask = 3<<5,
- EMemSpyKernelConfigPagingPolicyNoPaging = 0<<5,
- EMemSpyKernelConfigPagingPolicyAlwaysPage = 1<<5,
- EMemSpyKernelConfigPagingPolicyDefaultUnpaged = 2<<5,
- EMemSpyKernelConfigPagingPolicyDefaultPaged = 3<<5,
- };
-
-
-
-CMemSpyViewROMInfo::CMemSpyViewROMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aEngine, aObserver )
- {
- }
-
-
-void CMemSpyViewROMInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "ROM Info" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-void CMemSpyViewROMInfo::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewROMInfo::ViewType() const
- {
- return EMemSpyViewTypeROMInfo;
- }
-
-
-CMemSpyViewBase* CMemSpyViewROMInfo::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewROMInfo::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
- return child;
- }
-
-
-void CMemSpyViewROMInfo::SetListBoxModelL()
- {
- CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
- CleanupStack::PushL( model );
-
- TBuf<KMaxFullName + 1> item;
-
- TInt value = 0;
- TMemSpySizeText valueBuf;
- TMemSpySizeText valueBuf2;
-
- // 1st item = Total RAM
- _LIT(KItem1Format, "\tROM Size (HAL)\t\t%S");
- HAL::Get( HALData::EMemoryROM, value );
- valueBuf = MemSpyUiUtils::FormatSizeText( value );
- item.Format( KItem1Format, &valueBuf );
- model->AppendL( item );
-
-#ifdef __EPOC32__
- TBuf<128> buf2;
- _LIT( KTimeFormatSpecLocal, "%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B" );
- const TUint main_start = UserSvr::RomHeaderAddress();
- TRomHeader* romHeader = (TRomHeader*) main_start;
-
- _LIT(KItem2Format, "\tROM Size (Header)\t\t%S");
- valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iRomSize ) );
- item.Format( KItem2Format, &valueBuf );
- model->AppendL( item );
-
- _LIT(KItem2aFormat, "\tROM Page Size\t\t%S");
- HAL::Get( HALData::EMemoryPageSize, value );
- valueBuf = MemSpyUiUtils::FormatSizeText( value );
- item.Format( KItem2aFormat, &valueBuf );
- model->AppendL( item );
-
- _LIT(KItem10Format, "\tVersion\t\tv%2d.%02d.%06d");
- item.Format( KItem10Format, romHeader->iVersion.iMajor, romHeader->iVersion.iMinor, romHeader->iVersion.iBuild );
- model->AppendL( item );
-
- _LIT(KItem3Format, "\tTimestamp\t\t%S");
- TTime time( romHeader->iTime );
- time.FormatL( buf2, KTimeFormatSpecLocal );
- item.Format( KItem3Format, &buf2 );
- model->AppendL( item );
-
- _LIT(KItem4Format, "\tAddress Range\t\t%S - %S");
- MemSpyUiUtils::FormatHex( valueBuf, romHeader->iRomBase );
- MemSpyUiUtils::FormatHex( valueBuf2, (romHeader->iRomBase + romHeader->iRomSize ));
- item.Format( KItem4Format, &valueBuf, &valueBuf2 );
- model->AppendL( item );
-
- _LIT(KItem5Format, "\tPrimary File Address\t\t%S");
- MemSpyUiUtils::FormatHex( valueBuf, romHeader->iPrimaryFile );
- item.Format( KItem5Format, &valueBuf );
- model->AppendL( item );
-
- _LIT(KItem6Format, "\tSecondary File Address\t\t%S");
- MemSpyUiUtils::FormatHex( valueBuf, romHeader->iSecondaryFile );
- item.Format( KItem6Format, &valueBuf );
- model->AppendL( item );
-
- _LIT(KItem7Format, "\tChecksum\t\t%S");
- MemSpyUiUtils::FormatHex( valueBuf, romHeader->iCheckSum );
- item.Format( KItem7Format, &valueBuf );
- model->AppendL( item );
-
- _LIT(KItem8Format, "\tKernel Config Flags\t\t%S");
- MemSpyUiUtils::FormatHex( valueBuf, romHeader->iKernelConfigFlags );
- item.Format( KItem8Format, &valueBuf );
- model->AppendL( item );
-
- if ( romHeader->iKernelConfigFlags & EKernelConfigIpcV1Available )
- {
- _LIT(KItem8aFormat, "\tIPC v1 Available\t\tYes");
- item.Copy( KItem8aFormat );
- model->AppendL( item );
- }
- if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecEnforcement )
- {
- _LIT(KItem8bFormat, "\tPlatSec Enforcement\t\tYes");
- item.Copy( KItem8bFormat );
- model->AppendL( item );
- }
- if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecDiagnostics )
- {
- _LIT(KItem8cFormat, "\tPlatSec Diagnostics\t\tYes");
- item.Copy( KItem8cFormat );
- model->AppendL( item );
- }
- if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecProcessIsolation )
- {
- _LIT(KItem8dFormat, "\tPlatSec Process Isolation\t\tYes");
- item.Copy( KItem8dFormat );
- model->AppendL( item );
- }
- if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecEnforceSysBin )
- {
- _LIT(KItem8eFormat, "\tEnforce \\Sys\\Bin\\\t\tYes");
- item.Copy( KItem8eFormat );
- model->AppendL( item );
- }
-
- const TUint32 pagingPolicy = ( romHeader->iKernelConfigFlags & EMemSpyKernelConfigPagingPolicyMask );
-#ifdef _DEBUG
- RDebug::Printf( "pagingPolicy: %u (0x%08x)", pagingPolicy, pagingPolicy );
-#endif
- _LIT(KItem8eFormat, "\tDemand Paging\t\t%S");
- //
- if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyNoPaging )
- {
- _LIT( KDemandPagingPolicyNoPaging, "No Paging" );
- item.Format( KItem8eFormat, &KDemandPagingPolicyNoPaging );
- }
- else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyAlwaysPage )
- {
- _LIT( KDemandPagingPolicyAlwaysPage, "Always Paging" );
- item.Format( KItem8eFormat, &KDemandPagingPolicyAlwaysPage);
- }
- else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyDefaultUnpaged )
- {
- _LIT( KDemandPagingPolicyDefaultUnpaged, "Default Unpaged" );
- item.Format( KItem8eFormat, &KDemandPagingPolicyDefaultUnpaged);
- }
- else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyDefaultPaged )
- {
- _LIT( KDemandPagingPolicyDefaultPaged, "Default Paged" );
- item.Format( KItem8eFormat, &KDemandPagingPolicyDefaultPaged );
- }
- //
- model->AppendL( item );
-
- _LIT(KItem9Format, "\tSection Header Address\t\t%S");
- MemSpyUiUtils::FormatHex( valueBuf, romHeader->iRomSectionHeader );
- item.Format( KItem9Format, &valueBuf );
- model->AppendL( item );
-
- _LIT(KItem11Format, "\tCompressed Size\t\t%S");
- valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iCompressedSize ) );
- item.Format( KItem11Format, &valueBuf );
- model->AppendL( item );
-
- _LIT(KItem12Format, "\tUncompressed Size\t\t%S");
- valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iUncompressedSize ) );
- item.Format( KItem12Format, &valueBuf );
- model->AppendL( item );
-
- _LIT(KItem13Format, "\tDisabled Caps. #1\t\t%S");
- MemSpyUiUtils::FormatHex( valueBuf, romHeader->iDisabledCapabilities[0] );
- item.Format( KItem13Format, &valueBuf );
- model->AppendL( item );
-
- _LIT(KItem14Format, "\tDisabled Caps. #2\t\t%S");
- MemSpyUiUtils::FormatHex( valueBuf, romHeader->iDisabledCapabilities[1] );
- item.Format( KItem14Format, &valueBuf );
- model->AppendL( item );
-
- for(TInt i=0; i<TRomHeader::KNumTraceMask; i++)
- {
- _LIT(KItem15Format, "\tTrace Mask #%d\t\t%S");
- MemSpyUiUtils::FormatHex( valueBuf, romHeader->iTraceMask[i] );
- item.Format( KItem15Format, i+1, &valueBuf );
- model->AppendL( item );
- }
-
-#endif
-
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
- CleanupStack::Pop( model );
- }
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewServerList.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,239 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewServerList.h"
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperserver.h>
-#include <memspysession.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyViewProcesses.h"
-#include "MemSpyContainerObserver.h"
-
-
-
-/*
-CMemSpyViewServerList::CMemSpyViewServerList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aEngine, aObserver )
- {
- }
-*/
-CMemSpyViewServerList::CMemSpyViewServerList( RMemSpySession& aSession, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aSession, aObserver )
- {
- }
-
-
-
-CMemSpyViewServerList::~CMemSpyViewServerList()
- {
- delete iList;
- }
-
-
-void CMemSpyViewServerList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- iSort = ESortServByName;
- _LIT( KTitle, "Running Servers" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-TBool CMemSpyViewServerList::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdServerListSortByName:
- OnCmdServerListSortByNameL();
- break;
- case EMemSpyCmdServerListSortBySessionCount:
- OnCmdServerListSortBySessionCountL();
- break;
- case EMemSpyCmdServerListOutputListCSV:
- OnCmdServerListOutputSummaryL();
- break;
- case EMemSpyCmdServerListOutputListDetailed:
- OnCmdServerListOutputDetailedL();
- break;
-
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewServerList::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewServerList::ViewType() const
- {
- return EMemSpyViewTypeServerList;
- }
-
-
-CMemSpyViewBase* CMemSpyViewServerList::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iMemSpySession, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewServerList::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
-
- if ( iActionedItemIndex )
- {
- child = new(ELeave) CMemSpyViewProcesses( iMemSpySession, iObserver, iServers[iActionedItemIndex]->Id() );
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- }
- //
-
- return child;
- }
-
-void CMemSpyViewServerList::SetListBoxModelL()
- {
- TInt err = KErrNone;
- iModel = NULL;
-
- TRAP( err, iMemSpySession.GetServersL( iServers, iSort ) );
-
- if ( err == KErrNone )
- {
- iModel = new (ELeave) CDesC16ArrayFlat( iServers.Count() ); //array for formated items
- _LIT(KSession, "session");
-
- for( TInt i = 0; i < iServers.Count(); i++ )
- {
- HBufC* combined = HBufC::NewLC( iServers[i]->Name().Length() + 128 );
-
- TPtr pCombined( combined->Des() );
- pCombined.Zero();
- pCombined.Copy( _L("\t") );
-
- if( iServers[i]->Name() != KNullDesC )
- {
- pCombined.Append( iServers[i]->Name() );
- }
-
- pCombined.Append( _L("\t\t") );
- TBuf<16> count;
- _LIT( KCount, "%d session");
-
- count.Format( KCount, iServers[i]->SessionCount() );
- pCombined.Append( count );
-
- if( iServers[i]->SessionCount() != 1 )
- {
- _LIT( KS, "s" );
- pCombined.Append( KS );
- }
-
- iModel->AppendL( pCombined );
-
- CleanupStack::PopAndDestroy(combined);
- }
- }
-
- //
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( iModel );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewServerList::HandleListBoxItemActionedL( TInt aCurrentIndex )
- {
- if ( aCurrentIndex >= 0 && aCurrentIndex < iServers.Count() )
- {
- iActionedItemIndex = aCurrentIndex;
- }
- else
- {
- iActionedItem = NULL;
- }
-
- // Notify observer about an item being 'fired'
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewServerList::OnCmdServerListSortByNameL()
- {
- iSort = ESortServByName;
- RefreshL();
- }
-
-
-void CMemSpyViewServerList::OnCmdServerListSortBySessionCountL()
- {
- iSort = ESortServBySessionCount;
- RefreshL();
- }
-
-
-void CMemSpyViewServerList::OnCmdServerListOutputSummaryL()
- {
- OnCmdServerListOutputGenericL( EFalse );
- }
-
-
-void CMemSpyViewServerList::OnCmdServerListOutputDetailedL()
- {
- OnCmdServerListOutputGenericL( ETrue );
- }
-
-
-void CMemSpyViewServerList::OnCmdServerListOutputGenericL( TBool aDetailed )
- {
- iMemSpySession.ServerListOutputGenericL( aDetailed );
- }
-
-
-
-
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewSystemConfig.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,883 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewSystemConfig.h"
-
-// System includes
-#include <hal.h>
-#include <bautils.h>
-#include <eikenv.h>
-#ifdef __EPOC32__
-#include <e32rom.h>
-#endif
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperfilesystem.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyContainerObserver.h"
-
-// Literal constants
-_LIT( KMemSpyItemValueNotKnown, "Unknown" );
-
-
-
-CMemSpyViewSystemConfig::CMemSpyViewSystemConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aEngine, aObserver )
- {
- }
-
-
-CMemSpyViewSystemConfig::~CMemSpyViewSystemConfig()
- {
- delete iModel;
- }
-
-
-void CMemSpyViewSystemConfig::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "System Configuration" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-void CMemSpyViewSystemConfig::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewSystemConfig::ViewType() const
- {
- return EMemSpyViewTypeSystemConfig;
- }
-
-
-CMemSpyViewBase* CMemSpyViewSystemConfig::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewSystemConfig::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
- return child;
- }
-
-
-void CMemSpyViewSystemConfig::SetListBoxModelL()
- {
- CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5);
- delete iModel;
- iModel = model;
-
- TBuf<128> valueBuf;
- TInt value = 0;
- TInt value2 = 0;
- TMemSpySizeText sizeBuf;
-
- //
- _LIT(KItem1Format, "Manufacturer");
- GetManufacturer( valueBuf );
- AddItemL( KItem1Format, valueBuf );
-
- //
- _LIT(KItem2Format, "Machine Uid");
- GetMachineUid( valueBuf );
- AddItemL( KItem2Format, valueBuf );
-
- //
- _LIT(KItem1aFormat, "Model Uid");
- GetHALValueAsHexL( HALData::EModel, KItem1aFormat );
-
- //
- _LIT(KItem2aFormat, "Device Family");
- GetDeviceFamily( valueBuf );
- AddItemL( KItem2aFormat, valueBuf );
-
- //
- _LIT(KItem2bFormat, "Device Family Rev.");
- GetHALValueAsNumericL( HALData::EDeviceFamilyRev, KItem2bFormat );
-
- //
- _LIT(KItem3Format, "Hardware Rev.");
- GetHALValueAsNumericL( HALData::EManufacturerHardwareRev, KItem3Format );
-
- //
- _LIT(KItem4Format, "Software Rev.");
- GetHALValueAsNumericL( HALData::EManufacturerSoftwareRev, KItem4Format );
-
- //
- _LIT(KItem5Format, "Software Build");
- GetHALValueAsNumericL( HALData::EManufacturerSoftwareBuild, KItem5Format );
-
- //
- _LIT(KItem6Format, "CPU");
- GetCPU( valueBuf );
- AddItemL( KItem6Format, valueBuf );
-
- //
- _LIT(KItem7Format, "CPU ABI");
- GetCPUABI( valueBuf );
- AddItemL( KItem7Format, valueBuf );
-
- //
- _LIT(KItem8Format, "CPU Speed");
- _LIT(KItem8Suffix, "KHz");
- GetHALValueAsNumericL( HALData::ECPUSpeed, KItem8Format, &KItem8Suffix );
-
- //
- _LIT(KItem8aFormat, "Floating Point Support");
- GetHALValueAsYesNoL( HALData::EHardwareFloatingPoint, KItem8aFormat );
-
- //
- _LIT(KItem8bFormat, "System Tick Period");
- _LIT(KItem8bSuffix, "ms");
- GetHALValueAsNumericL( HALData::ESystemTickPeriod, KItem8bFormat, &KItem8bSuffix );
-
- //
- _LIT(KItem8cFormat, "Nano Tick Period");
- _LIT(KItem8cSuffix, "us");
- GetHALValueAsNumericL( HALData::ENanoTickPeriod, KItem8cFormat, &KItem8cSuffix );
-
- //
- _LIT(KItem9Format, "Startup Reason");
- GetStartupReason( valueBuf );
- AddItemL( KItem9Format, valueBuf );
-
- //
- _LIT(KItem10Format, "Language");
- GetHALValueAsNumericL( HALData::ELanguageIndex, KItem10Format, NULL, 4 );
-
- //
- _LIT(KItem10aFormat, "Locale");
- GetHALValueAsNumericL( HALData::ELocaleLoaded, KItem10aFormat, NULL, 4 );
-
- //
- _LIT(KItem11aFormat, "Clipboard Drive");
- GetHALValueAsDriveLetterL( HALData::EClipboardDrive, KItem11aFormat );
-
- //
- _LIT(KItem11bFormat, "System Drive (Hal)");
- GetHALValueAsDriveLetterL( HALData::ESystemDrive, KItem11bFormat );
-
- //
- _LIT(KItem11cFormat, "System Drive (F32)");
- TDriveNumber systemDrive = CMemSpyEngineHelperFileSystem::GetSystemDrive();
- AddItemL( systemDrive, KItem11cFormat );
-
- //
- _LIT(KItem11dFormat, "System Drive (Bafl)");
- value = BaflUtils::GetSystemDrive( systemDrive );
- if ( value == KErrNone )
- {
- AddItemL( systemDrive, KItem11dFormat );
- }
- else
- {
- MemSpyUiUtils::GetErrorText( valueBuf, value );
- AddItemL( KItem11dFormat, valueBuf );
- }
-
- //
- _LIT(KItem12Format, "Display Type");
- GetDisplayType( valueBuf );
- AddItemL( KItem12Format, valueBuf );
- //
- _LIT(KItem12aCaption, "Display Size");
- _LIT(KItem12aFormat, "%d x %d");
- value = value2 = 0;
- GetHALValue( HALData::EDisplayXPixels, value );
- GetHALValue( HALData::EDisplayYPixels, value2 );
- valueBuf.Format( KItem12aFormat, value, value2 );
- AddItemL( KItem12aCaption, valueBuf );
-
- //
- _LIT(KItem13Format, "Display Depth");
- _LIT(KItem13Suffix, "bpp");
- GetHALValueAsNumericL( HALData::EDisplayBitsPerPixel, KItem13Format, &KItem13Suffix );
-
- //
- _LIT(KItem14Format, "Display Mode Count");
- GetHALValueAsNumericL( HALData::EDisplayNumModes, KItem14Format );
-
- //
- _LIT(KItem14aFormat, "Current Mode");
- GetHALValueAsNumericL( HALData::EDisplayMode, KItem14aFormat );
-
- //
- _LIT(KItem15Format, "Display Address");
- GetHALValueAsHexL( HALData::EDisplayMemoryAddress, KItem15Format );
-
- //
- _LIT(KItem16Format, "Screen Count");
- GetHALValueAsNumericL( HALData::EDisplayNumberOfScreens, KItem16Format );
-
- //
- _LIT(KItem17Format, "Eikon Def. Disp. Mode");
- GetDisplayMode( valueBuf, static_cast<TMemSpyDisplayMode>( CEikonEnv::Static()->DefaultDisplayMode() ) );
- AddItemL( KItem17Format, valueBuf );
-
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
- iModel = NULL;
- }
-
-
-void CMemSpyViewSystemConfig::GetManufacturer( TDes& aBuf )
- {
- TInt value = KErrGeneral;
- GetHALValue( HALData::EManufacturer, value );
- //
- switch( value )
- {
- case HALData::EManufacturer_Ericsson:
- {
- _LIT( KName, "Ericsson" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EManufacturer_Motorola:
- {
- _LIT( KName, "Motorola" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EManufacturer_Nokia:
- {
- _LIT( KName, "Nokia" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EManufacturer_Panasonic:
- {
- _LIT( KName, "Panasonic" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EManufacturer_Psion:
- {
- _LIT( KName, "Psion" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EManufacturer_Intel:
- {
- _LIT( KName, "Intel" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EManufacturer_Cogent:
- {
- _LIT( KName, "Cogent" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EManufacturer_Cirrus:
- {
- _LIT( KName, "Cirrus" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EManufacturer_Linkup:
- {
- _LIT( KName, "Linkup" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EManufacturer_TexasInstruments:
- {
- _LIT( KName, "Texas Instruments" );
- aBuf.Copy( KName );
- }
- break;
- default:
- aBuf.Copy( KMemSpyItemValueNotKnown );
- break;
- }
- }
-
-
-void CMemSpyViewSystemConfig::GetDisplayMode( TDes& aBuf, TMemSpyDisplayMode aMode )
- {
- switch( aMode )
- {
- case ENone:
- {
- _LIT( KName, "ENone" );
- aBuf.Copy( KName );
- }
- case EGray2:
- {
- _LIT( KName, "EGray2" );
- aBuf.Copy( KName );
- }
- case EGray4:
- {
- _LIT( KName, "EGray4" );
- aBuf.Copy( KName );
- }
- case EGray16:
- {
- _LIT( KName, "EGray16" );
- aBuf.Copy( KName );
- }
- case EGray256:
- {
- _LIT( KName, "EGray256" );
- aBuf.Copy( KName );
- }
- case EColor16:
- {
- _LIT( KName, "EColor16" );
- aBuf.Copy( KName );
- }
- case EColor256:
- {
- _LIT( KName, "EColor256" );
- aBuf.Copy( KName );
- }
- case EColor64K:
- {
- _LIT( KName, "EColor64K" );
- aBuf.Copy( KName );
- }
- case EColor16M:
- {
- _LIT( KName, "EColor16M" );
- aBuf.Copy( KName );
- }
- case ERgb:
- {
- _LIT( KName, "ERgb" );
- aBuf.Copy( KName );
- }
- break;
- case EColor4K:
- {
- _LIT( KName, "EColor4K" );
- aBuf.Copy( KName );
- }
- break;
- case EColor16MU:
- {
- _LIT( KName, "EColor16MU" );
- aBuf.Copy( KName );
- }
- break;
- case EColor16MA:
- {
- _LIT( KName, "EColor16MA" );
- aBuf.Copy( KName );
- }
- break;
- case EColor16MAP:
- {
- _LIT( KName, "EColor16MAP" );
- aBuf.Copy( KName );
- }
- break;
- default:
- aBuf.Copy( KMemSpyItemValueNotKnown );
- break;
- }
- }
-
-
-void CMemSpyViewSystemConfig::GetDeviceFamily( TDes& aBuf )
- {
- TInt value = KErrGeneral;
- GetHALValue( HALData::EDeviceFamily, value );
- //
- switch( value )
- {
- case HALData::EDeviceFamily_Crystal:
- {
- _LIT( KName, "Crystal" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EDeviceFamily_Pearl:
- {
- _LIT( KName, "Pearl" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EDeviceFamily_Quartz:
- {
- _LIT( KName, "Quartz" );
- aBuf.Copy( KName );
- }
- break;
- default:
- aBuf.Copy( KMemSpyItemValueNotKnown );
- break;
- }
- }
-
-
-void CMemSpyViewSystemConfig::GetCPU( TDes& aBuf )
- {
- TInt value = KErrGeneral;
- GetHALValue( HALData::ECPU, value );
- //
- switch( value )
- {
- case HALData::ECPU_ARM:
- {
- _LIT( KName, "ARM" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::ECPU_MCORE:
- {
- _LIT( KName, "mCORE" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::ECPU_X86:
- {
- _LIT( KName, "X86" );
- aBuf.Copy( KName );
- }
- break;
- default:
- aBuf.Copy( KMemSpyItemValueNotKnown );
- break;
- }
- }
-
-
-void CMemSpyViewSystemConfig::GetCPUABI( TDes& aBuf )
- {
- TInt value = KErrGeneral;
- GetHALValue( HALData::ECPUABI, value );
- //
- switch( value )
- {
- case HALData::ECPUABI_ARM4:
- {
- _LIT( KName, "ARM4" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::ECPUABI_ARMI:
- {
- _LIT( KName, "ARMI" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::ECPUABI_THUMB:
- {
- _LIT( KName, "ARM4" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::ECPUABI_MCORE:
- {
- _LIT( KName, "mCORE" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::ECPUABI_MSVC:
- {
- _LIT( KName, "MSVC" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::ECPUABI_ARM5T:
- {
- _LIT( KName, "ARM5T" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::ECPUABI_X86:
- {
- _LIT( KName, "X86" );
- aBuf.Copy( KName );
- }
- break;
- default:
- aBuf.Copy( KMemSpyItemValueNotKnown );
- break;
- }
- }
-
-
-void CMemSpyViewSystemConfig::GetStartupReason( TDes& aBuf )
- {
- TInt value = KErrGeneral;
- GetHALValue( HALData::ESystemStartupReason, value );
- //
- switch( value )
- {
- case HALData::ESystemStartupReason_Cold:
- {
- _LIT( KName, "Cold" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::ESystemStartupReason_Warm:
- {
- _LIT( KName, "Warm" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::ESystemStartupReason_Fault:
- {
- _LIT( KName, "Fault" );
- aBuf.Copy( KName );
- }
- break;
- default:
- aBuf.Copy( KMemSpyItemValueNotKnown );
- break;
- }
- }
-
-
-void CMemSpyViewSystemConfig::GetKeyboard( TDes& aBuf )
- {
- _LIT(KComma, ", ");
- TInt value = KErrGeneral;
- GetHALValue( HALData::EKeyboard, value );
- //
- aBuf.Zero();
- if ( value & EKeyboard_Keypad )
- {
- _LIT( KName, "Keypad" );
- aBuf.Copy( KName );
- }
-
-
- if ( value & EKeyboard_Full )
- {
- if ( aBuf.Length() )
- {
- aBuf.Append( KComma );
- }
-
- _LIT( KName, "Full Keyboard" );
- aBuf.Copy( KName );
- }
-
- if ( !aBuf.Length() )
- {
- aBuf.Copy( KMemSpyItemValueNotKnown );
- }
- }
-
-
-void CMemSpyViewSystemConfig::GetMachineUid( TDes& aBuf )
- {
- TInt value = KErrGeneral;
- GetHALValue( HALData::EMachineUid, value );
- //
- switch( value )
- {
- case HALData::EMachineUid_Series5mx:
- {
- _LIT( KName, "Series 5mx" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_Brutus:
- {
- _LIT( KName, "Brutus" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_Cogent:
- {
- _LIT( KName, "Cogent" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_Win32Emulator:
- {
- _LIT( KName, "Win32 Emulator" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_WinC:
- {
- _LIT( KName, "WINC" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_CL7211_Eval:
- {
- _LIT( KName, "CL7211" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_LinkUp:
- {
- _LIT( KName, "LinkUp" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_Assabet:
- {
- _LIT( KName, "Assabet" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_IQ80310:
- {
- _LIT( KName, "IQ80310" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_Lubbock:
- {
- _LIT( KName, "Lubbock" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_Integrator:
- {
- _LIT( KName, "Integrator" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_Helen:
- {
- _LIT( KName, "Helen" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_X86PC:
- {
- _LIT( KName, "X86PC" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_OmapH2:
- {
- _LIT( KName, "OmapH2" );
- aBuf.Copy( KName );
- }
- break;
- case HALData::EMachineUid_OmapH4:
- {
- _LIT( KName, "OmapH4" );
- aBuf.Copy( KName );
- }
- break;
- default:
- {
- _LIT( KName, "0x%08x" );
- aBuf.Format( KName, value );
- }
- break;
- }
- }
-
-
-void CMemSpyViewSystemConfig::GetDisplayType( TDes& aBuf )
- {
- TInt value = KErrGeneral;
- GetHALValue( HALData::EDisplayIsMono, value );
- //
- if ( value == 0 )
- {
- _LIT( KName, "Colour" );
- aBuf.Copy( KName );
- }
- else if ( value == 1 )
- {
- _LIT( KName, "Mono" );
- aBuf.Copy( KName );
- }
- else
- {
- MemSpyUiUtils::GetErrorText( aBuf, value );
- }
- }
-
-
-TInt CMemSpyViewSystemConfig::GetHALValue( HALData::TAttribute aAttribute, TInt& aValue )
- {
- aValue = KErrGeneral;
- const TInt error = HAL::Get( aAttribute, aValue );
-
-#ifdef _DEBUG
- if ( error != KErrNone )
- {
- RDebug::Printf("CMemSpyViewSystemConfig::GetHALValue() - aAttribute: %3d, error: %d, value: %d", aAttribute, error, aValue);
- }
-#endif
-
- return error;
- }
-
-
-TInt CMemSpyViewSystemConfig::GetHALValueAsNumericL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix, TInt aWidth )
- {
- TBuf<20> valueBuf;
- TInt value = 0;
- //
- const TInt error = GetHALValue( aAttribute, value );
- if ( error == KErrNone )
- {
- if ( aWidth > 0 && aWidth < 12 )
- {
- valueBuf.NumFixedWidthUC( (TUint) value, EDecimal, aWidth );
- }
- else
- {
- valueBuf.Num( value );
- }
-
- AddItemL( aCaption, valueBuf, aSuffix );
- }
- else
- {
- MemSpyUiUtils::GetErrorText( valueBuf, error );
- AddItemL( aCaption, valueBuf );
- }
- //
- return error;
- }
-
-
-TInt CMemSpyViewSystemConfig::GetHALValueAsHexL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix )
- {
- TBuf<20> valueBuf;
- TInt value = 0;
- //
- const TInt error = GetHALValue( aAttribute, value );
- if ( error == KErrNone )
- {
- MemSpyEngineUtils::FormatHex( valueBuf, value );
- AddItemL( aCaption, valueBuf, aSuffix );
- }
- else
- {
- MemSpyUiUtils::GetErrorText( valueBuf, error );
- AddItemL( aCaption, valueBuf );
- }
- //
- return error;
- }
-
-
-TInt CMemSpyViewSystemConfig::GetHALValueAsYesNoL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix )
- {
- TBuf<20> valueBuf;
- TInt value = 0;
- //
- const TInt error = GetHALValue( aAttribute, value );
- if ( error == KErrNone || error == KErrNotSupported )
- {
- _LIT(KYes, "Yes");
- _LIT(KNo, "No");
- _LIT(KError, "Error: %d");
-
- if ( error < KErrNone )
- {
- valueBuf.Format( KError, error );
- }
- else if ( value == EFalse )
- {
- valueBuf.Copy( KNo );
- }
- else if ( error == KErrNone )
- {
- valueBuf.Copy( KYes );
- }
-
- AddItemL( aCaption, valueBuf, aSuffix );
- }
- else
- {
- MemSpyUiUtils::GetErrorText( valueBuf, error );
- AddItemL( aCaption, valueBuf );
- }
- //
- return error;
- }
-
-
-TInt CMemSpyViewSystemConfig::GetHALValueAsDriveLetterL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix )
- {
- TInt value = 0;
- const TInt error = GetHALValue( aAttribute, value );
- //
- if ( error == KErrNone && ( value >= EDriveA && value <= EDriveZ ) )
- {
- AddItemL( (TDriveNumber) value, aCaption, aSuffix );
- }
- else
- {
- _LIT( KItemNotSet, "Not Defined");
- AddItemL( aCaption, KItemNotSet );
- }
- //
- return error;
- }
-
-
-void CMemSpyViewSystemConfig::AddItemL( const TDesC& aCaption, const TDesC& aValue, const TDesC* aSuffix )
- {
- _LIT(KItemFormat, "\t%S\t\t%S");
- //
- TBuf<KMaxFullName> item;
- item.Format( KItemFormat, &aCaption, &aValue );
- if ( aSuffix )
- {
- _LIT(KSpace, " ");
- item.Append( KSpace );
- item.Append( *aSuffix );
- }
- //
- iModel->AppendL( item );
- }
-
-
-void CMemSpyViewSystemConfig::AddItemL( TDriveNumber aDrive, const TDesC& aCaption, const TDesC* aSuffix )
- {
- TBuf<20> valueBuf;
- //
- const TDriveUnit drive( aDrive );
- valueBuf.Copy( drive.Name() );
- //
- AddItemL( aCaption, valueBuf, aSuffix );
- }
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemActiveObject.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewThreadInfoItemActiveObject.h"
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperactiveobject.h>
-#include <memspysession.h>
-
-// User includes
-#include "MemSpyContainerObserver.h"
-
-
-CMemSpyViewThreadInfoItemActiveObjectBase::CMemSpyViewThreadInfoItemActiveObjectBase(RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
-: CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeActiveObject )
- {
- }
-
-
-TBool CMemSpyViewThreadInfoItemActiveObjectBase::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- /*
- //
- switch ( aCommand )
- {
- case EMemSpyCmdActiveObjectListing:
- OnCmdWriteAOListingL();
- break;
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- * */
- return handled;
- }
-
-
-void CMemSpyViewThreadInfoItemActiveObjectBase::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
- {
- if ( aResourceId == R_MEMSPY_MENUPANE )
- {
- // aMenuPane->SetItemDimmed( EMemSpyCmdActiveObject, Thread().IsDead() );
- }
- }
-
-
-CMemSpyEngineActiveObjectArray& CMemSpyViewThreadInfoItemActiveObjectBase::ActiveObjectArray() const
- {
- // CMemSpyThreadInfoActiveObjects* activeObjectArray = static_cast< CMemSpyThreadInfoActiveObjects* >( iInfoItem );
- // return activeObjectArray->Array();
- }
-
-
-void CMemSpyViewThreadInfoItemActiveObjectBase::OnCmdWriteAOListingL()
- {
- iMemSpySession.OutputAOListL( ThreadId(), EMemSpyThreadInfoItemTypeActiveObject );
-
- /*
- CMemSpyEngineActiveObjectArray& objects = ActiveObjectArray();
-
- // Begin a new data stream
- _LIT( KMemSpyContext, "Active Object List - " );
- _LIT( KMemSpyFolder, "Active Objects" );
- iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
-
- // Set prefix for overall listing
- iEngine.Sink().OutputPrefixSetLC( KMemSpyContext );
-
- // Create header
- CMemSpyEngineActiveObjectArray::OutputDataColumnsL( iEngine );
-
- // List items
- const TInt count = objects.Count();
- for(TInt i=0; i<count; i++)
- {
- const CMemSpyEngineActiveObject& object = objects.At( i );
- //
- object.OutputDataL( iEngine );
- }
-
- // Tidy up
- CleanupStack::PopAndDestroy(); // prefix
-
- // End data stream
- iEngine.Sink().DataStreamEndL();
- */
- }
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewThreadInfoItemActiveObject::CMemSpyViewThreadInfoItemActiveObject( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
-: CMemSpyViewThreadInfoItemActiveObjectBase( aSession, aObserver, aProcId, aId, aType )
- {
- }
-
-
-void CMemSpyViewThreadInfoItemActiveObject::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- // Causes list of server's to be prepared
- CMemSpyViewThreadInfoItemActiveObjectBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- _LIT( KTitle, "Active Objects" );
- SetTitleL( KTitle );
-
- // Try to select the correct server
- /* TODO: to consider this
- CMemSpyThreadInfoHandleObjectBase* infoItem = static_cast< CMemSpyThreadInfoHandleObjectBase* >( iInfoItem );
- TInt selectedIndex = 0;
- if ( aSelectionRune )
- {
- CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray();
- const TInt index = activeObjectArray.ObjectIndexByAddress( aSelectionRune );
- if ( index >= 0 && index < activeObjectArray.Count() )
- {
- selectedIndex = index + 1;
- }
- }
-
- // Select item
- if ( infoItem->DetailsCount() > 0 )
- {
- */
- iListBox->SetCurrentItemIndex( 0 ); //selectedIndex
- HandleListBoxItemSelectedL( 0 ); //selectedIndex
- /*
- }
- */
- }
-
-
-TMemSpyViewType CMemSpyViewThreadInfoItemActiveObject::ViewType() const
- {
- return EMemSpyViewTypeThreadInfoItemActiveObject;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemActiveObject::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
- /*
- // Get current entry address
- TInt index = iListBox->CurrentItemIndex();
- if ( index > 0 )
- {
- --index;
- CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray();
- //
- if ( index >= 0 && index < activeObjectArray.MdcaCount() )
- {
- CMemSpyEngineActiveObject& object = activeObjectArray.At( index );
- TAny* aoAddress = object.Address();
- //
- child = new(ELeave) CMemSpyViewThreadInfoItemActiveObjectDetails( iEngine, iObserver, iInfoItem->Container(), aoAddress );
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent(), NULL );
- CleanupStack::Pop( child );
- }
- }
- //
- *
- */
- return child;
- }
-
-
-
-
-
-
-
-
-
-
-/*
-CMemSpyViewThreadInfoItemActiveObjectDetails::CMemSpyViewThreadInfoItemActiveObjectDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, TAny* aObjectAddress )
-: CMemSpyViewThreadInfoItemActiveObjectBase( aEngine, aObserver, aContainer ), iObjectAddress( aObjectAddress )
- {
- }
-
-
-void CMemSpyViewThreadInfoItemActiveObjectDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- CMemSpyViewThreadInfoItemActiveObjectBase::ConstructL( aRect, aContainer, aSelectionRune );
-
- _LIT( KTitle, "Active Object Details" );
- SetTitleL( KTitle );
- }
-
-
-TMemSpyViewType CMemSpyViewThreadInfoItemActiveObjectDetails::ViewType() const
- {
- return EMemSpyViewTypeThreadInfoItemActiveObjectDetails;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemActiveObjectDetails::PrepareParentViewL()
- {
- CMemSpyViewThreadInfoItemActiveObject* parent = new(ELeave) CMemSpyViewThreadInfoItemActiveObject( iEngine, iObserver, iInfoItem->Container() );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), iObjectAddress );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-void CMemSpyViewThreadInfoItemActiveObjectDetails::SetListBoxModelL()
- {
- // Try to find the right entry
- CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray();
- const TInt index = activeObjectArray.ObjectIndexByAddress( iObjectAddress );
- User::LeaveIfError( index );
- CMemSpyEngineActiveObject& object = activeObjectArray.At( index );
- //
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( &object );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-*/
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemChunk.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewThreadInfoItemChunk.h"
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperchunk.h>
-
-// User includes
-#include "MemSpyContainerObserver.h"
-#include "MemSpyViewChunkList.h"
-
-
-
-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();
-
- // Get the current code segment that corresponds to our currently focused list item.
- const TInt index = iListBox->CurrentItemIndex();
- if ( index >= 0 && index < list->Count() )
- {
- CMemSpyEngineChunkEntry& entry = list->At( index );
- child = new(ELeave) CMemSpyViewChunkDetails( iEngine, iObserver, *list, entry );
-
- // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
- // This object is about to die in any case.
- chunkInfoItem->NullifyList();
-
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- }
- */
- return child;
- }
-
-
-
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemCodeSeg.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewThreadInfoItemCodeSeg.h"
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelpercodesegment.h>
-
-// User includes
-#include "MemSpyContainerObserver.h"
-#include "MemSpyViewCodeSegList.h"
-
-
-
-CMemSpyViewThreadInfoItemCodeSeg::CMemSpyViewThreadInfoItemCodeSeg( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
-: CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeCodeSeg )
- {
- }
-
-
-TBool CMemSpyViewThreadInfoItemCodeSeg::HandleCommandL( TInt aCommand )
- {
- TBool handled = CMemSpyViewBase::HandleCommandL( aCommand );
- return handled;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemCodeSeg::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
- /* TODO
- // Get the code segment list
- CMemSpyThreadInfoCodeSeg* codeSegInfoItem = static_cast< CMemSpyThreadInfoCodeSeg* >( iInfoItem );
- CMemSpyEngineCodeSegList* list = &codeSegInfoItem->List();
-
- // Get the current code segment that corresponds to our currently focused list item.
- const TInt index = iListBox->CurrentItemIndex();
- if ( index >= 0 && index < list->Count() )
- {
- CMemSpyEngineCodeSegEntry& entry = list->At( index );
- child = new(ELeave) CMemSpyViewCodeSegDetails( iEngine, iObserver, *list, entry );
-
- // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now.
- // This object is about to die in any case.
- codeSegInfoItem->NullifyList();
-
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- }
- */
- return child;
- }
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneralInfo.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewThreadInfoItemGeneralInfo.h"
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspysession.h>
-
-// User includes
-#include "MemSpyContainerObserver.h"
-#include "MemSpyViewThreads.h"
-#include "MemSpyViewThreadInfoItemHeap.h"
-
-
-/*
-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 )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-
-
-void CMemSpyViewThreadInfoItemGeneralInfo::HandleListBoxItemActionedL( TInt /*aIndex*/ )
- {
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneric.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,327 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewThreadInfoItemGeneric.h"
-
-// System includes
-#include <AknWaitDialog.h>
-#include <memspyui.rsg>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspysession.h>
-
-// User includes
-#include "MemSpyContainerObserver.h"
-#include "MemSpyViewThreadInfoItemList.h"
-#include "MemSpyUiUtils.h"
-
-// Constants
-const TInt KMemSpyConstructionCheckerTimerPeriod = 500000; // 1/2 second
-
-CMemSpyViewThreadInfoItemGeneric::CMemSpyViewThreadInfoItemGeneric( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcessId, TThreadId aId, TMemSpyThreadInfoItemType aType )
-: CMemSpyViewBase( aSession, aObserver )//, iThreadId( aId ), iType( aType ) //iContainer( aInfoContainer )
- {
- iParentProcessId = aProcessId;
- iThreadId = aId;
- iType = aType;
- }
-
-
-CMemSpyViewThreadInfoItemGeneric::~CMemSpyViewThreadInfoItemGeneric()
- {/* TODO:
- if ( iInfoItem )
- {
- iInfoItem->Close();
- }
- DestroyWaitNote();
- */
- }
-
-
-void CMemSpyViewThreadInfoItemGeneric::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- const TPtrC pTitle( MemSpyUiUtils::ThreadInfoItemNameByType( iType ) );
- SetTitleL( pTitle );
-
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-CMemSpyProcess& CMemSpyViewThreadInfoItemGeneric::Process() const
- {
- // return iContainer.Thread().Process();
- }
-
-
-CMemSpyThread& CMemSpyViewThreadInfoItemGeneric::Thread() const
- {
- // return iContainer.Thread();
- }
-
-
-CMemSpyThreadInfoContainer& CMemSpyViewThreadInfoItemGeneric::Container() const
- {
- // return iContainer;
- }
-
-
-CMemSpyThreadInfoItemBase& CMemSpyViewThreadInfoItemGeneric::InfoItem() const
- {
- // __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() );
- // return *iInfoItem;
- }
-
-
-void CMemSpyViewThreadInfoItemGeneric::RefreshL()
- {
- // iInfoItem->RebuildL(); //TODO
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewThreadInfoItemGeneric::ViewType() const
- {
- TMemSpyViewType type = EMemSpyViewTypeNone;
- //
- //switch( iInfoItem->Type() )
- switch( iType )
- {
- case EMemSpyThreadInfoItemTypeHeap:
- type = EMemSpyViewTypeThreadInfoItemHeap;
- break;
- case EMemSpyThreadInfoItemTypeStack:
- type = EMemSpyViewTypeThreadInfoItemStack;
- break;
- case EMemSpyThreadInfoItemTypeChunk:
- type = EMemSpyViewTypeThreadInfoItemChunk;
- break;
- case EMemSpyThreadInfoItemTypeCodeSeg:
- type = EMemSpyViewTypeThreadInfoItemCodeSeg;
- break;
- case EMemSpyThreadInfoItemTypeServer:
- type = EMemSpyViewTypeThreadInfoItemServer;
- break;
- case EMemSpyThreadInfoItemTypeSession:
- type = EMemSpyViewTypeThreadInfoItemSession;
- break;
- case EMemSpyThreadInfoItemTypeSemaphore:
- type = EMemSpyViewTypeThreadInfoItemSemaphore;
- break;
- case EMemSpyThreadInfoItemTypeMutex:
- type = EMemSpyViewTypeThreadInfoItemMutex;
- break;
- case EMemSpyThreadInfoItemTypeTimer:
- type = EMemSpyViewTypeThreadInfoItemTimer;
- break;
- case EMemSpyThreadInfoItemTypeLDD:
- type = EMemSpyViewTypeThreadInfoItemLDD;
- break;
- case EMemSpyThreadInfoItemTypePDD:
- type = EMemSpyViewTypeThreadInfoItemPDD;
- break;
- case EMemSpyThreadInfoItemTypeLogicalChannel:
- type = EMemSpyViewTypeThreadInfoItemLogicalChannel;
- break;
- case EMemSpyThreadInfoItemTypeChangeNotifier:
- type = EMemSpyViewTypeThreadInfoItemChangeNotifier;
- break;
- case EMemSpyThreadInfoItemTypeUndertaker:
- type = EMemSpyViewTypeThreadInfoItemUndertaker;
- break;
- case EMemSpyThreadInfoItemTypeMessageQueue:
- type = EMemSpyViewTypeThreadInfoItemMessageQueue;
- break;
- case EMemSpyThreadInfoItemTypeConditionalVariable:
- type = EMemSpyViewTypeThreadInfoItemConditionalVariable;
- break;
- case EMemSpyThreadInfoItemTypeOpenFiles:
- type = EMemSpyViewTypeThreadInfoItemOpenFiles;
- break;
- case EMemSpyThreadInfoItemTypeActiveObject:
- type = EMemSpyViewTypeThreadInfoItemActiveObject;
- break;
- case EMemSpyThreadInfoItemTypeGeneralInfo:
- type = EMemSpyViewTypeThreadInfoItemGeneralInfo;
- break;
- case EMemSpyThreadInfoItemTypeOtherThreads:
- type = EMemSpyViewTypeThreadInfoItemOtherThreads;
- break;
- case EMemSpyThreadInfoItemTypeOtherProcesses:
- type = EMemSpyViewTypeThreadInfoItemOtherProcesses;
- break;
- case EMemSpyThreadInfoItemTypeOwnedThreadHandles:
- type = EMemSpyViewTypeThreadInfoItemOwnedThreadHandles;
- break;
- case EMemSpyThreadInfoItemTypeOwnedProcessHandles:
- type = EMemSpyViewTypeThreadInfoItemOwnedProcessHandles;
- break;
-
- default:
- //__ASSERT_DEBUG( EFalse, User::Invariant() );
- break;
- }
- //
- return type;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareParentViewL()
- {
- CMemSpyViewThreadInfoItemList* parent = new(ELeave) CMemSpyViewThreadInfoItemList( iMemSpySession, iObserver, iParentProcessId, iThreadId );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), iType );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareChildViewL()
- {
- //__ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() );
- CMemSpyViewBase* child = NULL;
- //
- return child;
- }
-
-
-TBool CMemSpyViewThreadInfoItemGeneric::HandleCommandL( TInt aCommand )
- {
- TBool handled = CMemSpyViewBase::HandleCommandL( aCommand );
- return handled;
- }
-
-
-void CMemSpyViewThreadInfoItemGeneric::SetListBoxModelL()
- {
- iMemSpySession.GetThreadInfoItems( iThreadInfoItems, iThreadId, iType ); // TODO don't ignore error!
-
- iModel = new (ELeave) CDesC16ArrayFlat( iThreadInfoItems.Count() + 10 );
-
- for( TInt i=0; i<iThreadInfoItems.Count(); i++)
- {
- HBufC* combined = HBufC::NewLC( iThreadInfoItems[i]->Caption().Length() + iThreadInfoItems[i]->Value().Length() + 30 );
-
- TPtr pCombined( combined->Des() );
- pCombined.Zero();
- pCombined.Copy( _L("\t") );
- if( iThreadInfoItems[i]->Caption() != KNullDesC )
- pCombined.Append( iThreadInfoItems[i]->Caption() );
- if( iType != EMemSpyThreadInfoItemTypeChunk )
- {
- pCombined.Append( _L("\t\t") );
- pCombined.Append( iThreadInfoItems[i]->Value() );
- }
-
- iModel->AppendL( pCombined );
-
- CleanupStack::PopAndDestroy(combined);
- }
-
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- //listbox->Model()->SetItemTextArray( iInfoItem );
- listbox->Model()->SetItemTextArray( iModel );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewThreadInfoItemGeneric::HandleListBoxItemActionedL( TInt /*aIndex*/ )
- {
- // Notify observer about an item being 'fired'
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewThreadInfoItemGeneric::HandleListBoxItemSelectedL( TInt /*aIndex*/ )
- {
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-
-
-
-void CMemSpyViewThreadInfoItemGeneric::ShowWaitNoteL()
- {
- // Ugly, but I'm not adding an observer mechanism just for this wait dialog.
- // __ASSERT_ALWAYS( iWaitConstructionChecker == NULL, User::Invariant() );
- iWaitConstructionChecker = CPeriodic::NewL( CActive::EPriorityLow );
- iWaitConstructionChecker->Start( KMemSpyConstructionCheckerTimerPeriod,
- KMemSpyConstructionCheckerTimerPeriod,
- TCallBack( CheckForItemConstructionComplete, this ) );
-
- if ( !iWaitNote )
- {
- iWaitNote = new ( ELeave ) CAknWaitDialog( reinterpret_cast<CEikDialog**> ( &iWaitNote ), ETrue );
- iWaitNote->ExecuteDlgLD( CAknNoteDialog::ENoTone, R_MEMSPY_PREPARING_INFO_ITEM_CONTAINER_WAIT_NOTE );
- }
- }
-
-
-void CMemSpyViewThreadInfoItemGeneric::DestroyWaitNote()
- {
-#ifdef _DEBUG
- RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::DestroyWaitNote() - START" );
-#endif
- //
- delete iWaitConstructionChecker;
- iWaitConstructionChecker = NULL;
- //
- if ( iWaitNote )
- {
- TRAP_IGNORE( iWaitNote->ProcessFinishedL() ); // deletes the dialog
- iWaitNote = NULL;
- }
- //
-#ifdef _DEBUG
- RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::DestroyWaitNote() - END" );
-#endif
- }
-
-
-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() );*/
-#endif
- //
- /*
- TBool callAgain = ETrue;
- if ( self.iInfoItem->IsReady() )
- {
- self.DestroyWaitNote();
- callAgain = EFalse;
- }
- //
- return callAgain;
- */
- }
-
-
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemHeap.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewThreadInfoItemHeap.h"
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspysession.h>
-
-// User includes
-#include "MemSpyContainerObserver.h"
-#include "MemSpyViewThreads.h"
-#include "MemSpyViewThreadInfoItemHeap.h"
-#include "MemSpyAppUi.h"
-
-
-/*
-CMemSpyViewThreadInfoItemHeap::CMemSpyViewThreadInfoItemHeap( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
-: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeHeap )
- {
- }
-*/
-CMemSpyViewThreadInfoItemHeap::CMemSpyViewThreadInfoItemHeap( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
-: CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId , EMemSpyThreadInfoItemTypeHeap )
- {
- }
-
-
-TBool CMemSpyViewThreadInfoItemHeap::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
-#ifndef __WINS__
- case EMemSpyCmdHeapDataDump:
- OnCmdHeapDataL();
- break;
-#endif
- case EMemSpyCmdHeapCellListing:
- OnCmdHeapCellListingL();
- break;
- case EMemSpyCmdHeapInfoThread:
- OnCmdHeapInfoL();
- break;
-
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewThreadInfoItemHeap::OnCmdHeapDataL()
- {
- iMemSpySession.OutputThreadHeapDataL( ThreadId() );
- }
-
-
-void CMemSpyViewThreadInfoItemHeap::OnCmdHeapCellListingL()
- {
- iMemSpySession.OutputThreadCellListL( ThreadId() );
- }
-
-
-void CMemSpyViewThreadInfoItemHeap::OnCmdHeapInfoL()
- {
- iMemSpySession.OutputHeapInfoUserL( ThreadId() );
- }
-
-
-void CMemSpyViewThreadInfoItemHeap::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
- {
- if ( aResourceId == R_MEMSPY_MENUPANE )
- {
- //aMenuPane->SetItemDimmed( EMemSpyCmdHeap, Thread().IsDead() ); //TODO
- }
- }
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemList.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,435 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewThreadInfoItemList.h"
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspysession.h>
-
-// UI Utils include
-#include "MemSpyUiUtils.h"
-
-// User includes
-#include "MemSpyContainerObserver.h"
-#include "MemSpyViewThreads.h"
-#include "MemSpyViewThreadInfoItemHeap.h"
-#include "MemSpyViewThreadInfoItemStack.h"
-#include "MemSpyViewThreadInfoItemChunk.h"
-#include "MemSpyViewThreadInfoItemCodeSeg.h"
-#include "MemSpyViewThreadInfoItemServer.h"
-#include "MemSpyViewThreadInfoItemActiveObject.h"
-#include "MemSpyViewThreadInfoItemGeneralInfo.h"
-#include "MemSpyViewThreadInfoItemMemoryTracking.h"
-
-// Constants
-const TInt KMemSpyIdleResetListboxTimerPeriod = 250000;
-
-
-CMemSpyViewThreadInfoItemList::CMemSpyViewThreadInfoItemList( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcess, TThreadId aThread )
-: CMemSpyViewBase( aSession, aObserver ), iParentProcessId( aProcess ), iThreadId( aThread )
- {
- }
-
-
-CMemSpyViewThreadInfoItemList::~CMemSpyViewThreadInfoItemList()
- {
- /* TODO:
- TRAP_IGNORE(
- CMemSpyThreadInfoContainer& container = iThread.InfoContainerL();
- container.ObserverRemove( *this );
- );
- */
- }
-
-
-
-void CMemSpyViewThreadInfoItemList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TMemSpyThreadInfoItemType aType )
- {
- _LIT( KTitle, "Thread Objects" );
- SetTitleL( KTitle );
- //
- //iIdleResetListboxTimer = CPeriodic::NewL( CActive::EPriorityIdle );
- /* TODO: to solve observer
- CMemSpyThreadInfoContainer& container = iThread.InfoContainerL();
- container.ObserverAddL( *this );
- */
- CMemSpyViewBase::ConstructL( aRect, aContainer );
- //
- if( aType > EMemSpyThreadInfoItemTypeFirst || aType < EMemSpyThreadInfoItemTypeLast )
- {
- TInt index(aType);
- if ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
- {
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
- }
- else
- {
- iListBox->SetCurrentItemIndex( 0 );
- HandleListBoxItemSelectedL( 0 );
- }
- /*if ( aSelectionRune )
- {
- CMemSpyThreadInfoItemBase* selectedItem = reinterpret_cast< CMemSpyThreadInfoItemBase* >( aSelectionRune );
- const TInt index = container.InfoItemIndexByType( selectedItem->Type() );
- if ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
- {
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
- }
- else if ( container.MdcaCount() > 0 )
- {*/
- //iListBox->SetCurrentItemIndex( 0 );
- //HandleListBoxItemSelectedL( 0 );
- //}
- }
-
-const CMemSpyThreadInfoItemBase& CMemSpyViewThreadInfoItemList::CurrentInfoItem() const
- {
- //__ASSERT_ALWAYS( iCurrentInfoItem != NULL, User::Invariant() );
- return *iCurrentInfoItem;
- }
-
-void CMemSpyViewThreadInfoItemList::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewThreadInfoItemList::ViewType() const
- {
- return EMemSpyViewTypeThreadInfoItemList;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemList::PrepareParentViewL()
- {
- CMemSpyViewBase* parent = new(ELeave) CMemSpyViewThreads( iMemSpySession, iObserver, iParentProcessId, iThreadId );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemList::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
-
- TMemSpyThreadInfoItemType type;
- iMemSpySession.GetInfoItemType( iCurrentInfoItemId, iThreadId, type );
-
- switch( type )
- {
- case EMemSpyThreadInfoItemTypeHeap:
- child = new(ELeave) CMemSpyViewThreadInfoItemHeap( iMemSpySession, iObserver, iParentProcessId, iThreadId, type );
- break;
- case EMemSpyThreadInfoItemTypeStack:
- child = new(ELeave) CMemSpyViewThreadInfoItemStack( iMemSpySession, iObserver, iParentProcessId, iThreadId, type );
- break;
- case EMemSpyThreadInfoItemTypeChunk:
- child = new(ELeave) CMemSpyViewThreadInfoItemChunk( iMemSpySession, iObserver, iParentProcessId, iThreadId, type );
- break;
- case EMemSpyThreadInfoItemTypeCodeSeg:
- child = new(ELeave) CMemSpyViewThreadInfoItemCodeSeg( iMemSpySession, iObserver, iParentProcessId, iThreadId, type );
- break;
- case EMemSpyThreadInfoItemTypeServer:
- child = new(ELeave) CMemSpyViewThreadInfoItemServer( iMemSpySession, iObserver, iParentProcessId, iThreadId, type );
- break;
- case EMemSpyThreadInfoItemTypeActiveObject:
- child = new(ELeave) CMemSpyViewThreadInfoItemActiveObject( iMemSpySession, iObserver, iParentProcessId, iThreadId, type );
- break;
- case EMemSpyThreadInfoItemTypeGeneralInfo:
- 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:
- case EMemSpyThreadInfoItemTypeTimer:
- case EMemSpyThreadInfoItemTypeLDD:
- case EMemSpyThreadInfoItemTypePDD:
- case EMemSpyThreadInfoItemTypeLogicalChannel:
- case EMemSpyThreadInfoItemTypeChangeNotifier:
- case EMemSpyThreadInfoItemTypeUndertaker:
- case EMemSpyThreadInfoItemTypeMessageQueue:
- case EMemSpyThreadInfoItemTypeConditionalVariable:
- case EMemSpyThreadInfoItemTypeOpenFiles:
- case EMemSpyThreadInfoItemTypeOtherThreads:
- case EMemSpyThreadInfoItemTypeOtherProcesses:
- case EMemSpyThreadInfoItemTypeOwnedThreadHandles:
- case EMemSpyThreadInfoItemTypeOwnedProcessHandles:
- child = new(ELeave) CMemSpyViewThreadInfoItemGeneric( iMemSpySession, iObserver, iParentProcessId, iThreadId, type );
- break;
-
- default:
- // __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0) );
- break;
- }
-
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
- return child;
- }
-
-
-TBool CMemSpyViewThreadInfoItemList::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdThreadInfoHandles:
- OnCmdInfoHandlesL();
- break;
-
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewThreadInfoItemList::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
- {
- if ( aResourceId == R_MEMSPY_MENUPANE )
- {
- // aMenuPane->SetItemDimmed( EMemSpyCmdThread, iThread.IsDead() ); //TODO
- }
- else if ( aResourceId == MenuCascadeResourceId() )
- {
- // Always remove these items - they are only shown in the master thread view
- aMenuPane->SetItemDimmed( EMemSpyCmdThreadSetPriority, ETrue );
- aMenuPane->SetItemDimmed( EMemSpyCmdThreadEnd, ETrue );
- }
- }
-
-
-void CMemSpyViewThreadInfoItemList::OnCmdInfoHandlesL()
- {
- iMemSpySession.OutputThreadInfoHandlesL( iThreadId );
- }
-
-
-void CMemSpyViewThreadInfoItemList::HandleMemSpyEngineInfoContainerEventL( TEvent aEvent, TMemSpyThreadInfoItemType aType )
- {/*
- if ( aEvent == EInfoItemChanged )
- {
- }
- else if ( aEvent == EInfoItemDestroyed )
- {
- if ( iCurrentInfoItem && iCurrentInfoItem->Type() == aType )
- {
- iCurrentInfoItem->Close();
- iCurrentInfoItem = NULL;
- }
- }
-
- iIdleResetListboxTimer->Cancel();
- iIdleResetListboxTimer->Start( KMemSpyIdleResetListboxTimerPeriod, KMemSpyIdleResetListboxTimerPeriod, TCallBack( IdleUpdateListBoxModel, this ) );
- */
- }
-
-
-void CMemSpyViewThreadInfoItemList::SetListBoxModelL()
- {
- 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 );
- }
-
-
-void CMemSpyViewThreadInfoItemList::HandleListBoxItemActionedL( TInt /*aIndex*/ )
- {
- // Notify observer about an item being 'fired'
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewThreadInfoItemList::HandleListBoxItemSelectedL( TInt aIndex )
- {
- iCurrentInfoItemId = aIndex;
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-
-
-TInt CMemSpyViewThreadInfoItemList::IdleUpdateListBoxModel( TAny* aSelf )
- {
- CMemSpyViewThreadInfoItemList* self = reinterpret_cast< CMemSpyViewThreadInfoItemList* >( aSelf );
- TRAP_IGNORE( self->DoIdleUpdateListBoxModelL() );
- return EFalse;
- }
-
-
-void CMemSpyViewThreadInfoItemList::DoIdleUpdateListBoxModelL()
- {
- /*
- CMemSpyThreadInfoContainer& container = iThread.InfoContainerL();
-
- // Try to maintain current item selection if at all possible.
- TMemSpyThreadInfoItemType type = EMemSpyThreadInfoItemTypeHeap;
- if ( iCurrentInfoItem )
- {
- type = iCurrentInfoItem->Type();
- }
-
- // Update list box & model
- SetListBoxModelL();
- iListBox->HandleItemAdditionL();
- RefreshL();
-
- // Try to select previous item if it is still available
- const TInt index = container.InfoItemIndexByType( type );
- if ( index >= 0 && index < container.MdcaCount() )
- {
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
-
- iIdleResetListboxTimer->Cancel();
- */
- }
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemMemoryTracking.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,664 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewThreadInfoItemMemoryTracking.h"
-
-// System includes
-#include <AknQueryDialog.h>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyengineprocessmemorytracker.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-
-// User includes
-#include "MemSpyContainerObserver.h"
-
-
-CMemSpyViewThreadInfoItemMemoryTracking::CMemSpyViewThreadInfoItemMemoryTracking( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
-: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking )
- {
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTracking::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingObserverAddL( *this );
-
- // Reset the title
- _LIT( KCustomTitle, "Memory Statistics" );
- SetTitleL( KCustomTitle );
-
- // Select the appropriate view
- const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune );
- const TInt index = IndexByViewType( viewType );
- //
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::ConstructL() - aSelectionRune: 0x%08x, viewType: %d, index: %d", aSelectionRune, viewType, index );
-#endif
- //
- if ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
- {
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
- }
-
-
-TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTracking::ViewType() const
- {
- return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatistics;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTracking::PrepareParentViewL()
- {
- CMemSpyViewBase* parent = CMemSpyViewThreadInfoItemGeneric::PrepareParentViewL();
-
- // Stop observing changes
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingObserverRemove( *this );
-
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTracking::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
- //
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- const TInt index = iListBox->CurrentItemIndex();
- if ( index == 1 )
- {
- child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingCurrent( iEngine, iObserver, Container() );
- }
- else if ( index == 2 )
- {
- child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingHWM( iEngine, iObserver, Container() );
- }
- else if ( index == 3 )
- {
- child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingPeak( iEngine, iObserver, Container() );
- }
- //
- if ( child )
- {
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( child );
-
- // Stop observing changes
- item->TrackingObserverRemove( *this );
- }
- //
- return child;
- }
-
-
-TBool CMemSpyViewThreadInfoItemMemoryTracking::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdMemoryTrackingStart:
- OnCmdTrackingStartL();
- break;
- case EMemSpyCmdMemoryTrackingStop:
- OnCmdTrackingStopL();
- break;
- case EMemSpyCmdMemoryTrackingHWMReset:
- OnCmdHWMResetL();
- break;
- case EMemSpyCmdMemoryTrackingTotalWithSharedMem:
- OnCmdTotalWithSharedMemL();
- break;
- case EMemSpyCmdMemoryTrackingTotalWithoutSharedMem:
- OnCmdTotalWithoutSharedMemL();
- break;
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-TInt CMemSpyViewThreadInfoItemMemoryTracking::IndexByViewType( TMemSpyViewType aType )
- {
- TInt index = 0;
- //
- switch( aType )
- {
- default:
- case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent:
- index = 1;
- break;
- case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM:
- index = 2;
- break;
- case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak:
- index = 3;
- break;
- }
- //
- return index;
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTracking::HandleListBoxItemActionedL( TInt aIndex )
- {
- if ( aIndex == 0 )
- {
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- if ( item->TrackingActive() )
- {
- OnCmdTrackingStopL();
- }
- else
- {
- OnCmdTrackingStartL();
- }
- }
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
-
- // Ensure we refresh the listbox content
- iListBox->DrawDeferred();
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTracking::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- iListBox->DrawDeferred();
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTracking::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
- {
- if ( aResourceId == MenuCascadeResourceId() )
- {
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- //
- if ( !item->TrackerExists() || item->TrackingActive() )
- {
- aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingStart, ETrue );
- }
- else
- {
- aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingStop, ETrue );
- }
- //
- if ( item->TotalIncludesSharedMemory() )
- {
- aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingTotalWithSharedMem, ETrue );
- }
- else
- {
- aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingTotalWithoutSharedMem, ETrue );
- }
-
- aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingHWMReset, Thread().IsDead() );
- }
- else if ( aResourceId == R_MEMSPY_MENUPANE )
- {
- aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTracking, Thread().IsDead() );
- aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStart, Thread().IsDead() );
- }
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryTrackingStartedL()
- {
- RefreshL();
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryTrackingStoppedL()
- {
- RefreshL();
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
- {
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL() - START - this: 0x%08x", this );
-#endif
-
- CMemSpyViewBase::RefreshL();
- iListBox->DrawDeferred();
-
-#ifdef _DEBUG
- RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL() - END - this: 0x%08x", this );
-#endif
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTrackingStartL()
- {
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingStartL();
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTrackingStopL()
- {
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingStopL();
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdHWMResetL()
- {
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingResetHWML();
- RefreshL();
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTotalWithSharedMemL()
- {
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingSetTotalIncludesSharedMemoryL( ETrue );
- RefreshL();
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTotalWithoutSharedMemL()
- {
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingSetTotalIncludesSharedMemoryL( EFalse );
- RefreshL();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewThreadInfoItemMemoryTrackingCurrent::CMemSpyViewThreadInfoItemMemoryTrackingCurrent( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
-: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking )
- {
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
-
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingObserverAddL( *this );
-
- // Reset the title
- _LIT( KCustomTitle, "Current Statistics" );
- SetTitleL( KCustomTitle );
- }
-
-
-TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingCurrent::ViewType() const
- {
- return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingCurrent::PrepareParentViewL()
- {
- CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
-
- // Stop observing changes
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingObserverRemove( *this );
-
- return parent;
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::SetListBoxModelL()
- {
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- MDesCArray* model = &item->InfoCurrent();
-
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
- {
- CMemSpyViewBase::RefreshL();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewThreadInfoItemMemoryTrackingHWM::CMemSpyViewThreadInfoItemMemoryTrackingHWM( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
-: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking )
- {
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTrackingHWM::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
-
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingObserverAddL( *this );
-
- // Reset the title
- _LIT( KCustomTitle, "HWM Statistics" );
- SetTitleL( KCustomTitle );
- }
-
-
-TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingHWM::ViewType() const
- {
- return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingHWM::PrepareParentViewL()
- {
- CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
-
- // Stop observing changes
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingObserverRemove( *this );
-
- return parent;
- }
-
-
-TBool CMemSpyViewThreadInfoItemMemoryTrackingHWM::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdMemoryTrackingHWMReset:
- OnCmdHWMResetL();
- break;
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTrackingHWM::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTrackingHWM::SetListBoxModelL()
- {
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- MDesCArray* model = &item->InfoHWM();
-
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTrackingHWM::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
- {
- CMemSpyViewBase::RefreshL();
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTrackingHWM::OnCmdHWMResetL()
- {
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingResetHWML();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CMemSpyViewThreadInfoItemMemoryTrackingPeak::CMemSpyViewThreadInfoItemMemoryTrackingPeak( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
-: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking )
- {
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTrackingPeak::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
-
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingObserverAddL( *this );
-
- // Reset the title
- _LIT( KCustomTitle, "Peak Statistics" );
- SetTitleL( KCustomTitle );
- }
-
-
-TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingPeak::ViewType() const
- {
- return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingPeak::PrepareParentViewL()
- {
- CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
-
- // Stop observing changes
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- item->TrackingObserverRemove( *this );
-
- return parent;
- }
-
-
-TBool CMemSpyViewThreadInfoItemMemoryTrackingPeak::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTrackingPeak::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTrackingPeak::SetListBoxModelL()
- {
- CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
- MDesCArray* model = &item->InfoPeak();
-
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewThreadInfoItemMemoryTrackingPeak::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
- {
- CMemSpyViewBase::RefreshL();
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemServer.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,394 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewThreadInfoItemServer.h"
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperheap.h>
-#include <memspy/engine/memspyenginehelperserver.h>
-
-// User includes
-#include "MemSpyContainerObserver.h"
-
-// Constants
-const TInt KMemSpyServerSessionsIndex = 2;
-
-
-
-CMemSpyViewThreadInfoItemServer::CMemSpyViewThreadInfoItemServer( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
-: CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeServer )
- {
- }
-
-
-void CMemSpyViewThreadInfoItemServer::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- // Causes list of server's to be prepared
- CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
-
- _LIT( KTitle, "Server List" );
- SetTitleL( KTitle );
-
-#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 )
- {
- // Treat the rune as a handle, and try to look it up
- selectedIndex = infoItem->DetailsIndexByHandle( aSelectionRune );
- }
-
- // Select item
- if ( infoItem->DetailsCount() > 0 )
- {*/
- iListBox->SetCurrentItemIndex( selectedIndex );
- HandleListBoxItemSelectedL( selectedIndex );
- /*}*/
- }
-
-
-TBool CMemSpyViewThreadInfoItemServer::HandleCommandL( TInt aCommand )
- {
- TBool handled = CMemSpyViewBase::HandleCommandL( aCommand );
- return handled;
- }
-
-
-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 );
-
-#ifdef _DEBUG
- RDebug::Printf( "CMemSpyViewThreadInfoItemServer::HandleListBoxItemSelectedL() - iCurrentInfoItemDetails.iHandle: 0x%08x", iCurrentInfoItemDetails.iHandle );
-#endif
-*/
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/*
-CMemSpyViewThreadInfoItemServerDetails::CMemSpyViewThreadInfoItemServerDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails )
-: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeServer ), iInfoItemDetails( aInfoItemDetails )
- {
- }
-
-
-void CMemSpyViewThreadInfoItemServerDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- // Causes list of server's to be prepared
- CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
-
- _LIT( KTitle, "Server Details" );
- SetTitleL( KTitle );
-
- // Try to select the correct server
- TInt selectedIndex = 0;
- if ( aSelectionRune )
- {
- // Presence of non-null item means that we came from the "Server sessions" list
- selectedIndex = KMemSpyServerSessionsIndex;
- }
-
- // Select item
- iListBox->SetCurrentItemIndex( selectedIndex );
- HandleListBoxItemSelectedL( selectedIndex );
- }
-
-
-TBool CMemSpyViewThreadInfoItemServerDetails::HandleCommandL( TInt aCommand )
- {
- TBool handled = CMemSpyViewBase::HandleCommandL( aCommand );
- return handled;
- }
-
-
-TMemSpyViewType CMemSpyViewThreadInfoItemServerDetails::ViewType() const
- {
- return EMemSpyViewTypeThreadInfoItemServerDetails;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemServerDetails::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
- const TInt currentIndex = iListBox->CurrentItemIndex();
- //
- if ( currentIndex == KMemSpyServerSessionsIndex )
- {
- CMemSpyViewThreadInfoItemServerSessions* serverSessions = new(ELeave) CMemSpyViewThreadInfoItemServerSessions( iEngine, iObserver, iInfoItem->Container(), iInfoItemDetails );
- CleanupStack::PushL( serverSessions );
- serverSessions->ConstructL( Rect(), *Parent(), NULL );
- CleanupStack::Pop( serverSessions );
- child = serverSessions;
- }
- //
- return child;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemServerDetails::PrepareParentViewL()
- {
- CMemSpyViewThreadInfoItemServer* parent = new(ELeave) CMemSpyViewThreadInfoItemServer( iEngine, iObserver, iInfoItem->Container() );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), iInfoItemDetails.iHandle );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-void CMemSpyViewThreadInfoItemServerDetails::SetListBoxModelL()
- {
- CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(4);
- CleanupStack::PushL( model );
-
- TBuf<KMaxFullName + 1> item;
-
- // 1st item = session type
- const TPtrC pServerSessionType = CMemSpyThreadInfoServer::SessionType( iInfoItemDetails.iSessionType );
- _LIT(KItem1Format, "\tServer Type\t\t%S");
- item.Format( KItem1Format, &pServerSessionType );
- model->AppendL( item );
-
- // 2nd item = session count
- _LIT(KItem2Format, "\tConnected Sessions\t\t%d");
- item.Format( KItem2Format, iInfoItemDetails.iCount );
- model->AppendL( item );
-
- // 3rd item = view sessions
- if ( iInfoItem->Container().MdcaCount() > 0 )
- {
- _LIT(KItem3Format, "\tView Sessions");
- model->AppendL( KItem3Format );
- }
-
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
- CleanupStack::Pop( model );
- }
-
-*/
-/*
-void CMemSpyViewThreadInfoItemServerDetails::HandleListBoxItemActionedL( TInt /*aIndex*/ /*)
-*/
-/*
- {
- // Notify observer about an item being 'fired'
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewThreadInfoItemServerDetails::HandleListBoxItemSelectedL( TInt /*aIndex*/ /*)
-*/
-/*
- {
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-*/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/*
-
-
-CMemSpyViewThreadInfoItemServerSessions::CMemSpyViewThreadInfoItemServerSessions( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails )
-: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeServer ), iInfoItemDetails( aInfoItemDetails )
- {
- }
-
-
-void CMemSpyViewThreadInfoItemServerSessions::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
- //
- _LIT( KTitle, "Connected Session List" );
- SetTitleL( KTitle );
- }
-
-
-TBool CMemSpyViewThreadInfoItemServerSessions::HandleCommandL( TInt aCommand )
- {
- TBool handled = CMemSpyViewBase::HandleCommandL( aCommand );
- return handled;
- }
-
-
-TMemSpyViewType CMemSpyViewThreadInfoItemServerSessions::ViewType() const
- {
- return EMemSpyViewTypeThreadInfoItemServerSessions;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreadInfoItemServerSessions::PrepareParentViewL()
- {
- CMemSpyViewThreadInfoItemServerDetails* parent = new(ELeave) CMemSpyViewThreadInfoItemServerDetails( iEngine, iObserver, iInfoItem->Container(), iInfoItemDetails );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), this );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-void CMemSpyViewThreadInfoItemServerSessions::SetListBoxModelL()
- {
- CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(4);
- CleanupStack::PushL( model );
-
- // Get handles
- RArray<TMemSpyDriverServerSessionInfo> sessions;
- CleanupClosePushL( sessions );
- iEngine.HelperServer().GetServerSessionsL( iInfoItemDetails, sessions );
-
- // Prepare items
- TBuf<KMaxFullName + 1> item;
- const TInt count = sessions.Count();
- for( TInt i=0; i<count; i++ )
- {
- _LIT(KInsertTab, "\t");
-
- const TMemSpyDriverServerSessionInfo& session = sessions[ i ];
- item.Zero();
-
- if ( session.iOwnerType == TMemSpyDriverServerSessionInfo::EOwnerThread )
- {
- // Find the thread object
- CMemSpyThread* thread = NULL;
- CMemSpyProcess* process = NULL;
- //
- const TInt error = iEngine.Container().ProcessAndThreadByThreadId( session.iOwnerId, process, thread );
- //
- if ( error == KErrNone )
- {
- item.Append( process->Name() );
- item.Append( KInsertTab );
- item.Append( KInsertTab );
- item.Append( thread->Name() );
- }
- }
- else if ( session.iOwnerType == TMemSpyDriverServerSessionInfo::EOwnerProcess )
- {
- // Find the process object
- CMemSpyProcess* process = NULL;
- TRAPD( error, process = &iEngine.Container().ProcessByIdL( session.iOwnerId ) );
- if ( error == KErrNone )
- {
- item.Append( process->Name() );
- }
- }
-
- if ( !item.Length() )
- {
- // Fall-back case
- item.Copy( session.iName );
- }
-
- // Add item
- item.Insert( 0, KInsertTab );
- model->AppendL( item );
- }
- CleanupStack::PopAndDestroy( &sessions );
-
- // Set up list box
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( model );
- listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
- CleanupStack::Pop( model );
- }
-
-*/
-
-
-
-
-
-
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemStack.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewThreadInfoItemStack.h"
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspy/engine/memspyenginehelperstack.h>
-#include <memspysession.h>
-
-// User includes
-#include "MemSpyContainerObserver.h"
-#include "MemSpyViewThreads.h"
-#include "MemSpyViewThreadInfoItemHeap.h"
-#include "MemSpyAppUi.h"
-
-
-
-CMemSpyViewThreadInfoItemStack::CMemSpyViewThreadInfoItemStack( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
-: CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeStack )
- {
- }
-
-
-TBool CMemSpyViewThreadInfoItemStack::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
-#ifndef __WINS__
- case EMemSpyCmdStackDataUser:
- OnCmdStackDataUserL();
- break;
- case EMemSpyCmdStackDataKernel:
- OnCmdStackDataKernelL();
- break;
-#endif
- case EMemSpyCmdStackInfoThread:
- OnCmdStackInfoL();
- break;
-
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewThreadInfoItemStack::OnCmdStackInfoL()
- {
- iMemSpySession.OutputStackInfoL( ThreadId() );
- }
-
-
-void CMemSpyViewThreadInfoItemStack::OnCmdStackDataUserL()
- {
- iMemSpySession.OutputStackDataL( ThreadId(), EMemSpyDriverDomainUser );
- }
-
-
-void CMemSpyViewThreadInfoItemStack::OnCmdStackDataKernelL()
- {
- iMemSpySession.OutputStackDataL( ThreadId(), EMemSpyDriverDomainKernel );
- }
-
-
-void CMemSpyViewThreadInfoItemStack::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
- {
- if ( aResourceId == R_MEMSPY_MENUPANE )
- {
- //TODO aMenuPane->SetItemDimmed( EMemSpyCmdStack, Thread().IsDead() );
- }
- }
--- a/memspyui/ui/avkon/src/MemSpyViewThreads.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,464 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewThreads.h"
-
-// System includes
-#include <AknQueryDialog.h>
-#include <memspyui.rsg>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectprocess.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
-#include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
-#include <memspy/engine/memspyenginehelperprocess.h>
-#include <memspysession.h>
-
-// User includes
-#include "MemSpyContainerObserver.h"
-#include "MemSpyViewProcesses.h"
-#include "MemSpyViewThreadInfoItemList.h"
-
-
-
-CMemSpyViewThreads::CMemSpyViewThreads( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aId, TThreadId aThreadId )
-: CMemSpyViewBase( aSession, aObserver ), iParentProcessId( aId ), iCurrentThreadId( aThreadId )
- {
- }
-
-
-CMemSpyViewThreads::~CMemSpyViewThreads()
- {
- }
-
-
-void CMemSpyViewThreads::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- TInt error = KErrNone;
- TRAP( error, iMemSpySession.GetThreadsL( iParentProcessId, iThreads ) );
-
- if( error == KErrNone )
- {
- _LIT( KTitle, "Threads" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- //
- if( iCurrentThreadId > 0 )
- {
- for( TInt i = 0; i < iThreads.Count() ; i++ )
- {
- if( iThreads[i]->Id() == iCurrentThreadId )
- {
- const TInt index = i;
- if ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
- {
- iListBox->SetCurrentItemIndex( index );
- HandleListBoxItemSelectedL( index );
- }
- }
- }
- }
- else if( iThreads.Count() > 0 )
- {
- iListBox->SetCurrentItemIndex( 0 );
- HandleListBoxItemSelectedL( 0 );
- }
- }
- }
-
-
-TProcessId CMemSpyViewThreads::Process() const
- {
- return iParentProcessId;
- }
-
-
-TThreadId CMemSpyViewThreads::CurrentThread()
- {
- return iCurrentThreadId;
- }
-
-
-void CMemSpyViewThreads::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewThreads::ViewType() const
- {
- return EMemSpyViewTypeThreads;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreads::PrepareParentViewL()
- {
- CMemSpyViewProcesses* parent = new(ELeave) CMemSpyViewProcesses( iMemSpySession, iObserver, iParentProcessId );
- CleanupStack::PushL( parent );
- //parent->ConstructL( Rect(), *Parent(), &iParentProcessId );
- parent->ConstructL( Rect(), *Parent() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewThreads::PrepareChildViewL()
- {
- CMemSpyViewThreadInfoItemList* child = new(ELeave) CMemSpyViewThreadInfoItemList( iMemSpySession, iObserver, iParentProcessId, iCurrentThreadId );
- CleanupStack::PushL( child );
- child->ConstructL( Rect(), *Parent(), EMemSpyThreadInfoItemTypeFirst );
- CleanupStack::Pop( child );
- return child;
- }
-
-
-void CMemSpyViewThreads::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
- {
- if ( aResourceId == R_MEMSPY_MENUPANE )
- {
- /*
- CMemSpyThread& thread = CurrentThread();
- aMenuPane->SetItemDimmed( EMemSpyCmdThread, thread.IsDead() );
- */
- //aMenuPane->SetItemDimmed( EMemSpyCmdThread, (iThreads[iListBox->CurrentItemIndex()]->ExitType() != EExitPending ));
- }
- }
-
-
-TBool CMemSpyViewThreads::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdThreadEndKill:
- OnCmdEndKillL();
- break;
- case EMemSpyCmdThreadEndTerminate:
- OnCmdEndTerminateL();
- break;
- case EMemSpyCmdThreadEndPanic:
- OnCmdEndPanicL();
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteVeryLow:
- case EMemSpyCmdThreadSetPriorityAbsoluteLowNormal:
- case EMemSpyCmdThreadSetPriorityAbsoluteLow:
- case EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal:
- case EMemSpyCmdThreadSetPriorityAbsoluteBackground:
- case EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal:
- case EMemSpyCmdThreadSetPriorityAbsoluteForeground:
- case EMemSpyCmdThreadSetPriorityAbsoluteHighNormal:
- case EMemSpyCmdThreadSetPriorityAbsoluteHigh:
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime1:
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime2:
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime3:
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime4:
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime5:
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime6:
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime7:
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime8:
- OnCmdSetPriorityL( aCommand );
- break;
-
- case EMemSpyCmdThreadInfoHandles:
- OnCmdInfoHandlesL();
- break;
-
- default:
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewThreads::OnCmdEndKillL()
- {
- TBool system = ETrue;
- TBool doTerminate = ETrue;
- TInt err = KErrNone;
-
- iMemSpySession.ThreadSystemPermanentOrCritical( iCurrentThreadId, system );
-
- if ( system )
- {
- CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
- doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
- }
- //
- if ( doTerminate )
- {
- TRAP( err, iMemSpySession.EndThreadL( iCurrentThreadId, EKill ) );
- if ( err == KErrNone )
- RefreshL();
- }
- }
-
-
-void CMemSpyViewThreads::OnCmdEndTerminateL()
- {
- TBool system = ETrue;
- TBool doTerminate = ETrue;
- TInt err = KErrNone;
-
- iMemSpySession.ThreadSystemPermanentOrCritical( iCurrentThreadId, system );
-
- if ( system )
- {
- CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
- doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
- }
- //
- if ( doTerminate )
- {
- TRAP( err, iMemSpySession.EndThreadL( iCurrentThreadId, ETerminate ) );
- if( err == KErrNone )
- RefreshL();
- }
- }
-
-
-void CMemSpyViewThreads::OnCmdEndPanicL()
- {
- TBool system = ETrue;
- TBool doTerminate = ETrue;
- TInt err = KErrNone;
-
- iMemSpySession.ThreadSystemPermanentOrCritical( iCurrentThreadId, system );
-
- if ( system )
- {
- CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
- doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
- }
- //
- if ( doTerminate )
- {
- TRAP( err, iMemSpySession.EndThreadL( iCurrentThreadId, EPanic ) );
- if( err == KErrNone )
- RefreshL();
- }
- }
-
-
-void CMemSpyViewThreads::OnCmdSetPriorityL( TInt aCommand )
- {
- TThreadPriority pri = EPriorityAbsoluteBackground;
- switch( aCommand )
- {
- case EMemSpyCmdThreadSetPriorityAbsoluteVeryLow:
- pri = EPriorityAbsoluteVeryLow;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteLowNormal:
- pri = EPriorityAbsoluteLowNormal;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteLow:
- pri = EPriorityAbsoluteLow;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal:
- pri = EPriorityAbsoluteBackgroundNormal;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteBackground:
- pri = EPriorityAbsoluteBackground;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal:
- pri = EPriorityAbsoluteForegroundNormal;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteForeground:
- pri = EPriorityAbsoluteForeground;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteHighNormal:
- pri = EPriorityAbsoluteHighNormal;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteHigh:
- pri = EPriorityAbsoluteHigh;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime1:
- pri = EPriorityAbsoluteRealTime1;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime2:
- pri = EPriorityAbsoluteRealTime2;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime3:
- pri = EPriorityAbsoluteRealTime3;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime4:
- pri = EPriorityAbsoluteRealTime4;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime5:
- pri = EPriorityAbsoluteRealTime5;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime6:
- pri = EPriorityAbsoluteRealTime6;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime7:
- pri = EPriorityAbsoluteRealTime7;
- break;
- case EMemSpyCmdThreadSetPriorityAbsoluteRealTime8:
- pri = EPriorityAbsoluteRealTime8;
- break;
- }
-
-#ifdef _DEBUG
- RDebug::Printf( "CMemSpyViewThreads::OnCmdSetPriorityL() - pri: %d", pri );
-#endif
- TInt err = KErrNone;
- TRAP( err , iMemSpySession.SetThreadPriorityL( iCurrentThreadId, pri ) );
- if( err == KErrNone )
- {
- RefreshL();
- }
- else
- {
- #ifdef _DEBUG
- RDebug::Printf( "CMemSpyViewThreads::OnCmdSetPriorityL() - set priority failed" );
- #endif
- }
-
-#ifdef _DEBUG
- RDebug::Printf( "CMemSpyViewThreads::OnCmdSetPriorityL() - END" );
-#endif
-
- }
-
-
-void CMemSpyViewThreads::OnCmdInfoHandlesL()
- {
- iMemSpySession.OutputThreadInfoHandlesL( iCurrentThreadId );
- }
-
-
-void CMemSpyViewThreads::SetListBoxModelL()
- {
- iModel = new (ELeave) CDesC16ArrayFlat( iThreads.Count() ); //array for formated items
-
- _LIT( KTab, "\t" );
- _LIT( KTTab, "\t\t" );
-
- for( TInt i=0; i < iThreads.Count(); i++ )
- {
- HBufC* tempName = HBufC::NewL( iThreads[i]->Name().Length() + 16 );
- CleanupStack::PushL( tempName );
- TPtr tempNamePtr( tempName->Des() );
- tempNamePtr.Copy( KTab );
- tempNamePtr.Append( iThreads[i]->Name() );
- tempNamePtr.Append( KTTab );
-
- AppendPriority( tempNamePtr, iThreads[i]->ThreadPriority() );
-
- iModel->AppendL( tempNamePtr );
-
- CleanupStack::PopAndDestroy( tempName );
- }
-
- CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( iModel );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-void CMemSpyViewThreads::HandleListBoxItemActionedL( TInt /*aIndex*/ )
- {
- // Notify observer about an item being 'fired'
- ReportEventL( MMemSpyViewObserver::EEventItemActioned );
- }
-
-
-void CMemSpyViewThreads::HandleListBoxItemSelectedL( TInt aIndex )
- {
- iCurrentThreadId = iThreads[ aIndex ]->Id();
-
- // Notify observer about item selection
- ReportEventL( MMemSpyViewObserver::EEventItemSelected );
- }
-
-
-void CMemSpyViewThreads::AppendPriority( TDes& aDes, TThreadPriority aPriority )
- {
- switch( aPriority )
- {
- case EPriorityNull:
- aDes += _L("[Null]");
- break;
- case EPriorityMuchLess:
- aDes += _L("[Much Less]");
- break;
- case EPriorityLess:
- aDes += _L("[Less]");
- break;
- case EPriorityNormal:
- aDes += _L("[Normal]");
- break;
- case EPriorityMore:
- aDes += _L("[More]");
- break;
- case EPriorityMuchMore:
- aDes += _L("[Much More]");
- break;
- case EPriorityRealTime:
- aDes += _L("[Real Time]");
- break;
-
- // Absolute values
- case EPriorityAbsoluteVeryLow:
- aDes += _L("[Abs Very Low]");
- break;
- case EPriorityAbsoluteLowNormal:
- aDes += _L("[Abs Low Norm]");
- break;
- case EPriorityAbsoluteLow:
- aDes += _L("[Abs Low]");
- break;
- case EPriorityAbsoluteBackground:
- aDes += _L("[Abs Bgnd]");
- break;
- case EPriorityAbsoluteBackgroundNormal:
- aDes += _L("[Abs Bgnd Norm]");
- break;
- case EPriorityAbsoluteForeground:
- aDes += _L("[Abs Fgnd]");
- break;
- case EPriorityAbsoluteForegroundNormal:
- aDes += _L("[Abs Fgnd Norm]");
- break;
- case EPriorityAbsoluteHigh:
- aDes += _L("[Abs High]");
- break;
- case EPriorityAbsoluteHighNormal:
- aDes += _L("[Abs High Norm]");
- break;
- case EPriorityAbsoluteRealTime1:
- case EPriorityAbsoluteRealTime2:
- case EPriorityAbsoluteRealTime3:
- case EPriorityAbsoluteRealTime4:
- case EPriorityAbsoluteRealTime5:
- case EPriorityAbsoluteRealTime6:
- case EPriorityAbsoluteRealTime7:
- case EPriorityAbsoluteRealTime8:
- aDes.AppendFormat( _L("[Abs RT %d]"), ( aPriority - EPriorityAbsoluteRealTime1 ) + 1 );
- break;
- default:
- aDes += _L("[Unknown Pri.]");
- break;
- }
- }
--- a/memspyui/ui/avkon/src/MemSpyViewType.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewType.h"
-
-
-
-
-TBool MemSpyViewTypeUtils::IsOpenableItem( TMemSpyViewType aType )
- {
- TBool openable = EFalse;
- //
- switch( aType )
- {
- case EMemSpyViewTypeMainMenu:
- case EMemSpyViewTypeProcesses:
- case EMemSpyViewTypeServerList:
- case EMemSpyViewTypeThreads:
- case EMemSpyViewTypeThreadInfoItemList:
- case EMemSpyViewTypeThreadInfoItemServer:
- case EMemSpyViewTypeThreadInfoItemSession:
- openable = ETrue;
- break;
- default:
- break;
- }
- //
- return openable;
- }
-
-
-TBool MemSpyViewTypeUtils::IsThreadInfoItem( TMemSpyViewType aType )
- {
- TBool infoItem = ETrue;
- //
- switch( aType )
- {
- case EMemSpyViewTypeMainMenu:
- case EMemSpyViewTypeRAMInfo:
- case EMemSpyViewTypeROMInfo:
- case EMemSpyViewTypeServerList:
- case EMemSpyViewTypeOpenFiles:
- case EMemSpyViewTypeProcesses:
- case EMemSpyViewTypeThreads:
- case EMemSpyViewTypeThreadInfoItemList:
- infoItem = EFalse;
- break;
- default:
- break;
- }
- //
- return infoItem;
- }
-
-
-TBool MemSpyViewTypeUtils::IsExitableView( TMemSpyViewType aType )
- {
- TBool ret = EFalse;
- //
- switch( aType )
- {
- case EMemSpyViewTypeMainMenu:
- ret = ETrue;
- break;
- default:
- break;
- }
- //
- return ret;
- }
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewWindowGroups.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,315 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyViewWindowGroups.h"
-
-// System includes
-#include <eikclbd.h>
-#include <aknmessagequerydialog.h>
-#include <aknnotewrappers.h>
-
-// Engine includes
-#include <memspy/engine/memspyengine.h>
-#include <memspy/engine/memspyengineobjectcontainer.h>
-#include <memspy/engine/memspyengineobjectthread.h>
-
-// User includes
-#include "MemSpyUiUtils.h"
-#include "MemSpyViewMainMenu.h"
-#include "MemSpyContainerObserver.h"
-
-// Literal constants
-const TInt KMaxInfoLength = 128;
-
-
-CMemSpyViewWindowGroups::CMemSpyViewWindowGroups( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-: CMemSpyViewBase( aEngine, aObserver )
- {
- }
-
-
-CMemSpyViewWindowGroups::~CMemSpyViewWindowGroups()
- {
- delete iWindowGroupList;
- }
-
-
-void CMemSpyViewWindowGroups::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
- {
- _LIT( KTitle, "Window Groups" );
- SetTitleL( KTitle );
- //
- CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
- }
-
-
-CEikListBox* CMemSpyViewWindowGroups::ConstructListBoxL()
- {
- delete iListBox;
- iListBox = NULL;
- CAknSingleNumberStyleListBox* listbox = new (ELeave) CAknSingleNumberStyleListBox();
- iListBox = listbox;
- listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling );
- listbox->SetContainerWindowL( *this );
- listbox->CreateScrollBarFrameL( ETrue );
- SetListBoxModelL();
- listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
- listbox->SetListBoxObserver( this );
- listbox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
- listbox->SetObserver( this );
- return listbox;
- }
-
-void CMemSpyViewWindowGroups::RefreshL()
- {
- SetListBoxModelL();
- CMemSpyViewBase::RefreshL();
- }
-
-
-TMemSpyViewType CMemSpyViewWindowGroups::ViewType() const
- {
- return EMemSpyViewTypeWindowGroups;
- }
-
-
-CMemSpyViewBase* CMemSpyViewWindowGroups::PrepareParentViewL()
- {
- CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver );
- CleanupStack::PushL( parent );
- parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
- CleanupStack::Pop( parent );
- return parent;
- }
-
-
-CMemSpyViewBase* CMemSpyViewWindowGroups::PrepareChildViewL()
- {
- CMemSpyViewBase* child = NULL;
- if ( iListBox &&
- iListBox->Model()->NumberOfItems() &&
- iListBox->CurrentItemIndex() > KErrNotFound )
- {
- DetailsL();
- }
- return child;
- }
-
-
-void CMemSpyViewWindowGroups::SetListBoxModelL()
- {
- // Take ownership of new model
- MMemSpyEngineHelperWindowServer& windowServerManager = iEngine.HelperWindowServer();
- MMemSpyEngineWindowGroupList* windowGroupList = windowServerManager.WindowGroupListL();
- delete iWindowGroupList;
- iWindowGroupList = windowGroupList;
-
- // Set up list box
- CAknSingleNumberStyleListBox* listbox = static_cast< CAknSingleNumberStyleListBox* >( iListBox );
- listbox->Model()->SetItemTextArray( iWindowGroupList );
- listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
- }
-
-
-TBool CMemSpyViewWindowGroups::HandleCommandL( TInt aCommand )
- {
- TBool handled = ETrue;
- //
- switch ( aCommand )
- {
- case EMemSpyCmdWindowGroupTerminate:
- {
- TRAPD( err, OnCmdEndL( aCommand ) );
- CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
- if ( err )
- {
- note->ExecuteLD( _L("Cannot terminate task") );
- }
- else
- {
- note->ExecuteLD( _L("Task terminated") );
- }
- break;
- }
- case EMemSpyCmdWindowGroupSwitchTo:
- {
- TRAPD( err, OnCmdSwitchToL() );
- if ( err )
- {
- CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
- note->ExecuteLD( _L("Cannot bring to foreground") );
- }
- break;
- }
- case EMemSpyCmdWindowGroupEnd:
- {
- TRAPD( err, OnCmdEndL( aCommand ) );
- CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
- if ( err )
- {
- note->ExecuteLD( _L("Cannot end task") );
- }
- else
- {
- note->ExecuteLD( _L("Task exited") );
- }
- break;
- }
- case EMemSpyCmdWindowGroupPanic:
- {
- TRAPD( err, OnCmdEndL( aCommand ) );
- CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue );
- if ( err )
- {
- note->ExecuteLD( _L("Cannot panic task") );
- }
- else
- {
- note->ExecuteLD( _L("Task panic'ed") );
- }
- break;
- }
- default:
- {
- handled = CMemSpyViewBase::HandleCommandL( aCommand );
- break;
- }
- }
- //
- return handled;
- }
-
-
-void CMemSpyViewWindowGroups::OnCmdSwitchToL()
- {
- MMemSpyEngineHelperWindowServer& windowServerManager = iEngine.HelperWindowServer();
- TInt id = iWindowGroupList->At( iListBox->CurrentItemIndex() ).iId;
- windowServerManager.SwitchToL( id );
- }
-
-
-void CMemSpyViewWindowGroups::OnCmdEndL( TInt aCommand )
- {
- /*
- TBool doTerminate = ETrue;
-
- CMemSpyEngineObjectContainer& container = iEngine.Container();
- TThreadId id = iWindowGroupList->At( iListBox->CurrentItemIndex() ).iThreadId;
-
- // Try to find the thread in question...
- CMemSpyProcess* process = NULL;
- CMemSpyThread* thread = NULL;
- User::LeaveIfError( container.ProcessAndThreadByThreadId( id, process, thread ) );
-
- if ( thread )
- {
- //
- if ( thread->IsSystemPermanent() || thread->IsSystemCritical() )
- {
- CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
- doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
- }
- //
- if ( doTerminate )
- {
- switch ( aCommand )
- {
- case EMemSpyCmdWindowGroupTerminate:
- {
- thread->TerminateL();
- break;
- }
- case EMemSpyCmdWindowGroupEnd:
- {
- thread->KillL();
- break;
- }
- case EMemSpyCmdWindowGroupPanic:
- {
- thread->PanicL();
- break;
- }
- default:
- {
- // Programming error
- __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) );
- }
- }
- }
- }
- RefreshL();
- */
- }
-
-
-void CMemSpyViewWindowGroups::DetailsL()
- {
- HBufC* messageBuf = HBufC::NewLC( 4096 );
- TPtr messagePtr = messageBuf->Des();
-
- // Fetch data from helper
- TMemSpyEngineWindowGroupDetails selectedObject;
- MMemSpyEngineHelperWindowServer& windowServerManager = iEngine.HelperWindowServer();
- TInt id = iWindowGroupList->At( iListBox->CurrentItemIndex() ).iId;
- windowServerManager.GetWindowGroupDetailsL( id, selectedObject );
-
- // Append info to string buffer
- AppendFormatString( messagePtr, _L("WG ID: %d\n"), selectedObject.iId );
- AppendFormatString( messagePtr, _L("Client ThreadId: %Lu\n"), selectedObject.iThreadId.Id() );
- TFullName name;
- name.Copy( selectedObject.iFullName );
- AppendFormatString( messagePtr, _L("Thr: %S\n"), &name );
- name.Zero();
- AppendFormatString( messagePtr, _L("Priority: %d\n"), selectedObject.iPriority );
- AppendFormatString( messagePtr, _L("Handle: 0x%08X\n"), selectedObject.iWindowGroupHandle );
- name.Copy( selectedObject.iName );
- AppendFormatString( messagePtr, _L("Name: %S\n"), &name );
- name.Zero();
- AppendFormatString( messagePtr, _L("UID: 0x%08X\n"), selectedObject.iUID );
- AppendFormatString( messagePtr, _L("IsBusy: %d\n"), selectedObject.iIsBusy );
- AppendFormatString( messagePtr, _L("IsSystem: %d\n"), selectedObject.iIsSystem );
- AppendFormatString( messagePtr, _L("IsHidden: %d\n"), selectedObject.iIsHidden );
- name.Copy( selectedObject.iCaption );
- AppendFormatString( messagePtr, _L("Caption: %S\n"), &name );
- name.Zero();
- name.Copy( selectedObject.iDocName );
- AppendFormatString( messagePtr, _L("Docname: %S"), &name );
- name.Zero();
-
- // Display the buffer on a dialog
- CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog( CAknQueryDialog::ENoTone );
- dialog->PrepareLC( R_MEMSPY_KERNEL_OBJECT_DETAILS_DIALOG );
- TFileName headerText;
- headerText.Copy( selectedObject.iFullName );
- dialog->SetHeaderTextL( headerText );
- dialog->SetMessageTextL( messagePtr );
- dialog->RunLD();
-
- CleanupStack::PopAndDestroy( messageBuf );
- }
-
-
-void CMemSpyViewWindowGroups::AppendFormatString( TPtr& aPtr, TRefByValue<const TDesC> aFmt, ... )
- {
- TBuf<KMaxInfoLength> infoString;
- VA_LIST list;
- VA_START ( list, aFmt );
- infoString.FormatList( aFmt, list );
- aPtr.Append( infoString );
- }
-
-
--- a/memspyui/ui/hb/hb.pro Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-TEMPLATE = app
-TARGET = MemSpyUI
-DEPENDPATH += .
-INCLUDEPATH += /epoc32/include/platform/memspy/api
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-load(hb.prf)
-symbian:CONFIG -= symbian_i18n
-
-HEADERS += inc/enginewrapper.h \
- inc/viewmanager.h \
- inc/memspyview.h \
- inc/memspylistview.h \
- inc/memspymainview.h \
- inc/memspyprocessview.h \
- inc/memspythreadview.h \
- inc/memspythreaddetailindexview.h \
- inc/memspythreaddetailview.h \
- inc/memspykernelobjecttypeview.h \
- inc/memspykernelobjectview.h \
- inc/memspykernelobjectdetailview.h \
- inc/memspytrackingview.h \
- inc/memspyswmtview.h \
- inc/memspyheapdumpsview.h \
- inc/memspysettingsview.h \
- inc/memspyserverview.h \
- inc/memspyecomcategoryview.h \
- inc/memspyecominterfaceview.h \
- inc/memspyecomimplementationview.h \
- inc/memspyecomimplementationdetailview.h
-
-SOURCES += src/main.cpp \
- src/enginewrapper.cpp \
- src/viewmanager.cpp \
- src/memspyview.cpp \
- src/memspylistview.cpp \
- src/memspymainview.cpp \
- src/memspyprocessview.cpp \
- src/memspythreadview.cpp \
- src/memspythreaddetailindexview.cpp \
- src/memspythreaddetailview.cpp \
- src/memspykernelobjecttypeview.cpp \
- src/memspykernelobjectview.cpp \
- src/memspykernelobjectdetailview.cpp \
- src/memspytrackingview.cpp \
- src/memspyswmtview.cpp \
- src/memspyheapdumpsview.cpp \
- src/memspysettingsview.cpp \
- src/memspyserverview.cpp \
- src/memspyecomcategoryview.cpp \
- src/memspyecominterfaceview.cpp \
- src/memspyecomimplementationview.cpp \
- src/memspyecomimplementationdetailview.cpp
-
-RESOURCES +=
-
-symbian: {
- LIBS += -lestor \
- -lbafl \
- -lMemSpyClient \
- -lefsrv
-
-
- TARGET.CAPABILITY = ReadUserData WriteUserData ReadDeviceData WriteDeviceData SwEvent PowerMgmt
-
- TARGET.UID2 = 0x100039CE
- TARGET.UID3 = 0x2002129F
- TARGET.SID = 0x2002129F
- TARGET.VID = 0x101FB657 // Nokia
-
- TARGET.EPOCHEAPSIZE = 0x10000 0x2000000 // Min 64Kb, Max 32Mb
-
- ICON = ../../icons/qgn_menu_memspyui.svg
-
- RSS_RULES += "group_name = \"RnD Tools\"";
-} else {
- error("Only Symbian supported")
-}
--- a/memspyui/ui/hb/inc/enginewrapper.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,636 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef ENGINEWRAPPER_H_
-#define ENGINEWRAPPER_H_
-
-#include <QObject>
-#include <QVariantList>
-#include <QSettings>
-
-#include <memspysession.h>
-
-typedef quint64 ProcessId;
-typedef quint64 ThreadId;
-
-enum ThreadPriority
-{
- ThreadPriorityNull=(-30),
- ThreadPriorityMuchLess=(-20),
- ThreadPriorityLess=(-10),
- ThreadPriorityNormal=0,
- ThreadPriorityMore=10,
- ThreadPriorityMuchMore=20,
- ThreadPriorityRealTime=30,
- ThreadPriorityAbsoluteVeryLow=100,
- ThreadPriorityAbsoluteLowNormal=150,
- ThreadPriorityAbsoluteLow=200,
- ThreadPriorityAbsoluteBackgroundNormal=250,
- ThreadPriorityAbsoluteBackground=300,
- ThreadPriorityAbsoluteForegroundNormal=350,
- ThreadPriorityAbsoluteForeground=400,
- ThreadPriorityAbsoluteHighNormal=450,
- ThreadPriorityAbsoluteHigh=500,
- ThreadPriorityAbsoluteRealTime1=810,
- ThreadPriorityAbsoluteRealTime2=820,
- ThreadPriorityAbsoluteRealTime3=830,
- ThreadPriorityAbsoluteRealTime4=840,
- ThreadPriorityAbsoluteRealTime5=850,
- ThreadPriorityAbsoluteRealTime6=860,
- ThreadPriorityAbsoluteRealTime7=870,
- ThreadPriorityAbsoluteRealTime8=880
-};
-
-enum KernelObjectType
-{
- KernelObjectTypeUnknown = -1,
- KernelObjectTypeThread = 0,
- KernelObjectTypeProcess,
- KernelObjectTypeChunk,
- KernelObjectTypeLibrary,
- KernelObjectTypeSemaphore,
- KernelObjectTypeMutex,
- KernelObjectTypeTimer,
- KernelObjectTypeServer,
- KernelObjectTypeSession,
- KernelObjectTypeLogicalDevice,
- KernelObjectTypePhysicalDevice,
- KernelObjectTypeLogicalChannel,
- KernelObjectTypeChangeNotifier,
- KernelObjectTypeUndertaker,
- KernelObjectTypeMsgQueue,
- KernelObjectTypePropertyRef,
- KernelObjectTypeCondVar
-};
-
-enum ThreadInfoType
-{
- ThreadInfoTypeGeneral = EMemSpyThreadInfoItemTypeGeneralInfo,
- ThreadInfoTypeHeap = EMemSpyThreadInfoItemTypeHeap,
- ThreadInfoTypeStack = EMemSpyThreadInfoItemTypeStack,
- ThreadInfoTypeChunk = EMemSpyThreadInfoItemTypeChunk,
- ThreadInfoTypeCodeSeg = EMemSpyThreadInfoItemTypeCodeSeg,
- ThreadInfoTypeOpenFiles = EMemSpyThreadInfoItemTypeOpenFiles,
- ThreadInfoTypeActiveObjects = EMemSpyThreadInfoItemTypeActiveObject,
- ThreadInfoTypeOwnedThreadHandles = EMemSpyThreadInfoItemTypeOwnedThreadHandles,
- ThreadInfoTypeOwnedProcessHandles = EMemSpyThreadInfoItemTypeOwnedProcessHandles,
- ThreadInfoTypeServer = EMemSpyThreadInfoItemTypeServer,
- ThreadInfoTypeSession = EMemSpyThreadInfoItemTypeSession,
- ThreadInfoTypeSemaphore = EMemSpyThreadInfoItemTypeSemaphore,
- ThreadInfoTypeOtherThreads = EMemSpyThreadInfoItemTypeOtherThreads,
- ThreadInfoTypeOtherProcesses = EMemSpyThreadInfoItemTypeOtherProcesses,
- ThreadInfoTypeMutex = EMemSpyThreadInfoItemTypeMutex,
- ThreadInfoTypeTimer = EMemSpyThreadInfoItemTypeTimer,
- ThreadInfoTypeChannel = EMemSpyThreadInfoItemTypeLogicalChannel,
- ThreadInfoTypeChangeNotifier = EMemSpyThreadInfoItemTypeChangeNotifier,
- ThreadInfoTypeUndertaker = EMemSpyThreadInfoItemTypeUndertaker,
- ThreadInfoTypeMessageQueue = EMemSpyThreadInfoItemTypeMessageQueue,
- ThreadInfoTypeConditionalVariable = EMemSpyThreadInfoItemTypeConditionalVariable,
- ThreadInfoTypeLDD = EMemSpyThreadInfoItemTypeLDD,
- ThreadInfoTypePDD = EMemSpyThreadInfoItemTypePDD,
-};
-
-enum DeviceWideOperation
-{
- OutputPhoneInfo = 0,
-
- OutputDetailedPhoneInfo,
-
- OutputHeapInfo,
-
- OutputCompactHeapInfo,
-
- OutputHeapCellListing,
-
- OutputHeapData,
-
- OutputStackInfo,
-
- OutputCompactStackInfo,
-
- OutputUserStackData,
-
- OutputKernelStackData
-};
-
-enum SwmtMode
-{
- SwmtModeBasic = 0,
- SwmtModeFull,
- SwmtModeCustom
-};
-
-enum HeapDumpsMode
-{
- HeapDumpsModeKernel = 0,
- HeapDumpsModeUser,
- HeapDumpsModeBoth
-};
-
-enum OutputMode
-{
- OutputModeTrace = 0,
- OutputModeFile
-};
-
-class MemSpyProcess
-{
-public:
- MemSpyProcess(CMemSpyApiProcess* process)
- : mProcess(process)
- {}
-
- virtual ~MemSpyProcess() { delete mProcess; }
-
- ProcessId id() const { return mProcess->Id(); }
-
- QString name() const { return QString((QChar*) mProcess->Name().Ptr(), mProcess->Name().Length()); }
-
- QString exitInfo() const;
-
- int priority() const { return mProcess->Priority(); }
-
- int threadCount() const { return mProcess->ThreadCount(); }
-
- int sid() const { return mProcess->SID(); }
-
- int vid() const { return mProcess->VID(); }
-
- bool isDead() const { return mProcess->IsDead(); }
-
-private:
- CMemSpyApiProcess *mProcess;
-};
-
-class MemSpyThread
-{
-public:
- MemSpyThread(CMemSpyApiThread* thread)
- : mThread(thread)
- {}
-
- virtual ~MemSpyThread() { delete mThread; }
-
- ThreadId id() const { return mThread->Id(); }
-
- QString name() const { return QString((QChar*) mThread->Name().Ptr(), mThread->Name().Length()); }
-
- int priority() const { return mThread->ThreadPriority(); }
-
-
-private:
- CMemSpyApiThread *mThread;
-};
-
-class MemSpyKernelObjectType
-{
-public:
- MemSpyKernelObjectType(CMemSpyApiKernelObject* type)
- : mType(type)
- {}
-
- virtual ~MemSpyKernelObjectType() { delete mType; }
-
- int id() const { return mType->Type(); }
-
- 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;
-};
-
-class MemSpyKernelObject
-{
-public:
- MemSpyKernelObject(CMemSpyApiKernelObjectItem* object)
- : mObject(object)
- {}
-
- virtual ~MemSpyKernelObject() { delete mObject; }
-
- int type() const { return mObject->Type(); }
-
- QString name() const { return QString::fromLatin1((char*)mObject->Name().Ptr(), mObject->Name().Length()); }
-
- QString nameDetail() const { return QString::fromLatin1((char*)mObject->NameDetail().Ptr(), mObject->NameDetail().Length()); }
-
- int accessCount() const { return mObject->AccessCount(); }
-
- int uniqueId() const { return mObject->UniqueID(); }
-
- unsigned int protection() const { return mObject->Protection(); }
-
- unsigned int addressOfKernelOwner() const { return reinterpret_cast<unsigned int>(mObject->AddressOfKernelOwner()); }
-
- unsigned int kernelAddress() const { return reinterpret_cast<unsigned int>(mObject->Handle()); }
-
- unsigned int addressOfOwningProcess() const { return reinterpret_cast<unsigned int>(mObject->AddressOfOwningProcess()); }
-
- int id() const { return mObject->Id(); }
-
- int priority() const { return mObject->Priority(); }
-
- QString nameOfOwner() const { return QString::fromLatin1((char*)mObject->NameOfOwner().Ptr(), mObject->NameOfOwner().Length()); }
-
- unsigned int creatorId() const { return mObject->CreatorId(); }
-
- int attributes() const { return mObject->Attributes(); }
-
- unsigned int addressOfDataBssStackChunk() const { return reinterpret_cast<unsigned int>(mObject->AddressOfDataBssStackChunk()); }
-
- unsigned int securityZone() const { return mObject->SecurityZone(); }
-
- unsigned int size() const { return mObject->Size(); }
-
- unsigned int maxSize() const { return mObject->MaxSize(); }
-
- unsigned int bottom() const { return mObject->Bottom(); }
-
- unsigned int top() const { return mObject->Top(); }
-
- unsigned int startPos() const { return mObject->StartPos(); }
-
- unsigned int controllingOwner() const { return mObject->ControllingOwner(); }
-
- unsigned int restrictions() const { return mObject->Restrictions(); }
-
- unsigned int mapAttr() const { return mObject->Restrictions(); }
-
- unsigned int chunkType() const { return mObject->ChunkType(); }
-
- int mapCount() const { return mObject->MapCount(); }
-
- unsigned int state() const { return mObject->State(); }
-
- unsigned int addressOfCodeSeg() const { return reinterpret_cast<unsigned int>(mObject->AddressOfCodeSeg()); }
-
- unsigned int resetting() const { return mObject->Resetting(); }
-
- unsigned int order() const { return mObject->Order(); }
-
- QString version() const { return QString((QChar*) mObject->Version().Name().Ptr(), mObject->Version().Name().Length()); }
-
- unsigned int parseMask() const { return mObject->ParseMask(); }
-
- unsigned int unitsMask() const { return mObject->UnitsMask(); }
-
- unsigned int changes() const { return mObject->Changes(); }
-
- int count() const { return mObject->Count(); }
-
- int waitCount() const { return mObject->WaitCount(); }
-
- int sessionType() const { return mObject->SessionType(); }
-
- int timerType() const { return mObject->TimerType(); }
-
- int timerState() const { return mObject->TimerState(); }
-
- unsigned int addressOfOwningThread() const { return reinterpret_cast<unsigned int>(mObject->AddressOfOwningThread()); }
-
- unsigned int addressOfServer() const { return reinterpret_cast<unsigned int>(mObject->AddressOfServer()); }
-
- unsigned int svrSessionType() const { return mObject->SvrSessionType(); }
-
- int msgCount() const { return mObject->MsgCount(); }
-
- int msgLimit() const { return mObject->MsgLimit(); }
-
- unsigned int totalAccessCount() const { return mObject->TotalAccessCount(); }
-
- int openChannels() const { return mObject->OpenChannels(); }
-
-private:
- 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 MemSpyServer
-{
-public:
- MemSpyServer(CMemSpyApiServer* server)
- : mServer(server)
- {}
-
- virtual ~MemSpyServer() { delete mServer; }
-
- ProcessId id() const { return mServer->Id(); }
-
- QString name() const { return QString((QChar*) mServer->Name().Ptr(), mServer->Name().Length()); }
-
- int sessionCount() const { return mServer->SessionCount(); }
-
-private:
- CMemSpyApiServer *mServer;
-};
-
-class MemSpyEComCategory
-{
-public:
- MemSpyEComCategory(CMemSpyApiEComCategory* category)
- : mData(category)
- {}
-
- virtual ~MemSpyEComCategory() { delete mData; }
-
- int id() const { return mData->Id().iUid; }
-
- QString name() const { return QString((QChar*) mData->Name().Ptr(), mData->Name().Length()); }
-
- int interfaceCount() const { return mData->InterfaceCount(); }
-
-private:
- CMemSpyApiEComCategory *mData;
-};
-
-class MemSpyEComInterface
-{
-public:
- MemSpyEComInterface(CMemSpyApiEComInterface* interface)
- : mData(interface)
- {}
-
- virtual ~MemSpyEComInterface() { delete mData; }
-
- int id() const { return mData->Id().iUid; }
-
- int categoryId() const { return mData->CategoryId().iUid; }
-
- QString name() const { return QString((QChar*) mData->Name().Ptr(), mData->Name().Length()); }
-
- int implementationCount() const { return mData->ImplementationCount(); }
-
-private:
- CMemSpyApiEComInterface *mData;
-};
-
-class MemSpyEComImplementation
-{
-public:
- MemSpyEComImplementation(CMemSpyApiEComImplementation* interface)
- : mData(interface)
- {}
-
- virtual ~MemSpyEComImplementation() { delete mData; }
-
- int id() const { return mData->ImplementationUid().iUid; }
-
- QString name() const { return QString((QChar*) mData->Name().Ptr(), mData->Name().Length()); }
-
- int version() const { return mData->Version(); }
-
- QString dataType() const { return QString((QChar*) mData->DataType().Ptr(), mData->DataType().Length()); }
-
- QString opaqueData() const { return QString((QChar*) mData->OpaqueData().Ptr(), mData->OpaqueData().Length()); }
-
- QString drive() const { return QString((QChar*) mData->Drive().Name().Ptr(), mData->Drive().Name().Length()); }
-
- bool romOnly() const { return mData->RomOnly(); }
-
- bool romBased() const { return mData->RomBased(); }
-
- int vendorId() const { return mData->VendorId(); }
-
- bool disabled() const { return mData->Disabled(); }
-
-private:
- CMemSpyApiEComImplementation *mData;
-};
-
-
-class MemSpyDwoProgressTracker : public QObject, public CActive
-{
- Q_OBJECT
-
-public:
- MemSpyDwoProgressTracker(RMemSpySession &session);
- virtual ~MemSpyDwoProgressTracker();
-
-public slots:
-
- void start();
-
- void cancel();
-
-protected: // from CActive
-
- virtual void RunL();
-
- virtual void DoCancel();
-
- virtual TInt RunError(TInt aError);
-
-signals:
- void progress(int progress, const QString& processName);
-
-private:
- TMemSpyDeviceWideOperationProgress mProgress;
- RMemSpySession mSession;
-};
-
-class MemSpyDwoTracker : public QObject, public CActive
-{
- Q_OBJECT
-
-public:
- MemSpyDwoTracker(RMemSpySession &session, DeviceWideOperation operation);
- virtual ~MemSpyDwoTracker();
-
-public slots:
-
- void start();
-
- void cancel();
-
-protected: // from CActive
-
- virtual void RunL();
-
- virtual void DoCancel();
-
- virtual TInt RunError(TInt aError);
-
-signals:
- void finished(int errorCode);
- void progress(int progress, const QString& processName);
-
-private:
- RMemSpySession mSession;
- MemSpyDwoProgressTracker *mProgressTracker;
- DeviceWideOperation mOperation;
-};
-
-class MemSpyAsyncTracker : public QObject, public CActive
-{
- Q_OBJECT
-
-public:
-
- MemSpyAsyncTracker(RMemSpySession& session, void (RMemSpySession::*function)(TRequestStatus&));
-
- void start();
-
- virtual void RunL();
-
- virtual void DoCancel();
-
- virtual TInt RunError(TInt aError);
-
-signals:
-
- void finished(int errorCode);
-
-private:
- void (RMemSpySession::*mFunction)(TRequestStatus&);
- RMemSpySession& mSession;
-};
-
-class MemSpySwmtDumpTracker : public MemSpyAsyncTracker
-{
-public:
- MemSpySwmtDumpTracker(RMemSpySession& session) :
- MemSpyAsyncTracker(session, &RMemSpySession::ForceSwmtUpdate)
- {}
-};
-
-class MemSpyKernelHeapDumpTracker : public MemSpyAsyncTracker
-{
-public:
- MemSpyKernelHeapDumpTracker(RMemSpySession& session) :
- MemSpyAsyncTracker(session, &RMemSpySession::OutputKernelHeapData)
- {}
-};
-
-class MemSpySettings : private QSettings
-{
-public:
-
- MemSpySettings();
-
- OutputMode outputMode() const;
- void setOutputMode(OutputMode mode);
-
- QString outputPath() const;
- void setOutputPath(const QString& path);
-
- int swmtTimerPeriod() const;
- void setSwmtTimerPeriod(int period);
-
- SwmtMode swmtMode() const;
- void setSwmtMode(SwmtMode mode);
-
- QVariantList swmtCategories() const;
- void setSwmtCategories(const QVariantList& categories);
-
- HeapDumpsMode heapDumpsMode() const;
- void setHeapDumpsMode(HeapDumpsMode mode);
-};
-
-class EngineWrapper : public QObject
-{
- Q_OBJECT
-
-public:
- EngineWrapper();
-
- virtual ~EngineWrapper();
-
- bool initialize();
-
- MemSpySettings& settings();
-
- const MemSpySettings& settings() const;
-
-
-
- QList<MemSpyProcess*> getProcesses();
-
- QList<MemSpyThread*> getThreads(ProcessId processId);
-
- QList<MemSpyThreadInfoItem*> getThreadInfo(ThreadId threadId, ThreadInfoType type);
-
- void setThreadPriority(ThreadId threadId, ThreadPriority priority);
-
- QList<MemSpyKernelObjectType*> getKernelObjectTypes();
-
- QList<MemSpyKernelObject*> getKernelObjects(int type);
-
- QList<MemSpyServer*> getServers();
-
- QList<MemSpyEComCategory*> getEComCategories();
-
- QList<MemSpyEComInterface*> getEComInterfaces(int categoryId);
-
- QList<MemSpyEComImplementation*> getEComImplementations(int interfaceId);
-
- MemSpyDwoTracker* createDeviceWideOperation(DeviceWideOperation operation);
-
- MemSpyKernelHeapDumpTracker* createKernelHeapDumpTracker();
-
- MemSpySwmtDumpTracker* createSwmtDumpTracker();
-
- void setSwmtSettings(SwmtMode mode, const QVariantList& categories);
-
- bool isSwmtRunning();
-
- void startSwmt(int period);
-
- void stopSwmt();
-
- void forceSwmtDump();
-
- void outputKernelHeapData();
-
- int outputThreadHeapData(const QString& filter);
-
- void updateOutputSettings();
-
- void killProcess(ProcessId process);
-
- void panicProcess(ProcessId process);
-
- void terminateProcess(ProcessId process);
-
-private:
- RMemSpySession mSession;
-
- bool mSwmtRunning;
-
- MemSpySettings mSettings;
-};
-
-#endif /* ENGINEWRAPPER_H_ */
--- a/memspyui/ui/hb/inc/memspyecomcategoryview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYECOMCATEGORYVIEW_H_
-#define MEMSPYECOMCATEGORYVIEW_H_
-
-#include <QAbstractListModel>
-
-#include "memspylistview.h"
-#include "enginewrapper.h"
-
-
-class MemSpyEComCategoryModel : public QAbstractListModel
-{
-public:
- MemSpyEComCategoryModel(EngineWrapper &engine, QObject *parent = 0);
-
- ~MemSpyEComCategoryModel();
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
- void refresh();
-
-private:
- EngineWrapper& mEngine;
-
- QList<MemSpyEComCategory*> mData;
-};
-
-class MemSpyEComCategoryView : public MemSpyListView
-{
-
- Q_OBJECT
-
-public:
- MemSpyEComCategoryView(EngineWrapper &engine, ViewManager &viewManager) :
- MemSpyListView(engine, viewManager),
- mModel(0)
- {}
-
-public slots:
- virtual void refresh();
-
-protected:
- void initialize(const QVariantMap& params);
-
-protected:
- virtual bool isRefreshable() const { return true; }
-
-private slots:
- void itemClicked(const QModelIndex& index);
-
-private:
- MemSpyEComCategoryModel* mModel;
-};
-
-#endif /* MEMSPYECOMCATEGORYVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspyecomimplementationdetailview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYECOMIMPLEMENTATIONDETAILVIEW_H_
-#define MEMSPYECOMIMPLEMENTATIONDETAILVIEW_H_
-
-#include <QAbstractListModel>
-
-#include "memspylistview.h"
-#include "enginewrapper.h"
-
-
-class MemSpyEComImplementationDetailModel : public QAbstractListModel
-{
-public:
- MemSpyEComImplementationDetailModel(MemSpyEComImplementation* implementation, QObject *parent = 0);
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
-private:
- QVariantList mData;
-};
-
-class MemSpyEComImplementationDetailView : public MemSpyListView
-{
-
- Q_OBJECT
-
-public:
- MemSpyEComImplementationDetailView(EngineWrapper &engine, ViewManager &viewManager) :
- MemSpyListView(engine, viewManager),
- mModel(0)
- {}
-
-protected:
- void initialize(const QVariantMap& params);
-
-private:
- MemSpyEComImplementationDetailModel* mModel;
-};
-
-#endif /* MEMSPYECOMIMPLEMENTATIONDETAILVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspyecomimplementationview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYECOMIMPLEMENTATIONVIEW_H_
-#define MEMSPYECOMIMPLEMENTATIONVIEW_H_
-
-#include <QAbstractListModel>
-
-#include "memspylistview.h"
-#include "enginewrapper.h"
-
-
-class MemSpyEComImplementationModel : public QAbstractListModel
-{
-public:
- MemSpyEComImplementationModel(EngineWrapper &engine, int interfaceId, QObject *parent = 0);
-
- ~MemSpyEComImplementationModel();
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
- void refresh();
-
-private:
- int mInterfaceId;
-
- EngineWrapper& mEngine;
-
- QList<MemSpyEComImplementation*> mData;
-};
-
-class MemSpyEComImplementationView : public MemSpyListView
-{
-
- Q_OBJECT
-
-public:
- MemSpyEComImplementationView(EngineWrapper &engine, ViewManager &viewManager) :
- MemSpyListView(engine, viewManager),
- mModel(0)
- {}
-
-public slots:
- virtual void refresh();
-
-protected:
- void initialize(const QVariantMap& params);
-
-protected:
- virtual bool isRefreshable() const { return true; }
-
-private slots:
- void itemClicked(const QModelIndex& index);
-
-private:
- MemSpyEComImplementationModel* mModel;
-
- int mParentId;
-
- QString mParentName;
-};
-
-#endif /* MEMSPYECOMIMPLEMENTATIONVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspyecominterfaceview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYECOMINTERFACEVIEW_H_
-#define MEMSPYECOMINTERFACEVIEW_H_
-
-#include <QAbstractListModel>
-
-#include "memspylistview.h"
-#include "enginewrapper.h"
-
-
-class MemSpyEComInterfaceModel : public QAbstractListModel
-{
-public:
- MemSpyEComInterfaceModel(EngineWrapper &engine, int categoryId, QObject *parent = 0);
-
- ~MemSpyEComInterfaceModel();
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
- void refresh();
-
-private:
- int mCategoryId;
-
- EngineWrapper& mEngine;
-
- QList<MemSpyEComInterface*> mData;
-};
-
-class MemSpyEComInterfaceView : public MemSpyListView
-{
-
- Q_OBJECT
-
-public:
- MemSpyEComInterfaceView(EngineWrapper &engine, ViewManager &viewManager) :
- MemSpyListView(engine, viewManager),
- mModel(0)
- {}
-
-public slots:
- virtual void refresh();
-
-protected:
- void initialize(const QVariantMap& params);
-
-protected:
- virtual bool isRefreshable() const { return true; }
-
-private slots:
- void itemClicked(const QModelIndex& index);
-
-private:
- MemSpyEComInterfaceModel* mModel;
-
- int mParentId;
-
- QString mParentName;
-};
-
-#endif /* MEMSPYECOMINTERFACEVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspyheapdumpsview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYHEAPDUMPSVIEW_H_
-#define MEMSPYHEAPDUMPSVIEW_H_
-
-#include "memspyview.h"
-
-class HbDataFormModel;
-class HbDataFormModelItem;
-
-class MemSpyHeapDumpsView : public MemSpyView
-{
- Q_OBJECT
-
-public:
- MemSpyHeapDumpsView(EngineWrapper &engine, ViewManager &viewManager);
- virtual ~MemSpyHeapDumpsView();
-
- void initialize(const QVariantMap& params);
-
-protected:
- HbToolBar* createToolBar();
-
- HbWidget* createCentralWidget();
-
-private slots:
- void modeChanged(int mode);
- void dump();
-
- void updateDwoProgress(int progress, const QString& processName);
- void asyncOperationFinished(int errorCode);
-
-
-private:
- void removeFilterItem();
- void createFilterItem();
-
-private:
- HbDataFormModel* mModel;
- HbDataFormModelItem* mModeItem;
- HbDataFormModelItem* mFilterItem;
-
- HbProgressDialog* mDwoProgressDialog;
-};
-
-#endif /* MEMSPYHEAPDUMPSVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspykernelobjectdetailview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYKERNELOBJECTDETAILVIEW_H_
-#define MEMSPYKERNELOBJECTDETAILVIEW_H_
-
-#include "memspylistview.h"
-
-class MemSpyKernelObjectDetailModel : public QAbstractListModel
-{
-public:
- MemSpyKernelObjectDetailModel(const QStringList& details, QObject *parent = 0);
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
-private:
- QStringList mDetails;
-};
-
-class MemSpyKernelObjectDetailView : public MemSpyListView
-{
- Q_OBJECT
-
-public:
- MemSpyKernelObjectDetailView(EngineWrapper &engine, ViewManager &viewManager)
- : MemSpyListView(engine, viewManager) {}
-
-protected:
- virtual void initialize(const QVariantMap& params);
-
- virtual bool isBreadCrumbVisible() const;
-
- virtual QString getBreadCrumbText() const;
-
-private:
- QString mTypeName;
- QString mObjectName;
-};
-
-#endif /* MEMSPYKERNELOBJECTDETAILVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspykernelobjecttypeview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYKERNELOBJECTTYPESVIEW_H_
-#define MEMSPYKERNELOBJECTTYPESVIEW_H_
-
-#include "memspylistview.h"
-#include "enginewrapper.h"
-
-class MemSpyKernelObjectTypeModel : public QAbstractListModel
-{
-public:
- MemSpyKernelObjectTypeModel(EngineWrapper &engine, QObject *parent = 0);
-
- virtual ~MemSpyKernelObjectTypeModel();
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
-private:
- QString formatSize(qint64 size) const;
-
-private:
- QList<MemSpyKernelObjectType*> mObjectTypes;
-
- QStringList mKernelObjectNames;
-};
-
-class MemSpyKernelObjectTypeView : public MemSpyListView
-{
- Q_OBJECT
-
-public:
- MemSpyKernelObjectTypeView(EngineWrapper &engine, ViewManager &viewManager)
- : MemSpyListView(engine, viewManager) {}
-
-protected:
- virtual void initialize(const QVariantMap& params);
-
-private slots:
- void itemClicked(const QModelIndex& index);
-};
-
-#endif /* MEMSPYKERNELOBJECTTYPESVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspykernelobjectview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYKERNELOBJECTVIEW_H_
-#define MEMSPYKERNELOBJECTVIEW_H_
-
-#include "memspylistview.h"
-#include "enginewrapper.h"
-
-class MemSpyKernelObjectModel : public QAbstractListModel
-{
-public:
- MemSpyKernelObjectModel(EngineWrapper &engine, int objectType, QObject *parent = 0);
-
- ~MemSpyKernelObjectModel();
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
-private:
- QList<MemSpyKernelObject*> mObjects;
-};
-
-
-class MemSpyKernelObjectView : public MemSpyListView
-{
- Q_OBJECT
-
-public:
- MemSpyKernelObjectView(EngineWrapper &engine, ViewManager &viewManager)
- : MemSpyListView(engine, viewManager) {}
-
-protected:
- virtual void initialize(const QVariantMap& params);
-
- virtual bool isBreadCrumbVisible() const;
-
- virtual QString getBreadCrumbText() const;
-
-private slots:
- void itemClicked(const QModelIndex& index);
-
-private:
- QStringList getDetails(MemSpyKernelObject *object);
-};
-
-#endif /* MEMSPYKERNELOBJECTVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspylistview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYLISTVIEW_H_
-#define MEMSPYLISTVIEW_H_
-
-#include <HbListView>
-
-#include "memspyview.h"
-
-class MemSpyListView : public MemSpyView
- {
-public:
- MemSpyListView(EngineWrapper &engine, ViewManager &viewManager) :
- MemSpyView(engine, viewManager) {}
-
-protected:
- virtual HbWidget* createCentralWidget();
-
-protected:
- HbListView mListView;
- };
-
-#endif /* MEMSPYLISTVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspymainview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYMAINVIEW_H_
-#define MEMSPYMAINVIEW_H_
-
-#include "memspylistview.h"
-
-class MemSpyMainView : public MemSpyListView
-{
- Q_OBJECT
-
-public:
- MemSpyMainView(EngineWrapper &engine, ViewManager &viewManager)
- : MemSpyListView(engine, viewManager) {}
-protected:
- virtual void initialize(const QVariantMap& params);
- virtual bool isBreadCrumbVisible() const;
-
-public slots:
- void itemClicked(const QModelIndex& index);
-};
-
-#endif /* MEMSPYMAINVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspyprocessview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYPROCESSVIEW_H_
-#define MEMSPYPROCESSVIEW_H_
-
-#include <QAbstractListModel>
-
-#include "memspylistview.h"
-#include "enginewrapper.h"
-
-
-class MemSpyProcessModel : public QAbstractListModel
-{
-public:
- MemSpyProcessModel(EngineWrapper &engine, QObject *parent = 0);
-
- ~MemSpyProcessModel();
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
- void refresh();
-
-private:
- EngineWrapper& mEngine;
-
- QList<MemSpyProcess*> mProcesses;
-
- QMap<int, QString> mPriorityMap;
-};
-
-class MemSpyProcessView : public MemSpyListView
-{
- Q_OBJECT
-
-public:
- MemSpyProcessView(EngineWrapper &engine, ViewManager &viewManager) :
- MemSpyListView(engine, viewManager),
- mModel(0)
- {}
-
-public slots:
- virtual void refresh();
-
-protected:
- void initialize(const QVariantMap& params);
-
-protected:
- virtual bool isRefreshable() const { return true; }
-
-private slots:
- void itemClicked(const QModelIndex& index);
- void catchLongPress(HbAbstractViewItem *item, const QPointF &coords);
-
- void kill();
- void panic();
- void terminate();
-
-private:
- MemSpyProcessModel* mModel;
-
- HbMenu* mContextMenu;
- HbMenu* mEndMenu;
-
- ProcessId mProcessId;
-};
-
-#endif /* MEMSPYPROCESSVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspyserverview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYSERVERVIEW_H_
-#define MEMSPYSERVERVIEW_H_
-
-#include <QAbstractListModel>
-
-#include "memspylistview.h"
-#include "enginewrapper.h"
-
-
-class MemSpyServerModel : public QAbstractListModel
-{
-public:
- MemSpyServerModel(EngineWrapper &engine, QObject *parent = 0);
-
- ~MemSpyServerModel();
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
- void refresh();
-
-private:
- EngineWrapper& mEngine;
-
- QList<MemSpyServer*> mServers;
-};
-
-class MemSpyServerView : public MemSpyListView
-{
-
- Q_OBJECT
-
-public:
- MemSpyServerView(EngineWrapper &engine, ViewManager &viewManager) :
- MemSpyListView(engine, viewManager),
- mModel(0)
- {}
-
-public slots:
- virtual void refresh();
-
-protected:
- void initialize(const QVariantMap& params);
-
-protected:
- virtual bool isRefreshable() const { return true; }
-
-private slots:
- void itemClicked(const QModelIndex& index);
-
-private:
- MemSpyServerModel* mModel;
-};
-
-#endif /* MEMSPYSERVERVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspysettingsview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYSETTINGSVIEW_H_
-#define MEMSPYSETTINGSVIEW_H_
-
-#include <HbView>
-
-class HbDataForm;
-class HbDataFormModel;
-class HbDataFormModelItem;
-class EngineWrapper;
-
-class MemSpySettingsView : public HbView
-{
- Q_OBJECT
-
-public:
- MemSpySettingsView(EngineWrapper &engine);
- virtual ~MemSpySettingsView();
-
- void initialize(const QVariantMap& params);
-
-private slots:
- void updateModel();
- void accept();
- void reject();
-
-signals:
- void finished(bool ok);
-
-private:
- HbDataForm* mForm;
- HbDataFormModel* mModel;
- HbDataFormModelItem* mModeItem;
- HbDataFormModelItem* mPathItem;
- HbDataFormModelItem* mCustomPathItem;
-
- EngineWrapper& mEngine;
-};
-
-#endif /* MEMSPYSETTINGSVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspyswmtview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYSWMTVIEW_H_
-#define MEMSPYSWMTVIEW_H_
-
-#include "memspyview.h"
-
-class HbDataFormModel;
-class HbDataFormModelItem;
-class HbProgressDialog;
-
-class MemSpySwmtView : public MemSpyView
-{
- Q_OBJECT
-
-public:
- MemSpySwmtView(EngineWrapper &engine, ViewManager &viewManager);
- virtual ~MemSpySwmtView();
-
- void initialize(const QVariantMap& params);
-
-protected:
- HbToolBar* createToolBar();
-
- HbWidget* createCentralWidget();
-
-private slots:
- void toggleTimer();
- void forceDump();
- void modeChanged(int mode);
- void asyncOperationFinished(int errorCode);
-
-private:
- void updateTimerAction(bool isRunning);
- void removeCategoriesItem();
- void createCategoriesItem();
- void updateSettings();
-
-private:
- HbAction* mToggleTimerAction;
-
- HbDataFormModel* mModel;
- HbDataFormModelItem* mTimerItem;
- HbDataFormModelItem* mModeItem;
- HbDataFormModelItem* mCategoriesItem;
-
- HbProgressDialog* mProgressDialog;
-};
-
-#endif /* MEMSPYSWMTVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspythreaddetailindexview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYTHREADDETAILINDEXVIEW_H_
-#define MEMSPYTHREADDETAILINDEXVIEW_H_
-
-#include "memspylistview.h"
-#include "enginewrapper.h"
-
-class HbMenu;
-
-class MemSpyThreadDetailIndexView : public MemSpyListView
-{
- Q_OBJECT
-
-public:
- MemSpyThreadDetailIndexView(EngineWrapper &engine, ViewManager &viewManager)
- : MemSpyListView(engine, viewManager) {}
-protected:
- virtual void initialize(const QVariantMap& params);
-
- virtual HbMenu* createToolMenu();
-
- virtual bool isBreadCrumbVisible() const;
-
- virtual QString getBreadCrumbText() const;
-
-private slots:
- void changePriority();
- void itemClicked(const QModelIndex& index);
-
-private:
- ThreadId mThreadId;
- HbMenu *mPriorityMenu;
- QString mProcessName;
- QString mThreadName;
-};
-
-#endif /* MEMSPYTHREADDETAILINDEXVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspythreaddetailview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYTHREADDETAILVIEW_H_
-#define MEMSPYTHREADDETAILVIEW_H_
-
-#include "memspylistview.h"
-#include "enginewrapper.h"
-
-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<MemSpyThreadInfoItem*> mThreadInfo;
-};
-
-
-class MemSpyThreadDetailView : public MemSpyListView
-{
- Q_OBJECT
-
-public:
- MemSpyThreadDetailView(EngineWrapper &engine, ViewManager &viewManager)
- : MemSpyListView(engine, viewManager) {}
-protected:
- virtual void initialize(const QVariantMap& params);
-
- virtual bool isBreadCrumbVisible() const;
-
- virtual QString getBreadCrumbText() const;
-
-private:
- ThreadId mThreadId;
- HbMenu *mPriorityMenu;
- QString mProcessName;
- QString mThreadName;
-};
-
-#endif /* MEMSPYTHREADDETAILVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspythreadview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYTHREADVIEW_H_
-#define MEMSPYTHREADVIEW_H_
-
-#include "memspylistview.h"
-#include "enginewrapper.h"
-
-class MemSpyThreadModel : public QAbstractListModel
-{
-public:
- MemSpyThreadModel(EngineWrapper &engine, ProcessId threadId, QObject *parent = 0);
-
- ~MemSpyThreadModel();
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
- void refresh();
-
-private:
- ProcessId mProcessId;
-
- EngineWrapper& mEngine;
-
- QList<MemSpyThread*> mThreads;
-
- QMap<int, QString> mPriorityMap;
-};
-
-
-class MemSpyThreadView : public MemSpyListView
-{
- Q_OBJECT
-
-public:
- MemSpyThreadView(EngineWrapper &engine, ViewManager &viewManager);
- ~MemSpyThreadView();
-
-public slots:
- virtual void refresh();
-
-protected:
- void initialize(const QVariantMap& params);
-
-protected:
- virtual bool isRefreshable() const { return true; }
-
- virtual bool isBreadCrumbVisible() const;
-
- QString getBreadCrumbText() const;
-
- HbMenu* createToolMenu();
-
-private slots:
- void itemClicked(const QModelIndex& index);
- void catchLongPress(HbAbstractViewItem *item, const QPointF &coords);
- void changePriority();
-
- void kill();
- void panic();
- void terminate();
-
-private:
- HbMenu* mContextMenu;
- HbMenu* mPriorityMenu;
- ProcessId mProcessId;
- ThreadId mThreadId;
- QString mProcessName;
-
- MemSpyThreadModel* mModel;
-};
-
-#endif /* MEMSPYTHREADVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspytrackingview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef MEMSPYTRACKINGVIEW_H_
-#define MEMSPYTRACKINGVIEW_H_
-
-#include "memspylistview.h"
-
-class MemSpyTrackingView : public MemSpyListView
-{
- Q_OBJECT
-
-public:
- MemSpyTrackingView(EngineWrapper &engine, ViewManager &viewManager)
- : MemSpyListView(engine, viewManager) {}
-protected:
- virtual void initialize(const QVariantMap& params);
- virtual bool isBreadCrumbVisible() const;
-
-public slots:
- void itemClicked(const QModelIndex& index);
-};
-
-#endif /* MEMSPYTRACKINGVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspyview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYVIEW_H_
-#define MEMSPYVIEW_H_
-
-#include <HbView>
-#include <HbListView>
-#include <QVariantMap>
-
-class HbLabel;
-class HbProgressDialog;
-class EngineWrapper;
-class ViewManager;
-
-
-class MemSpyView : public HbView
-{
- Q_OBJECT
-
-public:
- MemSpyView(EngineWrapper &engine, ViewManager &viewManager);
-
- virtual ~MemSpyView();
-
-protected:
-
- virtual QList<QAction*> createOutputActions();
-
- virtual HbMenu* createToolMenu();
-
- virtual HbToolBar* createToolBar();
-
- virtual bool isRefreshable() const;
-
- virtual bool isBreadCrumbVisible() const;
-
- virtual QString getBreadCrumbText() const;
-
- virtual HbWidget* createCentralWidget() = 0;
-
-public slots:
-
- virtual void initialize(const QVariantMap& params);
-
- virtual void refresh();
-
- void showSettings();
-
- void showAbout();
-
-private slots:
-
- void closeSettings();
-
-protected:
-
- EngineWrapper &mEngine;
-
- ViewManager &mViewManager;
-
-
-private:
- HbMenu* mOutputMenu;
- HbMenu* mOutputGenInfoMenu;
- HbMenu* mOutputHeapInfoMenu;
- HbMenu* mOutputStackInfoMenu;
- HbToolBar* mToolBar;
-
- HbLabel* mBreadCrumb;
-};
-
-#endif /* MEMSPYVIEW_H_ */
--- a/memspyui/ui/hb/inc/viewmanager.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef VIEWMANAGER_H_
-#define VIEWMANAGER_H_
-
-
-#include <QObject>
-#include <QVariantMap>
-
-enum ViewIndex {
- MainView,
- ProcessView,
- ThreadView,
- ThreadDetailIndexView,
- ThreadDetailView,
- KernelObjectTypeView,
- KernelObjectView,
- KernelObjectDetailView,
- TrackingView,
- SwmtView,
- HeapDumpsView,
- ServerView,
- EComCategoryView,
- EComInterfaceView,
- EComImplementationView,
- EComImplementationDetailView,
-};
-
-class HbMainWindow;
-class HbView;
-class EngineWrapper;
-
-
-class ViewManager : public QObject
-{
- Q_OBJECT
-
-public:
- ViewManager(HbMainWindow &window, EngineWrapper &engine, QObject *parent = 0);
-
-public slots:
- void showView(ViewIndex index, const QVariantMap ¶ms);
-
- void showView(ViewIndex index);
-
- void goBack();
-
-private slots:
- void viewChanged(HbView *view);
-
-private:
- HbMainWindow &mWindow;
- EngineWrapper &mEngine;
-};
-
-#endif /* VIEWMANAGER_H_ */
--- a/memspyui/ui/hb/src/enginewrapper.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,578 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <QMessageBox>
-
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
-
-#include "enginewrapper.h"
-
-// CONSTANTS
-
-const QString OUTPUT_MODE = "output/mode";
-const QString OUTPUT_PATH = "output/path";
-const QString SWMT_PERIOD = "swmt/period";
-const QString SWMT_MODE = "swmt/mode";
-const QString SWMT_CATEGORIES = "swmt/categories";
-const QString HEAP_DUMPS_MODE = "heapdumps/mode";
-
-QString MemSpyProcess::exitInfo() const
-{
- QChar exitType[] = {'K', 'T', 'P', 'R'};
- QString result = QString("[%1]").arg(exitType[mProcess->ExitType()]);
-
- if (mProcess->ExitType() != EExitKill && mProcess->ExitType() != EExitPending) {
-
- QString exitCategory = QString((QChar*) mProcess->ExitCategory().Ptr(), mProcess->ExitCategory().Length());
- result.append(QString(" %1-%2").arg(exitCategory).arg(mProcess->ExitReason()));
- }
-
- return result;
-}
-
-
-MemSpyDwoProgressTracker::MemSpyDwoProgressTracker(RMemSpySession &session) :
- CActive(EPriorityStandard), mSession(session)
-{
- CActiveScheduler::Add(this);
-}
-
-MemSpyDwoProgressTracker::~MemSpyDwoProgressTracker()
-{
- Cancel();
-}
-
-void MemSpyDwoProgressTracker::start()
-{
- mSession.NotifyDeviceWideOperationProgress(mProgress, iStatus);
-
- SetActive();
-}
-
-void MemSpyDwoProgressTracker::cancel()
-{
- Cancel();
-}
-
-// Event handler method.
-
-void MemSpyDwoProgressTracker::RunL()
- {
-
- // If an error occurred handle it in RunError().
- User::LeaveIfError(iStatus.Int());
-
- // Resubmit the request immediately
-
- mSession.NotifyDeviceWideOperationProgress(mProgress, iStatus);
-
- SetActive();
-
- emit progress(mProgress.Progress(), QString((QChar*) mProgress.Description().Ptr(), mProgress.Description().Length()));
- }
-
-void MemSpyDwoProgressTracker::DoCancel()
-{
- // this is not yet implemented, as it is not required in current use cases
-}
-
-TInt MemSpyDwoProgressTracker::RunError(TInt aError)
-{
- // KErrNotReady and KErrCancel errors are OK, they just notify
- // us about the outstanding notification request that won't be
- // processed.
- Q_UNUSED(aError);
-
- return KErrNone;
-}
-
-MemSpyDwoTracker::MemSpyDwoTracker(RMemSpySession &session, DeviceWideOperation operation) :
- CActive(EPriorityStandard),
- mSession(session),
- mProgressTracker(new MemSpyDwoProgressTracker(session)),
- mOperation(operation)
-{
- CActiveScheduler::Add(this);
- connect(mProgressTracker, SIGNAL(progress(int,QString)), this, SIGNAL(progress(int,QString)));
-}
-
-MemSpyDwoTracker::~MemSpyDwoTracker()
-{
- Cancel();
-
- delete mProgressTracker;
-}
-
-void MemSpyDwoTracker::start()
-{
- void (RMemSpySession::*functions[])(TRequestStatus&) = {
- &RMemSpySession::OutputPhoneInfo,
- &RMemSpySession::OutputDetailedPhoneInfo,
- &RMemSpySession::OutputHeapInfo,
- &RMemSpySession::OutputCompactHeapInfo,
- &RMemSpySession::OutputHeapCellListing,
- &RMemSpySession::OutputHeapData,
- &RMemSpySession::OutputStackInfo,
- &RMemSpySession::OutputCompactStackInfo,
- &RMemSpySession::OutputUserStackData,
- &RMemSpySession::OutputKernelStackData };
-
- (mSession.*functions[mOperation])(iStatus);
-
- mProgressTracker->start();
-
- SetActive();
-}
-
-void MemSpyDwoTracker::cancel()
-{
- Cancel();
-}
-
-// Event handler method.
-
-void MemSpyDwoTracker::RunL()
- {
-
- // If an error occurred handle it in RunError().
- User::LeaveIfError(iStatus.Int());
-
- // Operation has finished successfully
- emit finished(0);
- }
-
-void MemSpyDwoTracker::DoCancel()
-{
- // Cancel progress tracker
- mProgressTracker->cancel();
-
- mSession.CancelDeviceWideOperationL();
-}
-
-TInt MemSpyDwoTracker::RunError(TInt aError)
-{
- // Emit the finished signal to notify user
- // operation was canceled
- emit finished(aError);
-
- return KErrNone;
-}
-
-MemSpyAsyncTracker::MemSpyAsyncTracker(RMemSpySession& session, void (RMemSpySession::*function)(TRequestStatus&)) :
- CActive(EPriorityStandard),
- mFunction(function),
- mSession(session)
-{
- CActiveScheduler::Add(this);
-}
-
-void MemSpyAsyncTracker::RunL()
-{
- // If an error occurred handle it in RunError().
- User::LeaveIfError(iStatus.Int());
-
- // Operation has finished successfully
- emit finished(0);
-}
-
-void MemSpyAsyncTracker::DoCancel()
-{
- // nothing to do here
-}
-
-TInt MemSpyAsyncTracker::RunError(TInt aError)
-{
- // Emit the finished signal to notify user
- // that operation was canceled
- emit finished(aError);
-
- return KErrNone;
-}
-
-void MemSpyAsyncTracker::start()
-{
- (mSession.*mFunction)(iStatus);
-
- SetActive();
-}
-
-MemSpySettings::MemSpySettings() :
- QSettings("Nokia", "MemSpy")
-{
-}
-
-OutputMode MemSpySettings::outputMode() const
-{
- return static_cast<OutputMode>(value(OUTPUT_MODE, 0).toInt());
-}
-
-void MemSpySettings::setOutputMode(OutputMode mode)
-{
- setValue(OUTPUT_MODE, mode);
-}
-
-QString MemSpySettings::outputPath() const
-{
- return value(OUTPUT_PATH).toString();
-}
-
-void MemSpySettings::setOutputPath(const QString& path)
-{
- setValue(OUTPUT_PATH, path);
-}
-
-int MemSpySettings::swmtTimerPeriod() const
-{
- return value(SWMT_PERIOD, 30).toInt();
-}
-
-void MemSpySettings::setSwmtMode(SwmtMode mode)
-{
- setValue(SWMT_MODE, mode);
-}
-
-SwmtMode MemSpySettings::swmtMode() const
-{
- return static_cast<SwmtMode>(value(SWMT_MODE, 0).toInt());
-}
-
-void MemSpySettings::setSwmtTimerPeriod(int period)
-{
- setValue(SWMT_PERIOD, period);
-}
-
-
-QVariantList MemSpySettings::swmtCategories() const
-{
- return value(SWMT_CATEGORIES).toList();
-}
-
-void MemSpySettings::setSwmtCategories(const QVariantList& categories)
-{
- setValue(SWMT_CATEGORIES, categories);
-}
-
-HeapDumpsMode MemSpySettings::heapDumpsMode() const
-{
- return static_cast<HeapDumpsMode>(value(HEAP_DUMPS_MODE).toInt());
-}
-
-void MemSpySettings::setHeapDumpsMode(HeapDumpsMode mode)
-{
- setValue(HEAP_DUMPS_MODE, mode);
-}
-
-
-EngineWrapper::EngineWrapper() :
- mSwmtRunning(false)
-{
-}
-
-EngineWrapper::~EngineWrapper()
-{
- mSession.Close();
-}
-
-bool EngineWrapper::initialize()
-{
- return mSession.Connect() == KErrNone;
-}
-
-MemSpySettings& EngineWrapper::settings()
-{
- return mSettings;
-}
-
-const MemSpySettings& EngineWrapper::settings() const
-{
- return mSettings;
-}
-
-
-
-QList<MemSpyProcess*> EngineWrapper::getProcesses()
-{
- QList<MemSpyProcess*> result;
-
- RArray<CMemSpyApiProcess*> proc;
-
- QT_TRAP_THROWING(mSession.GetProcessesL(proc));
-
- for (TInt i=0; i<proc.Count(); i++)
- result.append(new MemSpyProcess(proc[i]));
-
- return result;
-}
-
-QList<MemSpyThread*> EngineWrapper::getThreads(ProcessId processId)
-{
- QList<MemSpyThread*> result;
-
- RArray<CMemSpyApiThread*> proc;
-
- QT_TRAP_THROWING(mSession.GetThreadsL(processId, proc));
-
- for (TInt i=0; i<proc.Count(); i++)
- result.append(new MemSpyThread(proc[i]));
-
- return result;
-}
-
-QList<MemSpyThreadInfoItem*> EngineWrapper::getThreadInfo(ThreadId threadId, ThreadInfoType type)
-{
- QList<MemSpyThreadInfoItem*> result;
- RArray<CMemSpyApiThreadInfoItem*> threadInfo;
- qt_symbian_throwIfError(mSession.GetThreadInfoItems(threadInfo, threadId,
- static_cast<TMemSpyThreadInfoItemType>(type)));
-
- for (TInt i=0; i<threadInfo.Count(); i++)
- result.append(new MemSpyThreadInfoItem(threadInfo[i]));
-
- return result;
-}
-
-void EngineWrapper::setThreadPriority(ThreadId threadId, ThreadPriority priority)
-{
- TRAP_IGNORE(mSession.SetThreadPriorityL(threadId, priority));
-}
-
-QList<MemSpyKernelObjectType*> EngineWrapper::getKernelObjectTypes()
-{
- QList<MemSpyKernelObjectType*> result;
-
- RArray<CMemSpyApiKernelObject*> types;
- qt_symbian_throwIfError(mSession.GetKernelObjects(types));
-
- for(TInt i=0; i<types.Count(); i++)
- result.append(new MemSpyKernelObjectType(types[i]));
-
- return result;
-}
-
-QList<MemSpyKernelObject*> EngineWrapper::getKernelObjects(int type)
-{
- QList<MemSpyKernelObject*> result;
-
- RArray<CMemSpyApiKernelObjectItem*> objects;
- qt_symbian_throwIfError(mSession.GetKernelObjectItems(objects,
- static_cast<TMemSpyDriverContainerType>(type)));
-
- for (TInt i=0; i<objects.Count(); i++)
- result.append(new MemSpyKernelObject(objects[i]));
-
- return result;
-}
-
-QList<MemSpyServer*> EngineWrapper::getServers()
-{
- QList<MemSpyServer*> result;
-
- RArray<CMemSpyApiServer*> proc;
-
- QT_TRAP_THROWING(mSession.GetServersL(proc));
-
- for (TInt i=0; i<proc.Count(); i++)
- result.append(new MemSpyServer(proc[i]));
-
- return result;
-}
-
-QList<MemSpyEComCategory*> EngineWrapper::getEComCategories()
-{
- QList<MemSpyEComCategory*> result;
-
- RArray<CMemSpyApiEComCategory*> cat;
-
- QT_TRAP_THROWING(mSession.GetEComCategoriesL(cat));
-
- for (TInt i=0; i<cat.Count(); i++)
- result.append(new MemSpyEComCategory(cat[i]));
-
- return result;
-}
-
-QList<MemSpyEComInterface*> EngineWrapper::getEComInterfaces(int categoryId)
-{
- QList<MemSpyEComInterface*> result;
-
- RArray<CMemSpyApiEComInterface*> interfaces;
-
- QT_TRAP_THROWING(mSession.GetEComInterfacesL(TUid::Uid(categoryId), interfaces));
-
- for (TInt i=0; i<interfaces.Count(); i++)
- result.append(new MemSpyEComInterface(interfaces[i]));
-
- return result;
-}
-
-QList<MemSpyEComImplementation*> EngineWrapper::getEComImplementations(int interfaceId)
-{
- QList<MemSpyEComImplementation*> result;
-
- RArray<CMemSpyApiEComImplementation*> implementations;
-
- QT_TRAP_THROWING(mSession.GetEComImplementationsL(TUid::Uid(interfaceId), implementations));
-
- for (TInt i=0; i<implementations.Count(); i++)
- result.append(new MemSpyEComImplementation(implementations[i]));
-
- return result;
-}
-
-
-MemSpyDwoTracker* EngineWrapper::createDeviceWideOperation(DeviceWideOperation operation)
-{
- return new MemSpyDwoTracker(mSession, operation);
-}
-
-MemSpyKernelHeapDumpTracker* EngineWrapper::createKernelHeapDumpTracker()
-{
- return new MemSpyKernelHeapDumpTracker(mSession);
-}
-
-MemSpySwmtDumpTracker* EngineWrapper::createSwmtDumpTracker()
-{
- return new MemSpySwmtDumpTracker(mSession);
-}
-
-void EngineWrapper::setSwmtSettings(SwmtMode mode, const QVariantList& categories)
-{
- int bits = 0;
- bool heapDumps = false;
- switch (mode)
- {
- case SwmtModeBasic:
- bits = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap |
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks |
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData |
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory;
-
- break;
-
- case SwmtModeFull:
- bits = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
- heapDumps = true;
-
- break;
-
- case SwmtModeCustom:
- bits = 0;
- // this needs to be in sync. with swmt view categories
- TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerCategories cats[] = {
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache,
- //TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles,
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap,
- //TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap,
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks,
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks,
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive,
- //TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks,
- //TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData,
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode,
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles,
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles,
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage,
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory,
- TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups
- };
-
- foreach (const QVariant& bit, categories)
- bits |= cats[bit.toInt()];
-
- break;
- }
-
- TRAP_IGNORE(mSession.SetSwmtCategoriesL(bits));
- TRAP_IGNORE(mSession.SetSwmtHeapDumpsEnabledL(heapDumps));
-}
-
-bool EngineWrapper::isSwmtRunning()
-{
- return mSwmtRunning;
-}
-
-void EngineWrapper::startSwmt(int period)
-{
- mSwmtRunning = true;
- updateOutputSettings();
- TRAP_IGNORE(mSession.StartSwmtTimerL(period));
-}
-
-void EngineWrapper::stopSwmt()
-{
- mSwmtRunning = false;
- TRAP_IGNORE(mSession.StopSwmtTimerL());
-}
-
-void EngineWrapper::forceSwmtDump()
-{
- updateOutputSettings();
- TRAP_IGNORE(mSession.ForceSwmtUpdateL());
-}
-
-void EngineWrapper::outputKernelHeapData()
-{
- updateOutputSettings();
- TRAP_IGNORE(mSession.OutputKernelHeapDataL());
-}
-
-int EngineWrapper::outputThreadHeapData(const QString& filter)
-{
- TPtrC customFilterDesc(static_cast<const TUint16*>(filter.utf16()), filter.length());
-
- TRAPD(err, mSession.OutputThreadHeapDataL(customFilterDesc));
-
- return err;
-}
-
-void EngineWrapper::updateOutputSettings()
-{
- switch (mSettings.outputMode()) {
- case OutputModeTrace:
- TRAP_IGNORE(mSession.SwitchOutputToTraceL());
- break;
-
- case OutputModeFile:
-
- if (mSettings.outputPath().isEmpty()) {
- TRAP_IGNORE(mSession.SwitchOutputToFileL(KNullDesC));
-
- } else {
-
- QString root = mSettings.outputPath();
- TPtrC rootDesc (static_cast<const TUint16*>(root.utf16()), root.length());
-
- TRAP_IGNORE(mSession.SwitchOutputToFileL(rootDesc));
- }
-
- }
-}
-
-void EngineWrapper::killProcess(ProcessId process)
-{
- TRAP_IGNORE(mSession.EndProcessL(process, EKill));
-}
-
-void EngineWrapper::panicProcess(ProcessId process)
-{
- TRAP_IGNORE(mSession.EndProcessL(process, EPanic));
-}
-
-void EngineWrapper::terminateProcess(ProcessId process)
-{
- TRAP_IGNORE(mSession.EndProcessL(process, ETerminate));
-}
--- a/memspyui/ui/hb/src/main.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <HbApplication>
-#include <QMessageBox>
-#include <HbMainWindow>
-
-#include "enginewrapper.h"
-#include "memspyview.h"
-#include "memspyprocessview.h"
-#include "viewmanager.h"
-
-int main(int argc, char *argv[])
-{
- HbApplication app(argc, argv);
-
- EngineWrapper engine;
- if (!engine.initialize()) {
- QMessageBox::critical(0, "Error", "Engine failed to initialize. Closing.");
- return 1;
- }
-
- HbMainWindow window;
- ViewManager viewManager(window, engine);
- viewManager.showView(MainView);
-
- window.show();
- return app.exec();
-}
--- a/memspyui/ui/hb/src/memspyecomcategoryview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include "memspyecomcategoryview.h"
-#include "viewmanager.h"
-
-MemSpyEComCategoryModel::MemSpyEComCategoryModel(EngineWrapper &engine, QObject *parent) :
- QAbstractListModel(parent),
- mEngine(engine),
- mData(engine.getEComCategories())
-{
-}
-
-MemSpyEComCategoryModel::~MemSpyEComCategoryModel()
-{
- qDeleteAll(mData);
-}
-
-int MemSpyEComCategoryModel::rowCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent);
- return mData.count();
-}
-
-QVariant MemSpyEComCategoryModel::data(const QModelIndex &index, int role) const
-{
- if (role == Qt::DisplayRole) {
- const MemSpyEComCategory* cat = mData.at(index.row());
-
- QStringList lines;
- lines << cat->name();
- lines << QString("%1 interface(s)").arg(cat->interfaceCount());
-
- return lines;
- }
-
- if (role == Qt::UserRole)
- return mData.at(index.row())->id();
-
- return QVariant();
-}
-
-void MemSpyEComCategoryModel::refresh()
-{
- beginResetModel();
- QList<MemSpyEComCategory*> data = mEngine.getEComCategories();
- qDeleteAll(mData);
- mData = data;
- endResetModel();
-}
-
-
-void MemSpyEComCategoryView::initialize(const QVariantMap& params)
-{
- setTitle(tr("ECom Categories"));
- MemSpyView::initialize(params);
-
- mModel = new MemSpyEComCategoryModel(mEngine, this);
- mListView.setModel(mModel);
-
- connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
-}
-
-void MemSpyEComCategoryView::itemClicked(const QModelIndex& index)
-{
- QVariantMap map;
- map.insert("pid", index.data(Qt::UserRole));
- map.insert("pname", index.data(Qt::DisplayRole).toStringList().at(0));
- mViewManager.showView(EComInterfaceView, map);
-}
-
-void MemSpyEComCategoryView::refresh()
-{
- mModel->refresh();
-}
--- a/memspyui/ui/hb/src/memspyecomimplementationdetailview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include "memspyecomimplementationdetailview.h"
-#include "viewmanager.h"
-
-MemSpyEComImplementationDetailModel::MemSpyEComImplementationDetailModel(MemSpyEComImplementation* impl, QObject *parent) :
- QAbstractListModel(parent)
-{
- mData << (QStringList() << tr("Impl. Uid") << QString("0x%1").arg(impl->id(), 0, 16));
- mData << (QStringList() << tr("Display Name") << impl->name());
- mData << (QStringList() << tr("Opaque Data") << impl->opaqueData());
- mData << (QStringList() << tr("Data Type") << impl->dataType());
- mData << (QStringList() << tr("Drive") << impl->drive());
- mData << (QStringList() << tr("Is Disabled") << (impl->disabled() ? tr("Yes") : tr("No")));
- mData << (QStringList() << tr("ROM-Only") << (impl->romOnly() ? tr("Yes") : tr("No")));
- mData << (QStringList() << tr("ROM-Based") << (impl->romBased() ? tr("Yes") : tr("No")));
-}
-
-int MemSpyEComImplementationDetailModel::rowCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent);
- return mData.count();
-}
-
-QVariant MemSpyEComImplementationDetailModel::data(const QModelIndex &index, int role) const
-{
- if (role == Qt::DisplayRole)
- return mData.at(index.row());
-
- return QVariant();
-}
-
-void MemSpyEComImplementationDetailView::initialize(const QVariantMap& params)
-{
- setTitle(tr("ECom Implementation Detail"));
- MemSpyView::initialize(params);
-
- MemSpyEComImplementation* implementation = static_cast<MemSpyEComImplementation*>(
- qVariantValue<void*>(params["implementation"]));
-
- mModel = new MemSpyEComImplementationDetailModel(implementation);
- mListView.setModel(mModel);
-}
--- a/memspyui/ui/hb/src/memspyecomimplementationview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include "memspyecomimplementationview.h"
-#include "viewmanager.h"
-
-MemSpyEComImplementationModel::MemSpyEComImplementationModel(EngineWrapper &engine, int interfaceId, QObject *parent) :
- QAbstractListModel(parent),
- mInterfaceId(interfaceId),
- mEngine(engine),
- mData(engine.getEComImplementations(interfaceId))
-{
-}
-
-MemSpyEComImplementationModel::~MemSpyEComImplementationModel()
-{
- qDeleteAll(mData);
-}
-
-int MemSpyEComImplementationModel::rowCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent);
- return mData.count();
-}
-
-QVariant MemSpyEComImplementationModel::data(const QModelIndex &index, int role) const
-{
- if (role == Qt::DisplayRole) {
- const MemSpyEComImplementation* impl = mData.at(index.row());
-
- QStringList lines;
- lines << QString("0x%1").arg(impl->id(), 0, 16);
- lines << impl->name();
-
- return lines;
- }
-
- if (role == Qt::UserRole)
- return qVariantFromValue<void*>(mData.at(index.row()));
-
- return QVariant();
-}
-
-void MemSpyEComImplementationModel::refresh()
-{
- beginResetModel();
- QList<MemSpyEComImplementation*> data = mEngine.getEComImplementations(mInterfaceId);
- qDeleteAll(mData);
- mData = data;
- endResetModel();
-}
-
-
-void MemSpyEComImplementationView::initialize(const QVariantMap& params)
-{
- setTitle(tr("ECom Implementations"));
-
- mParentId = params["pid"].toInt();
- mParentName = params["pname"].toString();
-
- MemSpyView::initialize(params);
-
- mModel = new MemSpyEComImplementationModel(mEngine, mParentId, this);
- mListView.setModel(mModel);
-
- connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
-}
-
-void MemSpyEComImplementationView::itemClicked(const QModelIndex& index)
-{
- QVariantMap map;
- map.insert("implementation", index.data(Qt::UserRole));
- mViewManager.showView(EComImplementationDetailView, map);
-}
-
-void MemSpyEComImplementationView::refresh()
-{
- mModel->refresh();
-}
--- a/memspyui/ui/hb/src/memspyecominterfaceview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include "memspyecominterfaceview.h"
-#include "viewmanager.h"
-
-MemSpyEComInterfaceModel::MemSpyEComInterfaceModel(EngineWrapper &engine, int categoryId, QObject *parent) :
- QAbstractListModel(parent),
- mCategoryId(categoryId),
- mEngine(engine),
- mData(engine.getEComInterfaces(categoryId))
-{
-}
-
-MemSpyEComInterfaceModel::~MemSpyEComInterfaceModel()
-{
- qDeleteAll(mData);
-}
-
-int MemSpyEComInterfaceModel::rowCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent);
- return mData.count();
-}
-
-QVariant MemSpyEComInterfaceModel::data(const QModelIndex &index, int role) const
-{
- if (role == Qt::DisplayRole) {
- const MemSpyEComInterface* interface = mData.at(index.row());
-
- QStringList lines;
- lines << interface->name();
- lines << QString("%1 implementation(s)").arg(interface->implementationCount());
-
- return lines;
- }
-
- if (role == Qt::UserRole)
- return mData.at(index.row())->id();
-
- return QVariant();
-}
-
-void MemSpyEComInterfaceModel::refresh()
-{
- beginResetModel();
- QList<MemSpyEComInterface*> data = mEngine.getEComInterfaces(mCategoryId);
- qDeleteAll(mData);
- mData = data;
- endResetModel();
-}
-
-
-void MemSpyEComInterfaceView::initialize(const QVariantMap& params)
-{
- setTitle(tr("ECom Interfaces"));
-
- mParentId = params["pid"].toInt();
- mParentName = params["pname"].toString();
-
- MemSpyView::initialize(params);
-
- mModel = new MemSpyEComInterfaceModel(mEngine, mParentId, this);
- mListView.setModel(mModel);
-
- connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
-}
-
-void MemSpyEComInterfaceView::itemClicked(const QModelIndex& index)
-{
- QVariantMap map;
- map.insert("pid", index.data(Qt::UserRole));
- map.insert("pname", index.data(Qt::DisplayRole).toStringList().at(0));
- mViewManager.showView(EComImplementationView, map);
-}
-
-void MemSpyEComInterfaceView::refresh()
-{
- mModel->refresh();
-}
--- a/memspyui/ui/hb/src/memspyheapdumpsview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include <HbToolBar>
-#include <HbAction>
-#include <HbDataForm>
-#include <HbDataFormModel>
-#include <HbProgressDialog>
-#include <HbMessageBox>
-#include <HbLabel>
-
-#include "memspyheapdumpsview.h"
-#include "enginewrapper.h"
-
-const QStringList MODE_ITEMS = QStringList() <<
- MemSpyHeapDumpsView::tr("Kernel") <<
- MemSpyHeapDumpsView::tr("User") <<
- MemSpyHeapDumpsView::tr("Both");
-
-MemSpyHeapDumpsView::MemSpyHeapDumpsView(EngineWrapper &engine, ViewManager &viewManager) :
- MemSpyView(engine, viewManager),
- mModel(0),
- mModeItem(0),
- mFilterItem(0),
- mDwoProgressDialog(0)
-{
-}
-
-MemSpyHeapDumpsView::~MemSpyHeapDumpsView()
-{
- delete mDwoProgressDialog;
-}
-
-void MemSpyHeapDumpsView::initialize(const QVariantMap& params)
-{
- setTitle(tr("Heap Dumps"));
-
- MemSpyView::initialize(params);
-}
-
-HbToolBar* MemSpyHeapDumpsView::createToolBar()
-{
- HbToolBar* toolBar = new HbToolBar();
- toolBar->addAction(tr("Dump Now"), this, SLOT(dump()));
- return toolBar;
-}
-
-HbWidget* MemSpyHeapDumpsView::createCentralWidget()
-{
- mModel = new HbDataFormModel(this);
-
- //TODO: uncomment after kernel heap dumps are implemented
-// mModeItem = mModel->appendDataFormItem(
-// HbDataFormModelItem::ComboBoxItem, tr("Heap Dump"));
-// mModeItem->setContentWidgetData("items", MODE_ITEMS);
-// mModeItem->setContentWidgetData("currentIndex", mEngine.settings().heapDumpsMode());
-// modeChanged(mEngine.settings().heapDumpsMode());
-
- //TODO: remove after kernel heap dumps are implemented
- createFilterItem();
-
- HbDataForm* form = new HbDataForm(this);
- form->setModel(mModel);
-
- //TODO: uncomment after kernel heap dumps are implemented
-// form->addConnection(mModeItem, SIGNAL(currentIndexChanged(int)), this, SLOT(modeChanged(int)));
-
- return form;
-}
-
-void MemSpyHeapDumpsView::modeChanged(int mode)
-{
- if (mode == HeapDumpsModeKernel && mFilterItem)
- removeFilterItem();
- else if (mode != HeapDumpsModeKernel && !mFilterItem)
- createFilterItem();
-}
-
-void MemSpyHeapDumpsView::createFilterItem()
-{
- mFilterItem = mModel->appendDataFormItem(
- HbDataFormModelItem::TextItem, tr("Filter"));
-}
-
-void MemSpyHeapDumpsView::removeFilterItem()
-{
- mModel->removeItem(mFilterItem);
- mFilterItem = 0;
-}
-
-void MemSpyHeapDumpsView::dump()
-{
- mEngine.updateOutputSettings();
-
- HeapDumpsMode mode = HeapDumpsModeUser;
- //TODO: uncomment after kernel heap dumps are implemented
- //static_cast<HeapDumpsMode>(mModeItem->contentWidgetData("currentIndex").toInt());
-
- // save settings
- //TODO: uncomment after kernel heap dumps are implemented
- //mEngine.settings().setHeapDumpsMode(mode);
-
- if (mode == HeapDumpsModeKernel || mode == HeapDumpsModeBoth) {
- // dump kernel heap
- mDwoProgressDialog = new HbProgressDialog(HbProgressDialog::WaitDialog);
- mDwoProgressDialog->setText(tr("Please wait..."));
- mDwoProgressDialog->show();
-
- MemSpyKernelHeapDumpTracker* tracker = mEngine.createKernelHeapDumpTracker();
- connect(tracker, SIGNAL(finished(int)), this, SLOT(asyncOperationFinished(int)));
- tracker->start();
- }
-
- if (mode == HeapDumpsModeUser || mode == HeapDumpsModeBoth) {
- // dump user heap
-
- QString filter = mFilterItem->contentWidgetData("text").toString();
- if (!filter.isEmpty()) {
-
- int errorCode = mEngine.outputThreadHeapData(filter);
- if (errorCode == KErrNotFound) {
- HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
- messageBox->setText(tr("No thread matches your filter"));
- HbLabel *header = new HbLabel(tr("No such thread"), messageBox);
- messageBox->setHeadingWidget(header);
- messageBox->setAttribute(Qt::WA_DeleteOnClose);
- messageBox->setTimeout(HbPopup::StandardTimeout);
- messageBox->open();
- }
-
-
- } else {
- mDwoProgressDialog = new HbProgressDialog(HbProgressDialog::ProgressDialog);
- mDwoProgressDialog->setMinimum(0);
- mDwoProgressDialog->setMaximum(100);
- mDwoProgressDialog->show();
-
- MemSpyDwoTracker* tracker = mEngine.createDeviceWideOperation(OutputHeapData);
- connect(tracker, SIGNAL(progress(int,QString)), this, SLOT(updateDwoProgress(int,QString)));
- connect(tracker, SIGNAL(finished(int)), this, SLOT(asyncOperationFinished(int)));
- connect(mDwoProgressDialog, SIGNAL(cancelled()), tracker, SLOT(cancel()));
- tracker->start();
- }
- }
-}
-
-void MemSpyHeapDumpsView::updateDwoProgress(int progress, const QString& processName)
-{
- mDwoProgressDialog->setText(processName);
- mDwoProgressDialog->setProgressValue(progress);
-}
-
-void MemSpyHeapDumpsView::asyncOperationFinished(int errorCode)
-{
- mDwoProgressDialog->hide();
- delete mDwoProgressDialog;
- mDwoProgressDialog = 0;
-
- delete sender();
-
- if (errorCode != KErrNone && errorCode != KErrCancel) {
- HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeWarning);
- messageBox->setText(tr("An error occured during the operation. Error code: %1").arg(errorCode));
- HbLabel *header = new HbLabel(tr("Error"), messageBox);
- messageBox->setHeadingWidget(header);
- messageBox->setAttribute(Qt::WA_DeleteOnClose);
- messageBox->setTimeout(HbPopup::StandardTimeout);
- messageBox->open();
- }
-}
--- a/memspyui/ui/hb/src/memspykernelobjectdetailview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include <QStringListModel>
-
-#include "memspykernelobjectdetailview.h"
-
-MemSpyKernelObjectDetailModel::MemSpyKernelObjectDetailModel(const QStringList& details, QObject *parent) :
- QAbstractListModel(parent),
- mDetails(details)
-{
-
-}
-
-int MemSpyKernelObjectDetailModel::rowCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent);
- return mDetails.count();
-}
-
-QVariant MemSpyKernelObjectDetailModel::data(const QModelIndex &index, int role) const
-{
- if (role == Qt::DisplayRole) {
-
- // convert from semicolon delimited line to two lines
- return mDetails.at(index.row()).split(": ");
- }
-
- return QVariant();
-}
-
-
-void MemSpyKernelObjectDetailView::initialize(const QVariantMap& params)
-{
- setTitle("Details");
-
- mTypeName = params["typeName"].toString();
- mObjectName = params["objectName"].toString();
- MemSpyView::initialize(params);
-
- QStringList items = params.value("details").toStringList();
- mListView.setModel(new MemSpyKernelObjectDetailModel(items, this));
-}
-
-bool MemSpyKernelObjectDetailView::isBreadCrumbVisible() const
-{
- return true;
-}
-
-QString MemSpyKernelObjectDetailView::getBreadCrumbText() const
-{
- return tr("Kernel Objects > %1 > %2").arg(mTypeName).arg(mObjectName);
-}
--- a/memspyui/ui/hb/src/memspykernelobjecttypeview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include <QStringListModel>
-
-#include "memspykernelobjecttypeview.h"
-#include "viewmanager.h"
-
-MemSpyKernelObjectTypeModel::MemSpyKernelObjectTypeModel(EngineWrapper &engine, QObject *parent) :
- QAbstractListModel(parent),
- mObjectTypes(engine.getKernelObjectTypes())
-{
- mKernelObjectNames << "Threads" << "Processes" << "Chunks" << "Libraries" <<
- "Semaphores" << "Mutexes" << "Timers" << "Servers" << "Sessions" << "Logical Devices" <<
- "Physical Devices" << "Logical Channels" << "Change Notifiers" << "Undertakers" <<
- "Message Queues" << "Property Refs." << "Conditional Vars.";
-}
-
-MemSpyKernelObjectTypeModel::~MemSpyKernelObjectTypeModel()
-{
- qDeleteAll(mObjectTypes);
-}
-
-int MemSpyKernelObjectTypeModel::rowCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent);
- return mObjectTypes.count();
-}
-
-QVariant MemSpyKernelObjectTypeModel::data(const QModelIndex &index, int role) const
-{
- if (role == Qt::DisplayRole) {
- QStringList lines;
- lines << mKernelObjectNames.at(index.row());
- lines << QString("%1, %2").
- arg(tr("%n item(s)", "", mObjectTypes.at(index.row())->count())).
- arg(formatSize(mObjectTypes.at(index.row())->size()));
-
- return lines;
- }
-
- if (role == Qt::UserRole)
- return mObjectTypes.at(index.row())->id();
-
- return QVariant();
-}
-
-QString MemSpyKernelObjectTypeModel::formatSize(qint64 size) const
-{
- // If < 1000K
- if (size < 1024000)
- return QString("%1K").arg(size ? qBound<int>(1, (size + 512) >> 10, 999) : 0);
-
- // larger than 1M
- double sizeInM = size / 1048576.;
- return sizeInM >= 1000 ?
- QString("%1G").arg(qMax<double>(1, sizeInM / 1024), 0, 'f', 1) :
- QString("%1M").arg(qBound<double>(1, sizeInM, 999.9), 0, 'f', 1);
-}
-
-void MemSpyKernelObjectTypeView::initialize(const QVariantMap& params)
-{
- setTitle(tr("Kernel Objects"));
-
- MemSpyView::initialize(params);
-
- mListView.setModel(new MemSpyKernelObjectTypeModel(mEngine, this));
-
- connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
-}
-
-void MemSpyKernelObjectTypeView::itemClicked(const QModelIndex& index)
-{
- QVariantMap map;
- map.insert("type", index.row());
- mViewManager.showView(KernelObjectView, map);
-}
-
--- a/memspyui/ui/hb/src/memspykernelobjectview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,310 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include <QStringListModel>
-
-#include "memspykernelobjectview.h"
-#include "viewmanager.h"
-
-MemSpyKernelObjectModel::MemSpyKernelObjectModel(EngineWrapper &engine, int objectType, QObject *parent) :
- QAbstractListModel(parent),
- mObjects(engine.getKernelObjects(objectType))
-{
-}
-
-MemSpyKernelObjectModel::~MemSpyKernelObjectModel()
-{
- qDeleteAll(mObjects);
-}
-
-int MemSpyKernelObjectModel::rowCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent);
- return mObjects.count();
-}
-
-QVariant MemSpyKernelObjectModel::data(const QModelIndex &index, int role) const
-{
- if (role == Qt::DisplayRole) {
- QStringList lines;
- lines << mObjects.at(index.row())->name();
-
- return lines;
- }
-
- if (role == Qt::UserRole) {
- return qVariantFromValue<void*>(mObjects.at(index.row()));
- }
-
- return QVariant();
-}
-
-void MemSpyKernelObjectView::initialize(const QVariantMap& params)
-{
- QStringList list = QStringList() << "Threads" << "Processes" << "Chunks" << "Libraries" <<
- "Semaphores" << "Mutexes" << "Timers" << "Servers" << "Sessions" << "Logical Devices" <<
- "Physical Devices" << "Logical Channels" << "Change Notifiers" << "Undertakers" <<
- "Message Queues" << "Property Refs." << "Conditional Vars.";
-
- int type = params.value("type").toInt();
-
- setTitle(list.at(type));
-
- MemSpyView::initialize(params);
-
- //mListView.setModel(new MemSpyKernelObjectTypeModel(mEngine, this));
- mListView.setModel(new MemSpyKernelObjectModel(mEngine, type, this));
-
- connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
-}
-
-bool MemSpyKernelObjectView::isBreadCrumbVisible() const
-{
- return true;
-}
-
-QString MemSpyKernelObjectView::getBreadCrumbText() const
-{
- return tr("Kernel Objects");
-}
-
-
-void MemSpyKernelObjectView::itemClicked(const QModelIndex& index)
-{
- QVariantMap map;
- map.insert("details", getDetails(static_cast<MemSpyKernelObject*>(qVariantValue<void*>(index.data(Qt::UserRole)))));
- map.insert("typeName", title());
- map.insert("objectName", static_cast<MemSpyKernelObject*>(qVariantValue<void*>(index.data(Qt::UserRole)))->nameDetail());
- mViewManager.showView(KernelObjectDetailView, map);
-}
-
-QStringList MemSpyKernelObjectView::getDetails(MemSpyKernelObject *object)
-{
- QStringList result;
-
- result << QString("%1: %2").arg(tr("Name")).arg(object->nameDetail());
- result << QString("%1: %2").arg(tr("Full Name")).arg(object->name());
- result << QString("%1: %2").arg(tr("AccessCount")).arg(object->accessCount());
- result << QString("%1: %2").arg(tr("UniqueID")).arg(object->uniqueId());
- result << QString("%1: %2").arg(tr("Protection")).arg(object->protection());
- result << QString("%1: %2").arg(tr("OwnrAddr")).arg(object->addressOfKernelOwner());
- result << QString("%1: %2").arg(tr("KernelAddr")).arg(object->kernelAddress());
-
- // Object type specific attributes:
- switch (object->type())
- {
- case KernelObjectTypeUnknown:
- {
- break;
- }
- case KernelObjectTypeThread:
- {
- result << QString("%1: %2").arg(tr("OwnrPrAddr")).arg(object->addressOfOwningProcess());
- result << QString("%1: %2").arg(tr("ThreadID")).arg(object->id());
- result << QString("%1: %2").arg(tr("Priority")).arg(object->priority());
- result << QString("%1: %2").arg(tr("Proc")).arg(object->nameOfOwner());
- break;
- }
- case KernelObjectTypeProcess:
- {
- result << QString("%1: %2").arg(tr("OwnrPrAddr")).arg(object->addressOfOwningProcess());
- result << QString("%1: %2").arg(tr("CreatorId")).arg(object->creatorId());
- result << QString("%1: %2").arg(tr("Attributes")).arg(object->attributes());
- result << QString("%1: %2").arg(tr("StckChnk")).arg(object->addressOfDataBssStackChunk());
- result << QString("%1: %2").arg(tr("ProcessID")).arg(object->id());
- result << QString("%1: %2").arg(tr("Priority")).arg(object->priority());
- result << QString("%1: %2").arg(tr("SecurityZone")).arg(object->securityZone());
-
- /* TODO: to solve process details
- CMemSpyEngineObjectContainer& container = iEngine.Container();
- TProcessId id( iKernelObjectItems[iListBox->CurrentItemIndex().iId );
- TRAP_IGNORE(
- CMemSpyProcess& process = container.ProcessByIdL( id );
- AppendFormatString( messagePtr, _L("\nSID: 0x%08X\n"), process.SID() );
- AppendFormatString( messagePtr, _L("VID: 0x%08X\n"), process.VID() );
- AppendFormatString( messagePtr, _L("UID1: 0x%08X\n"), process.UIDs()[0].iUid );
- AppendFormatString( messagePtr, _L("UID2: 0x%08X\n"), process.UIDs()[1].iUid );
- AppendFormatString( messagePtr, _L("UID3: 0x%08X\n"), process.UIDs()[2].iUid );
- AppendFormatString( messagePtr, _L("Caps: 0x%08X%08X"), process.Capabilities().iCaps[0], process.Capabilities().iCaps[1]);
- );
- */
- break;
- }
- case KernelObjectTypeChunk:
- {
- result << QString("%1: %2").arg(tr("OwnrPrAddr")).arg(object->addressOfOwningProcess());
- result << QString("%1: %2").arg(tr("Size")).arg(object->size());
- result << QString("%1: %2").arg(tr("MaxSize")).arg(object->maxSize());
- result << QString("%1: %2").arg(tr("Bottom")).arg(object->bottom());
- result << QString("%1: %2").arg(tr("Top")).arg(object->top());
- result << QString("%1: %2").arg(tr("Attr")).arg(object->attributes());
- result << QString("%1: %2").arg(tr("Start")).arg(object->startPos());
- result << QString("%1: %2").arg(tr("CntrlID")).arg(object->controllingOwner());
- result << QString("%1: %2").arg(tr("Restrictions")).arg(object->restrictions());
- result << QString("%1: %2").arg(tr("MapAttr")).arg(object->mapAttr());
- result << QString("%1: %2").arg(tr("Type")).arg(object->chunkType());
- result << QString("%1: %2").arg(tr("Proc")).arg(object->nameOfOwner());
- break;
- }
- case KernelObjectTypeLibrary:
- {
- result << QString("%1: %2").arg(tr("MapCount")).arg(object->mapCount());
- result << QString("%1: %2").arg(tr("State")).arg(object->state());
- result << QString("%1: %2").arg(tr("CodeSeg")).arg(object->addressOfCodeSeg());
- break;
- }
- case KernelObjectTypeSemaphore:
- {
- result << QString("%1: %2").arg(tr("Count")).arg(object->count());
- result << QString("%1: %2").arg(tr("Resetting")).arg(object->resetting());
- break;
- }
- case KernelObjectTypeMutex:
- {
- result << QString("%1: %2").arg(tr("HoldCount")).arg(object->count());
- result << QString("%1: %2").arg(tr("WaitCount")).arg(object->waitCount());
- result << QString("%1: %2").arg(tr("Resetting")).arg(object->resetting());
- result << QString("%1: %2").arg(tr("Order")).arg(object->order());
- break;
- }
- case KernelObjectTypeTimer:
- {
- result << QString("%1: %2").arg(tr("State")).arg(object->timerState());
- result << QString("%1: %2").arg(tr("Type")).arg(object->timerType());
- break;
- }
- case KernelObjectTypeServer:
- {
- result << QString("%1: %2").arg(tr("ThrdAddr")).arg(object->addressOfOwningThread());
- result << QString("%1: %2").arg(tr("Thr")).arg(object->nameOfOwner());
- result << QString("%1: %2").arg(tr("Type")).arg(object->sessionType());
-// RArray<TMemSpyDriverServerSessionInfo> sessions;
-// CleanupClosePushL( sessions );
- /* TODO: to solve server sessions
- iEngine.HelperServer().GetServerSessionsL( iKernelObjectItems[iListBox->CurrentItemIndex(), sessions );
- const TInt count = sessions.Count();
- for ( TInt i = 0; i < count; i++ )
- {
- const TMemSpyDriverServerSessionInfo& session = sessions[ i ];
- AppendFormatString( messagePtr, _L("SessAddr: 0x%08X\n"), session.iAddress );
- TFullName sessName;
- sessName.Copy( session.iName );
- AppendFormatString( messagePtr, _L("Sess: %S\n"), &sessName );
- }
- CleanupStack::PopAndDestroy( &sessions );
- */
- break;
- }
- case KernelObjectTypeSession:
- {
- result << QString("%1: %2").arg(tr("Server")).arg(object->addressOfServer());
- result << QString("%1: %2").arg(tr("Srv")).arg(object->name());
- result << QString("%1: %2").arg(tr("AccCount")).arg(object->totalAccessCount());
- result << QString("%1: %2").arg(tr("SesType")).arg(object->sessionType());
- result << QString("%1: %2").arg(tr("SvrType")).arg(object->svrSessionType());
- result << QString("%1: %2").arg(tr("MsgCount")).arg(object->msgCount());
- result << QString("%1: %2").arg(tr("MsgLimit")).arg(object->msgLimit());
-
- break;
- }
- case KernelObjectTypeLogicalDevice:
- {
- result << QString("%1: %2").arg(tr("Version")).arg(object->version());
- result << QString("%1: %2").arg(tr("ParseMask")).arg(object->parseMask());
- result << QString("%1: %2").arg(tr("UnitsMask")).arg(object->unitsMask());
- result << QString("%1: %2").arg(tr("Open channels")).arg(object->openChannels());
- break;
- }
- case KernelObjectTypePhysicalDevice:
- {
- result << QString("%1: %2").arg(tr("Version")).arg(object->version());
- result << QString("%1: %2").arg(tr("UnitsMask")).arg(object->unitsMask());
- result << QString("%1: %2").arg(tr("CodeSeg")).arg(object->addressOfCodeSeg());
- break;
- }
- case KernelObjectTypeLogicalChannel:
- {
- // No other details
- break;
- }
- case KernelObjectTypeChangeNotifier:
- {
- result << QString("%1: %2").arg(tr("Changes")).arg(object->changes());
- result << QString("%1: %2").arg(tr("ThrdAddr")).arg(object->addressOfOwningThread());
- result << QString("%1: %2").arg(tr("Thr")).arg(object->nameOfOwner());
- break;
- }
- case KernelObjectTypeUndertaker:
- {
- result << QString("%1: %2").arg(tr("ThrdAddr")).arg(object->addressOfOwningThread());
- result << QString("%1: %2").arg(tr("Thr")).arg(object->nameOfOwner());
- break;
- }
- case KernelObjectTypeMsgQueue:
- {
- // No other details
- break;
- }
- case KernelObjectTypePropertyRef:
- {
- /*
- Not listing details here, as propertyRef is not listed in TaskMgr.
- Following propertyRef attributes are available at engine side.
-
- IsReady
- Type
- Category
- Key
- RefCount
- ThreadId
- CreatorSID
- */
- break;
- }
- case KernelObjectTypeCondVar:
- {
- result << QString("%1: %2").arg(tr("Resetting")).arg(object->resetting());
- result << QString("%1: %2").arg(tr("Mutex")).arg(object->addressOfOwningThread());
- result << QString("%1: %2").arg(tr("Mtx")).arg(object->nameOfOwner());
- result << QString("%1: %2").arg(tr("WaitCount")).arg(object->waitCount());
-
-// RArray<TMemSpyDriverCondVarSuspendedThreadInfo> threads;
-// CleanupClosePushL( threads );
- /* TODO: to solve thread cond. vars.
- iEngine.HelperCondVar().GetCondVarSuspendedThreadsL( iKernelObjectItems[iListBox->CurrentItemIndex(), threads );
- const TInt count = threads.Count();
- for ( TInt i = 0; i < count; i++ )
- {
- const TMemSpyDriverCondVarSuspendedThreadInfo& thr = threads[ i ];
- AppendFormatString( messagePtr, _L("SuspThrdAddr: 0x%08X\n"), thr.iAddress );
- TFullName thrName;
- thrName.Copy( thr.iName );
- AppendFormatString( messagePtr, _L("Thr: %S\n"), &thrName );
- }
- CleanupStack::PopAndDestroy( &threads );
- */
- break;
- }
-// default:
-// {
-// // Programming error
-// __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) );
-// }
- }
-
- return result;
-}
--- a/memspyui/ui/hb/src/memspylistview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include "memspylistview.h"
-
-HbWidget* MemSpyListView::createCentralWidget()
-{
- return &mListView;
-}
--- a/memspyui/ui/hb/src/memspymainview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include "memspymainview.h"
-#include "viewmanager.h"
-
-#include <QStringListModel>
-#include <QDebug>
-
-void MemSpyMainView::initialize(const QVariantMap& params)
-{
- setTitle("MemSpy");
-
- MemSpyView::initialize(params);
-
- QStringList items = QStringList()
- << tr("Processes & Threads")
- << tr("Kernel Objects")
- << tr("Tracking")
- << tr("Servers")
- << tr("ECom");
- mListView.setModel(new QStringListModel(items, this));
-
- QObject::connect(&mListView, SIGNAL(released(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
-}
-
-void MemSpyMainView::itemClicked(const QModelIndex& index)
-{
- Q_UNUSED(index);
- ViewIndex indexes[] = { ProcessView, KernelObjectTypeView, TrackingView, ServerView, EComCategoryView };
- mViewManager.showView(indexes[index.row()]);
-}
-
-bool MemSpyMainView::isBreadCrumbVisible() const
-{
- return false;
-}
-
--- a/memspyui/ui/hb/src/memspyprocessview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "memspyprocessview.h"
-
-#include <QVariantMap>
-#include <HbAbstractViewItem>
-#include <HbMenu>
-
-#include "viewmanager.h"
-
-MemSpyProcessModel::MemSpyProcessModel(EngineWrapper &engine, QObject *parent) :
- QAbstractListModel(parent),
- mEngine(engine),
- mProcesses(engine.getProcesses())
-{
- mPriorityMap.insert(EPriorityLow, tr("[L]"));
- mPriorityMap.insert(EPriorityBackground, tr("[B]"));
- mPriorityMap.insert(EPriorityForeground, tr("[F]"));
- mPriorityMap.insert(EPriorityHigh, tr("[H]"));
- mPriorityMap.insert(EPriorityWindowServer, tr("[WS]"));
- mPriorityMap.insert(EPriorityFileServer, tr("[FS]"));
- mPriorityMap.insert(EPriorityRealTimeServer, tr("[RTS]"));
- mPriorityMap.insert(EPrioritySupervisor, tr("[SUP]"));
-}
-
-MemSpyProcessModel::~MemSpyProcessModel()
-{
- qDeleteAll(mProcesses);
-}
-
-int MemSpyProcessModel::rowCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent);
- return mProcesses.count();
-}
-
-QVariant MemSpyProcessModel::data(const QModelIndex &index, int role) const
-{
- if (role == Qt::DisplayRole) {
- const MemSpyProcess* process = mProcesses.at(index.row());
-
- QStringList lines;
- lines << process->name();
-
- lines << (process->isDead() ?
- process->exitInfo() :
- QString("%1, %2 thr, %3").
- arg(process->sid(), 0, 16).
- arg(process->threadCount()).
- arg(mPriorityMap.value(process->priority(), tr("[?]"))));
-
- return lines;
- }
-
- if (role == Qt::UserRole)
- return mProcesses.at(index.row())->id();
-
- return QVariant();
-}
-
-void MemSpyProcessModel::refresh()
-{
- beginResetModel();
- QList<MemSpyProcess*> data = mEngine.getProcesses();
- qDeleteAll(mProcesses);
- mProcesses = data;
- endResetModel();
-}
-
-
-void MemSpyProcessView::initialize(const QVariantMap& params)
-{
- setTitle(tr("Processes"));
- MemSpyView::initialize(params);
-
- mModel = new MemSpyProcessModel(mEngine, this);
- mListView.setModel(mModel);
-
- connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
- connect(&mListView, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)),
- this, SLOT(catchLongPress(HbAbstractViewItem*,QPointF)));
-
- mContextMenu = new HbMenu;
- mEndMenu = mContextMenu->addMenu("End");
-
- mEndMenu->addAction(tr("Kill"), this, SLOT(kill()));
- mEndMenu->addAction(tr("Panic"), this, SLOT(panic()));
- mEndMenu->addAction(tr("Terminate"), this, SLOT(terminate()));
-}
-
-void MemSpyProcessView::itemClicked(const QModelIndex& index)
-{
- QVariantMap map;
- map.insert("pid", index.data(Qt::UserRole));
- map.insert("pname", index.data(Qt::DisplayRole).toStringList().at(0));
- mViewManager.showView(ThreadView, map);
-}
-
-void MemSpyProcessView::catchLongPress(HbAbstractViewItem *item, const QPointF &coords)
-{
- mProcessId = qVariantValue<ProcessId>(item->modelIndex().data(Qt::UserRole));
- mContextMenu->setPreferredPos(coords);
- mContextMenu->open();
-}
-
-void MemSpyProcessView::kill()
-{
- mEngine.killProcess(mProcessId);
- refresh();
-}
-
-void MemSpyProcessView::panic()
-{
- mEngine.panicProcess(mProcessId);
- refresh();
-}
-
-void MemSpyProcessView::terminate()
-{
- mEngine.terminateProcess(mProcessId);
- refresh();
-}
-
-void MemSpyProcessView::refresh()
-{
- mModel->refresh();
-}
-
--- a/memspyui/ui/hb/src/memspyserverview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include "memspyserverview.h"
-#include "viewmanager.h"
-
-MemSpyServerModel::MemSpyServerModel(EngineWrapper &engine, QObject *parent) :
- QAbstractListModel(parent),
- mEngine(engine),
- mServers(engine.getServers())
-{
-}
-
-MemSpyServerModel::~MemSpyServerModel()
-{
- qDeleteAll(mServers);
-}
-
-int MemSpyServerModel::rowCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent);
- return mServers.count();
-}
-
-QVariant MemSpyServerModel::data(const QModelIndex &index, int role) const
-{
- if (role == Qt::DisplayRole) {
- const MemSpyServer* server = mServers.at(index.row());
-
- QStringList lines;
- lines << server->name();
- lines << QString("%1 session(s)").arg(server->sessionCount());
-
- return lines;
- }
-
- if (role == Qt::UserRole)
- return mServers.at(index.row())->id();
-
- return QVariant();
-}
-
-void MemSpyServerModel::refresh()
-{
- beginResetModel();
- QList<MemSpyServer*> data = mEngine.getServers();
- qDeleteAll(mServers);
- mServers = data;
- endResetModel();
-}
-
-
-void MemSpyServerView::initialize(const QVariantMap& params)
-{
- setTitle(tr("Servers"));
- MemSpyView::initialize(params);
-
- mModel = new MemSpyServerModel(mEngine, this);
- mListView.setModel(mModel);
-
- connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
-}
-
-void MemSpyServerView::itemClicked(const QModelIndex& index)
-{
- QVariantMap map;
- map.insert("pid", index.data(Qt::UserRole));
- map.insert("pname", index.data(Qt::DisplayRole).toStringList().at(0));
- mViewManager.showView(ThreadView, map);
-}
-
-void MemSpyServerView::refresh()
-{
- mModel->refresh();
-}
--- a/memspyui/ui/hb/src/memspysettingsview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include <HbToolBar>
-#include <HbAction>
-#include <HbDataForm>
-#include <HbDataFormModel>
-#include <HbProgressDialog>
-
-#include "memspysettingsview.h"
-#include "enginewrapper.h"
-
-const QStringList MODE_ITEMS = QStringList() <<
- MemSpySettingsView::tr("RDebug") <<
- MemSpySettingsView::tr("File");
-
-MemSpySettingsView::MemSpySettingsView(EngineWrapper &engine) :
- mForm(new HbDataForm(this)),
- mModel(0),
- mModeItem(0),
- mPathItem(0),
- mCustomPathItem(0),
- mEngine(engine)
-{
- setTitle(tr("Settings"));
-
- toolBar()->addAction(tr("OK"), this, SLOT(accept()));
- toolBar()->addAction(tr("Cancel"), this, SLOT(reject()));
-
- mModel = new HbDataFormModel(this);
-
- mModeItem = mModel->appendDataFormItem(
- HbDataFormModelItem::ComboBoxItem, tr("Output"));
- mModeItem->setContentWidgetData("items", MODE_ITEMS);
- mModeItem->setContentWidgetData("currentIndex", mEngine.settings().outputMode());
-
- updateModel();
-
-
- mForm->setModel(mModel);
- mForm->addConnection(mModeItem, SIGNAL(currentIndexChanged(int)), this, SLOT(updateModel()));
- setWidget(mForm);
-
- // change navigation action
- HbAction* action = new HbAction(Hb::BackNaviAction, this);
- connect(action, SIGNAL(triggered()), this, SLOT(reject()));
- setNavigationAction(action);
-}
-
-MemSpySettingsView::~MemSpySettingsView()
-{
-}
-
-void MemSpySettingsView::updateModel()
-{
- OutputMode mode = static_cast<OutputMode>(mModeItem->contentWidgetData("currentIndex").toInt());
- if (mode == OutputModeTrace) {
- // remove both path item and custom path item
- if (mPathItem)
- mModel->removeItem(mPathItem);
- if (mCustomPathItem)
- mModel->removeItem(mCustomPathItem);
-
- mPathItem = mCustomPathItem = 0;
- } else if (mode == OutputModeFile) {
- if (!mPathItem) {
- // create path item
- mPathItem = mModel->appendDataFormItem(
- HbDataFormModelItem::CheckBoxItem, tr("Path"));
- mPathItem->setContentWidgetData("text", tr("Use Default Path (\\MemSpy)"));
- mPathItem->setContentWidgetData("checkState",
- mEngine.settings().outputPath().isEmpty() ? Qt::Checked : Qt::Unchecked);
-
- mForm->addConnection(mPathItem, SIGNAL(stateChanged(int)),
- this, SLOT(updateModel()));
- }
-
- if (mPathItem->contentWidgetData("checkState").toInt() == Qt::Unchecked && !mCustomPathItem) {
- // create custom path item
- mCustomPathItem = mModel->appendDataFormItem(
- HbDataFormModelItem::TextItem, tr("Custom Path"));
- mCustomPathItem->setContentWidgetData("text",
- mEngine.settings().outputPath().isEmpty() ? "\\MemSpy" : mEngine.settings().outputPath());
- }
-
- if (mPathItem->contentWidgetData("checkState").toInt() == Qt::Checked && mCustomPathItem) {
- // remove cusom path item
- mModel->removeItem(mCustomPathItem);
- mCustomPathItem = 0;
- }
- }
-}
-
-void MemSpySettingsView::accept()
-{
- OutputMode mode = static_cast<OutputMode>(mModeItem->contentWidgetData("currentIndex").toInt());
-
- mEngine.settings().setOutputMode(mode);
-
- if (mode == OutputModeFile) {
- QString path = mPathItem->contentWidgetData("checkState").toInt() == Qt::Checked ?
- "" :
- mCustomPathItem->contentWidgetData("text").toString();
- mEngine.settings().setOutputPath(path);
- }
- emit finished(true);
-}
-
-void MemSpySettingsView::reject()
-{
- emit finished(false);
-}
-
--- a/memspyui/ui/hb/src/memspyswmtview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include <HbToolBar>
-#include <HbAction>
-#include <HbDataForm>
-#include <HbDataFormModel>
-#include <HbProgressDialog>
-
-#include "memspyswmtview.h"
-#include "enginewrapper.h"
-
-const QStringList MODE_ITEMS = QStringList() <<
- MemSpySwmtView::tr("Basic") <<
- MemSpySwmtView::tr("Full") <<
- MemSpySwmtView::tr("Custom");
-
-const QStringList CATEGORIES_ITEMS = QStringList() <<
- MemSpySwmtView::tr("FileServer Cache") <<
- //MemSpySwmtView::tr("Bitmap Handles") <<
- MemSpySwmtView::tr("User Heap") <<
- //MemSpySwmtView::tr("Kernel Heap") <<
- MemSpySwmtView::tr("Local Chunks") <<
- MemSpySwmtView::tr("Global Chunks") <<
- MemSpySwmtView::tr("RAM Drive") <<
- //MemSpySwmtView::tr("User Stacks") <<
- //MemSpySwmtView::tr("Global Data") <<
- MemSpySwmtView::tr("RAM-loaded Code") <<
- MemSpySwmtView::tr("Kernel Handles") <<
- MemSpySwmtView::tr("Open Files") <<
- MemSpySwmtView::tr("Disk Usage") <<
- MemSpySwmtView::tr("System Memory") <<
- MemSpySwmtView::tr("Windows Groups");
-
-MemSpySwmtView::MemSpySwmtView(EngineWrapper &engine, ViewManager &viewManager) :
- MemSpyView(engine, viewManager),
- mToggleTimerAction(0),
- mCategoriesItem(0),
- mProgressDialog(0)
-{
-}
-
-MemSpySwmtView::~MemSpySwmtView()
-{
-}
-
-void MemSpySwmtView::initialize(const QVariantMap& params)
-{
- setTitle(tr("SWMT"));
-
- MemSpyView::initialize(params);
-}
-
-HbToolBar* MemSpySwmtView::createToolBar()
-{
- HbToolBar* toolBar = new HbToolBar();
- mToggleTimerAction = toolBar->addAction("", this, SLOT(toggleTimer()));
- toolBar->addAction(tr("Dump Now"), this, SLOT(forceDump()));
-
- updateTimerAction(mEngine.isSwmtRunning());
-
- return toolBar;
-}
-
-HbWidget* MemSpySwmtView::createCentralWidget()
-{
- mModel = new HbDataFormModel(this);
-
- mTimerItem = mModel->appendDataFormItem(
- HbDataFormModelItem::TextItem, tr("Timer (sec.)"));
- mTimerItem->setContentWidgetData("maxLength", 2);
- mTimerItem->setContentWidgetData("text", mEngine.settings().swmtTimerPeriod());
-
- mModeItem = mModel->appendDataFormItem(
- HbDataFormModelItem::ComboBoxItem, tr("Tracking mode"));
- mModeItem->setContentWidgetData("items", MODE_ITEMS);
- mModeItem->setContentWidgetData("currentIndex", mEngine.settings().swmtMode());
-
- modeChanged(mEngine.settings().swmtMode());
-
- HbDataForm* form = new HbDataForm(this);
- form->setModel(mModel);
-
- form->addConnection(mModeItem, SIGNAL(currentIndexChanged(int)), this, SLOT(modeChanged(int)));
-
- return form;
-}
-
-void MemSpySwmtView::updateTimerAction(bool isRunning)
-{
- mToggleTimerAction->setText(isRunning ? tr("Stop Timer") : tr("Start Timer"));
-}
-
-void MemSpySwmtView::toggleTimer()
-{
- bool wasRunning = mEngine.isSwmtRunning();
- if (wasRunning)
- mEngine.stopSwmt();
- else
- {
- updateSettings();
- mEngine.startSwmt(qBound(5, mTimerItem->contentWidgetData("text").toInt(), 60));
- }
-
- updateTimerAction(!wasRunning);
-}
-
-void MemSpySwmtView::forceDump()
-{
- updateSettings();
- mEngine.updateOutputSettings();
-
- MemSpySwmtDumpTracker* tracker = mEngine.createSwmtDumpTracker();
- connect(tracker, SIGNAL(finished(int)), this, SLOT(asyncOperationFinished(int)));
-
- mProgressDialog = new HbProgressDialog(HbProgressDialog::WaitDialog);
- mProgressDialog->setText(tr("Please wait..."));
- mProgressDialog->setPrimaryAction(0);
- mProgressDialog->show();
-
- tracker->start();
-}
-
-void MemSpySwmtView::updateSettings()
-{
- mEngine.settings().setSwmtTimerPeriod(mTimerItem->contentWidgetData("text").toInt());
- mEngine.settings().setSwmtMode(static_cast<SwmtMode>(
- mModeItem->contentWidgetData("currentIndex").toInt()));
- if (mCategoriesItem)
- mEngine.settings().setSwmtCategories(mCategoriesItem->contentWidgetData("selectedItems").toList());
-
- mEngine.setSwmtSettings(static_cast<SwmtMode>(mEngine.settings().swmtMode()),
- mEngine.settings().swmtCategories());
-}
-
-void MemSpySwmtView::modeChanged(int mode)
-{
- if (mode != SwmtModeCustom && mCategoriesItem)
- removeCategoriesItem();
- else if (mode == SwmtModeCustom && !mCategoriesItem)
- createCategoriesItem();
-}
-
-void MemSpySwmtView::asyncOperationFinished(int errorCode)
-{
- Q_UNUSED(errorCode);
-
- mProgressDialog->hide();
- delete mProgressDialog;
- mProgressDialog = 0;
-
- delete sender();
-}
-
-void MemSpySwmtView::createCategoriesItem()
-{
- mCategoriesItem = mModel->appendDataFormItem(
- HbDataFormModelItem::MultiselectionItem, tr("Categories"));
- mCategoriesItem->setContentWidgetData("items", CATEGORIES_ITEMS);
- mCategoriesItem->setContentWidgetData("selectedItems", mEngine.settings().swmtCategories());
-}
-
-void MemSpySwmtView::removeCategoriesItem()
-{
- mModel->removeItem(mCategoriesItem);
- mCategoriesItem = 0;
-}
--- a/memspyui/ui/hb/src/memspythreaddetailindexview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include <QAction>
-#include <QStringListModel>
-#include <HbMenu>
-
-#include "memspythreaddetailindexview.h"
-#include "viewmanager.cpp"
-
-void MemSpyThreadDetailIndexView::initialize(const QVariantMap& params)
-{
- setTitle(tr("Details"));
-
- mProcessName = params["pname"].toString();
- mThreadName = params["tname"].toString();
-
- MemSpyView::initialize(params);
-
- mThreadId = qVariantValue<ThreadId>(params["tid"]);
-
- QStringList lines = QStringList() << tr("General") << tr("Heap") << tr("Stack")
- << tr("Chunks") << tr("Code Segments") << tr("Open Files") << tr("Active Objects")
- << tr("Handles to other Threads") << tr("Handles to other Processes")
- << tr("Servers Running in Thread") << tr("Client <-> Server connections")
- << tr("Semaphores") << tr("References this Thread") << tr("References this Process")
- << tr("Mutexes") << tr("Timers") << tr("Logical DD Channels")
- << tr("Change Notifiers") << tr("Undertakers") << tr("Logical Device Drivers")
- << tr("Physical Device Drivers");
-
- mListView.setModel(new QStringListModel(lines, this));
-
- connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
-}
-
-HbMenu* MemSpyThreadDetailIndexView::createToolMenu()
-{
- HbMenu* menu = new HbMenu(tr("Thread"));
- mPriorityMenu = menu->addMenu("Change Priority");
-
- mPriorityMenu->addAction(tr("Abs. Very Low"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Low Normal"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Low"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Background Normal"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Background"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Foreground Normal"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Foreground"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. High Normal"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. High"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Real Time 1"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Real Time 2"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Real Time 3"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Real Time 4"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Real Time 5"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Real Time 6"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Real Time 7"), this, SLOT(changePriority()));
- mPriorityMenu->addAction(tr("Abs. Real Time 8"), this, SLOT(changePriority()));
-
- return menu;
-}
-
-bool MemSpyThreadDetailIndexView::isBreadCrumbVisible() const
-{
- return true;
-}
-
-QString MemSpyThreadDetailIndexView::getBreadCrumbText() const
-{
- return tr("Processes > %1 > Threads > %2").arg(mProcessName).arg(mThreadName);
-}
-
-void MemSpyThreadDetailIndexView::changePriority()
-{
- QAction *s = qobject_cast<QAction*>(sender());
- int index = mPriorityMenu->actions().indexOf(s);
-
- ThreadPriority priorities[] = {
- ThreadPriorityAbsoluteVeryLow,
- ThreadPriorityAbsoluteLowNormal,
- ThreadPriorityAbsoluteLow,
- ThreadPriorityAbsoluteBackgroundNormal,
- ThreadPriorityAbsoluteBackground,
- ThreadPriorityAbsoluteForegroundNormal,
- ThreadPriorityAbsoluteForeground,
- ThreadPriorityAbsoluteHighNormal,
- ThreadPriorityAbsoluteHigh,
- ThreadPriorityAbsoluteRealTime1,
- ThreadPriorityAbsoluteRealTime2,
- ThreadPriorityAbsoluteRealTime3,
- ThreadPriorityAbsoluteRealTime4,
- ThreadPriorityAbsoluteRealTime5,
- ThreadPriorityAbsoluteRealTime6,
- ThreadPriorityAbsoluteRealTime7,
- ThreadPriorityAbsoluteRealTime8 };
-
- if (index >= 0)
- mEngine.setThreadPriority(mThreadId, priorities[index]);
-}
-
-void MemSpyThreadDetailIndexView::itemClicked(const QModelIndex& index)
-{
- ThreadInfoType types[] = { ThreadInfoTypeGeneral, ThreadInfoTypeHeap,
- ThreadInfoTypeStack, ThreadInfoTypeChunk, ThreadInfoTypeCodeSeg,
- ThreadInfoTypeOpenFiles, ThreadInfoTypeActiveObjects, ThreadInfoTypeOwnedThreadHandles,
- ThreadInfoTypeOwnedProcessHandles, ThreadInfoTypeServer, ThreadInfoTypeSession,
- ThreadInfoTypeSemaphore, ThreadInfoTypeOtherThreads, ThreadInfoTypeOtherProcesses,
- ThreadInfoTypeMutex, ThreadInfoTypeTimer, ThreadInfoTypeChannel,
- ThreadInfoTypeChangeNotifier, ThreadInfoTypeUndertaker,
- ThreadInfoTypeLDD, ThreadInfoTypePDD };
-
- QVariantMap map;
- map.insert("tid", mThreadId);
- map.insert("type", types[index.row()]);
- map.insert("pname", mProcessName);
- map.insert("tname", mThreadName);
- mViewManager.showView(ThreadDetailView, map);
-}
-
--- a/memspyui/ui/hb/src/memspythreaddetailview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include <QAction>
-#include <QStringListModel>
-#include <HbMenu>
-
-#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 qMax(mThreadInfo.count(), 1);
-}
-
-QVariant MemSpyThreadDetailModel::data(const QModelIndex &index, int role) const
-{
- if (role == Qt::DisplayRole) {
-
- if (mThreadInfo.count()) {
- QStringList lines;
- lines << mThreadInfo.at(index.row())->caption();
- lines << mThreadInfo.at(index.row())->value();
- return lines;
- }
-
- return tr("(no items found)");
- }
-
- if (role == Qt::TextAlignmentRole && mThreadInfo.count() == 0) {
-
- return Qt::AlignHCenter;
- }
-
- return QVariant();
-}
-
-void MemSpyThreadDetailView::initialize(const QVariantMap& params)
-{
- mProcessName = params["pname"].toString();
- mThreadName = params["tname"].toString();
-
- // TODO: Remove duplicates with memspythreaddetailindexview
- QMap<int, QString> titleMap;
- titleMap[ThreadInfoTypeGeneral] = tr("General");
- titleMap[ThreadInfoTypeHeap] = tr("Heap");
- titleMap[ThreadInfoTypeStack] = tr("Stack");
- titleMap[ThreadInfoTypeChunk] = tr("Chunks");
- titleMap[ThreadInfoTypeCodeSeg] = tr("Code Segments");
- titleMap[ThreadInfoTypeOpenFiles] = tr("Open Files");
- titleMap[ThreadInfoTypeActiveObjects] = tr("Active Objects");
- titleMap[ThreadInfoTypeOwnedThreadHandles] = tr("Handles to other Threads");
- titleMap[ThreadInfoTypeOwnedProcessHandles] = tr("Handles to other Processes");
- titleMap[ThreadInfoTypeServer] = tr("Servers Running in Thread");
- titleMap[ThreadInfoTypeSession] = tr("Client <-> Server connections");
- titleMap[ThreadInfoTypeSemaphore] = tr("Semaphores");
- titleMap[ThreadInfoTypeOtherThreads] = tr("References this Thread");
- titleMap[ThreadInfoTypeOtherProcesses] = tr("References this Process");
- titleMap[ThreadInfoTypeMutex] = tr("Mutexes");
- titleMap[ThreadInfoTypeTimer] = tr("Timers");
- titleMap[ThreadInfoTypeChannel] = tr("Logical DD Channels");
- titleMap[ThreadInfoTypeChangeNotifier] = tr("Change Notifiers");
- titleMap[ThreadInfoTypeUndertaker] = tr("Undertakers");
- titleMap[ThreadInfoTypeLDD] = tr("Logical Device Drivers");
- titleMap[ThreadInfoTypePDD] = tr("Physical Device Drivers");
-
- setTitle(titleMap.value(params["type"].toInt()));
-
- MemSpyView::initialize(params);
-
- ThreadId threadId = qVariantValue<ThreadId>(params["tid"]);
- ThreadInfoType type = static_cast<ThreadInfoType>(qVariantValue<int>(params["type"]));
-
- mListView.setModel(new MemSpyThreadDetailModel(mEngine, threadId, type, this));
-}
-
-bool MemSpyThreadDetailView::isBreadCrumbVisible() const
-{
- return true;
-}
-
-QString MemSpyThreadDetailView::getBreadCrumbText() const
-{
- return tr("Processes > %1 > Threads > %2").arg(mProcessName).arg(mThreadName);
-}
--- a/memspyui/ui/hb/src/memspythreadview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include <HbAbstractViewItem>
-#include <HbMenu>
-#include <QAction>
-
-#include "memspythreadview.h"
-#include "viewmanager.h"
-
-MemSpyThreadModel::MemSpyThreadModel(EngineWrapper &engine, ProcessId processId, QObject *parent) :
- QAbstractListModel(parent),
- mProcessId(processId),
- mEngine(engine),
- mThreads(engine.getThreads(processId))
-{
- mPriorityMap.insert(ThreadPriorityNull, tr("[Null]"));
- mPriorityMap.insert(ThreadPriorityMuchLess, tr("[Much Less]"));
- mPriorityMap.insert(ThreadPriorityLess, tr("[Less]"));
- mPriorityMap.insert(ThreadPriorityNormal, tr("[Normal]"));
- mPriorityMap.insert(ThreadPriorityMore, tr("[More]"));
- mPriorityMap.insert(ThreadPriorityMuchMore, tr("[Much More]"));
- mPriorityMap.insert(ThreadPriorityRealTime, tr("[Real Time]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteVeryLow, tr("[Abs. Very Low]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteLowNormal, tr("[Abs. Low Normal]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteLow, tr("[Abs. Low]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteBackgroundNormal, tr("[Abs. Background Normal]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteBackground, tr("[Abs. Background]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteForegroundNormal, tr("[Abs. Foreground Normal]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteForeground, tr("[Abs. Foreground]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteHighNormal, tr("[Abs. Hight Normal]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteHigh, tr("[Abs. High]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteRealTime1, tr("[Abs. RT 1]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteRealTime2, tr("[Abs. RT 2]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteRealTime3, tr("[Abs. RT 3]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteRealTime4, tr("[Abs. RT 4]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteRealTime5, tr("[Abs. RT 5]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteRealTime6, tr("[Abs. RT 6]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteRealTime7, tr("[Abs. RT 7]"));
- mPriorityMap.insert(ThreadPriorityAbsoluteRealTime8, tr("[Abs. RT 8]"));
-}
-
-MemSpyThreadModel::~MemSpyThreadModel()
-{
- qDeleteAll(mThreads);
-}
-
-int MemSpyThreadModel::rowCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent);
- return mThreads.count();
-}
-
-QVariant MemSpyThreadModel::data(const QModelIndex &index, int role) const
-{
- if (role == Qt::DisplayRole) {
- QStringList lines;
- lines << mThreads.at(index.row())->name();
- lines << mPriorityMap.value(mThreads.at(index.row())->priority(), tr("[Unknown]"));
- return lines;
- }
-
- if (role == Qt::UserRole)
- return mThreads.at(index.row())->id();
-
- return QVariant();
-}
-
-void MemSpyThreadModel::refresh()
-{
- beginResetModel();
- QList<MemSpyThread*> data = mEngine.getThreads(mProcessId);
- qDeleteAll(mThreads);
- mThreads = data;
- endResetModel();
-}
-
-MemSpyThreadView::MemSpyThreadView(EngineWrapper &engine, ViewManager &viewManager) :
- MemSpyListView(engine, viewManager),
- mContextMenu(0),
- mPriorityMenu(0),
- mThreadId(0),
- mModel(0)
-{
-}
-
-MemSpyThreadView::~MemSpyThreadView()
-{
- delete mContextMenu;
- delete mPriorityMenu;
-}
-
-void MemSpyThreadView::initialize(const QVariantMap& params)
-{
- setTitle(tr("Threads"));
-
- mProcessId = qVariantValue<ProcessId>(params["pid"]);
- mProcessName = params["pname"].toString();
-
- MemSpyView::initialize(params);
-
- mModel = new MemSpyThreadModel(mEngine, mProcessId, this);
- mListView.setModel(mModel);
-
- connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
- connect(&mListView, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)),
- this, SLOT(catchLongPress(HbAbstractViewItem*,QPointF)));
-
- mContextMenu = new HbMenu;
- mPriorityMenu = mContextMenu->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()));
-}
-
-
-bool MemSpyThreadView::isBreadCrumbVisible() const
-{
- return true;
-}
-
-QString MemSpyThreadView::getBreadCrumbText() const
-{
- return tr("Processes > %1").arg(mProcessName);
-}
-
-HbMenu* MemSpyThreadView::createToolMenu()
-{
- HbMenu* menu = new HbMenu(tr("Process"));
- menu->addAction("Kill", this, SLOT(kill()));
- menu->addAction("Panic", this, SLOT(panic()));
- menu->addAction("Terminate", this, SLOT(terminate()));
- return menu;
-}
-
-void MemSpyThreadView::itemClicked(const QModelIndex& index)
-{
- QVariantMap map;
- map["tid"] = index.data(Qt::UserRole);
- map.insert("pname", mProcessName);
- map.insert("tname", index.data(Qt::DisplayRole).toStringList().at(0));
-
- mViewManager.showView(ThreadDetailIndexView, map);
-}
-
-void MemSpyThreadView::catchLongPress(HbAbstractViewItem *item, const QPointF &coords)
-{
- mThreadId = qVariantValue<ThreadId>(item->modelIndex().data(Qt::UserRole));
- mContextMenu->setPreferredPos(coords);
- mContextMenu->open();
-}
-
-void MemSpyThreadView::changePriority()
-{
- QAction *s = qobject_cast<QAction*>(sender());
- int index = mPriorityMenu->actions().indexOf(s);
-
- ThreadPriority priorities[] = {
- ThreadPriorityAbsoluteVeryLow,
- ThreadPriorityAbsoluteLowNormal,
- ThreadPriorityAbsoluteLow,
- ThreadPriorityAbsoluteBackgroundNormal,
- ThreadPriorityAbsoluteBackground,
- ThreadPriorityAbsoluteForegroundNormal,
- ThreadPriorityAbsoluteForeground,
- ThreadPriorityAbsoluteHighNormal,
- ThreadPriorityAbsoluteHigh,
- ThreadPriorityAbsoluteRealTime1,
- ThreadPriorityAbsoluteRealTime2,
- ThreadPriorityAbsoluteRealTime3,
- ThreadPriorityAbsoluteRealTime4,
- ThreadPriorityAbsoluteRealTime5,
- ThreadPriorityAbsoluteRealTime6,
- ThreadPriorityAbsoluteRealTime7,
- ThreadPriorityAbsoluteRealTime8 };
-
- if (index >= 0) {
- mEngine.setThreadPriority(mThreadId, priorities[index]);
- refresh();
- }
-}
-
-void MemSpyThreadView::kill()
-{
- mEngine.killProcess(mProcessId);
- refresh();
-}
-
-void MemSpyThreadView::panic()
-{
- mEngine.panicProcess(mProcessId);
- refresh();
-}
-
-void MemSpyThreadView::terminate()
-{
- mEngine.terminateProcess(mProcessId);
- refresh();
-}
-
-
-void MemSpyThreadView::refresh()
-{
- mModel->refresh();
-}
--- a/memspyui/ui/hb/src/memspytrackingview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include "memspytrackingview.h"
-#include "viewmanager.h"
-
-#include <QStringListModel>
-#include <QDebug>
-
-void MemSpyTrackingView::initialize(const QVariantMap& params)
-{
- setTitle("MemSpy");
-
- MemSpyView::initialize(params);
-
- QStringList items = QStringList()
- << tr("System Wide Memory Tracking")
- << tr("Heap Dumps");
- mListView.setModel(new QStringListModel(items, this));
-
- QObject::connect(&mListView, SIGNAL(released(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
-}
-
-void MemSpyTrackingView::itemClicked(const QModelIndex& index)
-{
- Q_UNUSED(index);
- ViewIndex indexes[] = { SwmtView, HeapDumpsView };
- mViewManager.showView(indexes[index.row()]);
-}
-
-bool MemSpyTrackingView::isBreadCrumbVisible() const
-{
- return false;
-}
-
--- a/memspyui/ui/hb/src/memspyview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <QSignalMapper>
-#include <QGraphicsLinearLayout>
-#include <QDebug>
-#include <HbMenu>
-#include <HbAction>
-#include <HbToolBar>
-#include <HbApplication>
-#include <HbMessageBox>
-#include <HbMainWindow>
-#include <HbLabel>
-
-#include "memspyview.h"
-#include "enginewrapper.h"
-
-#include "memspysettingsview.h"
-
-MemSpyView::MemSpyView(EngineWrapper &engine, ViewManager &viewManager) :
- HbView(),
- mEngine(engine),
- mViewManager(viewManager),
- mOutputMenu(0),
- mOutputGenInfoMenu(0),
- mOutputHeapInfoMenu(0),
- mOutputStackInfoMenu(0),
- mToolBar(0),
- mBreadCrumb(0)
-{
-}
-
-MemSpyView::~MemSpyView()
-{
- delete mBreadCrumb;
- delete mToolBar;
- delete mOutputStackInfoMenu;
- delete mOutputHeapInfoMenu;
- delete mOutputGenInfoMenu;
- delete mOutputMenu;
-}
-
-void MemSpyView::initialize(const QVariantMap& params)
-{
- Q_UNUSED(params);
- QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, this);
-
- if (isBreadCrumbVisible()) {
- mBreadCrumb = new HbLabel(this);
- mBreadCrumb->setTextWrapping(Hb::TextWordWrap);
- mBreadCrumb->setElideMode(Qt::ElideLeft);
- mBreadCrumb->setPlainText(getBreadCrumbText());
- HbFontSpec spec(HbFontSpec::PrimarySmall);
- mBreadCrumb->setFontSpec(spec);
- layout->addItem(mBreadCrumb);
- }
- layout->addItem(createCentralWidget());
- setLayout(layout);
-
- if (isRefreshable())
- menu()->addAction(tr("Refresh"), this, SLOT(refresh()));
-
- HbMenu* toolMenu = createToolMenu();
- if (toolMenu)
- menu()->addMenu(toolMenu);
-
- menu()->addAction(tr("Settings ..."), this, SLOT(showSettings()));
- menu()->addAction(tr("About ..."), this, SLOT(showAbout()));
- menu()->addAction(tr("Exit"), qApp, SLOT(quit()));
-
- mToolBar = createToolBar();
- if (mToolBar)
- setToolBar(mToolBar);
-}
-
-QList<QAction*> MemSpyView::createOutputActions()
-{
- return QList<QAction*>();
-}
-
-HbMenu* MemSpyView::createToolMenu()
-{
- return 0;
-}
-
-HbToolBar* MemSpyView::createToolBar()
-{
- return 0;
-}
-
-bool MemSpyView::isRefreshable() const
-{
- return false;
-}
-
-bool MemSpyView::isBreadCrumbVisible() const
-{
- return false;
-}
-
-QString MemSpyView::getBreadCrumbText() const
-{
- QStringList views;
- for (int i=1; i<mainWindow()->views().count() - 1; i++) {
- const HbView *view = mainWindow()->views().at(i);
- if (view == this)
- break;
- views.append(view->title());
- }
- views.append(title());
-
- return views.join(" > ");
-}
-
-void MemSpyView::refresh()
-{
- // Empty default implementation
-}
-
-void MemSpyView::showSettings()
-{
- MemSpySettingsView* settings = new MemSpySettingsView(mEngine);
- connect(settings, SIGNAL(finished(bool)), this, SLOT(closeSettings()));
- mainWindow()->addView(settings);
- mainWindow()->setCurrentView(settings);
-}
-
-void MemSpyView::showAbout()
-{
- HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
- messageBox->setText("Version 2.2.0 - 24th August 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.");
- HbLabel *header = new HbLabel("About MemSpy", messageBox);
- messageBox->setHeadingWidget(header);
- messageBox->setAttribute(Qt::WA_DeleteOnClose);
- messageBox->setTimeout(HbPopup::NoTimeout);
- messageBox->open();
-}
-
-void MemSpyView::closeSettings()
-{
- sender()->deleteLater();
- mainWindow()->setCurrentView(this);
-}
--- a/memspyui/ui/hb/src/viewmanager.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include <HbMainWindow>
-#include <HbAction>
-#include <HbMessageBox>
-#include <HbLabel>
-
-#include "viewmanager.h"
-
-#include "enginewrapper.h"
-#include "memspyview.h"
-#include "memspymainview.h"
-#include "memspyprocessview.h"
-#include "memspythreadview.h"
-#include "memspythreaddetailindexview.h"
-#include "memspythreaddetailview.h"
-#include "memspykernelobjecttypeview.h"
-#include "memspykernelobjectview.h"
-#include "memspykernelobjectdetailview.h"
-#include "memspytrackingview.h"
-#include "memspyswmtview.h"
-#include "memspyheapdumpsview.h"
-#include "memspyserverview.h"
-#include "memspyecomcategoryview.h"
-#include "memspyecominterfaceview.h"
-#include "memspyecomimplementationview.h"
-#include "memspyecomimplementationdetailview.h"
-
-template <typename T>
-static MemSpyView* factory(EngineWrapper &engine, ViewManager &viewManager)
-{
- return new T(engine, viewManager);
-}
-// This array needs to be in sync with view enum
-MemSpyView* (*sFactories[])(EngineWrapper&, ViewManager&) = {
- &factory<MemSpyMainView>,
- &factory<MemSpyProcessView>,
- &factory<MemSpyThreadView>,
- &factory<MemSpyThreadDetailIndexView>,
- &factory<MemSpyThreadDetailView>,
- &factory<MemSpyKernelObjectTypeView>,
- &factory<MemSpyKernelObjectView>,
- &factory<MemSpyKernelObjectDetailView>,
- &factory<MemSpyTrackingView>,
- &factory<MemSpySwmtView>,
- &factory<MemSpyHeapDumpsView>,
- &factory<MemSpyServerView>,
- &factory<MemSpyEComCategoryView>,
- &factory<MemSpyEComInterfaceView>,
- &factory<MemSpyEComImplementationView>,
- &factory<MemSpyEComImplementationDetailView>,
-};
-
-
-ViewManager::ViewManager(HbMainWindow &window, EngineWrapper &engine, QObject *parent) :
- QObject(parent),
- mWindow(window),
- mEngine(engine)
-{
- connect(&mWindow, SIGNAL(currentViewChanged(HbView *)), this, SLOT(viewChanged(HbView *)));
-}
-
-void ViewManager::showView(ViewIndex viewIndex, const QVariantMap ¶ms)
-{
- MemSpyView* view;
- try {
- view = sFactories[viewIndex](mEngine, *this);
- view->initialize(params);
- }
- catch (std::exception& ex)
- {
- // show message box with exception
- // TODO: qt_symbian_exception2Error shouldn't probably be here
- QString error = tr("An error occured during the operation. Error code: %1").arg(
- qt_symbian_exception2Error(ex));
-
- HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeWarning);
- messageBox->setText(error);
- HbLabel *header = new HbLabel(tr("Error"), messageBox);
- messageBox->setHeadingWidget(header);
- messageBox->setAttribute(Qt::WA_DeleteOnClose);
- messageBox->setTimeout(HbPopup::StandardTimeout);
- messageBox->open();
-
- delete view;
- return;
- }
-
- if (viewIndex != MainView) {
- HbAction* action = new HbAction(Hb::BackNaviAction, this);
- connect(action, SIGNAL(triggered()), this, SLOT(goBack()));
- view->setNavigationAction(action);
- }
-
- mWindow.addView(view);
- mWindow.setCurrentView(view);
-}
-
-void ViewManager::showView(ViewIndex viewIndex)
-{
- showView(viewIndex, QVariantMap());
-}
-
-void ViewManager::goBack()
-{
- const QList<HbView*> views = mWindow.views();
- int index = views.indexOf(mWindow.currentView());
- mWindow.setCurrentView(views.at(index-1), true, Hb::ViewSwitchUseBackAnim);
-}
-
-void ViewManager::viewChanged(HbView *view)
-{
- const QList<HbView*> views = mWindow.views();
- int index = views.indexOf(view);
- for (int i=views.count()-1; i>index; i--)
- mWindow.removeView(views.at(i));
-}
--- a/perfmon/data/perfmon.rss Wed Sep 15 12:13:45 2010 +0300
+++ b/perfmon/data/perfmon.rss Wed Oct 13 14:32:52 2010 +0300
@@ -416,15 +416,6 @@
//
-// resources for enablepowermonitoring selections
-//
-RESOURCE TBUF r_powermonitoringenabled_setting_title
- {
- buf = "Enable power monitoring";
- }
-
-
-//
// resources for datapopupvisibility selection
//
RESOURCE TBUF r_datapopupvisibility_setting_title
@@ -594,7 +585,7 @@
id = EAknMessageQueryContentId;
control = AVKON_MESSAGE_QUERY
{
- message = "Version 1.2.0 - 26th August 2010. Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.";
+ message = "Version 1.0.0 - 6th March 2008. Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.";
};
}
};
--- a/perfmon/engine/inc/perfmon.hrh Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_HRH
-#define PERFMON_HRH
-
-enum TPerfMonCommandIds
- {
- EPerfMonCmdEnableLogging = 1,
- EPerfMonCmdDisableLogging,
- EPerfMonCmdSettings,
- EPerfMonCmdAbout,
-
- EPerfMonCmdSettingsChange,
- EPerfMonCmdSettingsExit,
- EPerfMonCmdSettingsBack,
-
- EPerfMonSettingItemList = 1000
- };
-
-enum TPerfMonMainViewTabs
- {
- ETabMainViewValues = 1,
- ETabMainViewGraphs
- };
-
-enum TPerfMonSettingListTabs
- {
- ETabSettingsGeneral = 0,
- ETabSettingsDataPopup,
- ETabSettingsGraphs,
- ETabSettingsLogging
- };
-
-enum TPerfMonSettingListIds
- {
- ESettingListItemHeartBeat = 0,
- ESettingListItemMaxSamples,
- ESettingListItemPriority,
- ESettingListItemCPUMode,
- ESettingListItemKeepBackLightOn,
- ESettingListItemPowerMonitoringEnabled,
-
- ESettingListItemDataPopupVisbility,
- ESettingListItemDataPopupLocation,
- ESettingListItemDataPopupSources,
-
- ESettingListItemGraphsVerticalBarPeriod,
- ESettingListItemGraphsSources,
-
- ESettingListItemLoggingMode,
- ESettingListItemLoggingFilePath,
- ESettingListItemLoggingSources
- };
-
-enum TPerfMonSettingThreadPriorityTypes
- {
- EThreadPriorityTypeMuchLess = 0,
- EThreadPriorityTypeLess,
- EThreadPriorityTypeNormal,
- EThreadPriorityTypeMore,
- EThreadPriorityTypeMuchMore,
- EThreadPriorityTypeRealTime,
- EThreadPriorityTypeAbsoluteVeryLow,
- EThreadPriorityTypeAbsoluteLow,
- EThreadPriorityTypeAbsoluteBackground,
- EThreadPriorityTypeAbsoluteForeground,
- EThreadPriorityTypeAbsoluteHigh
- };
-
-enum TPerfMonSettingCPUModes
- {
- ECPUModeNotSet = -1,
- ECPUModeCPUTime,
- ECPUModeNOPs
- };
-
-enum TPerfMonSettingDataPopupVisbilities
- {
- EDataPopupVisbilityAlwaysOn = 0,
- EDataPopupVisbilityBackgroundOnly,
- EDataPopupVisbilityAlwaysAlwaysOff
- };
-
-enum TPerfMonSettingDataPopupLocations
- {
- EDataPopupLocationTopRight = 0,
- EDataPopupLocationBottomMiddle
- };
-
-enum TPerfMonSettingSources
- {
- ESourceCPU = 0,
- ESourceRAM,
- ESourceC,
- ESourceD,
- ESourceE,
- ESourceF,
- ESourceG,
- ESourceH,
- ESourceI,
- ESourcePwr,
- ESourcesLength // this should be always the last!
- };
-
-enum TPerfMonSettingLoggingMode
- {
- ELoggingModeRDebug = 0,
- ELoggingModeLogFile,
- ELoggingModeRDebugLogFile
- };
-
-#endif // PERFMON_HRH
--- a/perfmon/engine/inc/perfmon_engine.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,259 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_ENGINE_H
-#define PERFMON_ENGINE_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-#include <apgcli.h>
-#include <gdi.h>
-
-#include "perfmon.hrh"
-#include "perfmon_powerlistener.h"
-
-const TUint KMaxCPUs = 4;
-
-
-// setting keys (do not change uids of existing keys to maintain compatibility to older versions!)
-const TUid KPMSettingHeartBeat = { 0x00 };
-const TUid KPMSettingMaxSamples = { 0x01 };
-const TUid KPMSettingPriority = { 0x02 };
-const TUid KPMSettingCPUMode = { 0x03 };
-const TUid KPMSettingKeepBackLightOn = { 0x04 };
-
-const TUid KPMSettingDataPopupVisbility = { 0x05 };
-const TUid KPMSettingDataPopupLocation = { 0x06 };
-const TUid KPMSettingDataPopupSources = { 0x07 };
-
-const TUid KPMSettingGraphsVerticalBarPeriod = { 0x08 };
-const TUid KPMSettingGraphsSources = { 0x09 };
-
-const TUid KPMSettingLoggingMode = { 0x0A };
-const TUid KPMSettingLoggingFilePath = { 0x0B };
-const TUid KPMSettingLoggingSources = { 0x0C };
-
-const TUid KPMSettingPowerMonitoringEnabled = { 0x0D };
-
-// FORWARD DECLARATIONS
-class CPerfMonValuesContainer;
-class CPerfMonGraphsContainer;
-class CPerfMonDataPopupContainer;
-class CEikonEnv;
-class CCoeControl;
-class CDictionaryFileStore;
-
-
-// CLASS DECLARATIONS
-
-class TPerfMonNOPCounter
- {
-public:
- TInt64 iCounterValue;
- TInt iCPUNumber;
- TInt iAmountOfCPUs;
- };
-
-class TPerfMonSources
- {
-public:
- TBool iSrcEnabled[ESourcesLength];
-
-public:
- inline void SetDefaults1()
- {
- iSrcEnabled[ESourceCPU] = ETrue;
- iSrcEnabled[ESourceRAM] = ETrue;
- iSrcEnabled[ESourceC] = ETrue;
- iSrcEnabled[ESourceD] = EFalse;
- iSrcEnabled[ESourceE] = EFalse;
- iSrcEnabled[ESourceF] = EFalse;
- iSrcEnabled[ESourceG] = EFalse;
- iSrcEnabled[ESourceH] = EFalse;
- iSrcEnabled[ESourceI] = EFalse;
- iSrcEnabled[ESourcePwr] = EFalse;
- }
- inline void SetDefaults2()
- {
- iSrcEnabled[ESourceCPU] = ETrue;
- iSrcEnabled[ESourceRAM] = ETrue;
- iSrcEnabled[ESourceC] = EFalse;
- iSrcEnabled[ESourceD] = EFalse;
- iSrcEnabled[ESourceE] = EFalse;
- iSrcEnabled[ESourceF] = EFalse;
- iSrcEnabled[ESourceG] = EFalse;
- iSrcEnabled[ESourceH] = EFalse;
- iSrcEnabled[ESourceI] = EFalse;
- iSrcEnabled[ESourcePwr] = EFalse;
- }
- TInt EnabledSourcesCount()
- {
- TInt srcCount(0);
-
- for (TInt i=0; i<ESourcesLength; i++)
- {
- if (iSrcEnabled[i])
- srcCount++;
- }
-
- return srcCount;
- }
- };
-
-
-class TPerfMonSettings
- {
-public:
- TInt iHeartBeat;
- TInt iMaxSamples;
- TInt iPriority;
- TInt iCPUMode;
- TBool iKeepBacklightOn;
-
- TInt iDataPopupVisibility;
- TInt iDataPopupLocation;
- TPerfMonSources iDataPopupSources;
-
- TInt iGraphsVerticalBarPeriod;
- TPerfMonSources iGraphsSources;
-
- TInt iLoggingMode;
- TFileName iLoggingFilePath;
- TPerfMonSources iLoggingSources;
-
- TBool iLoggingEnabled;
-
- TBool iPowerMonitoringEnabled;
- };
-
-
-class TSampleData
- {
-public:
- TInt64 iFree;
- TInt64 iSize;
- TTimeIntervalMicroSeconds iTimeFromStart;
- };
-
-typedef CArrayFixSeg<TSampleData> CSampleDataArray;
-
-
-class TSampleEntry
- {
-public:
- TBuf<16> iDescription;
- TBuf<16> iUnitTypeShort; //eg. b
- TBuf<16> iUnitTypeLong; //eg. bytes
- TInt iDriveNumber; //used only for disk drives
- TRgb iGraphColor;
- CSampleDataArray* iSampleDataArray;
- };
-
-typedef CArrayFixSeg<TSampleEntry> CSampleEntryArray;
-
-
-
-class CPerfMonEngine : public CActive
- {
-public:
- ~CPerfMonEngine();
- void ActivateEngineL();
- void DeActivateEngineL();
- void EnableLogging(TBool aEnable);
-
-private:
- void RunL();
- void DoCancel();
-
- void LoadSettingsL();
- void OpenLogFile(TBool aOpen);
- void CreateSamplesDataArrayL();
- void UpdateSamplesDataL();
- void AppendLatestSamplesToLogsL();
- void ActivateCPUMonitoringL();
- TBool OpenHandleToNullThread();
- void DeActivateCPUMonitoring();
- TBool CPUTimeSupported();
- TInt GetAmountOfCPUs();
- TThreadPriority SettingItemToThreadPriority(TInt aIndex);
- void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TInt& aValue);
- void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TDes& aValue);
- void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TPerfMonSources& aValue);
- void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TInt& aValue);
- void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TDes& aValue);
- void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TPerfMonSources& aValue);
- void ActivatePowerMonitoringL();
- void DeActivatePowerMonitoring();
-
- TInt SampleEntryPosToSettingPos(TInt aSampleEntryPos);
-
-protected:
- CPerfMonEngine();
- void ConstructL();
- void SaveSettingsL();
- virtual void SendDrawEventToContainersL() = 0;
- virtual void HandleSettingsChangeL();
-
-public:
- inline TPerfMonSettings& Settings() { return iSettings; }
- inline CEikonEnv* EikonEnv() { return iEnv; }
- inline RApaLsSession& LsSession() { return iLs; }
-
- inline CSampleEntryArray* SampleEntryArray() { return iSampleEntryArray; }
- inline TInt CPU0PositionInSamples() { return iCPU0PositionInSamples; }
- inline TInt RAMPositionInSamples() { return iRAMPositionInSamples; }
- inline TInt CDrivePositionInSamples() { return iCDrivePositionInSamples; }
- inline TInt PowerPositionInSamples() { return iPowerPositionInSamples; }
- inline TInt AmountOfCPUs() { return iAmountOfCPUs; }
- inline TBool PowerMonitoringSupported() { return iPowerClient->IsSupported(); }
-
-protected:
- RTimer iTimer;
- CEikonEnv* iEnv;
- TPerfMonSettings iSettings;
- RApaLsSession iLs;
- CSampleEntryArray* iSampleEntryArray;
- TTime iStartTime;
-
- TInt iCurrentCPUMode;
-
- RThread iCPULoadNOPThread[KMaxCPUs];
- TPerfMonNOPCounter iCPULoadNOPCounter[KMaxCPUs];
-
- RThread iNullThreads[KMaxCPUs];
- TBool iCPULoadCalibrating;
- TInt iCPULoadCalibrationCounter;
- TInt64 iCPULoadMaxValue;
- TInt64 iCPULoadPreviousValue[KMaxCPUs];
- TInt iAmountOfCPUs;
- TTime iPreviousTime;
-
- TInt iCPU0PositionInSamples;
- TInt iRAMPositionInSamples;
- TInt iCDrivePositionInSamples;
- TInt iPowerPositionInSamples;
-
- TBool iLogFileInitialized;
- RFile iLogFile;
-
- CPerfMonPowerListener* iPowerClient;
- };
-
-
-#endif
--- a/perfmon/engine/inc/perfmon_powerlistener.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_POWERLISTENER_H
-#define PERFMON_POWERLISTENER_H
-
-// INCLUDES
-#include <HWRMPower.h>
-
-#include "perfmon.hrh"
-
-// HWRM reporting interval multiplier
-const TInt KSampleIntervalMultiple = 1;
-const TInt KReportingDuration = 0; // Infinite duration
-
-class CPerfMonPowerListener : public CBase, public MHWRMBatteryPowerObserver
- {
-public:
- static CPerfMonPowerListener* NewL();
- ~CPerfMonPowerListener();
-
-private:
- CPerfMonPowerListener();
- void ConstructL();
-
- // Handling central repository max reporting period key
- void GetReportingPeriodL();
- void SetReportingPeriodL(TInt aDuration);
-
-public:
- static TBool IsSupported();
-
- // Start monitoring power values
- TInt Activate();
- // Stop monitoring power values
- void DeActivate();
-
- // Get average power since last read.
- TInt GetPower();
- // Maximum power value since measurement started
- inline TInt GetMaxPower() { return iMaxPower; }
-
- virtual void PowerMeasurement(TInt aErrCode, CHWRMPower::TBatteryPowerMeasurementData& aMeasurement);
-
-private:
- CHWRMPower* iHWRMPower;
- RArray<TInt> iPowerBuffer;
- TInt iLastPowerAvg;
- TInt iMaxPower;
-
- TInt iOriginalMaxReportingPeriod;
- };
-
-#endif
--- a/perfmon/engine/src/perfmon_engine.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1128 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-// INCLUDE FILES
-#include "perfmon_engine.h"
-#include "perfmon_powerlistener.h"
-#include <coeutils.h>
-#include <bautils.h>
-#include <eikenv.h>
-#include <e32hal.h>
-#include <u32std.h>
-#include <s32file.h>
-#include <akntitle.h>
-#include <eikspane.h>
-#include <aknnotewrappers.h>
-_LIT(KDefaultLogFilePath, "c:\\data\\PerfMon.log");
-
-const TInt KCalibrationLength = 2;
-const TInt KMinimumSamplesLength = 16;
-const TInt KCPUTimeMultiplier = 1000000; // used to avoid TReal conversions
-
-const TInt KSettingsDrive = EDriveC;
-_LIT(KSettingsFileName, "perfmon_settings.ini");
-
-// --------------------------------------------------------------------------------------------
-
-TInt CPULoadCount(TAny* aPtr)
- {
- TPerfMonNOPCounter& atts = *((TPerfMonNOPCounter*) aPtr);
-
- // increase the counter
- atts.iCounterValue++;
- return 1;
- }
-
-TInt CPULoadNOPThread(TAny* aPtr)
- {
- // set the thread running in correct CPU
- TPerfMonNOPCounter& atts = *((TPerfMonNOPCounter*) aPtr);
-
- if (atts.iAmountOfCPUs > 1)
- {
- // request via HAL that the current thread will run in CPU defined in atts.iCPUNumber
- TInt err = UserSvr::HalFunction(EHalGroupKernel, 19 /*EKernelHalLockThreadToCpu*/, (TAny*) atts.iCPUNumber, 0);
-
- if (err != KErrNone)
- {
- // error, stop this thread
- return err;
- }
- }
-
- // init trap clean and install active scheduler
- CTrapCleanup* pC = CTrapCleanup::New();
- CActiveScheduler* pS = new CActiveScheduler;
- CActiveScheduler::Install(pS);
-
- // call the counter to simulate polling the null thread for cpu time
- CIdle* idle = CIdle::NewL(CActive::EPriorityStandard);
- TCallBack cb(CPULoadCount, aPtr);
- idle->Start(cb);
-
- pS->Start();
-
- delete idle;
- delete pS;
- delete pC;
-
- return KErrNone;
- }
-
-// ===================================== MEMBER FUNCTIONS =====================================
-
-CPerfMonEngine::CPerfMonEngine() :
- CActive(EPriorityUserInput)
- {
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::ConstructL()
- {
- iCurrentCPUMode = ECPUModeNotSet;
- iLogFileInitialized = EFalse;
- iAmountOfCPUs = 1;
-
- iEnv = CEikonEnv::Static();
- User::LeaveIfError(iLs.Connect());
-
- User::LeaveIfError(iTimer.CreateLocal());
- CActiveScheduler::Add(this);
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::ActivateEngineL()
- {
- // load settings
- TRAP_IGNORE(LoadSettingsL());
-
- // create data storages for the samples
- CreateSamplesDataArrayL();
-
- // set default modes
- HandleSettingsChangeL();
-
- // start sampling data immediately (jump to RunL)
- iTimer.After(iStatus, 100);
- SetActive();
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::DeActivateEngineL()
- {
- Cancel();
-
- DeActivatePowerMonitoring();
- DeActivateCPUMonitoring();
-
- // close log file
- OpenLogFile(EFalse);
- }
-
-// --------------------------------------------------------------------------------------------
-
-CPerfMonEngine::~CPerfMonEngine()
- {
- DeActivatePowerMonitoring();
-
- if (iPowerClient != 0)
- {
- delete iPowerClient;
- iPowerClient = 0;
- }
-
- iTimer.Close();
-
- // clear data storages
- if (iSampleEntryArray)
- {
- for (TInt i = 0; i < iSampleEntryArray->Count(); i++)
- {
- delete iSampleEntryArray->At(i).iSampleDataArray;
- }
-
- delete iSampleEntryArray;
- }
-
- iLs.Close();
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::DoCancel()
- {
- iTimer.Cancel();
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::RunL()
- {
- // calculate new values
- UpdateSamplesDataL();
-
- // log changes
- AppendLatestSamplesToLogsL();
-
- // redraw views
- SendDrawEventToContainersL();
-
- // continue
- iTimer.After(iStatus, iSettings.iHeartBeat * 1000); // convert from milliseconds to microseconds
- SetActive();
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::HandleSettingsChangeL()
- {
- // set priority of the thread
- RThread().SetPriority(SettingItemToThreadPriority(iSettings.iPriority));
-
- // init cpu monitor if setting has been changed
- if (iCurrentCPUMode != iSettings.iCPUMode)
- {
- DeActivateCPUMonitoring();
- ActivateCPUMonitoringL();
- }
-
- // Check for power setting changes every time
- if (iSettings.iPowerMonitoringEnabled == true)
- {
- ActivatePowerMonitoringL();
- }
- else
- {
- DeActivatePowerMonitoring();
- }
-
- // close log file
- OpenLogFile(EFalse);
-
- // enable log file
- if (iSettings.iLoggingEnabled && (iSettings.iLoggingMode
- == ELoggingModeLogFile || iSettings.iLoggingMode
- == ELoggingModeRDebugLogFile))
- OpenLogFile(ETrue);
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::EnableLogging(TBool aEnable)
- {
- if (aEnable)
- {
- if (iSettings.iLoggingMode == ELoggingModeLogFile
- || iSettings.iLoggingMode == ELoggingModeRDebugLogFile)
- OpenLogFile(ETrue);
-
- iSettings.iLoggingEnabled = ETrue;
- }
- else // disable
- {
- iSettings.iLoggingEnabled = EFalse;
- OpenLogFile(EFalse);
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::OpenLogFile(TBool aOpen)
- {
- // open log file for writing
- if (aOpen)
- {
- if (!iLogFileInitialized)
- {
- TInt err(KErrNone);
-
- // open the log file for writing
- if (iLogFile.Open(iEnv->FsSession(), iSettings.iLoggingFilePath,
- EFileWrite) != KErrNone)
- {
- iEnv->FsSession().MkDirAll(iSettings.iLoggingFilePath);
- err = iLogFile.Replace(iEnv->FsSession(),
- iSettings.iLoggingFilePath, EFileWrite);
- }
- else
- {
- // file opens correctly, seek to the end
- TInt fileSize = 0;
- iLogFile.Size(fileSize);
- err = iLogFile.Seek(ESeekCurrent, fileSize);
- }
-
- if (err == KErrNone)
- {
- iLogFileInitialized = ETrue;
- }
- else
- {
- // show error
- CAknErrorNote* note = new (ELeave) CAknErrorNote();
- note->ExecuteLD(_L("Unable to create log file, check settings"));
- }
- }
- }
-
- // close handle to log file
- else
- {
- if (iLogFileInitialized)
- {
- iLogFile.Flush();
- iLogFile.Close();
-
- iLogFileInitialized = EFalse;
- }
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::ActivateCPUMonitoringL()
- {
- // reset counter variables
- iCPULoadCalibrating = ETrue;
- iCPULoadCalibrationCounter = 0;
- iCPULoadMaxValue = 999999999;
-
- for (TInt i=0; i<KMaxCPUs; i++)
- {
- iCPULoadPreviousValue[i] = 1;
- }
-
- // use null thread is cpu time is supported and the setting is on
- if (CPUTimeSupported() && iSettings.iCPUMode == ECPUModeCPUTime)
- {
- // try to open handle to null thread
- if (OpenHandleToNullThread())
- {
- // handle is open, get initial value for each CPU
- for (TInt i=0; i<iAmountOfCPUs; i++)
- {
- TTimeIntervalMicroSeconds time;
- iNullThreads[i].GetCpuTime(time);
- iCPULoadPreviousValue[i] = time.Int64();
- }
-
- iPreviousTime.HomeTime();
-
- iCurrentCPUMode = ECPUModeCPUTime;
- return; // cpu time is succesfully in use
- }
- }
-
- // otherwise use normal sampling with nops
- iCurrentCPUMode = ECPUModeNotSet;
-
- // show a warning if cpu time cannot be taken in use
- if (iSettings.iCPUMode == ECPUModeCPUTime)
- {
- CAknInformationNote* note = new (ELeave) CAknInformationNote();
- note->ExecuteLD(
- _L("CPU Time not supported in this system, using NOPs sampling"));
- }
-
- // get the amount of CPUs
- iAmountOfCPUs = GetAmountOfCPUs();
-
- // create a thread for CPU load monitoring
- for (TInt i=0; i<iAmountOfCPUs; i++)
- {
- // initialize the NOP counter variables
- iCPULoadNOPCounter[i].iCounterValue = 0;
- iCPULoadNOPCounter[i].iCPUNumber = i;
- iCPULoadNOPCounter[i].iAmountOfCPUs = iAmountOfCPUs;
-
- // create a name for the thread
- TFileName cpuLoadThreadName;
- cpuLoadThreadName.Copy(_L("PerfMonCPULoadNOPThread"));
- cpuLoadThreadName.AppendNum(i);
-
- // create the thread and resume it
- User::LeaveIfError(iCPULoadNOPThread[i].Create(cpuLoadThreadName,
- CPULoadNOPThread, 0x1000, 0x1000, 0x100000, &iCPULoadNOPCounter[i]));
- iCPULoadNOPThread[i].SetPriority(EPriorityLess);
- iCPULoadNOPThread[i].Resume();
- }
-
- iCurrentCPUMode = ECPUModeNOPs; // NOPs taken succesfully in use
- }
-
-// --------------------------------------------------------------------------------------------
-
-TBool CPerfMonEngine::OpenHandleToNullThread()
- {
- // find the kernel process and then the null thread
- TFindProcess fp(_L("ekern.exe*"));
-
- TFullName kernelName;
- if (fp.Next(kernelName) == KErrNone)
- {
- iAmountOfCPUs = 0;
-
- // find all null threads in the system by following the order ie "Null", "Null1", "Null2", "Null3"
- for (TInt i(0); i<KMaxCPUs; i++)
- {
- // construct name of the null thread from the process name
- TFullName nullThreadName(kernelName);
- nullThreadName.Append(_L("::Null"));
-
- if (i >= 1) // add identifier for CPUs higher than zero
- nullThreadName.AppendNum(i);
-
- TFindThread ft(nullThreadName);
- TFullName threadName;
-
- if (ft.Next(threadName) == KErrNone)
- {
- if (iNullThreads[i].Open(threadName) != KErrNone)
- return EFalse;
-
- iAmountOfCPUs++;
- }
- else
- {
- break; // break the loop, no more matches can be found
- }
- }
- }
-
- // process not found
- else
- return EFalse;
-
- // success!
- return ETrue;
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::DeActivateCPUMonitoring()
- {
- if (iCurrentCPUMode == ECPUModeCPUTime)
- {
- // close handles to null threads
- for (TInt i=0;i<iAmountOfCPUs;i++)
- {
- iNullThreads[i].Close();
- }
- }
-
- else if (iCurrentCPUMode == ECPUModeNOPs)
- {
- // kill the cpu load thread
- for (TInt i=0;i<iAmountOfCPUs;i++)
- {
- iCPULoadNOPThread[i].Kill(0);
- iCPULoadNOPThread[i].Close();
- }
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-TBool CPerfMonEngine::CPUTimeSupported()
- {
- TTimeIntervalMicroSeconds time;
- TInt err = RThread().GetCpuTime(time);
-
- if (err == KErrNone && time.Int64() > 0)
- return ETrue;
- else
- return EFalse;
- }
-
-// --------------------------------------------------------------------------------------------
-
-TInt CPerfMonEngine::GetAmountOfCPUs()
- {
- // query from HAL the amount of CPUs and then check it returns a valid value
- TInt amountOfCPUs = UserSvr::HalFunction(EHalGroupKernel, 16 /*EKernelHalNumLogicalCpus*/, 0, 0);
-
- if (amountOfCPUs >= 1 && amountOfCPUs <= KMaxCPUs)
- return amountOfCPUs;
- else
- return 1; // HAL may not support this feature, so just return one CPU
- }
-
-// --------------------------------------------------------------------------------------------
-
-TThreadPriority CPerfMonEngine::SettingItemToThreadPriority(TInt aIndex)
- {
- TThreadPriority threadPriority = EPriorityNull;
-
- switch (aIndex)
- {
- case EThreadPriorityTypeMuchLess:
- {
- threadPriority = EPriorityMuchLess;
- break;
- }
- case EThreadPriorityTypeLess:
- {
- threadPriority = EPriorityLess;
- break;
- }
- case EThreadPriorityTypeNormal:
- {
- threadPriority = EPriorityNormal;
- break;
- }
- case EThreadPriorityTypeMore:
- {
- threadPriority = EPriorityMore;
- break;
- }
- case EThreadPriorityTypeMuchMore:
- {
- threadPriority = EPriorityMuchMore;
- break;
- }
- case EThreadPriorityTypeRealTime:
- {
- threadPriority = EPriorityRealTime;
- break;
- }
- case EThreadPriorityTypeAbsoluteVeryLow:
- {
- threadPriority = EPriorityAbsoluteVeryLow;
- break;
- }
- case EThreadPriorityTypeAbsoluteLow:
- {
- threadPriority = EPriorityAbsoluteLow;
- break;
- }
- case EThreadPriorityTypeAbsoluteBackground:
- {
- threadPriority = EPriorityAbsoluteBackground;
- break;
- }
- case EThreadPriorityTypeAbsoluteForeground:
- {
- threadPriority = EPriorityAbsoluteForeground;
- break;
- }
- case EThreadPriorityTypeAbsoluteHigh:
- {
- threadPriority = EPriorityAbsoluteHigh;
- break;
- }
-
- default:
- {
- User::Panic(_L("Wrong tp index"), 276);
- break;
- }
- }
-
- return threadPriority;
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::CreateSamplesDataArrayL()
- {
- TInt maxSamples =
- iSettings.iMaxSamples >= KMinimumSamplesLength ? iSettings.iMaxSamples
- : KMinimumSamplesLength;
-
- // create the data structure to store all samples
- iSampleEntryArray = new (ELeave) CSampleEntryArray(16);
-
- // set sample data array positions for each type
- iCPU0PositionInSamples = 0;
- iRAMPositionInSamples = KMaxCPUs;
- iCDrivePositionInSamples = KMaxCPUs+1;
- iPowerPositionInSamples = iCDrivePositionInSamples + ( ESourceI - ESourceC ) + 1;
-
- // add all CPU source entries
- for (TInt i=0; i<KMaxCPUs; i++)
- {
- TSampleEntry newSampleEntry;
-
- newSampleEntry.iDescription.Copy(_L("CPU"));
- newSampleEntry.iDescription.AppendNum(i);
-
- newSampleEntry.iUnitTypeShort.Copy(KNullDesC);
- newSampleEntry.iUnitTypeLong.Copy(KNullDesC);
- newSampleEntry.iDriveNumber = -1;
- newSampleEntry.iGraphColor = KRgbYellow;
- newSampleEntry.iGraphColor.SetGreen(255-i*75);
- newSampleEntry.iGraphColor.SetBlue(i*75);
-
- newSampleEntry.iSampleDataArray = new(ELeave) CSampleDataArray(maxSamples);
- iSampleEntryArray->AppendL(newSampleEntry);
- }
-
- // add RAM entry
- {
- TSampleEntry newSampleEntry;
-
- newSampleEntry.iDescription.Copy(_L("RAM"));
- newSampleEntry.iUnitTypeShort.Copy(_L("b"));
- newSampleEntry.iUnitTypeLong.Copy(_L("bytes"));
- newSampleEntry.iDriveNumber = -1;
- newSampleEntry.iGraphColor = KRgbGreen;
-
- newSampleEntry.iSampleDataArray = new(ELeave) CSampleDataArray(maxSamples);
- iSampleEntryArray->AppendL(newSampleEntry);
- }
-
- // add all disk drives
- for (TInt i=0; i<ESourceI-ESourceC+1; i++)
- {
- TSampleEntry newSampleEntry;
-
- TChar driveLetter = 'C' + i; // C is the first drive
-
- newSampleEntry.iDescription.Append(driveLetter);
- newSampleEntry.iDescription.Append(_L(":"));
- newSampleEntry.iUnitTypeShort.Copy(_L("b"));
- newSampleEntry.iUnitTypeLong.Copy(_L("bytes"));
-
- iEnv->FsSession().CharToDrive(driveLetter,
- newSampleEntry.iDriveNumber);
-
- newSampleEntry.iGraphColor = KRgbCyan;
- newSampleEntry.iGraphColor.SetGreen(255 - (i - ESourceC) * 30);
- newSampleEntry.iGraphColor.SetRed(i * 30);
-
- newSampleEntry.iSampleDataArray = new (ELeave) CSampleDataArray(
- maxSamples);
-
- iSampleEntryArray->AppendL(newSampleEntry);
- }
-
- // add power entry
- {
- TSampleEntry newSampleEntry;
-
- newSampleEntry.iDescription.Copy(_L("Power"));
- newSampleEntry.iUnitTypeShort.Copy(_L("mW"));
- newSampleEntry.iUnitTypeLong.Copy(_L("milliwatts"));
- newSampleEntry.iDriveNumber = -1;
- newSampleEntry.iGraphColor = KRgbRed;
-
- newSampleEntry.iSampleDataArray = new(ELeave) CSampleDataArray(maxSamples);
- iSampleEntryArray->AppendL(newSampleEntry);
- }
-
- // save current time as start time
- iStartTime.HomeTime();
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::UpdateSamplesDataL()
- {
- // reset inactivity timers
- if (iSettings.iKeepBacklightOn)
- User::ResetInactivityTime();
-
- // get current time
- TTime currentTime;
- currentTime.HomeTime();
-
- // calculate time difference
- TTimeIntervalMicroSeconds timeDeltaFromPreviousSample =
- currentTime.MicroSecondsFrom(iPreviousTime);
-
- // remember current time as previous
- iPreviousTime = currentTime;
-
- // get CPU load value for each CPU
- for (TInt i=0;i<iAmountOfCPUs;i++)
- {
- TInt64 cpuLoadDelta(0);
- TInt64 cpuLoadFree(0);
- TInt64 currentCPUValue(0);
-
- if (iCurrentCPUMode == ECPUModeCPUTime || iCurrentCPUMode == ECPUModeNOPs)
- {
- if (iCurrentCPUMode == ECPUModeCPUTime)
- {
- // get CPU time of null thread
- TTimeIntervalMicroSeconds time;
- iNullThreads[i].GetCpuTime(time);
- currentCPUValue = time.Int64();
- }
- else if (iCurrentCPUMode == ECPUModeNOPs)
- {
- // get CPU time from sampler
- currentCPUValue = iCPULoadNOPCounter[i].iCounterValue;
- }
-
- // get delta and store the previous value
- cpuLoadDelta = currentCPUValue - iCPULoadPreviousValue[i];
- iCPULoadPreviousValue[i] = currentCPUValue;
-
- // velocity = distance / time
- cpuLoadFree = cpuLoadDelta * KCPUTimeMultiplier / timeDeltaFromPreviousSample.Int64();
-
- // detect maximum value (this is common to all CPUs)
- if (cpuLoadFree > iCPULoadMaxValue)
- {
- iCPULoadMaxValue = cpuLoadFree;
- }
- }
-
- // save cpu sample data
- TSampleData cpuSample;
- cpuSample.iFree = cpuLoadFree;
- cpuSample.iSize = iCPULoadCalibrating ? cpuLoadFree : iCPULoadMaxValue; // if calibrating, size==free, otherwise store the correct size value
- cpuSample.iTimeFromStart = currentTime.MicroSecondsFrom(iStartTime);
-
- iSampleEntryArray->At(i).iSampleDataArray->InsertL(0, cpuSample);
- }
-
- // check calibration status, the calibration will be only done against CPU0
- if (iCPULoadCalibrating)
- {
- iCPULoadCalibrationCounter++;
- TInt64 cpuLoadSize = iSampleEntryArray->At(iCPU0PositionInSamples).iSampleDataArray->At(0).iSize;
-
- // check if need to calibrate anymore
- if (iCPULoadCalibrationCounter > KCalibrationLength)
- {
- iCPULoadCalibrating = EFalse;
-
- // from the samples, get the minimum value, and let it be the max value
- for (TInt i=0; i<iSampleEntryArray->At(0).iSampleDataArray->Count(); i++)
- {
- TInt64 newCPULoadMaxValue = iCPULoadMaxValue;
-
- if (iSampleEntryArray->At(0).iSampleDataArray->At(i).iFree < newCPULoadMaxValue)
- {
- newCPULoadMaxValue = iSampleEntryArray->At(0).iSampleDataArray->At(i).iFree;
- }
-
- iCPULoadMaxValue = newCPULoadMaxValue;
- }
-
- // adjust priority of the poller thread
- if (iCurrentCPUMode == ECPUModeNOPs)
- {
- for (TInt i=0; i<iAmountOfCPUs; i++)
- {
- iCPULoadNOPThread[i].SetPriority(EPriorityAbsoluteVeryLow);
- }
- }
-
- }
- }
-
- // get ram memory
- TMemoryInfoV1Buf ramMemory;
- UserHal::MemoryInfo(ramMemory);
-
- TSampleData memorySample;
- memorySample.iFree = ramMemory().iFreeRamInBytes;
- memorySample.iSize = ramMemory().iMaxFreeRamInBytes;
- memorySample.iTimeFromStart = currentTime.MicroSecondsFrom(iStartTime);
-
- iSampleEntryArray->At(iRAMPositionInSamples).iSampleDataArray->InsertL(0, memorySample);
-
- // all drives
- for (TInt i = iCDrivePositionInSamples; i < iPowerPositionInSamples; i++)
- {
- TSampleData driveSample;
-
- // get volume info from RFs
- TVolumeInfo volumeInfo;
- if (iEnv->FsSession().Volume(volumeInfo,
- iSampleEntryArray->At(i).iDriveNumber) == KErrNone)
- {
- driveSample.iFree = volumeInfo.iFree;
- driveSample.iSize = volumeInfo.iSize;
- }
- else
- {
- driveSample.iFree = 0;
- driveSample.iSize = 0;
- }
-
- driveSample.iTimeFromStart = currentTime.MicroSecondsFrom(iStartTime);
-
- iSampleEntryArray->At(i).iSampleDataArray->InsertL(0, driveSample);
- }
-
- // Power data
- TSampleData powerSample;
- if (iSettings.iPowerMonitoringEnabled)
- {
- // Values in milliwatts
- powerSample.iFree = ( iPowerClient->GetMaxPower() - iPowerClient->GetPower() ) / 1000;
- powerSample.iSize = iPowerClient->GetMaxPower() / 1000;
- }
- else
- {
- powerSample.iFree = 0;
- powerSample.iSize = 0;
- }
-
- powerSample.iTimeFromStart = currentTime.MicroSecondsFrom(iStartTime);
-
- iSampleEntryArray->At(iPowerPositionInSamples).iSampleDataArray->InsertL(0, powerSample);
-
- // compress sample data arrays to save memory
- TInt curLength(iSampleEntryArray->At(0).iSampleDataArray->Count());
-
- TInt maxSamples =
- iSettings.iMaxSamples >= KMinimumSamplesLength ? iSettings.iMaxSamples
- : KMinimumSamplesLength;
-
- if (curLength > maxSamples && curLength % 5 == 0)
- {
- for (TInt i = 0; i < iSampleEntryArray->Count(); i++)
- {
- if (SampleEntryArray()->At(i).iSampleDataArray->Count() > 0)
- {
- iSampleEntryArray->At(i).iSampleDataArray->ResizeL(maxSamples); // looses old samples
- iSampleEntryArray->At(i).iSampleDataArray->Compress();
- }
- }
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::AppendLatestSamplesToLogsL()
- {
- if (iSettings.iLoggingEnabled && SampleEntryArray())
- {
- // loop all sources
- for (TInt i = 0; i < SampleEntryArray()->Count(); i++)
- {
- // check if this setting has been enabled and it has some data
- if (iSettings.iLoggingSources.iSrcEnabled[SampleEntryPosToSettingPos(i)]
- && SampleEntryArray()->At(i).iSampleDataArray->Count() > 0)
- {
- // get current sample
- TSampleData& currentSample =
- SampleEntryArray()->At(i).iSampleDataArray->At(0);
-
- TBuf<128> buf;
- buf.Append(_L("PERFMON;"));
- buf.Append(SampleEntryArray()->At(i).iDescription);
- buf.Append(_L(";"));
- buf.AppendNum(currentSample.iTimeFromStart.Int64());
- buf.Append(_L(";"));
- buf.AppendNum(currentSample.iFree);
- buf.Append(_L(";"));
- buf.AppendNum(currentSample.iSize);
-
- // print to RDebug
- if (iSettings.iLoggingMode == ELoggingModeRDebug
- || iSettings.iLoggingMode == ELoggingModeRDebugLogFile)
- {
- RDebug::Print(buf);
- }
-
- // print to log file
- if (iSettings.iLoggingMode == ELoggingModeLogFile
- || iSettings.iLoggingMode == ELoggingModeRDebugLogFile)
- {
- buf.Append(_L("\r\n"));
-
- TBuf8<128> buf8;
- buf8.Copy(buf);
-
- iLogFile.Write(buf8);
- }
- }
- }
- }
- }
-
-void CPerfMonEngine::LoadSettingsL()
- {
- // set defaults
- iSettings.iHeartBeat = 600;
- iSettings.iMaxSamples = 64;
- iSettings.iPriority = EThreadPriorityTypeNormal;
- iSettings.iCPUMode = ECPUModeCPUTime;
- iSettings.iKeepBacklightOn = ETrue;
-
- iSettings.iDataPopupVisibility = EDataPopupVisbilityAlwaysOn;
- iSettings.iDataPopupLocation = EDataPopupLocationTopRight;
- iSettings.iDataPopupSources.SetDefaults1();
-
- iSettings.iGraphsVerticalBarPeriod = 5;
- iSettings.iGraphsSources.SetDefaults2();
-
- iSettings.iLoggingMode = ELoggingModeRDebug;
- iSettings.iLoggingFilePath.Copy(KDefaultLogFilePath);
- iSettings.iLoggingSources.SetDefaults2();
-
- iSettings.iLoggingEnabled = EFalse;
-
- iSettings.iPowerMonitoringEnabled = ETrue;
-
- // make sure that the private path of this app in c-drive exists
- iEnv->FsSession().CreatePrivatePath(KSettingsDrive); // c:\\private\\20011385\\
-
- // handle settings always in the private directory
- if (iEnv->FsSession().SetSessionToPrivate(KSettingsDrive) == KErrNone)
- {
- const TUid KUidPerfMon =
- {
- 0x20011385
- };
- // open or create a dictionary file store
- CDictionaryFileStore* settingsStore = CDictionaryFileStore::OpenLC(
- iEnv->FsSession(), KSettingsFileName, KUidPerfMon);
-
- LoadDFSValueL(settingsStore, KPMSettingHeartBeat, iSettings.iHeartBeat);
- LoadDFSValueL(settingsStore, KPMSettingMaxSamples,
- iSettings.iMaxSamples);
- LoadDFSValueL(settingsStore, KPMSettingPriority, iSettings.iPriority);
-
- LoadDFSValueL(settingsStore, KPMSettingCPUMode, iSettings.iCPUMode);
-
- LoadDFSValueL(settingsStore, KPMSettingKeepBackLightOn,
- iSettings.iKeepBacklightOn);
-
- LoadDFSValueL(settingsStore, KPMSettingDataPopupVisbility,
- iSettings.iDataPopupVisibility);
- LoadDFSValueL(settingsStore, KPMSettingDataPopupLocation,
- iSettings.iDataPopupLocation);
- LoadDFSValueL(settingsStore, KPMSettingDataPopupSources,
- iSettings.iDataPopupSources);
-
- LoadDFSValueL(settingsStore, KPMSettingGraphsVerticalBarPeriod,
- iSettings.iGraphsVerticalBarPeriod);
- LoadDFSValueL(settingsStore, KPMSettingGraphsSources,
- iSettings.iGraphsSources);
-
- LoadDFSValueL(settingsStore, KPMSettingLoggingMode,
- iSettings.iLoggingMode);
- LoadDFSValueL(settingsStore, KPMSettingLoggingFilePath,
- iSettings.iLoggingFilePath);
- LoadDFSValueL(settingsStore, KPMSettingLoggingSources,
- iSettings.iLoggingSources);
-
- LoadDFSValueL(settingsStore, KPMSettingPowerMonitoringEnabled,
- iSettings.iPowerMonitoringEnabled);
-
- CleanupStack::PopAndDestroy(); // settingsStore
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonEngine::SaveSettingsL()
- {
- // handle settings always in c:\\private\\20011385\\
- if (iEnv->FsSession().SetSessionToPrivate( KSettingsDrive ) == KErrNone)
- {
- // delete existing store to make sure that it is clean and not eg corrupted
- if (BaflUtils::FileExists(iEnv->FsSession(), KSettingsFileName))
- {
- iEnv->FsSession().Delete(KSettingsFileName);
- }
- const TUid KUidPerfMon =
- {
- 0x20011385
- };
- // create a dictionary file store
- CDictionaryFileStore* settingsStore = CDictionaryFileStore::OpenLC(
- iEnv->FsSession(), KSettingsFileName, KUidPerfMon);
-
- SaveDFSValueL(settingsStore, KPMSettingHeartBeat, iSettings.iHeartBeat);
- SaveDFSValueL(settingsStore, KPMSettingMaxSamples,
- iSettings.iMaxSamples);
- SaveDFSValueL(settingsStore, KPMSettingPriority, iSettings.iPriority);
- SaveDFSValueL(settingsStore, KPMSettingCPUMode, iSettings.iCPUMode);
- SaveDFSValueL(settingsStore, KPMSettingKeepBackLightOn,
- iSettings.iKeepBacklightOn);
-
- SaveDFSValueL(settingsStore, KPMSettingDataPopupVisbility,
- iSettings.iDataPopupVisibility);
- SaveDFSValueL(settingsStore, KPMSettingDataPopupLocation,
- iSettings.iDataPopupLocation);
- SaveDFSValueL(settingsStore, KPMSettingDataPopupSources,
- iSettings.iDataPopupSources);
-
- SaveDFSValueL(settingsStore, KPMSettingGraphsVerticalBarPeriod,
- iSettings.iGraphsVerticalBarPeriod);
- SaveDFSValueL(settingsStore, KPMSettingGraphsSources,
- iSettings.iGraphsSources);
-
- SaveDFSValueL(settingsStore, KPMSettingLoggingMode,
- iSettings.iLoggingMode);
- SaveDFSValueL(settingsStore, KPMSettingLoggingFilePath,
- iSettings.iLoggingFilePath);
- SaveDFSValueL(settingsStore, KPMSettingLoggingSources,
- iSettings.iLoggingSources);
-
- SaveDFSValueL(settingsStore, KPMSettingPowerMonitoringEnabled,
- iSettings.iPowerMonitoringEnabled);
-
- settingsStore->CommitL();
- CleanupStack::PopAndDestroy(); // settingsStore
- }
- }
-
-// ---------------------------------------------------------------------------
-
-void CPerfMonEngine::LoadDFSValueL(CDictionaryFileStore* aDicFS,
- const TUid& aUid, TInt& aValue)
- {
- if (aDicFS->IsPresentL(aUid))
- {
- RDictionaryReadStream in;
- in.OpenLC(*aDicFS, aUid);
- aValue = in.ReadInt16L();
- CleanupStack::PopAndDestroy(); // in
- }
- }
-
-// ---------------------------------------------------------------------------
-
-void CPerfMonEngine::LoadDFSValueL(CDictionaryFileStore* aDicFS,
- const TUid& aUid, TDes& aValue)
- {
- if (aDicFS->IsPresentL(aUid))
- {
- RDictionaryReadStream in;
- in.OpenLC(*aDicFS, aUid);
- TInt bufLength = in.ReadInt16L(); // get length of descriptor
- in.ReadL(aValue, bufLength); // get the descriptor itself
- CleanupStack::PopAndDestroy(); // in
- }
- }
-
-// ---------------------------------------------------------------------------
-
-void CPerfMonEngine::LoadDFSValueL(CDictionaryFileStore* aDicFS,
- const TUid& aUid, TPerfMonSources& aValue)
- {
- if (aDicFS->IsPresentL(aUid))
- {
- RDictionaryReadStream in;
- in.OpenLC(*aDicFS, aUid);
- TInt bufLength = in.ReadInt16L(); // get length of the array
-
- if (bufLength < 0 || bufLength > ESourcesLength) // check for validaty
- User::Leave(KErrNotSupported);
-
- for (TInt i = 0; i < bufLength; i++) // get all items
- aValue.iSrcEnabled[i] = in.ReadInt16L();
-
- CleanupStack::PopAndDestroy(); // in
- }
- }
-
-// ---------------------------------------------------------------------------
-
-void CPerfMonEngine::SaveDFSValueL(CDictionaryFileStore* aDicFS,
- const TUid& aUid, const TInt& aValue)
- {
- RDictionaryWriteStream out;
- out.AssignLC(*aDicFS, aUid);
- out.WriteInt16L(aValue);
- out.CommitL();
- CleanupStack::PopAndDestroy(); // out
- }
-
-// ---------------------------------------------------------------------------
-
-void CPerfMonEngine::SaveDFSValueL(CDictionaryFileStore* aDicFS,
- const TUid& aUid, const TDes& aValue)
- {
- RDictionaryWriteStream out;
- out.AssignLC(*aDicFS, aUid);
- out.WriteInt16L(aValue.Length()); // write length of the descriptor
- out.WriteL(aValue, aValue.Length()); // write the descriptor itself
- out.CommitL();
- CleanupStack::PopAndDestroy(); // out
- }
-
-// ---------------------------------------------------------------------------
-
-void CPerfMonEngine::SaveDFSValueL(CDictionaryFileStore* aDicFS,
- const TUid& aUid, const TPerfMonSources& aValue)
- {
- RDictionaryWriteStream out;
- out.AssignLC(*aDicFS, aUid);
-
- out.WriteInt16L(ESourcesLength); // write length of the array
-
- for (TInt i = 0; i < ESourcesLength; i++) // write all items
- out.WriteInt16L(aValue.iSrcEnabled[i]);
-
- out.CommitL();
- CleanupStack::PopAndDestroy(); // out
- }
-
-// ---------------------------------------------------------------------------
-
-void CPerfMonEngine::ActivatePowerMonitoringL()
- {
- if (iPowerClient == 0)
- {
- iPowerClient = CPerfMonPowerListener::NewL();
- }
-
- // disable power monitoring if initialization fails
- TInt err = iPowerClient->Activate();
- if (err != KErrNone )
- {
- DeActivatePowerMonitoring();
-
- iSettings.iPowerMonitoringEnabled = EFalse;
- }
- }
-
-// ---------------------------------------------------------------------------
-
-void CPerfMonEngine::DeActivatePowerMonitoring()
- {
- if (iPowerClient != 0)
- {
- iPowerClient->DeActivate();
- }
- }
-
-// ---------------------------------------------------------------------------
-
-TInt CPerfMonEngine::SampleEntryPosToSettingPos(TInt aSampleEntryPos)
- {
- TInt settingPos(0); // return position of aSampleEntryPos in settings
-
- if (aSampleEntryPos >= iCPU0PositionInSamples && aSampleEntryPos < iRAMPositionInSamples)
- {
- settingPos = ESourceCPU;
- }
- else if (aSampleEntryPos == iRAMPositionInSamples)
- {
- settingPos = ESourceRAM;
- }
- else
- {
- settingPos = ESourceC + (aSampleEntryPos-iCDrivePositionInSamples);
- }
-
- return settingPos;
- }
-
-// End of File
--- a/perfmon/engine/src/perfmon_powerlistener.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,262 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-// INCLUDE FILES
-#include "perfmon_powerlistener.h"
-#include "../../symbian_version.hrh"
-
-#include <centralrepository.h>
-#include <hwrm/hwrmpowerdomaincrkeys.h>
-
-
-#if (SYMBIAN_VERSION_SUPPORT == SYMBIAN_3)
-
- CPerfMonPowerListener* CPerfMonPowerListener::NewL()
- {
- CPerfMonPowerListener* self = new (ELeave) CPerfMonPowerListener();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
- // --------------------------------------------------------------------------------------------
-
- CPerfMonPowerListener::CPerfMonPowerListener() :
- iHWRMPower(0),
- iLastPowerAvg(0),
- iMaxPower(0),
- iOriginalMaxReportingPeriod(0)
- {
- }
-
- // --------------------------------------------------------------------------------------------
-
- void CPerfMonPowerListener::ConstructL()
- {
- }
-
- // --------------------------------------------------------------------------------------------
-
- CPerfMonPowerListener::~CPerfMonPowerListener()
- {
- DeActivate();
-
- if (iHWRMPower != 0)
- {
- delete iHWRMPower;
- iHWRMPower = 0;
- }
- }
-
- // --------------------------------------------------------------------------------------------
-
- TBool CPerfMonPowerListener::IsSupported()
- {
- return ETrue;
- }
-
- // --------------------------------------------------------------------------------------------
-
- TInt CPerfMonPowerListener::Activate()
- {
- if (iHWRMPower == 0)
- {
- TRAPD(err, iHWRMPower = CHWRMPower::NewL());
- if (err != KErrNone)
- {
- return err;
- }
-
- // Callbacks to this object
- err = iHWRMPower->SetPowerReportObserver(this);
- if (err != KErrNone)
- {
- return err;
- }
-
- TRAP_IGNORE(GetReportingPeriodL());
- }
-
- // Set infinite reporting period
- TRAPD(err, SetReportingPeriodL(KReportingDuration));
- if (err != KErrNone)
- {
- return err;
- }
-
- TRequestStatus status(KRequestPending);
-
- // Start the power consumption notification
- iHWRMPower->StartAveragePowerReporting(status, KSampleIntervalMultiple);
- User::WaitForRequest(status);
-
- // Check if monitoring was succesfully started or already ongoing.
- if ((status.Int() != KErrNone) && (status.Int() != KErrAlreadyExists))
- {
- return status.Int();
- }
-
- return KErrNone;
- }
-
- // ---------------------------------------------------------------------------
-
- void CPerfMonPowerListener::DeActivate()
- {
- if (iHWRMPower != 0)
- {
- TRAP_IGNORE(iHWRMPower->StopAveragePowerReportingL());
- }
-
- // Restore original value to max sampling duration
- TRAP_IGNORE(SetReportingPeriodL(iOriginalMaxReportingPeriod));
-
- iPowerBuffer.Reset();
- iLastPowerAvg = 0;
- }
-
- // ---------------------------------------------------------------------------
-
- TInt CPerfMonPowerListener::GetPower()
- {
- TInt avgPower = 0;
- TInt newValueCount = iPowerBuffer.Count();
-
- if (newValueCount > 0)
- {
- // Read all new values from buffer and calculate average from them.
- for (int i = 0; i < newValueCount; i++)
- {
- avgPower += iPowerBuffer[i];
- }
- avgPower = avgPower / newValueCount;
-
- iPowerBuffer.Reset();
- iLastPowerAvg = avgPower;
- }
- else
- {
- avgPower = iLastPowerAvg;
- }
-
- return avgPower;
- }
-
- // ---------------------------------------------------------------------------
-
- void CPerfMonPowerListener::PowerMeasurement(TInt aErrCode, CHWRMPower::TBatteryPowerMeasurementData& aMeasurement)
- {
- if (aErrCode == KErrNone)
- {
- // Store new value to buffer to wait for reading
- TInt value = aMeasurement.iAverageVoltage * aMeasurement.iAverageCurrent;
-
- // If charger is connected, reported values may be negative.
- if (value < 0)
- {
- value = 0;
- }
-
- iPowerBuffer.Append(value);
-
- if ( value > iMaxPower )
- {
- iMaxPower = value;
- }
- }
- // Ignore any errors
- }
-
- void CPerfMonPowerListener::GetReportingPeriodL()
- {
- CRepository* cenRep = CRepository::NewL(KCRUidPowerSettings);
-
- CleanupStack::PushL(cenRep);
- User::LeaveIfError(cenRep->Get(KPowerMaxReportingPeriod, iOriginalMaxReportingPeriod));
- CleanupStack::Pop();
-
- delete cenRep;
- }
-
- void CPerfMonPowerListener::SetReportingPeriodL(TInt aDuration)
- {
- CRepository* cenRep = CRepository::NewL(KCRUidPowerSettings);
-
- CleanupStack::PushL(cenRep);
- User::LeaveIfError(cenRep->Set(KPowerMaxReportingPeriod, aDuration));
- CleanupStack::Pop();
-
- delete cenRep;
- }
-
-// SYMBIAN_VERSION_SUPPORT < SYMBIAN_3
-#else
-
- // Stub implementation for older Symbian versions
-
- CPerfMonPowerListener* CPerfMonPowerListener::NewL()
- {
- CPerfMonPowerListener* self = new (ELeave) CPerfMonPowerListener();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
- CPerfMonPowerListener::CPerfMonPowerListener() :
- iHWRMPower(0),
- iLastPowerAvg(0),
- iMaxPower(0)
- {
- }
-
- void CPerfMonPowerListener::ConstructL()
- {
- }
-
- CPerfMonPowerListener::~CPerfMonPowerListener()
- {
- DeActivate();
- }
-
- TBool CPerfMonPowerListener::IsSupported()
- {
- return EFalse;
- }
-
- TInt CPerfMonPowerListener::Activate()
- {
- return KErrNotSupported;
- }
-
- void CPerfMonPowerListener::DeActivate()
- {
- }
-
- TInt CPerfMonPowerListener::GetPower()
- {
- return 0;
- }
-
- void CPerfMonPowerListener::PowerMeasurement(TInt aErrCode, CHWRMPower::TBatteryPowerMeasurementData& aMeasurement)
- {
- }
-
-#endif
-
-// End of File
--- a/perfmon/group/ReleaseNotes_PerfMon.txt Wed Sep 15 12:13:45 2010 +0300
+++ b/perfmon/group/ReleaseNotes_PerfMon.txt Wed Oct 13 14:32:52 2010 +0300
@@ -1,9 +1,9 @@
===============================================================================
-RELEASE NOTES - PERFORMANCE MONITOR v1.2.0
-RELEASED 26th August 2010
+RELEASE NOTES - PERFORMANCE MONITOR v1.0.0
+RELEASED 6th March 2008
-SUPPORTS S60 5.2+
+SUPPORTS S60 3.0+
===============================================================================
@@ -26,11 +26,9 @@
===============================================================================
-What's New in v1.2.0
+What's New in v1.0.0
====================
-- SMP support
-- Added power usage statistics
-- Error corrections
+- Initial version
===============================================================================
@@ -74,11 +72,6 @@
Version History:
================
-Version 1.1.1 - 26th August 2010
-====================
-- Improved Orbit UI
-- Error corrections
-
Version 1.0.0 - 6th March 2008
------------------------------
- Initial version
--- a/perfmon/group/bld.inf Wed Sep 15 12:13:45 2010 +0300
+++ b/perfmon/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -15,16 +15,38 @@
*
*/
+
#include <platform_paths.hrh>
-prj_platforms
+PRJ_EXPORTS
+../group/backup_registration.xml Z:/private/20011385/backup_registration.xml
+../rom/perfmon.iby CORE_IBY_EXPORT_PATH(tools,perfmon.iby)
+
-WINSCW GCCE ARMV5 ARMV6
+PRJ_MMPFILES
+#if defined(__SERIES60_30__) || defined(__SERIES60_31__) || defined(__S60_32__)
+ gnumakefile perfmon_icons_aif.mk
-#include "bld_generic.inf"
+ #ifdef MARM
+ gnumakefile perfmon_stub_sis.mk
+ #endif
+#endif
+
+perfmon.mmp
-#include "../ui/avkon/group/bld.inf"
-prj_mmpfiles
+#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__)
+ PRJ_EXTENSIONS
+ START EXTENSION s60/mifconv
+ OPTION TARGETFILE perfmon_aif.mif
+ OPTION SOURCEDIR ../icons
+ OPTION SOURCES -c8,8 qgn_menu_perfmon
+ END
-prj_extensions
\ No newline at end of file
+ #ifdef MARM
+ START EXTENSION app-services/buildstubsis
+ OPTION SRCDIR ../sis
+ OPTION SISNAME PerfMon_stub
+ END
+ #endif
+#endif
--- a/perfmon/group/bld_generic.inf Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_EXPORTS
-../group/backup_registration.xml Z:/private/20011385/backup_registration.xml
-../rom/perfmon.iby CORE_IBY_EXPORT_PATH(tools,perfmon.iby)
-
-PRJ_MMPFILES
-#if defined(__SERIES60_30__) || defined(__SERIES60_31__) || defined(__S60_32__)
- gnumakefile perfmon_icons_aif.mk
-
- #ifdef MARM
- gnumakefile perfmon_stub_sis.mk
- #endif
-#endif
-
-#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__)
- PRJ_EXTENSIONS
- START EXTENSION s60/mifconv
- OPTION TARGETFILE perfmon_aif.mif
- OPTION SOURCEDIR ../icons
- OPTION SOURCES -c8,8 qgn_menu_perfmon
- END
-
- #ifdef MARM
- START EXTENSION app-services/buildstubsis
- OPTION SRCDIR ../sis
- OPTION SISNAME PerfMon_stub
- END
- #endif
-#endif
--- a/perfmon/group/group.pro Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-TEMPLATE = subdirs
-
-BLD_INF_RULES.prj_platforms += "$${LITERAL_HASH}include \"bld_generic.inf\""
-#TODO: Functionality broken
-#BLD_INF_RULES.prj_exports += "../rom/perfmon_datapopup.iby CORE_IBY_EXPORT_PATH(tools,perfmon_datapopup.iby)"
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/group/perfmon.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+
+TARGET PerfMon.exe
+TARGETTYPE exe
+EPOCSTACKSIZE 0x5000
+EPOCHEAPSIZE 0x10000 0x1000000 // Min 64Kb, Max 16Mb
+
+UID 0x100039CE 0x20011385
+
+VENDORID VID_DEFAULT
+CAPABILITY WriteDeviceData
+
+SMPSAFE
+
+LANG SC
+
+
+START RESOURCE ../data/perfmon.rss
+HEADER
+TARGETPATH APP_RESOURCE_DIR
+END
+
+START RESOURCE ../data/perfmon_reg.rss
+DEPENDS perfmon.rsg
+TARGETPATH /private/10003a3f/apps
+END
+
+APP_LAYER_SYSTEMINCLUDE
+USERINCLUDE ../inc
+SOURCEPATH ../src
+
+
+SOURCE perfmon_app.cpp
+SOURCE perfmon_document.cpp
+SOURCE perfmon_appui.cpp
+SOURCE perfmon_model.cpp
+SOURCE perfmon_valuesview.cpp
+SOURCE perfmon_valuescontainer.cpp
+SOURCE perfmon_graphsview.cpp
+SOURCE perfmon_graphscontainer.cpp
+SOURCE perfmon_settingsviewdlg.cpp
+SOURCE perfmon_datapopupcontainer.cpp
+
+LIBRARY euser.lib
+LIBRARY commonengine.lib
+LIBRARY apparc.lib
+LIBRARY cone.lib
+LIBRARY eikcore.lib
+LIBRARY eikcoctl.lib
+LIBRARY eikdlg.lib
+LIBRARY avkon.lib
+LIBRARY ws32.lib
+LIBRARY apgrfx.lib
+LIBRARY efsrv.lib
+LIBRARY bafl.lib
+LIBRARY gdi.lib
+LIBRARY estor.lib
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/inc/perfmon.hrh Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef PERFMON_HRH
+#define PERFMON_HRH
+
+enum TPerfMonCommandIds
+ {
+ EPerfMonCmdEnableLogging = 1,
+ EPerfMonCmdDisableLogging,
+ EPerfMonCmdSettings,
+ EPerfMonCmdAbout,
+
+ EPerfMonCmdSettingsChange,
+ EPerfMonCmdSettingsExit,
+ EPerfMonCmdSettingsBack,
+
+ EPerfMonSettingItemList = 1000
+ };
+
+enum TPerfMonMainViewTabs
+ {
+ ETabMainViewValues = 1,
+ ETabMainViewGraphs
+ };
+
+enum TPerfMonSettingListTabs
+ {
+ ETabSettingsGeneral = 0,
+ ETabSettingsDataPopup,
+ ETabSettingsGraphs,
+ ETabSettingsLogging
+ };
+
+enum TPerfMonSettingListIds
+ {
+ ESettingListItemHeartBeat = 0,
+ ESettingListItemMaxSamples,
+ ESettingListItemPriority,
+ ESettingListItemCPUMode,
+ ESettingListItemKeepBackLightOn,
+
+ ESettingListItemDataPopupVisbility,
+ ESettingListItemDataPopupLocation,
+ ESettingListItemDataPopupSources,
+
+ ESettingListItemGraphsVerticalBarPeriod,
+ ESettingListItemGraphsSources,
+
+ ESettingListItemLoggingMode,
+ ESettingListItemLoggingFilePath,
+ ESettingListItemLoggingSources
+ };
+
+enum TPerfMonSettingThreadPriorityTypes
+ {
+ EThreadPriorityTypeMuchLess = 0,
+ EThreadPriorityTypeLess,
+ EThreadPriorityTypeNormal,
+ EThreadPriorityTypeMore,
+ EThreadPriorityTypeMuchMore,
+ EThreadPriorityTypeRealTime,
+ EThreadPriorityTypeAbsoluteVeryLow,
+ EThreadPriorityTypeAbsoluteLow,
+ EThreadPriorityTypeAbsoluteBackground,
+ EThreadPriorityTypeAbsoluteForeground,
+ EThreadPriorityTypeAbsoluteHigh
+ };
+
+enum TPerfMonSettingCPUModes
+ {
+ ECPUModeNotSet = -1,
+ ECPUModeCPUTime,
+ ECPUModeNOPs
+ };
+
+enum TPerfMonSettingDataPopupVisbilities
+ {
+ EDataPopupVisbilityAlwaysOn = 0,
+ EDataPopupVisbilityBackgroundOnly,
+ EDataPopupVisbilityAlwaysAlwaysOff
+ };
+
+enum TPerfMonSettingDataPopupLocations
+ {
+ EDataPopupLocationTopRight = 0,
+ EDataPopupLocationBottomMiddle
+ };
+
+enum TPerfMonSettingSources
+ {
+ ESourceCPU = 0,
+ ESourceRAM,
+ ESourceC,
+ ESourceD,
+ ESourceE,
+ ESourceF,
+ ESourceG,
+ ESourceH,
+ ESourceI,
+ ESourcesLength // this should be always the last!
+ };
+
+enum TPerfMonSettingLoggingMode
+ {
+ ELoggingModeRDebug = 0,
+ ELoggingModeLogFile,
+ ELoggingModeRDebugLogFile
+ };
+
+#endif // PERFMON_HRH
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/inc/perfmon_app.h Wed Oct 13 14:32:52 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:
+*
+*/
+
+
+#ifndef PERFMON_APP_H
+#define PERFMON_APP_H
+
+
+// INCLUDES
+#include <aknapp.h>
+
+// CONSTANTS
+// UID of the application
+const TUid KUidPerfMon = { 0x20011385 };
+
+// CLASS DECLARATION
+
+/**
+* CPerfMonApp application class.
+* Provides factory to create concrete document object.
+*
+*/
+class CPerfMonApp : public CAknApplication
+ {
+
+ public: // Functions from base classes
+ /**
+ * From CApaApplication, overridden to enable INI file support.
+ * @return A pointer to the dictionary store
+ */
+ CDictionaryStore* OpenIniFileLC(RFs& aFs) const;
+ private:
+
+ /**
+ * From CApaApplication, creates CPerfMonDocument document object.
+ * @return A pointer to the created document object.
+ */
+ CApaDocument* CreateDocumentL();
+
+ /**
+ * From CApaApplication, returns application's UID (KUidPerfMon).
+ * @return The value of KUidPerfMon.
+ */
+ TUid AppDllUid() const;
+ };
+
+#endif
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/inc/perfmon_appui.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 PERFMON_APPUI_H
+#define PERFMON_APPUI_H
+
+// INCLUDES
+#include <eikapp.h>
+#include <eikdoc.h>
+#include <e32std.h>
+#include <coeccntx.h>
+#include <aknViewAppUi.h>
+#include <akntabgrp.h>
+#include <aknnavide.h>
+#include "perfmon_std.h"
+
+// FORWARD DECLARATIONS
+class CPerfMonModel;
+class CAknNavigationControlContainer;
+class CAknTabGroup;
+class CAknNavigationDecorator;
+
+
+// CLASS DECLARATIONS
+
+class CPerfMonAppUi : public CAknViewAppUi
+ {
+ public: // // Constructors and destructor
+
+ void ConstructL();
+
+ ~CPerfMonAppUi();
+
+ public: // New functions
+
+ private:
+ // From MEikMenuObserver
+ void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+ private:
+ void HandleForegroundEventL(TBool aForeground);
+
+ void HandleCommandL(TInt aCommand);
+
+ void HandleResourceChangeL(TInt aType);
+
+ virtual TKeyResponse HandleKeyEventL(
+ const TKeyEvent& aKeyEvent,TEventCode aType);
+
+ private: //Data
+ CPerfMonModel* iModel;
+ CAknNavigationControlContainer* iNaviPane;
+ CAknTabGroup* iTabGroup;
+ CAknNavigationDecorator* iDecoratedTabGroup;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/inc/perfmon_datapopupcontainer.h Wed Oct 13 14:32:52 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:
+*
+*/
+
+
+#ifndef PERFMON_DATAPOPUPCONTAINER_H
+#define PERFMON_DATAPOPUPCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+
+#include "perfmon_drawcallback.h"
+
+
+// FORWARD DECLARATIONS
+class CPerfMonModel;
+
+
+// CLASS DECLARATIONS
+
+class CPerfMonDataPopupContainer : public CCoeControl, public MDrawUpdateCallback
+ {
+public:
+ void ConstructL(const TRect& aRect);
+ ~CPerfMonDataPopupContainer();
+
+protected:
+ void Draw(const TRect& aRect) const;
+ virtual void SizeChanged();
+
+public:
+ void SetPositionAndSize();
+ void UpdateVisibility(TBool aForeground=ETrue);
+
+public: // from MDrawUpdateCallback
+ void DrawUpdate();
+
+private:
+ CPerfMonModel* iModel;
+ RWindowGroup iWindowGroup;
+ const CFont* iFont;
+ TInt iFontSize;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/inc/perfmon_document.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef PERFMON_DOCUMENT_H
+#define PERFMON_DOCUMENT_H
+
+// INCLUDES
+#include <AknDoc.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CEikAppUi;
+class CPerfMonModel;
+
+
+// CLASS DECLARATION
+
+/**
+* CPerfMonDocument application class.
+*/
+class CPerfMonDocument : public CAknDocument
+ {
+ public: // Constructors and destructor
+ static CPerfMonDocument* NewL(CEikApplication& aApp);
+ virtual ~CPerfMonDocument();
+
+ public: // New functions
+
+ public: // from CEikDocument
+ CFileStore* OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs);
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private:
+
+ /**
+ * EPOC default constructor.
+ */
+ CPerfMonDocument(CEikApplication& aApp);
+ void ConstructL();
+
+ private:
+
+ /**
+ * From CEikDocument, create CPerfMonAppUi "App UI" object.
+ */
+ CEikAppUi* CreateAppUiL();
+
+ public:
+ inline CPerfMonModel* Model() { return iModel; }
+
+ private:
+ CPerfMonModel* iModel;
+
+ };
+
+#endif
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/inc/perfmon_drawcallback.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef PERFMON_DRAWCALLBACK_H
+#define PERFMON_DRAWCALLBACK_H
+
+class MDrawUpdateCallback
+ {
+public:
+ virtual void DrawUpdate() = 0;
+ };
+
+#endif
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/inc/perfmon_graphscontainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef PERFMON_GRAPHSCONTAINER_H
+#define PERFMON_GRAPHSCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+
+#include "perfmon_drawcallback.h"
+
+
+// FORWARD DECLARATIONS
+class CPerfMonModel;
+
+
+// CLASS DECLARATIONS
+
+class CPerfMonGraphsContainer : public CCoeControl, public MDrawUpdateCallback
+ {
+public:
+ void ConstructL(const TRect& aRect);
+ ~CPerfMonGraphsContainer();
+
+private:
+ void Draw(const TRect& aRect) const;
+ void HandleResourceChange(TInt aType);
+
+public:
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/);
+
+public: // from MDrawUpdateCallback
+ void DrawUpdate();
+
+private:
+ CPerfMonModel* iModel;
+ const CFont* iFont;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/inc/perfmon_graphsview.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef PERFMON_GRAPHSVIEW_H
+#define PERFMON_GRAPHSVIEW_H
+
+// INCLUDES
+#include <aknview.h>
+
+#include "perfmon_std.h"
+
+
+
+// CONSTANTS
+// UID of view
+const TUid KGraphsViewUID = {2};
+
+
+// FORWARD DECLARATIONS
+class CPerfMonGraphsContainer;
+class CPerfMonModel;
+
+
+// CLASS DECLARATION
+
+/**
+* CPerfMonGraphsView view class.
+*
+*/
+class CPerfMonGraphsView : public CAknView
+ {
+ public: // Constructors and destructor
+ void ConstructL();
+ ~CPerfMonGraphsView();
+
+ public: // Functions from base classes
+ TUid Id() const;
+ void HandleCommandL(TInt aCommand);
+ void HandleClientRectChange();
+
+ private: // From MEikMenuObserver
+ void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
+
+ private: // From AknView
+ void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage);
+ void DoDeactivate();
+
+ private: // Data
+ CPerfMonGraphsContainer* iContainer;
+ CPerfMonModel* iModel;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/inc/perfmon_model.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 PERFMON_MODEL_H
+#define PERFMON_MODEL_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <apgcli.h>
+#include <gdi.h>
+
+#include "perfmon.hrh"
+
+
+// setting keys (do not change uids of existing keys to maintain compatibility to older versions!)
+const TUid KPMSettingHeartBeat = { 0x00 };
+const TUid KPMSettingMaxSamples = { 0x01 };
+const TUid KPMSettingPriority = { 0x02 };
+const TUid KPMSettingCPUMode = { 0x03 };
+const TUid KPMSettingKeepBackLightOn = { 0x04 };
+
+const TUid KPMSettingDataPopupVisbility = { 0x05 };
+const TUid KPMSettingDataPopupLocation = { 0x06 };
+const TUid KPMSettingDataPopupSources = { 0x07 };
+
+const TUid KPMSettingGraphsVerticalBarPeriod = { 0x08 };
+const TUid KPMSettingGraphsSources = { 0x09 };
+
+const TUid KPMSettingLoggingMode = { 0x0A };
+const TUid KPMSettingLoggingFilePath = { 0x0B };
+const TUid KPMSettingLoggingSources = { 0x0C };
+
+
+
+// FORWARD DECLARATIONS
+class CPerfMonValuesContainer;
+class CPerfMonGraphsContainer;
+class CPerfMonDataPopupContainer;
+class CEikonEnv;
+class CCoeControl;
+class CDictionaryFileStore;
+
+
+// CLASS DECLARATIONS
+
+
+class TPerfMonSources
+ {
+public:
+ TBool iSrcEnabled[ESourcesLength];
+
+public:
+ inline void SetDefaults1()
+ {
+ iSrcEnabled[ESourceCPU] = ETrue;
+ iSrcEnabled[ESourceRAM] = ETrue;
+ iSrcEnabled[ESourceC] = ETrue;
+ iSrcEnabled[ESourceD] = EFalse;
+ iSrcEnabled[ESourceE] = EFalse;
+ iSrcEnabled[ESourceF] = EFalse;
+ iSrcEnabled[ESourceG] = EFalse;
+ iSrcEnabled[ESourceH] = EFalse;
+ iSrcEnabled[ESourceI] = EFalse;
+ }
+ inline void SetDefaults2()
+ {
+ iSrcEnabled[ESourceCPU] = ETrue;
+ iSrcEnabled[ESourceRAM] = ETrue;
+ iSrcEnabled[ESourceC] = EFalse;
+ iSrcEnabled[ESourceD] = EFalse;
+ iSrcEnabled[ESourceE] = EFalse;
+ iSrcEnabled[ESourceF] = EFalse;
+ iSrcEnabled[ESourceG] = EFalse;
+ iSrcEnabled[ESourceH] = EFalse;
+ iSrcEnabled[ESourceI] = EFalse;
+ }
+ TInt EnabledSourcesCount()
+ {
+ TInt srcCount(0);
+
+ for (TInt i=0; i<ESourcesLength; i++)
+ {
+ if (iSrcEnabled[i])
+ srcCount++;
+ }
+
+ return srcCount;
+ }
+ };
+
+
+class TPerfMonSettings
+ {
+public:
+ TInt iHeartBeat;
+ TInt iMaxSamples;
+ TInt iPriority;
+ TInt iCPUMode;
+ TBool iKeepBacklightOn;
+
+ TInt iDataPopupVisibility;
+ TInt iDataPopupLocation;
+ TPerfMonSources iDataPopupSources;
+
+ TInt iGraphsVerticalBarPeriod;
+ TPerfMonSources iGraphsSources;
+
+ TInt iLoggingMode;
+ TFileName iLoggingFilePath;
+ TPerfMonSources iLoggingSources;
+
+ TBool iLoggingEnabled;
+ };
+
+
+class TSampleData
+ {
+public:
+ TInt64 iFree;
+ TInt64 iSize;
+ TTimeIntervalMicroSeconds iTimeFromStart;
+ };
+
+typedef CArrayFixSeg<TSampleData> CSampleDataArray;
+
+
+class TSampleEntry
+ {
+public:
+ TBuf<16> iDescription;
+ TBuf<16> iUnitTypeShort; //eg. b
+ TBuf<16> iUnitTypeLong; //eg. bytes
+ TInt iDriveNumber; //used only for disk drives
+ TRgb iGraphColor;
+ CSampleDataArray* iSampleDataArray;
+ };
+
+typedef CArrayFixSeg<TSampleEntry> CSampleEntryArray;
+
+
+
+class CPerfMonModel : public CActive
+ {
+private:
+ enum TContainerDrawState
+ {
+ EDrawStateInvalid = -1,
+ EDrawStateValues,
+ EDrawStateGraphs
+ };
+
+public:
+ static CPerfMonModel* NewL();
+ ~CPerfMonModel();
+ void ActivateModelL();
+ void DeActivateModelL();
+ void EnableLogging(TBool aEnable);
+
+private:
+ void RunL();
+ void DoCancel();
+
+private:
+ CPerfMonModel();
+ void ConstructL();
+ void LoadSettingsL();
+ void SaveSettingsL();
+ void HandleSettingsChangeL();
+ void OpenLogFile(TBool aOpen);
+ void SendDrawEventToContainersL();
+ void CreateSamplesDataArrayL();
+ void UpdateSamplesDataL();
+ void AppendLatestSamplesToLogsL();
+ void ActivateCPUMonitoringL();
+ TBool OpenHandleToNullThread();
+ void DeActivateCPUMonitoring();
+ TBool CPUTimeSupported();
+ TThreadPriority SettingItemToThreadPriority(TInt aIndex);
+ void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TInt& aValue);
+ void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TDes& aValue);
+ void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TPerfMonSources& aValue);
+ void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TInt& aValue);
+ void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TDes& aValue);
+ void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TPerfMonSources& aValue);
+
+public:
+ void SetValuesContainer(CPerfMonValuesContainer* aValuesContainer);
+ void SetGraphsContainer(CPerfMonGraphsContainer* aGraphsContainer);
+ TInt LaunchSettingsDialogL();
+
+ inline TPerfMonSettings& Settings() { return iSettings; }
+ inline CEikonEnv* EikonEnv() { return iEnv; }
+ inline RApaLsSession& LsSession() { return iLs; }
+
+ inline CPerfMonValuesContainer* ValuesContainer() { return iValuesContainer; }
+ inline CPerfMonGraphsContainer* GraphsContainer() { return iGraphsContainer; }
+ inline CPerfMonDataPopupContainer* DataPopupContainer() { return iDataPopupContainer; }
+
+
+ inline CSampleEntryArray* SampleEntryArray() { return iSampleEntryArray; }
+
+private:
+ RTimer iTimer;
+ CPerfMonValuesContainer* iValuesContainer;
+ CPerfMonGraphsContainer* iGraphsContainer;
+ CPerfMonDataPopupContainer* iDataPopupContainer;
+ CEikonEnv* iEnv;
+ TPerfMonSettings iSettings;
+ RApaLsSession iLs;
+ TInt iDrawState;
+ CSampleEntryArray* iSampleEntryArray;
+ TTime iStartTime;
+
+ TInt iCurrentCPUMode;
+
+ RThread iNullThread;
+ RThread iCPULoadThread;
+ TBool iCPULoadCalibrating;
+ TInt iCPULoadCalibrationCounter;
+ TInt64 iCPULoadMaxValue;
+ TInt64 iCPULoadPreviousValue;
+ TInt64 iCPULoadCounter;
+ TTime iPreviousTime;
+
+ TBool iLogFileInitialized;
+ RFile iLogFile;
+ };
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/inc/perfmon_settingsviewdlg.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef PERFMON_SETTINGSVIEWDLG_H
+#define PERFMON_SETTINGSVIEWDLG_H
+
+// INCLUDES
+#include <AknDialog.h>
+#include <eiklbo.h>
+#include <AknTabObserver.h>
+#include <akntabgrp.h>
+#include <aknsettingitemlist.h>
+#include <akncheckboxsettingpage.h>
+
+#include "perfmon_model.h"
+
+
+// FORWARD DECLARATIONS
+class CAknSettingItemArray;
+class CAknSettingStyleListBox;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class CAknTabGroup;
+class TPerfMonSettings;
+class CSelectionItemList;
+
+
+// CLASS DEFINITIONS
+
+class CPerfMonSettingsViewDlg : public CAknDialog, public MEikListBoxObserver, public MAknTabObserver
+ {
+public:
+ static CPerfMonSettingsViewDlg* NewL(TPerfMonSettings& aSettings);
+ virtual ~CPerfMonSettingsViewDlg();
+
+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
+ CPerfMonSettingsViewDlg(TPerfMonSettings& aSettings);
+ void ConstructL();
+
+private: // Data
+ CAknSettingItemArray* iSettingItemArray;
+ CAknSettingStyleListBox* iListBox;
+ CAknNavigationControlContainer* iNaviContainer;
+ CAknNavigationDecorator* iDecoratedTabGroup;
+ CAknTabGroup* iTabGroup;
+ TPerfMonSettings& iSettings;
+ };
+
+
+class CSourceSelectionCheckBoxSettingItem : public CAknSettingItem
+ {
+public:
+ CSourceSelectionCheckBoxSettingItem( TInt aIdentifier, TPerfMonSources& aMemoryInUse );
+ virtual ~CSourceSelectionCheckBoxSettingItem();
+
+protected:
+ void CompleteConstructionL();
+ void StoreL();
+ void LoadL();
+ const TDesC& SettingTextL();
+ void EditItemL( TBool aCalledFromMenu );
+ void HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType );
+
+private:
+ void AddNewItemToArrayL(const TDesC& aLabel);
+
+private:
+ CSelectionItemList* iItemArray;
+ HBufC* iSettingText;
+ TPerfMonSources& iExternalSources;
+ };
+
+
+class CSourceSelectionCheckBoxSettingPage : public CAknCheckBoxSettingPage
+ {
+ public:
+ CSourceSelectionCheckBoxSettingPage( TInt aResourceID, CSelectionItemList* aItemArray );
+ public: // New functions
+ void UpdateCba();
+ };
+
+
+#endif
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/inc/perfmon_std.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef PERFMON_STD_H
+#define PERFMON_STD_H
+
+
+
+#endif
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/inc/perfmon_valuescontainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef PERFMON_VALUESCONTAINER_H
+#define PERFMON_VALUESCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+
+#include "perfmon_drawcallback.h"
+
+
+// FORWARD DECLARATIONS
+class CPerfMonModel;
+
+
+// CLASS DECLARATIONS
+
+class CPerfMonValuesContainer : public CCoeControl, public MDrawUpdateCallback
+ {
+public:
+ void ConstructL(const TRect& aRect);
+ ~CPerfMonValuesContainer();
+
+private:
+ void Draw(const TRect& aRect) const;
+ void HandleResourceChange(TInt aType);
+
+public:
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/);
+
+public: // from MDrawUpdateCallback
+ void DrawUpdate();
+
+private:
+ CPerfMonModel* iModel;
+ const CFont* iFont;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/inc/perfmon_valuesview.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef PERFMON_VALUESVIEW_H
+#define PERFMON_VALUESVIEW_H
+
+// INCLUDES
+#include <aknview.h>
+
+#include "perfmon_std.h"
+
+
+
+// CONSTANTS
+// UID of view
+const TUid KValuesViewUID = {1};
+
+
+// FORWARD DECLARATIONS
+class CPerfMonValuesContainer;
+class CPerfMonModel;
+
+
+// CLASS DECLARATION
+
+/**
+* CPerfMonValuesView view class.
+*
+*/
+class CPerfMonValuesView : public CAknView
+ {
+ public: // Constructors and destructor
+ void ConstructL();
+ ~CPerfMonValuesView();
+
+ public: // Functions from base classes
+ TUid Id() const;
+ void HandleCommandL(TInt aCommand);
+ void HandleClientRectChange();
+
+ private: // From MEikMenuObserver
+ void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
+
+ private: // From AknView
+ void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage);
+ void DoDeactivate();
+
+ private: // Data
+ CPerfMonValuesContainer* iContainer;
+ CPerfMonModel* iModel;
+ };
+
+#endif
+
+// End of File
--- a/perfmon/perfmon.pro Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-TEMPLATE = subdirs
-
-DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT QT_NO_DEBUG
-
-SUBDIRS = group \
- #TODO: Functionality broken
- #ui/hb/datapopup \
- ui/hb/app
--- a/perfmon/rom/perfmon.iby Wed Sep 15 12:13:45 2010 +0300
+++ b/perfmon/rom/perfmon.iby Wed Oct 13 14:32:52 2010 +0300
@@ -22,8 +22,11 @@
S60_APP_EXE(PerfMon)
S60_APP_AIF_ICONS(PerfMon)
S60_APP_RESOURCE(PerfMon)
-SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,PerfMon)
-data=ZPRIVATE\10003a3f\import\APPS\PerfMon_reg.RSC Private\10003a3f\import\Apps\PerfMon_reg.rsc
+#ifdef S60_UPGRADABLE_APP_REG_RSC
+ S60_UPGRADABLE_APP_REG_RSC(PerfMon)
+#else
+ S60_APP_AIF_RSC(PerfMon)
+#endif
data=ZPRIVATE\20011385\backup_registration.xml private\20011385\backup_registration.xml
data=ZSYSTEM\Install\PerfMon_stub.sis \system\install\PerfMon_stub.sis
--- a/perfmon/rom/perfmon_datapopup.iby Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef __PERFMON_DATAPOPUP_IBY__
-#define __PERFMON_DATAPOPUP_IBY__
-
-file=ABI_DIR\BUILD_DIR\PerfMonDataPopupPlugin.dll SHARED_LIB_DIR\PerfMonDataPopupPlugin.dll
-data=DATAZ_\resource\plugins\devicedialogs\PerfMonDataPopupPlugin.qtplugin resource\plugins\devicedialogs\PerfMonDataPopupPlugin.qtplugin
-
-#endif // __PERFMON_DATAPOPUP_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/src/perfmon_app.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+// INCLUDE FILES
+#include "perfmon_app.h"
+#include "perfmon_document.h"
+
+#include <eikstart.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CPerfMonApp::AppDllUid()
+// Returns application UID
+// ---------------------------------------------------------
+//
+TUid CPerfMonApp::AppDllUid() const
+ {
+ return KUidPerfMon;
+ }
+
+// ---------------------------------------------------------
+// CDictionaryStore* CPerfMonApp::OpenIniFileLC(RFs& aFs) const
+// overrides CAknApplication::OpenIniFileLC to enable INI file support
+// ---------------------------------------------------------
+//
+CDictionaryStore* CPerfMonApp::OpenIniFileLC(RFs& aFs) const
+ {
+ return CEikApplication::OpenIniFileLC(aFs);
+ }
+
+// ---------------------------------------------------------
+// CPerfMonApp::CreateDocumentL()
+// Creates CPerfMonDocument object
+// ---------------------------------------------------------
+//
+CApaDocument* CPerfMonApp::CreateDocumentL()
+ {
+ return CPerfMonDocument::NewL( *this );
+ }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+LOCAL_C CApaApplication* NewApplication()
+ {
+ return new CPerfMonApp;
+ }
+
+
+GLDEF_C TInt E32Main()
+ {
+ return EikStart::RunApplication(NewApplication);
+ }
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/src/perfmon_appui.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "perfmon_appui.h"
+#include "perfmon_valuesview.h"
+#include "perfmon_graphsview.h"
+#include "perfmon_datapopupcontainer.h"
+#include "perfmon.hrh"
+#include "perfmon_model.h"
+#include "perfmon_document.h"
+#include <perfmon.rsg>
+
+#include <avkon.hrh>
+#include <AknQueryDialog.h>
+#include <aknmessagequerydialog.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonAppUi::ConstructL()
+ {
+ // disable window server priority control for this application
+ iEikonEnv->WsSession().ComputeMode( RWsSession::EPriorityControlDisabled );
+
+ // set as system application to prevent getting shut down events
+ iEikonEnv->SetSystem(ETrue);
+
+ BaseConstructL(EAknEnableSkin);
+
+ iModel = static_cast<CPerfMonDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
+
+ // Show tabs for main views from resources
+ CEikStatusPane* sp = StatusPane();
+
+ // Fetch pointer to the default navi pane control
+ iNaviPane = (CAknNavigationControlContainer*)sp->ControlL(
+ TUid::Uid(EEikStatusPaneUidNavi));
+
+ // Tabgroup has been read from resource and it were pushed to the navi pane.
+ // Get pointer to the navigation decorator with the ResourceDecorator() function.
+ // Application owns the decorator and it has responsibility to delete the object.
+ iDecoratedTabGroup = iNaviPane->ResourceDecorator();
+ if (iDecoratedTabGroup)
+ {
+ iTabGroup = (CAknTabGroup*) iDecoratedTabGroup->DecoratedControl();
+ }
+
+ CPerfMonValuesView* valuesView = new(ELeave) CPerfMonValuesView;
+ CleanupStack::PushL(valuesView);
+ valuesView->ConstructL();
+ AddViewL(valuesView); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // valuesView
+
+ CPerfMonGraphsView* graphsView = new(ELeave) CPerfMonGraphsView;
+ CleanupStack::PushL(graphsView);
+ graphsView->ConstructL();
+ AddViewL(graphsView); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // graphsView
+
+ // set the default view
+ SetDefaultViewL(*valuesView);
+
+ // notify the model that everything has been constructed
+ iModel->ActivateModelL();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+CPerfMonAppUi::~CPerfMonAppUi()
+ {
+ // notify the model that the application is closing
+ if (iModel)
+ TRAP_IGNORE(iModel->DeActivateModelL());
+
+ delete iDecoratedTabGroup;
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
+ {
+ if (aResourceId == R_PERFMON_APP_MENU)
+ {
+ aMenuPane->SetItemDimmed(EPerfMonCmdEnableLogging, iModel->Settings().iLoggingEnabled);
+ aMenuPane->SetItemDimmed(EPerfMonCmdDisableLogging, !iModel->Settings().iLoggingEnabled);
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+TKeyResponse CPerfMonAppUi::HandleKeyEventL(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 );
+ ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
+ }
+ break;
+ case EKeyRightArrow:
+ if((active + 1) < count)
+ {
+ active++;
+ iTabGroup->SetActiveTabByIndex( active );
+ ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
+ }
+ break;
+ default:
+ return EKeyWasNotConsumed;
+ }
+
+ return EKeyWasConsumed;
+ }
+
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonAppUi::HandleCommandL(TInt aCommand)
+ {
+ switch ( aCommand )
+ {
+ case EPerfMonCmdEnableLogging:
+ {
+ iModel->EnableLogging(ETrue);
+ break;
+ }
+
+ case EPerfMonCmdDisableLogging:
+ {
+ iModel->EnableLogging(EFalse);
+ break;
+ }
+
+ case EPerfMonCmdSettings:
+ {
+ if (iModel->LaunchSettingsDialogL() == EAknCmdExit)
+ Exit();
+ break;
+ }
+
+ case EPerfMonCmdAbout:
+ {
+ CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog;
+ dialog->ExecuteLD(R_PERFMON_ABOUT_DIALOG);
+ }
+ break;
+
+ // a normal way to close an application
+ case EAknCmdExit:
+ case EEikCmdExit:
+ case EAknSoftkeyExit:
+ {
+ Exit();
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonAppUi::HandleForegroundEventL(TBool aForeground)
+ {
+ // handle visibility of the data popup container
+ if (iModel && iModel->DataPopupContainer())
+ {
+ iModel->DataPopupContainer()->UpdateVisibility(aForeground);
+ }
+
+ // call the base class
+ CAknAppUi::HandleForegroundEventL(aForeground);
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonAppUi::HandleResourceChangeL(TInt aType)
+ {
+ CAknAppUi::HandleResourceChangeL(aType);
+
+ // update size of the data popup container (implemented here because data popup container
+ // does not get HandleResourceChangeL events)
+ if (aType == KEikDynamicLayoutVariantSwitch)
+ {
+ if (iModel)
+ {
+ if (iModel->DataPopupContainer())
+ {
+ iModel->DataPopupContainer()->SetPositionAndSize();
+ }
+
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/src/perfmon_datapopupcontainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+// INCLUDE FILES
+#include "perfmon_datapopupcontainer.h"
+#include "perfmon.hrh"
+#include "perfmon_document.h"
+#include "perfmon_appui.h"
+#include "perfmon_model.h"
+
+#include <AknUtils.h>
+
+_LIT(KPercentageFormat,"%S %d%%");
+_LIT(KFreeFormat,"%S free %S%S");
+
+const TInt KLeftMargin = 2;
+
+
+// ===================================== MEMBER FUNCTIONS =====================================
+
+void CPerfMonDataPopupContainer::ConstructL(const TRect& /*aRect*/)
+ {
+ iModel = static_cast<CPerfMonDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
+ iFont = LatinPlain12();
+ iFontSize = iFont->FontMaxHeight();
+
+ // set windowgroup so that it always on top and does not receive focus
+ iWindowGroup = RWindowGroup(iCoeEnv->WsSession());
+ User::LeaveIfError(iWindowGroup.Construct((TUint32)&iWindowGroup));
+ iWindowGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
+ iWindowGroup.EnableReceiptOfFocus(EFalse);
+
+ CreateWindowL(&iWindowGroup);
+ //SetRect(aRect);
+ SetPositionAndSize();
+ SetBlank();
+
+ ActivateL();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+CPerfMonDataPopupContainer::~CPerfMonDataPopupContainer()
+ {
+ iWindowGroup.Close();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonDataPopupContainer::Draw(const TRect& aRect) const
+ {
+ CWindowGc& gc = SystemGc();
+ gc.SetBrushColor(KRgbWhite);
+ gc.Clear(aRect);
+
+ // check if sample array has been constructed
+ if (iModel->SampleEntryArray())
+ {
+ // init font
+ gc.SetPenColor(KRgbBlack);
+ gc.UseFont( iFont );
+
+ // draw a rect around the popup
+ gc.DrawRect(aRect);
+
+ TInt posCounter(1);
+
+ for (TInt i=0; i<iModel->SampleEntryArray()->Count(); i++)
+ {
+ // check if this setting has been enabled and it has some data
+ if (iModel->Settings().iDataPopupSources.iSrcEnabled[i] && iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0)
+ {
+ TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(0);
+ TBuf<32> buf;
+
+ // for CPU draw %, other amount of free memory
+ if (i == ESourceCPU)
+ {
+ buf.Format(KPercentageFormat, &iModel->SampleEntryArray()->At(i).iDescription, currentSample.iSize > 0 ? TInt( (1 - ((TReal)(currentSample.iFree) / (TReal)currentSample.iSize)) * 100) : 0 );
+ gc.DrawText(buf, TPoint(KLeftMargin, iFontSize*posCounter));
+ }
+ else
+ {
+ TBuf<32> freeBuf;
+ freeBuf.AppendNum(currentSample.iFree, TRealFormat(KDefaultRealWidth, 0));
+
+ TBuf<32> buf;
+ buf.Format(KFreeFormat, &iModel->SampleEntryArray()->At(i).iDescription, &freeBuf, &iModel->SampleEntryArray()->At(i).iUnitTypeShort);
+ gc.DrawText(buf, TPoint(KLeftMargin, iFontSize*posCounter));
+ }
+
+ posCounter++;
+ }
+ }
+
+ gc.DiscardFont();
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonDataPopupContainer::SizeChanged()
+ {
+ DrawNow();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonDataPopupContainer::SetPositionAndSize()
+ {
+ CWsScreenDevice* screenDevice = iEikonEnv->ScreenDevice();
+
+ // top right
+ if (iModel->Settings().iDataPopupLocation == EDataPopupLocationTopRight)
+ {
+ // screen orientation is landscape with softkeys on right
+ if (AknLayoutUtils::CbaLocation()==AknLayoutUtils::EAknCbaLocationRight)
+ {
+ SetRect(
+ TRect(
+ screenDevice->SizeInPixels().iWidth-102-15,
+ 0,
+ screenDevice->SizeInPixels().iWidth-15,
+ iModel->Settings().iDataPopupSources.EnabledSourcesCount()*iFontSize + 3
+ ));
+ }
+
+ // any other orientation
+ else
+ {
+ SetRect(
+ TRect(
+ screenDevice->SizeInPixels().iWidth-102,
+ 0,
+ screenDevice->SizeInPixels().iWidth,
+ iModel->Settings().iDataPopupSources.EnabledSourcesCount()*iFontSize + 3
+ ));
+ }
+ }
+
+ // bottom middle
+ else if (iModel->Settings().iDataPopupLocation == EDataPopupLocationBottomMiddle)
+ {
+ SetRect(
+ TRect(
+ screenDevice->SizeInPixels().iWidth/2-102/2,
+ screenDevice->SizeInPixels().iHeight - iModel->Settings().iDataPopupSources.EnabledSourcesCount()*iFontSize - 3,
+ screenDevice->SizeInPixels().iWidth/2+102/2,
+ screenDevice->SizeInPixels().iHeight
+ ));
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonDataPopupContainer::UpdateVisibility(TBool aForeground)
+ {
+ // application has been brought to foregound
+ if (aForeground)
+ {
+ if (iModel->Settings().iDataPopupVisibility==EDataPopupVisbilityAlwaysOn)
+ {
+ MakeVisible(ETrue);
+ }
+ else
+ {
+ MakeVisible(EFalse);
+ }
+ }
+
+ // application has been sent to background
+ else
+ {
+ if (iModel->Settings().iDataPopupVisibility==EDataPopupVisbilityAlwaysOn
+ || iModel->Settings().iDataPopupVisibility==EDataPopupVisbilityBackgroundOnly)
+ {
+ MakeVisible(ETrue);
+ }
+ else
+ {
+ MakeVisible(EFalse);
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonDataPopupContainer::DrawUpdate()
+ {
+ DrawDeferred();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/src/perfmon_document.cpp Wed Oct 13 14:32:52 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:
+*
+*/
+
+
+// INCLUDE FILES
+#include "perfmon_document.h"
+#include "perfmon_appui.h"
+#include "perfmon_model.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// constructor
+CPerfMonDocument::CPerfMonDocument(CEikApplication& aApp)
+: CAknDocument(aApp)
+ {
+ }
+
+// ----------------------------------------------------
+
+// destructor
+CPerfMonDocument::~CPerfMonDocument()
+ {
+ delete iModel;
+ }
+
+// ----------------------------------------------------
+
+// EPOC default constructor can leave.
+void CPerfMonDocument::ConstructL()
+ {
+ iModel = CPerfMonModel::NewL();
+ }
+
+// ----------------------------------------------------
+
+// Two-phased constructor.
+CPerfMonDocument* CPerfMonDocument::NewL(CEikApplication& aApp)
+ {
+ CPerfMonDocument* self = new(ELeave) CPerfMonDocument(aApp);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ----------------------------------------------------
+// CPerfMonDocument::CreateAppUiL()
+// constructs CPerfMonAppUi
+// ----------------------------------------------------
+//
+CEikAppUi* CPerfMonDocument::CreateAppUiL()
+ {
+ return new (ELeave) CPerfMonAppUi;
+ }
+
+// ----------------------------------------------------
+// CPerfMonDocument::OpenFileL
+// Overrides CAknDocument::OpenFileL to support document file
+// ----------------------------------------------------
+//
+CFileStore* CPerfMonDocument::OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs)
+ {
+ return CEikDocument::OpenFileL(aDoOpen, aFilename, aFs);
+ }
+
+// ----------------------------------------------------
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/src/perfmon_graphscontainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,233 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+// INCLUDE FILES
+#include "perfmon_graphscontainer.h"
+#include "perfmon.hrh"
+#include "perfmon_document.h"
+#include "perfmon_appui.h"
+#include "perfmon_model.h"
+
+#include <AknUtils.h>
+
+const TInt KAmountOfMicroSecondsFitsScreen = 20 * 1000000;
+#define KRgbCustomGrey TRgb(0x808080)
+
+_LIT(K100p, "100%");
+_LIT(K50p, "50%");
+_LIT(K0p, "0%");
+
+_LIT(KPercentageFormat,"%S %d%%");
+
+const TInt KMicroToSecondMultiplier = 1000000;
+
+// ===================================== MEMBER FUNCTIONS =====================================
+
+void CPerfMonGraphsContainer::ConstructL(const TRect& aRect)
+ {
+ iModel = static_cast<CPerfMonDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
+ //iFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont);
+ iFont = LatinBold12();
+
+ CreateWindowL();
+ SetRect(aRect);
+ SetBlank();
+
+ ActivateL();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+CPerfMonGraphsContainer::~CPerfMonGraphsContainer()
+ {
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonGraphsContainer::Draw(const TRect& aRect) const
+ {
+ // draw black background
+ CWindowGc& gc = SystemGc();
+ gc.SetBrushColor(KRgbBlack);
+ gc.Clear(aRect);
+
+ // activate font and get size
+ gc.UseFont(iFont);
+ TUint fontSize = iFont->FontMaxHeight();
+ //TInt fontBaseOffset = iFont->DescentInPixels();
+
+
+ // calculate time factor
+ TReal scaleFactor = (TReal) aRect.Width() / (TReal) KAmountOfMicroSecondsFitsScreen;
+
+ // calculate area height which is used to draw the grpahs
+ TInt drawAreaHeight = aRect.Height() - fontSize - fontSize;
+
+
+ // check if sample array has been constructed
+ if (iModel->SampleEntryArray())
+ {
+
+ // draw vertical time lines first
+ TInt verticalBarPeriodInSecs = iModel->Settings().iGraphsVerticalBarPeriod;
+
+ if (verticalBarPeriodInSecs >= 1 && iModel->SampleEntryArray()->At(0).iSampleDataArray->Count() > 0)
+ {
+ // get time from the first sample
+ TSampleData& firstSample = iModel->SampleEntryArray()->At(0).iSampleDataArray->At(0);
+ TInt64 currentMicroSeconds = firstSample.iTimeFromStart.Int64();
+
+ // calculate amount of microseconds exceeding value by using the modulo operator
+ TInt remainderInMicroSeconds = currentMicroSeconds % (verticalBarPeriodInSecs * 1000000);
+
+ // calculate first x pos
+ TInt vbarXpos = aRect.Width() - (remainderInMicroSeconds * scaleFactor);
+
+ // calculate the amount in seconds
+ TInt barSeconds = (currentMicroSeconds - remainderInMicroSeconds) / KMicroToSecondMultiplier;
+
+
+ // continue drawing periodically the vertical lines
+ while (vbarXpos >= 0 && barSeconds >= 0)
+ {
+ // draw vertical line
+ gc.SetPenColor(KRgbDarkRed);
+ gc.DrawLine(TPoint(vbarXpos,fontSize+1), TPoint(vbarXpos,aRect.Height()-fontSize));
+
+ // draw seconds value
+ gc.SetPenColor(KRgbCustomGrey);
+ TBuf<16> secsBuf;
+ secsBuf.AppendNum(barSeconds);
+ secsBuf.Append(_L("s"));
+ gc.DrawText(secsBuf, TPoint(vbarXpos-(iFont->TextWidthInPixels(secsBuf)/2), aRect.Height()));
+
+ // calculate new position
+ vbarXpos -= verticalBarPeriodInSecs * 1000000 * scaleFactor;
+ barSeconds -= verticalBarPeriodInSecs;
+ }
+ }
+
+ // draw the basic grid
+ gc.SetPenColor(KRgbCustomGrey);
+
+ gc.DrawLine(TPoint(0,fontSize), TPoint(aRect.Width(),fontSize)); // upper line
+ gc.DrawText(K100p, TPoint(0,fontSize));
+
+ gc.DrawLine(TPoint(0,aRect.Height()/2), TPoint(aRect.Width(),aRect.Height()/2)); // mid line
+ gc.DrawText(K50p, TPoint(0,aRect.Height()/2));
+
+ gc.DrawLine(TPoint(0,aRect.Height()-fontSize), TPoint(aRect.Width(),aRect.Height()-fontSize)); // bottom line
+ gc.DrawText(K0p, TPoint(0,aRect.Height()-fontSize));
+
+ TInt c(0);
+
+ // draw graphs for each sampled type
+ for (TInt i=0; i<iModel->SampleEntryArray()->Count(); i++)
+ {
+ // check if this setting has been enabled and it has some data
+ if (iModel->Settings().iGraphsSources.iSrcEnabled[i] && iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0)
+ {
+ // set pen color for the graph
+ gc.SetPenColor(iModel->SampleEntryArray()->At(i).iGraphColor);
+
+ // remember the position where drawing started
+ /*TReal*/TInt currentXPos(aRect.Width()); // start drawing from right
+ /*TReal*/TInt currentYPos(0);
+
+ // draw samples
+ for (TInt j=0; j<iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() - 1; j++)
+ {
+ TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(j);
+ TSampleData& previousSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(j+1);
+
+ // calculate X position for previous (j+1)
+ /*TReal*/TInt previousXPos = currentXPos -
+ ( (Abs(previousSample.iTimeFromStart.Int64() - currentSample.iTimeFromStart.Int64())) * scaleFactor );
+
+
+ // calculate initial Y position
+ if (j==0)
+ {
+ currentYPos = currentSample.iSize > 0 ? (TReal)(currentSample.iFree) / (TReal)currentSample.iSize * drawAreaHeight + fontSize : aRect.Height()-fontSize;
+ }
+
+ // calculate Y position for previous (j+1)
+ /*TReal*/TInt previousYPos = previousSample.iSize > 0 ? (TReal)(previousSample.iFree) / (TReal)previousSample.iSize * drawAreaHeight + fontSize : aRect.Height()-fontSize;
+
+
+ // draw a line between the previous and current
+ gc.DrawLine(TPoint((TInt)previousXPos,(TInt)previousYPos), TPoint((TInt)currentXPos,(TInt)currentYPos));
+
+
+ // draw current value in %
+ if (j==0) // draw the value of first sample
+ {
+ TBuf<16> buf;
+ buf.Format(KPercentageFormat, &iModel->SampleEntryArray()->At(i).iDescription, currentSample.iSize > 0 ? TInt( (1 - ((TReal)(currentSample.iFree) / (TReal)currentSample.iSize)) * 100) : 0 );
+
+ gc.DrawText(buf, TPoint(0,fontSize+fontSize+c*fontSize));
+ c++;
+ }
+
+
+ // stop drawing if we have run out of space
+ if (previousXPos < 0)
+ break;
+
+ // remeber previous values
+ currentXPos = previousXPos;
+ currentYPos = previousYPos;
+ }
+ }
+ }
+ }
+
+ gc.DiscardFont();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+TKeyResponse CPerfMonGraphsContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
+ {
+ return CCoeControl::OfferKeyEventL(aKeyEvent, aType);
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonGraphsContainer::HandleResourceChange(TInt aType)
+ {
+ if (aType == KEikDynamicLayoutVariantSwitch)
+ {
+ TRect mainPaneRect;
+ AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
+ SetRect(mainPaneRect);
+ }
+ else
+ CCoeControl::HandleResourceChange(aType);
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonGraphsContainer::DrawUpdate()
+ {
+ DrawDeferred();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/src/perfmon_graphsview.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "perfmon.hrh"
+#include "perfmon_graphsview.h"
+#include "perfmon_graphscontainer.h"
+#include "perfmon_document.h"
+#include "perfmon_model.h"
+#include <perfmon.rsg>
+
+#include <eikenv.h>
+#include <aknViewAppUi.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CPerfMonGraphsView::ConstructL(const TRect& aRect)
+// EPOC two-phased constructor
+// ---------------------------------------------------------
+//
+void CPerfMonGraphsView::ConstructL()
+ {
+ BaseConstructL( R_PERFMON_VIEW_GRAPHS );
+ iModel = static_cast<CPerfMonDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
+ }
+
+// ---------------------------------------------------------
+// CPerfMonGraphsView::~CPerfMonGraphsView()
+// ---------------------------------------------------------
+//
+CPerfMonGraphsView::~CPerfMonGraphsView()
+ {
+ if (iContainer)
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ }
+
+// ---------------------------------------------------------
+// TUid CPerfMonGraphsView::Id()
+// ---------------------------------------------------------
+//
+TUid CPerfMonGraphsView::Id() const
+ {
+ return KGraphsViewUID;
+ }
+
+// ---------------------------------------------------------
+// TUid CPerfMonGraphsView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
+// ---------------------------------------------------------
+//
+void CPerfMonGraphsView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
+ {
+ AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane);
+ }
+
+
+// ---------------------------------------------------------
+// CPerfMonGraphsView::HandleCommandL(TInt aCommand)
+// ---------------------------------------------------------
+//
+void CPerfMonGraphsView::HandleCommandL(TInt aCommand)
+ {
+/*
+ switch ( aCommand )
+ {
+ case EPerfMonCmdFileBack:
+ {
+ iModel->FileUtils()->MoveUpOneLevelL();
+ break;
+ }
+
+ default:
+ {
+*/
+ AppUi()->HandleCommandL( aCommand );
+/*
+ break;
+ }
+ }
+*/
+ }
+
+// ---------------------------------------------------------
+// CPerfMonGraphsView::HandleClientRectChange()
+// ---------------------------------------------------------
+//
+void CPerfMonGraphsView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+ }
+
+// ---------------------------------------------------------
+// CPerfMonGraphsView::DoActivateL(...)
+// ---------------------------------------------------------
+//
+void CPerfMonGraphsView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ iContainer = new (ELeave) CPerfMonGraphsContainer;
+ iModel->SetGraphsContainer(iContainer);
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect() );
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+ }
+
+// ---------------------------------------------------------
+// CPerfMonGraphsView::DoDeactivate()
+// ---------------------------------------------------------
+//
+void CPerfMonGraphsView::DoDeactivate()
+ {
+ if (iContainer)
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/src/perfmon_model.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,951 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "perfmon_model.h"
+#include "perfmon_app.h"
+#include "perfmon_settingsviewdlg.h"
+#include "perfmon.hrh"
+#include "perfmon_valuescontainer.h"
+#include "perfmon_graphscontainer.h"
+#include "perfmon_datapopupcontainer.h"
+#include <perfmon.rsg>
+
+#include <coeutils.h>
+#include <bautils.h>
+#include <eikenv.h>
+#include <e32hal.h>
+#include <u32std.h>
+#include <s32file.h>
+#include <akntitle.h>
+#include <eikspane.h>
+#include <aknnotewrappers.h>
+
+_LIT(KAppName, "PerfMon");
+_LIT(KDefaultLogFilePath, "c:\\data\\PerfMon.log");
+
+const TInt KCalibrationLength = 2;
+const TInt KMinimumSamplesLength = 16;
+const TInt KCPUTimeMultiplier = 1000000; // used to avoid TReal conversions
+
+const TInt KSettingsDrive = EDriveC;
+_LIT(KSettingsFileName, "perfmon_settings.ini");
+
+
+// --------------------------------------------------------------------------------------------
+
+TInt CPULoadCount(TAny* aInt)
+ {
+ // increase the counter
+ (*(TUint*)aInt)++;
+ return 1;
+ }
+
+TInt CPULoadNOPThread(TAny* aParam)
+ {
+ CTrapCleanup* pC = CTrapCleanup::New();
+ CActiveScheduler* pS = new CActiveScheduler;
+ CActiveScheduler::Install(pS);
+
+ CIdle* idle = CIdle::NewL(CActive::EPriorityStandard);
+ TCallBack cb(CPULoadCount, aParam);
+ idle->Start(cb);
+
+ pS->Start();
+
+ delete idle;
+ delete pS;
+ delete pC;
+
+ return 0;
+ }
+
+// ===================================== MEMBER FUNCTIONS =====================================
+
+CPerfMonModel* CPerfMonModel::NewL()
+ {
+ CPerfMonModel* self = new(ELeave) CPerfMonModel;
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// --------------------------------------------------------------------------------------------
+
+CPerfMonModel::CPerfMonModel() : CActive(EPriorityUserInput)
+ {
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::ConstructL()
+ {
+ iDrawState = EDrawStateInvalid;
+ iCurrentCPUMode = ECPUModeNotSet;
+ iLogFileInitialized = EFalse;
+
+ iEnv = CEikonEnv::Static();
+ User::LeaveIfError(iLs.Connect());
+
+ User::LeaveIfError(iTimer.CreateLocal());
+ CActiveScheduler::Add(this);
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::ActivateModelL()
+ {
+ // load settings
+ TRAP_IGNORE(LoadSettingsL());
+
+ // create data storages for the samples
+ CreateSamplesDataArrayL();
+
+ // initialize the data popup container in top-right corner
+ iDataPopupContainer = new(ELeave) CPerfMonDataPopupContainer;
+ iDataPopupContainer->ConstructL(TRect(0,0,1,1));
+
+ // set default modes
+ HandleSettingsChangeL();
+
+ // start sampling data immediately (jump to RunL)
+ iTimer.After(iStatus, 100);
+ SetActive();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::DeActivateModelL()
+ {
+ Cancel();
+
+ DeActivateCPUMonitoring();
+
+ if (iDataPopupContainer)
+ {
+ delete iDataPopupContainer;
+ iDataPopupContainer = NULL;
+ }
+
+ // close log file
+ OpenLogFile(EFalse);
+ }
+
+// --------------------------------------------------------------------------------------------
+
+CPerfMonModel::~CPerfMonModel()
+ {
+ iTimer.Close();
+
+ // clear data storages
+ if (iSampleEntryArray)
+ {
+ for (TInt i=0; i<iSampleEntryArray->Count(); i++)
+ {
+ delete iSampleEntryArray->At(i).iSampleDataArray;
+ }
+
+ delete iSampleEntryArray;
+ }
+
+
+ iLs.Close();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::DoCancel()
+ {
+ iTimer.Cancel();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::RunL()
+ {
+ // calculate new values
+ UpdateSamplesDataL();
+
+ // log changes
+ AppendLatestSamplesToLogsL();
+
+ // redraw views
+ SendDrawEventToContainersL();
+
+ // continue
+ iTimer.After(iStatus, iSettings.iHeartBeat * 1000); // convert from milliseconds to microseconds
+ SetActive();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::HandleSettingsChangeL()
+ {
+ // set priority of the thread
+ RThread().SetPriority(SettingItemToThreadPriority(iSettings.iPriority));
+
+ // set visibility and location of the data popup
+ iDataPopupContainer->UpdateVisibility();
+ iDataPopupContainer->SetPositionAndSize();
+
+ // init cpu monitor if setting has been changed
+ if (iCurrentCPUMode != iSettings.iCPUMode)
+ {
+ DeActivateCPUMonitoring();
+ ActivateCPUMonitoringL();
+ }
+
+ // close log file
+ OpenLogFile(EFalse);
+
+ // enable log file
+ if (iSettings.iLoggingEnabled && (iSettings.iLoggingMode == ELoggingModeLogFile || iSettings.iLoggingMode == ELoggingModeRDebugLogFile))
+ OpenLogFile(ETrue);
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::EnableLogging(TBool aEnable)
+ {
+ if (aEnable)
+ {
+ if (iSettings.iLoggingMode == ELoggingModeLogFile || iSettings.iLoggingMode == ELoggingModeRDebugLogFile)
+ OpenLogFile(ETrue);
+
+ iSettings.iLoggingEnabled = ETrue;
+ }
+ else // disable
+ {
+ iSettings.iLoggingEnabled = EFalse;
+ OpenLogFile(EFalse);
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::OpenLogFile(TBool aOpen)
+ {
+ // open log file for writing
+ if (aOpen)
+ {
+ if (!iLogFileInitialized)
+ {
+ TInt err(KErrNone);
+
+ // open the log file for writing
+ if (iLogFile.Open(iEnv->FsSession(), iSettings.iLoggingFilePath, EFileWrite) != KErrNone)
+ {
+ iEnv->FsSession().MkDirAll(iSettings.iLoggingFilePath);
+ err = iLogFile.Replace(iEnv->FsSession(), iSettings.iLoggingFilePath, EFileWrite);
+ }
+ else
+ {
+ // file opens correctly, seek to the end
+ TInt fileSize=0;
+ iLogFile.Size(fileSize);
+ err = iLogFile.Seek(ESeekCurrent, fileSize);
+ }
+
+ if (err == KErrNone)
+ {
+ iLogFileInitialized = ETrue;
+ }
+ else
+ {
+ // show error
+ CAknErrorNote* note = new(ELeave) CAknErrorNote();
+ note->ExecuteLD(_L("Unable to create log file, check settings"));
+ }
+ }
+ }
+
+ // close handle to log file
+ else
+ {
+ if (iLogFileInitialized)
+ {
+ iLogFile.Flush();
+ iLogFile.Close();
+
+ iLogFileInitialized = EFalse;
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::ActivateCPUMonitoringL()
+ {
+ // reset counter variables
+ iCPULoadCalibrating = ETrue;
+ iCPULoadCalibrationCounter = 0;
+ iCPULoadMaxValue = 999999999;
+ iCPULoadPreviousValue = 1;
+ iCPULoadCounter = 0;
+
+ // use null thread is cpu time is supported and the setting is on
+ if (CPUTimeSupported() && iSettings.iCPUMode == ECPUModeCPUTime)
+ {
+ // try to open handle to null thread
+ if (OpenHandleToNullThread())
+ {
+ // handle is open, get initial value
+ TTimeIntervalMicroSeconds time;
+ iNullThread.GetCpuTime(time);
+ iCPULoadPreviousValue = time.Int64();
+ iPreviousTime.HomeTime();
+
+ iCurrentCPUMode = ECPUModeCPUTime;
+ return; // cpu time is succesfully in use
+ }
+ }
+
+ // otherwise use normal sampling with nops
+ iCurrentCPUMode = ECPUModeNotSet;
+
+ // show a warning if cpu time cannot be taken in use
+ if (iSettings.iCPUMode == ECPUModeCPUTime)
+ {
+ CAknInformationNote* note = new(ELeave) CAknInformationNote();
+ note->ExecuteLD(_L("CPU Time not supported in this system, using NOPs sampling"));
+ }
+
+ // create a thread for CPU load monitoring
+ User::LeaveIfError(iCPULoadThread.Create(_L("PerfMonCPULoad"), CPULoadNOPThread, 0x1000, 0x1000, 0x100000, &iCPULoadCounter));
+ iCPULoadThread.SetPriority(EPriorityLess);
+ iCPULoadThread.Resume();
+
+ iCurrentCPUMode = ECPUModeNOPs; // NOPs taken succesfully in use
+ }
+
+// --------------------------------------------------------------------------------------------
+
+TBool CPerfMonModel::OpenHandleToNullThread()
+ {
+ // find the kernel process and then the null thread
+ TFindProcess fp(_L("ekern.exe*"));
+
+ TFullName kernelName;
+ if (fp.Next(kernelName) == KErrNone)
+ {
+ // process found, append null thread identifier
+ kernelName.Append(_L("::Null"));
+
+ // find the thread
+ TFindThread ft(kernelName);
+
+ TFullName threadName;
+ if (ft.Next(threadName) == KErrNone)
+ {
+ // open instance to the thread
+ if (iNullThread.Open(threadName) != KErrNone)
+ return EFalse;
+ }
+ }
+
+ // process not found
+ else
+ return EFalse;
+
+ // success!
+ return ETrue;
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::DeActivateCPUMonitoring()
+ {
+ if (iCurrentCPUMode == ECPUModeCPUTime)
+ {
+ iNullThread.Close();
+ }
+
+ else if (iCurrentCPUMode == ECPUModeNOPs)
+ {
+ // kill the cpu load thread
+ iCPULoadThread.Kill(0);
+ iCPULoadThread.Close();
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+TBool CPerfMonModel::CPUTimeSupported()
+ {
+ TTimeIntervalMicroSeconds time;
+ TInt err = RThread().GetCpuTime(time);
+
+ if (err == KErrNone && time.Int64() > 0)
+ return ETrue;
+ else
+ return EFalse;
+ }
+
+// --------------------------------------------------------------------------------------------
+
+TThreadPriority CPerfMonModel::SettingItemToThreadPriority(TInt aIndex)
+ {
+ TThreadPriority threadPriority = EPriorityNull;
+
+ switch ( aIndex )
+ {
+ case EThreadPriorityTypeMuchLess:
+ {
+ threadPriority = EPriorityMuchLess; break;
+ }
+ case EThreadPriorityTypeLess:
+ {
+ threadPriority = EPriorityLess; break;
+ }
+ case EThreadPriorityTypeNormal:
+ {
+ threadPriority = EPriorityNormal; break;
+ }
+ case EThreadPriorityTypeMore:
+ {
+ threadPriority = EPriorityMore; break;
+ }
+ case EThreadPriorityTypeMuchMore:
+ {
+ threadPriority = EPriorityMuchMore; break;
+ }
+ case EThreadPriorityTypeRealTime:
+ {
+ threadPriority = EPriorityRealTime; break;
+ }
+ case EThreadPriorityTypeAbsoluteVeryLow:
+ {
+ threadPriority = EPriorityAbsoluteVeryLow; break;
+ }
+ case EThreadPriorityTypeAbsoluteLow:
+ {
+ threadPriority = EPriorityAbsoluteLow; break;
+ }
+ case EThreadPriorityTypeAbsoluteBackground:
+ {
+ threadPriority = EPriorityAbsoluteBackground; break;
+ }
+ case EThreadPriorityTypeAbsoluteForeground:
+ {
+ threadPriority = EPriorityAbsoluteForeground; break;
+ }
+ case EThreadPriorityTypeAbsoluteHigh:
+ {
+ threadPriority = EPriorityAbsoluteHigh; break;
+ }
+
+ default:
+ {
+ User::Panic(_L("Wrong tp index"), 276);
+ break;
+ }
+ }
+
+ return threadPriority;
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::CreateSamplesDataArrayL()
+ {
+ TInt maxSamples = iSettings.iMaxSamples >= KMinimumSamplesLength ? iSettings.iMaxSamples : KMinimumSamplesLength;
+
+ // create the data structure to store all samples
+ iSampleEntryArray = new(ELeave) CSampleEntryArray(16);
+
+ // add all source entries
+ for (TInt i=0; i<ESourcesLength; i++)
+ {
+ TSampleEntry newSampleEntry;
+
+ if (i == ESourceCPU)
+ {
+ newSampleEntry.iDescription.Copy(_L("CPU"));
+ newSampleEntry.iUnitTypeShort.Copy(KNullDesC);
+ newSampleEntry.iUnitTypeLong.Copy(KNullDesC);
+ newSampleEntry.iDriveNumber = -1;
+ newSampleEntry.iGraphColor = KRgbYellow;
+ }
+
+ else if (i == ESourceRAM)
+ {
+ newSampleEntry.iDescription.Copy(_L("RAM"));
+ newSampleEntry.iUnitTypeShort.Copy(_L("b"));
+ newSampleEntry.iUnitTypeLong.Copy(_L("bytes"));
+ newSampleEntry.iDriveNumber = -1;
+ newSampleEntry.iGraphColor = KRgbGreen;
+ }
+
+ else //drives
+ {
+ TChar driveLetter = 'C' + i-ESourceC; // C is the first drive
+
+ newSampleEntry.iDescription.Append(driveLetter);
+ newSampleEntry.iDescription.Append(_L(":"));
+ newSampleEntry.iUnitTypeShort.Copy(_L("b"));
+ newSampleEntry.iUnitTypeLong.Copy(_L("bytes"));
+
+ iEnv->FsSession().CharToDrive(driveLetter, newSampleEntry.iDriveNumber);
+
+ newSampleEntry.iGraphColor = KRgbCyan;
+ newSampleEntry.iGraphColor.SetGreen(255-(i-ESourceC)*30);
+ newSampleEntry.iGraphColor.SetRed(i*30);
+ }
+
+ newSampleEntry.iSampleDataArray = new(ELeave) CSampleDataArray(maxSamples);
+
+ iSampleEntryArray->AppendL(newSampleEntry);
+ }
+
+ // save current time as start time
+ iStartTime.HomeTime();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::UpdateSamplesDataL()
+ {
+ // reset inactivity timers
+ if (iSettings.iKeepBacklightOn)
+ User::ResetInactivityTime();
+
+ // get current time
+ TTime currentTime;
+ currentTime.HomeTime();
+
+ // calculate time difference
+ TTimeIntervalMicroSeconds timeDeltaFromPreviousSample = currentTime.MicroSecondsFrom(iPreviousTime);
+
+ // remember current time as previous
+ iPreviousTime = currentTime;
+
+
+ // get CPU
+ TInt64 cpuLoadDelta(0);
+ TInt64 cpuLoadFree(0);
+ TInt64 cpuLoadSize(0);
+ TInt64 currentCPUValue(0);
+
+ if (iCurrentCPUMode == ECPUModeCPUTime || iCurrentCPUMode == ECPUModeNOPs)
+ {
+ if (iCurrentCPUMode == ECPUModeCPUTime)
+ {
+ TTimeIntervalMicroSeconds time;
+ iNullThread.GetCpuTime(time);
+ currentCPUValue = time.Int64();
+ }
+ else if (iCurrentCPUMode == ECPUModeNOPs)
+ {
+ currentCPUValue = iCPULoadCounter;
+ }
+
+ // get delta and store the previous value
+ cpuLoadDelta = currentCPUValue - iCPULoadPreviousValue;
+ iCPULoadPreviousValue = currentCPUValue;
+
+ // velocity = distance / time
+ cpuLoadFree = cpuLoadDelta * KCPUTimeMultiplier / timeDeltaFromPreviousSample.Int64();
+
+
+ // detect maximum value
+ if (cpuLoadFree > iCPULoadMaxValue)
+ iCPULoadMaxValue = cpuLoadFree;
+
+
+ // check calibration status
+ if (iCPULoadCalibrating)
+ {
+ iCPULoadCalibrationCounter++;
+ cpuLoadSize = cpuLoadFree;
+
+ // check if need to calibrate anymore
+ if (iCPULoadCalibrationCounter > KCalibrationLength)
+ {
+ iCPULoadCalibrating = EFalse;
+
+ // from the samples, get the minimum value, and let it be the max value
+ for (TInt i=0; i<iSampleEntryArray->At(0).iSampleDataArray->Count(); i++)
+ {
+ TInt64 newCPULoadMaxValue = iCPULoadMaxValue;
+
+ if (iSampleEntryArray->At(0).iSampleDataArray->At(i).iFree < newCPULoadMaxValue)
+ {
+ newCPULoadMaxValue = iSampleEntryArray->At(0).iSampleDataArray->At(i).iFree;
+ }
+
+ iCPULoadMaxValue = newCPULoadMaxValue;
+ }
+
+ // adjust priority of the poller thread
+ if (iCurrentCPUMode == ECPUModeNOPs)
+ {
+ iCPULoadThread.SetPriority(EPriorityAbsoluteVeryLow);
+ }
+ }
+
+ }
+ else
+ {
+ cpuLoadSize = iCPULoadMaxValue;
+ }
+ }
+
+
+ // save cpu sample data
+ TSampleData cpuSample;
+ cpuSample.iFree = cpuLoadFree;
+ cpuSample.iSize = cpuLoadSize;
+ cpuSample.iTimeFromStart = currentTime.MicroSecondsFrom(iStartTime);
+
+ iSampleEntryArray->At(0).iSampleDataArray->InsertL(0, cpuSample);
+
+
+
+ // get ram memory
+ TMemoryInfoV1Buf ramMemory;
+ UserHal::MemoryInfo(ramMemory);
+
+ TSampleData memorySample;
+ memorySample.iFree = ramMemory().iFreeRamInBytes;
+ memorySample.iSize = ramMemory().iMaxFreeRamInBytes;
+ memorySample.iTimeFromStart = currentTime.MicroSecondsFrom(iStartTime);
+
+ iSampleEntryArray->At(1).iSampleDataArray->InsertL(0, memorySample);
+
+
+ // all drives
+ for (TInt i=2; i<iSampleEntryArray->Count(); i++)
+ {
+ TSampleData driveSample;
+
+ // get volume info from RFs
+ TVolumeInfo volumeInfo;
+ if (iEnv->FsSession().Volume(volumeInfo, iSampleEntryArray->At(i).iDriveNumber) == KErrNone)
+ {
+ driveSample.iFree = volumeInfo.iFree;
+ driveSample.iSize = volumeInfo.iSize;
+ }
+ else
+ {
+ driveSample.iFree = 0;
+ driveSample.iSize = 0;
+ }
+
+ driveSample.iTimeFromStart = currentTime.MicroSecondsFrom(iStartTime);
+
+ iSampleEntryArray->At(i).iSampleDataArray->InsertL(0, driveSample);
+ }
+
+
+ // compress sample data arrays to save memory
+ TInt curLength(iSampleEntryArray->At(0).iSampleDataArray->Count());
+
+ TInt maxSamples = iSettings.iMaxSamples >= KMinimumSamplesLength ? iSettings.iMaxSamples : KMinimumSamplesLength;
+
+ if (curLength > maxSamples && curLength % 5 == 0)
+ {
+ for (TInt i=0; i<iSampleEntryArray->Count(); i++)
+ {
+ iSampleEntryArray->At(i).iSampleDataArray->ResizeL(maxSamples); // looses old samples
+ iSampleEntryArray->At(i).iSampleDataArray->Compress();
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::AppendLatestSamplesToLogsL()
+ {
+ if (iSettings.iLoggingEnabled && SampleEntryArray())
+ {
+ // loop all sources
+ for (TInt i=0; i<SampleEntryArray()->Count(); i++)
+ {
+ // check if this setting has been enabled and it has some data
+ if (iSettings.iLoggingSources.iSrcEnabled[i] && SampleEntryArray()->At(i).iSampleDataArray->Count() > 0)
+ {
+ // get current sample
+ TSampleData& currentSample = SampleEntryArray()->At(i).iSampleDataArray->At(0);
+
+ TBuf<128> buf;
+ buf.Append(_L("PERFMON;"));
+ buf.Append(SampleEntryArray()->At(i).iDescription);
+ buf.Append(_L(";"));
+ buf.AppendNum(currentSample.iTimeFromStart.Int64());
+ buf.Append(_L(";"));
+ buf.AppendNum(currentSample.iFree);
+ buf.Append(_L(";"));
+ buf.AppendNum(currentSample.iSize);
+
+ // print to RDebug
+ if (iSettings.iLoggingMode == ELoggingModeRDebug || iSettings.iLoggingMode == ELoggingModeRDebugLogFile)
+ {
+ RDebug::Print(buf);
+ }
+
+ // print to log file
+ if (iSettings.iLoggingMode == ELoggingModeLogFile || iSettings.iLoggingMode == ELoggingModeRDebugLogFile)
+ {
+ buf.Append(_L("\r\n"));
+
+ TBuf8<128> buf8;
+ buf8.Copy(buf);
+
+ iLogFile.Write(buf8);
+ }
+ }
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::SetValuesContainer(CPerfMonValuesContainer* aContainer)
+ {
+ iValuesContainer = aContainer;
+ iDrawState = EDrawStateValues;
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::SetGraphsContainer(CPerfMonGraphsContainer* aContainer)
+ {
+ iGraphsContainer = aContainer;
+ iDrawState = EDrawStateGraphs;
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::SendDrawEventToContainersL()
+ {
+ if (iDrawState == EDrawStateValues && iValuesContainer)
+ iValuesContainer->DrawUpdate();
+ else if (iDrawState == EDrawStateGraphs && iGraphsContainer)
+ iGraphsContainer->DrawUpdate();
+
+ if (iDataPopupContainer)
+ iDataPopupContainer->DrawUpdate();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::LoadSettingsL()
+ {
+ // set defaults
+ iSettings.iHeartBeat = 600;
+ iSettings.iMaxSamples = 64;
+ iSettings.iPriority = EThreadPriorityTypeNormal;
+ iSettings.iCPUMode = ECPUModeCPUTime;
+ iSettings.iKeepBacklightOn = ETrue;
+
+ iSettings.iDataPopupVisibility = EDataPopupVisbilityAlwaysOn;
+ iSettings.iDataPopupLocation = EDataPopupLocationTopRight;
+ iSettings.iDataPopupSources.SetDefaults1();
+
+ iSettings.iGraphsVerticalBarPeriod = 5;
+ iSettings.iGraphsSources.SetDefaults2();
+
+ iSettings.iLoggingMode = ELoggingModeRDebug;
+ iSettings.iLoggingFilePath.Copy(KDefaultLogFilePath);
+ iSettings.iLoggingSources.SetDefaults2();
+
+ iSettings.iLoggingEnabled = EFalse;
+
+
+ // make sure that the private path of this app in c-drive exists
+ iEnv->FsSession().CreatePrivatePath( KSettingsDrive ); // c:\\private\\20011385\\
+
+ // handle settings always in the private directory
+ if (iEnv->FsSession().SetSessionToPrivate( KSettingsDrive ) == KErrNone)
+ {
+ // open or create a dictionary file store
+ CDictionaryFileStore* settingsStore = CDictionaryFileStore::OpenLC(iEnv->FsSession(), KSettingsFileName, KUidPerfMon);
+
+ LoadDFSValueL(settingsStore, KPMSettingHeartBeat, iSettings.iHeartBeat);
+ LoadDFSValueL(settingsStore, KPMSettingMaxSamples, iSettings.iMaxSamples);
+ LoadDFSValueL(settingsStore, KPMSettingPriority, iSettings.iPriority);
+ LoadDFSValueL(settingsStore, KPMSettingCPUMode, iSettings.iCPUMode);
+ LoadDFSValueL(settingsStore, KPMSettingKeepBackLightOn, iSettings.iKeepBacklightOn);
+
+ LoadDFSValueL(settingsStore, KPMSettingDataPopupVisbility, iSettings.iDataPopupVisibility);
+ LoadDFSValueL(settingsStore, KPMSettingDataPopupLocation, iSettings.iDataPopupLocation);
+ LoadDFSValueL(settingsStore, KPMSettingDataPopupSources, iSettings.iDataPopupSources);
+
+ LoadDFSValueL(settingsStore, KPMSettingGraphsVerticalBarPeriod, iSettings.iGraphsVerticalBarPeriod);
+ LoadDFSValueL(settingsStore, KPMSettingGraphsSources, iSettings.iGraphsSources);
+
+ LoadDFSValueL(settingsStore, KPMSettingLoggingMode, iSettings.iLoggingMode);
+ LoadDFSValueL(settingsStore, KPMSettingLoggingFilePath, iSettings.iLoggingFilePath);
+ LoadDFSValueL(settingsStore, KPMSettingLoggingSources, iSettings.iLoggingSources);
+
+ CleanupStack::PopAndDestroy(); // settingsStore
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonModel::SaveSettingsL()
+ {
+ // handle settings always in c:\\private\\20011385\\
+ if (iEnv->FsSession().SetSessionToPrivate( KSettingsDrive ) == KErrNone)
+ {
+ // delete existing store to make sure that it is clean and not eg corrupted
+ if (BaflUtils::FileExists(iEnv->FsSession(), KSettingsFileName))
+ {
+ iEnv->FsSession().Delete(KSettingsFileName);
+ }
+
+ // create a dictionary file store
+ CDictionaryFileStore* settingsStore = CDictionaryFileStore::OpenLC(iEnv->FsSession(), KSettingsFileName, KUidPerfMon);
+
+ SaveDFSValueL(settingsStore, KPMSettingHeartBeat, iSettings.iHeartBeat);
+ SaveDFSValueL(settingsStore, KPMSettingMaxSamples, iSettings.iMaxSamples);
+ SaveDFSValueL(settingsStore, KPMSettingPriority, iSettings.iPriority);
+ SaveDFSValueL(settingsStore, KPMSettingCPUMode, iSettings.iCPUMode);
+ SaveDFSValueL(settingsStore, KPMSettingKeepBackLightOn, iSettings.iKeepBacklightOn);
+
+ SaveDFSValueL(settingsStore, KPMSettingDataPopupVisbility, iSettings.iDataPopupVisibility);
+ SaveDFSValueL(settingsStore, KPMSettingDataPopupLocation, iSettings.iDataPopupLocation);
+ SaveDFSValueL(settingsStore, KPMSettingDataPopupSources, iSettings.iDataPopupSources);
+
+ SaveDFSValueL(settingsStore, KPMSettingGraphsVerticalBarPeriod, iSettings.iGraphsVerticalBarPeriod);
+ SaveDFSValueL(settingsStore, KPMSettingGraphsSources, iSettings.iGraphsSources);
+
+ SaveDFSValueL(settingsStore, KPMSettingLoggingMode, iSettings.iLoggingMode);
+ SaveDFSValueL(settingsStore, KPMSettingLoggingFilePath, iSettings.iLoggingFilePath);
+ SaveDFSValueL(settingsStore, KPMSettingLoggingSources, iSettings.iLoggingSources);
+
+ settingsStore->CommitL();
+ CleanupStack::PopAndDestroy(); // settingsStore
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+TInt CPerfMonModel::LaunchSettingsDialogL()
+ {
+ // launch the settings dialog
+ TPerfMonSettings newSettings = iSettings;
+
+ CPerfMonSettingsViewDlg* dlg = CPerfMonSettingsViewDlg::NewL(newSettings);
+ TInt returnValue = dlg->ExecuteLD(R_PERFMON_SETTINGS_DIALOG);
+
+ // always save settings since the settings dialog does not provide a possibility to cancel
+ iSettings = newSettings;
+ SaveSettingsL();
+ HandleSettingsChangeL();
+
+ // make sure that the title of the application is correct
+ CEikStatusPane* sp = iEnv->AppUiFactory()->StatusPane();
+ CAknTitlePane* tp = static_cast<CAknTitlePane*>( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+ tp->SetTextL(KAppName);
+
+ return returnValue;
+ }
+
+// ---------------------------------------------------------------------------
+
+void CPerfMonModel::LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TInt& aValue)
+ {
+ if (aDicFS->IsPresentL(aUid))
+ {
+ RDictionaryReadStream in;
+ in.OpenLC(*aDicFS, aUid);
+ aValue = in.ReadInt16L();
+ CleanupStack::PopAndDestroy(); // in
+ }
+ }
+
+// ---------------------------------------------------------------------------
+
+void CPerfMonModel::LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TDes& aValue)
+ {
+ if (aDicFS->IsPresentL(aUid))
+ {
+ RDictionaryReadStream in;
+ in.OpenLC(*aDicFS, aUid);
+ TInt bufLength = in.ReadInt16L(); // get length of descriptor
+ in.ReadL(aValue, bufLength); // get the descriptor itself
+ CleanupStack::PopAndDestroy(); // in
+ }
+ }
+
+// ---------------------------------------------------------------------------
+
+void CPerfMonModel::LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TPerfMonSources& aValue)
+ {
+ if (aDicFS->IsPresentL(aUid))
+ {
+ RDictionaryReadStream in;
+ in.OpenLC(*aDicFS, aUid);
+ TInt bufLength = in.ReadInt16L(); // get length of the array
+
+ if (bufLength < 0 || bufLength > ESourcesLength) // check for validaty
+ User::Leave(KErrNotSupported);
+
+ for (TInt i=0; i<bufLength; i++) // get all items
+ aValue.iSrcEnabled[i] = in.ReadInt16L();
+
+ CleanupStack::PopAndDestroy(); // in
+ }
+ }
+
+// ---------------------------------------------------------------------------
+
+void CPerfMonModel::SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TInt& aValue)
+ {
+ RDictionaryWriteStream out;
+ out.AssignLC(*aDicFS, aUid);
+ out.WriteInt16L(aValue);
+ out.CommitL();
+ CleanupStack::PopAndDestroy(); // out
+ }
+
+// ---------------------------------------------------------------------------
+
+void CPerfMonModel::SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TDes& aValue)
+ {
+ RDictionaryWriteStream out;
+ out.AssignLC(*aDicFS, aUid);
+ out.WriteInt16L(aValue.Length()); // write length of the descriptor
+ out.WriteL(aValue, aValue.Length()); // write the descriptor itself
+ out.CommitL();
+ CleanupStack::PopAndDestroy(); // out
+ }
+
+// ---------------------------------------------------------------------------
+
+void CPerfMonModel::SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TPerfMonSources& aValue)
+ {
+ RDictionaryWriteStream out;
+ out.AssignLC(*aDicFS, aUid);
+
+ out.WriteInt16L(ESourcesLength); // write length of the array
+
+ for (TInt i=0; i<ESourcesLength; i++) // write all items
+ out.WriteInt16L(aValue.iSrcEnabled[i]);
+
+ out.CommitL();
+ CleanupStack::PopAndDestroy(); // out
+ }
+
+// ---------------------------------------------------------------------------
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/src/perfmon_settingsviewdlg.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,681 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "perfmon_settingsviewdlg.h"
+#include "perfmon_model.h"
+#include "perfmon.hrh"
+#include "perfmon_std.h"
+#include <perfmon.rsg>
+
+#include <aknsettingitemlist.h>
+#include <CAknMemorySelectionSettingItem.h>
+#include <aknlists.h>
+#include <akntitle.h>
+#include <aknnavi.h>
+#include <aknnavide.h>
+#include <StringLoader.h>
+#include <aknnotewrappers.h>
+
+// ===================================== MEMBER FUNCTIONS =====================================
+
+CPerfMonSettingsViewDlg* CPerfMonSettingsViewDlg::NewL(TPerfMonSettings& aSettings)
+ {
+ CPerfMonSettingsViewDlg* self = new(ELeave) CPerfMonSettingsViewDlg(aSettings);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// --------------------------------------------------------------------------------------------
+
+CPerfMonSettingsViewDlg::~CPerfMonSettingsViewDlg()
+ {
+ // restore default navi pane by popping the tab group from stack
+ if (iNaviContainer)
+ iNaviContainer->Pop();
+
+ if (iSettingItemArray)
+ {
+ iSettingItemArray->ResetAndDestroy();
+ delete iSettingItemArray;
+ }
+
+ delete iDecoratedTabGroup;
+ }
+
+// --------------------------------------------------------------------------------------------
+
+CPerfMonSettingsViewDlg::CPerfMonSettingsViewDlg(TPerfMonSettings& aSettings) : iSettings(aSettings)
+ {
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonSettingsViewDlg::ConstructL()
+ {
+ // construct a menu bar
+ CAknDialog::ConstructL(R_PERFMON_SETTINGS_MENUBAR);
+
+ // get pointer to status pane
+ CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane();
+
+ // set title text
+ CAknTitlePane* tp = static_cast<CAknTitlePane*>( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+ tp->SetTextL( _L("Settings") );
+
+ // create a new tab group
+ iNaviContainer = static_cast<CAknNavigationControlContainer*>(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi)));
+ iDecoratedTabGroup = iNaviContainer->CreateTabGroupL(this);
+ iTabGroup = static_cast<CAknTabGroup*>(iDecoratedTabGroup->DecoratedControl());
+ iTabGroup->SetTabFixedWidthL(KTabWidthWithTwoLongTabs);
+
+ // add tabs
+ iTabGroup->AddTabL(ETabSettingsGeneral, _L("General"));
+ iTabGroup->AddTabL(ETabSettingsDataPopup, _L("Data popup"));
+ iTabGroup->AddTabL(ETabSettingsGraphs, _L("Graphs"));
+ iTabGroup->AddTabL(ETabSettingsLogging, _L("Logging"));
+ iTabGroup->SetActiveTabByIndex(ETabSettingsGeneral);
+
+ // add new tab group to stack
+ iNaviContainer->PushL( *iDecoratedTabGroup );
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonSettingsViewDlg::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+ {
+ switch (aEventType)
+ {
+ case EEventEnterKeyPressed:
+ case EEventItemDoubleClicked:
+ ShowSettingPageL(EFalse);
+ break;
+ default:
+ break;
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonSettingsViewDlg::TabChangedL(TInt /*aIndex*/)
+ {
+ iListBox->SetCurrentItemIndex(0);
+
+ SetVisibilitiesOfSettingItemsL();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonSettingsViewDlg::ProcessCommandL(TInt aCommandId)
+ {
+ CAknDialog::ProcessCommandL(aCommandId);
+
+ switch (aCommandId)
+ {
+ case EPerfMonCmdSettingsChange:
+ ShowSettingPageL(ETrue);
+ break;
+ case EPerfMonCmdSettingsExit:
+ TryExitL(EAknCmdExit);
+ break;
+ default:
+ break;
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+TKeyResponse CPerfMonSettingsViewDlg::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 CPerfMonSettingsViewDlg::PreLayoutDynInitL()
+ {
+ iListBox = static_cast<CAknSettingStyleListBox*>( Control(EPerfMonSettingItemList) );
+ 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 CPerfMonSettingsViewDlg::OkToExitL(TInt aButtonId)
+ {
+ return CAknDialog::OkToExitL(aButtonId);
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonSettingsViewDlg::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 CPerfMonSettingsViewDlg::SetVisibilitiesOfSettingItemsL()
+ {
+ if (iSettingItemArray->Count() > 0)
+ {
+ switch (iTabGroup->ActiveTabIndex())
+ {
+ case ETabSettingsGeneral:
+ {
+ ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(EFalse);
+ ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(EFalse);
+ ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(EFalse);
+ ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(EFalse);
+ ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(EFalse);
+
+ ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(ETrue);
+
+ ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(ETrue);
+
+ ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(ETrue);
+
+ break;
+ }
+
+ case ETabSettingsDataPopup:
+ {
+ ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(ETrue);
+
+ ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(EFalse);
+ ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(EFalse);
+ ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(EFalse);
+
+ ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(ETrue);
+
+ ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(ETrue);
+
+ break;
+ }
+
+ case ETabSettingsGraphs:
+ {
+ ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(ETrue);
+
+ ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(ETrue);
+
+ ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(EFalse);
+ ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(EFalse);
+
+ ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(ETrue);
+
+ break;
+ }
+
+ case ETabSettingsLogging:
+ {
+ ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(ETrue);
+
+ ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(ETrue);
+
+ ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(ETrue);
+ ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(ETrue);
+
+ ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(EFalse);
+
+ if (iSettings.iLoggingMode == ELoggingModeLogFile || iSettings.iLoggingMode == ELoggingModeRDebugLogFile)
+ ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(EFalse);
+ else
+ ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue);
+
+ ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(EFalse);
+
+ break;
+ }
+
+ default:
+ User::Panic(_L("TabIOOB"), 50);
+ break;
+ }
+
+ iSettingItemArray->RecalculateVisibleIndicesL();
+ iListBox->HandleItemAdditionL();
+ iListBox->UpdateScrollBarsL();
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonSettingsViewDlg::UpdateListBoxL()
+ {
+ iSettingItemArray->ResetAndDestroy();
+
+ // create items
+ TInt ordinal(0);
+
+ AddSettingItemL(ESettingListItemHeartBeat,
+ R_HEARTBEAT_SETTING_TITLE,
+ R_HEARTBEAT_SETTING_PAGE,
+ NULL,
+ ordinal++);
+
+ AddSettingItemL(ESettingListItemMaxSamples,
+ R_MAXSAMPLES_SETTING_TITLE,
+ R_MAXSAMPLES_SETTING_PAGE,
+ NULL,
+ ordinal++);
+
+ AddSettingItemL(ESettingListItemPriority,
+ R_PRIORITY_SETTING_TITLE,
+ R_PRIORITY_SETTING_PAGE,
+ R_PRIORITY_SETTING_TEXTS,
+ ordinal++);
+
+ AddSettingItemL(ESettingListItemCPUMode,
+ R_CPUMODE_SETTING_TITLE,
+ R_CPUMODE_SETTING_PAGE,
+ R_CPUMODE_SETTING_TEXTS,
+ ordinal++);
+
+ AddSettingItemL(ESettingListItemKeepBackLightOn,
+ R_KEEPBACKLIGHTON_SETTING_TITLE,
+ R_BINARY_SETTING_PAGE,
+ R_YESNO_BINARYSELECTION_TEXTS,
+ ordinal++);
+//
+ AddSettingItemL(ESettingListItemDataPopupVisbility,
+ R_DATAPOPUPVISIBILITY_SETTING_TITLE,
+ R_DATAPOPUPVISIBILITY_SETTING_PAGE,
+ R_DATAPOPUPVISIBILITY_SETTING_TEXTS,
+ ordinal++);
+
+ AddSettingItemL(ESettingListItemDataPopupLocation,
+ R_DATAPOPUPLOCATION_SETTING_TITLE,
+ R_DATAPOPUPLOCATION_SETTING_PAGE,
+ R_DATAPOPUPLOCATION_SETTING_TEXTS,
+ ordinal++);
+
+ AddSettingItemL(ESettingListItemDataPopupSources,
+ R_SOURCES_SETTING_TITLE,
+ R_SOURCES_SETTING_PAGE,
+ NULL,
+ ordinal++);
+//
+ AddSettingItemL(ESettingListItemGraphsVerticalBarPeriod,
+ R_GRAPHSVERTICALBAR_SETTING_TITLE,
+ R_GRAPHSVERTICALBAR_SETTING_PAGE,
+ NULL,
+ ordinal++);
+
+ AddSettingItemL(ESettingListItemGraphsSources,
+ R_SOURCES_SETTING_TITLE,
+ R_SOURCES_SETTING_PAGE,
+ NULL,
+ ordinal++);
+//
+ AddSettingItemL(ESettingListItemLoggingMode,
+ R_LOGGINGMODE_SETTING_TITLE,
+ R_LOGGINGMODE_SETTING_PAGE,
+ R_LOGGINGMODE_SETTING_TEXTS,
+ ordinal++);
+
+ AddSettingItemL(ESettingListItemLoggingFilePath,
+ R_LOGGINGFILEPATH_SETTING_TITLE,
+ R_LOGGINGFILEPATH_SETTING_PAGE,
+ NULL,
+ ordinal++);
+
+ AddSettingItemL(ESettingListItemLoggingSources,
+ R_SOURCES_SETTING_TITLE,
+ R_SOURCES_SETTING_PAGE,
+ NULL,
+ ordinal++);
+
+ SetVisibilitiesOfSettingItemsL();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonSettingsViewDlg::AddSettingItemL(TInt aId,
+ TInt aTitleResource,
+ TInt aSettingPageResource,
+ TInt aAssociatedResource,
+ TInt aOrdinal)
+ {
+ // create a setting item
+ CAknSettingItem* settingItem = NULL;
+
+ switch (aId)
+ {
+ case ESettingListItemHeartBeat:
+ settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iHeartBeat);
+ break;
+
+ case ESettingListItemMaxSamples:
+ settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iMaxSamples);
+ break;
+
+ case ESettingListItemPriority:
+ settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iPriority);
+ break;
+
+ case ESettingListItemCPUMode:
+ settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iCPUMode);
+ break;
+
+ case ESettingListItemKeepBackLightOn:
+ settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iKeepBacklightOn);
+ break;
+
+ case ESettingListItemDataPopupVisbility:
+ settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iDataPopupVisibility);
+ break;
+
+ case ESettingListItemDataPopupLocation:
+ settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iDataPopupLocation);
+ break;
+
+ case ESettingListItemDataPopupSources:
+ settingItem = new(ELeave) CSourceSelectionCheckBoxSettingItem(aId, iSettings.iDataPopupSources);
+ break;
+
+ case ESettingListItemGraphsVerticalBarPeriod:
+ settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iGraphsVerticalBarPeriod);
+ break;
+
+ case ESettingListItemGraphsSources:
+ settingItem = new(ELeave) CSourceSelectionCheckBoxSettingItem(aId, iSettings.iGraphsSources);
+ break;
+
+ case ESettingListItemLoggingMode:
+ settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iLoggingMode);
+ break;
+
+ case ESettingListItemLoggingFilePath:
+ settingItem = new(ELeave) CAknTextSettingItem(aId, iSettings.iLoggingFilePath);
+ break;
+
+ case ESettingListItemLoggingSources:
+ settingItem = new(ELeave) CSourceSelectionCheckBoxSettingItem(aId, iSettings.iLoggingSources);
+ 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
+ }
+
+
+// --------------------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------------------
+
+CSourceSelectionCheckBoxSettingItem::CSourceSelectionCheckBoxSettingItem( TInt aIdentifier, TPerfMonSources& aMemoryInUse ):
+ CAknSettingItem(aIdentifier), iExternalSources( aMemoryInUse )
+ {
+ }
+
+CSourceSelectionCheckBoxSettingItem::~CSourceSelectionCheckBoxSettingItem()
+ {
+ delete iSettingText;
+
+ if( iItemArray )
+ {
+ iItemArray->ResetAndDestroy();
+ delete iItemArray;
+ }
+ }
+
+void CSourceSelectionCheckBoxSettingItem::AddNewItemToArrayL(const TDesC& aLabel)
+ {
+ TBuf<64> buf;
+ buf.Copy(aLabel);
+
+ CSelectableItem* item = new(ELeave) CSelectableItem(buf, EFalse);
+ CleanupStack::PushL(item);
+ item->ConstructL();
+ iItemArray->AppendL(item); // Ownership is transferred
+ CleanupStack::Pop(); // item
+ }
+
+void CSourceSelectionCheckBoxSettingItem::CompleteConstructionL()
+ {
+ SetEmptyItemTextL(_L("Nothing selected"));
+
+ iItemArray = new(ELeave) CSelectionItemList(16);
+ AddNewItemToArrayL(_L("CPU"));
+ AddNewItemToArrayL(_L("RAM"));
+ AddNewItemToArrayL(_L("C:"));
+ AddNewItemToArrayL(_L("D:"));
+ AddNewItemToArrayL(_L("E:"));
+ AddNewItemToArrayL(_L("F:"));
+ AddNewItemToArrayL(_L("G:"));
+ AddNewItemToArrayL(_L("H:"));
+ AddNewItemToArrayL(_L("I:"));
+
+ __ASSERT_ALWAYS(ESourcesLength==iItemArray->Count(), User::Panic(_L("Src.mismatch"),443));
+ }
+
+// transfer settings to the variables defined in the constructor
+void CSourceSelectionCheckBoxSettingItem::StoreL()
+ {
+ for (TInt i=0; i<ESourcesLength; i++)
+ {
+ iExternalSources.iSrcEnabled[i] = iItemArray->At(i)->SelectionStatus();
+ }
+ }
+
+// load settings from the variables defined in the constructor to our internal variables
+void CSourceSelectionCheckBoxSettingItem::LoadL()
+ {
+ for (TInt i=0; i<ESourcesLength; i++)
+ {
+ iItemArray->At(i)->SetSelectionStatus( iExternalSources.iSrcEnabled[i] );
+ }
+ }
+
+// returns the text shown in the setting item list
+const TDesC& CSourceSelectionCheckBoxSettingItem::SettingTextL()
+ {
+ TBuf<32> settingText;
+
+ if (iItemArray->At(ESourceCPU)->SelectionStatus())
+ settingText.Append(_L("CPU "));
+ if (iItemArray->At(ESourceRAM)->SelectionStatus())
+ settingText.Append(_L("RAM "));
+ if (iItemArray->At(ESourceC)->SelectionStatus())
+ settingText.Append(_L("C: "));
+ if (iItemArray->At(ESourceD)->SelectionStatus())
+ settingText.Append(_L("D: "));
+ if (iItemArray->At(ESourceE)->SelectionStatus())
+ settingText.Append(_L("E: "));
+ if (iItemArray->At(ESourceF)->SelectionStatus())
+ settingText.Append(_L("F: "));
+ if (iItemArray->At(ESourceG)->SelectionStatus())
+ settingText.Append(_L("G: "));
+ if (iItemArray->At(ESourceH)->SelectionStatus())
+ settingText.Append(_L("H: "));
+ if (iItemArray->At(ESourceI)->SelectionStatus())
+ settingText.Append(_L("I: "));
+ settingText.TrimAll();
+
+ if (iSettingText)
+ {
+ delete iSettingText;
+ iSettingText = NULL;
+ }
+
+ iSettingText = HBufC::NewL(settingText.Length());
+ iSettingText->Des().Copy(settingText);
+
+ if ( iSettingText->Length() > 0 )
+ return *iSettingText;
+ else
+ return EmptyItemText();
+ }
+
+
+// launches the setting page
+void CSourceSelectionCheckBoxSettingItem::EditItemL(TBool /*aCalledFromMenu*/)
+ {
+ CSourceSelectionCheckBoxSettingPage* dlg = new(ELeave) CSourceSelectionCheckBoxSettingPage(SettingPageResourceId(), iItemArray);
+
+ SetSettingPage( dlg );
+ SettingPage()->SetSettingPageObserver(this);
+
+ SettingPage()->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
+ SetSettingPage(0); // it is deleted now
+ }
+
+
+// handles setting page events
+void CSourceSelectionCheckBoxSettingItem::HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType )
+ {
+ switch( aEventType )
+ {
+ case EEventSettingCancelled:
+ {
+ // If setting is cancelled, load old values
+ LoadL();
+ break;
+ }
+ case EEventSettingChanged:
+ {
+ // If setting has changed, update CBA visibility
+ static_cast<CSourceSelectionCheckBoxSettingPage*>( aSettingPage )->UpdateCba();
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ CAknSettingItem::HandleSettingPageEventL( aSettingPage, aEventType );
+ }
+
+// --------------------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------------------
+
+CSourceSelectionCheckBoxSettingPage::CSourceSelectionCheckBoxSettingPage(TInt aResourceID, CSelectionItemList* aItemArray )
+ : CAknCheckBoxSettingPage( aResourceID, aItemArray )
+ {
+ }
+
+void CSourceSelectionCheckBoxSettingPage::UpdateCba()
+ {
+ // Cache the pointer to button group container
+ CEikButtonGroupContainer* cba = Cba();
+ // Left softkey should be visible if there are items selected,
+ // i.e. the selection index array has items.
+ TBool visible( ListBoxControl()->View()->SelectionIndexes()->Count() > 0 );
+ // Resolve left softkey command id
+ TInt leftId( cba->ButtonGroup()->CommandId( 0 ) );
+ // Check if left softkey visibility has changed
+ if( visible != cba->IsCommandVisible( leftId ) )
+ {
+ // Left softkey visibility has changed, update it
+ cba->MakeCommandVisible( leftId, visible );
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------------------
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/src/perfmon_valuescontainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+// INCLUDE FILES
+#include "perfmon_valuescontainer.h"
+#include "perfmon.hrh"
+#include "perfmon_document.h"
+#include "perfmon_appui.h"
+#include "perfmon_model.h"
+
+#include <AknUtils.h>
+
+_LIT(KPercentageFormat,"%S %d%%");
+_LIT(KFreeFormat,"%S free %S%S");
+_LIT(KSizeFormat,"%S size %S%S");
+
+const TInt KLeftMargin = 2;
+
+
+// ===================================== MEMBER FUNCTIONS =====================================
+
+void CPerfMonValuesContainer::ConstructL(const TRect& aRect)
+ {
+ iModel = static_cast<CPerfMonDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
+ iFont = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont);
+
+ CreateWindowL();
+ SetRect(aRect);
+ SetBlank();
+
+ ActivateL();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+CPerfMonValuesContainer::~CPerfMonValuesContainer()
+ {
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonValuesContainer::Draw(const TRect& aRect) const
+ {
+ CWindowGc& gc = SystemGc();
+ gc.SetBrushColor(KRgbWhite);
+ gc.Clear(aRect);
+
+ // check if sample array has been constructed
+ if (iModel->SampleEntryArray())
+ {
+ // init font
+ gc.SetPenColor(KRgbBlack);
+ gc.UseFont( iFont );
+ TUint separator = iFont->HeightInPixels()-2;
+
+ TInt c(1);
+
+ // draw all entries
+ for (TInt i=0; i<iModel->SampleEntryArray()->Count(); i++)
+ {
+ // check if data available
+ if (iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0)
+ {
+ TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(0);
+
+ if (i == ESourceCPU) // for CPU draw %
+ {
+ TBuf<16> buf;
+ buf.Format(KPercentageFormat, &iModel->SampleEntryArray()->At(i).iDescription, currentSample.iSize > 0 ? TInt( (1 - ((TReal)(currentSample.iFree) / (TReal)currentSample.iSize)) * 100) : 0 );
+ gc.DrawText(buf, TPoint(KLeftMargin,separator*c));
+ c++;
+ }
+
+ else if (currentSample.iSize > 0) // ram+drives, ignore absent drives
+ {
+ TBuf<32> amountBuf;
+ amountBuf.AppendNum(currentSample.iFree, TRealFormat(KDefaultRealWidth, 0));
+
+ TBuf<32> buf;
+ buf.Format(KFreeFormat, &iModel->SampleEntryArray()->At(i).iDescription, &amountBuf, &iModel->SampleEntryArray()->At(i).iUnitTypeShort);
+ gc.DrawText(buf, TPoint(KLeftMargin,separator*c));
+ c++;
+
+ amountBuf.Copy(KNullDesC);
+ amountBuf.AppendNum(currentSample.iSize, TRealFormat(KDefaultRealWidth, 0));
+
+ buf.Format(KSizeFormat, &iModel->SampleEntryArray()->At(i).iDescription, &amountBuf, &iModel->SampleEntryArray()->At(i).iUnitTypeShort);
+ gc.DrawText(buf, TPoint(KLeftMargin,separator*c));
+ c++;
+ }
+ }
+ }
+
+ gc.DiscardFont();
+ }
+ }
+
+// --------------------------------------------------------------------------------------------
+
+TKeyResponse CPerfMonValuesContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
+ {
+ return CCoeControl::OfferKeyEventL(aKeyEvent, aType);
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonValuesContainer::HandleResourceChange(TInt aType)
+ {
+ if (aType == KEikDynamicLayoutVariantSwitch)
+ {
+ TRect mainPaneRect;
+ AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
+ SetRect(mainPaneRect);
+ }
+ else
+ CCoeControl::HandleResourceChange(aType);
+ }
+
+// --------------------------------------------------------------------------------------------
+
+void CPerfMonValuesContainer::DrawUpdate()
+ {
+ DrawDeferred();
+ }
+
+// --------------------------------------------------------------------------------------------
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perfmon/src/perfmon_valuesview.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "perfmon.hrh"
+#include "perfmon_valuesview.h"
+#include "perfmon_valuescontainer.h"
+#include "perfmon_document.h"
+#include "perfmon_model.h"
+#include <perfmon.rsg>
+
+#include <eikenv.h>
+#include <aknViewAppUi.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CPerfMonValuesView::ConstructL(const TRect& aRect)
+// EPOC two-phased constructor
+// ---------------------------------------------------------
+//
+void CPerfMonValuesView::ConstructL()
+ {
+ BaseConstructL( R_PERFMON_VIEW_VALUES );
+ iModel = static_cast<CPerfMonDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
+ }
+
+// ---------------------------------------------------------
+// CPerfMonValuesView::~CPerfMonValuesView()
+// ---------------------------------------------------------
+//
+CPerfMonValuesView::~CPerfMonValuesView()
+ {
+ if (iContainer)
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ }
+
+// ---------------------------------------------------------
+// TUid CPerfMonValuesView::Id()
+// ---------------------------------------------------------
+//
+TUid CPerfMonValuesView::Id() const
+ {
+ return KValuesViewUID;
+ }
+
+// ---------------------------------------------------------
+// TUid CPerfMonValuesView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
+// ---------------------------------------------------------
+//
+void CPerfMonValuesView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
+ {
+ AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane);
+ }
+
+
+// ---------------------------------------------------------
+// CPerfMonValuesView::HandleCommandL(TInt aCommand)
+// ---------------------------------------------------------
+//
+void CPerfMonValuesView::HandleCommandL(TInt aCommand)
+ {
+/*
+ switch ( aCommand )
+ {
+ case EPerfMonCmdFileBack:
+ {
+ iModel->FileUtils()->MoveUpOneLevelL();
+ break;
+ }
+
+ default:
+ {
+*/
+ AppUi()->HandleCommandL( aCommand );
+/*
+ break;
+ }
+ }
+*/
+ }
+
+// ---------------------------------------------------------
+// CPerfMonValuesView::HandleClientRectChange()
+// ---------------------------------------------------------
+//
+void CPerfMonValuesView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+ }
+
+// ---------------------------------------------------------
+// CPerfMonValuesView::DoActivateL(...)
+// ---------------------------------------------------------
+//
+void CPerfMonValuesView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ iContainer = new (ELeave) CPerfMonValuesContainer;
+ iModel->SetValuesContainer(iContainer);
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect() );
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+ }
+
+// ---------------------------------------------------------
+// CPerfMonValuesView::DoDeactivate()
+// ---------------------------------------------------------
+//
+void CPerfMonValuesView::DoDeactivate()
+ {
+ if (iContainer)
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ }
+
+// End of File
--- a/perfmon/symbian_version.hrh Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Symbian version configuration file
-*
-*/
-
-#ifndef __SYMBIAN_VERSION_HRH
-#define __SYMBIAN_VERSION_HRH
-
-// S60 and Symbian version number enumeration definitions
-
-#define S60_30 30
-#define S60_31 31
-#define S60_32 32
-#define S60_50 50
-#define S60_51 91
-#define S60_52 92
-#define SYMBIAN_1 50
-#define SYMBIAN_2 91
-#define SYMBIAN_3 92
-#define SYMBIAN_4 101
-
-
-/**
- * Defines the S60 or Symbian version used by this component. This flag can be
- * used to variate the source code based on the SDK in use. The value of the
- * flag should be always changed to reflect the current build environment.
- */
-#define SYMBIAN_VERSION_SUPPORT SYMBIAN_3
-
-
-#endif // __SYMBIAN_VERSION_HRH
--- a/perfmon/ui/avkon/group/bld.inf Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_MMPFILES
-perfmon.mmp
--- a/perfmon/ui/avkon/group/perfmon.mmp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-
-TARGET PerfMon.exe
-TARGETTYPE exe
-EPOCSTACKSIZE 0x5000
-EPOCHEAPSIZE 0x10000 0x1000000 // Min 64Kb, Max 16Mb
-
-UID 0x100039CE 0x20011385
-
-VENDORID VID_DEFAULT
-CAPABILITY WriteDeviceData
-
-SMPSAFE
-
-LANG SC
-
-
-START RESOURCE ../../../data/perfmon.rss
-HEADER
-TARGETPATH APP_RESOURCE_DIR
-END
-
-START RESOURCE ../../../data/perfmon_reg.rss
-DEPENDS perfmon.rsg
-TARGETPATH /private/10003a3f/import/apps
-END
-
-APP_LAYER_SYSTEMINCLUDE
-USERINCLUDE ../inc
-SOURCEPATH ../src
-
-SOURCE perfmon_app.cpp
-SOURCE perfmon_document.cpp
-SOURCE perfmon_appui.cpp
-SOURCE perfmon_model.cpp
-SOURCE perfmon_valuesview.cpp
-SOURCE perfmon_valuescontainer.cpp
-SOURCE perfmon_graphsview.cpp
-SOURCE perfmon_graphscontainer.cpp
-SOURCE perfmon_settingsviewdlg.cpp
-SOURCE perfmon_datapopupcontainer.cpp
-
-USERINCLUDE ../../../engine/inc
-SOURCEPATH ../../../engine/src
-SOURCE perfmon_engine.cpp
-SOURCE perfmon_powerlistener.cpp
-
-LIBRARY euser.lib
-LIBRARY commonengine.lib
-LIBRARY apparc.lib
-LIBRARY cone.lib
-LIBRARY eikcore.lib
-LIBRARY eikcoctl.lib
-LIBRARY eikdlg.lib
-LIBRARY avkon.lib
-LIBRARY ws32.lib
-LIBRARY apgrfx.lib
-LIBRARY efsrv.lib
-LIBRARY bafl.lib
-LIBRARY gdi.lib
-LIBRARY estor.lib
-LIBRARY centralrepository.lib
-LIBRARY HWRMPowerClient.lib
-
-// End of File
--- a/perfmon/ui/avkon/inc/perfmon_app.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_APP_H
-#define PERFMON_APP_H
-
-
-// INCLUDES
-#include <aknapp.h>
-
-// CONSTANTS
-// UID of the application
-const TUid KUidPerfMon = { 0x20011385 };
-
-// CLASS DECLARATION
-
-/**
-* CPerfMonApp application class.
-* Provides factory to create concrete document object.
-*
-*/
-class CPerfMonApp : public CAknApplication
- {
-
- public: // Functions from base classes
- /**
- * From CApaApplication, overridden to enable INI file support.
- * @return A pointer to the dictionary store
- */
- CDictionaryStore* OpenIniFileLC(RFs& aFs) const;
- private:
-
- /**
- * From CApaApplication, creates CPerfMonDocument document object.
- * @return A pointer to the created document object.
- */
- CApaDocument* CreateDocumentL();
-
- /**
- * From CApaApplication, returns application's UID (KUidPerfMon).
- * @return The value of KUidPerfMon.
- */
- TUid AppDllUid() const;
- };
-
-#endif
-
-// End of File
-
--- a/perfmon/ui/avkon/inc/perfmon_appui.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_APPUI_H
-#define PERFMON_APPUI_H
-
-// INCLUDES
-#include <eikapp.h>
-#include <eikdoc.h>
-#include <e32std.h>
-#include <coeccntx.h>
-#include <aknViewAppUi.h>
-#include <akntabgrp.h>
-#include <aknnavide.h>
-#include "perfmon_std.h"
-
-// FORWARD DECLARATIONS
-class CPerfMonModel;
-class CAknNavigationControlContainer;
-class CAknTabGroup;
-class CAknNavigationDecorator;
-
-
-// CLASS DECLARATIONS
-
-class CPerfMonAppUi : public CAknViewAppUi
- {
- public: // // Constructors and destructor
-
- void ConstructL();
-
- ~CPerfMonAppUi();
-
- public: // New functions
-
- private:
- // From MEikMenuObserver
- void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
-
- private:
- void HandleForegroundEventL(TBool aForeground);
-
- void HandleCommandL(TInt aCommand);
-
- void HandleResourceChangeL(TInt aType);
-
- virtual TKeyResponse HandleKeyEventL(
- const TKeyEvent& aKeyEvent,TEventCode aType);
-
- private: //Data
- CPerfMonModel* iModel;
- CAknNavigationControlContainer* iNaviPane;
- CAknTabGroup* iTabGroup;
- CAknNavigationDecorator* iDecoratedTabGroup;
- };
-
-#endif
-
-// End of File
--- a/perfmon/ui/avkon/inc/perfmon_datapopupcontainer.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_DATAPOPUPCONTAINER_H
-#define PERFMON_DATAPOPUPCONTAINER_H
-
-// INCLUDES
-#include <coecntrl.h>
-
-#include "perfmon_drawcallback.h"
-
-
-// FORWARD DECLARATIONS
-class CPerfMonModel;
-
-
-// CLASS DECLARATIONS
-
-class CPerfMonDataPopupContainer : public CCoeControl, public MDrawUpdateCallback
- {
-public:
- void ConstructL(const TRect& aRect);
- ~CPerfMonDataPopupContainer();
-
-protected:
- void Draw(const TRect& aRect) const;
- virtual void SizeChanged();
-
-public:
- void SetPositionAndSize();
- void UpdateVisibility(TBool aForeground=ETrue);
-
-public: // from MDrawUpdateCallback
- void DrawUpdate();
-
-private:
- CPerfMonModel* iModel;
- RWindowGroup iWindowGroup;
- const CFont* iFont;
- TInt iFontSize;
- };
-
-#endif
-
-// End of File
--- a/perfmon/ui/avkon/inc/perfmon_document.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_DOCUMENT_H
-#define PERFMON_DOCUMENT_H
-
-// INCLUDES
-#include <AknDoc.h>
-
-// CONSTANTS
-
-// FORWARD DECLARATIONS
-class CEikAppUi;
-class CPerfMonModel;
-
-
-// CLASS DECLARATION
-
-/**
-* CPerfMonDocument application class.
-*/
-class CPerfMonDocument : public CAknDocument
- {
- public: // Constructors and destructor
- static CPerfMonDocument* NewL(CEikApplication& aApp);
- virtual ~CPerfMonDocument();
-
- public: // New functions
-
- public: // from CEikDocument
- CFileStore* OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs);
- protected: // New functions
-
- protected: // Functions from base classes
-
- private:
-
- /**
- * EPOC default constructor.
- */
- CPerfMonDocument(CEikApplication& aApp);
- void ConstructL();
-
- private:
-
- /**
- * From CEikDocument, create CPerfMonAppUi "App UI" object.
- */
- CEikAppUi* CreateAppUiL();
-
- public:
- inline CPerfMonModel* Model() { return iModel; }
-
- private:
- CPerfMonModel* iModel;
-
- };
-
-#endif
-
-// End of File
-
--- a/perfmon/ui/avkon/inc/perfmon_drawcallback.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_DRAWCALLBACK_H
-#define PERFMON_DRAWCALLBACK_H
-
-class MDrawUpdateCallback
- {
-public:
- virtual void DrawUpdate() = 0;
- };
-
-#endif
-
-// End of File
-
--- a/perfmon/ui/avkon/inc/perfmon_graphscontainer.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_GRAPHSCONTAINER_H
-#define PERFMON_GRAPHSCONTAINER_H
-
-// INCLUDES
-#include <coecntrl.h>
-
-#include "perfmon_drawcallback.h"
-
-
-// FORWARD DECLARATIONS
-class CPerfMonModel;
-
-
-// CLASS DECLARATIONS
-
-class CPerfMonGraphsContainer : public CCoeControl, public MDrawUpdateCallback
- {
-public:
- void ConstructL(const TRect& aRect);
- ~CPerfMonGraphsContainer();
-
-private:
- void Draw(const TRect& aRect) const;
- void HandleResourceChange(TInt aType);
-
-public:
- TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/);
-
-public: // from MDrawUpdateCallback
- void DrawUpdate();
-
-private:
- CPerfMonModel* iModel;
- const CFont* iFont;
- };
-
-#endif
-
-// End of File
--- a/perfmon/ui/avkon/inc/perfmon_graphsview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_GRAPHSVIEW_H
-#define PERFMON_GRAPHSVIEW_H
-
-// INCLUDES
-#include <aknview.h>
-
-#include "perfmon_std.h"
-
-
-
-// CONSTANTS
-// UID of view
-const TUid KGraphsViewUID = {2};
-
-
-// FORWARD DECLARATIONS
-class CPerfMonGraphsContainer;
-class CPerfMonModel;
-
-
-// CLASS DECLARATION
-
-/**
-* CPerfMonGraphsView view class.
-*
-*/
-class CPerfMonGraphsView : public CAknView
- {
- public: // Constructors and destructor
- void ConstructL();
- ~CPerfMonGraphsView();
-
- public: // Functions from base classes
- TUid Id() const;
- void HandleCommandL(TInt aCommand);
- void HandleClientRectChange();
-
- private: // From MEikMenuObserver
- void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
-
- private: // From AknView
- void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage);
- void DoDeactivate();
-
- private: // Data
- CPerfMonGraphsContainer* iContainer;
- CPerfMonModel* iModel;
- };
-
-#endif
-
-// End of File
--- a/perfmon/ui/avkon/inc/perfmon_model.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_MODEL_H
-#define PERFMON_MODEL_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-#include <apgcli.h>
-#include <gdi.h>
-
-#include "perfmon_engine.h"
-
-// FORWARD DECLARATIONS
-class CPerfMonValuesContainer;
-class CPerfMonGraphsContainer;
-class CPerfMonDataPopupContainer;
-
-class CPerfMonModel : public CPerfMonEngine
- {
-private:
- enum TContainerDrawState
- {
- EDrawStateInvalid = -1,
- EDrawStateValues,
- EDrawStateGraphs
- };
-
-public:
- static CPerfMonModel* NewL();
- void ActivateModelL();
- void DeActivateModelL();
-
-private:
- void ConstructL();
- void SendDrawEventToContainersL();
- void HandleSettingsChangeL();
-
-public:
- void SetValuesContainer(CPerfMonValuesContainer* aValuesContainer);
- void SetGraphsContainer(CPerfMonGraphsContainer* aGraphsContainer);
- TInt LaunchSettingsDialogL();
- TInt SampleEntryPosToSettingPos(TInt aSampleEntryPos);
-
- inline CPerfMonValuesContainer* ValuesContainer() { return iValuesContainer; }
- inline CPerfMonGraphsContainer* GraphsContainer() { return iGraphsContainer; }
- inline CPerfMonDataPopupContainer* DataPopupContainer() { return iDataPopupContainer; }
-
-private:
- CPerfMonValuesContainer* iValuesContainer;
- CPerfMonGraphsContainer* iGraphsContainer;
- CPerfMonDataPopupContainer* iDataPopupContainer;
- TInt iDrawState;
- };
-
-
-#endif
--- a/perfmon/ui/avkon/inc/perfmon_settingsviewdlg.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_SETTINGSVIEWDLG_H
-#define PERFMON_SETTINGSVIEWDLG_H
-
-// INCLUDES
-#include <AknDialog.h>
-#include <eiklbo.h>
-#include <AknTabObserver.h>
-#include <akntabgrp.h>
-#include <aknsettingitemlist.h>
-#include <akncheckboxsettingpage.h>
-
-#include "perfmon_model.h"
-
-
-// FORWARD DECLARATIONS
-class CAknSettingItemArray;
-class CAknSettingStyleListBox;
-class CAknNavigationControlContainer;
-class CAknNavigationDecorator;
-class CAknTabGroup;
-class TPerfMonSettings;
-class CSelectionItemList;
-
-
-// CLASS DEFINITIONS
-
-class CPerfMonSettingsViewDlg : public CAknDialog, public MEikListBoxObserver, public MAknTabObserver
- {
-public:
- static CPerfMonSettingsViewDlg* NewL(TPerfMonSettings& aSettings);
- virtual ~CPerfMonSettingsViewDlg();
-
-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
- CPerfMonSettingsViewDlg(TPerfMonSettings& aSettings);
- void ConstructL();
-
-private: // Data
- CAknSettingItemArray* iSettingItemArray;
- CAknSettingStyleListBox* iListBox;
- CAknNavigationControlContainer* iNaviContainer;
- CAknNavigationDecorator* iDecoratedTabGroup;
- CAknTabGroup* iTabGroup;
- TPerfMonSettings& iSettings;
- };
-
-
-class CSourceSelectionCheckBoxSettingItem : public CAknSettingItem
- {
-public:
- CSourceSelectionCheckBoxSettingItem( TInt aIdentifier, TPerfMonSources& aMemoryInUse );
- virtual ~CSourceSelectionCheckBoxSettingItem();
-
-protected:
- void CompleteConstructionL();
- void StoreL();
- void LoadL();
- const TDesC& SettingTextL();
- void EditItemL( TBool aCalledFromMenu );
- void HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType );
-
-private:
- void AddNewItemToArrayL(const TDesC& aLabel);
-
-private:
- CSelectionItemList* iItemArray;
- HBufC* iSettingText;
- TPerfMonSources& iExternalSources;
- };
-
-
-class CSourceSelectionCheckBoxSettingPage : public CAknCheckBoxSettingPage
- {
- public:
- CSourceSelectionCheckBoxSettingPage( TInt aResourceID, CSelectionItemList* aItemArray );
- public: // New functions
- void UpdateCba();
- };
-
-
-#endif
-
-// End of File
-
--- a/perfmon/ui/avkon/inc/perfmon_std.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_STD_H
-#define PERFMON_STD_H
-
-
-
-#endif
-
-// End of File
-
--- a/perfmon/ui/avkon/inc/perfmon_valuescontainer.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_VALUESCONTAINER_H
-#define PERFMON_VALUESCONTAINER_H
-
-// INCLUDES
-#include <coecntrl.h>
-
-#include "perfmon_drawcallback.h"
-
-
-// FORWARD DECLARATIONS
-class CPerfMonModel;
-
-
-// CLASS DECLARATIONS
-
-class CPerfMonValuesContainer : public CCoeControl, public MDrawUpdateCallback
- {
-public:
- void ConstructL(const TRect& aRect);
- ~CPerfMonValuesContainer();
-
-private:
- void Draw(const TRect& aRect) const;
- void HandleResourceChange(TInt aType);
-
-public:
- TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/);
-
-public: // from MDrawUpdateCallback
- void DrawUpdate();
-
-private:
- CPerfMonModel* iModel;
- const CFont* iFont;
- };
-
-#endif
-
-// End of File
--- a/perfmon/ui/avkon/inc/perfmon_valuesview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef PERFMON_VALUESVIEW_H
-#define PERFMON_VALUESVIEW_H
-
-// INCLUDES
-#include <aknview.h>
-
-#include "perfmon_std.h"
-
-
-
-// CONSTANTS
-// UID of view
-const TUid KValuesViewUID = {1};
-
-
-// FORWARD DECLARATIONS
-class CPerfMonValuesContainer;
-class CPerfMonModel;
-
-
-// CLASS DECLARATION
-
-/**
-* CPerfMonValuesView view class.
-*
-*/
-class CPerfMonValuesView : public CAknView
- {
- public: // Constructors and destructor
- void ConstructL();
- ~CPerfMonValuesView();
-
- public: // Functions from base classes
- TUid Id() const;
- void HandleCommandL(TInt aCommand);
- void HandleClientRectChange();
-
- private: // From MEikMenuObserver
- void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
-
- private: // From AknView
- void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage);
- void DoDeactivate();
-
- private: // Data
- CPerfMonValuesContainer* iContainer;
- CPerfMonModel* iModel;
- };
-
-#endif
-
-// End of File
--- a/perfmon/ui/avkon/src/perfmon_app.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-// INCLUDE FILES
-#include "perfmon_app.h"
-#include "perfmon_document.h"
-
-#include <eikstart.h>
-
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------
-// CPerfMonApp::AppDllUid()
-// Returns application UID
-// ---------------------------------------------------------
-//
-TUid CPerfMonApp::AppDllUid() const
- {
- return KUidPerfMon;
- }
-
-// ---------------------------------------------------------
-// CDictionaryStore* CPerfMonApp::OpenIniFileLC(RFs& aFs) const
-// overrides CAknApplication::OpenIniFileLC to enable INI file support
-// ---------------------------------------------------------
-//
-CDictionaryStore* CPerfMonApp::OpenIniFileLC(RFs& aFs) const
- {
- return CEikApplication::OpenIniFileLC(aFs);
- }
-
-// ---------------------------------------------------------
-// CPerfMonApp::CreateDocumentL()
-// Creates CPerfMonDocument object
-// ---------------------------------------------------------
-//
-CApaDocument* CPerfMonApp::CreateDocumentL()
- {
- return CPerfMonDocument::NewL( *this );
- }
-
-// ================= OTHER EXPORTED FUNCTIONS ==============
-
-LOCAL_C CApaApplication* NewApplication()
- {
- return new CPerfMonApp;
- }
-
-
-GLDEF_C TInt E32Main()
- {
- return EikStart::RunApplication(NewApplication);
- }
-
-
-// End of File
-
--- a/perfmon/ui/avkon/src/perfmon_appui.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-// INCLUDE FILES
-#include "perfmon_appui.h"
-#include "perfmon_valuesview.h"
-#include "perfmon_graphsview.h"
-#include "perfmon_datapopupcontainer.h"
-#include "perfmon.hrh"
-#include "perfmon_model.h"
-#include "perfmon_document.h"
-#include <perfmon.rsg>
-
-#include <avkon.hrh>
-#include <AknQueryDialog.h>
-#include <aknmessagequerydialog.h>
-
-
-// ================= MEMBER FUNCTIONS =======================
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonAppUi::ConstructL()
- {
- // disable window server priority control for this application
- iEikonEnv->WsSession().ComputeMode( RWsSession::EPriorityControlDisabled );
-
- // set as system application to prevent getting shut down events
- iEikonEnv->SetSystem(ETrue);
-
- BaseConstructL(EAknEnableSkin);
-
- iModel = static_cast<CPerfMonDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
-
- // Show tabs for main views from resources
- CEikStatusPane* sp = StatusPane();
-
- // Fetch pointer to the default navi pane control
- iNaviPane = (CAknNavigationControlContainer*)sp->ControlL(
- TUid::Uid(EEikStatusPaneUidNavi));
-
- // Tabgroup has been read from resource and it were pushed to the navi pane.
- // Get pointer to the navigation decorator with the ResourceDecorator() function.
- // Application owns the decorator and it has responsibility to delete the object.
- iDecoratedTabGroup = iNaviPane->ResourceDecorator();
- if (iDecoratedTabGroup)
- {
- iTabGroup = (CAknTabGroup*) iDecoratedTabGroup->DecoratedControl();
- }
-
- CPerfMonValuesView* valuesView = new(ELeave) CPerfMonValuesView;
- CleanupStack::PushL(valuesView);
- valuesView->ConstructL();
- AddViewL(valuesView); // transfer ownership to CAknViewAppUi
- CleanupStack::Pop(); // valuesView
-
- CPerfMonGraphsView* graphsView = new(ELeave) CPerfMonGraphsView;
- CleanupStack::PushL(graphsView);
- graphsView->ConstructL();
- AddViewL(graphsView); // transfer ownership to CAknViewAppUi
- CleanupStack::Pop(); // graphsView
-
- // set the default view
- SetDefaultViewL(*valuesView);
-
- // notify the model that everything has been constructed
- iModel->ActivateModelL();
- }
-
-// --------------------------------------------------------------------------------------------
-
-CPerfMonAppUi::~CPerfMonAppUi()
- {
- // notify the model that the application is closing
- if (iModel)
- TRAP_IGNORE(iModel->DeActivateModelL());
-
- delete iDecoratedTabGroup;
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
- {
- if (aResourceId == R_PERFMON_APP_MENU)
- {
- aMenuPane->SetItemDimmed(EPerfMonCmdEnableLogging, iModel->Settings().iLoggingEnabled);
- aMenuPane->SetItemDimmed(EPerfMonCmdDisableLogging, !iModel->Settings().iLoggingEnabled);
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-TKeyResponse CPerfMonAppUi::HandleKeyEventL(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 );
- ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
- }
- break;
- case EKeyRightArrow:
- if((active + 1) < count)
- {
- active++;
- iTabGroup->SetActiveTabByIndex( active );
- ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
- }
- break;
- default:
- return EKeyWasNotConsumed;
- }
-
- return EKeyWasConsumed;
- }
-
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonAppUi::HandleCommandL(TInt aCommand)
- {
- switch ( aCommand )
- {
- case EPerfMonCmdEnableLogging:
- {
- iModel->EnableLogging(ETrue);
- break;
- }
-
- case EPerfMonCmdDisableLogging:
- {
- iModel->EnableLogging(EFalse);
- break;
- }
-
- case EPerfMonCmdSettings:
- {
- if (iModel->LaunchSettingsDialogL() == EAknCmdExit)
- Exit();
- break;
- }
-
- case EPerfMonCmdAbout:
- {
- CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog;
- dialog->ExecuteLD(R_PERFMON_ABOUT_DIALOG);
- }
- break;
-
- // a normal way to close an application
- case EAknCmdExit:
- case EEikCmdExit:
- case EAknSoftkeyExit:
- {
- Exit();
- }
- break;
-
- default:
- break;
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonAppUi::HandleForegroundEventL(TBool aForeground)
- {
- // handle visibility of the data popup container
- if (iModel && iModel->DataPopupContainer())
- {
- iModel->DataPopupContainer()->UpdateVisibility(aForeground);
- }
-
- // call the base class
- CAknAppUi::HandleForegroundEventL(aForeground);
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonAppUi::HandleResourceChangeL(TInt aType)
- {
- CAknAppUi::HandleResourceChangeL(aType);
-
- // update size of the data popup container (implemented here because data popup container
- // does not get HandleResourceChangeL events)
- if (aType == KEikDynamicLayoutVariantSwitch)
- {
- if (iModel)
- {
- if (iModel->DataPopupContainer())
- {
- iModel->DataPopupContainer()->SetPositionAndSize();
- }
-
- }
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-// End of File
--- a/perfmon/ui/avkon/src/perfmon_datapopupcontainer.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-// INCLUDE FILES
-#include "perfmon_datapopupcontainer.h"
-#include "perfmon.hrh"
-#include "perfmon_document.h"
-#include "perfmon_appui.h"
-#include "perfmon_model.h"
-
-#include <AknUtils.h>
-
-_LIT(KFreeFormat,"%S free %S%S");
-
-const TInt KLeftMargin = 2;
-const TInt KPopupWidth = 94;
-const TInt KCPUExtraLength = 8;
-const TInt KPopupExtraSpaceBig = 15;
-const TInt KPopupExtraSpace = 3;
-
-
-// ===================================== MEMBER FUNCTIONS =====================================
-
-void CPerfMonDataPopupContainer::ConstructL(const TRect& /*aRect*/)
- {
- iModel = static_cast<CPerfMonDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
- iFont = LatinPlain12();
- iFontSize = iFont->FontMaxHeight();
-
- // set windowgroup so that it always on top and does not receive focus
- iWindowGroup = RWindowGroup(iCoeEnv->WsSession());
- User::LeaveIfError(iWindowGroup.Construct((TUint32)&iWindowGroup));
- iWindowGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
- iWindowGroup.EnableReceiptOfFocus(EFalse);
-
- CreateWindowL(&iWindowGroup);
- //SetRect(aRect);
- SetPositionAndSize();
- SetBlank();
-
- ActivateL();
- }
-
-// --------------------------------------------------------------------------------------------
-
-CPerfMonDataPopupContainer::~CPerfMonDataPopupContainer()
- {
- iWindowGroup.Close();
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonDataPopupContainer::Draw(const TRect& aRect) const
- {
- CWindowGc& gc = SystemGc();
- gc.SetBrushColor(KRgbWhite);
- gc.Clear(aRect);
-
- // check if sample array has been constructed
- if (iModel->SampleEntryArray())
- {
- // init font
- gc.SetPenColor(KRgbBlack);
- gc.UseFont( iFont );
-
- // draw a rect around the popup
- gc.DrawRect(aRect);
-
- TInt posCounter(1);
-
- // draw CPU % if enabled
- if (iModel->Settings().iDataPopupSources.iSrcEnabled[ESourceCPU])
- {
- TBuf<64> cpuText;
- cpuText.Copy(_L("CPU: "));
-
- // loop all CPUs
- for (TInt i=iModel->CPU0PositionInSamples(); i<iModel->CPU0PositionInSamples()+iModel->AmountOfCPUs(); i++)
- {
- // check samples available
- if (iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0)
- {
- TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(0);
-
- // append % value
- cpuText.AppendNum( currentSample.iSize > 0 ? TInt( (1 - ((TReal)(currentSample.iFree) / (TReal)currentSample.iSize)) * 100) : 0 );
- cpuText.Append(_L("% "));
- }
- }
-
- gc.DrawText(cpuText, TPoint(KLeftMargin, iFontSize*posCounter));
- posCounter++;
- }
-
- // draw RAM and Drive values
- for (TInt i=iModel->RAMPositionInSamples(); i<iModel->PowerPositionInSamples(); i++)
- {
- // check if this setting has been enabled and it has some data
- if (iModel->Settings().iDataPopupSources.iSrcEnabled[ESourceRAM + i - iModel->RAMPositionInSamples()] && iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0)
- {
- TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(0);
-
- TBuf<32> freeBuf;
- freeBuf.AppendNum(currentSample.iFree, TRealFormat(KDefaultRealWidth, 0));
-
- TBuf<32> buf;
- buf.Format(KFreeFormat, &iModel->SampleEntryArray()->At(i).iDescription, &freeBuf, &iModel->SampleEntryArray()->At(i).iUnitTypeShort);
- gc.DrawText(buf, TPoint(KLeftMargin, iFontSize*posCounter));
-
- posCounter++;
- }
- }
-
- // draw power value
- // check if this setting has been enabled and it has some data
- if (iModel->Settings().iDataPopupSources.iSrcEnabled[ESourcePwr] && iModel->SampleEntryArray()->At(iModel->PowerPositionInSamples()).iSampleDataArray->Count() > 0)
- {
- TSampleData& currentSample = iModel->SampleEntryArray()->At(iModel->PowerPositionInSamples()).iSampleDataArray->At(0);
-
- TBuf<32> powerText;
- powerText.Copy(_L("Power "));
-
- powerText.AppendNum(currentSample.iSize - currentSample.iFree, TRealFormat(KDefaultRealWidth, 0));
- powerText.AppendFormat(_L("%S"), &iModel->SampleEntryArray()->At(iModel->PowerPositionInSamples()).iUnitTypeShort);
-
- gc.DrawText(powerText, TPoint(KLeftMargin,iFontSize*posCounter));
-
- posCounter++;
- }
-
- gc.DiscardFont();
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonDataPopupContainer::SizeChanged()
- {
- DrawNow();
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonDataPopupContainer::SetPositionAndSize()
- {
- CWsScreenDevice* screenDevice = iEikonEnv->ScreenDevice();
-
- const TInt popupWidth = iModel->AmountOfCPUs() * KCPUExtraLength + KPopupWidth;
-
- // top right
- if (iModel->Settings().iDataPopupLocation == EDataPopupLocationTopRight)
- {
- // screen orientation is landscape with softkeys on right
- if (AknLayoutUtils::CbaLocation()==AknLayoutUtils::EAknCbaLocationRight)
- {
- SetRect(
- TRect(
- screenDevice->SizeInPixels().iWidth-popupWidth-KPopupExtraSpaceBig,
- 0,
- screenDevice->SizeInPixels().iWidth-KPopupExtraSpaceBig,
- iModel->Settings().iDataPopupSources.EnabledSourcesCount()*iFontSize + KPopupExtraSpace
- ));
- }
-
- // any other orientation
- else
- {
- SetRect(
- TRect(
- screenDevice->SizeInPixels().iWidth-popupWidth,
- 0,
- screenDevice->SizeInPixels().iWidth,
- iModel->Settings().iDataPopupSources.EnabledSourcesCount()*iFontSize + KPopupExtraSpace
- ));
- }
- }
-
- // bottom middle
- else if (iModel->Settings().iDataPopupLocation == EDataPopupLocationBottomMiddle)
- {
- SetRect(
- TRect(
- screenDevice->SizeInPixels().iWidth/2-popupWidth/2,
- screenDevice->SizeInPixels().iHeight - iModel->Settings().iDataPopupSources.EnabledSourcesCount()*iFontSize - KPopupExtraSpace,
- screenDevice->SizeInPixels().iWidth/2+popupWidth/2,
- screenDevice->SizeInPixels().iHeight
- ));
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonDataPopupContainer::UpdateVisibility(TBool aForeground)
- {
- // application has been brought to foregound
- if (aForeground)
- {
- if (iModel->Settings().iDataPopupVisibility==EDataPopupVisbilityAlwaysOn)
- {
- MakeVisible(ETrue);
- }
- else
- {
- MakeVisible(EFalse);
- }
- }
-
- // application has been sent to background
- else
- {
- if (iModel->Settings().iDataPopupVisibility==EDataPopupVisbilityAlwaysOn
- || iModel->Settings().iDataPopupVisibility==EDataPopupVisbilityBackgroundOnly)
- {
- MakeVisible(ETrue);
- }
- else
- {
- MakeVisible(EFalse);
- }
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonDataPopupContainer::DrawUpdate()
- {
- DrawDeferred();
- }
-
-// --------------------------------------------------------------------------------------------
-
-// End of File
--- a/perfmon/ui/avkon/src/perfmon_document.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-// INCLUDE FILES
-#include "perfmon_document.h"
-#include "perfmon_appui.h"
-#include "perfmon_model.h"
-
-// ================= MEMBER FUNCTIONS =======================
-
-// constructor
-CPerfMonDocument::CPerfMonDocument(CEikApplication& aApp)
-: CAknDocument(aApp)
- {
- }
-
-// ----------------------------------------------------
-
-// destructor
-CPerfMonDocument::~CPerfMonDocument()
- {
- delete iModel;
- }
-
-// ----------------------------------------------------
-
-// EPOC default constructor can leave.
-void CPerfMonDocument::ConstructL()
- {
- iModel = CPerfMonModel::NewL();
- }
-
-// ----------------------------------------------------
-
-// Two-phased constructor.
-CPerfMonDocument* CPerfMonDocument::NewL(CEikApplication& aApp)
- {
- CPerfMonDocument* self = new(ELeave) CPerfMonDocument(aApp);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
-
- return self;
- }
-
-// ----------------------------------------------------
-// CPerfMonDocument::CreateAppUiL()
-// constructs CPerfMonAppUi
-// ----------------------------------------------------
-//
-CEikAppUi* CPerfMonDocument::CreateAppUiL()
- {
- return new (ELeave) CPerfMonAppUi;
- }
-
-// ----------------------------------------------------
-// CPerfMonDocument::OpenFileL
-// Overrides CAknDocument::OpenFileL to support document file
-// ----------------------------------------------------
-//
-CFileStore* CPerfMonDocument::OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs)
- {
- return CEikDocument::OpenFileL(aDoOpen, aFilename, aFs);
- }
-
-// ----------------------------------------------------
-
-// End of File
--- a/perfmon/ui/avkon/src/perfmon_graphscontainer.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-// INCLUDE FILES
-#include "perfmon_graphscontainer.h"
-#include "perfmon.hrh"
-#include "perfmon_document.h"
-#include "perfmon_appui.h"
-#include "perfmon_model.h"
-
-#include <AknUtils.h>
-
-const TInt KAmountOfMicroSecondsFitsScreen = 20 * 1000000;
-#define KRgbCustomGrey TRgb(0x808080)
-
-_LIT(K100p, "100%");
-_LIT(K50p, "50%");
-_LIT(K0p, "0%");
-
-_LIT(KPercentageFormat,"%S %d%%");
-
-const TInt KMicroToSecondMultiplier = 1000000;
-
-// ===================================== MEMBER FUNCTIONS =====================================
-
-void CPerfMonGraphsContainer::ConstructL(const TRect& aRect)
- {
- iModel = static_cast<CPerfMonDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
- //iFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont);
- iFont = LatinBold12();
-
- CreateWindowL();
- SetRect(aRect);
- SetBlank();
-
- ActivateL();
- }
-
-// --------------------------------------------------------------------------------------------
-
-CPerfMonGraphsContainer::~CPerfMonGraphsContainer()
- {
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonGraphsContainer::Draw(const TRect& aRect) const
- {
- // draw black background
- CWindowGc& gc = SystemGc();
- gc.SetBrushColor(KRgbBlack);
- gc.Clear(aRect);
-
- // activate font and get size
- gc.UseFont(iFont);
- TUint fontSize = iFont->FontMaxHeight();
- //TInt fontBaseOffset = iFont->DescentInPixels();
-
-
- // calculate time factor
- TReal scaleFactor = (TReal) aRect.Width() / (TReal) KAmountOfMicroSecondsFitsScreen;
-
- // calculate area height which is used to draw the grpahs
- TInt drawAreaHeight = aRect.Height() - fontSize - fontSize;
-
-
- // check if sample array has been constructed
- if (iModel->SampleEntryArray())
- {
-
- // draw vertical time lines first
- TInt verticalBarPeriodInSecs = iModel->Settings().iGraphsVerticalBarPeriod;
-
- if (verticalBarPeriodInSecs >= 1 && iModel->SampleEntryArray()->At(0).iSampleDataArray->Count() > 0)
- {
- // get time from the first sample
- TSampleData& firstSample = iModel->SampleEntryArray()->At(0).iSampleDataArray->At(0);
- TInt64 currentMicroSeconds = firstSample.iTimeFromStart.Int64();
-
- // calculate amount of microseconds exceeding value by using the modulo operator
- TInt remainderInMicroSeconds = currentMicroSeconds % (verticalBarPeriodInSecs * 1000000);
-
- // calculate first x pos
- TInt vbarXpos = aRect.Width() - (remainderInMicroSeconds * scaleFactor);
-
- // calculate the amount in seconds
- TInt barSeconds = (currentMicroSeconds - remainderInMicroSeconds) / KMicroToSecondMultiplier;
-
-
- // continue drawing periodically the vertical lines
- while (vbarXpos >= 0 && barSeconds >= 0)
- {
- // draw vertical line
- gc.SetPenColor(KRgbDarkRed);
- gc.DrawLine(TPoint(vbarXpos,fontSize+1), TPoint(vbarXpos,aRect.Height()-fontSize));
-
- // draw seconds value
- gc.SetPenColor(KRgbCustomGrey);
- TBuf<16> secsBuf;
- secsBuf.AppendNum(barSeconds);
- secsBuf.Append(_L("s"));
- gc.DrawText(secsBuf, TPoint(vbarXpos-(iFont->TextWidthInPixels(secsBuf)/2), aRect.Height()));
-
- // calculate new position
- vbarXpos -= verticalBarPeriodInSecs * 1000000 * scaleFactor;
- barSeconds -= verticalBarPeriodInSecs;
- }
- }
-
- // draw the basic grid
- gc.SetPenColor(KRgbCustomGrey);
-
- gc.DrawLine(TPoint(0,fontSize), TPoint(aRect.Width(),fontSize)); // upper line
- gc.DrawText(K100p, TPoint(0,fontSize));
-
- gc.DrawLine(TPoint(0,aRect.Height()/2), TPoint(aRect.Width(),aRect.Height()/2)); // mid line
- gc.DrawText(K50p, TPoint(0,aRect.Height()/2));
-
- gc.DrawLine(TPoint(0,aRect.Height()-fontSize), TPoint(aRect.Width(),aRect.Height()-fontSize)); // bottom line
- gc.DrawText(K0p, TPoint(0,aRect.Height()-fontSize));
-
- TInt c(0);
-
- // draw graphs for each sampled type
- for (TInt i=0; i<iModel->SampleEntryArray()->Count(); i++)
- {
- // check if this setting has been enabled and it has some data
- if (iModel->Settings().iGraphsSources.iSrcEnabled[iModel->SampleEntryPosToSettingPos(i)] && iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0)
- {
- // set pen color for the graph
- gc.SetPenColor(iModel->SampleEntryArray()->At(i).iGraphColor);
-
- // remember the position where drawing started
- /*TReal*/TInt currentXPos(aRect.Width()); // start drawing from right
- /*TReal*/TInt currentYPos(0);
-
- // draw samples
- for (TInt j=0; j<iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() - 1; j++)
- {
- TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(j);
- TSampleData& previousSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(j+1);
-
- // calculate X position for previous (j+1)
- /*TReal*/TInt previousXPos = currentXPos -
- ( (Abs(previousSample.iTimeFromStart.Int64() - currentSample.iTimeFromStart.Int64())) * scaleFactor );
-
-
- // calculate initial Y position
- if (j==0)
- {
- currentYPos = currentSample.iSize > 0 ? (TReal)(currentSample.iFree) / (TReal)currentSample.iSize * drawAreaHeight + fontSize : aRect.Height()-fontSize;
- }
-
- // calculate Y position for previous (j+1)
- /*TReal*/TInt previousYPos = previousSample.iSize > 0 ? (TReal)(previousSample.iFree) / (TReal)previousSample.iSize * drawAreaHeight + fontSize : aRect.Height()-fontSize;
-
-
- // draw a line between the previous and current
- gc.DrawLine(TPoint((TInt)previousXPos,(TInt)previousYPos), TPoint((TInt)currentXPos,(TInt)currentYPos));
-
-
- // draw current value in %
- if (j==0) // draw the value of first sample
- {
- TBuf<16> buf;
- buf.Format(KPercentageFormat, &iModel->SampleEntryArray()->At(i).iDescription, currentSample.iSize > 0 ? TInt( (1 - ((TReal)(currentSample.iFree) / (TReal)currentSample.iSize)) * 100) : 0 );
-
- gc.DrawText(buf, TPoint(0,fontSize+fontSize+c*fontSize));
- c++;
- }
-
-
- // stop drawing if we have run out of space
- if (previousXPos < 0)
- break;
-
- // remeber previous values
- currentXPos = previousXPos;
- currentYPos = previousYPos;
- }
- }
- }
- }
-
- gc.DiscardFont();
- }
-
-// --------------------------------------------------------------------------------------------
-
-TKeyResponse CPerfMonGraphsContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
- {
- return CCoeControl::OfferKeyEventL(aKeyEvent, aType);
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonGraphsContainer::HandleResourceChange(TInt aType)
- {
- if (aType == KEikDynamicLayoutVariantSwitch)
- {
- TRect mainPaneRect;
- AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
- SetRect(mainPaneRect);
- }
- else
- CCoeControl::HandleResourceChange(aType);
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonGraphsContainer::DrawUpdate()
- {
- DrawDeferred();
- }
-
-// --------------------------------------------------------------------------------------------
-
-// End of File
--- a/perfmon/ui/avkon/src/perfmon_graphsview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-// INCLUDE FILES
-#include "perfmon.hrh"
-#include "perfmon_graphsview.h"
-#include "perfmon_graphscontainer.h"
-#include "perfmon_document.h"
-#include "perfmon_model.h"
-#include <perfmon.rsg>
-
-#include <eikenv.h>
-#include <aknViewAppUi.h>
-
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------
-// CPerfMonGraphsView::ConstructL(const TRect& aRect)
-// EPOC two-phased constructor
-// ---------------------------------------------------------
-//
-void CPerfMonGraphsView::ConstructL()
- {
- BaseConstructL( R_PERFMON_VIEW_GRAPHS );
- iModel = static_cast<CPerfMonDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
- }
-
-// ---------------------------------------------------------
-// CPerfMonGraphsView::~CPerfMonGraphsView()
-// ---------------------------------------------------------
-//
-CPerfMonGraphsView::~CPerfMonGraphsView()
- {
- if (iContainer)
- {
- AppUi()->RemoveFromViewStack( *this, iContainer );
- delete iContainer;
- iContainer = NULL;
- }
- }
-
-// ---------------------------------------------------------
-// TUid CPerfMonGraphsView::Id()
-// ---------------------------------------------------------
-//
-TUid CPerfMonGraphsView::Id() const
- {
- return KGraphsViewUID;
- }
-
-// ---------------------------------------------------------
-// TUid CPerfMonGraphsView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
-// ---------------------------------------------------------
-//
-void CPerfMonGraphsView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
- {
- AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane);
- }
-
-
-// ---------------------------------------------------------
-// CPerfMonGraphsView::HandleCommandL(TInt aCommand)
-// ---------------------------------------------------------
-//
-void CPerfMonGraphsView::HandleCommandL(TInt aCommand)
- {
-/*
- switch ( aCommand )
- {
- case EPerfMonCmdFileBack:
- {
- iModel->FileUtils()->MoveUpOneLevelL();
- break;
- }
-
- default:
- {
-*/
- AppUi()->HandleCommandL( aCommand );
-/*
- break;
- }
- }
-*/
- }
-
-// ---------------------------------------------------------
-// CPerfMonGraphsView::HandleClientRectChange()
-// ---------------------------------------------------------
-//
-void CPerfMonGraphsView::HandleClientRectChange()
- {
- if ( iContainer )
- {
- iContainer->SetRect( ClientRect() );
- }
- }
-
-// ---------------------------------------------------------
-// CPerfMonGraphsView::DoActivateL(...)
-// ---------------------------------------------------------
-//
-void CPerfMonGraphsView::DoActivateL(
- const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
- const TDesC8& /*aCustomMessage*/)
- {
- if (!iContainer)
- {
- iContainer = new (ELeave) CPerfMonGraphsContainer;
- iModel->SetGraphsContainer(iContainer);
- iContainer->SetMopParent(this);
- iContainer->ConstructL( ClientRect() );
- AppUi()->AddToStackL( *this, iContainer );
- }
- }
-
-// ---------------------------------------------------------
-// CPerfMonGraphsView::DoDeactivate()
-// ---------------------------------------------------------
-//
-void CPerfMonGraphsView::DoDeactivate()
- {
- if (iContainer)
- {
- AppUi()->RemoveFromViewStack( *this, iContainer );
- delete iContainer;
- iContainer = NULL;
- }
- }
-
-// End of File
--- a/perfmon/ui/avkon/src/perfmon_model.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-// INCLUDE FILES
-
-#include "perfmon_model.h"
-#include "perfmon_app.h"
-#include "perfmon_settingsviewdlg.h"
-#include "perfmon.hrh"
-#include "perfmon_valuescontainer.h"
-#include "perfmon_graphscontainer.h"
-#include "perfmon_datapopupcontainer.h"
-#include <perfmon.rsg>
-
-#include <coeutils.h>
-#include <bautils.h>
-#include <eikenv.h>
-#include <e32hal.h>
-#include <u32std.h>
-#include <s32file.h>
-#include <akntitle.h>
-#include <eikspane.h>
-#include <aknnotewrappers.h>
-
-_LIT(KAppName, "PerfMon");
-
-// ===================================== MEMBER FUNCTIONS =====================================
-
-CPerfMonModel* CPerfMonModel::NewL()
- {
- CPerfMonModel* self = new(ELeave) CPerfMonModel;
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonModel::ConstructL()
- {
- iDrawState = EDrawStateInvalid;
- CPerfMonEngine::ConstructL();
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonModel::ActivateModelL()
- {
- // initialize the data popup container in top-right corner
- iDataPopupContainer = new(ELeave) CPerfMonDataPopupContainer;
- iDataPopupContainer->ConstructL(TRect(0,0,1,1));
-
- ActivateEngineL();
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonModel::DeActivateModelL()
- {
- DeActivateEngineL();
-
- if (iDataPopupContainer)
- {
- delete iDataPopupContainer;
- iDataPopupContainer = NULL;
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonModel::SetValuesContainer(CPerfMonValuesContainer* aContainer)
- {
- iValuesContainer = aContainer;
- iDrawState = EDrawStateValues;
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonModel::SetGraphsContainer(CPerfMonGraphsContainer* aContainer)
- {
- iGraphsContainer = aContainer;
- iDrawState = EDrawStateGraphs;
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonModel::SendDrawEventToContainersL()
- {
- if (iDrawState == EDrawStateValues && iValuesContainer)
- iValuesContainer->DrawUpdate();
- else if (iDrawState == EDrawStateGraphs && iGraphsContainer)
- iGraphsContainer->DrawUpdate();
-
- if (iDataPopupContainer)
- iDataPopupContainer->DrawUpdate();
- }
-
-void CPerfMonModel::HandleSettingsChangeL()
- {
- // set visibility and location of the data popup
- iDataPopupContainer->UpdateVisibility();
- iDataPopupContainer->SetPositionAndSize();
- CPerfMonEngine::HandleSettingsChangeL();
- }
-
-// --------------------------------------------------------------------------------------------
-
-TInt CPerfMonModel::LaunchSettingsDialogL()
- {
- // launch the settings dialog
- TPerfMonSettings newSettings = iSettings;
-
- CPerfMonSettingsViewDlg* dlg = CPerfMonSettingsViewDlg::NewL(newSettings);
- TInt returnValue = dlg->ExecuteLD(R_PERFMON_SETTINGS_DIALOG);
-
- // always save settings since the settings dialog does not provide a possibility to cancel
- iSettings = newSettings;
- SaveSettingsL();
- HandleSettingsChangeL();
-
- // make sure that the title of the application is correct
- CEikStatusPane* sp = iEnv->AppUiFactory()->StatusPane();
- CAknTitlePane* tp = static_cast<CAknTitlePane*>( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
- tp->SetTextL(KAppName);
-
- return returnValue;
- }
-
-// ---------------------------------------------------------------------------
-
-TInt CPerfMonModel::SampleEntryPosToSettingPos(TInt aSampleEntryPos)
- {
- TInt settingPos(0); // return position of aSampleEntryPos in settings
-
- if (aSampleEntryPos >= iCPU0PositionInSamples && aSampleEntryPos < iRAMPositionInSamples)
- {
- settingPos = ESourceCPU;
- }
- else if (aSampleEntryPos == iRAMPositionInSamples)
- {
- settingPos = ESourceRAM;
- }
- else
- {
- settingPos = ESourceC + (aSampleEntryPos-iCDrivePositionInSamples);
- }
-
- return settingPos;
- }
-
-// ---------------------------------------------------------------------------
-
-// End of File
--- a/perfmon/ui/avkon/src/perfmon_settingsviewdlg.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,702 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-// INCLUDE FILES
-#include "perfmon_settingsviewdlg.h"
-#include "perfmon_model.h"
-#include "perfmon.hrh"
-#include "perfmon_std.h"
-#include "perfmon_powerlistener.h"
-#include <perfmon.rsg>
-
-#include <aknsettingitemlist.h>
-#include <CAknMemorySelectionSettingItem.h>
-#include <aknlists.h>
-#include <akntitle.h>
-#include <aknnavi.h>
-#include <aknnavide.h>
-#include <StringLoader.h>
-#include <aknnotewrappers.h>
-
-// ===================================== MEMBER FUNCTIONS =====================================
-
-CPerfMonSettingsViewDlg* CPerfMonSettingsViewDlg::NewL(TPerfMonSettings& aSettings)
- {
- CPerfMonSettingsViewDlg* self = new(ELeave) CPerfMonSettingsViewDlg(aSettings);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// --------------------------------------------------------------------------------------------
-
-CPerfMonSettingsViewDlg::~CPerfMonSettingsViewDlg()
- {
- // restore default navi pane by popping the tab group from stack
- if (iNaviContainer)
- iNaviContainer->Pop();
-
- if (iSettingItemArray)
- {
- iSettingItemArray->ResetAndDestroy();
- delete iSettingItemArray;
- }
-
- delete iDecoratedTabGroup;
- }
-
-// --------------------------------------------------------------------------------------------
-
-CPerfMonSettingsViewDlg::CPerfMonSettingsViewDlg(TPerfMonSettings& aSettings) : iSettings(aSettings)
- {
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonSettingsViewDlg::ConstructL()
- {
- // construct a menu bar
- CAknDialog::ConstructL(R_PERFMON_SETTINGS_MENUBAR);
-
- // get pointer to status pane
- CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane();
-
- // set title text
- CAknTitlePane* tp = static_cast<CAknTitlePane*>( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
- tp->SetTextL( _L("Settings") );
-
- // create a new tab group
- iNaviContainer = static_cast<CAknNavigationControlContainer*>(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi)));
- iDecoratedTabGroup = iNaviContainer->CreateTabGroupL(this);
- iTabGroup = static_cast<CAknTabGroup*>(iDecoratedTabGroup->DecoratedControl());
- iTabGroup->SetTabFixedWidthL(KTabWidthWithTwoLongTabs);
-
- // add tabs
- iTabGroup->AddTabL(ETabSettingsGeneral, _L("General"));
- iTabGroup->AddTabL(ETabSettingsDataPopup, _L("Data popup"));
- iTabGroup->AddTabL(ETabSettingsGraphs, _L("Graphs"));
- iTabGroup->AddTabL(ETabSettingsLogging, _L("Logging"));
- iTabGroup->SetActiveTabByIndex(ETabSettingsGeneral);
-
- // add new tab group to stack
- iNaviContainer->PushL( *iDecoratedTabGroup );
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonSettingsViewDlg::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
- {
- switch (aEventType)
- {
- case EEventEnterKeyPressed:
- case EEventItemDoubleClicked:
- ShowSettingPageL(EFalse);
- break;
- default:
- break;
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonSettingsViewDlg::TabChangedL(TInt /*aIndex*/)
- {
- iListBox->SetCurrentItemIndex(0);
-
- SetVisibilitiesOfSettingItemsL();
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonSettingsViewDlg::ProcessCommandL(TInt aCommandId)
- {
- CAknDialog::ProcessCommandL(aCommandId);
-
- switch (aCommandId)
- {
- case EPerfMonCmdSettingsChange:
- ShowSettingPageL(ETrue);
- break;
- case EPerfMonCmdSettingsExit:
- TryExitL(EAknCmdExit);
- break;
- default:
- break;
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-TKeyResponse CPerfMonSettingsViewDlg::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 CPerfMonSettingsViewDlg::PreLayoutDynInitL()
- {
- iListBox = static_cast<CAknSettingStyleListBox*>( Control(EPerfMonSettingItemList) );
- 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 CPerfMonSettingsViewDlg::OkToExitL(TInt aButtonId)
- {
- return CAknDialog::OkToExitL(aButtonId);
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonSettingsViewDlg::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 CPerfMonSettingsViewDlg::SetVisibilitiesOfSettingItemsL()
- {
- if (iSettingItemArray->Count() > 0)
- {
- switch (iTabGroup->ActiveTabIndex())
- {
- case ETabSettingsGeneral:
- {
- ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(EFalse);
- ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(EFalse);
- ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(EFalse);
- ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(EFalse);
- ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(EFalse);
- if (CPerfMonPowerListener::IsSupported())
- ((*iSettingItemArray)[ESettingListItemPowerMonitoringEnabled])->SetHidden(EFalse);
- else
- ((*iSettingItemArray)[ESettingListItemPowerMonitoringEnabled])->SetHidden(ETrue);
-
- ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(ETrue);
-
- ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(ETrue);
-
- ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(ETrue);
-
- break;
- }
-
- case ETabSettingsDataPopup:
- {
- ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemPowerMonitoringEnabled])->SetHidden(ETrue);
-
- ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(EFalse);
- ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(EFalse);
- ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(EFalse);
-
- ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(ETrue);
-
- ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(ETrue);
-
- break;
- }
-
- case ETabSettingsGraphs:
- {
- ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemPowerMonitoringEnabled])->SetHidden(ETrue);
-
- ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(ETrue);
-
- ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(EFalse);
- ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(EFalse);
-
- ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(ETrue);
-
- break;
- }
-
- case ETabSettingsLogging:
- {
- ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemPowerMonitoringEnabled])->SetHidden(ETrue);
-
- ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(ETrue);
-
- ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(ETrue);
- ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(ETrue);
-
- ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(EFalse);
-
- if (iSettings.iLoggingMode == ELoggingModeLogFile || iSettings.iLoggingMode == ELoggingModeRDebugLogFile)
- ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(EFalse);
- else
- ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue);
-
- ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(EFalse);
-
- break;
- }
-
- default:
- User::Panic(_L("TabIOOB"), 50);
- break;
- }
-
- iSettingItemArray->RecalculateVisibleIndicesL();
- iListBox->HandleItemAdditionL();
- iListBox->UpdateScrollBarsL();
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonSettingsViewDlg::UpdateListBoxL()
- {
- iSettingItemArray->ResetAndDestroy();
-
- // create items
- TInt ordinal(0);
-
- AddSettingItemL(ESettingListItemHeartBeat,
- R_HEARTBEAT_SETTING_TITLE,
- R_HEARTBEAT_SETTING_PAGE,
- NULL,
- ordinal++);
-
- AddSettingItemL(ESettingListItemMaxSamples,
- R_MAXSAMPLES_SETTING_TITLE,
- R_MAXSAMPLES_SETTING_PAGE,
- NULL,
- ordinal++);
-
- AddSettingItemL(ESettingListItemPriority,
- R_PRIORITY_SETTING_TITLE,
- R_PRIORITY_SETTING_PAGE,
- R_PRIORITY_SETTING_TEXTS,
- ordinal++);
-
- AddSettingItemL(ESettingListItemCPUMode,
- R_CPUMODE_SETTING_TITLE,
- R_CPUMODE_SETTING_PAGE,
- R_CPUMODE_SETTING_TEXTS,
- ordinal++);
-
- AddSettingItemL(ESettingListItemKeepBackLightOn,
- R_KEEPBACKLIGHTON_SETTING_TITLE,
- R_BINARY_SETTING_PAGE,
- R_YESNO_BINARYSELECTION_TEXTS,
- ordinal++);
-
- AddSettingItemL(ESettingListItemPowerMonitoringEnabled,
- R_POWERMONITORINGENABLED_SETTING_TITLE,
- R_BINARY_SETTING_PAGE,
- R_YESNO_BINARYSELECTION_TEXTS,
- ordinal++);
-//
- AddSettingItemL(ESettingListItemDataPopupVisbility,
- R_DATAPOPUPVISIBILITY_SETTING_TITLE,
- R_DATAPOPUPVISIBILITY_SETTING_PAGE,
- R_DATAPOPUPVISIBILITY_SETTING_TEXTS,
- ordinal++);
-
- AddSettingItemL(ESettingListItemDataPopupLocation,
- R_DATAPOPUPLOCATION_SETTING_TITLE,
- R_DATAPOPUPLOCATION_SETTING_PAGE,
- R_DATAPOPUPLOCATION_SETTING_TEXTS,
- ordinal++);
-
- AddSettingItemL(ESettingListItemDataPopupSources,
- R_SOURCES_SETTING_TITLE,
- R_SOURCES_SETTING_PAGE,
- NULL,
- ordinal++);
-//
- AddSettingItemL(ESettingListItemGraphsVerticalBarPeriod,
- R_GRAPHSVERTICALBAR_SETTING_TITLE,
- R_GRAPHSVERTICALBAR_SETTING_PAGE,
- NULL,
- ordinal++);
-
- AddSettingItemL(ESettingListItemGraphsSources,
- R_SOURCES_SETTING_TITLE,
- R_SOURCES_SETTING_PAGE,
- NULL,
- ordinal++);
-//
- AddSettingItemL(ESettingListItemLoggingMode,
- R_LOGGINGMODE_SETTING_TITLE,
- R_LOGGINGMODE_SETTING_PAGE,
- R_LOGGINGMODE_SETTING_TEXTS,
- ordinal++);
-
- AddSettingItemL(ESettingListItemLoggingFilePath,
- R_LOGGINGFILEPATH_SETTING_TITLE,
- R_LOGGINGFILEPATH_SETTING_PAGE,
- NULL,
- ordinal++);
-
- AddSettingItemL(ESettingListItemLoggingSources,
- R_SOURCES_SETTING_TITLE,
- R_SOURCES_SETTING_PAGE,
- NULL,
- ordinal++);
-
- SetVisibilitiesOfSettingItemsL();
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonSettingsViewDlg::AddSettingItemL(TInt aId,
- TInt aTitleResource,
- TInt aSettingPageResource,
- TInt aAssociatedResource,
- TInt aOrdinal)
- {
- // create a setting item
- CAknSettingItem* settingItem = NULL;
-
- switch (aId)
- {
- case ESettingListItemHeartBeat:
- settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iHeartBeat);
- break;
-
- case ESettingListItemMaxSamples:
- settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iMaxSamples);
- break;
-
- case ESettingListItemPriority:
- settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iPriority);
- break;
-
- case ESettingListItemCPUMode:
- settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iCPUMode);
- break;
-
- case ESettingListItemKeepBackLightOn:
- settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iKeepBacklightOn);
- break;
-
- case ESettingListItemPowerMonitoringEnabled:
- settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iPowerMonitoringEnabled);
- break;
-
- case ESettingListItemDataPopupVisbility:
- settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iDataPopupVisibility);
- break;
-
- case ESettingListItemDataPopupLocation:
- settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iDataPopupLocation);
- break;
-
- case ESettingListItemDataPopupSources:
- settingItem = new(ELeave) CSourceSelectionCheckBoxSettingItem(aId, iSettings.iDataPopupSources);
- break;
-
- case ESettingListItemGraphsVerticalBarPeriod:
- settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iGraphsVerticalBarPeriod);
- break;
-
- case ESettingListItemGraphsSources:
- settingItem = new(ELeave) CSourceSelectionCheckBoxSettingItem(aId, iSettings.iGraphsSources);
- break;
-
- case ESettingListItemLoggingMode:
- settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iLoggingMode);
- break;
-
- case ESettingListItemLoggingFilePath:
- settingItem = new(ELeave) CAknTextSettingItem(aId, iSettings.iLoggingFilePath);
- break;
-
- case ESettingListItemLoggingSources:
- settingItem = new(ELeave) CSourceSelectionCheckBoxSettingItem(aId, iSettings.iLoggingSources);
- 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
- }
-
-
-// --------------------------------------------------------------------------------------------
-// --------------------------------------------------------------------------------------------
-
-CSourceSelectionCheckBoxSettingItem::CSourceSelectionCheckBoxSettingItem( TInt aIdentifier, TPerfMonSources& aMemoryInUse ):
- CAknSettingItem(aIdentifier), iExternalSources( aMemoryInUse )
- {
- }
-
-CSourceSelectionCheckBoxSettingItem::~CSourceSelectionCheckBoxSettingItem()
- {
- delete iSettingText;
-
- if( iItemArray )
- {
- iItemArray->ResetAndDestroy();
- delete iItemArray;
- }
- }
-
-void CSourceSelectionCheckBoxSettingItem::AddNewItemToArrayL(const TDesC& aLabel)
- {
- TBuf<64> buf;
- buf.Copy(aLabel);
-
- CSelectableItem* item = new(ELeave) CSelectableItem(buf, EFalse);
- CleanupStack::PushL(item);
- item->ConstructL();
- iItemArray->AppendL(item); // Ownership is transferred
- CleanupStack::Pop(); // item
- }
-
-void CSourceSelectionCheckBoxSettingItem::CompleteConstructionL()
- {
- SetEmptyItemTextL(_L("Nothing selected"));
-
- iItemArray = new(ELeave) CSelectionItemList(16);
- AddNewItemToArrayL(_L("CPU"));
- AddNewItemToArrayL(_L("RAM"));
- AddNewItemToArrayL(_L("C:"));
- AddNewItemToArrayL(_L("D:"));
- AddNewItemToArrayL(_L("E:"));
- AddNewItemToArrayL(_L("F:"));
- AddNewItemToArrayL(_L("G:"));
- AddNewItemToArrayL(_L("H:"));
- AddNewItemToArrayL(_L("I:"));
- AddNewItemToArrayL(_L("Power"));
-
- __ASSERT_ALWAYS(ESourcesLength==iItemArray->Count(), User::Panic(_L("Src.mismatch"),443));
- }
-
-// transfer settings to the variables defined in the constructor
-void CSourceSelectionCheckBoxSettingItem::StoreL()
- {
- for (TInt i=0; i<ESourcesLength; i++)
- {
- iExternalSources.iSrcEnabled[i] = iItemArray->At(i)->SelectionStatus();
- }
- }
-
-// load settings from the variables defined in the constructor to our internal variables
-void CSourceSelectionCheckBoxSettingItem::LoadL()
- {
- for (TInt i=0; i<ESourcesLength; i++)
- {
- iItemArray->At(i)->SetSelectionStatus( iExternalSources.iSrcEnabled[i] );
- }
- }
-
-// returns the text shown in the setting item list
-const TDesC& CSourceSelectionCheckBoxSettingItem::SettingTextL()
- {
- TBuf<32> settingText;
-
- if (iItemArray->At(ESourceCPU)->SelectionStatus())
- settingText.Append(_L("CPU "));
- if (iItemArray->At(ESourceRAM)->SelectionStatus())
- settingText.Append(_L("RAM "));
- if (iItemArray->At(ESourceC)->SelectionStatus())
- settingText.Append(_L("C: "));
- if (iItemArray->At(ESourceD)->SelectionStatus())
- settingText.Append(_L("D: "));
- if (iItemArray->At(ESourceE)->SelectionStatus())
- settingText.Append(_L("E: "));
- if (iItemArray->At(ESourceF)->SelectionStatus())
- settingText.Append(_L("F: "));
- if (iItemArray->At(ESourceG)->SelectionStatus())
- settingText.Append(_L("G: "));
- if (iItemArray->At(ESourceH)->SelectionStatus())
- settingText.Append(_L("H: "));
- if (iItemArray->At(ESourceI)->SelectionStatus())
- settingText.Append(_L("I: "));
- if (iItemArray->At(ESourcePwr)->SelectionStatus())
- settingText.Append(_L("Power "));
- settingText.TrimAll();
-
- if (iSettingText)
- {
- delete iSettingText;
- iSettingText = NULL;
- }
-
- iSettingText = HBufC::NewL(settingText.Length());
- iSettingText->Des().Copy(settingText);
-
- if ( iSettingText->Length() > 0 )
- return *iSettingText;
- else
- return EmptyItemText();
- }
-
-
-// launches the setting page
-void CSourceSelectionCheckBoxSettingItem::EditItemL(TBool /*aCalledFromMenu*/)
- {
- CSourceSelectionCheckBoxSettingPage* dlg = new(ELeave) CSourceSelectionCheckBoxSettingPage(SettingPageResourceId(), iItemArray);
-
- SetSettingPage( dlg );
- SettingPage()->SetSettingPageObserver(this);
-
- SettingPage()->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
- SetSettingPage(0); // it is deleted now
- }
-
-
-// handles setting page events
-void CSourceSelectionCheckBoxSettingItem::HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType )
- {
- switch( aEventType )
- {
- case EEventSettingCancelled:
- {
- // If setting is cancelled, load old values
- LoadL();
- break;
- }
- case EEventSettingChanged:
- {
- // If setting has changed, update CBA visibility
- static_cast<CSourceSelectionCheckBoxSettingPage*>( aSettingPage )->UpdateCba();
- break;
- }
- default:
- {
- break;
- }
- }
- CAknSettingItem::HandleSettingPageEventL( aSettingPage, aEventType );
- }
-
-// --------------------------------------------------------------------------------------------
-// --------------------------------------------------------------------------------------------
-
-CSourceSelectionCheckBoxSettingPage::CSourceSelectionCheckBoxSettingPage(TInt aResourceID, CSelectionItemList* aItemArray )
- : CAknCheckBoxSettingPage( aResourceID, aItemArray )
- {
- }
-
-void CSourceSelectionCheckBoxSettingPage::UpdateCba()
- {
- // Cache the pointer to button group container
- CEikButtonGroupContainer* cba = Cba();
- // Left softkey should be visible if there are items selected,
- // i.e. the selection index array has items.
- TBool visible( ListBoxControl()->View()->SelectionIndexes()->Count() > 0 );
- // Resolve left softkey command id
- TInt leftId( cba->ButtonGroup()->CommandId( 0 ) );
- // Check if left softkey visibility has changed
- if( visible != cba->IsCommandVisible( leftId ) )
- {
- // Left softkey visibility has changed, update it
- cba->MakeCommandVisible( leftId, visible );
- }
- }
-
-// --------------------------------------------------------------------------------------------
-// --------------------------------------------------------------------------------------------
-
-// End of File
--- a/perfmon/ui/avkon/src/perfmon_valuescontainer.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-// INCLUDE FILES
-#include "perfmon_valuescontainer.h"
-#include "perfmon.hrh"
-#include "perfmon_document.h"
-#include "perfmon_appui.h"
-#include "perfmon_model.h"
-
-#include <AknUtils.h>
-
-_LIT(KFreeFormat,"%S free %S%S");
-_LIT(KSizeFormat,"%S size %S%S");
-
-const TInt KLeftMargin = 2;
-
-
-// ===================================== MEMBER FUNCTIONS =====================================
-
-void CPerfMonValuesContainer::ConstructL(const TRect& aRect)
- {
- iModel = static_cast<CPerfMonDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
- iFont = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont);
-
- CreateWindowL();
- SetRect(aRect);
- SetBlank();
-
- ActivateL();
- }
-
-// --------------------------------------------------------------------------------------------
-
-CPerfMonValuesContainer::~CPerfMonValuesContainer()
- {
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonValuesContainer::Draw(const TRect& aRect) const
- {
- CWindowGc& gc = SystemGc();
- gc.SetBrushColor(KRgbWhite);
- gc.Clear(aRect);
-
- // check if sample array has been constructed
- if (iModel->SampleEntryArray())
- {
- // init font
- gc.SetPenColor(KRgbBlack);
- gc.UseFont( iFont );
- TUint separator = iFont->HeightInPixels()-2;
-
- // draw CPU %
- TBuf<64> cpuText;
- cpuText.Copy(_L("CPU: "));
-
- for (TInt i=iModel->CPU0PositionInSamples(); i<iModel->CPU0PositionInSamples()+iModel->AmountOfCPUs(); i++)
- {
- // check if data available
- if (iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0)
- {
- TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(0);
-
- cpuText.AppendNum( currentSample.iSize > 0 ? TInt( (1 - ((TReal)(currentSample.iFree) / (TReal)currentSample.iSize)) * 100) : 0 );
- cpuText.Append(_L("% "));
- }
-
- }
- gc.DrawText(cpuText, TPoint(KLeftMargin,separator));
-
- TInt c(2); // line counter
-
- // draw RAM and Drive values
- for (TInt i=iModel->RAMPositionInSamples(); i<iModel->PowerPositionInSamples(); i++)
- {
- // check if data available
- if (iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0)
- {
- TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(0);
-
- if (currentSample.iSize > 0) // draw only when size is known, this should ignore absent drives
- {
- TBuf<32> amountBuf;
- amountBuf.AppendNum(currentSample.iFree, TRealFormat(KDefaultRealWidth, 0));
-
- TBuf<32> buf;
- buf.Format(KFreeFormat, &iModel->SampleEntryArray()->At(i).iDescription, &amountBuf, &iModel->SampleEntryArray()->At(i).iUnitTypeShort);
- gc.DrawText(buf, TPoint(KLeftMargin,separator*c));
- c++;
-
- amountBuf.Copy(KNullDesC);
- amountBuf.AppendNum(currentSample.iSize, TRealFormat(KDefaultRealWidth, 0));
-
- buf.Format(KSizeFormat, &iModel->SampleEntryArray()->At(i).iDescription, &amountBuf, &iModel->SampleEntryArray()->At(i).iUnitTypeShort);
- gc.DrawText(buf, TPoint(KLeftMargin,separator*c));
- c++;
- }
- }
- }
-
- // draw power value
- if (iModel->SampleEntryArray()->At(iModel->PowerPositionInSamples()).iSampleDataArray->Count() > 0)
- {
- TSampleData& currentSample = iModel->SampleEntryArray()->At(iModel->PowerPositionInSamples()).iSampleDataArray->At(0);
-
- if (currentSample.iSize > 0)
- {
- TBuf<32> powerText;
- powerText.Copy(_L("Power "));
-
- powerText.AppendNum(currentSample.iSize - currentSample.iFree, TRealFormat(KDefaultRealWidth, 0));
- powerText.AppendFormat(_L("%S"), &iModel->SampleEntryArray()->At(iModel->PowerPositionInSamples()).iUnitTypeShort);
-
- gc.DrawText(powerText, TPoint(KLeftMargin,separator*c));
- }
- }
-
- gc.DiscardFont();
- }
- }
-
-// --------------------------------------------------------------------------------------------
-
-TKeyResponse CPerfMonValuesContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
- {
- return CCoeControl::OfferKeyEventL(aKeyEvent, aType);
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonValuesContainer::HandleResourceChange(TInt aType)
- {
- if (aType == KEikDynamicLayoutVariantSwitch)
- {
- TRect mainPaneRect;
- AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
- SetRect(mainPaneRect);
- }
- else
- CCoeControl::HandleResourceChange(aType);
- }
-
-// --------------------------------------------------------------------------------------------
-
-void CPerfMonValuesContainer::DrawUpdate()
- {
- DrawDeferred();
- }
-
-// --------------------------------------------------------------------------------------------
-
-// End of File
--- a/perfmon/ui/avkon/src/perfmon_valuesview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-// INCLUDE FILES
-#include "perfmon.hrh"
-#include "perfmon_valuesview.h"
-#include "perfmon_valuescontainer.h"
-#include "perfmon_document.h"
-#include "perfmon_model.h"
-#include <perfmon.rsg>
-
-#include <eikenv.h>
-#include <aknViewAppUi.h>
-
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------
-// CPerfMonValuesView::ConstructL(const TRect& aRect)
-// EPOC two-phased constructor
-// ---------------------------------------------------------
-//
-void CPerfMonValuesView::ConstructL()
- {
- BaseConstructL( R_PERFMON_VIEW_VALUES );
- iModel = static_cast<CPerfMonDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
- }
-
-// ---------------------------------------------------------
-// CPerfMonValuesView::~CPerfMonValuesView()
-// ---------------------------------------------------------
-//
-CPerfMonValuesView::~CPerfMonValuesView()
- {
- if (iContainer)
- {
- AppUi()->RemoveFromViewStack( *this, iContainer );
- delete iContainer;
- iContainer = NULL;
- }
- }
-
-// ---------------------------------------------------------
-// TUid CPerfMonValuesView::Id()
-// ---------------------------------------------------------
-//
-TUid CPerfMonValuesView::Id() const
- {
- return KValuesViewUID;
- }
-
-// ---------------------------------------------------------
-// TUid CPerfMonValuesView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
-// ---------------------------------------------------------
-//
-void CPerfMonValuesView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
- {
- AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane);
- }
-
-
-// ---------------------------------------------------------
-// CPerfMonValuesView::HandleCommandL(TInt aCommand)
-// ---------------------------------------------------------
-//
-void CPerfMonValuesView::HandleCommandL(TInt aCommand)
- {
-/*
- switch ( aCommand )
- {
- case EPerfMonCmdFileBack:
- {
- iModel->FileUtils()->MoveUpOneLevelL();
- break;
- }
-
- default:
- {
-*/
- AppUi()->HandleCommandL( aCommand );
-/*
- break;
- }
- }
-*/
- }
-
-// ---------------------------------------------------------
-// CPerfMonValuesView::HandleClientRectChange()
-// ---------------------------------------------------------
-//
-void CPerfMonValuesView::HandleClientRectChange()
- {
- if ( iContainer )
- {
- iContainer->SetRect( ClientRect() );
- }
- }
-
-// ---------------------------------------------------------
-// CPerfMonValuesView::DoActivateL(...)
-// ---------------------------------------------------------
-//
-void CPerfMonValuesView::DoActivateL(
- const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
- const TDesC8& /*aCustomMessage*/)
- {
- if (!iContainer)
- {
- iContainer = new (ELeave) CPerfMonValuesContainer;
- iModel->SetValuesContainer(iContainer);
- iContainer->SetMopParent(this);
- iContainer->ConstructL( ClientRect() );
- AppUi()->AddToStackL( *this, iContainer );
- }
- }
-
-// ---------------------------------------------------------
-// CPerfMonValuesView::DoDeactivate()
-// ---------------------------------------------------------
-//
-void CPerfMonValuesView::DoDeactivate()
- {
- if (iContainer)
- {
- AppUi()->RemoveFromViewStack( *this, iContainer );
- delete iContainer;
- iContainer = NULL;
- }
- }
-
-// End of File
--- a/perfmon/ui/hb/app/app.pro Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-TEMPLATE = app
-TARGET = PerfMon
-DEPENDPATH += .
-INCLUDEPATH += inc
-
-load(hb.prf)
-symbian:CONFIG -= symbian_i18n
-
-HEADERS += inc/application.h \
- inc/mainwindow.h \
- inc/mainview.h \
- inc/datacontainer.h \
- inc/valuedatacontainer.h \
- inc/graphdatacontainer.h \
- inc/settingsview.h \
-# inc/datapopup.h \
- inc/enginewrapper.h
-
-SOURCES += src/main.cpp \
- src/application.cpp \
- src/mainwindow.cpp \
- src/mainview.cpp \
- src/valuedatacontainer.cpp \
- src/graphdatacontainer.cpp \
- src/settingsview.cpp \
-# src/datapopup.cpp \
- src/enginewrapper.cpp
-
-RESOURCES +=
-
-symbian: {
- INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
- INCLUDEPATH += ../../../engine/inc
- HEADERS += ../../../engine/inc/perfmon_engine.h \
- ../../../engine/inc/perfmon_powerlistener.h
-
- SOURCES += ../../../engine/src/perfmon_engine.cpp \
- ../../../engine/src/perfmon_powerlistener.cpp
-
- LIBS += -lestor \
- -lbafl \
- -lefsrv \
- -lavkon \
- -lapparc \
- -lapgrfx \
- -lgdi \
- -lcone \
- -lcentralrepository \
- -lHWRMPowerClient
-
- TARGET.CAPABILITY = WriteDeviceData
-
- TARGET.UID2 = 0x100039CE
- TARGET.UID3 = 0x20011385
- TARGET.SID = 0x20011385
- TARGET.VID = 0x101FB657 // Nokia
-
- TARGET.EPOCHEAPSIZE = 0x10000 0x2000000 // Min 64Kb, Max 32Mb
-
- ICON = ../../../icons/qgn_menu_perfmon.svg
-
- RSS_RULES += "group_name = \"RnD Tools\"";
-}
--- a/perfmon/ui/hb/app/inc/application.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef APPLICATION_H
-#define APPLICATION_H
-
-#include <HbApplication>
-
-
-class QSymbianEvent;
-
-class Application : public HbApplication
-{
- Q_OBJECT
-
-public:
- Application(int &argc, char *argv[]);
-
-signals:
- void foregroundEvent(bool foreground);
-
-protected:
-#ifdef Q_OS_SYMBIAN
- bool symbianEventFilter(const QSymbianEvent * event);
-#endif
-};
-
-#endif // APPLICATION_H
--- a/perfmon/ui/hb/app/inc/datacontainer.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef DATACONTAINER_H
-#define DATACONTAINER_H
-
-#include <hbwidget.h>
-#include <enginewrapper.h>
-
-class DataContainer : public HbWidget
-{
- Q_OBJECT
-
-public:
- DataContainer(const EngineWrapper& engine, QGraphicsItem *parent = 0) :
- HbWidget(parent),
- mEngine(engine)
- {
- }
-
- void hideContainer()
- {
- disconnect(&mEngine, SIGNAL(samplesUpdated()), this, SLOT(samplesUpdated()));
- hide();
- }
-
- void showContainer()
- {
- connect(&mEngine, SIGNAL(samplesUpdated()),this, SLOT(samplesUpdated()));
- show();
- }
-
- inline const EngineWrapper& engine() const { return mEngine; }
-
-public slots:
- virtual void samplesUpdated()
- {
- update();
- }
-
-private:
- const EngineWrapper& mEngine;
-};
-
-#endif // DATACONTAINER_H
--- a/perfmon/ui/hb/app/inc/datapopup.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef DATAPOPUP_H
-#define DATAPOPUP_H
-
-#include <HbDeviceDialog>
-#include <QFont>
-
-class EngineWrapper;
-
-class DataPopup : public HbDeviceDialog
-{
- Q_OBJECT
-
-public:
- DataPopup(EngineWrapper &engine);
-
-public slots:
- void show();
- void hide();
- void updateSamples();
- void updateSettings();
- void updateVisibility(bool foreground);
-
-signals:
- void clicked();
-
-private slots:
- void triggerAction(QVariantMap data);
-
-private:
- QVariantMap collectParams() const;
- void updateData();
-
-private:
- EngineWrapper &mEngine;
-
- bool mPopupCreated;
-
- bool mPopupVisible;
-};
-
-#endif // DATAPOPUP_H
--- a/perfmon/ui/hb/app/inc/enginewrapper.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef ENGINEWRAPPER_H
-#define ENGINEWRAPPER_H
-
-#include "perfmon_engine.h"
-
-#include <QObject>
-#include <QColor>
-#include <QList>
-#include <QVariant>
-
-struct SampleData
-{
- qint64 mFree;
- qint64 mSize;
- qint64 mTimeFromStart;
-};
-
-class SampleEntry
-{
-public:
- SampleEntry(const TSampleEntry& sampleEntry) : mEntry(&sampleEntry) {}
-
- QString description() const { return QString((QChar*)mEntry->iDescription.Ptr(), mEntry->iDescription.Length()); }
- QString unitShort() const { return QString((QChar*)mEntry->iUnitTypeShort.Ptr(), mEntry->iUnitTypeShort.Length()); }
- QString unitLong() const { return QString((QChar*)mEntry->iUnitTypeLong.Ptr(), mEntry->iUnitTypeLong.Length()); }
- int driveNumber() const { return mEntry->iDriveNumber; }
- QColor graphColor() const { return QColor(mEntry->iGraphColor.Red(), mEntry->iGraphColor.Green(), mEntry->iGraphColor.Blue()); }
-
- int sampleCount() const { return mEntry->iSampleDataArray->Count(); }
- inline const SampleData& sample(int index) const { return reinterpret_cast<SampleData&>(mEntry->iSampleDataArray->At(index)); }
-private:
- const TSampleEntry *mEntry;
-
-friend class EngineWrapper;
-};
-
-class PerfMonSources
-{
-public:
- int count() const { return ESourcesLength; }
- int isEnabled (int index) const { return mSources.iSrcEnabled[index]; }
- void setEnabled(int index, bool enabled) { mSources.iSrcEnabled[index] = enabled; }
- QList<QVariant> enabledIndexes() const {
- QList<QVariant> indexes;
- for(int i=0; i<count(); i++) {
- if (isEnabled(i))
- indexes.append(i);
- }
- return indexes;
- }
- void setEnabledIndexes(const QList<QVariant> &indexes)
- {
- for (int i=0; i<count(); i++) {
- setEnabled(i, false);
- }
- foreach (const QVariant& index, indexes) {
- setEnabled(index.toInt(), true);
- }
- }
-
-private:
- PerfMonSources(TPerfMonSources &sources) : mSources(sources) {}
- friend class PerfMonSettings;
-
-private:
- TPerfMonSources &mSources;
-};
-
-class PerfMonSettings
-{
-public:
- int heartBeat() const { return mSettings.iHeartBeat; }
- int maxSamples() const { return mSettings.iMaxSamples; }
- int priority() const { return mSettings.iPriority; }
- int cpuMode() const { return mSettings.iCPUMode; }
- bool keepBacklightOn() const { return mSettings.iKeepBacklightOn; }
- bool powerMonitoringEnabled() const { return mSettings.iPowerMonitoringEnabled; }
-
- int dataPopupVisibility() const { return mSettings.iDataPopupVisibility; }
- int dataPopupLocation() const { return mSettings.iDataPopupLocation; }
- PerfMonSources &dataPopupSources() { return mDataPopupSources; }
- const PerfMonSources &dataPopupSources() const { return mDataPopupSources; }
-
- int graphVerticalBarPeriod() const { return mSettings.iGraphsVerticalBarPeriod; }
- PerfMonSources &graphSources() { return mGraphSources; }
- const PerfMonSources &graphSources() const { return mGraphSources; }
-
- int loggingMode() const { return mSettings.iLoggingMode; }
- QString loggingFilePath() const {
- return QString((QChar*)mSettings.iLoggingFilePath.Ptr(),
- mSettings.iLoggingFilePath.Length());
- }
- PerfMonSources &loggingSources() { return mLogSources; }
- const PerfMonSources &loggingSources() const { return mLogSources; }
-
- bool loggingEnabled() { return mSettings.iLoggingEnabled; }
-
-
- void setHeartBeat(int heartBeat) { mSettings.iHeartBeat = heartBeat; }
- void setMaxSamples(int maxSamples) { mSettings.iMaxSamples = maxSamples; }
- void setPriority(int priority) { mSettings.iPriority = priority; }
- void setCpuMode(int cpuMode) { mSettings.iCPUMode = cpuMode; }
- void setKeepBacklightOn(bool backlightOn) const { mSettings.iKeepBacklightOn = backlightOn; }
- void setPowerMonitoringEnabled(bool powerEnabled) const { mSettings.iPowerMonitoringEnabled = powerEnabled; }
-
- void setDataPopupVisibility(int visibility) { mSettings.iDataPopupVisibility = visibility; }
- void setDataPopupLocation(int location) { mSettings.iDataPopupLocation = location; }
-
- void setGraphVerticalBarPeriod(int period) { mSettings.iGraphsVerticalBarPeriod = period; }
-
- void setLoggingMode(int mode) { mSettings.iLoggingMode = mode; }
- void setLoggingFilePath(const QString& filePath) { mSettings.iLoggingFilePath = filePath.utf16(); }
-
-private:
- // only EngineWrapper can create Settings instance
- PerfMonSettings(TPerfMonSettings &settings) :
- mSettings(settings),
- mDataPopupSources(settings.iDataPopupSources),
- mGraphSources(settings.iGraphsSources),
- mLogSources(settings.iLoggingSources)
- {}
- friend class EngineWrapper;
-
-private:
- TPerfMonSettings &mSettings;
- PerfMonSources mDataPopupSources;
- PerfMonSources mGraphSources;
- PerfMonSources mLogSources;
-};
-
-/**
- * class that is used for communicating between Symbian and Qt code.
- */
-class EngineWrapper : public QObject, public CPerfMonEngine
- {
- Q_OBJECT
-
-public:
-
- /**
- * Constructor
- */
- EngineWrapper();
-
- /**
- * Destructor
- */
- ~EngineWrapper();
-
-public:
- const QList<SampleEntry>& sampleEntries() const { return mEntries; }
-
- PerfMonSettings &settings() { return mSettings; }
- const PerfMonSettings &settings() const { return mSettings; }
-
- int SampleEntryPosToSettingPos(int entryPos) const;
-
-public slots:
-
- bool updateSettings();
- bool initialize();
- void finalize();
- void setLoggingEnabled(bool enabled);
-
-signals:
-
- void samplesUpdated();
- void settingsUpdated();
-
-protected:
- void SendDrawEventToContainersL();
-
-private:
- QList<SampleEntry> mEntries;
-
- void createSampleEntriesArray();
-
- PerfMonSettings mSettings;
-};
-
-#endif //ENGINEWRAPPER_H
--- a/perfmon/ui/hb/app/inc/graphdatacontainer.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef GRAPHDATACONTAINER_H
-#define GRAPHDATACONTAINER_H
-
-#include "datacontainer.h"
-
-#include <QFont>
-
-class GraphDataContainer : public DataContainer
-{
- Q_OBJECT
-public:
- GraphDataContainer(const EngineWrapper& engine, QGraphicsItem *parent = 0);
-
-protected:
- void paint (QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- QWidget *widget = 0);
-
-private:
- QFont mFont;
-};
-
-#endif // GRAPHDATACONTAINER_H
--- a/perfmon/ui/hb/app/inc/mainview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MAINVIEW_H
-#define MAINVIEW_H
-
-#include <hbview.h>
-
-#include "valuedatacontainer.h"
-#include "graphdatacontainer.h"
-
-class HbAction;
-class EngineWrapper;
-
-class MainView : public HbView
-{
- Q_OBJECT
-
-public:
- MainView(EngineWrapper &engine);
- ~MainView();
-
-private:
- void createMenu();
-
-public slots:
- void showValues();
- void showGraphs();
- void toggleLogging();
- void showAbout();
-
-signals:
- void settingsCommandInvoked();
-
-private:
- void updateLoggingAction();
-
-private:
- EngineWrapper &mEngine;
-
- ValueDataContainer *mValueDataContainer;
- GraphDataContainer *mGraphDataContainer;
-
- HbAction *mValuesAction;
- HbAction *mGraphAction;
- HbAction *mSwitchViewAction;
- HbAction *mLoggingAction;
-};
-
-#endif // MAINVIEW_H
--- a/perfmon/ui/hb/app/inc/mainwindow.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <HbMainWindow>
-
-class EngineWrapper;
-class MainView;
-class SettingsView;
-
-class MainWindow : public HbMainWindow
-{
- Q_OBJECT
-public:
- MainWindow(EngineWrapper &engine, QWidget *parent = 0);
-
-public slots:
- void showMainView();
- void showSettings();
-
-private:
- void clearViews();
-
-private:
- EngineWrapper &mEngine;
- MainView* mMainView;
- SettingsView* mSettingsView;
-};
-
-#endif // MAINWINDOW_H
--- a/perfmon/ui/hb/app/inc/popupdatacontainer.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef POPUPDATACONTAINER_H
-#define POPUPDATACONTAINER_H
-
-#include "datacontainer.h"
-
-#include <QFont>
-
-class PopupDataContainer : public DataContainer
-{
- Q_OBJECT
-public:
- PopupDataContainer(const EngineWrapper& engine, QGraphicsItem *parent = 0);
-
-public slots:
- virtual void samplesUpdated();
-
-protected:
- void paint (QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- QWidget *widget = 0);
-
-private:
- QFont mFont;
-};
-
-#endif // POPUPDATACONTAINER_H
--- a/perfmon/ui/hb/app/inc/settingsview.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef SETTINGSVIEW_H
-#define SETTINGSVIEW_H
-
-#include <hbview.h>
-
-class HbDataForm;
-class HbDataFormModel;
-class HbDataFormModelItem;
-
-class EngineWrapper;
-class PerfMonSettings;
-class PerfMonSources;
-
-class SettingsView : public HbView
-{
- Q_OBJECT
-
-signals:
- void finished(bool ok);
-
-public:
- SettingsView(EngineWrapper &engine);
-
-private slots:
- void dataItemDisplayed(const QModelIndex &index);
- void logModeChanged(int index);
- void accept();
- void reject();
-
-private:
- void createModel(HbDataFormModel &model);
- void load(const PerfMonSettings& settings);
- void save(PerfMonSettings& settings);
- void createLogFilePathItem();
- void removeLogFilePathItem();
-
-private:
- EngineWrapper &mEngine;
- HbDataForm *mSettingsForm;
- HbDataFormModel *mModel;
-
- HbDataFormModelItem* mHeartBeatItem;
- HbDataFormModelItem* mMaxSamplesItem;
- HbDataFormModelItem* mPriorityItem;
- HbDataFormModelItem* mCpuSamplingItem;
- HbDataFormModelItem* mKeepBacklightItem;
- HbDataFormModelItem* mPowerMonitoringEnabledItem;
- HbDataFormModelItem* mPopupVisibilityItem;
- HbDataFormModelItem* mPopupLocationItem;
- HbDataFormModelItem* mPopupSourcesItem;
- HbDataFormModelItem* mVerticalBarPeriodItem;
- HbDataFormModelItem* mGraphSourcesItem;
-
- HbDataFormModelItem* mLogPage;
- HbDataFormModelItem* mLogModeItem;
- HbDataFormModelItem* mLogFilePathItem;
- HbDataFormModelItem* mLogSourcesItem;
-
- QString mLogFilePath;
-};
-
-#endif // SETTINGSVIEW_H
--- a/perfmon/ui/hb/app/inc/valuedatacontainer.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef VALUEDATACONTAINER_H
-#define VALUEDATACONTAINER_H
-
-#include "datacontainer.h"
-
-#include <QFont>
-
-class ValueDataContainer : public DataContainer
-{
- Q_OBJECT
-public:
- ValueDataContainer(const EngineWrapper& engine, QGraphicsItem *parent = 0);
-
-protected:
- void paint (QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- QWidget *widget = 0);
-
-private:
- QFont mFont;
-};
-
-#endif // VALUEDATACONTAINER_H
--- a/perfmon/ui/hb/app/src/application.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <QSymbianEvent>
-
-#include "application.h"
-
-#ifdef Q_OS_SYMBIAN
-#include <w32std.h>
-
-#endif
-
-Application::Application(int &argc, char *argv[]) :
- HbApplication(argc, argv)
-{
-}
-
-#ifdef Q_OS_SYMBIAN
-bool Application::symbianEventFilter(const QSymbianEvent * event)
-{
- if (event->type() == QSymbianEvent::WindowServerEvent)
- {
- const TWsEvent *aEvent = event->windowServerEvent();
-
- if (aEvent->Type() == EEventFocusLost) {
- emit foregroundEvent(false);
- }
-
- if (aEvent->Type() == EEventFocusGained) {
- emit foregroundEvent(true);
- }
- }
- return HbApplication::symbianEventFilter(event);
-}
-#endif
--- a/perfmon/ui/hb/app/src/datapopup.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <HbView>
-#include <HbEvent>
-#include <QFontMetrics>
-
-#include "datapopup.h"
-#include "enginewrapper.h"
-#include "popupdatacontainer.h"
-
-DataPopup::DataPopup(EngineWrapper &engine) :
- mEngine(engine),
- mPopupCreated(false),
- mPopupVisible(false)
-{
- connect(&mEngine, SIGNAL(samplesUpdated()), this, SLOT(updateSamples()));
- connect(&mEngine, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
- connect(this, SIGNAL(dataReceived(QVariantMap)), this, SLOT(triggerAction(QVariantMap)));
-}
-
-void DataPopup::show()
-{
- mPopupVisible = true;
- if (!mPopupCreated &&
- mEngine.sampleEntries().length() &&
- mEngine.settings().dataPopupSources().enabledIndexes().length())
- {
- bool anyData = false;
- foreach (QVariant index, mEngine.settings().dataPopupSources().enabledIndexes())
- anyData = anyData || mEngine.sampleEntries().at(index.toInt()).sampleCount();
-
- if (anyData) {
- mPopupCreated = HbDeviceDialog::show("com.nokia.rnd.perfmondatapopup/1.0",
- collectParams());
- }
- }
-}
-
-void DataPopup::hide()
-{
- mPopupVisible = false;
- if (mPopupCreated) {
- mPopupCreated = !cancel();
- }
-}
-
-void DataPopup::updateSamples()
-{
- updateData();
-}
-
-void DataPopup::updateSettings()
-{
- // mEngine.settings().dataPopupVisibility can only be changed from
- // main window, so we may assume the window is in foreground
- updateVisibility(true);
- updateData();
-}
-
-void DataPopup::updateVisibility(bool foreground)
-{
- if (mEngine.settings().dataPopupVisibility() == EDataPopupVisbilityAlwaysOn ||
- (mEngine.settings().dataPopupVisibility() == EDataPopupVisbilityBackgroundOnly && !foreground)) {
-
- show();
- } else {
- hide();
- }
-}
-
-void DataPopup::triggerAction(QVariantMap data)
-{
- if (data.contains("mouseEvent") && data["mouseEvent"].toString() == "press") {
- emit clicked();
-
- // data popup was clicked, move it to other position
- mEngine.settings().setDataPopupLocation(
- EDataPopupLocationBottomMiddle - mEngine.settings().dataPopupLocation());
- mEngine.updateSettings();
- }
-}
-
-QVariantMap DataPopup::collectParams() const
-{
- QVariantMap result;
-
- // add location param
- result["location"] = mEngine.settings().dataPopupLocation();
-
- // add lines param
- QStringList lines;
- QList<SampleEntry> entries = mEngine.sampleEntries();
- int posCounter(ESourceCPU);
-
- if (mEngine.settings().dataPopupSources().isEnabled(posCounter))
- {
- // loop all CPUs
- for (TInt i = mEngine.CPU0PositionInSamples(); i < mEngine.CPU0PositionInSamples() + mEngine.AmountOfCPUs(); i++)
- {
- // check samples available
- if (entries.at(i).sampleCount() > 0)
- {
- const SampleEntry &entry = entries.at(i);
- const SampleData &sample = entry.sample(0);
-
- double perc = sample.mSize > 0 ?
- 100. - 100. * sample.mFree / sample.mSize : 0;
-
- QString text = tr("%1 %2%").arg(entry.description()).
- arg(perc, 0, 'f', 0);
- lines.append(text);
- }
- }
- }
-
- posCounter++;
-
- // draw RAM and Drive values
- for (TInt i = mEngine.RAMPositionInSamples(); i < mEngine.PowerPositionInSamples(); i++)
- {
- // check if this setting has been enabled and it has some data
- if (mEngine.settings().dataPopupSources().isEnabled(posCounter) && entries.at(i).sampleCount() > 0)
- {
- const SampleEntry &entry = entries.at(i);
- const SampleData &sample = entry.sample(0);
-
- QString text = tr("%1 free %L2%3").arg(entry.description()).
- arg(sample.mFree).arg(entry.unitShort());
- lines.append(text);
- }
-
- posCounter++;
- }
-
- // draw power value
- // check if this setting has been enabled and it has some data
- if (mEngine.settings().dataPopupSources().isEnabled(posCounter) && entries.at(mEngine.PowerPositionInSamples()).sampleCount() > 0)
- {
- const SampleEntry &entry = entries.at(mEngine.PowerPositionInSamples());
- const SampleData &sample = entry.sample(0);
-
- QString text = tr("%1 %L2%3").arg(entry.description()).
- arg(sample.mSize - sample.mFree).arg(entry.unitShort());
- lines.append(text);
- }
-
- result["lines"] = lines;
-
- return result;
-}
-
-void DataPopup::updateData()
-{
- if (!mPopupVisible)
- return;
-
- if (!mPopupCreated) {
- show();
- } else {
- HbDeviceDialog::update(collectParams());
- }
-}
--- a/perfmon/ui/hb/app/src/enginewrapper.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <e32def.h>
-#include <e32cmn.h>
-
-#include "enginewrapper.h"
-
-
-// ---------------------------------------------------------------------------
-
-EngineWrapper::EngineWrapper() : mSettings(iSettings)
-{
-}
-
-// ---------------------------------------------------------------------------
-
-EngineWrapper::~EngineWrapper()
-{
- finalize();
-}
-
-// ---------------------------------------------------------------------------
-
-bool EngineWrapper::initialize()
-{
- TInt err = KErrNone;
-
- TRAP(err, ConstructL());
- if (err != KErrNone)
- return false;
-
- TRAP(err, ActivateEngineL());
- if (err != KErrNone)
- return false;
-
- createSampleEntriesArray();
-
- return true;
-}
-
-// ---------------------------------------------------------------------------
-
-int EngineWrapper::SampleEntryPosToSettingPos(int entryPos) const
-{
- int settingPos(0); // return position of aSampleEntryPos in settings
-
- if (entryPos >= iCPU0PositionInSamples && entryPos < iRAMPositionInSamples)
- {
- settingPos = ESourceCPU;
- }
- else if (entryPos == iRAMPositionInSamples)
- {
- settingPos = ESourceRAM;
- }
- else
- {
- settingPos = ESourceC + (entryPos - iCDrivePositionInSamples);
- }
-
- return settingPos;
-}
-
-// ---------------------------------------------------------------------------
-
-void EngineWrapper::createSampleEntriesArray()
-{
- for (TInt i=0; i < iSampleEntryArray->Count(); i++)
- {
- mEntries.append(iSampleEntryArray->At(i));
- }
-}
-
-// ---------------------------------------------------------------------------
-
-void EngineWrapper::finalize()
-{
- TRAP_IGNORE(DeActivateEngineL());
-}
-
-// ---------------------------------------------------------------------------
-
-bool EngineWrapper::updateSettings()
-{
- TInt err = KErrNone;
-
- TRAP(err, SaveSettingsL());
- if (err != KErrNone)
- return false;
-
- TRAP(err, HandleSettingsChangeL());
- if (err != KErrNone)
- return false;
-
- emit settingsUpdated();
- return true;
-}
-
-// ---------------------------------------------------------------------------
-
-void EngineWrapper::setLoggingEnabled(bool enabled)
-{
- EnableLogging(enabled);
-}
-
-// ---------------------------------------------------------------------------
-
-void EngineWrapper::SendDrawEventToContainersL()
-{
- emit samplesUpdated();
-}
-
-// ---------------------------------------------------------------------------
--- a/perfmon/ui/hb/app/src/graphdatacontainer.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "graphdatacontainer.h"
-#include "enginewrapper.h"
-
-#include <QPainter>
-#include <QFontMetrics>
-
-const int amountOfMicroSecondsFitsScreen = 20 * 1000000;
-const int microToSecondMultiplier = 1000000;
-
-GraphDataContainer::GraphDataContainer(const EngineWrapper& engine, QGraphicsItem *parent) :
- DataContainer(engine, parent)
-{
- HbFontSpec spec(HbFontSpec::Secondary);
- mFont = spec.font();
- mFont.setPixelSize(12);
-}
-
-void GraphDataContainer::paint (QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- QWidget *widget)
-{
- Q_UNUSED(option);
- Q_UNUSED(widget);
-
- // set proper font and prepare font metrics for text width / height calculation
- painter->setFont(mFont);
- QFontMetricsF metrics(mFont);
-
- // fill background with black color
- painter->fillRect(rect(), Qt::black);
-
- // calculate time factor
- qreal scaleFactor = rect().width() / (qreal) amountOfMicroSecondsFitsScreen;
-
- // calculate area height which is used to draw the grpahs
- qreal drawAreaHeight = rect().height() - 2 * metrics.height();
-
-
- const QList<SampleEntry> sampleEntries = engine().sampleEntries();
-
- // check if sample array has been constructed
- if (sampleEntries.length())
- {
- // draw vertical time lines first
- int verticalBarPeriodInSecs = engine().settings().graphVerticalBarPeriod();
-
- if (verticalBarPeriodInSecs >= 1 && sampleEntries.first().sampleCount() > 0)
- {
- // get time from the first sample
- const SampleData& firstSample = sampleEntries.first().sample(0);
- qint64 currentMicroSeconds = firstSample.mTimeFromStart;
-
- // calculate amount of microseconds exceeding value by using the modulo operator
- int remainderInMicroSeconds = currentMicroSeconds % (verticalBarPeriodInSecs * 1000000);
-
- // calculate first x pos
- qreal vbarXpos = rect().width() - (remainderInMicroSeconds * scaleFactor);
-
- // calculate the amount in seconds
- int barSeconds = (currentMicroSeconds - remainderInMicroSeconds) / microToSecondMultiplier;
-
- // continue drawing periodically the vertical lines
- while (vbarXpos >= 0 && barSeconds >= 0)
- {
- // draw vertical line
- painter->setPen(Qt::darkRed);
- painter->drawLine(QPointF(vbarXpos, metrics.height() + 1),
- QPointF(vbarXpos, rect().height() - metrics.height()));
-
- // draw seconds value
- painter->setPen(Qt::darkGray);
- QString secsText = QString("%1s").arg(barSeconds);
- QPointF secsPos(vbarXpos - metrics.width(secsText) / 2,
- rect().height());
- painter->drawText(secsPos, secsText);
-
- // calculate new position
- vbarXpos -= verticalBarPeriodInSecs * 1000000 * scaleFactor;
- barSeconds -= verticalBarPeriodInSecs;
- }
- }
-
- // draw the basic grid
- painter->setPen(Qt::darkGray);
-
- qreal axisY = metrics.height();
- painter->drawLine(QPointF(0, axisY), QPointF(rect().width(), axisY)); // upper line
- painter->drawText(QPointF(0, axisY), tr("100%"));
-
- axisY = rect().height() / 2;
- painter->drawLine(QPointF(0, axisY), QPointF(rect().width(), axisY)); // mid line
- painter->drawText(QPointF(0, axisY), tr("50%"));
-
- axisY = rect().height() - metrics.height();
- painter->drawLine(QPointF(0, axisY), QPointF(rect().width(), axisY)); // bottom line
- painter->drawText(QPointF(0, axisY), tr("0%"));
-
- int c = 0;
- // draw graphs for each sampled type
- for (int i=0; i<sampleEntries.length(); i++)
- {
- // check if this setting has been enabled and it has some data
- if (engine().settings().graphSources().isEnabled(engine().SampleEntryPosToSettingPos(i)) &&
- sampleEntries.at(i).sampleCount() > 0)
- {
- // set pen color for the graph
- painter->setPen(sampleEntries.at(i).graphColor());
-
- // remember the position where drawing started
- qreal currentXPos(rect().width()); // start drawing from right
- qreal currentYPos(0.);
-
- // draw samples
- for (int j=0; j<sampleEntries.at(i).sampleCount()-1; j++)
- {
- const SampleData& currentSample = sampleEntries.at(i).sample(j);
- const SampleData& previousSample = sampleEntries.at(i).sample(j+1);
-
- // calculate X position for previous (j+1)
- qreal previousXPos = currentXPos -
- qAbs(previousSample.mTimeFromStart - currentSample.mTimeFromStart) * scaleFactor;
-
-
- // calculate initial Y position
- if (j==0)
- {
- currentYPos = currentSample.mSize > 0 ?
- drawAreaHeight * currentSample.mFree / currentSample.mSize + metrics.height() :
- rect().height() - metrics.height();
- }
-
- // calculate Y position for previous (j+1)
- qreal previousYPos = previousSample.mSize > 0 ?
- drawAreaHeight * previousSample.mFree / previousSample.mSize + metrics.height() :
- rect().height() - metrics.height();
-
-
- // draw a line between the previous and current
- painter->drawLine(QPointF(previousXPos, previousYPos),
- QPointF(currentXPos, currentYPos));
-
- // draw current value in %
- if (j==0) // draw the value of first sample
- {
- qreal perc = currentSample.mSize > 0 ?
- 100. - 100. * currentSample.mFree / currentSample.mSize : 0;
- QString percText = QString ("%1 %2%").
- arg(sampleEntries.at(i).description()).
- arg(perc, 0, 'f', 0);
-
- painter->drawText(QPointF(0, metrics.height() * (c + 2)),
- percText);
- c++;
- }
-
-
- // stop drawing if we have run out of space
- if (previousXPos < 0)
- break;
-
- // remeber previous values
- currentXPos = previousXPos;
- currentYPos = previousYPos;
- }
-
-
- }
- }
-
- }
-}
--- a/perfmon/ui/hb/app/src/main.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <QMessageBox>
-
-#include "application.h"
-#include "enginewrapper.h"
-#include "mainwindow.h"
-#include "datapopup.h"
-
-int main(int argc, char *argv[])
-{
- Application app(argc, argv);
-
- EngineWrapper engine;
- if (!engine.initialize())
- {
- QMessageBox::critical(0, QObject::tr("Error"), QObject::tr("Unable to initialize engine. Application will now quit."));
- return 1;
- }
-
- MainWindow window(engine);
- window.show();
-// TODO: functionality broken
- /*
- DataPopup dataPopup(engine);
-
- QObject::connect(&app, SIGNAL(foregroundEvent(bool)),
- &dataPopup, SLOT(updateVisibility(bool)));
-
- // TODO: pass false if run in background
- dataPopup.updateVisibility(true);
-*/
- return app.exec();
-}
--- a/perfmon/ui/hb/app/src/mainview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <QActionGroup>
-#include <HbApplication>
-#include <HbMenu>
-#include <HbToolBar>
-#include <HbAction>
-#include <HbMessageBox>
-#include <HbLabel>
-
-#include "mainview.h"
-#include "enginewrapper.h"
-
-
-// ---------------------------------------------------------------------------
-
-MainView::MainView(EngineWrapper &engine) :
- mEngine(engine),
- mValueDataContainer(0),
- mGraphDataContainer(0)
-{
- setTitle(tr("Perf. Monitor"));
- mValueDataContainer = new ValueDataContainer(mEngine, this);
- mGraphDataContainer = new GraphDataContainer(mEngine, this);
- createMenu();
- showValues();
-}
-
-// ---------------------------------------------------------------------------
-
-MainView::~MainView()
-{
-}
-
-// ---------------------------------------------------------------------------
-
-void MainView::createMenu()
-{
- HbMenu *menu = this->menu();
- HbToolBar *toolbar = this->toolBar();
-
- if (menu && toolbar) {
- mSwitchViewAction = new HbAction(toolbar);
- toolbar->addAction(mSwitchViewAction);
-
- QActionGroup *viewGroup = new QActionGroup(this);
- HbMenu *viewSubmenu = menu->addMenu(tr("View"));
- mValuesAction = viewSubmenu->addAction(tr("Values"), this, SLOT(showValues()));
- mValuesAction->setCheckable(true);
- mValuesAction->setChecked(true);
- viewGroup->addAction(mValuesAction);
-
- mGraphAction = viewSubmenu->addAction(tr("Graphs"), this, SLOT(showGraphs()));
- mGraphAction->setCheckable(true);
- viewGroup->addAction(mGraphAction);
-
- mLoggingAction = menu->addAction(QString(), this, SLOT(toggleLogging()));
- toolbar->addAction(mLoggingAction);
- updateLoggingAction();
-
- menu->addAction(tr("Settings..."), this, SIGNAL(settingsCommandInvoked()));
- menu->addAction(tr("About..."), this, SLOT(showAbout()));
- menu->addAction(tr("Exit"), qApp, SLOT(quit()));
-
- }
-}
-
-void MainView::showValues()
-{
- // remove old widget & take ownership
- takeWidget();
- mGraphDataContainer->hideContainer();
- mValueDataContainer->showContainer();
- // set new widget
- this->setWidget(mValueDataContainer);
-
- mValuesAction->setChecked(true);
-
- mSwitchViewAction->setText(tr("View Graphs"));
- disconnect(mSwitchViewAction, SIGNAL(triggered(bool)), this, SLOT(showValues()));
- connect(mSwitchViewAction, SIGNAL(triggered(bool)), this, SLOT(showGraphs()));
-}
-
-void MainView::showGraphs()
-{
- // remove old widget & take ownership
- takeWidget();
- mValueDataContainer->hideContainer();
- mGraphDataContainer->showContainer();
- // set new widget
- this->setWidget(mGraphDataContainer);
-
- mGraphAction->setChecked(true);
-
- mSwitchViewAction->setText(tr("View Values"));
- disconnect(mSwitchViewAction, SIGNAL(triggered(bool)), this, SLOT(showGraphs()));
- connect(mSwitchViewAction, SIGNAL(triggered(bool)), this, SLOT(showValues()));
-}
-
-void MainView::updateLoggingAction()
-{
- mLoggingAction->setText(mEngine.settings().loggingEnabled() ?
- tr("Stop Logging") :
- tr("Start Logging"));
-}
-
-void MainView::toggleLogging()
-{
- mEngine.setLoggingEnabled(!mEngine.settings().loggingEnabled());
- updateLoggingAction();
-}
-
-void MainView::showAbout()
-{
- HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
- messageBox->setText("Version 1.2.0 - 26th August 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.");
- HbLabel *header = new HbLabel("About PerfMon", messageBox);
- messageBox->setHeadingWidget(header);
- messageBox->setAttribute(Qt::WA_DeleteOnClose);
- messageBox->setTimeout(HbPopup::NoTimeout);
- messageBox->open();
-}
--- a/perfmon/ui/hb/app/src/mainwindow.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <HbAction>
-
-#include "mainwindow.h"
-
-#include "enginewrapper.h"
-#include "mainview.h"
-#include "settingsview.h"
-
-MainWindow::MainWindow(EngineWrapper &engine, QWidget *parent)
- : HbMainWindow(parent)
- , mEngine(engine)
-{
- mMainView = new MainView(mEngine);
- connect(mMainView, SIGNAL(settingsCommandInvoked()), this, SLOT(showSettings()));
-
- addView(mMainView);
-
- mSettingsView = new SettingsView(mEngine);
- connect(mSettingsView, SIGNAL(finished(bool)), this, SLOT(showMainView()));
-
- HbAction *action = new HbAction(Hb::BackNaviAction, mSettingsView);
- connect(action, SIGNAL(triggered()), mSettingsView, SLOT(reject()));
- mSettingsView->setNavigationAction(action);
-
- addView(mSettingsView);
-
- showMainView();
-}
-
-void MainWindow::showMainView()
-{
- setCurrentView( mMainView );
-}
-
-void MainWindow::showSettings()
-{
- setCurrentView( mSettingsView );
-}
--- a/perfmon/ui/hb/app/src/popupdatacontainer.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "popupdatacontainer.h"
-#include "enginewrapper.h"
-
-#include <QGraphicsLinearLayout>
-#include <HbLabel>
-#include <QPainter>
-
-const int leftMargin = 2;
-
-PopupDataContainer::PopupDataContainer(const EngineWrapper& engine, QGraphicsItem *parent) :
- DataContainer(engine, parent)
-{
- connect(&engine, SIGNAL(samplesUpdated()), this, SLOT(samplesUpdated()));
-
- HbFontSpec spec(HbFontSpec::Secondary);
- mFont = spec.font();
- mFont.setPixelSize(12);
-
-}
-
-void PopupDataContainer::samplesUpdated()
-{
- update();
-}
-
-void PopupDataContainer::paint (QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- QWidget *widget)
-{
- Q_UNUSED(option);
- Q_UNUSED(widget);
-
- // set proper font and prepare font metrics for text height calculation
- painter->setFont(mFont);
- QFontMetricsF metrics(mFont);
-
- QList<SampleEntry> entries = engine().sampleEntries();
- qreal verticalPos = metrics.height();
-
- for (int i=0; i<entries.length(); i++)
- {
- if (engine().settings().dataPopupSources().isEnabled(i) &&
- entries.at(i).sampleCount() > 0)
- {
- const SampleEntry &entry = entries.at(i);
- const SampleData &sample = entry.sample(0);
-
- if (i == ESourceCPU)
- {
- // CPU
- double perc = sample.mSize > 0 ?
- 100. - 100. * sample.mFree / sample.mSize : 0;
-
-
- QString text = tr("%1 %2%").arg(entry.description()).
- arg(perc, 0, 'f', 2);
- painter->drawText(QPointF(leftMargin, verticalPos), text);
- }
- else if (i == ESourcePwr)
- {
- // Power
- QString text = tr("%1 %L2%3").arg(entry.description()).
- arg(sample.mSize - sample.mFree).arg(entry.unitShort());
- painter->drawText(QPointF(leftMargin, verticalPos), text);
- }
- else
- {
- // RAM and Drives
- QString text = tr("%1 free %L2%3").arg(entry.description()).
- arg(sample.mFree).arg(entry.unitShort());
- painter->drawText(QPointF(leftMargin, verticalPos), text);
- }
-
- verticalPos += metrics.height();
- }
- }
-}
--- a/perfmon/ui/hb/app/src/settingsview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,278 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "settingsview.h"
-
-#include <HbAction>
-#include <HbToolBar>
-#include <HbDataForm>
-#include <HbDataFormModel>
-#include <HbDataFormModelItem>
-#include <HbDataFormViewItem>
-#include <HbLineEdit>
-#include <HbPushButton>
-
-#include "enginewrapper.h"
-
-const QStringList PRIORITY_ITEMS = QStringList() << SettingsView::tr("Much less") <<
- SettingsView::tr("Less") << SettingsView::tr("Normal") <<
- SettingsView::tr("More") << SettingsView::tr("Much more") <<
- SettingsView::tr("Real time") << SettingsView::tr("Abs. very low") <<
- SettingsView::tr("Abs. low") << SettingsView::tr("Abs background") <<
- SettingsView::tr("Abs. foreground") << SettingsView::tr("Abs high");
-
-const QStringList CPU_SAMPLING = QStringList() << SettingsView::tr("CPU Time") <<
- SettingsView::tr("NOPs");
-
-const QStringList POPUP_LOCATION = QStringList() << SettingsView::tr("Top right") <<
- SettingsView::tr("Bottom middle");
-
-const QStringList POPUP_VISIBILITY = QStringList() << SettingsView::tr("On") <<
- SettingsView::tr("Backgr. only") << SettingsView::tr("Off");
-
-const QStringList SOURCES = QStringList() << SettingsView::tr("CPU") <<
- SettingsView::tr("Ram") << SettingsView::tr("C:") << SettingsView::tr("D:") <<
- SettingsView::tr("E:") << SettingsView::tr("F:") << SettingsView::tr("G:") <<
- SettingsView::tr("H:") << SettingsView::tr("I:") << SettingsView::tr("Power");
-
-const QStringList LOG_MODES = QStringList() << SettingsView::tr("RDebug") <<
- SettingsView::tr("Log file") << SettingsView::tr("RDebug & log file");
-
-
-SettingsView::SettingsView(EngineWrapper &engine)
- : mEngine(engine), mLogFilePathItem(0)
-{
- setTitle(tr("Settings"));
-
- //create toolbar showing launch popup
- HbToolBar *toolBar = this->toolBar();
- HbAction *actionOk = new HbAction(tr("Ok"), toolBar);
- HbAction *actionCancel = new HbAction(tr("Cancel"), toolBar);
-
- toolBar->addAction(actionOk);
- toolBar->addAction(actionCancel);
-
- //create setting form
- mSettingsForm = new HbDataForm();
-
- //create a model class
- mModel = new HbDataFormModel(this);
- createModel(*mModel);
- load(engine.settings());
-
- connect(mSettingsForm, SIGNAL(itemShown(const QModelIndex)),
- this, SLOT(dataItemDisplayed(const QModelIndex)));
-
- // Set created model to form
- mSettingsForm->setModel(mModel);
- setWidget(mSettingsForm);
-
-
- connect(actionOk, SIGNAL(triggered()), this, SLOT(accept()));
- connect(actionCancel, SIGNAL(triggered()), this, SLOT(reject()));
- connect(this, SIGNAL(aboutToClose()), this, SLOT(accept()));
-
-}
-
-void SettingsView::createModel(HbDataFormModel &model)
-{
- // General page
- HbDataFormModelItem *generalPage = model.appendDataFormPage(tr("General"));
-
- mHeartBeatItem = model.appendDataFormItem(
- HbDataFormModelItem::TextItem, tr("Heart beat (ms)"), generalPage);
- mHeartBeatItem->setContentWidgetData("maximum", 99999);
- mHeartBeatItem->setContentWidgetData("minimum", 0);
- mHeartBeatItem->setContentWidgetData("inputMethodHints", Qt::ImhDigitsOnly);
-
- mMaxSamplesItem = model.appendDataFormItem(
- HbDataFormModelItem::TextItem, tr("Max samples"), generalPage);
- mMaxSamplesItem->setContentWidgetData("maximum", 9999);
- mMaxSamplesItem->setContentWidgetData("minimum", 0);
- mMaxSamplesItem->setContentWidgetData("inputMethodHints", Qt::ImhDigitsOnly);
-
- mPriorityItem = model.appendDataFormItem(
- HbDataFormModelItem::RadioButtonListItem, tr("Priority"), generalPage);
- mPriorityItem->setContentWidgetData("items", PRIORITY_ITEMS);
-
- mCpuSamplingItem = model.appendDataFormItem(
- HbDataFormModelItem::RadioButtonListItem, tr("CPU sampling mode"), generalPage);
- mCpuSamplingItem->setContentWidgetData("items", CPU_SAMPLING);
-
- mKeepBacklightItem = model.appendDataFormItem(
- HbDataFormModelItem::CheckBoxItem, tr("Backlight"), generalPage);
- mKeepBacklightItem->setContentWidgetData("text", tr("Keep backlight on"));
-
- mPowerMonitoringEnabledItem = model.appendDataFormItem(
- HbDataFormModelItem::CheckBoxItem, tr("Power"), generalPage);
- mPowerMonitoringEnabledItem->setContentWidgetData("text", tr("Enable power monitoring"));
-
- // Gray out selection if feature is not supported.
- if (!mEngine.PowerMonitoringSupported())
- {
- mPowerMonitoringEnabledItem->setEnabled(false);
- }
-
- // Data popup page
- HbDataFormModelItem *dataPopupPage = model.appendDataFormPage(tr("Data popup"));
-
- mPopupVisibilityItem = model.appendDataFormItem(
- HbDataFormModelItem::RadioButtonListItem, tr("Visibility"),
- dataPopupPage);
- mPopupVisibilityItem->setContentWidgetData("items", POPUP_VISIBILITY);
-
- mPopupLocationItem = model.appendDataFormItem(
- HbDataFormModelItem::RadioButtonListItem, tr("Location"), dataPopupPage);
- mPopupLocationItem->setContentWidgetData("items", POPUP_LOCATION);
-
- mPopupSourcesItem = model.appendDataFormItem(
- HbDataFormModelItem::MultiselectionItem, tr("Sources"), dataPopupPage);
- mPopupSourcesItem->setContentWidgetData("items", SOURCES);
-
- // Graphs page
- HbDataFormModelItem *graphsPage = model.appendDataFormPage(tr("Graphs"));
-
- mVerticalBarPeriodItem = model.appendDataFormItem(
- HbDataFormModelItem::TextItem, tr("Vertical bar period (s)"), graphsPage);
- mVerticalBarPeriodItem->setContentWidgetData("maximum", 999);
- mVerticalBarPeriodItem->setContentWidgetData("minimum", 0);
- mVerticalBarPeriodItem->setContentWidgetData("inputMethodHints", Qt::ImhDigitsOnly);
-
- mGraphSourcesItem = model.appendDataFormItem(
- HbDataFormModelItem::MultiselectionItem, tr("Sources"), graphsPage);
- mGraphSourcesItem->setContentWidgetData("items", SOURCES);
-
- // Logging page
- mLogPage = model.appendDataFormPage(tr("Logging"));
-
- mLogModeItem = model.appendDataFormItem(
- HbDataFormModelItem::RadioButtonListItem, tr("Mode"), mLogPage);
- mLogModeItem->setContentWidgetData("items", LOG_MODES);
- mSettingsForm->addConnection(mLogModeItem, SIGNAL(itemSelected(int)),
- this, SLOT(logModeChanged(int)));
-
- mLogSourcesItem = model.appendDataFormItem(
- HbDataFormModelItem::MultiselectionItem, tr("Sources"), mLogPage);
- mLogSourcesItem->setContentWidgetData("items", SOURCES);
-}
-
-void SettingsView::load(const PerfMonSettings& settings)
-{
- mHeartBeatItem->setContentWidgetData("text", settings.heartBeat());
- mMaxSamplesItem->setContentWidgetData("text", settings.maxSamples());
- mPriorityItem->setContentWidgetData("selected", settings.priority());
- mCpuSamplingItem->setContentWidgetData("selected", settings.cpuMode());
- mKeepBacklightItem->setContentWidgetData("checkState", settings.keepBacklightOn() ? Qt::Checked : Qt::Unchecked);
- mPowerMonitoringEnabledItem->setContentWidgetData("checkState", settings.powerMonitoringEnabled() ? Qt::Checked : Qt::Unchecked);
-
- mPopupVisibilityItem->setContentWidgetData("selected", settings.dataPopupVisibility());
- mPopupLocationItem->setContentWidgetData("selected", settings.dataPopupLocation());
- mPopupSourcesItem->setContentWidgetData("selectedItems",
- qVariantFromValue(settings.dataPopupSources().enabledIndexes()));
-
- mVerticalBarPeriodItem->setContentWidgetData("text", settings.graphVerticalBarPeriod());
- mGraphSourcesItem->setContentWidgetData("selectedItems",
- qVariantFromValue(settings.graphSources().enabledIndexes()));
-
- mLogModeItem->setContentWidgetData("selected", settings.loggingMode());
- mLogFilePath = settings.loggingFilePath();
- if (settings.loggingMode() > ELoggingModeRDebug)
- createLogFilePathItem();
- mLogSourcesItem->setContentWidgetData("selectedItems",
- qVariantFromValue(settings.loggingSources().enabledIndexes()));
-}
-
-void SettingsView::save(PerfMonSettings& settings)
-{
- settings.setHeartBeat(mHeartBeatItem->contentWidgetData("text").toInt());
- settings.setMaxSamples(mMaxSamplesItem->contentWidgetData("text").toInt());
- settings.setPriority(mPriorityItem->contentWidgetData("selected").toInt());
- settings.setCpuMode(mCpuSamplingItem->contentWidgetData("selected").toInt());
- settings.setKeepBacklightOn(mKeepBacklightItem->contentWidgetData("checkState").toInt() == Qt::Checked);
- settings.setPowerMonitoringEnabled(mPowerMonitoringEnabledItem->contentWidgetData("checkState").toInt() == Qt::Checked);
-
- settings.setDataPopupVisibility(mPopupVisibilityItem->contentWidgetData("selected").toInt());
- settings.setDataPopupLocation(mPopupLocationItem->contentWidgetData("selected").toInt());
- settings.dataPopupSources().setEnabledIndexes(
- qVariantValue<QList<QVariant> >(mPopupSourcesItem->contentWidgetData("selectedItems")));
-
- settings.setGraphVerticalBarPeriod(mVerticalBarPeriodItem->contentWidgetData("text").toInt());
- settings.graphSources().setEnabledIndexes(
- qVariantValue<QList<QVariant> >(mGraphSourcesItem->contentWidgetData("selectedItems")));
-
- settings.setLoggingMode(mLogModeItem->contentWidgetData("selected").toInt());
-
- if (mLogFilePathItem)
- settings.setLoggingFilePath(mLogFilePathItem->contentWidgetData("text").toString());
- settings.loggingSources().setEnabledIndexes(
- qVariantValue<QList<QVariant> >(mLogSourcesItem->contentWidgetData("selectedItems")));
-}
-
-void SettingsView::dataItemDisplayed(const QModelIndex &index)
-{
- HbDataFormModelItem* modelItem = mModel->itemFromIndex(index);
- HbDataFormViewItem *viewItem = static_cast<HbDataFormViewItem*>(mSettingsForm->itemByIndex(index));
- HbWidget *dataContentWidget = viewItem->dataItemContentWidget();
-
- // set input method hint for edits
- // TODO: remove once setContentWidgetData works with inputMethodHints
- if (modelItem == mHeartBeatItem ||
- modelItem == mMaxSamplesItem ||
- modelItem == mVerticalBarPeriodItem)
- {
- HbLineEdit *edit = static_cast<HbLineEdit*>(dataContentWidget);
- edit->setInputMethodHints(Qt::ImhDigitsOnly);
- }
-}
-
-void SettingsView::logModeChanged(int index)
-{
- if (index == ELoggingModeRDebug && mLogFilePathItem) {
- removeLogFilePathItem();
- }
- else if (index != ELoggingModeRDebug && !mLogFilePathItem) {
- createLogFilePathItem();
- }
-}
-
-void SettingsView::createLogFilePathItem()
-{
- mLogFilePathItem = mModel->insertDataFormItem(mLogPage->indexOf(mLogModeItem) + 1,
- HbDataFormModelItem::TextItem, tr("Log file path"), mLogPage);
- mLogFilePathItem->setContentWidgetData("text", mLogFilePath);
-}
-
-void SettingsView::removeLogFilePathItem()
-{
- // we need to store current text so that it is not lost when
- // user hides and then displays "Log file path" item again.
- mLogFilePath = mLogFilePathItem->contentWidgetData("text").toString();
- mModel->removeItem(mLogFilePathItem);
- mLogFilePathItem = 0;
-}
-
-void SettingsView::accept()
-{
- save(mEngine.settings());
- mEngine.updateSettings();
- emit finished(true);
-}
-
-void SettingsView::reject()
-{
- emit finished(false);
-}
--- a/perfmon/ui/hb/app/src/valuedatacontainer.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "valuedatacontainer.h"
-#include "enginewrapper.h"
-
-#include <QGraphicsLinearLayout>
-#include <QPalette>
-#include <QPainter>
-#include <HbColorScheme>
-
-const int leftMargin = 2;
-
-ValueDataContainer::ValueDataContainer(const EngineWrapper& engine, QGraphicsItem *parent) :
- DataContainer(engine, parent)
-{
- HbFontSpec spec(HbFontSpec::Secondary);
- mFont = spec.font();
-}
-
-void ValueDataContainer::paint (QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- QWidget *widget)
-{
- Q_UNUSED(option);
- Q_UNUSED(widget);
-
- // set proper font and prepare font metrics for text height calculation
- painter->setFont(mFont);
-
- QColor col = HbColorScheme::color("qtc_textedit_normal");
- if(col.isValid())
- painter->setPen(col);
-
- QFontMetricsF metrics(mFont);
-
- QList<SampleEntry> entries = engine().sampleEntries();
- int c = 1;
-
- // CPUs
- for (int i = const_cast<EngineWrapper&>( engine() ).CPU0PositionInSamples();
- i < const_cast<EngineWrapper&>( engine() ).CPU0PositionInSamples() +
- const_cast<EngineWrapper&>( engine() ).AmountOfCPUs(); i++)
- {
- // check if data available
- const SampleEntry &entry = entries.at(i);
-
- if (entry.sampleCount() == 0)
- continue;
-
- const SampleData &sample = entry.sample(0);
-
- double perc = sample.mSize > 0 ?
- 100. - 100. * sample.mFree / sample.mSize : 0;
-
- QString text = tr("%1 %2%").arg(entry.description()).
- arg(perc, 0, 'f', 0);
- painter->drawText(QPointF(leftMargin, c * metrics.height()), text);
- c++;
- }
-
- // RAM and drives
- for (int i = const_cast<EngineWrapper&>( engine() ).RAMPositionInSamples();
- i < const_cast<EngineWrapper&>( engine() ).PowerPositionInSamples(); i++)
- {
- // check if data available
- const SampleEntry &entry = entries.at(i);
-
- if (entry.sampleCount() == 0)
- continue;
-
- const SampleData &sample = entry.sample(0);
-
- if (sample.mSize > 0)
- {
- // RAM and Drives
- QString text = tr("%1 free %L2%3").arg(entry.description()).
- arg(sample.mFree).arg(entry.unitShort());
- painter->drawText(QPointF(leftMargin, c * metrics.height()), text);
- c++;
-
- text = tr("%1 size %L2%3").arg(entry.description()).
- arg(sample.mSize).arg(entry.unitShort());
- painter->drawText(QPointF(leftMargin, c * metrics.height()), text);
- c++;
- }
- }
-
- // Power sample
- // check if data available
- const SampleEntry &entry = entries.at(const_cast<EngineWrapper&>( engine() ).PowerPositionInSamples());
-
- if (entry.sampleCount() > 0)
- {
- const SampleData &sample = entry.sample(0);
-
- if (sample.mSize > 0)
- {
- QString text = tr("%1 %L2%3").arg(entry.description()).
- arg(sample.mSize - sample.mFree).arg(entry.unitShort());
- painter->drawText(QPointF(leftMargin, c * metrics.height()), text);
- c++;
- }
- }
-}
--- a/perfmon/ui/hb/datapopup/datapopup.pro Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-TEMPLATE = lib
-TARGET = PerfMonDataPopupPlugin
-CONFIG += plugin hb
-
-# directories
-INCLUDEPATH += inc
-DEPENDPATH += inc
-
-HEADERS += inc/perfmondatapopupplugin_p.h
-HEADERS += inc/perfmondatapopupdialog_p.h
-HEADERS += inc/perfmondatapopupwidget_p.h
-
-SOURCES += src/perfmondatapopupplugin.cpp
-SOURCES += src/perfmondatapopupdialog.cpp
-SOURCES += src/perfmondatapopupwidget.cpp
-
-symbian {
- INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
- TARGET.EPOCALLOWDLLDATA = 1
- TARGET.CAPABILITY = CAP_GENERAL_DLL
- TARGET.UID3 = 0x2002E6B0
-
- hblib.sources = Hb.dll
- hblib.path = /sys/bin
- hblib.depends = "(0xEEF9EA38), 1, 0, 0, {\"Hb\"}"
-
- pluginstub.sources = PerfMonDataPopupPlugin.dll
- pluginstub.path = /resource/plugins/devicedialogs/
- DEPLOYMENT += pluginstub
-}
\ No newline at end of file
--- a/perfmon/ui/hb/datapopup/inc/perfmondatapopupdialog_p.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef PERFMONDATAPOPUPDIALOG_P_H
-#define PERFMONDATAPOPUPDIALOG_P_H
-
-#include <QObject>
-#include <QVariantMap>
-
-#include <hbdevicedialoginterface.h>
-#include <hbdevicedialog.h>
-#include <hbnotificationdialog.h>
-
-class PerfMonDataPopupWidget;
-
-class PerfMonDataPopupDialog : public HbDialog, public HbDeviceDialogInterface
-{
- Q_OBJECT
- Q_PROPERTY(Location location READ location WRITE setLocation)
- Q_PROPERTY(QStringList lines READ lines WRITE setLines)
-
- Q_ENUMS(Location)
-
-public:
- enum Location
- {
- LocationTopRight = 0,
- LocationBottomMiddle
- };
-
-public:
- PerfMonDataPopupDialog(const QVariantMap ¶meters);
- virtual ~PerfMonDataPopupDialog();
-
- bool setDeviceDialogParameters(const QVariantMap ¶meters);
- int deviceDialogError() const;
- void closeDeviceDialog(bool byClient);
- HbPopup *deviceDialogWidget() const;
-
-protected:
-// void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
-// QWidget *widget=0);
-
-protected:
- void hideEvent(QHideEvent *event);
- void showEvent(QShowEvent *event);
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
-
-signals:
- void deviceDialogClosed();
- void deviceDialogData(QVariantMap data);
-
-private slots:
- void reposition();
-
-private:
- Location location() const;
- void setLocation(Location location);
-
- QStringList lines() const;
- void setLines(const QStringList &lines);
-
-private:
- Q_DISABLE_COPY(PerfMonDataPopupDialog)
-
- int mLastError;
- bool mShowEventReceived;
-
- Location mLocation;
-
- PerfMonDataPopupWidget *mWidget;
-};
-
-#endif // PERFMONDATAPOPUPDIALOG_P_H
--- a/perfmon/ui/hb/datapopup/inc/perfmondatapopupplugin_p.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef PERFMONDATAPOPUPPLUGIN_P_H
-#define PERFMONDATAPOPUPPLUGIN_P_H
-
-#include <QObject>
-#include <QVariantMap>
-
-#include <hbdevicedialogplugin.h>
-
-class PerfMonDataPopupPluginPrivate;
-
-class PerfMonDataPopupPlugin : public HbDeviceDialogPlugin
-{
- Q_OBJECT
-
-public:
- friend class PerfMonDataPopupPluginPrivate;
-
- PerfMonDataPopupPlugin();
- ~PerfMonDataPopupPlugin();
-
- bool accessAllowed(const QString &deviceDialogType,
- const QVariantMap ¶meters, const QVariantMap &securityInfo) const;
- HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType,
- const QVariantMap ¶meters);
- bool deviceDialogInfo(const QString &deviceDialogType,
- const QVariantMap ¶meters, DeviceDialogInfo *info) const;
- QStringList deviceDialogTypes() const;
- PluginFlags pluginFlags() const;
- int error() const;
-
-private:
- Q_DISABLE_COPY(PerfMonDataPopupPlugin)
- PerfMonDataPopupPluginPrivate *d;
-};
-
-#endif // PERFMONDATAPOPUPPLUGIN_P_H
--- a/perfmon/ui/hb/datapopup/inc/perfmondatapopuppluginerrors_p.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef PERFMONDATAPOPUPPLUGINERRORS_P_H
-#define PERFMONDATAPOPUPPLUGINERRORS_P_H
-
-#include <hbdevicedialog.h>
-
-// No error
-const int NoError = 0;
-// Illegal parameter error
-const int ParameterError = HbDeviceDialog::PluginErrors + 1;
-
-#endif // PERFMONDATAPOPUPPLUGINERRORS_P_H
--- a/perfmon/ui/hb/datapopup/inc/perfmondatapopupwidget_p.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef PERFMONDATAPOPUPWIDGET_P_H
-#define PERFMONDATAPOPUPWIDGET_P_H
-
-#include <HbWidget>
-
-class PerfMonDataPopupWidget : public HbWidget
-{
- Q_OBJECT
- Q_PROPERTY(QStringList lines READ lines WRITE setLines)
-
-public:
- explicit PerfMonDataPopupWidget(QGraphicsItem *parent = 0);
-
-public:
- QStringList lines() const;
- void setLines(const QStringList &lines);
-
-protected:
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0);
-
-private:
- QStringList mLines;
-
- QFont mFont;
-
-};
-
-#endif // PERFMONDATAPOPUPWIDGET_P_H
--- a/perfmon/ui/hb/datapopup/src/perfmondatapopupdialog.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <QtDebug>
-#include <QIcon>
-#include <QVariant>
-#include <QList>
-#include <HbMainWindow>
-
-#include "perfmondatapopupdialog_p.h"
-#include "perfmondatapopuppluginerrors_p.h"
-#include "perfmondatapopupwidget_p.h"
-
-// Constructor
-PerfMonDataPopupDialog::PerfMonDataPopupDialog(const QVariantMap ¶meters) :
- mLastError(NoError),
- mShowEventReceived(false),
- mLocation(LocationTopRight),
- mWidget(new PerfMonDataPopupWidget(this))
-{
- setTimeout(0);
- setModal(false);
- setDismissPolicy(HbPopup::NoDismiss);
- setBackgroundItem(0);
- setContentWidget(mWidget);
- setBackgroundFaded(false);
-
- setDeviceDialogParameters(parameters);
-}
-
-PerfMonDataPopupDialog::~PerfMonDataPopupDialog()
-{
-}
-
-// Set parameters
-bool PerfMonDataPopupDialog::setDeviceDialogParameters(const QVariantMap ¶meters)
-{
- if (parameters.contains("lines"))
- {
- QVariant lines = parameters.value("lines");
- if (!lines.canConvert(QVariant::StringList)) {
- mLastError = ParameterError;
- return false;
- }
-
- setLines(lines.toStringList());
- }
-
- if (parameters.contains("location"))
- {
- QVariant location = parameters.value("location");
- if (!location.canConvert<int>()) {
- mLastError = ParameterError;
- return false;
- }
-
- if (location.toInt() != LocationTopRight &&
- location.toInt() != LocationBottomMiddle)
- {
- mLastError = ParameterError;
- return false;
- }
-
- setLocation(static_cast<Location>(location.toInt()));
- }
- update();
- return true;
-}
-
-// Get error
-int PerfMonDataPopupDialog::deviceDialogError() const
-{
- return mLastError;
-}
-
-// Close device dialog
-void PerfMonDataPopupDialog::closeDeviceDialog(bool byClient)
-{
- Q_UNUSED(byClient);
- close();
- // If show event has been received, close is signalled from hide event. If not,
- // hide event does not come and close is signalled from here.
- if (!mShowEventReceived) {
- emit deviceDialogClosed();
- }
-}
-
-// Return display widget
-HbPopup *PerfMonDataPopupDialog::deviceDialogWidget() const
-{
- return const_cast<PerfMonDataPopupDialog*>(this);
-}
-
-// Widget is about to hide. Closing effect has ended.
-void PerfMonDataPopupDialog::hideEvent(QHideEvent *event)
-{
- if (mainWindow()) {
- disconnect(mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)),
- this, SLOT(reposition()));
- }
- HbPopup::hideEvent(event);
- emit deviceDialogClosed();
-}
-
-// Widget is about to show
-void PerfMonDataPopupDialog::showEvent(QShowEvent *event)
-{
- if (mainWindow()) {
- connect(mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)),
- this, SLOT(reposition()));
- }
- reposition();
- HbPopup::showEvent(event);
- mShowEventReceived = true;
-}
-
-
-void PerfMonDataPopupDialog::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- Q_UNUSED(event);
-
- QVariantMap data;
- data["mouseEvent"] = "press";
- emit deviceDialogData(data);
-}
-
-
-PerfMonDataPopupDialog::Location PerfMonDataPopupDialog::location() const
-{
- return mLocation;
-}
-
-void PerfMonDataPopupDialog::setLocation(Location location)
-{
- if (location != mLocation) {
- mLocation = location;
- reposition();
- }
-}
-
-QStringList PerfMonDataPopupDialog::lines() const
-{
- return mWidget->lines();
-}
-
-void PerfMonDataPopupDialog::setLines(const QStringList &lines)
-{
- mWidget->setLines(lines);
-}
-
-void PerfMonDataPopupDialog::reposition()
-{
- if (mainWindow()) {
- QSize screenSize = HbDeviceProfile::profile(mainWindow()).logicalSize();
- switch (mLocation) {
- case LocationTopRight:
- setPreferredPos(QPointF(screenSize.width(), 0),
- HbPopup::TopRightCorner);
- break;
-
- case LocationBottomMiddle:
- setPreferredPos(QPointF(screenSize.width() / 2, screenSize.height()),
- HbPopup::BottomEdgeCenter);
- break;
- }
- }
-}
--- a/perfmon/ui/hb/datapopup/src/perfmondatapopupplugin.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <QtPlugin>
-
-#include <hbdevicedialog.h>
-#include "perfmondatapopupplugin_p.h"
-#include "perfmondatapopupdialog_p.h"
-#include "perfmondatapopuppluginerrors_p.h"
-
-Q_EXPORT_PLUGIN2(perfmondatapopupplugin, PerfMonDataPopupPlugin)
-
-// This plugin implements one device dialog type
-static const struct {
- const char *mTypeString;
-} dialogInfos[] = {
- {"com.nokia.rnd.perfmondatapopup/1.0"}
-};
-
-class PerfMonDataPopupPluginPrivate
-{
-public:
- PerfMonDataPopupPluginPrivate() {mError = NoError;}
-
- int mError;
-};
-
-// Constructor
-PerfMonDataPopupPlugin::PerfMonDataPopupPlugin()
- : d(new PerfMonDataPopupPluginPrivate)
-{
-}
-
-// Destructor
-PerfMonDataPopupPlugin::~PerfMonDataPopupPlugin()
-{
- delete d;
-}
-
-// Check if client is allowed to use device dialog widget
-bool PerfMonDataPopupPlugin::accessAllowed(const QString &deviceDialogType,
- const QVariantMap ¶meters, const QVariantMap &securityInfo) const
-{
- Q_UNUSED(deviceDialogType)
- Q_UNUSED(parameters)
- Q_UNUSED(securityInfo)
-
- // This plugin doesn't perform operations that may compromise security. All clients
- // are allowed to use.
- return true;
-}
-
-// Create device dialog widget
-HbDeviceDialogInterface *PerfMonDataPopupPlugin::createDeviceDialog(
- const QString &deviceDialogType, const QVariantMap ¶meters)
-{
- Q_UNUSED(deviceDialogType)
- d->mError = NoError;
-
- HbDeviceDialogInterface *ret(0);
- QVariantMap params = parameters;
-
- PerfMonDataPopupDialog *deviceDialog =
- new PerfMonDataPopupDialog(params);
- d->mError = deviceDialog->deviceDialogError();
- if (d->mError != NoError) {
- delete deviceDialog;
- deviceDialog = 0;
- }
- ret = deviceDialog;
-
- return ret;
-}
-
-// Return device dialog flags
-bool PerfMonDataPopupPlugin::deviceDialogInfo(const QString &deviceDialogType,
- const QVariantMap ¶meters, DeviceDialogInfo *info) const
-{
- Q_UNUSED(deviceDialogType);
- Q_UNUSED(parameters);
-
- info->group = DeviceNotificationDialogGroup;
- //info->group = GenericDeviceDialogGroup;
- info->flags = NoDeviceDialogFlags;
- info->priority = DefaultPriority;
-
- return true;
-}
-
-// Return device dialog types this plugin implements
-QStringList PerfMonDataPopupPlugin::deviceDialogTypes() const
-{
- QStringList types;
- const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]);
- for(int i = 0; i < numTypes; i++) {
- types.append(dialogInfos[i].mTypeString);
- }
- return types;
-}
-
-// Return plugin flags
-HbDeviceDialogPlugin::PluginFlags PerfMonDataPopupPlugin::pluginFlags() const
-{
- return NoPluginFlags;
-}
-
-// Return last error
-int PerfMonDataPopupPlugin::error() const
-{
- return d->mError;
-}
--- a/perfmon/ui/hb/datapopup/src/perfmondatapopupwidget.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <QPainter>
-
-#include "perfmondatapopupwidget_p.h"
-
-const qreal popupMargin = 5.;
-
-PerfMonDataPopupWidget::PerfMonDataPopupWidget(QGraphicsItem *parent) :
- HbWidget(parent)
-{
- HbFontSpec fontSpec(HbFontSpec::Secondary);
- mFont = fontSpec.font();
- mFont.setPixelSize(12);
-}
-
-QStringList PerfMonDataPopupWidget::lines() const
-{
- return mLines;
-}
-
-void PerfMonDataPopupWidget::setLines(const QStringList &lines)
-{
- mLines = lines;
- updateGeometry();
-}
-
-QSizeF PerfMonDataPopupWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- if (which == Qt::PreferredSize)
- {
- QFontMetricsF metrics(mFont);
-
- qreal width = 0;
- foreach (const QString &line, mLines) {
- width = qMax(width, metrics.width(line));
- }
- qreal height = metrics.height() * mLines.length();
-
- return QSizeF(width + 2 * popupMargin, height + 2 * popupMargin);
- }
-
- return HbWidget::sizeHint(which, constraint);
-}
-
-void PerfMonDataPopupWidget::paint(QPainter *painter,
- const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(widget);
- Q_UNUSED(option);
-
- QFontMetricsF metrics(mFont);
- qreal lineHeight = metrics.height();
- qreal verticalPos = lineHeight + popupMargin;
-
- // draw background
- painter->setBrush(Qt::white);
- painter->drawRect(option->rect);
-
- painter->setFont(mFont);
-
- foreach (const QString &line, mLines) {
- painter->drawText(QPointF(popupMargin, verticalPos), line);
- verticalPos += lineHeight;
- }
-
-}
--- a/perfmon/ui/hb/win/enginewrapper.cpp Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "enginewrapper.h"
-
-
-// ---------------------------------------------------------------------------
-
-EngineWrapper::EngineWrapper()
-{
-}
-
-// ---------------------------------------------------------------------------
-
-EngineWrapper::~EngineWrapper()
-{
- finalize();
-}
-
-// ---------------------------------------------------------------------------
-
-bool EngineWrapper::initialize()
-{
-
- SampleEntry cpu;
- cpu.mDescription = "CPU";
- cpu.mDriveNumber = -1;
- cpu.mGraphColor.setNamedColor("yellow");
-
- SampleEntry ram;
- ram.mDescription = "RAM";
- ram.mUnitShort = "b";
- ram.mUnitLong = "bytes";
- ram.mDriveNumber = -1;
- ram.mGraphColor.setNamedColor("green");
-
- SampleEntry cdrive;
- cdrive.mDescription = "C:";
- cdrive.mUnitShort = "b";
- cdrive.mUnitLong = "bytes";
- cdrive.mDriveNumber = 0;
- cdrive.mGraphColor.setNamedColor("cyan");
-
- SampleEntry ddrive;
- ddrive.mDescription = "D:";
- ddrive.mUnitShort = "b";
- ddrive.mUnitLong = "bytes";
- ddrive.mDriveNumber = 0;
- ddrive.mGraphColor.setNamedColor("blue");
-
- mEntries << cpu << ram << cdrive << ddrive;
-
- connect(&mTimer, SIGNAL(timeout()), this, SLOT(update()));
- mStartTime = QTime::currentTime();
- mTimer.start(600);
-
- return true;
-}
-
-// ---------------------------------------------------------------------------
-
-void EngineWrapper::finalize()
-{
-}
-
-// ---------------------------------------------------------------------------
-
-bool EngineWrapper::updateSettings()
-{
- emit settingsUpdated();
- return true;
-}
-
-void EngineWrapper::update()
-{
- // do some updates :)
- for (int i=0; i<mEntries.length(); i++)
- {
- SampleEntry & entry = mEntries[i];
- if (entry.mSampleData.length() > 0)
- {
- SampleData data = entry.mSampleData.at(0);
- data.mFree += 10000 * (qrand() % 1000 - 500);
- data.mTimeFromStart = mStartTime.msecsTo(QTime::currentTime()) * 1000;
- entry.mSampleData.prepend(data);
- }
- else
- {
- SampleData data = {100000000L, 200000000L, mStartTime.msecsTo(QTime::currentTime()) * 1000};
- entry.mSampleData.prepend(data);
- }
-
- if (entry.mSampleData.length() > 64)
- {
- entry.mSampleData.removeLast();
- }
- }
-
- emit samplesUpdated();
-}
--- a/perfmon/ui/hb/win/enginewrapper.h Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,270 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef ENGINEWRAPPER_H
-#define ENGINEWRAPPER_H
-
-#include <QObject>
-#include <QColor>
-#include <QList>
-#include <QTime>
-#include <QTimer>
-
-enum SettingThreadPriorityTypes
-{
- EThreadPriorityTypeMuchLess = 0,
- EThreadPriorityTypeLess,
- EThreadPriorityTypeNormal,
- EThreadPriorityTypeMore,
- EThreadPriorityTypeMuchMore,
- EThreadPriorityTypeRealTime,
- EThreadPriorityTypeAbsoluteVeryLow,
- EThreadPriorityTypeAbsoluteLow,
- EThreadPriorityTypeAbsoluteBackground,
- EThreadPriorityTypeAbsoluteForeground,
- EThreadPriorityTypeAbsoluteHigh
-};
-
-enum SettingCPUModes
-{
- ECPUModeNotSet = -1,
- ECPUModeCPUTime,
- ECPUModeNOPs
-};
-
-enum SettingDataPopupVisbilities
-{
- EDataPopupVisbilityAlwaysOn = 0,
- EDataPopupVisbilityBackgroundOnly,
- EDataPopupVisbilityAlwaysAlwaysOff
-};
-
-enum SettingDataPopupLocations
-{
- EDataPopupLocationTopRight = 0,
- EDataPopupLocationBottomMiddle
-};
-
-enum SettingSources
-{
- ESourceCPU = 0,
- ESourceRAM,
- ESourceC,
- ESourceD,
- ESourceE,
- ESourceF,
- ESourceG,
- ESourceH,
- ESourceI,
- ESourcesLength // this should be always the last!
-};
-
-enum SettingLoggingMode
-{
- ELoggingModeRDebug = 0,
- ELoggingModeLogFile,
- ELoggingModeRDebugLogFile
-};
-
-
-struct SampleData
-{
- qint64 mFree;
- qint64 mSize;
- qint64 mTimeFromStart;
-};
-
-class SampleEntry
-{
-public:
- QString description() const { return mDescription; }
- QString unitShort() const { return mUnitShort; }
- QString unitLong() const { return mUnitLong; }
- int driveNumber() const { return mDriveNumber; }
- QColor graphColor() const { return mGraphColor; }
-
- int sampleCount() const { return mSampleData.length(); }
- const SampleData &sample(int index) const { return mSampleData[index]; }
-private:
- QString mDescription;
- QString mUnitShort;
- QString mUnitLong;
- int mDriveNumber;
- QColor mGraphColor;
-
- QList<SampleData> mSampleData;
-
-friend class EngineWrapper;
-};
-
-class PerfMonSources
-{
-public:
- int count() const { return 9; }
- int isEnabled (int index) const { return mSources[index]; }
- void setEnabled(int index, bool enabled) { mSources[index] = enabled; }
- QList<int> enabledIndexes() const
- {
- QList<int> indexes;
- for(int i=0; i<count(); i++) {
- if (isEnabled(i))
- indexes.append(i);
- }
- return indexes;
- }
- void setEnabledIndexes(const QList<int> &indexes)
- {
- for(int i=0; i<count(); i++) {
- setEnabled(i, indexes.contains(i));
- }
- }
-
-PerfMonSources() {
- memset(mSources, 0, sizeof mSources);
- mSources[0] = mSources[1] = mSources[2] = true;
-}
-
-private:
- bool mSources[9];
-};
-
-class PerfMonSettings
-{
-public:
- int heartBeat() const { return mHeartBeat; }
- int maxSamples() const { return mMaxSamples; }
- int priority() const { return mPriority; }
- int cpuMode() const { return mCPUMode; }
- bool keepBacklightOn() const { return mKeepBacklightOn; }
-
- int dataPopupVisibility() const { return mDataPopupVisibility; }
- int dataPopupLocation() const { return mDataPopupLocation; }
- PerfMonSources &dataPopupSources() { return mDataPopupSources; }
- const PerfMonSources &dataPopupSources() const { return mDataPopupSources; }
-
- int graphVerticalBarPeriod() const { return mGraphsVerticalBarPeriod; }
- PerfMonSources &graphSources() { return mGraphSources; }
- const PerfMonSources &graphSources() const { return mGraphSources; }
-
- int loggingMode() const { return mLoggingMode; }
- QString loggingFilePath() const { return mLoggingFilePath; }
- PerfMonSources &loggingSources() { return mLogSources; }
- const PerfMonSources &loggingSources() const { return mLogSources; }
-
- bool loggingEnabled() { return mLoggingEnabled; }
-
-
- void setHeartBeat(int heartBeat) { mHeartBeat = heartBeat; }
- void setMaxSamples(int maxSamples) { mMaxSamples = maxSamples; }
- void setPriority(int priority) { mPriority = priority; }
- void setCpuMode(int cpuMode) { mCPUMode = cpuMode; }
- void setKeepBacklightOn(bool backlightOn) { mKeepBacklightOn = backlightOn; }
-
- void setDataPopupVisibility(int visibility) { mDataPopupVisibility = visibility; }
- void setDataPopupLocation(int location) { mDataPopupLocation = location; }
-
- void setGraphVerticalBarPeriod(int period) { mGraphsVerticalBarPeriod = period; }
-
- void setLoggingMode(int mode) { mLoggingMode = mode; }
- void setLoggingFilePath(const QString& filePath) { mLoggingFilePath = filePath; }
-
- void setLoggingEnabled(bool enabled) { mLoggingEnabled = enabled; }
-
-private:
- friend class EngineWrapper;
-
- PerfMonSettings() : mHeartBeat(600), mMaxSamples(64), mPriority(2), mCPUMode(1),
- mKeepBacklightOn(true), mDataPopupVisibility(0), mDataPopupLocation(0),
- mGraphsVerticalBarPeriod(5), mLoggingMode(1), mLoggingFilePath("C:\\data\\perfmon.log"),
- mLoggingEnabled(true) {}
-
-
-private:
- int mHeartBeat;
- int mMaxSamples;
- int mPriority;
- int mCPUMode;
- bool mKeepBacklightOn;
-
- int mDataPopupVisibility;
- int mDataPopupLocation;
- PerfMonSources mDataPopupSources;
-
- int mGraphsVerticalBarPeriod;
- PerfMonSources mGraphSources;
-
- int mLoggingMode;
- QString mLoggingFilePath;
- PerfMonSources mLogSources;
-
- bool mLoggingEnabled;
-};
-
-/**
- * Mock engine to simulate perfmon engine for non-symbian development.
- */
-class EngineWrapper : public QObject
- {
- Q_OBJECT
-
-public:
-
- /**
- * Constructor
- */
- EngineWrapper();
-
- /**
- * Destructor
- */
- ~EngineWrapper();
-
-public:
- const QList<SampleEntry>& sampleEntries() const { return mEntries; }
-
- PerfMonSettings &settings() { return mSettings; }
- const PerfMonSettings &settings() const { return mSettings; }
-
- void setLoggingEnabled(bool enabled) { mSettings.setLoggingEnabled(enabled); }
-
-public slots:
-
- bool updateSettings();
- bool initialize();
- void finalize();
-
-signals:
-
- void samplesUpdated();
- void settingsUpdated();
-
-private slots:
-
- void update();
-
-private:
-
- QList<SampleEntry> mEntries;
-
- QTimer mTimer;
-
- QTime mStartTime;
-
- PerfMonSettings mSettings;
-};
-
-#endif //ENGINEWRAPPER_H
--- a/perfmon/ui/hb/win/win.pro Wed Sep 15 12:13:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-win32 {
- TEMPLATE = subdirs
-
- SUBDIRS = ../app ../datapopup
-
- system($$QMAKE_COPY enginewrapper.cpp ..\app\src\enginewrapper.cpp)
- system($$QMAKE_COPY enginewrapper.h ..\app\inc\enginewrapper.h)
-} else {
- error("Only Windows supported")
-}
--- a/piprofilerui/group/bld_generic.inf Wed Sep 15 12:13:45 2010 +0300
+++ b/piprofilerui/group/bld_generic.inf Wed Oct 13 14:32:52 2010 +0300
@@ -16,5 +16,19 @@
*/
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
--- a/piprofilerui/ui/avkon/data/piprofilerui.rss Wed Sep 15 12:13:45 2010 +0300
+++ b/piprofilerui/ui/avkon/data/piprofilerui.rss Wed Oct 13 14:32:52 2010 +0300
@@ -480,7 +480,7 @@
id = EAknMessageQueryContentId;
control = AVKON_MESSAGE_QUERY
{
- message = "Version 2.2.2 - 23rd August 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.";
+ message = "Version 2.2.0.2 - 4th May 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.";
};
}
};
--- a/piprofilerui/ui/avkon/rom/piprofilerui_avkon.iby Wed Sep 15 12:13:45 2010 +0300
+++ b/piprofilerui/ui/avkon/rom/piprofilerui_avkon.iby Wed Oct 13 14:32:52 2010 +0300
@@ -30,4 +30,7 @@
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__
--- a/piprofilerui/ui/hb/hb.pro Wed Sep 15 12:13:45 2010 +0300
+++ b/piprofilerui/ui/hb/hb.pro Wed Oct 13 14:32:52 2010 +0300
@@ -55,7 +55,7 @@
TARGET.CAPABILITY = ALL -TCB
- LIBS += -lcharconv -lbafl -lsysutil -lefsrv
+ LIBS += -lcharconv -lbafl -lsysutil
ICON = ../icons/qgn_menu_piprofilerui.svg
--- a/piprofilerui/ui/hb/inc/notifications.h Wed Sep 15 12:13:45 2010 +0300
+++ b/piprofilerui/ui/hb/inc/notifications.h Wed Oct 13 14:32:52 2010 +0300
@@ -18,7 +18,7 @@
#ifndef NOTIFICATIONS_H_
#define NOTIFICATIONS_H_
-#include <QString>
+#include <qstring>
/**
* Notifications class for viewing notification messages.
--- a/piprofilerui/ui/hb/inc/pimainwindow.h Wed Sep 15 12:13:45 2010 +0300
+++ b/piprofilerui/ui/hb/inc/pimainwindow.h Wed Oct 13 14:32:52 2010 +0300
@@ -19,7 +19,7 @@
#define PIPROFILERMAINWINDOW_H_
// System includes
-#include <qobject.h>
+#include <QObject.h>
#include <hbmainwindow.h>
// User includes
--- a/piprofilerui/ui/hb/rom/piprofilerui_hb.iby Wed Sep 15 12:13:45 2010 +0300
+++ b/piprofilerui/ui/hb/rom/piprofilerui_hb.iby Wed Oct 13 14:32:52 2010 +0300
@@ -27,4 +27,7 @@
//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__
--- a/piprofilerui/ui/hb/src/pimainview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/piprofilerui/ui/hb/src/pimainview.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -89,6 +89,7 @@
loadItemsFromResources(loader);
// Set list widget items
+ mListPlugins->setLongPressEnabled(true);
mListPlugins->setClampingStyle(HbScrollArea::BounceBackClamping);
mListPlugins->setFrictionEnabled(true);
@@ -186,7 +187,7 @@
void PIMainView::showAboutPopup()
{
- Notifications::showMessageBox("Version 2.2.2 - 23rd August 2010. \n"
+ Notifications::showMessageBox("Version 2.2.0.2 - 4th May 2010. \n"
"Copyright © 2010 Nokia Corporation "
"and/or its subsidiary(-ies). "
"All rights reserved.");
--- a/piprofilerui/ui/hb/src/piprofilerengineprivate.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/piprofilerui/ui/hb/src/piprofilerengineprivate.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -181,10 +181,7 @@
// check now if a second appearance exists in process list,
// i.e. engine started from eshell => two engine processes appear in normal case
- err = procName.Next(aResult2);
- if (err != KErrNone) {
- return err;
- }
+ procName.Next(aResult2);
// check if aResult2 contained the second appearance of profiler engine
if(aResult2.CompareF(aResult) > 0)
--- a/piprofilerui/ui/hb/src/pisettingsview.cpp Wed Sep 15 12:13:45 2010 +0300
+++ b/piprofilerui/ui/hb/src/pisettingsview.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -15,18 +15,18 @@
*
*/
-#include <HbMainWindow>
-#include <HbDataForm>
-#include <HbDataFormModel>
-#include <HbDataFormModelItem>
-#include <HbDataFormViewItem>
-#include <QGraphicsLinearLayout>
-#include <QValidator>
-#include <QIntValidator>
-#include <QModelIndex>
-#include <HbLineEdit>
-#include <HbValidator>
-#include <HbEditorInterface>
+#include <hbmainwindow>
+#include <hbdataform>
+#include <hbdataformmodel>
+#include <hbdataformmodelitem>
+#include <hbdataformviewitem>
+#include <qgraphicslinearlayout>
+#include <qvalidator>
+#include <qintvalidator>
+#include <qmodelindex>
+#include <hblineedit>
+#include <hbvalidator>
+#include <hbeditorinterface>
#include <hbabstractitemview.h>
#include "pisettingsview.h"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/group/ReleaseNote.txt Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,47 @@
+========================================================================
+RELEASE NOTE FOR STIF UI - STIF_201024 (7.3.35)
+SUPPORTING SERIES 60 3.0 ->
+========================================================================
+
+Product Description:
+====================
+STIF UI is Series 60 UI application for STIF project.
+STIF is a test harness for testing Symbian & S60 non-UI components.
+This widely used test framework can be used for both test case implementation and test cases execution.
+
+Features :
+=========
+- Easy to use
+- Multiple test cases can be executed concurrently.
+
+
+Enhancements:
+=============
+N/A
+
+
+New Features:
+=============
+N/A
+
+
+System Requirements:
+====================
+Basic Requirements:
+- S60/Symbian OS development environment installed
+
+- stif project needs to be compiled/installed before stifui can be used
+
+
+Compatibility Issues:
+=====================
+N/A
+
+Known Issues:
+===========
+If problems with compilation appears (missing platform_paths.hrh file error message),
+please use EnvPatcher.pl script from stif/envpatcher folder to fix environment.
+
+
+Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: bld.inf Toplevel build information for STIF UI
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+
+// Note that if you want to build STIF to GCCE platform, GCCE must be
+// specified separately - it is not part of default platforms.
+// DEFAULT GCCE
+
+ DEFAULT
+
+
+PRJ_EXPORTS
+// This is added in order to export iby files automaticly in 5.0 env
+ ../rom/Stifui.iby CORE_IBY_EXPORT_PATH(tools,Stifui.iby)
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+ // StifUI
+ #include "../stifui/group/bld.inf"
+
+ // UiTestServerStarter
+ #include "../uitestserverstarter/group/bld.inf"
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/rom/Stifui.iby Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Stifui.iby file specifies needed STIF and STIF UI
+* and UITetsServerstarter components for ROM image
+*
+*/
+
+#ifndef __STIF_UI_IBY__
+#define __STIF_UI_IBY__
+
+S60_APP_EXE(Stifui)
+
+#ifdef S60_UPGRADABLE_APP_REG_RSC
+ S60_UPGRADABLE_APP_REG_RSC(Stifui)
+#else
+ S60_APP_AIF_RSC(Stifui)
+#endif
+
+S60_APP_RESOURCE(Stifui)
+
+S60_APP_EXE(UITestServerStarter)
+
+#ifdef S60_UPGRADABLE_APP_REG_RSC
+ S60_UPGRADABLE_APP_REG_RSC(UITestServerStarter)
+#else
+ S60_APP_AIF_RSC(UITestServerStarter)
+#endif
+
+
+S60_APP_RESOURCE(UITestServerStarter)
+
+// Note: before creating image, copy Stifui_31_Stub.sis from \stifui\sis\ to \epoc32\data\Z\system\install\
+data=ZSYSTEM\install\Stifui_31_Stub.sis System\Install\Stifui_31_Stub.sis
+
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/sis/Stifui.pkg Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,67 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Installation file for STIF UI
+;
+
+; Languages
+&EN
+
+; Package header, uid is the Stifui's uid
+#{"STIF UI"},(0x1028311D),0,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+
+ ;// Note: STIF needs to be installed before STIF UI can be used
+
+ "\epoc32\release\armv5\udeb\Stifui.exe"-"!:\Sys\Bin\Stifui.exe"
+ "\epoc32\data\z\private\10003a3f\apps\Stifui_reg.rsc"-"!:\Private\10003a3f\import\apps\Stifui_reg.rsc"
+ "\epoc32\data\z\Resource\apps\Stifui.rsc"-"!:\Resource\apps\Stifui.rsc"
+
+ "\epoc32\release\armv5\udeb\UITestServerStarter.exe"-"!:\Sys\Bin\UITestServerStarter.exe"
+ "\epoc32\data\z\private\10003a3f\apps\UITestServerStarter_reg.rsc"-"!:\Private\10003a3f\import\apps\UITestServerStarter_reg.rsc"
+ "\epoc32\data\z\Resource\apps\UITestServerStarter.rsc"-"!:\Resource\apps\UITestServerStarter.rsc"
+
+; Embedded SIS
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
\ No newline at end of file
Binary file stifui/avkon/sis/Stifui_31.sis has changed
Binary file stifui/avkon/sis/Stifui_31_Stub.SIS has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/data/Stifui.rss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,2057 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file defines StifUI resources.
+*
+*/
+
+// RESOURCE IDENTIFIER
+NAME STIF // 4 letter ID
+
+// INCLUDES
+
+#include <eikon.rh>
+#include "Stifui.hrh"
+#include "Stifui_loc.hrh"
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.hrh>
+#include <CommonDialogs.hrh> // Enumerations of memory selection, file selection, save etc dialogs
+#include <CommonDialogs.rh> // Resource structures of memory selection, file selection, save etc dialogs
+#if defined (__S60_)
+ #include <data_caging_paths_strings.hrh>
+#endif
+#include <appinfo.rh>
+
+// CONSTANTS
+
+
+// MACROS
+
+
+// RESOURCE DEFINITIONS
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf="STIF UI"; }
+
+RESOURCE EIK_APP_INFO
+ {
+ status_pane = r_appui_status_pane;
+ }
+
+STRUCT STRING
+ {
+ BUF text;
+ }
+
+
+// RESOURCE DEFINITIONS
+//-----------------------------------------------------------------------------
+//
+// r_appui_hotkeys
+// ?description
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE HOTKEYS r_appui_hotkeys
+ {
+ control=
+ {
+ HOTKEY { command=EAknCmdExit; key='e'; }
+ };
+ }
+
+
+// APPUI
+//-----------------------------------------------------------------------------
+//
+// r_appui_status_pane
+// Applications status panel.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE STATUS_PANE_APP_MODEL r_appui_status_pane
+ {
+ panes=
+ {
+ //SPANE_PANE
+ // {
+ // id = EEikStatusPaneUidNavi;
+ // //type = EEikCtLabel;
+ // //type = EAknCtTitlePane;
+ // type = EAknCtNaviPane;
+ // //resource = r_appui_statuspane_text;
+ // resource = r_appui_navi_decorator;
+ // },
+ SPANE_PANE
+ {
+ id = EEikStatusPaneUidTitle;
+ type = EAknCtTitlePane;
+ resource = r_appui_overriden_app_name;
+ }
+ //SPANE_PANE
+ // {
+ // id = EEikStatusPaneUidContext;
+ // type = EAknCtContextPane;
+ // resource = ;
+ // }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_status_pane
+// Status panel text.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LABEL r_appui_statuspane_text
+ {
+ txt = "STIF UI";
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_overriden_app_name
+// Application name.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TITLE_PANE r_appui_overriden_app_name
+ {
+ txt = qtn_app_caption_string;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_navi_decorator
+// ?description
+//
+//-----------------------------------------------------------------------------
+//
+/*
+RESOURCE NAVI_DECORATOR r_appui_navi_decorator
+ {
+ type = ENaviDecoratorControlTabGroup;
+ control = TAB_GROUP
+ {
+ tab_width = EAknTabWidthWithTwoTabs; // two tabs
+ active = 0;
+ tabs = {
+ TAB
+ {
+ id = ETestCaseMenuTab; // from application hrh
+ txt = qtn_testcase_menu_tab;
+ },
+ TAB
+ {
+ id = ETestModulesMenuTab; // from application hrh
+ txt = qtn_testmodules_menu_tab;
+ },
+ TAB
+ {
+ id = ETestSetsMenuTab; // from application hrh
+ txt = qtn_testsets_menu_tab;
+ }
+ };
+ };
+ }
+*/
+
+// MAIN MENU
+//-----------------------------------------------------------------------------
+//
+// r_appui_mainmenuview
+// Mainmenu view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_mainmenuview
+ {
+ menubar=r_appui_menubar_mainmenuview;
+ cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_menubar_mainmenuview
+// Main menu menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_mainmenuview
+ {
+ titles=
+ {
+ MENU_TITLE
+ {
+ menu_pane=r_appui_mainmenuview_menu;
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_mainmenuview_menu
+// Main menu options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_mainmenuview_menu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command= EAknCmdOpen;
+ txt = "Open";
+ },
+ MENU_ITEM
+ {
+ command = ECmdShowAbout;
+ txt = "About";
+ },
+ MENU_ITEM
+ {
+ command = EAknSoftkeyExit;
+ txt = "Exit";
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_main_menu_listbox
+// ListBox( Single )
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_main_menu_listbox
+ {
+ array_id = r_main_menu_items;
+ flags = EAknListBoxSelectionList;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_main_menu_items
+// Items array for Main Menu
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_main_menu_items
+ {
+ items =
+ {
+ LBUF
+ {
+ txt = qtn_mainmenulist_test_cases;
+ },
+ LBUF
+ {
+ txt = qtn_mainmenulist_modules;
+ },
+ LBUF
+ {
+ txt = qtn_mainmenulist_test_sets;
+ }
+ };
+ }
+
+
+
+// TEST CASES MENU
+//-----------------------------------------------------------------------------
+//
+// r_appui_testcasemenuview
+// Test case menu view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_testcasemenuview
+ {
+ menubar=r_appui_menubar_testcasemenuview;
+ cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_menubar_testcasemenuview
+// Test case view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_testcasemenuview
+ {
+ titles=
+ {
+ MENU_TITLE
+ {
+ menu_pane=r_appui_testcasemenuview_menu;
+ }
+ };
+
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_testcasemenuview_menu
+// Testcase view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_testcasemenuview_menu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command= EAknCmdOpen;
+ txt = "Open";
+ },
+ MENU_ITEM
+ {
+ command = EAknSoftkeyExit;
+ txt = "Exit";
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_testcase_menu_listbox
+// ListBox( Single )
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_testcase_menu_listbox
+ {
+ array_id = r_testcase_menu_items;
+ flags = EAknListBoxSelectionList;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_testcase_menu_items
+// Items array for Test Case Menu
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_testcase_menu_items
+ {
+ items =
+ {
+ LBUF
+ {
+ txt = qtn_testcasemenu_startcase; // "\tStart Case(s)";
+ },
+ LBUF
+ {
+ txt = qtn_testcasemenu_startedcases; // "\tStarted Cases";
+ }
+ };
+ }
+
+
+
+// START CASES
+//-----------------------------------------------------------------------------
+//
+// r_appui_startcasesview
+// Startcases view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_startcasesview
+ {
+ hotkeys=r_appui_hotkeys;
+ menubar=r_appui_menubar_startcasesview;
+ cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_menubar_startcasesview
+// Startcases view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_startcasesview
+ {
+ titles=
+ {
+ MENU_TITLE
+ {
+ menu_pane=r_appui_startcasesview_menu;
+ //menu_pane=R_AVKON_MENUPANE_MARKABLE_LIST;
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_loadtestsetview_menu
+// loadtestset view options menu.
+//
+//-----------------------------------------------------------------------------
+RESOURCE MENU_PANE r_appui_loadtestsetview_menu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command=EAknCmdOpen;
+ txt = qtn_start;
+ },
+ MENU_ITEM
+ {
+ command=EEikCmdExit;
+ txt = qtn_exit;
+ }
+ };
+ }
+//-----------------------------------------------------------------------------
+//
+// r_appui_loadtestsetview
+// Started cases view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_loadtestsetview
+ {
+ //hotkeys=r_appui_hotkeys;
+ menubar=r_appui_menubar_startedcasesmenuview;
+ cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_menubar_startedcasesmenuview
+// Started cases menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_loadtestsetview
+ {
+ titles=
+ {
+ MENU_TITLE
+ {
+ menu_pane=r_appui_loadtestsetview_menu;
+ }
+ };
+
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_startcasesview_menu
+// Startcases view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_startcasesview_menu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command = ECmdFilterMenu;
+ txt = qtn_filter_menu;
+ cascade = r_appui_filtermenu;
+ },
+ /*
+ MENU_ITEM
+ {
+ command=ECmdFilterByModule;
+ txt = qtn_filter_by_modules;
+ cascade = r_appui_filterbymodules_menu;
+ },
+ MENU_ITEM
+ {
+ command=ECmdFilterByTestCaseFile;
+ txt = qtn_filter_by_test_case_file;
+ cascade = r_appui_filter_by_testcasefile_menu;
+ },
+ MENU_ITEM
+ {
+ command=ECmdNOFiltering;
+ txt = qtn_no_filtering;
+ },
+ */
+ MENU_ITEM
+ {
+ command=ECmdMarkMenu;
+ txt = qtn_markmenu_title;
+ cascade = r_appui_markunmark_menu;
+ },
+ MENU_ITEM
+ {
+ command=ECmdStartCases;
+ txt = qtn_start_test_cases;
+ },
+ MENU_ITEM
+ {
+ command=EEikCmdExit;
+ txt = qtn_exit;
+ }
+ };
+ }
+
+
+
+// STARTED CASES
+//-----------------------------------------------------------------------------
+//
+// r_appui_startedcasesmenuview
+// Started cases view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_startedcasesmenuview
+ {
+ //hotkeys=r_appui_hotkeys;
+ menubar=r_appui_menubar_startedcasesmenuview;
+ cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_menubar_startedcasesmenuview
+// Started cases menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_startedcasesmenuview
+ {
+ titles=
+ {
+ MENU_TITLE
+ {
+ menu_pane=r_appui_startedcasesmenuview_menu;
+ }
+ };
+
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_startedcasesmenuview_menu
+// Started cases view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_startedcasesmenuview_menu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command= EAknCmdOpen;
+ txt = "Open";
+ },
+ MENU_ITEM
+ {
+ command = EAknSoftkeyExit;
+ txt = "Exit";
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_started_cases_menu_listbox
+// ListBox( Single )
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_started_cases_menu_listbox
+ {
+ array_id = r_startedcases_menu_items;
+ flags = EAknListBoxSelectionList;
+ }
+
+
+
+//-----------------------------------------------------------------------------
+//
+// r_startedcases_menu_items
+// Items array for Test Case Menu
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_startedcases_menu_items
+ {
+ items =
+ {
+ LBUF
+ {
+ txt = qtn_startedcases_allcases;
+ },
+ LBUF
+ {
+ txt = qtn_startedcases_ongoing;
+ },
+ LBUF
+ {
+ txt = qtn_startedcases_paused;
+ },
+ LBUF
+ {
+ txt = qtn_startedcases_passed;
+ },
+ LBUF
+ {
+ txt = qtn_startedcases_failed;
+ },
+ LBUF
+ {
+ txt = qtn_startedcases_crashed_aborted;
+ },
+ LBUF
+ {
+ txt = qtn_startedcases_statistics;
+ }
+ };
+ }
+
+
+
+// SHOW STARTED CASES
+//-----------------------------------------------------------------------------
+//
+// r_appui_showstartedcasesview
+// Show started cases view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_showstartedcasesview
+ {
+ hotkeys=r_appui_hotkeys;
+ menubar=r_appui_menubar_showstartedcasesview;
+ cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_menubar_showstartedcasesview
+// Show started cases view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_showstartedcasesview
+ {
+ titles=
+ {
+ MENU_TITLE
+ {
+ menu_pane=r_appui_showstartedcasesview_menu;
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_showstartedcasesview_menu
+// Show started cases view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_showstartedcasesview_menu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command=ECmdViewOutput;
+ txt = qtn_view_output;
+ },
+ MENU_ITEM
+ {
+ command = ECmdFilterMenu;
+ txt = qtn_filter_menu;
+ cascade = r_appui_filtermenu;
+ },
+ MENU_ITEM
+ {
+ command=ECmdShowSetMenu;
+ txt = qtn_testcase_control_menu;
+ cascade = r_testcase_control_submenu;
+ },
+ MENU_ITEM
+ {
+ command=EEikCmdExit;
+ txt = qtn_exit;
+ }
+
+ /*
+ MENU_ITEM
+ {
+ command=ECmdPauseTestCase;
+ txt = qtn_pause_testcase;
+ },
+ MENU_ITEM
+ {
+ command=ECmdResumeTestCase;
+ txt = qtn_resume_testcase;
+ },
+ MENU_ITEM
+ {
+ command=ECmdAbortTestCase;
+ txt = qtn_abort_testcase;
+ },
+ */
+
+ /*
+ MENU_ITEM
+ {
+ command=ECmdFilterByModule;
+ txt = qtn_filter_by_modules;
+ cascade = r_appui_filterbymodules_menu;
+ },
+ MENU_ITEM
+ {
+ command=ECmdFilterByTestCaseFile;
+ txt = qtn_filter_by_test_case_file;
+ cascade = r_appui_filter_by_testcasefile_menu;
+ },
+ MENU_ITEM
+ {
+ command=ECmdNOFiltering;
+ txt = qtn_no_filtering;
+ },
+ */
+
+ /*
+ MENU_ITEM
+ {
+ command=ECmdRemoveExecution;
+ txt = qtn_remove_execution;
+ },
+ MENU_ITEM
+ {
+ command=ECmdRemoveAllExecutions;
+ txt = qtn_remove_all_executions;
+ },
+ */
+
+ };
+ }
+
+
+// STATISTICS VIEW
+//-----------------------------------------------------------------------------
+//
+// r_appui_statisticsview
+// Statistics view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_statisticsview
+ {
+ menubar= r_appui_menubar_statisticsview;
+ cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_menubar_statisticsview
+// Statistics view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_statisticsview
+ {
+ titles=
+ {
+ MENU_TITLE
+ {
+ menu_pane=r_appui_statisticsview_menu;
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_statisticsview_menu
+// Statistics view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_statisticsview_menu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command=ECmdFilterByModule;
+ txt = qtn_filter_by_modules;
+ cascade = r_appui_filterbymodules_menu;
+ },
+ MENU_ITEM
+ {
+ command=ECmdFilterByTestCaseFile;
+ txt = qtn_filter_by_test_case_file;
+ cascade = r_appui_filter_by_testcasefile_menu;
+ },
+ MENU_ITEM
+ {
+ command=ECmdNOFiltering;
+ txt = qtn_no_filtering;
+ },
+
+ MENU_ITEM
+ {
+ command=EEikCmdExit;
+ txt = qtn_exit;
+ }
+ };
+ }
+
+
+// TESTCASE OUTPUT VIEW
+//-----------------------------------------------------------------------------
+//
+// r_appui_testcaseoutputview
+// Testcase output view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_testcaseoutputview
+ {
+ hotkeys=r_appui_hotkeys;
+ menubar=r_appui_menubar_testcaseoutputview;
+ cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_menubar_testcaseoutputview
+// Testcase output view menub bar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_testcaseoutputview
+ {
+ titles=
+ {
+ MENU_TITLE
+ {
+ menu_pane=r_appui_testcaseoutputview_menu;
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_testcaseoutputview_menu
+// Testcase output view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_testcaseoutputview_menu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command=ECmdPauseTestCase;
+ txt = qtn_pause_testcase;
+ },
+ MENU_ITEM
+ {
+ command=ECmdResumeTestCase;
+ txt = qtn_resume_testcase;
+ },
+ MENU_ITEM
+ {
+ command=ECmdAbortTestCase;
+ txt = qtn_abort_testcase;
+ },
+ MENU_ITEM
+ {
+ command=EEikCmdExit;
+ txt = qtn_exit;
+ }
+ };
+ }
+
+
+
+// MODULES MENU
+//-----------------------------------------------------------------------------
+//
+// r_appui_testmodulesmenuview
+// Test modules menu view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_testmodulesmenuview
+ {
+ hotkeys=r_appui_hotkeys;
+ menubar=r_appui_menubar_testmodulesmenuview;
+ cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_menubar_testmodulesmenuview
+// Test modules view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_testmodulesmenuview
+ {
+ titles=
+ {
+ MENU_TITLE
+ {
+ menu_pane=r_appui_testmodulesmenuview_menu;
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_testmodulesmenuview_menu
+// Testmodules view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_testmodulesmenuview_menu
+ {
+ items=
+ {
+ // MENU_ITEM
+ // {
+ // command=ECmdOpenModule;
+ // txt = qtn_open_module;
+ // },
+ MENU_ITEM
+ {
+ command=ECmdAddModule;
+ txt = qtn_add_module;
+ },
+ MENU_ITEM
+ {
+ command=ECmdRemoveModule;
+ txt = qtn_remove_module;
+ },
+ MENU_ITEM
+ {
+ command=EAknCmdExit;
+ txt = qtn_exit;
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+// r_testmodules_menu_listbox
+// ListBox( Single )
+//
+//-----------------------------------------------------------------------------
+//
+/*
+RESOURCE LISTBOX r_testmodules_menu_listbox
+ {
+ array_id = r_testmodules_menu_items;
+ flags = EAknListBoxSelectionList;
+ }
+*/
+
+//-----------------------------------------------------------------------------
+// r_testmodules_menu_items
+// Items array for Test Case Menu
+//
+//-----------------------------------------------------------------------------
+//
+/*
+RESOURCE ARRAY r_testmodules_menu_items
+ {
+ items =
+ {
+ LBUF
+ {
+ txt = "\tModule1";
+ },
+ LBUF
+ {
+ txt = "\tModule2";
+ }
+ };
+ }
+*/
+
+
+// TEST SET BASE
+//-----------------------------------------------------------------------------
+//
+// r_appui_testsetbasemenuview
+// Testset base menu view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_testsetbasemenuview
+ {
+ menubar=r_appui_menubar_testsetbasemenuview;
+ cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_menubar_testsetbasemenuview
+// Testset base menu view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_testsetbasemenuview
+ {
+ titles=
+ {
+ MENU_TITLE
+ {
+ menu_pane=r_appui_testsetbasemenuview_menu;
+ }
+ };
+
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_testsetbasemenuview_menu
+// Testset base menu view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_testsetbasemenuview_menu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command= ECmdCreateTestSet;
+ txt = "Create test set";
+ },
+ MENU_ITEM
+ {
+ command= ECmdLoadTestSet;
+ txt = "Load test set";
+ },
+ MENU_ITEM
+ {
+ command = EAknSoftkeyExit;
+ txt = "Exit";
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_testsetbase_menu_listbox
+// ListBox( Single )
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_testsetbase_menu_listbox
+ {
+ array_id = r_testsetbase_menu_items;
+ flags = EAknListBoxSelectionList;
+ }
+
+
+
+//-----------------------------------------------------------------------------
+//
+// r_testsetbase_menu_items
+// Items array for Test Sets Base Menu
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_testsetbase_menu_items
+ {
+ items =
+ {
+ LBUF
+ {
+ txt = qtn_testsetbasemenu_createtestset;
+ },
+ LBUF
+ {
+ txt = qtn_testsetbasemenu_loadtestset;
+ }
+ };
+ }
+
+
+// TESTSET MENU
+//-----------------------------------------------------------------------------
+//
+// r_appui_testsetmenuview
+// Test set menu view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_testsetmenuview
+ {
+ menubar=r_appui_menubar_testsetmenuview;
+ cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_menubar_testsetmenuview
+// Test set menu view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_testsetmenuview
+ {
+ titles=
+ {
+ MENU_TITLE
+ {
+ menu_pane=r_appui_testsetmenuview_menu;
+ }
+ };
+
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_testsetmenuview_menu
+// Test set menu view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_testsetmenuview_menu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command= ECmdStartTestSet;
+ txt = "Start testing";
+ },
+ MENU_ITEM
+ {
+ command= ECmdShowStartedTestSet;
+ txt = "View started cases";
+ },
+ MENU_ITEM
+ {
+ command= ECmdSaveTestSet;
+ txt = "Save test set";
+ },
+ MENU_ITEM
+ {
+ command= ECmdInsertTestCases;
+ txt = "Insert test case(s)";
+ },
+ MENU_ITEM
+ {
+ command= ECmdRemoveTestCases;
+ txt = "Remove test case";
+ },
+ MENU_ITEM
+ {
+ command = EAknSoftkeyExit;
+ txt = "Exit";
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_testset_menu_listbox
+// ListBox( Single )
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_testset_menu_listbox
+ {
+ array_id = r_testset_menu_items;
+ flags = EAknListBoxSelectionList;
+ }
+
+
+
+//-----------------------------------------------------------------------------
+//
+// r_testset_menu_items
+// Items array for Test Sets Menu
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_testset_menu_items
+ {
+ items =
+ {
+ LBUF
+ {
+ txt = "";
+ }
+ };
+ }
+
+
+// TESTSET STARTED CASES
+//-----------------------------------------------------------------------------
+//
+// r_test_set_startedcasesview
+// Test set started cases view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_testset_startedcasesview
+ {
+ //hotkeys=r_appui_hotkeys;
+ menubar=r_testset_menubar_startedcasesview;
+ cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_test_set_menubar_startedcasesview
+// Test set started cases view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_testset_menubar_startedcasesview
+ {
+ titles=
+ {
+ MENU_TITLE
+ {
+ menu_pane=r_testset_startedcasesview_menu;
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_testset_startedcasesview_menu
+// Test set started cases view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_testset_startedcasesview_menu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ txt = qtn_testset_started_menu;
+ cascade = r_testset_startedcases_submenu;
+ },
+ MENU_ITEM
+ {
+ command=ECmdViewOutput;
+ txt = qtn_view_output;
+ },
+ MENU_ITEM
+ {
+ command=ECmdShowSetMenu;
+ txt = qtn_testcase_control_menu;
+ cascade = r_testcase_control_submenu;
+ },
+ MENU_ITEM
+ {
+ command=EEikCmdExit;
+ txt = qtn_exit;
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_testset_startedcases_submenu
+// Test set started cases view sub menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_testset_startedcases_submenu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command = ECmdShowAllStartedCases;
+ txt = qtn_testset_started_allcases;
+ },
+ MENU_ITEM
+ {
+ command = ECmdShowOngoingCases;
+ txt = qtn_testset_started_ongoing;
+ },
+ MENU_ITEM
+ {
+ command = ECmdShowPausedCases;
+ txt = qtn_testset_started_paused;
+ },
+ MENU_ITEM
+ {
+ command = ECmdShowPassedCases;
+ txt = qtn_testset_started_passed;
+ },
+ MENU_ITEM
+ {
+ command = ECmdShowFailedCases;
+ txt = qtn_testset_started_failed;
+ },
+ MENU_ITEM
+ {
+ command = ECmdShowCrashedAbortedCases;
+ txt = qtn_testset_started_crashed_aborted;
+ }
+ };
+ }
+
+
+// TESTSET INSERT CASES
+//-----------------------------------------------------------------------------
+//
+// r_insert_testcases_view
+// Insert test cases view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_insert_testcases_view
+ {
+ //hotkeys=r_appui_hotkeys;
+ menubar=r_insert_testcases_menubar;
+ cba=R_AVKON_SOFTKEYS_OPTIONS_CANCEL;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_insert_testcases_menubar
+// Insert test cases view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_insert_testcases_menubar
+ {
+ titles=
+ {
+ MENU_TITLE
+ {
+ menu_pane=r_insert_testcases_menu;
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_insert_testcases_menu
+// Insert test cases view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_insert_testcases_menu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command=ECmdInsertSelectedCases;
+ txt = qtn_testsetinsert_add_selected;
+ },
+ MENU_ITEM
+ {
+ command = ECmdFilterMenu;
+ txt = qtn_filter_menu;
+ cascade = r_appui_filtermenu;
+ },
+ MENU_ITEM
+ {
+ command=ECmdMarkMenu;
+ txt = qtn_markmenu_title;
+ cascade = r_appui_markunmark_menu;
+ },
+ MENU_ITEM
+ {
+ command=EEikCmdExit;
+ txt = qtn_exit;
+ }
+ };
+ }
+
+
+
+// GENERAL
+// MARKMENU
+//-----------------------------------------------------------------------------
+//
+// r_appui_markunmark_menu
+// Submenu for marking items.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_markunmark_menu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command=EAknCmdMark;
+ txt = qtn_markmenu_mark;
+ },
+ MENU_ITEM
+ {
+ command=EAknCmdUnmark;
+ txt = qtn_markmenu_unmark;
+ },
+ MENU_ITEM
+ {
+ command=EAknMarkAll;
+ txt = qtn_markmenu_markall;
+ },
+ MENU_ITEM
+ {
+ command=EAknUnmarkAll;
+ txt = qtn_markmenu_unmarkall;
+ }
+ };
+ }
+
+// TEST CASE CONTROL
+//-----------------------------------------------------------------------------
+//
+// r_testset_stertedcases_setmenu
+// Test set started cases view set menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_testcase_control_submenu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command=ECmdPauseTestCase;
+ txt = qtn_pause_testcase;
+ },
+ MENU_ITEM
+ {
+ command=ECmdResumeTestCase;
+ txt = qtn_resume_testcase;
+ },
+ MENU_ITEM
+ {
+ command=ECmdAbortTestCase;
+ txt = qtn_abort_testcase;
+ }
+ };
+ }
+
+// FILTERING
+//-----------------------------------------------------------------------------
+//
+// r_appui_filtermenu
+// MenuPane for Filter submenu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_filtermenu
+ {
+ items=
+ {
+ MENU_ITEM
+ {
+ command=ECmdFilterByModule;
+ txt = qtn_filter_by_modules;
+ cascade = r_appui_filterbymodules_menu;
+ },
+ MENU_ITEM
+ {
+ command=ECmdFilterByTestCaseFile;
+ txt = qtn_filter_by_test_case_file;
+ cascade = r_appui_filter_by_testcasefile_menu;
+ },
+ MENU_ITEM
+ {
+ command=ECmdNOFiltering;
+ txt = qtn_no_filtering;
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_filterbymodules_menu
+// MenuPane for Filter submenu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_filterbymodules_menu
+ {
+ items=
+ {
+ // items (modules) are added dynamically when
+ // Filter by module submenu is opened
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_appui_filter_by_testcasefile_menu
+// MenuPane for Filter submenu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_filter_by_testcasefile_menu
+ {
+ items=
+ {
+ // Items (testcase files are added dynamically when
+ // Filter by testcase file menu is opened
+ };
+ }
+
+
+// DIALOGS
+// START TEST CASES
+//-----------------------------------------------------------------------------
+//
+// r_start_testcase_list_query
+// Query dialog for starting single test case.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LIST_QUERY r_start_testcase_list_query
+ {
+ flags = EGeneralQueryFlags;
+ softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
+ items =
+ {
+ DLG_LINE //AVKON_LIST_QUERY_DLG_LINE
+ {
+ type = EAknCtListQueryControl;
+ id = EListQueryControl;
+ control = AVKON_LIST_QUERY_CONTROL
+ {
+ listtype = EAknCtSinglePopupMenuListBox;
+ listbox = LISTBOX //AVKON_LIST_QUERY_LIST
+ {
+ flags = EAknListBoxMenuList;
+ height = 3;
+ width = 3;
+ array_id = r_start_testcase_listbox_item_array;
+ };
+ heading = qtn_starting_test_case;
+ };
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_start_testcase_listbox_item_array
+// Listbox items in query dialog for starting single test case.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_start_testcase_listbox_item_array
+ {
+ items =
+ {
+ LBUF { txt = qtn_start_test; },
+ LBUF { txt = qtn_start_test_output; }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_start_multiple_testcases_list_query
+// Query dialog for starting multiple test cases.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LIST_QUERY r_start_multiple_testcases_list_query
+ {
+ flags = EGeneralQueryFlags;
+ softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
+ items =
+ {
+ DLG_LINE //AVKON_LIST_QUERY_DLG_LINE
+ {
+ type = EAknCtListQueryControl;
+ id = EListQueryControl;
+ control = AVKON_LIST_QUERY_CONTROL
+ {
+ listtype = EAknCtSinglePopupMenuListBox;
+ listbox = LISTBOX //AVKON_LIST_QUERY_LIST
+ {
+ flags = EAknListBoxMenuList;
+ height = 3;
+ width = 3;
+ array_id = r_start_multiple_testcases_listbox_item_array;
+ };
+ heading = qtn_starting_test_cases;
+ };
+ }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_start_multiple_testcases_listbox_item_array
+// Listbox items in query dialog for starting single test case.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_start_multiple_testcases_listbox_item_array
+ {
+ items =
+ {
+ LBUF { txt = qtn_start_tests_parallel; },
+ LBUF { txt = qtn_start_tests_serial; }
+ };
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_general_confirmation_dialog
+// General confirmation dialog with empty label.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_general_confirmation_dialog
+ {
+ flags = EGeneralQueryFlags;
+ buttons = R_AVKON_SOFTKEYS_YES_NO;
+ items =
+ {
+ DLG_LINE
+ {
+ type = EAknCtQuery;
+ id = EGeneralQuery;
+ control = AVKON_CONFIRMATION_QUERY
+ {
+ layout = EConfirmationQueryLayout;
+ label = "";
+ };
+ }
+ };
+
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_stifui_about_dialog
+// "About" dialog
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_stifui_about_dialog
+{
+ flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow;
+ buttons = R_AVKON_SOFTKEYS_OK_EMPTY;
+ items=
+ {
+ DLG_LINE
+ {
+ type = EAknCtPopupHeadingPane;
+ id = EAknMessageQueryHeaderId;
+ control = AVKON_HEADING
+ {
+ label = "About STIF";
+ headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE;
+ };
+ },
+ DLG_LINE
+ {
+ type = EAknCtMessageQuery;
+ id = EAknMessageQueryContentId;
+ control = AVKON_MESSAGE_QUERY
+ {
+
+ };
+ }
+ };
+}
+
+//-----------------------------------------------------------------------------
+//
+// r_memory_selection_dialog
+// Selection dialog for selectiong either C or E drive.
+// Not yet used.
+//
+//-----------------------------------------------------------------------------
+//
+/*
+RESOURCE MEMORYSELECTIONDIALOG r_memory_selection_dialog
+ {
+ title = "Choose memory:";
+ softkey_1 = "Ok";
+ softkey_2 = "Cancel";
+ locations =
+ {
+ LOCATION { root_path = "C:\\"; },
+ LOCATION { root_path = "E:\\"; //default_folder = "TestFramework\\";
+ }
+ };
+ }
+*/
+
+//-----------------------------------------------------------------------------
+//
+// r_file_selection_dialog
+// Fileselection dialog.
+// Not yet used.
+//
+//-----------------------------------------------------------------------------
+//
+/*
+RESOURCE FILESELECTIONDIALOG r_file_selection_dialog
+ {
+ title = "Select-a-file:";
+ root_path = "C:\\";
+ filters =
+ {
+ FILTER
+ {
+ filter_type = EAttributeFilter; //EAttributeFilter;
+ filter_style = EExclusiveFilter; //EExclusiveFilter;
+ filter_data =
+ {
+ "SH",
+ "R"
+ }; // Excludes system, hidden and read-only attributes
+ }
+ };
+ }
+*/
+
+
+// APPLICATION NAVIPANEL TITLES
+//-----------------------------------------------------------------------------
+//
+// r_navititle_main
+// Main menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_main
+ {
+ txt = qtn_navi_main;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_testcases
+// Test cases menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_testcases
+ {
+ txt = qtn_navi_testcases;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_startcases
+// Startcases menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_startcases
+ {
+ txt = qtn_navi_startcases;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_loadtestset
+// Startcases menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_loadtestset
+ {
+ txt = qtn_navi_load_test_set;
+ }
+
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_startedcases
+// Started cases menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_startedcases
+ {
+ txt = qtn_navi_startedcases;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_testcase_output
+// Test case output view title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_testcase_output
+ {
+ txt = qtn_navi_testcase_output;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_modules
+// Modules menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_modules
+ {
+ txt = qtn_navi_modules;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_testset_base
+// Testset base menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_testset_base
+ {
+ txt = qtn_navi_testset_base;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_testset
+// Testset menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_testset
+ {
+ txt = qtn_navi_testset;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_testset_insert
+// Testset insert menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_testset_insert
+ {
+ txt = qtn_navi_testset_insert;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_started
+// Started cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_started
+ {
+ txt = qtn_navi_started;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_started_all
+// All started cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_started_all
+ {
+ txt = qtn_navi_started_all;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_started_ongoing
+// Ongoing cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_started_ongoing
+ {
+ txt = qtn_navi_started_ongoing;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_started_paused
+// Paused cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_started_paused
+ {
+ txt = qtn_navi_started_paused;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_started_passed
+// Passed cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_started_passed
+ {
+ txt = qtn_navi_started_passed;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_started_failed
+// Failed cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_started_failed
+ {
+ txt = qtn_navi_started_failed;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_started_crashed_aborted
+// Crashed cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_started_crashed_aborted
+ {
+ txt = qtn_navi_started_crashed_aborted;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_navititle_started_stats
+// Statistics view menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_started_stats
+ {
+ txt = qtn_navi_started_stats;
+ }
+
+
+// RESOURCE TEXTS
+//-----------------------------------------------------------------------------
+//
+// r_insert_confirmation_question
+// Insert test cases confirmation query text.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE STRING r_insert_confirmation_question
+ {
+ text = qtn_insert_confirmation;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_insert_nocases_text
+// Infomsg text to inform user that there´s no test cases selected when
+// trying to insert test cases.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE STRING r_insert_nocases_text
+ {
+ text = qtn_insert_none_selected;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_insert_confirmation_question
+// Overwrite existing test set confirmation query text.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE STRING r_overwrite_testset_question
+ {
+ text = qtn_owerwrite_testset_confirmation;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_insert_confirmation_question
+// Save test set confirmation query text.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE STRING r_save_testset_question
+ {
+ text = qtn_save_testset_confirmation;
+ }
+
+//-----------------------------------------------------------------------------
+//
+// r_insert_confirmation_question
+// Loading test set failed text.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE STRING r_load_testset_failed
+ {
+ text = qtn_load_testset_errornote;
+ }
+
+
+// TEST CASE STATES
+RESOURCE STRING r_testcase_state_running
+ {
+ text = qtn_testcase_state_running;
+ }
+
+RESOURCE STRING r_testcase_state_passed
+ {
+ text = qtn_testcase_state_passed;
+ }
+
+RESOURCE STRING r_testcase_state_failed
+ {
+ text = qtn_testcase_state_failed;
+ }
+
+RESOURCE STRING r_testcase_state_crashed_aborted
+ {
+ text = qtn_testcase_state_crashed_aborted;
+ }
+
+RESOURCE STRING r_testcase_state_unknown
+ {
+ text = qtn_testcase_state_unknown;
+ }
+
+RESOURCE LOCALISABLE_APP_INFO r_stifui_localisable_app_info
+ {
+ short_caption = qtn_app_short_caption_string;
+ caption_and_icon =
+ CAPTION_AND_ICON_INFO
+ {
+ caption = qtn_app_caption_string;
+ };
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/data/Stifui_reg.rss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file defines StifUI resources.
+*
+*/
+
+#include <Stifui.rsg>
+#include <appinfo.rh>
+#if defined (__S60_)
+ #include <data_caging_paths_strings.hrh>
+#endif
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0x1028311D
+
+RESOURCE APP_REGISTRATION_INFO
+ {
+ app_file = "Stifui";
+ localisable_resource_file = APP_RESOURCE_DIR"\\Stifui";
+ localisable_resource_id = R_STIFUI_LOCALISABLE_APP_INFO;
+ group_name = "RnD Tools";
+ }
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/group/Stifui.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: STIFUI MMP file.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+TARGET Stifui.exe
+TARGETTYPE exe
+UID 0x100039ce 0x1028311D
+VENDORID 0x101FB657
+SECUREID 0x102073DC
+CAPABILITY AllFiles SwEvent CommDD
+
+START RESOURCE ../data/Stifui.rss
+ HEADER
+ TARGETPATH resource/apps
+END
+
+SOURCEPATH ../data
+START RESOURCE ./Stifui_reg.rss
+ DEPENDS stifui.rsg
+ TARGETPATH /private/10003a3f/apps
+END
+
+SOURCEPATH ../src
+
+
+SOURCE AppUIApp.cpp
+SOURCE AppUIAppUi.cpp
+SOURCE AppUIDocument.cpp
+SOURCE View.cpp
+SOURCE Container.cpp
+SOURCE UIStoreHandler.cpp
+
+SOURCE MainMenuView.cpp
+SOURCE MainMenuContainer.cpp
+
+SOURCE TestCaseMenuView.cpp
+SOURCE TestCaseMenuContainer.cpp
+
+SOURCE StartCasesView.cpp
+SOURCE StartCasesContainer.cpp
+
+SOURCE StartedCasesMenuView.cpp
+SOURCE StartedCasesMenuContainer.cpp
+
+SOURCE ShowStartedCasesView.cpp
+SOURCE ShowStartedCasesContainer.cpp
+
+SOURCE TestCaseOutputView.cpp
+SOURCE TestCaseOutputContainer.cpp
+
+SOURCE Testmodulesmenuview.cpp
+SOURCE TestModulesMenuContainer.cpp
+
+SOURCE StatisticsView.cpp
+SOURCE StatisticsContainer.cpp
+
+SOURCE TestSetBaseMenuView.cpp
+SOURCE TestSetBaseMenuContainer.cpp
+
+SOURCE TestSetMenuView.cpp
+SOURCE TestSetMenuContainer.cpp
+
+SOURCE TestSetInsertMenuView.cpp
+SOURCE TestSetInsertMenuContainer.cpp
+
+SOURCE TestSetStartedCasesView.cpp
+SOURCE TestSetStartedCasesContainer.cpp
+
+//SOURCE MenuListBox.cpp
+
+SOURCE MenuListBox.cpp CreatedTestSetMenuContainer.cpp CreatedTestSetMenuView.cpp
+
+USERINCLUDE ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY apparc.lib
+LIBRARY cone.lib
+LIBRARY eikcore.lib
+
+LIBRARY eikcoctl.lib
+LIBRARY avkon.lib
+
+LIBRARY stiftestengine.lib
+LIBRARY stiftestinterface.lib
+LIBRARY bafl.lib
+LIBRARY eikctl.lib // For adding icons
+LIBRARY StifTFwIf.lib
+LIBRARY efsrv.lib
+
+LIBRARY egul.lib
+LIBRARY aknskins.lib
+LIBRARY aknicon.lib
+
+START WINS
+// ?wins_specific_information
+END
+
+START MARM
+// ?marm_specific_information
+END
+
+EPOCHEAPSIZE 0x10000 0x500000
+EPOCSTACKSIZE 32768
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: bld.inf build information for STIF UI.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// ARM4 not supported in SDK
+
+ DEFAULT
+
+
+PRJ_EXPORTS
+// None
+
+PRJ_TESTEXPORTS
+// None
+
+PRJ_MMPFILES
+
+ Stifui.mmp
+
+PRJ_TESTMMPFILES
+// None
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/AppUIApp.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CAppUIApp class declaration.
+*
+*/
+
+#ifndef APPUIAPP_H
+#define APPUIAPP_H
+
+// INCLUDES
+#include <aknapp.h>
+
+// CONSTANTS
+// UID of the application
+const TUid KUidAppUI = { 0x1028311D };
+
+// CLASS DECLARATION
+
+/**
+* CAppUIApp application class.
+* Provides factory to create concrete document object.
+*
+*/
+class CAppUIApp : public CAknApplication
+ {
+
+ public: // Functions from base classes
+ private:
+
+ /**
+ * From CApaApplication, creates CAppUIDocument document object.
+ * @return A pointer to the created document object.
+ */
+ CApaDocument* CreateDocumentL();
+
+ /**
+ * From CApaApplication, returns application's UID (KUidAppUI).
+ * @return The value of KUidAppUI.
+ */
+ TUid AppDllUid() const;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/AppUIAppUi.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,222 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CAppUIAppUi class declaration.
+*
+*/
+
+#ifndef APPUIAPPUI_H
+#define APPUIAPPUI_H
+
+// INCLUDES
+#include <eikapp.h>
+#include <e32std.h>
+#include <aknViewAppUi.h>
+#include <akntabgrp.h>
+#include <aknnavide.h>
+#include <StifLogger.h>
+#include "Stifui.hrh"
+
+//#include "UIStoreIf.h"
+//#include "UIStore.h"
+//#include "UIEngine.h"
+//#include "SettingServerClient.h"
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <SettingServerClient.h>
+
+#include "UIStoreHandler.h"
+
+
+// FORWARD DECLARATIONS
+class CAppUIContainer;
+class CUIStoreHandler;
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+_LIT( KDefaultPathAndIni, "C:\\TestFramework\\TestFramework.ini" );
+
+// CLASS DECLARATION
+
+
+/**
+ * Class contains static methods for calling different
+ * types of message dialog boxes.
+ */
+class TMessageBoxUtil
+ {
+ public:
+
+ /**
+ * Display message that executed funtion is not implemented yet.
+ */
+ static void ShowNotImplementedYetL();
+
+ /**
+ * Display error note.
+ * @param aMessage Error message to display.
+ */
+ static void ShowErrorNoteL( const TDesC& aMessage );
+ };
+
+
+/**
+* Application UI class.
+* Provides support for the following features:
+* - EIKON control architecture
+* - view architecture
+* - status pane
+*
+*/
+class CAppUIAppUi : public CAknViewAppUi
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CAppUIAppUi();
+
+ public: // New functions
+
+ /**
+ * Returns pointer to UIStoreHandler object,
+ * which handles test cases and test modules.
+ * @return UIStoreHandler to CData object
+ */
+ CUIStore* UIStoreHandler();
+
+ /**
+ * Shows outputs of the test case.
+ * @param aTestCase Pointer to started test case.
+ */
+ void ShowTestCaseOutput(CStartedTestCase* aTestCase);
+
+ /**
+ * Receives output update notification from CData.
+ * @param aTestCase Pointer to started test case.
+ * @param aStatus Status.
+ */
+ void OutputUpdateL( CStartedTestCase* aTestCase, TInt aStatus );
+
+ /**
+ * Sets pointer to selected test case for viewing output.
+ * @param aStartedCase Pointer to started test case.
+ */
+ void SetStartedTestCase( CStartedTestCase* aStartedCase );
+
+ /**
+ * Returns pointer to started test case for viewing output.
+ * @return Poiner to started test case.
+ */
+ CStartedTestCase* GetStartedTestCase( );
+
+ /**
+ * Saves position of focus of any specific view
+ * @param aViewId ID of view under which the position will be stored
+ * @param aPosition is a number to be stored
+ */
+ void SaveFocusPosition(TAppUIViewNumber aViewId, TInt aPosition);
+
+ /**
+ * Used to retrieve previous focus position in a specific view
+ * @param aViewId - ID of view that the position should be retrieved for
+ * @return the previous focus position
+ */
+ TInt GetFocusPosition(TAppUIViewNumber aViewId);
+
+
+ public: // Functions from base classes
+
+ private:
+ /**
+ * Initializes menu pane.
+ * @param aResourceId Menu pane resource ID.
+ * @param aMenuPane Menu pane pointer.
+ */
+ void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+ private:
+ /**
+ * From CEikAppUi, takes care of command handling.
+ * @param aCommand command to be handled
+ */
+ void HandleCommandL(TInt aCommand);
+
+ /**
+ * From CEikAppUi, handles key events.
+ * @param aKeyEvent Event to handled.
+ * @param aType Type of the key event.
+ * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed).
+ */
+ virtual TKeyResponse HandleKeyEventL(
+ const TKeyEvent& aKeyEvent,TEventCode aType);
+
+ private: //Data
+ CUIStoreHandler* iUIStoreHandler;
+ CStartedTestCase* iStartedTestCase;
+ TInt iPreviousView; // For Back function
+
+ RArray<TInt> iPreviousFocusPosition;
+ // used to store positions in different views
+
+ TBool iPreviousPositionListValid;
+ // used to mark validity of iPreviousFocusPosition array
+
+ public: //Data
+
+ /**
+ * Pointer to logger.
+ */
+ CStifLogger* iLogger;
+
+ /**
+ * Mode of view started cases.
+ */
+ TInt /*enum TShowStartedCasesMode*/ iShowStartedCasesMode;
+
+ /**
+ * Index of started test set.
+ */
+ TInt iStartedTestSet;
+
+ /**
+ * Handle to Setting server.
+ */
+ RSettingServer iSettingServer;
+
+ public: // Friend classes
+
+ protected: // Friend classes
+
+ private: // Friend classes
+
+ // For iExecutedTestCaseCount moving
+ friend class CStartCasesView;
+ friend class CStatisticsView;
+ friend class CTestCaseOutputView;
+ friend class CTestSetInsertMenuView;
+ friend class CTestSetMenuView;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/AppUIDocument.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CAppUIDocument class declaration.
+*
+*/
+
+#ifndef APPUIDOCUMENT_H
+#define APPUIDOCUMENT_H
+
+// INCLUDES
+#include <AknDoc.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CEikAppUi;
+
+// CLASS DECLARATION
+
+/**
+* CAppUIDocument application class.
+*/
+class CAppUIDocument : public CAknDocument
+ {
+ public: // Constructors and destructor
+ /**
+ * Two-phased constructor.
+ */
+ static CAppUIDocument* NewL(CEikApplication& aApp);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CAppUIDocument();
+
+ public: // New functions
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private:
+
+ /**
+ * Symbian OS default constructor.
+ */
+ CAppUIDocument(CEikApplication& aApp);
+ void ConstructL();
+
+ private:
+
+ /**
+ * From CEikDocument, create CAppUIAppUi "App UI" object.
+ */
+ CEikAppUi* CreateAppUiL();
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/Container.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,275 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestCaseListBoxModel class
+* declaration
+*
+*/
+
+#ifndef CCONTAINER_H
+#define CCONTAINER_H
+
+#include <e32std.h>
+// Define *.mbm file name.
+_LIT(KListMbmFileName, "\\Resource\\Apps\\Stifui.mbm");
+
+// INCLUDES
+#include "View.h"
+
+#include <coecntrl.h>
+#include <eiklbo.h> // MEikListBoxObserver
+#include <bamdesca.h> // MDesCArray
+#include <aknsfld.h>
+
+//#include "RRefArray.h"
+//#include "UIEngine.h"
+//#include "UIStoreIf.h"
+//#include "UIStoreContainer.h"
+
+#include <stifinternal/RRefArray.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CDesC16Array;
+
+//class CTestSetInsertMenuView;
+class CEikColumnListBox;
+class CStartedTestCase;
+
+class CUIStoreHandler;
+class CUIStore;
+class CUIStoreIf;
+class CUIEngineContainer;
+class CUIEngine;
+
+// CLASS DECLARATION
+
+class CTestCaseListBoxModel : public CBase, public MDesCArray
+ {
+ public:
+ /**
+ * Destructor.
+ */
+ ~CTestCaseListBoxModel();
+
+ /**
+ * Two-phased constructor.
+ * @param aTestCasesInView Array of test cases in view.
+ * @return Pointer to created list box model.
+ */
+ static CTestCaseListBoxModel* NewL(
+ RPointerArray<CTestInfo>* aTestCasesInView);
+
+ public: // Functions from base classes
+
+ /**
+ * Returns the number of descriptor elements in the array.
+ * @return The number of descriptor elements.
+ */
+ virtual TInt MdcaCount() const;
+
+ /**
+ * Indexes into a descriptor array.
+ * @param aIndex The position of the descriptor element within the
+ * array. The position is relative to zero; i.e. zero
+ * implies the first descriptor element in the array.
+ * This value must be non-negative and less than the
+ * number of descriptors currently within the array
+ * otherwise the operator panics with
+ * EArrayIndexOutOfRange.
+ * @return A non-modifiable pointer descriptor representing the
+ * descriptor element located at position aIndex within
+ * the array.
+ */
+ virtual TPtrC MdcaPoint( TInt aIndex ) const;
+ protected:
+ /**
+ * Symbian OS two phased constructor.
+ * Completes the construction of the object.
+ */
+ void ConstructL();
+
+ protected: //data
+ RPointerArray<CTestInfo>* iTestCasesInView;
+ HBufC* iBuffer;
+
+ private: //data
+
+ };
+
+/**
+* CContainer container control class.
+*
+*/
+class CContainer : public CCoeControl
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CContainer();
+
+ public: // New functions
+
+ /**
+ * Show only testcases which are defined is specified module.
+ * @param aModuleName Module which test cases are shown.
+ */
+ virtual void FilterCasesByModuleL(TName aModuleName);
+
+ /**
+ * Show only testcases which are defined in specified test case file.
+ * @param aTestCaseFileName Test cases file name.
+ */
+ virtual void FilterCasesByTCFileNameL(TFileName aTestCaseFileName);
+
+ /**
+ * Remove possible filtering of test cases -> show all test cases.
+ */
+ virtual void NoFilteringL();
+
+ /**
+ * Returns pointers to selected test cases.
+ * @param aSelectedTestCases Currently selected test case.
+ */
+ virtual void SelectedTestCases(RPointerArray<CTestInfo>& aSelectedTestCases);
+
+ /**
+ * Returns pointers to currently (in list box) selected test cases info.
+ * @return Currently selected test case info.
+ */
+ virtual CTestInfo* SelectedTestCaseInfo();
+
+ /**
+ * Returns pointers to selected test cases info.
+ * @param aIndex test case index
+ * @return Currently selected test case info.
+ */
+ virtual CTestInfo* TestCaseInfo( TInt aIndex );
+
+ /**
+ * Sets graphic icon using listbox as CEikColumnListBox.
+ * @param aListBox Pointer to list box.
+ */
+ virtual void SetGraphicIconL( CEikColumnListBox* aListBox );
+
+ /**
+ * Appends graphics data.
+ * @param aIcons Pointer array of icons.
+ */
+ virtual void GraphicIconL( CArrayPtr<CGulIcon>* aIcons );
+
+ /**
+ * Gets the index number of the current item in the view.
+ * @return Index number of the current item.
+ */
+ virtual TInt CurrentItemIndex();
+
+ /**
+ * Sets the current item.
+ * @param aIndex Index of the item to make current.
+ */
+ virtual void SetCurrentItemIndex(TInt aCurrentTestCase);
+
+ /**
+ * Inline function for getting pointer to list box.
+ * @return Pointer to list box.
+ */
+ virtual inline CEikListBox* ListBox() { return (CEikListBox*)iListBox; };
+
+
+
+ /**
+ * Processes user commands.
+ * @param aCommand ID of the command to respond to.
+ */
+ virtual void ProcessCommandL( TInt aCommand );
+
+ /**
+ * Processes user commands.
+ * @param aCommand ID of the command to respond to.
+ */
+ virtual void SelectionListProcessCommandL( TInt aCommand );
+
+ /**
+ * Handles mark commands.
+ * @param aCommand ID of the command to respond to.
+ */
+ virtual void HandleMarkCommandL( TInt aCommand );
+
+
+
+ public: // Functions from base classes
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ virtual void SizeChanged();
+
+
+
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * Gets a count of the component controls of this list box control.
+ * This information is used for DrawNow().
+ */
+ virtual TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets a pointer to the specified component control.
+ * @param aIndex Index of the component control to look up.
+ * @return The control at aIndex.
+ */
+ virtual CCoeControl* ComponentControl(TInt aIndex) const;
+
+
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ virtual void Draw(const TRect& aRect) const;
+
+ protected: //data
+
+ CView* iParentView;
+ CEikColumnListBox* iListBox;
+ //CEikTextListBox* iListBox;
+ CTestCaseListBoxModel* iListBoxModel;
+ RPointerArray<CTestInfo> iTestCasesInView;
+ CUIStore* iUIStore;
+
+ private: //data
+
+ };
+
+#endif // CTestSetInsertMenuContainer_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/CreatedTestSetMenuContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CCreatedTestSetMenuContainer
+* class declaration.
+*
+*/
+
+#ifndef CREATETESTSETMENUCONTAINER_H
+#define CREATETESTSETMENUCONTAINER_H
+
+// INCLUDES
+#include "Container.h"
+
+#include <coecntrl.h>
+#include <eiklbo.h> // MEikListBoxObserver
+#include <bamdesca.h> // MDesCArray
+#include <aknsfld.h>
+
+#include <stifinternal/RRefArray.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CDesC16Array;
+
+class CCreatedTestSetMenuView;
+class CEikColumnListBox;
+class CStartedTestCase;
+
+class CUIStoreHandler;
+class CUIStore;
+class CUIStoreIf;
+class CUIEngineContainer;
+class CUIEngine;
+
+// CLASS DECLARATION
+/**
+* CCreatedTestSetMenuContainer container control class.
+*
+*/
+class CCreatedTestSetMenuContainer : public CContainer//public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ */
+ void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+ /**
+ * Destructor.
+ */
+ ~CCreatedTestSetMenuContainer();
+
+ public: // New functions
+
+ /**
+ * Stores current position of focus of iListBox to the CAppUiAppUi object
+ */
+ void SaveActiveLine();
+
+ public: // Functions from base classes
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ void SizeChanged();
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * Gets a count of the component controls of this list box control.
+ * This information is used for DrawNow().
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets a pointer to the specified component control.
+ * @param aIndex Index of the component control to look up.
+ * @return The control at aIndex.
+ */
+ CCoeControl* ComponentControl(TInt aIndex) const;
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * From CCoeControl,OfferKeyEventL
+ * Handles key events.
+ * @param aKeyEvent The key event.
+ * @param aType The type of key event.
+ * @return Indicates whether or not the key event was used
+ * by this control.
+ */
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+ private: //data
+
+ CCreatedTestSetMenuView* iParentView;
+ };
+
+#endif // CREATETESTSETMENUCONTAINER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/CreatedTestSetMenuView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CCreatedTestSetMenuView class
+* declaration.
+*
+*/
+
+#ifndef CREATEDTESTSETSETMENUVIEW_H
+#define CREATEDTESTSETSETMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h>
+
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CCreatedTestSetMenuContainer;
+
+
+// CLASS DECLARATION
+
+/**
+* CTestCaseMenuView view class.
+*
+*/
+class CCreatedTestSetMenuView : public CView, public MEikListBoxObserver //CAknView
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CCreatedTestSetMenuView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ void HandleClientRectChange();
+
+ /**
+ * Handles a list box event.
+ * @param aListBox A pointer to list box.
+ * @param aEventType Type of list box event.
+ */
+ void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+ public: // New functions
+
+
+
+ private:
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ void DoDeactivate();
+
+
+ private: // New functions
+
+ /**
+ * Checks listbox selections and launches
+ * query dialog to start test cases.
+ * @param aListBox Pointer to listbox.
+ */
+ void CheckListBoxSelectionsL(CEikListBox* aListBox);
+
+ private: // Data
+ CAknNavigationDecorator* iNaviDecorator;
+ CCreatedTestSetMenuContainer* iContainer;
+ TInt iCurrentTestCase;
+ TBufC<50> iCurrentTestSet;
+ TBool iSaveNeeded;
+ };
+
+#endif //CREATEDTESTSETSETMENUVIEW_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/MainMenuContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CMainMenuContainer class definition.
+*
+*/
+
+#ifndef CMAINMENUCONTAINER_H
+#define CMAINMENUCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+
+// CLASS DECLARATION
+
+/**
+* CMainMenuContainer container control class.
+*
+*/
+class CMainMenuContainer : public CCoeControl, public MEikListBoxObserver /* MCoeControlObserver */
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ */
+ void ConstructL(const TRect& aRect);
+
+ /**
+ * Destructor.
+ */
+ ~CMainMenuContainer();
+
+ public: // New functions
+
+ /**
+ * Get currently selected items index.
+ * @return Current item index.
+ */
+ TInt GetActiveLine();
+
+ /**
+ * Makes the iListBox store its focus position to CAppUiAppUi object
+ */
+ void SaveActiveLine();
+
+ public: // Functions from base classes
+
+ /**
+ * Method HandleSelectedListItemL handles valix index.
+ * @param aIndex Current item index.
+ */
+ void HandleSelectedListItemL( TInt aIndex );
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ void SizeChanged();
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * @return Number of controls indside this container.
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets the specified component of a compound control.
+ * @param aIndex The index of the control to get.
+ * @return The component control with an index of aIndex.
+ */
+ CCoeControl* ComponentControl(TInt aIndex) const;
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * Handles list box events.
+ * @param aListBox The originating list box.
+ * @param aEventType A code for the event. Further information may be
+ * obtained by accessing the list box itself.
+ */
+ void HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType);
+
+ /**
+ * From CCoeControl,OfferKeyEventL
+ * Handles key events.
+ * @param aKeyEvent The key event.
+ * @param aType The type of key event.
+ * @return Indicates whether or not the key event was used
+ * by this control.
+ */
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+
+ private: //data
+
+ CEikTextListBox* iListBox;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/MainMenuView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CMainMenuView class declaration.
+*
+*/
+
+#ifndef MAINMENUVIEW_H
+#define MAINMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <aknnavide.h>
+
+// CONSTANTS
+// UID of view
+const TUid KMainMenuViewId = {1};
+
+// FORWARD DECLARATIONS
+class CMainMenuContainer;
+
+// CLASS DECLARATION
+
+/**
+* CMainMenuView view class.
+*
+*/
+class CMainMenuView : public CView //CAknView
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CMainMenuView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ void HandleClientRectChange();
+
+ private:
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ void DoDeactivate();
+
+ private: // Data
+ CMainMenuContainer* iContainer;
+ CAknNavigationDecorator* iNaviDecorator;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/MenuListBox.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CMenuListBox class declaration.
+*
+*/
+
+#ifndef MENULISTBOX_H_
+#define MENULISTBOX_H_
+
+// INCLUDES
+#include <eiktxlbx.h>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+#include <aknview.h>
+#include <aknlists.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* CMenuListBox class. Has ability to store and retrieve previous focus position
+*/
+class CMenuListBox : public CAknSingleStyleListBox
+ {
+ public: // Constructors and destructor
+
+ static CMenuListBox* NewL(TAppUIViewNumber aViewId);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CMenuListBox();
+
+ /**
+ * Sets focus on last chosen position
+ */
+ void SetPreviousFocus();
+
+ /**
+ * Saves position of focus to CAppUiAppUi object
+ */
+ void SaveFocusPosition();
+
+ private: // Constructors and destructor
+
+ CMenuListBox(TAppUIViewNumber aViewId);
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ public: // Functions from base classes
+
+ private:
+
+ private: // Data
+ const TAppUIViewNumber iViewId;
+ };
+
+#endif /*MENULISTBOX_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/ShowStartedCasesContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,252 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStartedTestsListBoxModel class
+* declaration.
+*
+*/
+
+#ifndef CSHOWSTARTEDCASESCONTAINER_H
+#define CSHOWSTARTEDCASESCONTAINER_H
+
+// INCLUDES
+#include "Container.h"
+
+#include <coecntrl.h>
+#include <eiklbo.h>
+#include <bamdesca.h> // MDesCArray
+
+//#include "RRefArray.h"
+#include <stifinternal/RRefArray.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CAknSingleGraphicStyleListBox;
+class CDesC16ArrayFlat;
+class CStartedTestCase;
+class CUIStore;
+
+// CLASS DECLARATION
+
+class CStartedTestsListBoxModel : public CTestCaseListBoxModel //public CBase, public MDesCArray
+ {
+ public:
+ /**
+ * Destructor.
+ */
+ ~CStartedTestsListBoxModel();
+
+ /**
+ * Two-phased constructor.
+ * @param aTestsInView Array of test cases in view.
+ * @return Pointer to created list box model.
+ */
+ static CStartedTestsListBoxModel* NewL(
+ RRefArray<CStartedTestCase>* aTestsInView);
+
+ public: // Functions from base classes
+
+ /**
+ * Returns the number of descriptor elements in the array.
+ * @return The number of descriptor elements.
+ */
+ TInt MdcaCount() const;
+
+ /**
+ * Indexes into a descriptor array.
+ * @param aIndex The position of the descriptor element within the
+ * array. The position is relative to zero; i.e. zero
+ * implies the first descriptor element in the array.
+ * This value must be non-negative and less than the
+ * number of descriptors currently within the array
+ * otherwise the operator panics with
+ * EArrayIndexOutOfRange.
+ * @return A non-modifiable pointer descriptor representing the
+ * descriptor element located at position aIndex within
+ * the array.
+ */
+ TPtrC MdcaPoint(TInt aIndex) const;
+
+ private:
+
+ /**
+ * Symbian OS two phased constructor.
+ * Completes the construction of the object.
+ */
+ void ConstructL();
+
+ private: //data
+ RRefArray<CStartedTestCase>* iTestCasesInView;
+ };
+
+/**
+* CShowStartedCasesContainer container control class.
+*
+*/
+class CShowStartedCasesContainer : public CContainer //public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ * @return Observer for list box.
+ */
+ void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+ /**
+ * Destructor.
+ */
+ ~CShowStartedCasesContainer();
+
+ public: // New functions
+
+ /**
+ * Show only testcases which are defined is specified module.
+ * @param aModuleName Module which test cases are shown.
+ */
+ void FilterCasesByModuleL(TName aModuleName);
+
+ /**
+ * Show only testcases which are defined in specified test case file.
+ * @param aTestCaseFileName Test cases file name.
+ */
+ void FilterCasesByTCFileNameL(TFileName aTestCaseFileName);
+
+ /**
+ * Remove possible filtering of test cases -> show all test cases.
+ */
+ void NoFilteringL();
+
+ /**
+ * Returns reference to currently selected test case in view (listbox).
+ * @return Currently selected test case.
+ */
+ CStartedTestCase* SelectedTestCase();
+
+ /**
+ * Constructs list box model without any filtering.
+ */
+ void ConstructListBoxModelL();
+
+ /**
+ * Draws the list box.
+ */
+ void DrawListBox();
+
+ /**
+ * Returns count of test cases in view.
+ * @return Count of test cases in view.
+ */
+ TInt TestsInViewCount();
+
+ /**
+ * Handles the addition of an item to the model.
+ */
+ void HandleItemAdditionL();
+
+ /**
+ * Handles the removal of an item from the model.
+ */
+ void HandleItemRemovalL();
+
+ /**
+ * Returns pointer to currently selected test case.
+ * @param Current test case.
+ */
+ CStartedTestCase* CurrentTestCase();
+
+ /**
+ * Sets the current item.
+ * @param aIndex Index of the item to make current.
+ */
+ void SetCurrentItemIndex(TInt aIndex);
+
+ /**
+ * Resets the selection indices, top and current item indices,
+ * the selection, and the horizontal scroll offset of this list box.
+ * This function does not redraw the list box.
+ */
+ void ResetListBox();
+
+ /**
+ * Removes items from list box.
+ */
+ void RemoveSelectedExecutionsL();
+
+ /**
+ * Removes all started test cases from list box.
+ */
+ void RemoveAllExecutionsInViewL();
+
+ /**
+ * Stores current position of focus of iListBox to the CAppUiAppUi object
+ */
+ void SaveActiveLine();
+
+ private: // New functions
+
+ public: // Functions from base classes
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ void SizeChanged();
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * Gets a count of the component controls of this list box control.
+ * This information is used for DrawNow().
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets a pointer to the specified component control.
+ * @param aIndex Index of the component control to look up.
+ * @return The control at aIndex.
+ */
+ CCoeControl* ComponentControl(TInt aIndex) const;
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * From CCoeControl,OfferKeyEventL
+ * Handles key events.
+ * @param aKeyEvent The key event.
+ * @param aType The type of key event.
+ * @return Indicates whether or not the key event was used
+ * by this control.
+ */
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+ private: //data
+
+ CStartedTestsListBoxModel* iListBoxModel;
+ RRefArray<CStartedTestCase> iStartedTestsPtrs;
+ };
+
+#endif // CSHOWSTARTEDCASESCONTAINER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/ShowStartedCasesView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CShowStartedCasesView class
+* declaration.
+*
+*/
+
+#ifndef SHOWSTARTEDCASESVIEW_H
+#define SHOWSTARTEDCASESVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h> //CAknNavigationDecorator
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CShowStartedCasesContainer;
+
+// CLASS DECLARATION
+
+/**
+* CShowStartedCasesView view class.
+*
+*/
+class CShowStartedCasesView : public CView, public MEikListBoxObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CShowStartedCasesView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ void HandleClientRectChange();
+
+ /**
+ * Handles a list box event.
+ * @param aListBox A pointer to list box (not used).
+ * @param aEventType Type of list box event.
+ */
+ void HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType);
+
+ public: // New functions
+
+ /**
+ * Handles status changes of test cases in view.
+ */
+ void TestCaseStateChangedL();
+
+ /**
+ * Handles call to view test case´s output data.
+ */
+ void ViewTestCaseOutputL();
+
+ private:
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ void DoDeactivate();
+
+ /** From MEikMenuObserver
+ * Initializes menu pane.
+ * @param aResourceId Menu pane resource ID
+ * @param aMenuPane Menu pane pointer
+ */
+ void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+ /**
+ * Refreshes view name shown in the navi pane.
+ */
+ void RefreshNaviTitleL();
+
+ private: // Data
+ CShowStartedCasesContainer* iContainer;
+ CAknNavigationDecorator* iNaviDecorator;
+ TName iFilterModule;
+ TFileName iFilterTestCaseFile;
+ TInt iSelectedTestCase; // Which testcase was
+ // selected when view
+ // was active earlier.
+ };
+
+#endif //SHOWSTARTEDCASESVIEW_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/StartCasesContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStartCasesContainer class
+* declaration.
+*
+*/
+
+#ifndef CSTARTCASESCONTAINER_H
+#define CSTARTCASESCONTAINER_H
+
+// INCLUDES
+#include "Container.h"
+
+#include <coecntrl.h>
+#include <eiklbo.h> // MEikListBoxObserver
+#include <bamdesca.h> // MDesCArray
+#include <aknsfld.h>
+
+//#include "RRefArray.h"
+//#include "UIEngine.h"
+//#include "UIStoreIf.h"
+//#include "UIStoreContainer.h"
+
+#include <stifinternal/RRefArray.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CDesC16Array;
+
+class CStartCasesView;
+class CEikColumnListBox;
+class CStartedTestCase;
+
+class CUIStoreHandler;
+class CUIStore;
+class CUIStoreIf;
+class CUIEngineContainer;
+class CUIEngine;
+
+// CLASS DECLARATION
+/**
+* CStartCasesContainer container control class.
+*
+*/
+class CStartCasesContainer : public CContainer//public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ */
+ void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+ /**
+ * Destructor.
+ */
+ ~CStartCasesContainer();
+
+ public: // New functions
+
+ /**
+ * Stores current position of focus of iListBox to the CAppUiAppUi object
+ */
+ void SaveActiveLine();
+
+ public: // Functions from base classes
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ void SizeChanged();
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * Gets a count of the component controls of this list box control.
+ * This information is used for DrawNow().
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets a pointer to the specified component control.
+ * @param aIndex Index of the component control to look up.
+ * @return The control at aIndex.
+ */
+ CCoeControl* ComponentControl(TInt aIndex) const;
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * From CCoeControl,OfferKeyEventL
+ * Handles key events.
+ * @param aKeyEvent The key event.
+ * @param aType The type of key event.
+ * @return Indicates whether or not the key event was used
+ * by this control.
+ */
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+ private: //data
+
+ CStartCasesView* iParentView;
+ };
+
+#endif // CSTARTCASESCONTAINER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/StartCasesView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStartCasesView class declaration.
+*
+*/
+
+#ifndef STARTCASESVIEW_H
+#define STARTCASESVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h>
+
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CStartCasesContainer;
+
+
+// CLASS DECLARATION
+
+/**
+* CTestCaseMenuView view class.
+*
+*/
+class CStartCasesView : public CView, public MEikListBoxObserver //CAknView
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CStartCasesView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ void HandleClientRectChange();
+
+ /**
+ * Handles a list box event.
+ * @param aListBox A pointer to list box.
+ * @param aEventType Type of list box event.
+ */
+ void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+ public: // New functions
+
+ /**
+ * Starts test case.
+ */
+ void StartTestCaseL();
+
+ /**
+ * Starts multiple test cases.
+ * @param aSelectedÍndexes Indexes of selected test cases.
+ */
+ void StartTestCasesL( RArray<TInt> aSelectedIndexes );
+
+ private:
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ void DoDeactivate();
+
+ /**
+ * Initializes menu pane.
+ * @param aResourceId Menu pane resource ID.
+ * @param aMenuPane Menu pane pointer.
+ */
+ void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+ private: // New functions
+
+ /**
+ * Checks listbox selections and launches
+ * query dialog to start test cases.
+ * @param aListBox Pointer to listbox.
+ */
+ void CheckListBoxSelectionsL(CEikListBox* aListBox);
+
+ private: // Data
+ CAknNavigationDecorator* iNaviDecorator;
+ CStartCasesContainer* iContainer;
+ TInt iCurrentTestCase;
+ };
+
+#endif //STARTCASESVIEW_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/StartedCasesMenuContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStartedCasesMenuContainer class
+* declaration.
+*
+*/
+
+#ifndef CSTARTEDCASESMENUCONTAINER_H
+#define CSTARTEDCASESMENUCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+
+// CLASS DECLARATION
+
+/**
+* CStartedCasesMenuContainer container control class.
+*
+*/
+class CStartedCasesMenuContainer : public CCoeControl , public MEikListBoxObserver /* MCoeControlObserver */
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ */
+ void ConstructL(const TRect& aRect );
+
+ /**
+ * Destructor.
+ */
+ ~CStartedCasesMenuContainer();
+
+ public: // New functions
+
+ /**
+ * Get currently selected items index.
+ * @return Current item index.
+ */
+ TInt GetActiveLine();
+
+ /**
+ * Stores current position of focus of iListBox to the CAppUiAppUi object
+ */
+ void SaveActiveLine();
+
+ public: // Functions from base classes
+
+ /**
+ * Method HandleSelectedListItemL handles valix index.
+ * @param TInt aIndex
+ * @return nothing
+ */
+ void HandleSelectedListItemL( TInt aIndex );
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ void SizeChanged();
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * Gets a count of the component controls of this list box control.
+ * This information is used for DrawNow().
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets a pointer to the specified component control.
+ * @param aIndex Index of the component control to look up.
+ * @return The control at aIndex.
+ */
+ CCoeControl* ComponentControl(TInt aIndex) const;
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * Handles list box events.
+ * @param aListBox The originating list box.
+ * @param aEventType A code for the event. Further information may be
+ * obtained by accessing the list box itself.
+ */
+ void HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType);
+
+ /**
+ * From CCoeControl,OfferKeyEventL
+ * Handles key events.
+ * @param aKeyEvent The key event.
+ * @param aType The type of key event.
+ * @return Indicates whether or not the key event was used
+ * by this control.
+ */
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+
+ private: //data
+
+ CEikTextListBox* iListBox;
+ };
+
+#endif // CSTARTEDCASESMENUCONTAINER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/StartedCasesMenuView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStartedCasesMenuView class
+* declaration.
+*
+*/
+
+#ifndef STARTEDCASESMENUVIEW_H
+#define STARTEDCASESMENUVIEW_H
+
+// INCLUDES
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h>
+#include "View.h"
+
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CStartedCasesMenuContainer;
+
+// CLASS DECLARATION
+
+/**
+* CStartedCasesMenuView view class.
+*
+*/
+class CStartedCasesMenuView : public CView
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CStartedCasesMenuView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ void HandleClientRectChange();
+
+ private:
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ void DoDeactivate();
+
+ private: // Data
+ CAknNavigationDecorator* iNaviDecorator;
+ CStartedCasesMenuContainer* iContainer;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/StatisticsContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStatisticsContainer class
+* declaration.
+*
+*/
+
+#ifndef CSTATISTICSCONTAINER_H
+#define CSTATISTICSCONTAINER_H
+
+// INCLUDES
+#include "Container.h"
+
+#include <coecntrl.h>
+#include <eiklbo.h> // MEikListBoxObserver
+#include <bamdesca.h> // MDesCArray
+#include <aknsfld.h>
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CDesC16Array;
+
+class CStartCasesView;
+class CEikColumnListBox;
+
+// CLASS DECLARATION
+/**
+* StatisticsContainer container control class.
+*
+*/
+class CStatisticsContainer : public CContainer//public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ */
+ void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+ /**
+ * Destructor.
+ */
+ ~CStatisticsContainer();
+
+ public: // New functions
+
+ /**
+ * Stores current position of focus of iListBox to the CAppUiAppUi object
+ */
+ void SaveActiveLine();
+
+ public: // Functions from base classes
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ void SizeChanged();
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * Gets a count of the component controls of this list box control.
+ * This information is used for DrawNow().
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets a pointer to the specified component control.
+ * @param aIndex Index of the component control to look up.
+ * @return The control at aIndex.
+ */
+ CCoeControl* ComponentControl(TInt aIndex) const;
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * From CCoeControl,OfferKeyEventL
+ * Handles key events.
+ * @param aKeyEvent The key event.
+ * @param aType The type of key event.
+ * @return Indicates whether or not the key event was used
+ * by this control.
+ */
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+ private: //data
+
+ CStartCasesView* iParentView;
+ CDesC16ArrayFlat* iTestCaseArray;
+ };
+
+#endif // CSTATISTICSCONTAINER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/StatisticsView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStatisticsView class declaration.
+*
+*/
+
+#ifndef STATISTICSVIEW_H
+#define STATISTICSVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CStatisticsContainer;
+
+// CLASS DECLARATION
+
+/**
+* CTestCaseMenuView view class.
+*
+*/
+class CStatisticsView : public CView, public MEikListBoxObserver //CAknView
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CStatisticsView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ void HandleClientRectChange();
+
+ /**
+ * Handles a list box event.
+ * @param aListBox A pointer to list box.
+ * @param aEventType Type of list box event.
+ */
+ void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+ public: // New functions
+
+ /**
+ * Starts test case.
+ */
+ void StartTestCasesL();
+
+ private:
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ void DoDeactivate();
+
+ /** From MEikMenuObserver
+ * Initializes menu pane.
+ * @param aResourceId Menu pane resource ID
+ * @param aMenuPane Menu pane pointer
+ */
+ void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+
+ private: // Data
+ CAknNavigationDecorator* iNaviDecorator;
+ CStatisticsContainer* iContainer;
+ TInt iCurrentTestCase;
+ };
+
+#endif //STATISTICSVIEW_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/Stifui.hrh Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Const definitions file.
+*
+*/
+
+#ifndef STIF_UI_HRH
+#define STIF_UI_HRH
+
+enum TAppUICommandIds
+ {
+ EAppUIGoBack = 1,
+ EAppUIGoToMainMenu,
+ EAppUIGoToTestCaseMenu,
+ EAppUIGoToModulesMenu,
+ EAppUIGoToTestSetsMenu,
+ ECmdGoToStartCasesView,
+ ECmdGoToStartedCasesView,
+ ECmdShowStartedTestSet,
+ ECmdCreateTestSet,
+ ECmdLoadTestSet,
+ ECmdStartTestSet,
+ ECmdSaveTestSet,
+ ECmdInsertTestCases,
+ ECmdRemoveTestCases,
+ ECmdFilterCases,
+ ECmdMarkMenu,
+ ECmdInsertSelectedCases,
+ ECmdShowSetMenu,
+ ECmdStartCases,
+ ECmdShowAllStartedCases,
+ ECmdShowOngoingCases,
+ ECmdShowPassedCases,
+ ECmdShowFailedCases,
+ ECmdShowPausedCases,
+ ECmdShowCrashedAbortedCases,
+ ECmdShowStatistics,
+ ECmdViewOutput,
+ ECmdPauseTestCase,
+ ECmdResumeTestCase,
+ ECmdAbortTestCase,
+ ECmdRemoveExecution,
+ ECmdRemoveAllExecutions,
+ ECmdOpenModule,
+ ECmdAddModule,
+ ECmdRemoveModule,
+ ECmdFilterMenu,
+ ECmdShowAbout,
+ ECmdFilterByModule = 0x1000,
+ ECmdFilterByTestCaseFile = 0x2000,
+ ECmdNOFiltering = 0x3000,
+ ECmdGoToTestSetView
+ };
+
+
+enum TAppUITabViewId
+ {
+ ETestCaseMenuTab = 1,
+ ETestModulesMenuTab,
+ ETestSetsMenuTab
+ };
+
+// Application view ids.
+enum TAppUIViewNumber
+ {
+ EMainMenuViewId = 1,
+ ETestCaseMenuViewId,
+ EStartCaseMenuViewId,
+ EStartedCasesMenuViewId,
+ ETestModulesMenuViewId,
+ ETestSetBaseMenuViewId,
+ ETestSetMenuViewId,
+ ETestSetInsertMenuViewId,
+ ETestSetStartedCasesViewId,
+ ETestSetsMenuViewId, /*???*/
+ EShowStartedCasesViewId,
+ EShowStatisticsViewId,
+ ETestCaseOutputViewId,
+ EStatisticsViewId,
+ ECreatedTestSetMenuViewId
+ };
+
+enum TPanic
+ {
+ EModuleIndexOutOfBound,
+ EShowCasesOutOfSync
+ };
+
+enum TShowStartedCasesMode
+ {
+ EShowAllStartedCases,
+ EShowOngoingCases,
+ EShowPausedCases,
+ EShowPassedCases,
+ EShowFailedCases,
+ EShowCrashedAbortedCases,
+ EShowStatistics
+ };
+
+#endif // STIF_UI_HRH
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/Stifui_loc.hrh Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains localized strings.
+*
+*/
+
+// LOCALISATION STRINGS
+
+//#define qtn_testcase_menu_tab "Cases"
+//#define qtn_testmodules_menu_tab "Modules"
+//#define qtn_testsets_menu_tab "Sets"
+
+// Main menu
+#define qtn_mainmenulist_test_cases "\tTest Cases"
+#define qtn_mainmenulist_modules "\tModules"
+#define qtn_mainmenulist_test_sets "\tTest Sets"
+
+// Test cases menu
+#define qtn_testcasemenu_startcase "\tStart Case(s)"
+#define qtn_testcasemenu_startedcases "\tStarted Cases"
+
+// Started cases menu
+#define qtn_startedcases_allcases "\tAll Started Cases"
+#define qtn_startedcases_ongoing "\tOngoing Cases"
+#define qtn_startedcases_paused "\tPaused Cases"
+#define qtn_startedcases_passed "\tPassed Cases"
+#define qtn_startedcases_failed "\tFailed Cases"
+#define qtn_startedcases_crashed_aborted "\tCrashed/Aborted Cases"
+#define qtn_startedcases_statistics "\tStatistics"
+
+// Modules menu
+#define qtn_open_module "Open module"
+#define qtn_add_module "Load all module(s)"
+#define qtn_remove_module "Remove module"
+
+// Test set menu.
+#define qtn_testsetbasemenu_createtestset "\tCreate test set"
+#define qtn_testsetbasemenu_loadtestset "\tLoad test set"
+#define qtn_owerwrite_testset_confirmation "Test set already created. Do you want to overwrite it?"
+#define qtn_save_testset_confirmation "Save current test?"//changes for STIF-451
+#define qtn_load_testset_errornote "Error loading test set."
+
+#define qtn_testsetinsert_add_selected "Add selected"
+#define qtn_insert_confirmation "Add selected test case(s) to test set?"
+#define qtn_insert_none_selected "No test cases selected."
+
+#define qtn_testset_started_menu "Show"
+#define qtn_testset_set_menu "Set"
+
+#define qtn_testset_started_allcases "Started Cases"
+#define qtn_testset_started_ongoing "Ongoing Cases"
+#define qtn_testset_started_paused "Paused Cases"
+#define qtn_testset_started_passed "Passed Cases"
+#define qtn_testset_started_failed "Failed Cases"
+#define qtn_testset_started_crashed_aborted "Crashed/Aborted Cases"
+
+#define qtn_filter_test_cases "Filter"
+#define qtn_by_module "By module"
+#define qtn_by_testcasefile "By test case file"
+
+// Test case operations and menu texts
+#define qtn_markmenu_title "Mark/Unmark"
+#define qtn_markmenu_mark "Mark"
+#define qtn_markmenu_unmark "Unmark"
+#define qtn_markmenu_markall "Mark All"
+#define qtn_markmenu_unmarkall "Unmark All"
+#define qtn_mark_test_case "Mark"
+#define qtn_unmark_test_case "Unmark"
+
+#define qtn_filter_menu "Filtering"
+#define qtn_filter_by_modules "Filter by module"
+#define qtn_filter_by_test_case_file "Filter by test case file"
+#define qtn_no_filtering "No filtering"
+
+
+//#define qtn_remove_execution "Remove execution"
+//#define qtn_remove_all_executions "Remove all executions"
+#define qtn_testcase_control_menu "Test case control"
+#define qtn_view_output "View ouput of case"
+#define qtn_pause_testcase "Pause"
+#define qtn_resume_testcase "Resume"
+#define qtn_abort_testcase "Abort"
+
+#define qtn_exit "Exit"
+
+// Start test cases queries.
+#define qtn_start_test_cases "Start Case(s)"
+#define qtn_starting_test_case "Start test?"
+#define qtn_starting_test_cases "Start tests?"
+
+#define qtn_start "Start"
+#define qtn_start_and_view_output "Start and view output"
+
+#define qtn_start_test "Start"
+#define qtn_start_test_output "Start&view output"
+#define qtn_start_tests_parallel "Parallel"
+#define qtn_start_tests_serial "Sequential"
+
+// example caption strings for app
+#define qtn_app_caption_string "STIF UI"
+#define qtn_appui_demo "Demo"
+
+#define qtn_app_short_caption_string "STIF UI"
+
+// Navipanel titles
+#define qtn_navi_load_test_set "Load Test Set"
+#define qtn_navi_main "Main menu"
+#define qtn_navi_testcases "Test cases menu"
+#define qtn_navi_startcases "Start cases"
+#define qtn_navi_startedcases "Started cases"
+#define qtn_navi_testcase_output "Test case output"
+#define qtn_navi_modules "Modules menu"
+#define qtn_navi_testset_base "Test set menu"
+#define qtn_navi_testset "Test set"
+#define qtn_navi_testset_insert "Insert test case"
+
+#define qtn_navi_started "Started cases"
+#define qtn_navi_started_all "All started cases"
+#define qtn_navi_started_ongoing "Ongoing cases"
+#define qtn_navi_started_paused "Paused cases"
+#define qtn_navi_started_passed "Passed cases"
+#define qtn_navi_started_failed "Failed cases"
+#define qtn_navi_started_crashed_aborted "Crashed/Aborted cases"
+#define qtn_navi_started_stats "Statistics"
+
+// Test case states
+#define qtn_testcase_state_running "Running"
+#define qtn_testcase_state_passed "Passed"
+#define qtn_testcase_state_failed "Failed"
+#define qtn_testcase_state_crashed_aborted "Crashed/Aborted"
+#define qtn_testcase_state_unknown "Undefined state!"
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestCaseMenuContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestCaseMenuContainer class
+* declaration.
+*
+*/
+
+#ifndef CTESTCASEMENUCONTAINER_H
+#define CTESTCASEMENUCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+
+// CLASS DECLARATION
+
+/**
+* CTestCaseMenuContainer container control class.
+*
+*/
+class CTestCaseMenuContainer : public CCoeControl, public MEikListBoxObserver /* MCoeControlObserver */
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ */
+ void ConstructL(const TRect& aRect);
+
+ /**
+ * Destructor.
+ */
+ ~CTestCaseMenuContainer();
+
+ public: // New functions
+
+ /**
+ * Get currently selected items index.
+ * @return Current item index.
+ */
+ TInt GetActiveLine();
+
+ /**
+ * Stores current position of focus of iListBox to the CAppUiAppUi object
+ */
+ void SaveActiveLine();
+
+ public: // Functions from base classes
+
+ /**
+ * Method HandleSelectedListItemL handles valix index.
+ * @param TInt aIndex
+ * @return nothing
+ */
+ void HandleSelectedListItemL( TInt aIndex );
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ void SizeChanged();
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * Gets a count of the component controls of this list box control.
+ * This information is used for DrawNow().
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets a pointer to the specified component control.
+ * @param aIndex Index of the component control to look up.
+ * @return The control at aIndex.
+ */
+ CCoeControl* ComponentControl(TInt aIndex) const;
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * Handles list box events.
+ * @param aListBox The originating list box.
+ * @param aEventType A code for the event. Further information may be
+ * obtained by accessing the list box itself.
+ */
+ void HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType);
+
+ /**
+ * From CCoeControl,OfferKeyEventL
+ * Handles key events.
+ * @param aKeyEvent The key event.
+ * @param aType The type of key event.
+ * @return Indicates whether or not the key event was used
+ * by this control.
+ */
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+ private: //data
+
+ CEikTextListBox* iListBox;
+ };
+
+#endif // CTESTCASEMENUCONTAINER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestCaseMenuView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestCaseMenuView class
+* declaration.
+*
+*/
+
+#ifndef TESTCASEMENUVIEW_H
+#define TESTCASEMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <aknnavide.h>
+
+
+// CONSTANTS
+// UID of view
+const TUid KTestCaseMenuViewId = {2};
+
+// FORWARD DECLARATIONS
+class CTestCaseMenuContainer;
+
+// CLASS DECLARATION
+
+/**
+* CTestCaseMenuView view class.
+*
+*/
+class CTestCaseMenuView : public CView //CAknView
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CTestCaseMenuView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ void HandleClientRectChange();
+
+ private:
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ void DoDeactivate();
+
+ private: // Data
+ CAknNavigationDecorator* iNaviDecorator;
+ CTestCaseMenuContainer* iContainer;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestCaseOutputContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestOutputListBoxModel class
+* declaration.
+*
+*/
+
+#ifndef TESTCASEOUTPUTCONTAINER_H
+#define TESTCASEOUTPUTCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+#include <bamdesca.h> // MDesCArray
+
+// #include "RRefArray.h"
+#include <stifinternal/RRefArray.h>
+
+
+// Define *.mbm file name.
+_LIT(KMbmFileName, "\\Resource\\Apps\\Stifui.mbm");
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CAknSingleGraphicStyleListBox;
+class CDesC16ArrayFlat;
+class CStartedTestCase;
+
+class CUIStore;
+
+// CLASS DECLARATION
+
+class CTestOutputListBoxModel : public CBase, public MDesCArray
+ {
+ public:
+ /**
+ * Destructor.
+ */
+ ~CTestOutputListBoxModel();
+
+ /**
+ * Two-phased constructor.
+ * @param aStartedTestCase Pointer to started test case.
+ * @return Pointer to created list box model.
+ */
+ static CTestOutputListBoxModel* NewL(CStartedTestCase* aStartedTestCase);
+
+ public: // Functions from base classes
+
+ /**
+ * Returns the number of descriptor elements in the array.
+ * @return The number of descriptor elements.
+ */
+ TInt MdcaCount() const;
+
+ /**
+ * Indexes into a descriptor array.
+ * @param aIndex The position of the descriptor element within the
+ * array. The position is relative to zero; i.e. zero
+ * implies the first descriptor element in the array.
+ * This value must be non-negative and less than the
+ * number of descriptors currently within the array
+ * otherwise the operator panics with
+ * EArrayIndexOutOfRange.
+ * @return A non-modifiable pointer descriptor representing the
+ * descriptor element located at position aIndex within
+ * the array.
+ */
+ TPtrC MdcaPoint(TInt aIndex) const;
+
+ private:
+ /**
+ * Symbian OS two phased constructor.
+ * Completes the construction of the object.
+ */
+ void ConstructL();
+
+ private: //data
+ CStartedTestCase* iStartedTestCase;
+ HBufC* iBuffer;
+
+ };
+
+/**
+* CTestCaseOutputContainer container control class.
+*
+*/
+class CTestCaseOutputContainer : public CCoeControl, public MEikListBoxObserver /* MCoeControlObserver */
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ */
+ //void ConstructL(const TRect& aRect, TInt aExecutedTestCaseCount );
+ void ConstructL(const TRect& aRect, CStartedTestCase* aStartedTestCase );
+
+ /**
+ * Destructor.
+ */
+ ~CTestCaseOutputContainer();
+
+ public: // New functions
+ /**
+ * Handles addition of item to list box.
+ */
+ void OutputUpdateL();
+
+ private:
+
+ public: // Functions from base classes
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ void SizeChanged();
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * Gets a count of the component controls of this list box control.
+ * This information is used for DrawNow().
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets a pointer to the specified component control.
+ * @param aIndex Index of the component control to look up.
+ * @return The control at aIndex.
+ */
+ CCoeControl* ComponentControl(TInt aIndex) const;
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * Handles list box events.
+ * @param aListBox The originating list box.
+ * @param aEventType A code for the event. Further information may be
+ * obtained by accessing the list box itself.
+ */
+ void HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType);
+
+ /**
+ * From CCoeControl,OfferKeyEventL
+ * Handles key events.
+ * @param aKeyEvent The key event.
+ * @param aType The type of key event.
+ * @return Indicates whether or not the key event was used
+ * by this control.
+ */
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+ private: //data
+
+ CEikTextListBox* iListBox;
+ CTestOutputListBoxModel* iListBoxModel;
+ CUIStore* iUIStore;
+
+ };
+
+#endif // TESTCASEOUTPUTCONTAINER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestCaseOutputView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestCaseOutputView class
+* declaration.
+*
+*/
+
+#ifndef TESTCASEOUTPUTVIEW_H
+#define TESTCASEOUTPUTVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <aknnavide.h>
+
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CTestCaseOutputContainer;
+
+// CLASS DECLARATION
+
+/**
+* CTestCaseOutputView view class.
+*
+*/
+class CTestCaseOutputView : public CView
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CTestCaseOutputView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ void HandleClientRectChange();
+
+ public: // New functions
+
+ /**
+ * Receives output update notification from AppUI
+ * @param aTestCase A pointer to started test case.
+ */
+ void OutputUpdateL( CStartedTestCase* aTestCase );
+
+ /**
+ * Prints test case state to title pane
+ */
+ void PrintTestCaseStateL();
+
+ /**
+ * Handles test case state changed notification
+ */
+ void TestCaseStateChangedL();
+
+ private:
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ void DoDeactivate();
+
+ /** From MEikMenuObserver
+ * Initializes menu pane.
+ * @param aResourceId Menu pane resource ID
+ * @param aMenuPane Menu pane pointer
+ */
+ void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+
+ private: // Data
+ CAknNavigationDecorator* iNaviDecorator;
+ CTestCaseOutputContainer* iContainer;
+ CStartedTestCase* iCurrentTestCase;
+
+ };
+
+#endif //SHOWSTARTEDCASESVIEW_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestModulesMenuContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestModulesListBoxModel class
+* declaration.
+*
+*/
+
+#ifndef CTESTMODULESMENUCONTAINER_H
+#define CTESTMODULESMENUCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+
+// #include "RRefArray.h"
+#include <stifinternal/RRefArray.h>
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CUIStore;
+
+// CLASS DECLARATION
+class CTestModulesListBoxModel : public CBase, public MDesCArray
+ {
+ public:
+ /**
+ * Destructor.
+ */
+ ~CTestModulesListBoxModel();
+
+ /**
+ * Two-phased constructor.
+ * @param aTestModules Array of test modules names.
+ * @return Pointer to created list box model.
+ */
+ static CTestModulesListBoxModel* NewL(RRefArray<TDesC> aTestModules);
+
+ public: // Functions from base classes
+
+ /**
+ * Returns the number of descriptor elements in the array.
+ * @return The number of descriptor elements.
+ */
+ TInt MdcaCount() const;
+
+ /**
+ * Indexes into a descriptor array.
+ * @param aIndex The position of the descriptor element within the
+ * array. The position is relative to zero; i.e. zero
+ * implies the first descriptor element in the array.
+ * This value must be non-negative and less than the
+ * number of descriptors currently within the array
+ * otherwise the operator panics with
+ * EArrayIndexOutOfRange.
+ * @return A non-modifiable pointer descriptor representing the
+ * descriptor element located at position aIndex within
+ * the array.
+ */
+ TPtrC MdcaPoint(TInt aIndex) const;
+
+ private:
+ /**
+ * Symbian OS two phased constructor.
+ * Completes the construction of the object.
+ */
+ void ConstructL();
+
+ private: //data
+ RRefArray<TDesC> iTestModules;
+ HBufC* iBuffer;
+ };
+
+/**
+* CTestModulesMenuContainer container control class.
+*
+*/
+class CTestModulesMenuContainer : public CCoeControl
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ */
+ void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+ /**
+ * Destructor.
+ */
+ ~CTestModulesMenuContainer();
+
+ public: // New functions
+
+ /**
+ * Gets the index number of the current item in the view.
+ * @return Index number of the current item.
+ */
+ TInt CurrentItemIndex();
+
+ public: // New functions
+
+ /**
+ * Stores current position of focus of iListBox to the CAppUiAppUi object
+ */
+ void SaveActiveLine();
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ void SizeChanged();
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * Gets a count of the component controls of this list box control.
+ * This information is used for DrawNow().
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets a pointer to the specified component control.
+ * @param aIndex Index of the component control to look up.
+ * @return The control at aIndex.
+ */
+ CCoeControl* ComponentControl(TInt aIndex) const;
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * From CCoeControl,OfferKeyEventL
+ * Handles key events.
+ * @param aKeyEvent The key event.
+ * @param aType The type of key event.
+ * @return Indicates whether or not the key event was used
+ * by this control.
+ */
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+ private: //data
+
+ CEikTextListBox* iListBox;
+ CTestModulesListBoxModel* iListBoxModel;
+ CUIStore* iUIStore;
+ RRefArray<TDesC> iModules;
+ };
+
+#endif // CTESTMODULESMENUCONTAINER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestModulesMenuView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestModulesMenuView class
+* declaration.
+*
+*/
+
+#ifndef TESTMODULEMENUVIEW_H
+#define TESTMODULEMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CTestModulesMenuContainer;
+
+// CLASS DECLARATION
+
+/**
+* CTestModulesMenuView view class.
+*
+*/
+class CTestModulesMenuView : public CView, public MEikListBoxObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CTestModulesMenuView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ void HandleClientRectChange();
+
+ /**
+ * Handles a list box event.
+ * @param aListBox A pointer to list box (not used).
+ * @param aEventType Type of list box event.
+ */
+ void HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType);
+
+ /**
+ * Initializes menu pane.
+ * @param aResourceId Menu pane resource ID.
+ * @param aMenuPane Menu pane pointer.
+ */
+ void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
+
+ private:
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ void DoDeactivate();
+
+ private: // Data
+ CAknNavigationDecorator* iNaviDecorator;
+ CTestModulesMenuContainer* iContainer;
+ };
+
+#endif // TESTMODULEMENUVIEW_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetBaseMenuContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetBaseMenuContainer
+* class declaration.
+*
+*/
+
+#ifndef CTestSetBaseMenuContainer_H
+#define CTestSetBaseMenuContainer_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+
+
+// FORWARD DECLARATIONS
+//class CEikLabel; // for example labels
+class CEikTextListBox;
+
+// CLASS DECLARATION
+
+/**
+* CTestSetBaseMenuContainer container control class.
+*
+*/
+class CTestSetBaseMenuContainer : public CCoeControl
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ * @return Observer for list box.
+ */
+ void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+ /**
+ * Destructor.
+ */
+ ~CTestSetBaseMenuContainer();
+
+ public: // New functions
+
+ /**
+ * Get currently selected items index.
+ * @return Current item index.
+ */
+ TInt GetActiveLine();
+
+ /**
+ * Stores current position of focus of iListBox to the CAppUiAppUi object
+ */
+ void SaveActiveLine();
+
+ public: // Functions from base classes
+
+ /**
+ * Method HandleSelectedListItemL handles valix index.
+ * @param TInt aIndex
+ * @return nothing
+ */
+ void HandleSelectedListItemL( TInt aIndex );
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ void SizeChanged();
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * Gets a count of the component controls of this list box control.
+ * This information is used for DrawNow().
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets a pointer to the specified component control.
+ * @param aIndex Index of the component control to look up.
+ * @return The control at aIndex.
+ */
+ CCoeControl* ComponentControl(TInt aIndex) const;
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * From CCoeControl,OfferKeyEventL
+ * Handles key events.
+ * @param aKeyEvent The key event.
+ * @param aType The type of key event.
+ * @return Indicates whether or not the key event was used
+ * by this control.
+ */
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+
+ private: //data
+
+ CEikTextListBox* iListBox;
+ };
+
+#endif // CTestSetBaseMenuContainer_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetBaseMenuView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetBaseMenuView class declaration.
+*
+*/
+
+#ifndef TESTSETBASEMENUVIEW_H
+#define TESTSETBASEMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h>
+
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CTestSetBaseMenuContainer;
+
+// CLASS DECLARATION
+
+/**
+* CTestSetBaseMenuView view class.
+*
+*/
+class CTestSetBaseMenuView : public CView, public MEikListBoxObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CTestSetBaseMenuView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ void HandleClientRectChange();
+
+ /**
+ * Handles a list box event.
+ * @param aListBox A pointer to list box.
+ * @param aEventType Type of list box event.
+ */
+ void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+ private:
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ void DoDeactivate();
+
+ private: // Data
+ CAknNavigationDecorator* iNaviDecorator;
+ CTestSetBaseMenuContainer* iContainer;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetInsertMenuContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetInsertMenuContainer
+* class definition.
+*
+*/
+
+#ifndef TESTSETINSERTMENUCONTAINER_H
+#define TESTSETINSERTMENUCONTAINER_H
+
+// INCLUDES
+#include "Container.h"
+
+#include <coecntrl.h>
+#include <eiklbo.h> // MEikListBoxObserver
+#include <bamdesca.h> // MDesCArray
+#include <aknsfld.h>
+
+//#include "RRefArray.h"
+//#include "UIEngine.h"
+//#include "UIStoreIf.h"
+//#include "UIStoreContainer.h"
+
+#include <stifinternal/RRefArray.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+
+
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CDesC16Array;
+
+class CTestSetInsertMenuView;
+class CEikColumnListBox;
+class CStartedTestCase;
+
+class CUIStoreHandler;
+class CUIStore;
+class CUIStoreIf;
+class CUIEngineContainer;
+class CUIEngine;
+
+// CLASS DECLARATION
+/**
+* CTestSetInsertMenuContainer container control class.
+*
+*/
+class CTestSetInsertMenuContainer : public CContainer //public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ */
+ void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+ /**
+ * Destructor.
+ */
+ ~CTestSetInsertMenuContainer();
+
+ public: // New functions
+
+ /**
+ * Stores current position of focus of iListBox to the CAppUiAppUi object
+ */
+ void SaveActiveLine();
+
+ public: // Functions from base classes
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ void SizeChanged();
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * Gets a count of the component controls of this list box control.
+ * This information is used for DrawNow().
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets a pointer to the specified component control.
+ * @param aIndex Index of the component control to look up.
+ * @return The control at aIndex.
+ */
+ CCoeControl* ComponentControl(TInt aIndex) const;
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * From CCoeControl,OfferKeyEventL
+ * Handles key events.
+ * @param aKeyEvent The key event.
+ * @param aType The type of key event.
+ * @return Indicates whether or not the key event was used
+ * by this control.
+ */
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+ private: //data
+
+ CTestSetInsertMenuView* iParentView;
+ };
+
+#endif // CTestSetInsertMenuContainer_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetInsertMenuView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetInsertMenuView class
+* declaration.
+*
+*/
+
+#ifndef TESTSETINSERTMENUVIEW_H
+#define TESTSETINSERTMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CTestSetInsertMenuContainer;
+
+
+// CLASS DECLARATION
+
+/**
+* CTestCaseMenuView view class.
+*
+*/
+class CTestSetInsertMenuView : public CView, public MEikListBoxObserver //CAknView
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CTestSetInsertMenuView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ void HandleClientRectChange();
+
+ /**
+ * Handles a list box event.
+ * @param aListBox A pointer to list box.
+ * @param aEventType Type of list box event.
+ */
+ void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+ public: // New functions
+
+ /**
+ * Adds selected test cases to the current test set.
+ * @param aSelectedIndexes Indexes of selected test cases.
+ */
+ void AddCasesToTestSet( RArray<TInt> aSelectedIndexes );
+
+ private:
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ void DoDeactivate();
+
+ /**
+ * Initializes menu pane.
+ * @param aResourceId Menu pane resource ID.
+ * @param aMenuPane Menu pane pointer.
+ */
+ void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+ /**
+ * Show confirmation dialog for inserting test cases.
+ */
+ void ShowInsertCasesDialogL();
+
+ private: // Data
+ CAknNavigationDecorator* iNaviDecorator;
+ CTestSetInsertMenuContainer* iContainer;
+ TInt iCurrentTestCase;
+ };
+
+#endif //TestSetInsertMenuView_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetMenuContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetMenuContainer class
+* declaration.
+*
+*/
+
+#ifndef TestSetMenuContainer_H
+#define TestSetMenuContainer_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h> // MEikListBoxObserver
+#include <bamdesca.h> // MDesCArray
+#include <aknsfld.h>
+
+//#include "RRefArray.h"
+//#include "UIEngine.h"
+//#include "UIStoreIf.h"
+//#include "UIStoreContainer.h"
+
+#include <stifinternal/RRefArray.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CDesC16Array;
+
+class CTestSetMenuView;
+class CEikColumnListBox;
+class CTestCaseListBoxModel;
+
+class CUIStoreHandler;
+class CUIStore;
+class CUIStoreIf;
+class CUIEngineContainer;
+class CUIEngine;
+
+// CLASS DECLARATION
+/**
+* CTestSetMenuContainer container control class.
+*
+*/
+class CTestSetMenuContainer : public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ */
+ void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+ /**
+ * Destructor.
+ */
+ ~CTestSetMenuContainer();
+
+ public: // New functions
+ /**
+ * Show only testcases which are defined is specified module.
+ * @param aModuleName Module which test cases are shown.
+ */
+ void FilterCasesByModuleL(TName aModuleName);
+
+ /**
+ * Show only testcases which are defined in specified test case file.
+ * @param aTestCaseFileName Test cases file name.
+ */
+ void FilterCasesByTCFileNameL(TFileName aTestCaseFileName);
+
+ /**
+ * Remove possible filtering of test cases -> show all test cases.
+ */
+ void NoFilteringL();
+
+ /**
+ * Returns pointers to selected test cases.
+ * @param aSelectedTestCases Currently selected test case.
+ */
+ void SelectedTestCases(RPointerArray<CTestInfo>& aSelectedTestCases);
+
+ /**
+ * Sets graphic icon using listbox as CEikColumnListBox.
+ * @param aListBox Pointer to list box.
+ */
+ void SetGraphicIconL( CEikColumnListBox* aListBox );
+
+ /**
+ * Appends graphics data.
+ * @param aIcons Pointer array of icons.
+ */
+ void GraphicIconL( CArrayPtr<CGulIcon>* aIcons );
+
+ /**
+ * Gets the index number of the current item in the view.
+ * @return Index number of the current item.
+ */
+ TInt CurrentItemIndex();
+
+ /**
+ * Sets the current item.
+ * @param aIndex Index of the item to make current.
+ */
+ void SetCurrentItemIndex(TInt aCurrentTestCase);
+
+ /**
+ * Inline function for getting pointer to list box.
+ * @return Pointer to list box.
+ */
+ inline CEikListBox* ListBox() { return (CEikListBox*)iListBox; };
+
+ /**
+ * Processes user commands.
+ * @param aCommand ID of the command to respond to.
+ */
+ void ProcessCommandL( TInt aCommand );
+
+ /**
+ * Processes user commands.
+ * @param aCommand ID of the command to respond to.
+ */
+ void SelectionListProcessCommandL( TInt aCommand );
+
+ /**
+ * Handles mark commands.
+ * @param aCommand ID of the command to respond to.
+ */
+ void HandleMarkCommandL( TInt aCommand );
+
+ /**
+ * Removes items from list box.
+ * @param aSelected Indexes of removed items.
+ */
+ void RemoveListBoxItemL( TInt aSelected );
+
+ /**
+ * Stores current position of focus of iListBox to the CAppUiAppUi object
+ */
+ void SaveActiveLine();
+
+ public: // Functions from base classes
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ void SizeChanged();
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * Gets a count of the component controls of this list box control.
+ * This information is used for DrawNow().
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets a pointer to the specified component control.
+ * @param aIndex Index of the component control to look up.
+ * @return The control at aIndex.
+ */
+ CCoeControl* ComponentControl(TInt aIndex) const;
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * From CCoeControl,OfferKeyEventL
+ * Handles key events.
+ * @param aKeyEvent The key event.
+ * @param aType The type of key event.
+ * @return Indicates whether or not the key event was used
+ * by this control.
+ */
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+ private: //data
+
+ CTestSetMenuView* iParentView;
+ CEikColumnListBox* iListBox;
+ CTestCaseListBoxModel* iListBoxModel;
+ RPointerArray<CTestInfo> iTestCasesInView;
+ CUIStore* iUIStore;
+ };
+
+#endif // CTestSetMenuContainer_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetMenuView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetMenuView class declaration.
+*
+*/
+
+#ifndef TESTSETMENUVIEW_H
+#define TESTSETMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CTestSetMenuContainer;
+
+// CLASS DECLARATION
+/**
+* CTestCaseMenuView view class.
+*/
+class CTestSetMenuView : public CView, public MEikListBoxObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CTestSetMenuView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ void HandleClientRectChange();
+
+ public: // From MEikListBoxObserver
+
+ /**
+ * Handles list box event.
+ * @param aListBox Pointer to list box.
+ * @param aEventType List box event.
+ */
+ void HandleListBoxEventL(CEikListBox* aListBox,
+ TListBoxEvent aEventType);
+
+ public: // New functions
+
+ /**
+ * Starts all cases in active test set.
+ */
+ void StartTestSetL();
+
+ /**
+ * Removes selected test cases from active test set.
+ */
+ void RemoveSelectedTestCasesL();
+
+ /**
+ * Creates new test set.
+ * @param aTestSetName Name of the test set.
+ * @return Symbian OS error code.
+. */
+ TInt CreateTestSetL( const TDesC& aTestSetName );
+
+ /**
+ * Loads saved test set.
+ * @param aTestSetName Name of the test set.
+ * @return Symbian OS error code.
+ */
+ TInt LoadTestSetL( const TDesC& aTestSetName );
+
+ /**
+ * Saves current test set.
+ * @return Symbian OS error code.
+ */
+ TInt SaveCurrentTestSetL();
+
+ /**
+ * Removes current test set.
+ * @return Symbian OS error code.
+ */
+ TInt RemoveActiveTestSet();
+
+ /**
+ * Get name of the current test set.
+ * @return Name of the current test set.
+ */
+ inline const TDesC& CurrentTestSet()
+ { return iCurrentTestSet; }
+
+ /**
+ * Set save needed flag.
+ */
+ inline void SetSaveNeeded( TBool aSave )
+ { iSaveNeeded = aSave; }
+
+ private: // From AknView
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ void DoDeactivate();
+
+ private: // From MEikMenuObserver
+
+ /**
+ * Initializes menu pane.
+ * @param aResourceId Menu pane resource ID.
+ * @param aMenuPane Menu pane pointer.
+ */
+ void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+ private: // Data
+ CAknNavigationDecorator* iNaviDecorator;
+ CTestSetMenuContainer* iContainer;
+ CUIStore* iUIStore;
+ TInt iCurrentTestCase;
+ TInt iTestSetIndex;
+ TBuf<50> iCurrentTestSet;
+ TBool iSaveNeeded;
+
+ };
+
+#endif // TESTSETMENUVIEW_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetStartedCasesContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetStartedCasesContainer
+* class declaration.
+*
+*/
+
+#ifndef TESTSETSTARTEDCASESCONTAINER_H
+#define TESTSETSTARTEDCASESCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+#include <bamdesca.h> // MDesCArray
+
+//#include "RRefArray.h"
+#include <stifinternal/RRefArray.h>
+
+
+// Define *.mbm file name.
+_LIT(KMbmFileName, "\\Resource\\Apps\\Stifui.mbm");
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CAknSingleGraphicStyleListBox;
+class CDesC16ArrayFlat;
+class CStartedTestCase;
+
+class CUIStore;
+class CStartedTestsListBoxModel;
+
+// CLASS DECLARATION
+
+/**
+* CTestSetStartedCasesContainer container control class.
+*
+*/
+class CTestSetStartedCasesContainer : public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param aRect Frame rectangle for container.
+ */
+ void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+ /**
+ * Destructor.
+ */
+ ~CTestSetStartedCasesContainer();
+
+ public: // New functions
+
+ /**
+ * Returns reference to currently selected test case in view (listbox).
+ * @return Currently selected test case.
+ */
+ CStartedTestCase* SelectedTestCase();
+
+ /**
+ * Constructs list box model.
+ */
+ void ConstructListBoxModelL();
+
+ /**
+ * Draws the list box.
+ */
+ void DrawListBox();
+
+ /**
+ * Returns count of test cases in view.
+ * @return Count of test cases in view.
+ */
+ TInt TestsInViewCount();
+
+ /**
+ * Handles the addition of an item to the model.
+ */
+ void HandleItemAdditionL();
+
+ /**
+ * Handles the removal of an item from the model.
+ */
+ void HandleItemRemovalL();
+
+ /**
+ * Returns pointer to currently selected test case.
+ * @param Current test case.
+ */
+ CStartedTestCase* CurrentTestCase();
+
+ /**
+ * Gets the index number of the current item in the view.
+ * @return Index number of the current item.
+ */
+ TInt CurrentItemIndex();
+
+ /**
+ * Sets the current item.
+ * @param aIndex Index of the item to make current.
+ */
+ void SetCurrentItemIndex(TInt aIndex);
+
+ /**
+ * Resets the selection indices, top and current item indices,
+ * the selection, and the horizontal scroll offset of this list box.
+ * This function does not redraw the list box.
+ */
+ void ResetListBox();
+
+ /**
+ * Removes items from list box.
+ */
+ void RemoveSelectedExecutionsL();
+
+ /**
+ * Removes all started test cases from list box.
+ */
+ void RemoveAllExecutionsInViewL();
+
+ /**
+ * Stores current position of focus of iListBox to the CAppUiAppUi object
+ */
+ void SaveActiveLine();
+
+ private: // New functions
+
+ public: // Functions from base classes
+
+ private: // Functions from base classes
+
+ /**
+ * From CoeControl,SizeChanged.
+ * Called by framework when the view size is changed.
+ */
+ void SizeChanged();
+
+ /**
+ * From CoeControl,CountComponentControls.
+ * Gets a count of the component controls of this list box control.
+ * This information is used for DrawNow().
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * From CCoeControl,ComponentControl.
+ * Gets a pointer to the specified component control.
+ * @param aIndex Index of the component control to look up.
+ * @return The control at aIndex.
+ */
+ CCoeControl* ComponentControl(TInt aIndex) const;
+
+ /**
+ * From CCoeControl,Draw.
+ * Draw a control, called by window server.
+ * @param aRect The region of the control to be redrawn. Co-ordinates
+ * are relative to the control's origin (top left corner).
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * From CCoeControl,OfferKeyEventL
+ * Handles key events.
+ * @param aKeyEvent The key event.
+ * @param aType The type of key event.
+ * @return Indicates whether or not the key event was used
+ * by this control.
+ */
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+ private: //data
+
+ CEikTextListBox* iListBox;
+ CStartedTestsListBoxModel* iListBoxModel;
+ RRefArray<CStartedTestCase> iStartedTestsPtrs;
+ CUIStore* iUIStore;
+ };
+
+#endif // CTestSetStartedCasesCONTAINER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetStartedCasesView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetStartedCasesView class
+* declaration.
+*
+*/
+
+#ifndef TESTSETSTARTEDCASESVIEW_H
+#define TESTSETSTARTEDCASESVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h> //CAknNavigationDecorator
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CTestSetStartedCasesContainer;
+
+// CLASS DECLARATION
+
+/**
+* CTestSetStartedCasesView view class.
+*
+*/
+class CTestSetStartedCasesView : public CView, public MEikListBoxObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CTestSetStartedCasesView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ void HandleClientRectChange();
+
+ /**
+ * Handles a list box event.
+ * @param aListBox A pointer to list box (not used).
+ * @param aEventType Type of list box event.
+ */
+ void HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType);
+
+ public: // New functions
+
+ /**
+ * Handles status changes of test cases in view.
+ */
+ void TestCaseStateChangedL();
+
+ /**
+ * Handles call to view test case´s output data.
+ */
+ void ViewTestCaseOutputL();
+
+ private:
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ void DoDeactivate();
+
+ /**
+ * Initializes menu pane.
+ * @param aResourceId Menu pane resource ID.
+ * @param aMenuPane Menu pane pointer.
+ */
+ void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+ /**
+ * Refreshes view name shown in the navi pane.
+ */
+ void RefreshNaviTitleL();
+
+ private: // Data
+ CAknNavigationDecorator* iNaviDecorator;
+ CTestSetStartedCasesContainer* iContainer;
+ TName iFilterModule;
+ TFileName iFilterTestCaseFile;
+ TInt iSelectedTestCase; // Which testcase was
+ // selected when view
+ // was active earlier.
+ };
+
+#endif //TestSetStartedCasesVIEW_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/UIStoreHandler.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CUIStoreHandler class declaration.
+*
+*/
+
+#ifndef UISTOREHANDLER_H
+#define UISTOREHANDLER_H
+
+// INCLUDES
+//#include "UIStoreIf.h"
+//#include "UIStore.h"
+//#include "UIEngine.h"
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+
+#include "AppUIAppUi.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+// None
+class CAppUIAppUi;
+
+// DESCRIPTION
+// CUIStoreHandler is a STIF Test Framework Series60 UI class.
+// CUIStoreHandler's methods purpose is to offer handle to UI Engine.
+// Because multible inheritance in not allowed in SOS we cannot
+// inheritance CUIStore class direct so we use this class.
+
+class CUIStoreHandler
+ :public CUIStoreIf
+ {
+ public: // Enumerations
+
+ private: // Enumerations
+
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aAppUIAppUI Pointer to application ui.
+ * @return Pointer to UIStoreHandler.
+ */
+ static CUIStoreHandler* NewL( CAppUIAppUi* aAppUIAppUI );
+
+ /**
+ * Destructor.
+ */
+ ~CUIStoreHandler();
+
+ public: // New functions
+
+ /**
+ * C++ default constructor.
+ * @param aAppUIAppUI Pointer to application ui.
+ */
+ CUIStoreHandler( CAppUIAppUi* aAppUIAppUI );
+
+ /**
+ * Receives output update notify from started test case.
+ * Checks if that test case is currently in output view then
+ * sends notification to AppUI which handles notification onward.
+ * @param aTestCase
+ * @param aStatus
+ */
+ void Update( CStartedTestCase* aTestCase, TInt aStatus );
+
+ public: // Functions from base classes
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private:
+
+ /**
+ * By default Symbian OS constructor is private.
+ */
+ void ConstructL();
+
+ public: // Data
+
+ /**
+ * Returns the AppUI of the application
+ * @return Pointer to the Application UI.
+ */
+ CAppUIAppUi* iAppUIAppUI;
+
+ /**
+ * Counter for executed test cases
+ */
+ TInt iExecutedTestCaseCount;
+
+ protected: // Data
+
+ private: // Data
+
+ public: // Friend classes
+
+ protected: // Friend classes
+
+ private: // Friend classes
+
+ };
+
+#endif // UISTOREHANDLER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/View.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CView class declaration.
+*
+*/
+
+#ifndef VIEW_H
+#define VIEW_H
+
+// INCLUDES
+#include <aknview.h>
+
+//#include "UIStoreIf.h"
+#include <stifinternal/UIStoreIf.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+//class CMainMenuContainer;
+
+// CLASS DECLARATION
+
+/**
+* CMainMenuView view class.
+*
+*/
+class CView : public CAknView
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ ~CView();
+
+ public: // Functions from base classes
+
+ /**
+ * Returns view´s id.
+ * @return View id.
+ */
+ virtual TUid Id() const;
+
+ /**
+ * Handles a command.
+ * @param aCommand A command ID.
+ */
+ virtual void HandleCommandL( TInt aCommand );
+
+ /**
+ * Handles client rect changes.
+ */
+ virtual void HandleClientRectChange();
+
+ private:
+
+ /**
+ * Initializes view when activated.
+ * @param aPrevViewId Id of the previous view (not used).
+ * @param aCustomMessageId Custom message id (not used).
+ * @param aCustomMessage Custom message (not used).
+ */
+ virtual void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * Deactivates view.
+ */
+ virtual void DoDeactivate();
+
+ protected: // Data
+
+ /**
+ * Pointer to UI Store.
+ */
+ CUIStore* iUIStore;
+
+
+ private: // Data
+
+ };
+
+#endif // VIEW_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/version.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains STIF UI version declaration.
+*
+*/
+
+#ifndef VERSION_H_
+#define VERSION_H_
+
+#define STIFUI_MAJOR_VERSION 7
+#define STIFUI_MINOR_VERSION 3
+#define STIFUI_BUILD_VERSION 35
+
+#define STIFUI_REL_DATE "15th June 2010"
+
+#define TO_UNICODE(text) _L(text)
+
+#endif /*VERSION_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/AppUIApp.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CAppUIApp class definition.
+*
+*/
+
+// INCLUDE FILES
+#include "AppUIApp.h"
+#include "AppUIDocument.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CSTIFAppUIApp::AppDllUid()
+// Returns application UID
+// ---------------------------------------------------------
+//
+TUid CAppUIApp::AppDllUid() const
+ {
+ return KUidAppUI;
+ }
+
+
+// ---------------------------------------------------------
+// CSTIFAppUIApp::CreateDocumentL()
+// Creates CSTIFAppUIDocument object
+// ---------------------------------------------------------
+//
+CApaDocument* CAppUIApp::CreateDocumentL()
+ {
+ return CAppUIDocument::NewL( *this );
+ }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+//
+
+ #include <eikstart.h>
+ // ---------------------------------------------------------
+ // NewApplication()
+ // Exported function
+ // Returns: CApaApplication:
+ // ---------------------------------------------------------
+ //
+ LOCAL_C CApaApplication* NewApplication()
+ {
+ return new CAppUIApp;
+ }
+ // ---------------------------------------------------------
+ // E32Main()
+ // EXE Entry point
+ // Returns: KErrNone: No error
+ // ---------------------------------------------------------
+ //
+ GLDEF_C TInt E32Main()
+ {
+ return EikStart::RunApplication(NewApplication);
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/AppUIAppUi.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,698 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains TMessageBoxUtil class definition.
+*
+*/
+
+// INCLUDE FILES
+#include "AppUIAppUi.h"
+
+#include "MainMenuView.h"
+#include "TestCaseMenuView.h"
+#include "StartCasesView.h"
+#include "TestModulesMenuView.h"
+#include "StartedCasesMenuView.h"
+#include "ShowStartedCasesView.h"
+#include "TestCaseOutputView.h"
+#include "StatisticsView.h"
+#include "TestSetBaseMenuView.h"
+#include "TestSetMenuView.h"
+#include "TestSetInsertMenuView.h"
+#include "TestSetStartedCasesView.h"
+#include <aknmessagequerydialog.h>
+#include "version.h"
+
+#include "CreatedTestSetMenuView.h"
+
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+
+
+#include <StifTestInterface.h>
+
+#include <aknnotewrappers.h>
+#include <StringLoader.h>
+
+_LIT( KTestSet, "DefaultSet" );
+
+static const TInt KCopyrightChar = 169;
+
+// ----------------------------------------------------------
+// CMessageBoxUtil::ShowNotImplementedYetL
+// Displays message that executed funtion is not implemented yet.
+// ----------------------------------------------------------
+//
+void TMessageBoxUtil::ShowNotImplementedYetL()
+ {
+ _LIT(message, "Not implemented yet");
+ CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
+ informationNote->ExecuteLD(message);
+ }
+
+// ----------------------------------------------------------
+// Display error note.
+// @param aMessage Error message to display.
+// ----------------------------------------------------------
+//
+void TMessageBoxUtil::ShowErrorNoteL( const TDesC& aMessage )
+ {
+ CAknErrorNote* errorNote = new (ELeave) CAknErrorNote(ETrue);
+ // set timeout to 5 sec
+ errorNote->SetTimeout( (CAknNoteDialog::TTimeout)5000000 );
+ errorNote->ExecuteLD( aMessage );
+ }
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ----------------------------------------------------------
+// CAppUIAppUi::ConstructL()
+// ?implementation_description
+// ----------------------------------------------------------
+//
+void CAppUIAppUi::ConstructL()
+ {
+ TInt error(0);
+
+ BaseConstructL( EAknEnableSkin );
+
+ // connection to setting server needs to be open as long as STIF Series 60 UI APP is alive
+ TInt ret = iSettingServer.Connect();
+ if ( ret != KErrNone )
+ {
+ User::Leave( ret );
+ }
+
+ iLogger = CStifLogger::NewL( _L("E\x3a\\"), _L("stif_tfw_ui"),
+ CStifLogger::ETxt, CStifLogger::EFile,
+ ETrue, EFalse, ETrue, EFalse, EFalse );
+
+ iLogger->Log( _L("--- UI log starts ---") );
+ iLogger->Log( _L(" ") );
+ iLogger->Log( _L("appui: ConstructL") );
+
+ // Create CData object which handles all test cases data and running of them
+ iUIStoreHandler = CUIStoreHandler::NewL( this );
+
+ // CUIStore open
+ error = UIStoreHandler()->Open( KDefaultPathAndIni );
+ if ( KErrNone != error )
+ {
+ User::Leave( error );
+ }
+
+ CMainMenuView* mainMenuView = new (ELeave) CMainMenuView;
+ CleanupStack::PushL( mainMenuView );
+ mainMenuView->ConstructL();
+ AddViewL( mainMenuView ); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // MainMenuView
+
+ iLogger->Log(_L("appui:mainview "));
+
+ CCreatedTestSetMenuView* testCreatedTestSetMenuView = new (ELeave) CCreatedTestSetMenuView;
+ CleanupStack::PushL( testCreatedTestSetMenuView );
+ testCreatedTestSetMenuView->ConstructL();
+ AddViewL( testCreatedTestSetMenuView ); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // testCaseMenuView
+ CTestCaseMenuView* testCaseMenuView = new (ELeave) CTestCaseMenuView;
+ CleanupStack::PushL( testCaseMenuView );
+ testCaseMenuView->ConstructL();
+ AddViewL( testCaseMenuView ); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // testCaseMenuView
+
+ iLogger->Log(_L("appui:caseview "));
+
+ CStartCasesView* startCasesView = new (ELeave) CStartCasesView;
+ CleanupStack::PushL( startCasesView );
+ startCasesView->ConstructL();
+ AddViewL( startCasesView ); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // startCasesView
+
+ iLogger->Log(_L("appui:startcaseview "));
+
+ CStartedCasesMenuView* startedCasesMenuView = new (ELeave) CStartedCasesMenuView;
+ CleanupStack::PushL( startedCasesMenuView );
+ startedCasesMenuView->ConstructL();
+ AddViewL( startedCasesMenuView ); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // startedCasesMenuView
+
+ iLogger->Log(_L("appui:started cases view created"));
+
+ CShowStartedCasesView* showStartedCasesView = new (ELeave) CShowStartedCasesView;
+ CleanupStack::PushL( showStartedCasesView );
+ showStartedCasesView->ConstructL();
+ AddViewL( showStartedCasesView ); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // showStartedCasesView
+
+ iLogger->Log(_L("appui: show started cases view created"));
+
+ CTestCaseOutputView* testCaseOutputView = new (ELeave) CTestCaseOutputView;
+ CleanupStack::PushL( testCaseOutputView );
+ testCaseOutputView->ConstructL();
+ AddViewL( testCaseOutputView ); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // testCaseOutputView
+
+ iLogger->Log(_L("appui: test case output view created"));
+
+ CTestModulesMenuView* testModulesMenuView = new (ELeave) CTestModulesMenuView;
+ CleanupStack::PushL( testModulesMenuView );
+ testModulesMenuView->ConstructL();
+ AddViewL( testModulesMenuView ); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // testModulesMenuView
+
+ iLogger->Log(_L("appui:modulesview "));
+
+ CStatisticsView* statisticsMenuView = new (ELeave) CStatisticsView;
+ CleanupStack::PushL( statisticsMenuView );
+ statisticsMenuView->ConstructL();
+ AddViewL( statisticsMenuView ); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // statisticsMenuView
+
+ iLogger->Log(_L("appui:modulesview "));
+
+ //
+ CTestSetBaseMenuView* testSetBaseMenuView = new (ELeave) CTestSetBaseMenuView;
+ CleanupStack::PushL( testSetBaseMenuView );
+ testSetBaseMenuView->ConstructL();
+ AddViewL( testSetBaseMenuView ); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // testSetBaseMenuView
+
+ iLogger->Log(_L("appui:testsetsbaseview "));
+
+ CTestSetMenuView* testSetMenuView = new (ELeave) CTestSetMenuView;
+ CleanupStack::PushL( testSetMenuView );
+ testSetMenuView->ConstructL();
+ AddViewL( testSetMenuView ); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // testSetMenuView
+
+ iLogger->Log(_L("appui:testsetsview "));
+
+ CTestSetInsertMenuView* testSetInsertMenuView = new (ELeave) CTestSetInsertMenuView;
+ CleanupStack::PushL( testSetInsertMenuView );
+ testSetInsertMenuView->ConstructL();
+ AddViewL( testSetInsertMenuView ); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // testSetInsertMenuView
+
+ iLogger->Log(_L("appui:testsetinsertview "));
+
+ CTestSetStartedCasesView* testSetStartedCasesView = new (ELeave) CTestSetStartedCasesView;
+ CleanupStack::PushL( testSetStartedCasesView );
+ testSetStartedCasesView->ConstructL();
+ AddViewL( testSetStartedCasesView ); // transfer ownership to CAknViewAppUi
+ CleanupStack::Pop(); // testSetStartedCasesView
+
+ iLogger->Log(_L("appui:testsetStartedCasesView "));
+
+
+ SetDefaultViewL( *mainMenuView );
+
+ iLogger->Log(_L("appui:setdefview "));
+
+ iStartedTestCase = NULL;
+ iStartedTestSet = -1;
+
+ iPreviousPositionListValid = ETrue;
+ }
+
+// ----------------------------------------------------
+// CAppUIAppUi::~CAppUIAppUi()
+// Destructor
+// Frees reserved resources
+// ----------------------------------------------------
+//
+CAppUIAppUi::~CAppUIAppUi()
+ {
+
+ if ( iLogger )
+ {
+ iLogger->Log( _L(" ") );
+ iLogger->Log( _L("--- UI log ends ---") );
+ }
+
+ delete iLogger;
+ iSettingServer.Close();
+ UIStoreHandler()->Close();
+ delete iUIStoreHandler;
+
+ // Closing of array of positions of focus in various menus
+ iPreviousFocusPosition.Close();
+ // iPreviousFocusPosition is no longer valid and cannot be used any more
+ iPreviousPositionListValid = EFalse;
+ //RemoveView(EMainMenuViewId);
+ }
+
+// ------------------------------------------------------------------------------
+// CAppUIAppUi::Data( )
+// Just returns pointer to CUIStore object, which is created by CAppUIAppUi
+// ------------------------------------------------------------------------------
+//
+CUIStore* CAppUIAppUi::UIStoreHandler()
+ {
+ return &iUIStoreHandler->UIStore();
+
+ }
+
+// ------------------------------------------------------------------------------
+// CAppUIAppUi::::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
+// This function is called by the EIKON framework just before it displays
+// a menu pane. Its default implementation is empty, and by overriding it,
+// the application can set the state of menu items dynamically according
+// to the state of application data.
+// ------------------------------------------------------------------------------
+//
+void CAppUIAppUi::DynInitMenuPaneL(
+ TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
+ {
+
+ }
+
+// ----------------------------------------------------
+// CAppUIAppUi::HandleKeyEventL(
+// const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
+// ?implementation_description
+// ----------------------------------------------------
+//
+TKeyResponse CAppUIAppUi::HandleKeyEventL(
+ const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
+ {
+ TInt currentView;
+
+ if ( iView )
+ {
+ currentView = (iView->Id()).iUid;
+
+
+ switch ( aKeyEvent.iCode )
+ {
+ case EKeyLeftArrow:
+ {
+ switch ( currentView )
+ {
+ case ETestModulesMenuViewId:
+ {
+ HandleCommandL( EAppUIGoToTestCaseMenu );
+ break;
+ }
+ case ETestSetBaseMenuViewId:
+ {
+ HandleCommandL( EAppUIGoToModulesMenu );
+ ActivateLocalViewL(TUid::Uid(ETestModulesMenuViewId));
+ break;
+ }
+ }
+ break;
+ }
+ case EKeyRightArrow:
+ {
+ switch ( currentView )
+ {
+ case ETestCaseMenuViewId:
+ {
+ HandleCommandL( EAppUIGoToModulesMenu ); // TestCaseMenu --> TestModuleMenu
+ ActivateLocalViewL(TUid::Uid(ETestModulesMenuViewId));
+ break;
+ }
+ case ETestModulesMenuViewId:
+ {
+ HandleCommandL( EAppUIGoToTestSetsMenu );
+ ActivateLocalViewL(TUid::Uid(ETestSetBaseMenuViewId));
+ break;
+ }
+ case ETestSetsMenuViewId:
+ {
+ break;
+ }
+
+ }
+ break;
+ }
+
+ default:
+ {
+ return EKeyWasNotConsumed;
+ //break;
+ }
+ }
+ }
+
+ return EKeyWasConsumed;
+
+ }
+
+// ----------------------------------------------------
+// CAppUIAppUi::HandleCommandL(TInt aCommand)
+// ?implementation_description
+// ----------------------------------------------------
+//
+void CAppUIAppUi::HandleCommandL(TInt aCommand)
+ {
+ TInt currentView, newView;
+ TInt error(0);
+
+ currentView = (iView->Id()).iUid;
+
+ switch ( aCommand )
+ {
+ case EEikCmdExit:
+ case EAknSoftkeyExit:
+ {
+ PrepareToExit();
+ Exit();
+ newView = currentView;
+ break;
+ }
+ case EAppUIGoBack:
+ {
+ switch ( currentView )
+ {
+ case ETestCaseMenuViewId:
+ {
+ newView = EMainMenuViewId; // Test Cases Menu --> Main Menu
+ break;
+ }
+ case EStartCaseMenuViewId:
+ {
+ newView = ETestCaseMenuViewId; // Start Cases Menu --> Test Cases Menu
+ //iTabGroup->SetActiveTabByIndex(0);
+ break;
+ }
+ case ETestModulesMenuViewId:
+ {
+ newView = EMainMenuViewId; // Test Modules Menu --> Main Menu
+ break;
+ }
+ case EStartedCasesMenuViewId:
+ {
+ newView = ETestCaseMenuViewId; // Started Cases Menu --> Test Case Menu
+ break;
+ }
+ case EShowStartedCasesViewId:
+ {
+ newView = EStartedCasesMenuViewId; // Show started cases --> Started Cases Menu
+ break;
+ }
+ case ETestCaseOutputViewId:
+ {
+ newView = iPreviousView; // Test case output view --> previous view
+ break;
+ }
+ case EStatisticsViewId:
+ {
+ newView = EStartedCasesMenuViewId; // Statistic view --> Started Cases Menu
+ break;
+ }
+ case ETestSetBaseMenuViewId:
+ {
+ newView = EMainMenuViewId; // Test Sets Base Menu --> Main Menu
+ break;
+ }
+ case ETestSetMenuViewId:
+ {
+ newView = ETestSetBaseMenuViewId; // Test Sets Menu --> Test Sets Base Menu
+ break;
+ }
+ case ETestSetInsertMenuViewId:
+ {
+ newView = ETestSetMenuViewId; // Test Set Insert Menu --> Test Sets Menu
+ break;
+ }
+ case ETestSetStartedCasesViewId:
+ {
+ newView = ETestSetMenuViewId; // Test Set Started Cases Menu --> Test Sets Menu
+ break;
+ }
+ default:
+ {
+ newView = currentView; // Back does not work. This should not happen ever
+ break;
+ }
+ }
+ break;
+ }
+ case EAppUIGoToMainMenu:
+ {
+ newView = EMainMenuViewId;
+ break;
+ }
+ case EAppUIGoToTestCaseMenu:
+ {
+ newView = ETestCaseMenuViewId;
+ break;
+ }
+ case ECmdGoToStartCasesView:
+ {
+ newView = EStartCaseMenuViewId;
+ break;
+ }
+ case ECmdGoToStartedCasesView:
+ {
+ newView = EStartedCasesMenuViewId;
+ break;
+ }
+ case EAppUIGoToModulesMenu:
+ {
+ newView = ETestModulesMenuViewId;
+ //iTabGroup->SetActiveTabByIndex(1);
+ break;
+ }
+ case EAppUIGoToTestSetsMenu:
+ {
+ newView = ETestSetBaseMenuViewId;
+
+ //ShowNotImplementedYet();
+ //newView = currentView;
+ break;
+ }
+ case ECmdCreateTestSet:
+ {
+ CTestSetMenuView* testSetMenu = (CTestSetMenuView*)View( TUid::Uid(ETestSetMenuViewId) );
+ error = testSetMenu->CreateTestSetL( KTestSet );
+ if ( KErrNone == error || KErrAlreadyExists == error)
+ {
+ newView = ETestSetInsertMenuViewId;
+ currentView = ETestSetMenuViewId; // Store previous view for Back function
+ }
+ else
+ {
+ newView = ETestSetMenuViewId;
+ }
+ break;
+ }
+ case ECmdLoadTestSet:
+ {
+ newView = ECreatedTestSetMenuViewId; /*ETestSetBaseMenuViewId;*/
+ break;
+ }
+ case ECmdGoToTestSetView:
+ {
+
+ newView = ETestSetMenuViewId;
+ break;
+ }
+ case ECmdInsertTestCases:
+ {
+ newView = ETestSetInsertMenuViewId;
+ break;
+ }
+ case ECmdShowStartedTestSet:
+ {
+ newView = ETestSetStartedCasesViewId;
+ iShowStartedCasesMode = EShowAllStartedCases;
+ break;
+ }
+ case ECmdShowAllStartedCases:
+ newView = EShowStartedCasesViewId;
+ iShowStartedCasesMode = EShowAllStartedCases;
+ break;
+ case ECmdShowOngoingCases:
+ newView = EShowStartedCasesViewId;
+ iShowStartedCasesMode = EShowOngoingCases;
+ break;
+ case ECmdShowPassedCases:
+ newView = EShowStartedCasesViewId;
+ iShowStartedCasesMode = EShowPassedCases;
+ break;
+ case ECmdShowPausedCases:
+ newView = EShowStartedCasesViewId;
+ iShowStartedCasesMode = EShowPausedCases;
+ break;
+ case ECmdShowFailedCases:
+ newView = EShowStartedCasesViewId;
+ iShowStartedCasesMode = EShowFailedCases;
+ break;
+ case ECmdShowCrashedAbortedCases:
+ newView = EShowStartedCasesViewId;
+ iShowStartedCasesMode = EShowCrashedAbortedCases;
+ break;
+ case ECmdShowStatistics:
+ newView = EStatisticsViewId;
+ break;
+ case ECmdViewOutput:
+ newView = ETestCaseOutputViewId;
+ break;
+ case ECmdShowAbout:
+ {
+ CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog;
+ TBuf<200> version;
+ version.Format(_L("STIF UI - Version %d.%d.%d - "), STIFUI_MAJOR_VERSION, STIFUI_MINOR_VERSION, STIFUI_BUILD_VERSION);
+ version.Append(TO_UNICODE(STIFUI_REL_DATE));
+ version.Append(_L("\n"));
+
+ TInt stifMajorV;
+ TInt stifMinorV;
+ TInt stifBuildV;
+ TBuf<30> relDate;
+ TStifUtil::STIFVersion(stifMajorV, stifMinorV, stifBuildV, relDate);
+
+ TBuf<40> stifVersion;
+ stifVersion.Format(_L("STIF - Version %d.%d.%d - "), stifMajorV, stifMinorV, stifBuildV);
+ stifVersion.Append(relDate);
+ stifVersion.Append(_L("\n"));
+
+ version.Append(stifVersion);
+
+ version.Append(_L("Copyright "));
+ version.Append( KCopyrightChar );
+ version.Append(_L(" 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved."));
+
+ dlg->SetMessageText(version);
+ dlg->ExecuteLD(R_STIFUI_ABOUT_DIALOG);
+ newView = currentView;
+ break;
+ }
+ default:
+ {
+ TMessageBoxUtil::ShowNotImplementedYetL();
+ newView = currentView;
+ break;
+ }
+ }
+
+ if( newView != currentView )
+ {
+ iPreviousView = currentView; // Store previous view for Back function
+ ActivateLocalViewL( TUid::Uid(newView) );
+
+ /*switch ( newView )
+ {
+ case EMainMenuViewId:
+ case EStartedCasesMenuViewId:
+ case EStartCaseMenuViewId:
+ case ETestCaseOutputViewId:
+ {
+ //StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+ //iTabGroup->DimTab (ETestCaseMenuTab, ETrue);
+ //iTabGroup->DimTab (ETestModulesMenuTab, ETrue);
+ //iTabGroup->DimTab (ETestSetsMenuTab, ETrue);
+
+ //StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_EMPTY);
+ //StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_IDLE);
+ break;
+ }
+ case ETestCaseMenuViewId:
+ case ETestModulesMenuViewId:
+ case ETestSetsMenuViewId:
+ {
+ //StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+ //iTabGroup->DimTab (ETestCaseMenuTab, EFalse);
+ //iTabGroup->DimTab (ETestModulesMenuTab, EFalse);
+ //iTabGroup->DimTab (ETestSetsMenuTab, EFalse);
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }*/
+ }
+
+ }
+
+/**
+* Receives output update notification from UI Storehandler
+* @param
+* @return
+*/
+void CAppUIAppUi::OutputUpdateL( CStartedTestCase* aTestCase, TInt /* aStatus */ )
+ {
+ if( iView->Id().iUid == ETestCaseOutputViewId )
+ {
+ ( ( CTestCaseOutputView* )iView )->OutputUpdateL( aTestCase );
+ }
+ else if( iView->Id().iUid == EShowStartedCasesViewId )
+ {
+ ( ( CShowStartedCasesView* )iView )->TestCaseStateChangedL();
+ }
+ else if( iView->Id().iUid == ETestCaseOutputViewId )
+ {
+ ( ( CTestCaseOutputView* )iView )->TestCaseStateChangedL();
+ }
+ }
+
+/**
+* Sets index of selected test case for viewing test case output
+* @param
+* @return
+*/
+void CAppUIAppUi::SetStartedTestCase( CStartedTestCase* aStartedTestCase )
+ {
+ iStartedTestCase = aStartedTestCase;
+ }
+
+/**
+* Returns index of selected test case for viewing test case output
+* @param
+* @return
+*/
+CStartedTestCase* CAppUIAppUi::GetStartedTestCase( )
+ {
+ return iStartedTestCase;
+ }
+
+/**
+ * Stores focus position of focus from a specyfic view to iPreviousFocusPosition object.
+ * Value is than used to retrieve previous position of focus in the menu
+ * @param aViewId - identification of view
+ * @param aPosition - value to store for a specyfic view
+ */
+void CAppUIAppUi::SaveFocusPosition(TAppUIViewNumber aViewId, TInt aPosition)
+ {
+ if(!iPreviousPositionListValid)
+ {
+ return;
+ }
+ for(TInt counter = iPreviousFocusPosition.Count(); counter <= aViewId; counter++)
+ {
+ iPreviousFocusPosition.Append(0);
+ }
+ iPreviousFocusPosition[aViewId] = aPosition;
+ }
+
+/**
+ * Restores focus position of focus for a specyfic view from iPreviousFocusPosition object.
+ * @param aViewId - identification of view
+ * @return - previous position of focus in the requested view
+ */
+TInt CAppUIAppUi::GetFocusPosition(TAppUIViewNumber aViewId)
+ {
+ if(iPreviousFocusPosition.Count() > aViewId)
+ {
+ return iPreviousFocusPosition[aViewId];
+ }
+ else
+ {
+ return KErrNotFound;
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/AppUIDocument.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CAppUIDocument class definition.
+*
+*/
+
+// INCLUDE FILES
+#include "AppUIDocument.h"
+#include "AppUIAppUi.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// constructor
+CAppUIDocument::CAppUIDocument(CEikApplication& aApp)
+: CAknDocument(aApp)
+ {
+ }
+
+// destructor
+CAppUIDocument::~CAppUIDocument()
+ {
+ }
+
+// Symbian OS default constructor can leave.
+void CAppUIDocument::ConstructL()
+ {
+ }
+
+// Two-phased constructor.
+CAppUIDocument* CAppUIDocument::NewL(
+ CEikApplication& aApp) // CAppUIApp reference
+ {
+ CAppUIDocument* self = new (ELeave) CAppUIDocument( aApp );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ----------------------------------------------------
+// CAppUIDocument::CreateAppUiL()
+// constructs CAppUIAppUi
+// ----------------------------------------------------
+//
+CEikAppUi* CAppUIDocument::CreateAppUiL()
+ {
+ return new (ELeave) CAppUIAppUi;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/Container.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,444 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestCaseListBoxModel class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h> // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <aknnotewrappers.h>
+
+#include <eikclbd.h> // CColumnListBoxData
+
+#include "Container.h"
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestCaseListBoxModel::NewL
+//
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+
+CTestCaseListBoxModel* CTestCaseListBoxModel::NewL(RPointerArray<CTestInfo>* aTestCasesInView)
+ {
+ CTestCaseListBoxModel* self = new ( ELeave ) CTestCaseListBoxModel();
+ CleanupStack::PushL( self );
+ self->iBuffer = HBufC::NewL( 130 );
+ self->iTestCasesInView = aTestCasesInView;
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseListBoxModel::ConstructL
+//
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+
+void CTestCaseListBoxModel::ConstructL()
+ {
+ //iBuffer = HBufC::NewLC( KMaxInfoName + KMaxName + 2 );
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseListBoxModel::~CTestCaseListBoxModel
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestCaseListBoxModel::~CTestCaseListBoxModel()
+ {
+ delete iBuffer;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseListBoxModel::MdcaCount
+//
+// Returns the number of descriptor elements in the array.
+// ----------------------------------------------------------------------------
+//
+
+TInt CTestCaseListBoxModel::MdcaCount() const
+ {
+ return iTestCasesInView->Count();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseListBoxModel::MdcaPoint
+//
+// Indexes into a descriptor array.
+// ----------------------------------------------------------------------------
+//
+TPtrC CTestCaseListBoxModel::MdcaPoint(TInt aIndex) const
+ {
+ CTestInfo* testCasePtr = (*iTestCasesInView)[aIndex];
+ TPtr buffer( iBuffer->Des() );
+ buffer.Zero();
+ buffer.Append(_L("\t"));
+ buffer.Append(testCasePtr->TestCaseTitle() );
+ return *iBuffer;
+ }
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CContainer::ConstructL
+//
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CContainer::ConstructL()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::~CContainer
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CContainer::~CContainer()
+ {
+ iTestCasesInView.Close(); // does not delete objects whose pointers are contained in the array
+ delete iListBox;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CContainer::SetGraphicIconL
+//
+// Sets graphic icon using listbox as CEikColumnListBox.
+// ----------------------------------------------------------------------------
+//
+void CContainer::SetGraphicIconL( CEikColumnListBox* aListBox )
+ {
+ if ( aListBox )
+ {
+ // Creates gul icon.
+ CAknIconArray* iconArray = new(ELeave) CAknIconArray(1);
+ CleanupStack::PushL( iconArray );
+
+ GraphicIconL( iconArray ); // Appends graphic data.
+
+ // Sets graphics as ListBox icon.
+ aListBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray );
+
+ CleanupStack::Pop();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::CurrentItemIndex
+//
+// Returns current item index in list box.
+// ----------------------------------------------------------------------------
+//
+TInt CContainer::CurrentItemIndex()
+ {
+ return iListBox->CurrentItemIndex();
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::SetCurrentItemIndex
+//
+// Sets current item index in list box.
+// ----------------------------------------------------------------------------
+//
+void CContainer::SetCurrentItemIndex(TInt aCurrentTestCase)
+ {
+ iListBox->SetCurrentItemIndexAndDraw(aCurrentTestCase);
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::GraphicIconL
+//
+// Appends graphics data.
+// ----------------------------------------------------------------------------
+//
+void CContainer::GraphicIconL( CArrayPtr<CGulIcon>* aIcons )
+ {
+ if ( aIcons )
+ {
+ CFbsBitmap* markBitmap = NULL;
+ CFbsBitmap* markBitmapMask = NULL;
+
+ TRgb defaultColor;
+ defaultColor = CEikonEnv::Static()->Color(EColorControlText);
+
+ AknsUtils::CreateColorIconL(AknsUtils::SkinInstance(),
+ KAknsIIDQgnIndiMarkedAdd,
+ KAknsIIDQsnIconColors,
+ EAknsCIQsnIconColorsCG13,
+ markBitmap,
+ markBitmapMask,
+ AknIconUtils::AvkonIconFileName(),
+ EMbmAvkonQgn_indi_marked_add,
+ EMbmAvkonQgn_indi_marked_add_mask,
+ defaultColor );
+
+ CGulIcon* markIcon = CGulIcon::NewL(markBitmap,markBitmapMask);
+ aIcons->AppendL(markIcon);
+ }
+ }
+
+
+// ----------------------------------------------------------------------------
+// CContainer::SizeChanged
+//
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CContainer::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CContainer::CountComponentControls() const
+ {
+ return 1; // return nbr of controls inside this container
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::Draw
+//
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CContainer::Draw(const TRect& /*aRect*/) const
+ {
+ // CWindowGc& gc = SystemGc();
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::SelectedTestCases
+//
+// Returns pointers to selected test cases.
+// ----------------------------------------------------------------------------
+//
+void CContainer::SelectedTestCases
+ (RPointerArray<CTestInfo>& aSelectedTestCases)
+ {
+ TInt selectedItemIdx = iListBox->CurrentItemIndex();
+ if ( ( selectedItemIdx >= 0 ) && ( iTestCasesInView.Count() > selectedItemIdx ) )
+ {
+ aSelectedTestCases.Append( iTestCasesInView[ selectedItemIdx ] );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::SelectedTestCaseInfo
+//
+// Returns pointers to currently selected (in list box) test cases info.
+// ----------------------------------------------------------------------------
+//
+CTestInfo* CContainer::SelectedTestCaseInfo()
+ {
+ TInt selectedItemIdx = iListBox->CurrentItemIndex();
+ if ( ( selectedItemIdx >= 0 ) && ( iTestCasesInView.Count() > selectedItemIdx ) )
+ {
+ return iTestCasesInView[ selectedItemIdx ];
+ }
+ return NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::TestCaseInfo
+//
+// Returns pointers to selected test cases info.
+// ----------------------------------------------------------------------------
+//
+CTestInfo* CContainer::TestCaseInfo( TInt aIndex )
+ {
+ if ( ( aIndex >=0 ) && ( iTestCasesInView.Count() > aIndex ) )
+ {
+ return iTestCasesInView[ aIndex ];
+ }
+ return NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::HandleMarkCommandL
+//
+// Handles mark commands.
+// ----------------------------------------------------------------------------
+//
+void CContainer::HandleMarkCommandL( TInt aCommand )
+ {
+ if (iListBox)
+ {
+ AknSelectionService::HandleMarkableListProcessCommandL( aCommand, iListBox );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::ProcessCommandL
+//
+// Processes user commands.
+// ----------------------------------------------------------------------------
+//
+void CContainer::ProcessCommandL( TInt aCommand )
+ {
+ AknSelectionService::HandleMarkableListProcessCommandL( aCommand, iListBox );
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::SelectionListProcessCommandL
+//
+// Processes user commands.
+// ----------------------------------------------------------------------------
+//
+void CContainer::SelectionListProcessCommandL( TInt aCommand )
+ {
+ AknSelectionService::HandleSelectionListProcessCommandL( aCommand, iListBox );
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::FilterCasesByModuleL
+//
+// Show only testcases which are defined is specified module.
+// ----------------------------------------------------------------------------
+//
+void CContainer::FilterCasesByModuleL( TName aModuleName )
+ {
+ iTestCasesInView.Reset(); // Clear testCasesInView pointer array
+
+ RRefArray<CTestInfo> allCases;
+ TInt ret = iUIStore->TestCases( allCases );
+ if( KErrNone != ret )
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("FilterCasesByModuleL(): iUIStore->TestCases() fails"));
+ allCases.Reset();
+ allCases.Close();
+ User::Leave( ret );
+ }
+ const TInt KTestCaseCount = allCases.Count();
+ for( TInt i=0; i < KTestCaseCount; i++ )
+ {
+ if ( allCases[i].ModuleName() == aModuleName )
+ {
+ iTestCasesInView.Append( &( allCases[i] ) );
+ }
+ }
+ allCases.Reset();
+ allCases.Close();
+
+ iListBox->Reset();
+ iListBox->DrawNow();
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::FilterCasesByTCFileNameL
+//
+// Show only testcases which are defined is specified test case file.
+// ----------------------------------------------------------------------------
+//
+void CContainer::FilterCasesByTCFileNameL(
+ TFileName aTestCaseFileName )
+ {
+
+ iTestCasesInView.Reset(); // Clear testCasesInView pointer array
+
+ RRefArray<CTestInfo> allCases;
+ TInt ret = iUIStore->TestCases( allCases );
+ if( KErrNone != ret )
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("FilterCasesByModuleL(): iUIStore->TestCases() fails"));
+ allCases.Reset();
+ allCases.Close();
+ User::Leave( ret );
+ }
+ const TInt KTestCaseCount = allCases.Count();
+ for( TInt i=0; i < KTestCaseCount; i++ )
+ {
+ if ( allCases[i].TestCaseFile() == aTestCaseFileName )
+ {
+ iTestCasesInView.Append( &( allCases[i] ) );
+ }
+ }
+
+ allCases.Reset();
+ allCases.Close();
+
+ iListBox->Reset();
+ iListBox->DrawNow();
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::NoFilteringL
+//
+// Remove possible filtering of test cases -> show all test cases.
+// ----------------------------------------------------------------------------
+//
+void CContainer::NoFilteringL()
+ {
+ iTestCasesInView.Reset(); // Clear testCasesInView pointer array
+
+ RRefArray<CTestInfo> allCases;
+ TInt ret = iUIStore->TestCases( allCases );
+ if( KErrNone != ret )
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("FilterCasesByModuleL(): iUIStore->TestCases() fails"));
+ allCases.Reset();
+ allCases.Close();
+ User::Leave( ret );
+ }
+ const TInt KTestCaseCount = allCases.Count();
+
+ // Add all cases to iTestCasesInView pointer array
+ for( TInt i=0; i < KTestCaseCount; i++ )
+ {
+ iTestCasesInView.Append( &( allCases[i] ) );
+ }
+
+ allCases.Reset();
+ allCases.Close();
+
+ iListBox->Reset();
+ iListBox->DrawNow();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/CreatedTestSetMenuContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This fiole contains CreatedTestSetMenuContainer class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h> // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <aknnotewrappers.h>
+
+#include <eikclbd.h> // CColumnListBoxData
+
+#include "CreatedTestSetMenuContainer.h"
+#include "StartCasesView.h"
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include "Container.h"
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuContainer::ConstructL
+//
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("CCreatedTestSetMenuContainer: ConstructL"));
+
+ iParentView = (CCreatedTestSetMenuView*)aListBoxObserver;
+ CreateWindowL();
+
+ iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+ iTestCasesInView.Reset();
+
+ iListBox = CMenuListBox::NewL(ECreatedTestSetMenuViewId);
+ iListBox->SetContainerWindowL( *this );
+ iListBox->SetListBoxObserver( aListBoxObserver /*this*/ ); //
+ iListBox->ConstructL(this, EAknListBoxMarkableList /*EAknListBoxSelectionList*/);
+
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("CCreatedTestSetMenuContainer: ListBox constructed"));
+
+ //Create Scroller control for ListBox and set its visibility
+ iListBox->CreateScrollBarFrameL(ETrue);
+ iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+ iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+
+ if ( iUIStore )
+ {
+ CDesCArray* items = static_cast<CDesCArray*> (iListBox->Model()->ItemTextArray());
+
+ //Create list of available Test Set
+ RRefArray<TDesC> allSet;
+ RRefArray<CTestInfo> allCases;
+ TInt ret = iUIStore->GetTestSetsList( allSet );
+ if( KErrNone != ret )
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("iUIStore->GetTestSetsList() fails"));
+ allSet.Reset();
+ allSet.Close();
+ User::Leave( ret );
+ }
+
+ const TInt KTestCaseCount = allSet.Count();
+ for (TInt i=0; i <KTestCaseCount; i++)
+ {
+ _LIT(KItemFromat, "0\t%S\t\t");
+
+ RBuf tmp;
+ tmp.Create(allSet[i].Length() + 6);
+ tmp.Format( KItemFromat, &allSet[i] );
+ items->AppendL( tmp );
+ tmp.Close();
+ }
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("CCreatedTestSetMenuContainer: ListBox model"));
+ iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);
+ iListBox->HandleItemAdditionL();
+
+ allSet.Reset();
+ allSet.Close();
+ }
+ else
+ {
+ User::Leave( KErrGeneral );
+ }
+
+ // Creates graphic.
+ SetGraphicIconL( iListBox );
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("CCreatedTestSetMenuContainer: icons created"));
+
+ iListBox->ActivateL();
+ ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+ SetRect(aRect);
+ ActivateL();
+ }
+
+// ----------------------------------------------------------------------------
+//CreatedTestSetMenuContainer::~CStartCasesContainer
+//
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CCreatedTestSetMenuContainer::~CCreatedTestSetMenuContainer()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuContainer::SizeChanged
+//
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuContainer::SizeChanged()
+ {
+
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+ }
+
+// ----------------------------------------------------------------------------
+//CreatedTestSetMenuContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CCreatedTestSetMenuContainer::CountComponentControls() const
+ {
+ return 1; // return nbr of controls inside this container
+ }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CCreatedTestSetMenuContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuContainer::Draw
+//
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuContainer::Draw(const TRect& /*aRect*/) const
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuContainer::OfferKeyEventL
+//
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CCreatedTestSetMenuContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType )
+ {
+ if (iListBox)
+ {
+
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ else
+ {
+ return EKeyWasNotConsumed;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuContainer:::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuContainer::SaveActiveLine()
+ {
+ ((CMenuListBox*)iListBox)->SaveFocusPosition();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/CreatedTestSetMenuView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStartCasesView class definition.
+*
+*/
+
+// INCLUDE FILES
+#include <eikmenub.h>
+#include <aknViewAppUi.h>
+#include <aknlistquerydialog.h>
+#include <barsread.h> //TResourceReader
+#include <Stifui.rsg>
+#include "CreatedTestSetMenuView.h"
+#include "CreatedTestSetMenuContainer.h"
+#include "AppUIAppUi.h"
+#include "Stifui.hrh"
+#include "TestSetMenuView.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStartCasesView::ConstructL
+//
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuView::ConstructL()
+ {
+ CView::ConstructL();
+ BaseConstructL(R_APPUI_LOADTESTSETVIEW);
+ iCurrentTestCase = 0;
+
+ }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuView::~CStartCasesView
+//
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CCreatedTestSetMenuView::~CCreatedTestSetMenuView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuView::Id
+//
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CCreatedTestSetMenuView::Id() const
+ {
+ return TUid::Uid(ECreatedTestSetMenuViewId);
+
+ }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuView::HandleCommandL
+//
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuView::HandleCommandL(TInt aCommand)
+ {
+ switch ( aCommand )
+ {
+ case EAknSoftkeyBack:
+ {
+ AppUi()->HandleCommandL(EAppUIGoToTestSetsMenu);
+ break;
+ }
+ case EAknCmdOpen:
+ {
+ HandleListBoxEventL(iContainer->ListBox(), EEventEnterKeyPressed);
+ break;
+ }
+ default:
+ {
+ AppUi()->HandleCommandL( aCommand );
+ break;
+ }
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+//CreatedTestSetMenuView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuView::DoActivateL
+//
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("CreatedTestSetMenuView: DoActivateL"));
+ iContainer = new (ELeave) CCreatedTestSetMenuContainer;
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect(), this );
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("CreatedTestSetMenuView: container constructed"));
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+
+ iContainer->SetCurrentItemIndex(iCurrentTestCase);
+
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_LOADTESTSET);
+ iNaviDecorator = np->CreateNavigationLabelL( reader );
+ CleanupStack::PopAndDestroy(); // resource reader
+ np->PushL(*iNaviDecorator);
+
+ }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuView::DoDeactivate
+//
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ iContainer->SaveActiveLine();
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuView::HandleListBoxEventL
+//
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuView::HandleListBoxEventL( CEikListBox* aListBox,
+ TListBoxEvent aEventType )
+ {
+ if ( aEventType == MEikListBoxObserver::EEventEnterKeyPressed )
+ {
+ // Checking with item from list was selected
+ CTextListBoxModel* tmp = (CTextListBoxModel*)aListBox->Model();
+ TPtrC item = tmp->ItemText(aListBox->CurrentItemIndex());
+ // Geting propper format of item from list (ex. 2008_8_10_13_16.set ).
+ TPtrC substracted(item.Left(item.Length()-2));
+ substracted.Set(substracted.Right(substracted.Length()-2));
+ // Creating new view containing
+ CTestSetMenuView* testSetMenu = (CTestSetMenuView*)AppUi()->View( TUid::Uid(ETestSetMenuViewId) );
+ User::LeaveIfError( testSetMenu->LoadTestSetL( substracted ) );
+ AppUi()->HandleCommandL(ECmdGoToTestSetView);
+ }
+
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/MainMenuContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,217 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CMainMenuContainer class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h> // ListBox
+
+#include <barsread.h> // for TResourceReader
+
+#include <aknnotewrappers.h>
+
+#include "MainMenuContainer.h"
+#include "Stifui.hrh"
+#include <Stifui.rsg>
+#include "MenuListBox.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CMainMenuContainer::ConstructL
+//
+// Symbian OS two phased constructor
+// ---------------------------------------------------------
+//
+void CMainMenuContainer::ConstructL(const TRect& aRect)
+ {
+ CreateWindowL();
+
+ iListBox = CMenuListBox::NewL(EMainMenuViewId);
+ iListBox->SetContainerWindowL( *this );
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC( reader, R_MAIN_MENU_LISTBOX );
+ iListBox->SetListBoxObserver( this );
+ iListBox->ConstructFromResourceL( reader );
+ CleanupStack::PopAndDestroy(); // resource stuffs.
+ iListBox->ActivateL(); // Sets control as ready to be drawn
+
+ // retrieve previous position of focus for this view/continer and set focus to this value
+ ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+ SetRect(aRect);
+ ActivateL();
+ }
+
+
+// ---------------------------------------------------------
+// CMainMenuContainer::~CMainMenuContainer
+//
+// Destructor
+// ---------------------------------------------------------
+//
+CMainMenuContainer::~CMainMenuContainer()
+ {
+ if( iListBox )
+ {
+ delete iListBox;
+ iListBox = NULL;
+ }
+ }
+
+// ---------------------------------------------------------
+// CMainMenuContainer::SizeChanged
+//
+// Called by framework when the view size is changed
+// ---------------------------------------------------------
+//
+void CMainMenuContainer::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+ }
+
+// ---------------------------------------------------------
+// CMainMenuContainer::CountComponentControls
+//
+// Returns number of controls indside this container.
+// ---------------------------------------------------------
+//
+TInt CMainMenuContainer::CountComponentControls() const
+ {
+ return 1;
+ }
+
+// ---------------------------------------------------------
+// CMainMenuContainer::ComponentControl
+//
+// Gets the specified component of a compound control.
+// ---------------------------------------------------------
+//
+CCoeControl* CMainMenuContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+// ---------------------------------------------------------
+// CMainMenuContainer::Draw
+//
+// Draw a control, called by window server.
+// ---------------------------------------------------------
+//
+void CMainMenuContainer::Draw(const TRect& /*aRect*/) const
+ {
+ }
+
+// ---------------------------------------------------------
+// CMainMenuContainer::HandleListBoxEventL
+//
+// Handles list box events.
+// ---------------------------------------------------------
+//
+void CMainMenuContainer::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
+ {
+
+ if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+ {
+ HandleSelectedListItemL( aListBox->CurrentItemIndex() );
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CMainMenuContainer::HandleSelectedListItemL
+//
+// Method HandleSelectedListItemL handles valix index.
+// ----------------------------------------------------------------------------
+//
+void CMainMenuContainer::HandleSelectedListItemL( TInt aIndex )
+ {
+ TInt selection = aIndex;
+
+ // Change active view.
+ switch ( selection )
+ {
+ case 0:
+ ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(EAppUIGoToTestCaseMenu);
+ break;
+ case 1:
+ ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(EAppUIGoToModulesMenu);
+ break;
+ case 2:
+ ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(EAppUIGoToTestSetsMenu);
+ break;
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------
+// CMainMenuContainer::OfferKeyEventL
+//
+// Handles key events.
+// ---------------------------------------------------------
+//
+TKeyResponse CMainMenuContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType)
+{
+ if (aType != EEventKey)
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ // Offers key events to list box
+ if (iListBox)
+ {
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ else
+ {
+ return EKeyWasNotConsumed;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// CMainMenuContainer:::GetActiveLine
+//
+// Get currently selected items index.
+// ----------------------------------------------------------------------------
+//
+TInt CMainMenuContainer::GetActiveLine()
+ {
+ return iListBox->CurrentItemIndex();
+ }
+
+// ----------------------------------------------------------------------------
+// CMainMenuContainer:::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CMainMenuContainer::SaveActiveLine()
+ {
+ ((CMenuListBox*)iListBox)->SaveFocusPosition();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/MainMenuView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CMainMenuView class definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknViewAppUi.h>
+#include <barsread.h> //TResourceReader
+#include <Stifui.rsg>
+#include "MainMenuView.h"
+#include "MainMenuContainer.h"
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CMainMenuView::ConstructL
+//
+// Symbian OS two-phased constructor
+// ---------------------------------------------------------
+//
+void CMainMenuView::ConstructL()
+ {
+ BaseConstructL( R_APPUI_MAINMENUVIEW );
+ }
+
+// ---------------------------------------------------------
+// CMainMenuView::~CMainMenuView
+//
+// Destructor
+// ---------------------------------------------------------
+//
+CMainMenuView::~CMainMenuView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ---------------------------------------------------------
+// TUid CMainMenuView::Id
+//
+// Returns view´s id.
+// ---------------------------------------------------------
+//
+TUid CMainMenuView::Id() const
+ {
+ return TUid::Uid(EMainMenuViewId); //KMainMenuViewId;
+ }
+
+// ---------------------------------------------------------
+// CMainMenuView::HandleCommandL
+//
+// Handles a command.
+// ---------------------------------------------------------
+//
+void CMainMenuView::HandleCommandL(TInt aCommand)
+ {
+ switch ( aCommand )
+ {
+ case EAknSoftkeyBack:
+ {
+ AppUi()->HandleCommandL(EEikCmdExit);
+ break;
+ }
+ case EAknCmdOpen:
+ {
+ TInt a = iContainer->GetActiveLine();
+ iContainer->HandleSelectedListItemL( a );
+ }
+ break;
+ default:
+ {
+ AppUi()->HandleCommandL( aCommand );
+ break;
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+// CMainMenuView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ---------------------------------------------------------
+//
+void CMainMenuView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+ }
+
+// ---------------------------------------------------------
+// CMainMenuView::DoActivateL
+//
+// Initializes view when activated.
+// ---------------------------------------------------------
+//
+void CMainMenuView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ iContainer = new (ELeave) CMainMenuContainer;
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect() );
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_MAIN);
+ iNaviDecorator = np->CreateNavigationLabelL( reader );
+ CleanupStack::PopAndDestroy(); // resource reader
+
+ np->PushL(*iNaviDecorator);
+ }
+
+// ---------------------------------------------------------
+// CAppUIView::DoDeactivate
+//
+// Deactivates view.
+// ---------------------------------------------------------
+//
+void CMainMenuView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ iContainer->SaveActiveLine();
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/MenuListBox.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CMenuListBox class definition.
+*
+*/
+
+// INCLUDE FILES
+#include "MenuListBox.h"
+#include <aknview.h>
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CMainMenuView::CMenuListBox
+//
+// c++ constructor
+// ---------------------------------------------------------
+//
+CMenuListBox::CMenuListBox(TAppUIViewNumber aViewId)
+ : CAknSingleStyleListBox(), iViewId(aViewId)
+ {
+ }
+
+// ---------------------------------------------------------
+// CMenuListBox::ConstructL
+//
+// Symbian OS two-phased constructor
+// ---------------------------------------------------------
+//
+void CMenuListBox::ConstructL()
+ {
+
+ }
+
+// ---------------------------------------------------------
+// CMenuListBox::~CMenuListBox
+//
+// Destructor
+// ---------------------------------------------------------
+//
+CMenuListBox::~CMenuListBox()
+ {
+
+ }
+
+// ---------------------------------------------------------
+// CMenuListBox::NewL
+//
+// Symbian OS public constructor
+// @param aViewId - id of view to identify position in array where focus position will be saved to
+// or retrieved from
+//
+// @return - pointer to an instance of CMenuListBOx
+// ---------------------------------------------------------
+//
+CMenuListBox* CMenuListBox::NewL(TAppUIViewNumber aViewId)
+ {
+ CMenuListBox* self = new(ELeave) CMenuListBox(aViewId);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CMenuListBox::SaveFocusPosition
+//
+// Saves current focus position to CAppUiAppUi object
+// ---------------------------------------------------------
+//
+void CMenuListBox::SaveFocusPosition()
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->SaveFocusPosition(iViewId, this->CurrentItemIndex());
+ }
+
+// ---------------------------------------------------------
+// CMenuListBox::SetPreviousFocus
+//
+// Retrieves previous focus position from CAppUiAppUi object and sets focus
+// to that position
+// ---------------------------------------------------------
+//
+void CMenuListBox::SetPreviousFocus()
+ {
+ TInt previousPosition = ((CAppUIAppUi*)iCoeEnv->AppUi())->GetFocusPosition(iViewId);
+ if(previousPosition != KErrNotFound)
+ {
+ if(previousPosition < this->Model()->NumberOfItems() && previousPosition != 0)
+ {
+ this->SetCurrentItemIndex(previousPosition);
+ }
+ if(previousPosition >= this->Model()->NumberOfItems())
+ {
+ this->SetCurrentItemIndex(0); // setting current item to first element if pervious position is grater then current.
+ }
+ this->SetTopItemIndex(0);
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/ShowStartedCasesContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,646 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStartedTestsListBoxModel class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+
+#include <aknlists.h> // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <badesca.h> // CDesCArray
+#include <eikclbd.h> // CColumnListBoxData
+#include <aknnotewrappers.h>
+
+#include <Stifui.rsg>
+
+//#include "UIStoreIf.h"
+//#include "UIStore.h"
+//#include "UIEngine.h"
+//#include "UIEngineContainer.h"
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "ShowStartedCasesContainer.h"
+
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CStartedTestsListBoxModel::NewL
+//
+// Symbian OS two phased constructor
+// ---------------------------------------------------------
+//
+CStartedTestsListBoxModel* CStartedTestsListBoxModel::NewL
+ ( RRefArray<CStartedTestCase>* aTestCasesInView )
+ {
+ CStartedTestsListBoxModel* self = new ( ELeave ) CStartedTestsListBoxModel();
+ CleanupStack::PushL( self );
+ self->iBuffer = HBufC::NewL( 130 );
+ self->iTestCasesInView = aTestCasesInView;
+ CleanupStack::Pop();
+ return self;
+
+ }
+
+// ---------------------------------------------------------
+// CStartedTestsListBoxModel::ConstructL
+//
+// Symbian OS two phased constructor
+// Completes the construction of the object.
+// ---------------------------------------------------------
+//
+
+void CStartedTestsListBoxModel::ConstructL()
+ {
+ }
+
+// ---------------------------------------------------------
+// CStartedTestsListBoxModel::~CStartedTestsListBoxModel
+//
+// Destructor
+// ---------------------------------------------------------
+//
+
+CStartedTestsListBoxModel::~CStartedTestsListBoxModel()
+ {
+ }
+
+// ---------------------------------------------------------
+// CStartedTestsListBoxModel::MdcaCount
+//
+// Returns the number of descriptor elements in the array.
+// ---------------------------------------------------------
+//
+
+TInt CStartedTestsListBoxModel::MdcaCount() const
+ {
+ return iTestCasesInView->Count();
+
+ }
+
+// ---------------------------------------------------------
+// CStartedTestsListBoxModel::MdcaPoint
+//
+// Indexes into a descriptor array.
+// ---------------------------------------------------------
+//
+TPtrC CStartedTestsListBoxModel::MdcaPoint(TInt aIndex) const
+ {
+ TPtr buffer( iBuffer->Des() );
+ buffer.Zero();
+ switch ( (*iTestCasesInView)[aIndex].Status() )
+ {
+ case CUIStoreIf::EStatusRunning:
+ {
+ if( (*iTestCasesInView)[aIndex].UIEngineContainer().State() ==
+ CUIEngineContainer::ERunning )
+ {
+ buffer.Append(_L("Running\t"));
+ }
+ else
+ {
+ buffer.Append(_L("Paused\t"));
+ }
+ break;
+ }
+ case CUIStoreIf::EStatusPassed:
+ {
+ buffer.Append(_L("Passed\t"));
+ break;
+ }
+ case CUIStoreIf::EStatusFailed:
+ {
+ buffer.Append(_L("Failed\t"));
+ break;
+ }
+ /*case ECrashed:
+ buffer.Append(_L("Crashed\t"));
+ break;*/
+ case CUIStoreIf::EStatusAborted:
+ {
+ buffer.Append(_L("Aborted\t"));
+ break;
+ }
+ default:
+ {
+ if((*iTestCasesInView)[aIndex].Status() & CUIStoreIf::EStatusPassed)
+ {
+ buffer.Append(_L("Passed\t"));
+ }
+ else if((*iTestCasesInView)[aIndex].Status() & CUIStoreIf::EStatusFailed)
+ {
+ buffer.Append(_L("Failed\t"));
+ }
+ else if((*iTestCasesInView)[aIndex].Status() & CUIStoreIf::EStatusAborted)
+ {
+ buffer.Append(_L("Aborted\t"));
+ }
+ else if((*iTestCasesInView)[aIndex].Status() & CUIStoreIf::EStatusCrashed)
+ {
+ buffer.Append(_L("Crashed\t"));
+ }
+ else
+ {
+ buffer.Append(_L("\t"));
+ }
+ break;
+ }
+ }
+
+ buffer.Append((*iTestCasesInView)[aIndex].TestInfo().TestCaseTitle() );
+
+ return *iBuffer;
+
+ }
+
+
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::ConstructL
+//
+// Symbian OS two phased constructor
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+ {
+ CreateWindowL();
+
+ iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+ const TInt KSelectedMode = ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+
+ if(KSelectedMode == EShowOngoingCases || KSelectedMode == EShowPausedCases
+ || KSelectedMode == EShowCrashedAbortedCases || KSelectedMode == EShowAllStartedCases)
+ {
+ iListBox = new (ELeave) CAknSingleHeadingStyleListBox();
+ }
+ else
+ {
+ iListBox = CMenuListBox::NewL(EShowStartedCasesViewId); //CAknSingleStyleListBox();
+ }
+ iListBox->SetContainerWindowL( *this );
+ iListBox->SetListBoxObserver( aListBoxObserver );
+ iListBox->ConstructL(this, EAknListBoxSelectionList);
+
+ //Create Scroller control for ListBox and set its visibility
+ iListBox->CreateScrollBarFrameL(ETrue);
+ iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+ iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+
+ if ( iUIStore )
+ {
+ ConstructListBoxModelL();
+ iListBoxModel = CStartedTestsListBoxModel::NewL( &iStartedTestsPtrs );
+ iListBox->Model()->SetItemTextArray(iListBoxModel);
+ }
+ else
+ {
+ //User::Leave( syy?? )
+ }
+ iListBox->ActivateL();
+ if(KSelectedMode != EShowOngoingCases && KSelectedMode != EShowPausedCases
+ && KSelectedMode != EShowCrashedAbortedCases && KSelectedMode != EShowAllStartedCases)
+ {
+ ((CMenuListBox*)iListBox)->SetPreviousFocus();
+ }
+
+ SetRect(aRect);
+ ActivateL();
+
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::ConstructListBoxModelL
+//
+// Constructs list box model without any filtering.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::ConstructListBoxModelL()
+ {
+ TInt ret( 0 );
+ RRefArray<CStartedTestCase> startedTestCases;
+ ret = iUIStore->StartedTestCases( startedTestCases );
+ if( KErrNone != ret )
+ {
+ startedTestCases.Reset();
+ startedTestCases.Close();
+ User::Leave( ret );
+ }
+ CleanupClosePushL( startedTestCases ); // Closes the handle
+
+ const TInt KStartedCaseCount = startedTestCases.Count();
+
+ iStartedTestsPtrs.Reset(); // Remove all pointers (does not delete objects)
+
+ const TInt KSelectedMode = ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+
+ // Loop through all started cases
+ for( TInt i=0; i < KStartedCaseCount; i++ )
+ {
+ switch ( KSelectedMode )
+ {
+ case EShowAllStartedCases:
+ {
+ iStartedTestsPtrs.Append( startedTestCases[i] );
+ break;
+ }
+ case EShowOngoingCases:
+ {
+ // Note: PAUSE IS ALSO RUNNIN STATUS
+ if ( startedTestCases[i].Status() & CUIStoreIf::EStatusRunning )
+ {
+ iStartedTestsPtrs.Append(startedTestCases[i]);
+ }
+ break;
+ }
+ case EShowPassedCases:
+ {
+ if ( startedTestCases[i].Status() & CUIStoreIf::EStatusPassed )
+ {
+ iStartedTestsPtrs.Append( startedTestCases[i] );
+ }
+ break;
+ }
+ case EShowPausedCases:
+ {
+ if ( startedTestCases[i].Status() & CUIStoreIf::EStatusRunning )
+ {
+ if( startedTestCases[i].UIEngineContainer().State() == CUIEngineContainer::EPaused )
+ {
+ iStartedTestsPtrs.Append( startedTestCases[i] );
+ }
+ }
+ break;
+ }
+ case EShowFailedCases:
+ {
+ if ( startedTestCases[i].Status() & CUIStoreIf::EStatusFailed )
+ {
+ iStartedTestsPtrs.Append( startedTestCases[i] );
+ }
+ break;
+ }
+ case EShowCrashedAbortedCases:
+ {
+ if ( startedTestCases[i].Status() & CUIStoreIf::EStatusAborted
+ || startedTestCases[i].Status() & CUIStoreIf::EStatusCrashed)
+ {
+ iStartedTestsPtrs.Append( startedTestCases[i] );
+ }
+ break;
+ }
+ }
+ }
+ startedTestCases.Reset();
+ startedTestCases.Close();
+
+ CleanupStack::PopAndDestroy(); // startedTestCases
+
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::~CShowStartedCasesContainer
+//
+// Destructor
+// ---------------------------------------------------------
+//
+CShowStartedCasesContainer::~CShowStartedCasesContainer()
+ {
+ iStartedTestsPtrs.Close(); // does not delete objects whose pointers are contained in the array
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::SizeChanged
+//
+// Called by framework when the view size is changed
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ---------------------------------------------------------
+//
+TInt CShowStartedCasesContainer::CountComponentControls() const
+ {
+ return 1; // return nbr of controls inside this container
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ---------------------------------------------------------
+//
+CCoeControl* CShowStartedCasesContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::Draw
+//
+// Draw a control, called by window server.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::Draw(const TRect& /*aRect*/) const
+ {
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::OfferKeyEventL
+//
+// Handles key events.
+// ---------------------------------------------------------
+//
+TKeyResponse CShowStartedCasesContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType)
+ {
+ if (aType != EEventKey)
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ if (iListBox)
+ {
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ else
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::SelectedTestCase
+//
+// Returns reference to currently selected test case in view (listbox).
+// ---------------------------------------------------------
+//
+CStartedTestCase* CShowStartedCasesContainer::SelectedTestCase()
+ {
+ if ( iStartedTestsPtrs.Count() > 0 )
+ {
+ return &(iStartedTestsPtrs[ iListBox->CurrentItemIndex() ]);
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::DrawListBox
+//
+// Refresh ListBox, if aSelectedTestCase is still found from ListBox
+// it is set as selected test case.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::DrawListBox()
+ {
+ if ( iListBox )
+ {
+ iListBox->DrawNow();
+ }
+
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::HandleItemAdditionL
+//
+// Refresh ListBox after new item was added to listbox model.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::HandleItemAdditionL()
+ {
+ iListBox->HandleItemAdditionL();
+
+ }
+
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::HandleItemRemovalL
+//
+// Refresh ListBox after item is removed from listbox model.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::HandleItemRemovalL()
+ {
+ iListBox->HandleItemRemovalL();
+
+ // HandleItemRemovalL "loses selection" if current item is removed
+ // -> we have to check it and set one item as current item to make it possible for
+ // user to select one item from items left after remove
+ if ( iListBox->CurrentItemIndex() == -1 ) // No item selected
+ if ( ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount() > 0 ) // there are items
+ SetCurrentItemIndex(0);
+
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::TestsInViewCount
+//
+// Returns count of test cases in view.
+// ---------------------------------------------------------
+//
+TInt CShowStartedCasesContainer::TestsInViewCount()
+ {
+ return ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount();
+
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::CurrentTestCase
+//
+// Returns pointer to currently selected test case.
+// ---------------------------------------------------------
+//
+CStartedTestCase* CShowStartedCasesContainer::CurrentTestCase()
+ {
+ return &iStartedTestsPtrs[ iListBox->CurrentItemIndex() ];
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::SetCurrentItemIndex
+//
+// Sets the current item.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::SetCurrentItemIndex(TInt aIndex)
+ {
+ TInt itemCount = ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount();
+ if ( aIndex < itemCount )
+ {
+ iListBox->SetCurrentItemIndex(aIndex);
+ }
+ else
+ {
+ iListBox->SetCurrentItemIndex(itemCount);
+ }
+
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::ResetListBox
+//
+// Resets the selection indices, top and current item indices,
+// the selection, and the horizontal scroll offset of this list box.
+// This function does not redraw the list box.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::ResetListBox()
+ {
+ iListBox->Reset();
+
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::RemoveSelectedExecutionsL
+//
+// Removes items from list box.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::RemoveSelectedExecutionsL()
+ {
+ TInt indexOfRemovedExecution = 0;
+ iStartedTestsPtrs.Remove(indexOfRemovedExecution);
+ HandleItemRemovalL();
+
+ }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::RemoveAllExecutionsInViewL
+//
+// Removes all started test cases from list box.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::RemoveAllExecutionsInViewL()
+ {
+ iStartedTestsPtrs.Reset(); // Empties the array, does not delete the objects whose pointers are contained in the array
+ HandleItemRemovalL();
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::FilterCasesByModuleL
+//
+// Show only testcases which are defined is specified module.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesContainer::FilterCasesByModuleL(TName aModuleName)
+ {
+ //First the list box model have to be reconstructed to make sure that all
+ //possible earlier filtering does not affect
+ ConstructListBoxModelL();
+
+ TInt i;
+ const TInt KCurrentShowedCaseCount = iStartedTestsPtrs.Count();
+
+ for ( i = KCurrentShowedCaseCount-1; i >= 0; i-- )
+ {
+ RRefArray<CStartedTestCase> startedTestCases;
+ TInt ret = iUIStore->StartedTestCases( startedTestCases );
+ if( ret != KErrNone )
+ {
+ startedTestCases.Reset();
+ startedTestCases.Close();
+ }
+ if ( startedTestCases[i].TestInfo().ModuleName() != aModuleName )
+ {
+ iStartedTestsPtrs.Remove(i); // delete pointer to CStartedTestCase
+ }
+ startedTestCases.Reset();
+ startedTestCases.Close();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::FilterCasesByTCFileNameL
+//
+// Show only testcases which are defined is specified test case file.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesContainer::FilterCasesByTCFileNameL(TFileName aTestCaseFileName)
+ {
+
+ //First the list box model have to be reconstructed to make sure that all
+ //possible earlier filtering does not affect
+ ConstructListBoxModelL();
+
+ const TInt KCurrentShowedCaseCount = iStartedTestsPtrs.Count();
+
+ for ( TInt i = KCurrentShowedCaseCount-1; i >= 0; i-- )
+ {
+ RRefArray<CStartedTestCase> startedTestCases;
+ TInt ret = iUIStore->StartedTestCases( startedTestCases );
+ if( ret != KErrNone )
+ {
+ startedTestCases.Reset();
+ startedTestCases.Close();
+ }
+ if ( startedTestCases[i].TestInfo().TestCaseFile() != aTestCaseFileName )
+ {
+ iStartedTestsPtrs.Remove(i); // delete pointer to CStartedTestCase
+ }
+ startedTestCases.Reset();
+ startedTestCases.Close();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CContainer::NoFilteringL
+//
+// Remove possible filtering of test cases -> show all test cases.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesContainer::NoFilteringL()
+ {
+ ConstructListBoxModelL();
+ }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesContainer:::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesContainer::SaveActiveLine()
+ {
+ ((CMenuListBox*)iListBox)->SaveFocusPosition();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/ShowStartedCasesView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,668 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CShowStartedCasesView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <eikmenub.h>
+#include <aknViewAppUi.h>
+#include <barsread.h> //TResourceReader
+#include <Stifui.rsg>
+
+//#include "UIEngineContainer.h"
+#include <stifinternal/UIEngineContainer.h>
+
+#include "Stifui.hrh"
+#include "ShowStartedCasesView.h"
+#include "ShowStartedCasesContainer.h"
+#include "AppUIAppUi.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::ConstructL
+//
+// Symbian OS two-phased constructor
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::ConstructL()
+ {
+ CView::ConstructL();
+ BaseConstructL( R_APPUI_SHOWSTARTEDCASESVIEW );
+ iFilterModule.Zero();
+ iFilterTestCaseFile.Zero();
+ iSelectedTestCase=0;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::~CShowStartedCasesView()
+//
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CShowStartedCasesView::~CShowStartedCasesView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// TUid CShowStartedCasesView::Id()
+//
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CShowStartedCasesView::Id() const
+ {
+ return TUid::Uid(EShowStartedCasesViewId);
+ }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::HandleCommandL(TInt aCommand)
+//
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::HandleCommandL(TInt aCommand)
+ {
+ if ( aCommand >= ECmdFilterByModule && aCommand < ECmdFilterByTestCaseFile )
+ {
+ TInt moduleNumber = aCommand - ECmdFilterByModule;
+ RRefArray<TDesC> testModules;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( testModules );
+ if( KErrNone != ret )
+ {
+ testModules.Reset();
+ testModules.Close();
+ User::Leave( ret );
+ }
+ iFilterModule = testModules[moduleNumber];
+
+ iFilterTestCaseFile.Zero();
+
+ iContainer->FilterCasesByModuleL(iFilterModule);
+ //iContainer->ResetListBox();
+ //iContainer->DrawListBox();
+
+ testModules.Reset();
+ testModules.Close();
+
+ return;
+ }
+
+ else if ( aCommand >= ECmdFilterByTestCaseFile && aCommand < ECmdNOFiltering )
+ {
+ TInt testCaseFileNumber = aCommand - ECmdFilterByTestCaseFile;
+ RRefArray<TDesC> testCaseFiles;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( testCaseFiles );
+ if( KErrNone != ret )
+ {
+ testCaseFiles.Reset();
+ testCaseFiles.Close();
+ User::Leave( ret );
+ }
+
+ iFilterTestCaseFile = testCaseFiles[ testCaseFileNumber ];
+ iFilterModule.Zero();
+ //iContainer->FilterCasesByTCFileNameL(testCaseFileName);
+ iContainer->FilterCasesByTCFileNameL(iFilterTestCaseFile);
+ iContainer->ResetListBox();
+ iContainer->DrawListBox();
+
+ testCaseFiles.Reset();
+ testCaseFiles.Close();
+
+ return;
+ }
+
+ else if ( aCommand == ECmdNOFiltering )
+ {
+ iFilterModule.Zero();
+ iFilterTestCaseFile.Zero();
+ iContainer->NoFilteringL();
+ iContainer->ResetListBox();
+ iContainer->DrawListBox();
+ return;
+ }
+
+ // Handle rest possible commands
+ switch ( aCommand )
+ {
+ case ECmdViewOutput:
+ {
+ ViewTestCaseOutputL();
+ break;
+ }
+ case ECmdRemoveExecution:
+ {
+ iContainer->RemoveSelectedExecutionsL();
+ break;
+ }
+ case ECmdRemoveAllExecutions:
+ {
+ iContainer->RemoveAllExecutionsInViewL();
+ break;
+ }
+ case ECmdPauseTestCase:
+ {
+ TInt index = iContainer->CurrentItemIndex();
+ RRefArray<CStartedTestCase> runningTestCases;
+ TShowStartedCasesMode currentMode = (TShowStartedCasesMode)((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+ TInt ret = KErrNone;
+ if(currentMode == EShowAllStartedCases)
+ ret = iUIStore->StartedTestCases(runningTestCases, CUIStoreIf::EStatusAll);
+ else if(currentMode == EShowOngoingCases)
+ ret = iUIStore->StartedTestCases(runningTestCases, CUIStoreIf::EStatusRunning);
+ if( KErrNone != ret )
+ {
+ User::Leave( ret );
+ }
+ runningTestCases[index].UIEngineContainer().PauseTest();
+ runningTestCases.Close();
+ break;
+ }
+ case ECmdResumeTestCase:
+ {
+ TInt index = iContainer->CurrentItemIndex();
+ RRefArray<CStartedTestCase> runningTestCases;
+ TShowStartedCasesMode currentMode = (TShowStartedCasesMode)((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+ TInt ret = KErrNone;
+ if(currentMode == EShowAllStartedCases)
+ ret = iUIStore->StartedTestCases(runningTestCases, CUIStoreIf::EStatusAll);
+ else if(currentMode == EShowOngoingCases || currentMode == EShowPausedCases)
+ ret = iUIStore->StartedTestCases(runningTestCases, CUIStoreIf::EStatusRunning);
+ if( KErrNone != ret )
+ {
+ User::Leave( ret );
+ }
+ TInt testCaseToControl = 0;
+ if(currentMode == EShowAllStartedCases || currentMode == EShowOngoingCases)
+ {
+ testCaseToControl = index;
+ }
+ else if(currentMode == EShowPausedCases)
+ {
+ TInt pausedTestCasesCounter = 0;
+ for(int i = 0; i < runningTestCases.Count(); i++)
+ {
+ if(runningTestCases[i].UIEngineContainer().State() == CUIEngineContainer::EPaused)
+ {
+ if(pausedTestCasesCounter == index)
+ {
+ testCaseToControl = i;
+ break;
+ }
+ pausedTestCasesCounter++;
+ }
+ }
+ }
+
+ runningTestCases[testCaseToControl].UIEngineContainer().ResumeTest();
+ runningTestCases.Close();
+ break;
+ }
+ case ECmdAbortTestCase:
+ {
+ TInt index = iContainer->CurrentItemIndex();
+ RRefArray<CStartedTestCase> runningTestCases;
+ TShowStartedCasesMode currentMode = (TShowStartedCasesMode)((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+ TInt ret = KErrNone;
+ if(currentMode == EShowAllStartedCases)
+ ret = iUIStore->StartedTestCases(runningTestCases, CUIStoreIf::EStatusAll);
+ else if(currentMode == EShowOngoingCases || currentMode == EShowPausedCases)
+ ret = iUIStore->StartedTestCases(runningTestCases, CUIStoreIf::EStatusRunning);
+
+ if( KErrNone != ret )
+ {
+ User::Leave( ret );
+ }
+ TInt testCaseToControl = 0;
+
+ if(currentMode == EShowAllStartedCases || currentMode == EShowOngoingCases)
+ {
+ testCaseToControl = index;
+ }
+ else if(currentMode == EShowPausedCases)
+ {
+ TInt pausedTestCasesCounter = 0;
+ for(int i = 0; i < runningTestCases.Count(); i++)
+ {
+ if(runningTestCases[i].UIEngineContainer().State() == CUIEngineContainer::EPaused)
+ {
+ if(pausedTestCasesCounter == index)
+ {
+ testCaseToControl = i;
+ break;
+ }
+ pausedTestCasesCounter++;
+ }
+ }
+ }
+
+ runningTestCases[testCaseToControl].UIEngineContainer().CancelTest();
+ runningTestCases.Close();
+ break;
+ }
+ case EAknSoftkeyOk:
+ {
+ iEikonEnv->InfoMsg( _L("TestCase Menu ok") );
+ break;
+ }
+ case EAknSoftkeyBack:
+ {
+ // Remove possible filterings so that they does not affect when coming again to this view
+ iFilterModule.Zero();
+ iFilterTestCaseFile.Zero();
+ iSelectedTestCase=0; //Reset selected test case information
+ AppUi()->HandleCommandL(EAppUIGoBack);
+ break;
+ }
+ default:
+ {
+ AppUi()->HandleCommandL( aCommand );
+ break;
+ }
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::HandleListBoxEventL
+//
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+ {
+ if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+ {
+ ViewTestCaseOutputL();
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::ViewTestCaseOutputL
+//
+// Shows outputs of test case which is selected in Container.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::ViewTestCaseOutputL()
+ {
+ iSelectedTestCase = iContainer->CurrentItemIndex();
+
+ // Sets index of selected test case to AppUi
+ //( ( CAppUIAppUi* )AppUi() )->SetTestCaseIndex( iSelectedTestCase );
+ ( ( CAppUIAppUi* )AppUi() )->SetStartedTestCase( iContainer->CurrentTestCase() );
+
+ AppUi()->HandleCommandL(ECmdViewOutput);
+ }
+
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::HandleClientRectChange()
+//
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::DoActivateL
+//
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ iContainer = new (ELeave) CShowStartedCasesContainer;
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect(), this );
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+
+ // Check if filtering by module or by test case file is selected
+ if ( iFilterModule.Length() )
+ {
+ iContainer->FilterCasesByModuleL(iFilterModule);
+ }
+ else if ( iFilterTestCaseFile.Length() )
+ {
+ iContainer->FilterCasesByTCFileNameL(iFilterTestCaseFile);
+ }
+ if ( iSelectedTestCase )
+ iContainer->SetCurrentItemIndex(iSelectedTestCase);
+
+ RefreshNaviTitleL();
+
+ iContainer->DrawListBox();
+ }
+
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::RefreshNaviTitle
+//
+// Refreshes view name shown in the navi pane.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::RefreshNaviTitleL()
+ {
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+ TResourceReader reader;
+
+ switch ( ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode )
+ {
+ case EShowAllStartedCases:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_ALL);
+ break;
+ case EShowOngoingCases:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_ONGOING);
+ break;
+ case EShowPausedCases:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_PAUSED);
+ break;
+ case EShowPassedCases:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_PASSED);
+ break;
+ case EShowFailedCases:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_FAILED);
+ break;
+ case EShowCrashedAbortedCases:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_CRASHED_ABORTED);
+ break;
+ default:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTSET);
+ break;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ iNaviDecorator = np->CreateNavigationLabelL( reader );
+ CleanupStack::PopAndDestroy(); // resource reader
+ np->PushL(*iNaviDecorator);
+ }
+
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::DoDeactivate
+//
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ TInt mode = ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+ if(mode != EShowOngoingCases && mode != EShowPausedCases
+ && mode != EShowCrashedAbortedCases && mode != EShowAllStartedCases)
+ {
+ iContainer->SaveActiveLine();
+ }
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+
+ }
+
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::DynInitMenuPaneL
+//
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::DynInitMenuPaneL(
+ TInt aResourceId, CEikMenuPane* aMenuPane)
+ {
+ // options menu
+ if ( R_APPUI_SHOWSTARTEDCASESVIEW_MENU == aResourceId )
+ {
+ CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+ if ( NULL != startedTestCase )
+ {
+ aMenuPane->SetItemDimmed( ECmdFilterMenu, EFalse );
+ switch ( startedTestCase->Status() )
+ {
+ // test case running
+ case CUIStoreIf::EStatusRunning:
+ {
+ switch ( startedTestCase->UIEngineContainer().State() )
+ {
+ case CUIEngineContainer::ERunning:
+ case CUIEngineContainer::EPaused:
+ {
+ aMenuPane->SetItemDimmed( ECmdShowSetMenu, EFalse );
+ break;
+ }
+ //case CUIEngineContainer::ENotStarted:
+ //case CUIEngineContainer::EExecuted:
+ //case CUIEngineContainer::EFinished:
+ default:
+ {
+ aMenuPane->SetItemDimmed( ECmdShowSetMenu, ETrue );
+ }
+ }
+ break;
+ }
+
+ // test case not running
+ //case CUIStoreIf::EStatusPassed:
+ //case CUIStoreIf::EStatusFailed:
+ //case CUIStoreIf::EStatusAborted:
+ //case CUIStoreIf::EStatusExecuted
+ default:
+ {
+ aMenuPane->SetItemDimmed( ECmdShowSetMenu, ETrue );
+ }
+ }
+ }
+ else
+ {
+ //aMenuPane->SetItemDimmed( ECmdFilterMenu, ETrue );
+ aMenuPane->SetItemDimmed( ECmdViewOutput, ETrue );
+ aMenuPane->SetItemDimmed( ECmdShowSetMenu, ETrue );
+ }
+ }
+
+ // test case control menu
+ if ( R_TESTCASE_CONTROL_SUBMENU == aResourceId )
+ {
+ CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+
+ if ( NULL != startedTestCase )
+ {
+ if ( startedTestCase->Status() == CUIStoreIf::EStatusRunning )
+ {
+ switch ( startedTestCase->UIEngineContainer().State() )
+ {
+ case CUIEngineContainer::ERunning:
+ {
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, EFalse );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, EFalse );
+ break;
+ }
+ case CUIEngineContainer::EPaused:
+ {
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, EFalse );
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, EFalse );
+ break;
+ }
+ //case CUIEngineContainer::ENotStarted:
+ //case CUIEngineContainer::EExecuted:
+ //case CUIEngineContainer::EFinished:
+ default:
+ {
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+ break;
+ }
+ }
+ }
+ else
+ {
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+ }
+ }
+ else
+ {
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+ }
+ }
+
+ // Test modules are added to filter by test module submenu if the submenu is opened
+ if (R_APPUI_FILTERBYMODULES_MENU == aResourceId)
+ {
+ RRefArray<TDesC> testModules;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( testModules );
+ if( KErrNone != ret )
+ {
+ testModules.Reset();
+ testModules.Close();
+ User::Leave( ret );
+ }
+ TInt moduleCount = testModules.Count();
+
+ TInt i;
+ CEikMenuPaneItem::SData item;
+
+ item.iCommandId = ECmdFilterByModule;
+ item.iFlags = 0;
+ item.iCascadeId = 0;
+
+ for (i = 0; i < moduleCount; i++)
+ {
+ item.iText = testModules[i];
+ aMenuPane->AddMenuItemL(item);
+ item.iCommandId++; // command IDs 0x1000 - 0x1FFF are reserved for modules in hrh file
+ }
+
+ testModules.Reset();
+ testModules.Close();
+
+ }
+
+ // Test case files are added to filter by test case file submenu if the submenu is opened
+ if (R_APPUI_FILTER_BY_TESTCASEFILE_MENU == aResourceId)
+ {
+ RRefArray<TDesC> testCaseFiles;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( testCaseFiles );
+ if( KErrNone != ret )
+ {
+ testCaseFiles.Reset();
+ testCaseFiles.Close();
+ User::Leave( ret );
+ }
+ TInt testCaseFileCount = testCaseFiles.Count();
+
+ TInt i;
+ CEikMenuPaneItem::SData item;
+
+ item.iCommandId = ECmdFilterByTestCaseFile;
+ item.iFlags = 0;
+ item.iCascadeId = 0;
+
+ for (i = 0; i < testCaseFileCount; i++)
+ {
+ item.iText = testCaseFiles[i];
+ // If there´s no test case file, don´t add item to menu.
+ if ( testCaseFiles[i].Length() > 0 )
+ {
+ aMenuPane->AddMenuItemL(item);
+ }
+ item.iCommandId++; // command IDs 0x2000 - 0x2FFF are reserved for test case files in hrh file
+ }
+
+ testCaseFiles.Reset();
+ testCaseFiles.Close();
+
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::TestCaseStateChangedL
+//
+// Handles status changes of test cases in view.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::TestCaseStateChangedL()
+ {
+ if ( iContainer )
+ {
+
+ //CStartedTestCase* currentlySelectedTest = iContainer->SelectedTestCase();
+
+ TInt numOfTestsInViewBeforeStateChange = iContainer->TestsInViewCount();
+
+ //((CStartedTestsListBoxModel*)iContainer->iListBox->Model())->MdcaCount();
+
+ iContainer->ConstructListBoxModelL();
+
+ // Check if filtering by module or by test case file is selected
+ if ( iFilterModule.Length() )
+ {
+ iContainer->FilterCasesByModuleL(iFilterModule);
+ }
+ else if ( iFilterTestCaseFile.Length() )
+ {
+ iContainer->FilterCasesByTCFileNameL(iFilterTestCaseFile);
+ }
+
+ TInt numOfTestsInViewAfterStateChange = iContainer->TestsInViewCount();
+ //((CStartedTestsListBoxModel*)iContainer->iListBox->Model())->MdcaCount();
+
+ if ( numOfTestsInViewAfterStateChange >= numOfTestsInViewBeforeStateChange )
+ iContainer->HandleItemAdditionL();
+ else
+ iContainer->HandleItemRemovalL();
+
+ if(iContainer->CurrentItemIndex() < 0)
+ {
+ iContainer->SetCurrentItemIndex(0);
+ }
+ iContainer->DrawListBox();
+
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/StartCasesContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStartCasesContainer class
+* definition
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h> // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <aknnotewrappers.h>
+
+#include <eikclbd.h> // CColumnListBoxData
+
+#include "StartCasesContainer.h"
+#include "StartCasesView.h"
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include "Container.h"
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::ConstructL
+//
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ConstructL"));
+
+ iParentView = (CStartCasesView*)aListBoxObserver;
+ CreateWindowL();
+
+ iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+ iTestCasesInView.Reset();
+ //((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: iTCInV Reset"));
+
+ iListBox = CMenuListBox::NewL(EStartCaseMenuViewId);
+ iListBox->SetContainerWindowL( *this );
+ iListBox->SetListBoxObserver( aListBoxObserver /*this*/ ); // jos peritty MEikListBoxObserver:sta
+ iListBox->ConstructL(this, EAknListBoxMarkableList /*EAknListBoxSelectionList*/);
+
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ListBox constructed"));
+
+ //Create Scroller control for ListBox and set its visibility
+ iListBox->CreateScrollBarFrameL(ETrue);
+ iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+ iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+
+ if ( iUIStore )
+ {
+ RRefArray<CTestInfo> allCases;
+ TInt ret = iUIStore->TestCases( allCases );
+ if( KErrNone != ret )
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("iUIStore->TestCases() fails"));
+ allCases.Reset();
+ allCases.Close();
+ User::Leave( ret );
+ }
+
+ const TInt KTestCaseCount = allCases.Count();
+ for (TInt i=0; i < KTestCaseCount; i++)
+ {
+ ret = iTestCasesInView.Append( &allCases[i] );
+ if( ret != KErrNone )
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("Test case append fails with: %d"), ret );
+ User::Leave( ret );
+ }
+ }
+
+ iListBoxModel = CTestCaseListBoxModel::NewL(&iTestCasesInView);
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ListBox model"));
+
+ iListBox->Model()->SetItemTextArray(iListBoxModel);
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ListBox model set"));
+
+ allCases.Reset();
+ allCases.Close();
+ }
+ else
+ {
+ User::Leave( KErrGeneral );
+ }
+
+ // Creates graphic.
+ SetGraphicIconL( iListBox );
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: icons created"));
+
+ iListBox->ActivateL();
+ ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+ SetRect(aRect);
+ ActivateL();
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::~CStartCasesContainer
+//
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CStartCasesContainer::~CStartCasesContainer()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::SizeChanged
+//
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesContainer::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CStartCasesContainer::CountComponentControls() const
+ {
+ return 1; // return nbr of controls inside this container
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CStartCasesContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::Draw
+//
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesContainer::Draw(const TRect& /*aRect*/) const
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::OfferKeyEventL
+//
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CStartCasesContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType )
+ {
+ if (aType != EEventKey)
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ if (iListBox)
+ {
+ //if multiple items selected
+ if ( iListBox->SelectionIndexes()->Count() > 0 )
+ {
+ TUint mask = 0x40488;
+
+ //if event is enter key,
+ //don´t send it to listbox
+ if ( aKeyEvent.iScanCode == 0xa7
+ && ( aKeyEvent.iModifiers & mask ) == 0 )
+ {
+ iParentView->HandleListBoxEventL( iListBox, MEikListBoxObserver::EEventEnterKeyPressed );
+ return EKeyWasConsumed;
+ }
+ }
+
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ else
+ {
+ return EKeyWasNotConsumed;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer:::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CStartCasesContainer::SaveActiveLine()
+ {
+ ((CMenuListBox*)iListBox)->SaveFocusPosition();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/StartCasesView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,457 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStartCasesView class definition.
+*
+*/
+
+// INCLUDE FILES
+#include <eikmenub.h>
+#include <aknViewAppUi.h>
+#include <aknlistquerydialog.h>
+#include <barsread.h> //TResourceReader
+#include <Stifui.rsg>
+#include "StartCasesView.h"
+#include "StartCasesContainer.h"
+#include "AppUIAppUi.h"
+#include "Stifui.hrh"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStartCasesView::ConstructL
+//
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::ConstructL()
+ {
+ CView::ConstructL();
+ BaseConstructL( R_APPUI_STARTCASESVIEW );
+ iCurrentTestCase = 0;
+
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::~CStartCasesView
+//
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CStartCasesView::~CStartCasesView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::Id
+//
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CStartCasesView::Id() const
+ {
+ return TUid::Uid(EStartCaseMenuViewId);
+
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::HandleCommandL
+//
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::HandleCommandL(TInt aCommand)
+ {
+ if ( aCommand >= ECmdFilterByModule && aCommand < ECmdFilterByTestCaseFile ) // 0x1000 - 0x1FFF
+ {
+ TInt moduleNumber = aCommand - ECmdFilterByModule;
+ RRefArray<TDesC> allModules;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( allModules );
+ if( KErrNone != ret )
+ {
+ allModules.Reset();
+ allModules.Close();
+ User::Leave( ret );
+ }
+ TName moduleName = allModules[ moduleNumber ];
+
+ iContainer->FilterCasesByModuleL( moduleName );
+
+ allModules.Reset();
+ allModules.Close();
+ }
+ else if ( aCommand >= ECmdFilterByTestCaseFile && aCommand < ECmdNOFiltering )
+ {
+ TInt testCaseFileNumber = aCommand - ECmdFilterByTestCaseFile;
+ RRefArray<TDesC> allTestCases;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( allTestCases );
+ if( KErrNone != ret )
+ {
+ allTestCases.Reset();
+ allTestCases.Close();
+ User::Leave( ret );
+ }
+ TFileName testCaseFileName = allTestCases[ testCaseFileNumber ];
+
+ iContainer->FilterCasesByTCFileNameL( testCaseFileName );
+
+ allTestCases.Reset();
+ allTestCases.Close();
+ }
+ else if ( aCommand == ECmdNOFiltering )
+ {
+ iContainer->NoFilteringL();
+ }
+ else if ( aCommand == EAknCmdMark || aCommand == EAknCmdUnmark
+ || aCommand == EAknMarkAll || aCommand == EAknUnmarkAll )
+ {
+ iContainer->HandleMarkCommandL( aCommand );
+ }
+ else
+ {
+ switch ( aCommand )
+ {
+ case ECmdStartCases:
+ {
+ CheckListBoxSelectionsL( iContainer->ListBox() );
+ break;
+ }
+ case EAknSoftkeyBack:
+ {
+ iCurrentTestCase = 0;
+ AppUi()->HandleCommandL(EAppUIGoBack);
+ break;
+ }
+ default:
+ {
+ AppUi()->HandleCommandL( aCommand );
+ break;
+ }
+ }
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::DoActivateL
+//
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("StartCasesView: DoActivateL"));
+ iContainer = new (ELeave) CStartCasesContainer;
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect(), this );
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("StartCasesView: container constructed"));
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+
+ iContainer->SetCurrentItemIndex(iCurrentTestCase);
+
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTCASES);
+ iNaviDecorator = np->CreateNavigationLabelL( reader );
+ CleanupStack::PopAndDestroy(); // resource reader
+ np->PushL(*iNaviDecorator);
+
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::DoDeactivate
+//
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ iContainer->SaveActiveLine();
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::DynInitMenuPaneL
+//
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::DynInitMenuPaneL(
+ TInt aResourceId, CEikMenuPane* aMenuPane)
+ {
+
+ // Test modules are added to filter by test module submenu if the submenu is opened
+ if (R_APPUI_FILTERBYMODULES_MENU == aResourceId)
+ {
+ RRefArray<TDesC> modules;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( modules );
+ if( KErrNone != ret )
+ {
+ modules.Reset();
+ modules.Close();
+ User::Leave( ret );
+ }
+
+ TInt moduleCount = modules.Count();
+
+ TInt i;
+ CEikMenuPaneItem::SData item;
+
+ item.iCommandId = ECmdFilterByModule;
+ item.iFlags = 0;
+ item.iCascadeId = 0;
+
+ for (i = 0; i < moduleCount; i++)
+ {
+ //item.iText = modules[i].iModuleName;
+ item.iText.Copy( modules[i].Left( item.iText.MaxLength() ) ) ;
+ aMenuPane->AddMenuItemL(item);
+ item.iCommandId++; // command IDs 0x1000 - 0x1FFF are reserved for modules in hrh file
+ }
+
+ modules.Reset();
+ modules.Close();
+
+ }
+
+ // Test case files are added to filter by test case file submenu if the submenu is opened
+ if (R_APPUI_FILTER_BY_TESTCASEFILE_MENU == aResourceId)
+ {
+ RRefArray<TDesC> testCaseFiles;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( testCaseFiles );
+ if( KErrNone != ret )
+ {
+ testCaseFiles.Reset();
+ testCaseFiles.Close();
+ User::Leave( ret );
+ }
+
+ TInt testCaseFileCount = testCaseFiles.Count();
+
+ TInt i;
+ CEikMenuPaneItem::SData item;
+
+ item.iCommandId = ECmdFilterByTestCaseFile;
+ item.iFlags = 0;
+ item.iCascadeId = 0;
+
+ for (i = 0; i < testCaseFileCount; i++)
+ {
+ item.iText.Copy( testCaseFiles[i].Left( item.iText.MaxLength() ) );
+ // If there´s no test case file, don´t add item to menu.
+ if ( testCaseFiles[i].Length() > 0 )
+ {
+ aMenuPane->AddMenuItemL(item);
+ }
+ item.iCommandId++; // command IDs 0x2000 - 0x2FFF are reserved for test case files in hrh file
+ }
+
+ testCaseFiles.Reset();
+ testCaseFiles.Close();
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::HandleListBoxEventL
+//
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::HandleListBoxEventL( CEikListBox* aListBox,
+ TListBoxEvent aEventType )
+ {
+ if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+ {
+ CheckListBoxSelectionsL( aListBox );
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::CheckListBoxSelectionsL
+//
+// Checks listbox selections and launches query dialog to start test cases.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::CheckListBoxSelectionsL( CEikListBox* aListBox )
+ {
+ TInt i(0);
+ TInt count = aListBox->SelectionIndexes()->Count();
+
+ RArray<TInt> selectedIndices;
+ CleanupClosePushL( selectedIndices );
+
+ if ( count > 0 )
+ {
+ for( i = 0; i < count; i++ )
+ {
+ selectedIndices.InsertInOrder(
+ (*aListBox->SelectionIndexes())[i] );
+ }
+ }
+
+ // Check count of selected items.
+ if ( count == 1 )
+ {
+ iCurrentTestCase = selectedIndices[0];
+ StartTestCaseL();
+ }
+ else if (count > 1)
+ {
+ StartTestCasesL( selectedIndices );
+ }
+ else
+ {
+ iCurrentTestCase = iContainer->CurrentItemIndex();
+ StartTestCaseL();
+ }
+
+ CleanupStack::PopAndDestroy();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::StartTestCaseL
+//
+// Starts test case which is selected in containers list box.
+// First shows a list query if user wants just start test case or
+// if he wants to start test case and view test case output.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::StartTestCaseL()
+ {
+ TInt selectedItem(0);
+ CAknListQueryDialog* startDialog = new (ELeave) CAknListQueryDialog(&selectedItem);
+ if ( startDialog->ExecuteLD(R_START_TESTCASE_LIST_QUERY) )
+ {
+ CTestInfo* testCaseInfo = iContainer->SelectedTestCaseInfo();
+
+ User::LeaveIfNull( testCaseInfo );
+
+ TInt testCaseIndex( 0 );
+
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->StartTestCase( *testCaseInfo, testCaseIndex );
+
+ if( KErrNone != ret )
+ {
+ User::Leave( ret );
+ }
+
+ // Increment the counter value
+ ((CAppUIAppUi*)AppUi())->iUIStoreHandler->iExecutedTestCaseCount++;
+
+ if ( selectedItem == 1 ) // if view output was selected
+ {
+ CStartedTestCase* startedCase =
+ &((CAppUIAppUi*)AppUi())->UIStoreHandler()->StartedTestCaseL(
+ testCaseIndex );
+ ((CAppUIAppUi*)AppUi())->SetStartedTestCase( startedCase );
+
+ AppUi()->HandleCommandL( ECmdViewOutput );
+
+ }
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::StartTestCasesL
+//
+// Starts multiple test cases which are selected in containers list box.
+// Shows a list query if user wants to start cases parallel or sequential.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::StartTestCasesL( RArray<TInt> aSelectedIndexes )
+ {
+ _LIT( KTempSet, "TempSet");
+ TInt selectedItem(0);
+ TInt i(0);
+ TInt ret(0);
+
+ CAknListQueryDialog* startDialog = new (ELeave) CAknListQueryDialog(&selectedItem);
+ if ( startDialog->ExecuteLD(R_START_MULTIPLE_TESTCASES_LIST_QUERY) )
+ {
+ ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->CreateTestSet( KTempSet );
+
+ User::LeaveIfError( ret );
+
+ for( i = 0; i < aSelectedIndexes.Count(); i++ )
+ {
+ CTestInfo* testCaseInfo = iContainer->TestCaseInfo( aSelectedIndexes[i] );
+ User::LeaveIfNull( testCaseInfo );
+
+ ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->AddToTestSet( KTempSet, *testCaseInfo );
+ if( KErrNone != ret )
+ {
+ User::Leave( ret );
+ }
+ // Increment the counter value
+ ((CAppUIAppUi*)AppUi())->iUIStoreHandler->iExecutedTestCaseCount++;
+ }
+
+ //start cases
+ if ( selectedItem == 0 )
+ {
+ ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->StartTestSet(
+ ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestSetL( KTempSet ),
+ i, CStartedTestSet::ESetParallel);
+ }
+ else if (selectedItem == 1)
+ {
+ ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->StartTestSet(
+ ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestSetL( KTempSet ),
+ i, CStartedTestSet::ESetSequential);
+ }
+
+ ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->RemoveTestSet( KTempSet );
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/StartedCasesMenuContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,233 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStartedCasesMenuContainer
+* class definition.
+*
+*/
+
+// INCLUDE FILES
+#include "StartedCasesMenuContainer.h"
+#include "Stifui.hrh"
+#include <Stifui.rsg>
+
+#include <aknlists.h> //ListBox
+#include <barsread.h> // for TResourceReader
+
+#include <aknnotewrappers.h>
+
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::ConstructL
+//
+// Symbian OS default constructor.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuContainer::ConstructL(
+ const TRect& aRect )
+ {
+ CreateWindowL();
+
+ iListBox = CMenuListBox::NewL(EStartedCasesMenuViewId);
+ iListBox->SetContainerWindowL( *this );
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC( reader, R_STARTED_CASES_MENU_LISTBOX );
+ iListBox->SetListBoxObserver( this ); // jos peritty MEikListBoxObserver:sta
+ //iListBox->SetObserver( this /*iMainMenuObserver*/ ); //jos peritty MCoeControlObserver:sta
+ iListBox->ConstructFromResourceL( reader );
+ CleanupStack::PopAndDestroy(); // resource stuffs.
+
+ //Create Scroller control for ListBox and set its visibility
+ iListBox->CreateScrollBarFrameL(ETrue);
+ iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+
+ ((CMenuListBox*)iListBox)->SetPreviousFocus();
+ iListBox->ActivateL();
+
+ SetRect(aRect);
+ ActivateL();
+ }
+
+// Destructor
+CStartedCasesMenuContainer::~CStartedCasesMenuContainer()
+ {
+ if ( iListBox )
+ {
+ iListBox->Reset();
+ delete iListBox;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::SizeChanged
+//
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuContainer::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CStartedCasesMenuContainer::CountComponentControls() const
+ {
+ return 1; // return nbr of controls inside this container
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CStartedCasesMenuContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::Draw
+//
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuContainer::Draw(const TRect& /*aRect*/) const
+ {
+ // CWindowGc& gc = SystemGc();
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::HandleListBoxEventL
+//
+// Handles list box events.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuContainer::HandleListBoxEventL(
+ CEikListBox* aListBox,
+ TListBoxEvent aEventType )
+ {
+
+ if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+ {
+ HandleSelectedListItemL( aListBox->CurrentItemIndex() );
+ }
+ }
+
+
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::HandleSelectedListItemL
+//
+// Method HandleSelectedListItemL handles valid index.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuContainer::HandleSelectedListItemL( TInt aIndex )
+ {
+ TInt selection = aIndex;
+
+ switch ( selection )
+ {
+ case 0: ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowAllStartedCases);
+ break;
+ case 1: ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowOngoingCases);
+ break;
+ case 2: ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowPausedCases);
+ break;
+ case 3: ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowPassedCases);
+ break;
+ case 4: ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowFailedCases);
+ break;
+ case 5: ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowCrashedAbortedCases);
+ break;
+ case 6: ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowStatistics);
+ break;
+ default:
+ break;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::OfferKeyEventL
+//
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CStartedCasesMenuContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType)
+ {
+ if (aType != EEventKey)
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ switch ( aKeyEvent.iCode )
+ {
+ case EKeyLeftArrow:
+ case EKeyRightArrow:
+ { /* Left ja right key eventit valitetaan AppUille joka hoitaa siirtymisen toisiin nakymiin */
+ return EKeyWasNotConsumed;
+ //break;
+ }
+ default:
+ {
+ //Muut Key eventit valitetaan listboxille, joka hoitaa ne
+ if (iListBox)
+ {
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ }
+ }
+ return EKeyWasNotConsumed;
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::GetActiveLine
+//
+// Get currently selected items index.
+// ----------------------------------------------------------------------------
+//
+TInt CStartedCasesMenuContainer::GetActiveLine()
+ {
+ return iListBox->CurrentItemIndex();
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer:::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuContainer::SaveActiveLine()
+ {
+ ((CMenuListBox*)iListBox)->SaveFocusPosition();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/StartedCasesMenuView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStartedCasesMenuView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknViewAppUi.h>
+#include <barsread.h> //TResourceReader
+#include <Stifui.rsg>
+#include "StartedCasesMenuView.h"
+#include "StartedCasesMenuContainer.h"
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::ConstructL
+//
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuView::ConstructL()
+ {
+ CView::ConstructL();
+ BaseConstructL( R_APPUI_STARTEDCASESMENUVIEW );
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::~CStartedCasesMenuView
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CStartedCasesMenuView::~CStartedCasesMenuView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::Id
+//
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CStartedCasesMenuView::Id() const
+ {
+ return TUid::Uid(EStartedCasesMenuViewId); //KTestCaseMenuViewId;
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::HandleCommandL
+//
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuView::HandleCommandL(TInt aCommand)
+ {
+ switch ( aCommand )
+ {
+ case EAknSoftkeyBack:
+ {
+ AppUi()->HandleCommandL(EAppUIGoBack);
+ break;
+ }
+ case EAknCmdOpen:
+ {
+ TInt a = iContainer->GetActiveLine();
+ iContainer->HandleSelectedListItemL( a );
+ }
+ break;
+ default:
+ {
+ AppUi()->HandleCommandL( aCommand );
+ break;
+ }
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::DoActivateL
+//
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ iContainer = new (ELeave) CStartedCasesMenuContainer;
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect() );
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTEDCASES);
+ iNaviDecorator = np->CreateNavigationLabelL( reader );
+ CleanupStack::PopAndDestroy(); // resource reader
+ np->PushL(*iNaviDecorator);
+ }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::DoDeactivate
+//
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ iContainer->SaveActiveLine();
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/StatisticsContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,297 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStatisticsContainer class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h> // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <aknnotewrappers.h>
+
+#include <eikclbd.h> // CColumnListBoxData
+
+#include <Stifui.rsg>
+
+//#include "UIStoreIf.h"
+//#include "UIStore.h"
+//#include "UIEngine.h"
+//#include "UIEngineContainer.h"
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "StatisticsContainer.h"
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::ConstructL
+//
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsContainer::ConstructL( const TRect& aRect,
+ MEikListBoxObserver* aListBoxObserver )
+ {
+
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(
+ _L("StatisticsContainer: ConstructL"));
+
+ CreateWindowL();
+
+ iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+ //iTestCasesInView.Reset();
+ //((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StatisticsContainer: iTCInV Reset"));
+
+ iListBox = CMenuListBox::NewL(EStatisticsViewId);
+ iListBox->SetContainerWindowL( *this );
+ iListBox->SetListBoxObserver( aListBoxObserver /*this*/ ); // jos peritty MEikListBoxObserver:sta
+ iListBox->ConstructL(this, EAknListBoxMarkableList /*EAknListBoxSelectionList*/);
+
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StatisticsContainer: ListBox constructed"));
+
+ //Create Scroller control for ListBox and set its visibility
+ iListBox->CreateScrollBarFrameL(ETrue);
+ iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+
+ if ( iUIStore )
+ {
+ //RRefArray<CStartedTestCase> allStarted;
+ RRefArray<CStartedTestCase> allStarted;
+ TInt ret = iUIStore->StartedTestCases( allStarted );
+ if( KErrNone != ret )
+ {
+ allStarted.Reset();
+ allStarted.Close();
+ User::Leave( ret );
+ }
+ TInt count = allStarted.Count();
+ // TInt notstarted( 0 );
+ TInt ongoing( 0 );
+ TInt passed( 0 );
+ TInt failed( 0 );
+ TInt other( 0 );
+ //TInt aborted( 0 );
+ // TInt paused( 0 );
+ //TInt crashed( 0 );
+ //TInt executed( 0 );
+ // TInt state( 0 );
+
+ for( TInt a = 0; a < count; a++ )
+ {
+ switch ( allStarted[a].Status() )
+ {
+ case CUIStoreIf::EStatusRunning:
+ {
+ ongoing++;
+ break;
+ }
+ case CUIStoreIf::EStatusExecuted | CUIStoreIf::EStatusPassed:
+ {
+ passed++;
+ break;
+ }
+ case CUIStoreIf::EStatusExecuted |CUIStoreIf::EStatusFailed:
+ {
+ failed++;
+ break;
+ }
+ //case CUIStoreIf::EStatusAborted:
+ // {
+ // aborted++;
+ // break;
+ // }
+ /*case ECrashed:
+ {
+ crashed++;
+ break;
+ }
+ */
+ /*case EExecuted:
+ {
+ executed++;
+ break;
+ }
+ */
+ default:
+ {
+ other++;
+ break;
+ }
+ }
+ }
+
+ allStarted.Reset();
+ allStarted.Close();
+
+ iTestCaseArray = new (ELeave) CDesC16ArrayFlat(6);
+ iTestCaseArray->Reset();
+
+ HBufC* tmpHBuf = HBufC::NewL( 40 );
+ TPtr buffer( tmpHBuf->Des() );
+
+ buffer = ( _L("\t") );
+ buffer.AppendNum( ongoing );
+ buffer.Append( _L(" Running") );
+ iTestCaseArray->AppendL( buffer );
+
+ buffer = ( _L("\t") );
+ buffer.AppendNum( passed );
+ buffer.Append( _L(" Passed") );
+ iTestCaseArray->AppendL( buffer );
+
+ buffer = ( _L("\t") );
+ buffer.AppendNum( failed );
+ buffer.Append( _L(" Failed") );
+ iTestCaseArray->AppendL( buffer );
+
+ buffer = ( _L("\t") );
+ buffer.AppendNum( other );
+ buffer.Append( _L(" Crashed/Aborted") );
+ iTestCaseArray->AppendL( buffer );
+
+ delete tmpHBuf;
+
+ iListBox->Model()->SetItemTextArray( iTestCaseArray );
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StatisticsContainer: ListBox model set"));
+ }
+ else
+ {
+ //User::Leave( syy?? )
+ }
+
+ // Creates graphic.
+ //SetGraphicIconL( iListBox );
+ // ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StatisticsContainer: icons created"));
+
+ iListBox->ActivateL();
+ ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+ SetRect(aRect);
+ ActivateL();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::~CStatisticsContainer
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CStatisticsContainer::~CStatisticsContainer()
+ {
+ //iTestCasesInView.Close(); // does not delete objects whose pointers are contained in the array
+ //delete iListBox;
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::SizeChanged
+//
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsContainer::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CStatisticsContainer::CountComponentControls() const
+ {
+ return 1; // return nbr of controls inside this container
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+
+CCoeControl* CStatisticsContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::Draw
+//
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsContainer::Draw(const TRect& /*aRect*/) const
+ {
+ // CWindowGc& gc = SystemGc();
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::OfferKeyEventL
+//
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CStatisticsContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType)
+ {
+ if (aType != EEventKey)
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ if (iListBox)
+ {
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ else
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CStatisticsContainer::SaveActiveLine()
+ {
+ ((CMenuListBox*)iListBox)->SaveFocusPosition();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/StatisticsView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,350 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CStatisticsView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <eikmenub.h>
+#include <aknViewAppUi.h>
+#include <aknlistquerydialog.h>
+#include <barsread.h> //TResourceReader
+#include <Stifui.rsg>
+#include "AppUIAppUi.h"
+#include "Stifui.hrh"
+#include "StatisticsView.h"
+#include "StatisticsContainer.h"
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStatisticsView::ConstructL
+//
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::ConstructL()
+ {
+ CView::ConstructL();
+ BaseConstructL( R_APPUI_STATISTICSVIEW );
+ iCurrentTestCase = 0;
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::~CStatisticsView
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CStatisticsView::~CStatisticsView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::Id
+//
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CStatisticsView::Id() const
+ {
+ return TUid::Uid(EStatisticsViewId);
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::HandleCommandL
+//
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::HandleCommandL(TInt aCommand)
+ {
+ if ( aCommand >= ECmdFilterByModule && aCommand < ECmdFilterByTestCaseFile ) // 0x1000 - 0x1FFF
+ {
+ TInt moduleNumber = aCommand - ECmdFilterByModule;
+
+ RRefArray<TDesC> moduleName;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( moduleName );
+ if( KErrNone != ret )
+ {
+ moduleName.Reset();
+ moduleName.Close();
+ User::Leave( ret );
+ }
+ //iFilterModule = testModules[moduleNumber];
+
+ iContainer->FilterCasesByModuleL( moduleName[moduleNumber] );
+
+ moduleName.Reset();
+ moduleName.Close();
+
+ return;
+ }
+
+ if ( aCommand >= ECmdFilterByTestCaseFile && aCommand < ECmdNOFiltering )
+ {
+ TInt testCaseFileNumber = aCommand - ECmdFilterByTestCaseFile;
+ RRefArray<TDesC> testCaseFileName;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( testCaseFileName );
+ if( KErrNone != ret )
+ {
+ testCaseFileName.Reset();
+ testCaseFileName.Close();
+ User::Leave( ret );
+ }
+
+ iContainer->FilterCasesByTCFileNameL( testCaseFileName[testCaseFileNumber] );
+
+ testCaseFileName.Reset();
+ testCaseFileName.Close();
+
+ return;
+ }
+
+ if ( aCommand == ECmdNOFiltering )
+ {
+ iContainer->NoFilteringL();
+ return;
+ }
+
+ switch ( aCommand )
+ {
+ case ECmdStartCases:
+ {
+ iCurrentTestCase = iContainer->CurrentItemIndex();
+ StartTestCasesL();
+ break;
+ }
+ case EAknSoftkeyBack:
+ {
+ AppUi()->HandleCommandL( EAppUIGoBack );
+ break;
+ }
+ default:
+ {
+ AppUi()->HandleCommandL( aCommand );
+ break;
+ }
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::DoActivateL
+//
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("StatisticsView: DoActivateL"));
+ //message = _L("eng.open ret:");
+ //message.AppendNum( ret , EDecimal );
+ //AppUi()->iLogger->Log( message );
+ iContainer = new (ELeave) CStatisticsContainer;
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect(), this );
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("StatisticsView: container constructed"));
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+ iContainer->SetCurrentItemIndex(iCurrentTestCase);
+
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_STATS);
+ iNaviDecorator = np->CreateNavigationLabelL( reader );
+ CleanupStack::PopAndDestroy(); // resource reader
+ np->PushL(*iNaviDecorator);
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::DoDeactivate
+//
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ iContainer->SaveActiveLine();
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::DynInitMenuPaneL
+//
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::DynInitMenuPaneL(
+ TInt aResourceId, CEikMenuPane* aMenuPane)
+ {
+
+ // Test modules are added to filter by test module submenu if the submenu is opened
+ if (R_APPUI_FILTERBYMODULES_MENU == aResourceId)
+ {
+ RRefArray<TDesC> modules;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( modules );
+ if( KErrNone != ret )
+ {
+ modules.Reset();
+ modules.Close();
+ User::Leave( ret );
+ }
+
+ TInt moduleCount = modules.Count();
+
+ TInt i;
+ CEikMenuPaneItem::SData item;
+
+ item.iCommandId = ECmdFilterByModule;
+ item.iFlags = 0;
+ item.iCascadeId = 0;
+
+ for (i = 0; i < moduleCount; i++)
+ {
+ item.iText = modules[i];
+ aMenuPane->AddMenuItemL(item);
+ item.iCommandId++; // command IDs 0x1000 - 0x1FFF are reserved for modules in hrh file
+ }
+
+ modules.Reset();
+ modules.Close();
+ }
+
+ // Test case files are added to filter by test case file submenu if the submenu is opened
+ if (R_APPUI_FILTER_BY_TESTCASEFILE_MENU == aResourceId)
+ {
+ RRefArray<TDesC> testCaseFiles;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( testCaseFiles );
+ if( KErrNone != ret )
+ {
+ testCaseFiles.Reset();
+ testCaseFiles.Close();
+ User::Leave( ret );
+ }
+
+ TInt testCaseFileCount = testCaseFiles.Count();
+
+ TInt i;
+ CEikMenuPaneItem::SData item;
+
+ item.iCommandId = ECmdFilterByTestCaseFile;
+ item.iFlags = 0;
+ item.iCascadeId = 0;
+
+ for (i = 0; i < testCaseFileCount; i++)
+ {
+ item.iText = testCaseFiles[i];
+ aMenuPane->AddMenuItemL(item);
+ item.iCommandId++; // command IDs 0x2000 - 0x2FFF are reserved for test case files in hrh file
+ }
+
+ testCaseFiles.Reset();
+ testCaseFiles.Close();
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::HandleListBoxEventL
+//
+// Handles a list box event.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+ {
+ if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+ {
+ //iCurrentTestCase = aListBox->CurrentItemIndex();
+ //iCurrentTestCase = iContainer->CurrentItemIndex();
+ //StartTestCases();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::StartTestCases
+//
+// Starts test case(s) which is selected in containers list box.
+// First shows a list query if user wants just start test case or
+// if he wants to start test case and view test case output.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::StartTestCasesL()
+ {
+ TInt selectedItem(0);
+ CAknListQueryDialog* startDialog = new (ELeave) CAknListQueryDialog(&selectedItem);
+ if ( startDialog->ExecuteLD(R_START_TESTCASE_LIST_QUERY) )
+ {
+ RRefArray<CTestInfo> testInfo;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCases( testInfo );
+ if( KErrNone != ret )
+ {
+ testInfo.Reset();
+ testInfo.Close();
+ User::Leave( ret );
+ }
+ TInt testCaseNumber = testInfo[0].TestCaseNum();
+ TInt testCaseIndex( 0 );
+
+ //CUIEngineContainer* container = NULL;
+ ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->StartTestCase( testInfo[testCaseNumber], testCaseIndex );
+ if( KErrNone != ret )
+ {
+ User::Leave( ret );
+ }
+ testInfo.Reset();
+ testInfo.Close();
+
+ // Increment the counter value
+ ((CAppUIAppUi*)AppUi())->iUIStoreHandler->iExecutedTestCaseCount++;
+
+ }
+
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestCaseMenuContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestCaseMenuContainer class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include "TestCaseMenuContainer.h"
+#include "Stifui.hrh"
+#include <Stifui.rsg>
+
+#include <aknlists.h> //ListBox
+#include <barsread.h> // for TResourceReader
+
+#include <aknnotewrappers.h>
+
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::ConstructL
+//
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuContainer::ConstructL(const TRect& aRect)
+ {
+ CreateWindowL();
+
+ iListBox = CMenuListBox::NewL(ETestCaseMenuViewId);
+ iListBox->SetContainerWindowL( *this );
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC( reader, R_TESTCASE_MENU_LISTBOX );
+ iListBox->SetListBoxObserver( this );
+ iListBox->ConstructFromResourceL( reader );
+ CleanupStack::PopAndDestroy(); // resource stuffs.
+
+ // Create Scroller control for ListBox and set its visibility
+ // !!! Not needed yet because there are only two items in list box.
+ // If items are added later, scroller may be taken to use
+ //iListBox->CreateScrollBarFrameL(ETrue);
+ //iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+
+ iListBox->ActivateL();
+ ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+ SetRect(aRect);
+ ActivateL();
+ }
+
+// Destructor
+CTestCaseMenuContainer::~CTestCaseMenuContainer()
+ {
+ if ( iListBox )
+ {
+ iListBox->Reset();
+ delete iListBox;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::SizeChanged
+//
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuContainer::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestCaseMenuContainer::CountComponentControls() const
+ {
+ return 1; // return nbr of controls inside this container
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestCaseMenuContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::Draw
+//
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuContainer::Draw(const TRect& /*aRect*/) const
+ {
+ // CWindowGc& gc = SystemGc();
+ }
+
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::HandleListBoxEventL
+//
+// Handles list box events.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuContainer::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
+ {
+ if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+ {
+ HandleSelectedListItemL( aListBox->CurrentItemIndex() );
+
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::HandleSelectedListItemL
+//
+// Method HandleSelectedListItemL handles valid index.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuContainer::HandleSelectedListItemL( TInt aIndex )
+ {
+ TInt selection = aIndex;
+
+ switch ( selection )
+ {
+ case 0:
+ //Vaihda StartCasesView aktiiviseksi
+ ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdGoToStartCasesView);
+ break;
+ case 1:
+ ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdGoToStartedCasesView);
+ break;
+ default:
+ break;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::OfferKeyEventL
+//
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestCaseMenuContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType)
+ {
+ if (aType != EEventKey)
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ switch ( aKeyEvent.iCode )
+ {
+ case EKeyLeftArrow:
+ case EKeyRightArrow:
+ { /* Left ja right key eventit valitetaan AppUille joka hoitaa siirtymisen toisiin nakymiin */
+ return EKeyWasNotConsumed;
+ //break;
+ }
+ default:
+ {
+ //Muut Key eventit valitetaan listboxille, joka hoitaa ne
+ if (iListBox)
+ {
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ }
+ }
+ return EKeyWasNotConsumed;
+}
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::GetActiveLine
+//
+// Get currently selected items index.
+// ----------------------------------------------------------------------------
+//
+TInt CTestCaseMenuContainer::GetActiveLine()
+ {
+ return iListBox->CurrentItemIndex();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuContainer::SaveActiveLine()
+ {
+ ((CMenuListBox*)iListBox)->SaveFocusPosition();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestCaseMenuView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestCaseMenuView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknViewAppUi.h>
+#include <barsread.h> //TResourceReader
+#include <Stifui.rsg>
+#include "TestCaseMenuView.h"
+#include "TestCaseMenuContainer.h"
+#include "Stifui.hrh"
+#include "AppUIAppUi.h" // loggerin kayttoa varten, muuten ei tarvittaisi
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::ConstructL
+//
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuView::ConstructL()
+ {
+ CView::ConstructL();
+ BaseConstructL( R_APPUI_TESTCASEMENUVIEW );
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::~CTestCaseMenuView
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestCaseMenuView::~CTestCaseMenuView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::Id
+//
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestCaseMenuView::Id() const
+ {
+ return TUid::Uid(ETestCaseMenuViewId); //KTestCaseMenuViewId;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::HandleCommandL
+//
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuView::HandleCommandL(TInt aCommand)
+ {
+ switch ( aCommand )
+ {
+ case EAknSoftkeyBack:
+ {
+ AppUi()->HandleCommandL(EAppUIGoBack);
+ break;
+ }
+ case EAknCmdOpen:
+ {
+ TInt a = iContainer->GetActiveLine();
+ iContainer->HandleSelectedListItemL( a );
+ }
+ break;
+ default:
+ {
+ AppUi()->HandleCommandL( aCommand );
+ break;
+ }
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::DoActivateL
+//
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestCaseMenu: DoActivateL"));
+ //message = _L("eng.open ret:");
+ //message.AppendNum( ret , EDecimal );
+ //AppUi->iLogger->Log( message );
+ iContainer = new (ELeave) CTestCaseMenuContainer;
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect() );
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestCaseMenu: container constructed"));
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTCASES);
+ iNaviDecorator = np->CreateNavigationLabelL( reader );
+ CleanupStack::PopAndDestroy(); // resource reader
+ np->PushL(*iNaviDecorator);
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::DoDeactivate
+//
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ iContainer->SaveActiveLine();
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestCaseOutputContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,328 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestCaseOutputContainer class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include "TestCaseOutputContainer.h"
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include <aknlists.h> // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <badesca.h> // CDesCArray
+#include <eikclbd.h> // CColumnListBoxData
+#include <aknnotewrappers.h>
+
+//#include "UIStoreIf.h"
+//#include "UIStore.h"
+//#include "UIEngine.h"
+//#include "UIEngineContainer.h"
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "MenuListBox.h"
+
+//#include <gdi.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::ConstructL
+//
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputContainer::ConstructL(const TRect& aRect, CStartedTestCase* aStartedTestCase ) //TInt aExecutedTestCaseCount )
+ {
+ CreateWindowL();
+
+ iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+ iListBox = CMenuListBox::NewL(ETestCaseOutputViewId);
+ iListBox->SetContainerWindowL( *this );
+ iListBox->SetListBoxObserver( this );
+ iListBox->ConstructL(this, EAknListBoxSelectionList);
+
+ //Create Scroller control for ListBox and set its visibility
+ iListBox->CreateScrollBarFrameL(ETrue);
+ iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+
+ if( iUIStore )
+ {
+ iListBoxModel = CTestOutputListBoxModel::NewL( aStartedTestCase );
+ iListBox->Model()->SetItemTextArray( iListBoxModel );
+ }
+ else
+ {
+ //User::Leave( syy?? )
+ }
+ iListBox->ActivateL();
+ ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+ SetRect(aRect);
+ ActivateL();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::~CTestCaseOutputContainer
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestCaseOutputContainer::~CTestCaseOutputContainer()
+ {
+ // Discard and destroy the font
+ //CWindowGc* listBoxGc = iListBox->View()->ItemDrawer()->Gc();
+ //listBoxGc->DiscardFont();
+
+ //CWindowGc& gc = SystemGc();
+ //gc.DiscardFont();
+
+ //iCoeEnv->ScreenDevice()->ReleaseFont(iListBoxFont);
+
+ delete iListBox;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::SizeChanged
+//
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputContainer::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestCaseOutputContainer::CountComponentControls() const
+ {
+ return 1; // return nbr of controls inside this container
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestCaseOutputContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::Draw
+//
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputContainer::Draw(const TRect& /*aRect*/) const
+ {
+ // CWindowGc& gc = SystemGc();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::HandleListBoxEventL
+//
+// Handles list box events.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+ {
+ if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+ {
+ //TBuf<200> outputLine;
+ //CAknNoteDialog* outputLineNote = new (ELeave) CAknNoteDialog;
+ //outputLineNote->SetTextL( iListBoxModel->MdcaPoint(iListBox->CurrentItemIndex()) );
+ //outputLineNote->RunDlgLD();
+
+
+
+ //CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
+ //informationNote->SetTextL( iListBoxModel->MdcaPoint(iListBox->CurrentItemIndex()) );
+ //informationNote->SetTextPluralityL( ETrue );
+ //informationNote->SetTextL( _L("Number of cases: %d") );
+ //informationNote->SetTextNumberL( count );
+ //informationNote->ExecuteLD();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::OfferKeyEventL
+//
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestCaseOutputContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType)
+{
+ if (aType != EEventKey)
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ if (iListBox)
+ {
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ else
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ /*
+ switch ( aKeyEvent.iCode )
+ {
+ case EKeyLeftArrow:
+ case EKeyRightArrow:
+ { */ /* Left ja right key eventit valitetaan AppUille joka hoitaa siirtymisen toisiin nakymiin */
+ /* return EKeyWasNotConsumed;
+ break;
+ }
+ default:
+ {
+ //Muut Key eventit valitetaan listboxille, joka hoitaa ne
+ if (iListBox)
+ {
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ else
+ {
+ return EKeyWasNotConsumed;
+ }
+ break;
+ }
+ }*/
+}
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::OutputUpdateL
+//
+// Handles addition of item to list box.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputContainer::OutputUpdateL()
+ {
+ if ( iListBox )
+ {
+ iListBox->HandleItemAdditionL();
+ iListBox->DrawNow();
+ }
+ }
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ----------------------------------------------------------------------------
+// CTestOutputListBoxModel::NewL
+//
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CTestOutputListBoxModel* CTestOutputListBoxModel::NewL(CStartedTestCase* aStartedTestCase /*, HBufC* aBuffer*/)
+ {
+
+ CTestOutputListBoxModel* self = new ( ELeave ) CTestOutputListBoxModel();
+ CleanupStack::PushL( self );
+ //self->ConstructL();
+ //self->iBuffer = aBuffer;
+ self->iBuffer = HBufC::NewL( 150 );
+ self->iStartedTestCase = aStartedTestCase;
+ CleanupStack::Pop();
+ return self;
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestOutputListBoxModel::ConstructL
+//
+// Symbian OS two phased constructor.
+// Completes the construction of the object.
+// ----------------------------------------------------------------------------
+//
+void CTestOutputListBoxModel::ConstructL()
+ {
+ //iBuffer = HBufC::NewLC( KMaxInfoName + KMaxName + 2 );
+ }
+
+// ----------------------------------------------------------------------------
+// CTestOutputListBoxModel::~CTestCaseOutputContainer
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestOutputListBoxModel::~CTestOutputListBoxModel()
+ {
+ delete iBuffer;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestOutputListBoxModel::MdcaCount
+//
+// Returns the number of descriptor elements in the array.
+// ----------------------------------------------------------------------------
+//
+TInt CTestOutputListBoxModel::MdcaCount() const
+ {
+
+ TInt rows = iStartedTestCase->PrintArray().Count();
+ return rows;
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestOutputListBoxModel::MdcaPoint
+//
+// Indexes into a descriptor array.
+// ----------------------------------------------------------------------------
+//
+TPtrC CTestOutputListBoxModel::MdcaPoint(TInt aIndex) const
+ {
+ const RPointerArray<CTestProgress> printArray = iStartedTestCase->PrintArray();
+
+ TPtr buffer( iBuffer->Des() );
+ buffer.Zero();
+ buffer.Append(_L("\t"));
+ buffer.Append(printArray[aIndex]->iDescription);
+ buffer.Append(_L(" "));
+ buffer.Append(printArray[aIndex]->iText);
+
+ return *iBuffer;
+
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestCaseOutputView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,380 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestCaseOutputView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <eikmenub.h>
+#include <aknViewAppUi.h>
+#include <akntitle.h>
+#include <barsread.h> //TResourceReader
+#include <Stifui.rsg>
+
+//#include "UIStoreIf.h"
+//#include "UIStore.h"
+//#include "UIEngine.h"
+//#include "UIEngineContainer.h"
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "TestCaseOutputView.h"
+#include "TestCaseOutputContainer.h"
+#include "AppUIAppUi.h"
+#include "Stifui.hrh"
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::ConstructL
+//
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::ConstructL()
+ {
+ CView::ConstructL();
+ BaseConstructL( R_APPUI_TESTCASEOUTPUTVIEW );
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::~CTestCaseOutputView
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestCaseOutputView::~CTestCaseOutputView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+
+ iCurrentTestCase = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::Id
+//
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestCaseOutputView::Id() const
+ {
+ return TUid::Uid(ETestCaseOutputViewId);
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::HandleCommandL
+//
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::HandleCommandL(TInt aCommand)
+ {
+ switch ( aCommand )
+ {
+ case EAknSoftkeyBack:
+ {
+ AppUi()->HandleCommandL(EAppUIGoBack);
+ break;
+ }
+ case ECmdPauseTestCase:
+ {
+ /*
+ TInt index( 0 );
+ index = ( ( CAppUIAppUi* )AppUi() )->GetTestCaseIndex();
+ CStartedTestCase* startedTestCase = NULL;
+ TRAPD( ret, startedTestCase = &iUIStore->StartedTestCaseL( index ) );
+ if( ret != KErrNone )
+ {
+ // Leave
+ }
+ */
+ CStartedTestCase* startedTestCase =
+ ( ( CAppUIAppUi* )AppUi() )->GetStartedTestCase();
+ startedTestCase->UIEngineContainer().PauseTest();
+ break;
+ }
+ case ECmdResumeTestCase:
+ {
+ /*
+ TInt index( 0 );
+ index = ( ( CAppUIAppUi* )AppUi() )->GetTestCaseIndex();
+ CStartedTestCase* startedTestCase = NULL;
+ TRAPD( ret, startedTestCase = &iUIStore->StartedTestCaseL( index ) );
+ if( ret != KErrNone )
+ {
+ // Leave
+ }
+ */
+ CStartedTestCase* startedTestCase =
+ ( ( CAppUIAppUi* )AppUi() )->GetStartedTestCase();
+ startedTestCase->UIEngineContainer().ResumeTest();
+ break;
+ }
+ case ECmdAbortTestCase:
+ {
+ /*
+ TInt index( 0 );
+ index = ( ( CAppUIAppUi* )AppUi() )->GetTestCaseIndex();
+ CStartedTestCase* startedTestCase = NULL;
+ TRAPD( ret, startedTestCase = &iUIStore->StartedTestCaseL( index ) );
+ if( ret != KErrNone )
+ {
+ // Leave
+ }
+ */
+ CStartedTestCase* startedTestCase =
+ ( ( CAppUIAppUi* )AppUi() )->GetStartedTestCase();
+ startedTestCase->UIEngineContainer().CancelTest();
+ break;
+ }
+ default:
+ {
+ AppUi()->HandleCommandL( aCommand );
+ break;
+ }
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::DoActivateL
+//
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ iContainer = new (ELeave) CTestCaseOutputContainer;
+ iContainer->SetMopParent(this);
+
+ iCurrentTestCase = ( ( CAppUIAppUi* )AppUi() )->GetStartedTestCase();
+ iContainer->ConstructL( ClientRect(), iCurrentTestCase );
+
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+ PrintTestCaseStateL();
+
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTCASE_OUTPUT);
+ iNaviDecorator = np->CreateNavigationLabelL( reader );
+ CleanupStack::PopAndDestroy(); // resource reader
+ np->PushL(*iNaviDecorator);
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::DoDeactivate
+//
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ // Because DoDeactivate method can't leave we must
+ // catch unexpected leaves.
+ TInt ret = KErrNone;
+ TRAP( ret,
+ CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
+ if ( tp != NULL )
+ {
+ tp->SetTextToDefaultL(); // Set application name.
+ }
+ ); // TRAPD end
+
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+
+ iCurrentTestCase = NULL;
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::DynInitMenuPaneL
+//
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::DynInitMenuPaneL(
+ TInt aResourceId, CEikMenuPane* aMenuPane)
+ {
+ CStartedTestCase* startedTestCase =
+ ( ( CAppUIAppUi* )AppUi() )->GetStartedTestCase();
+
+ if (R_APPUI_TESTCASEOUTPUTVIEW_MENU == aResourceId)
+ {
+
+ if ( startedTestCase->Status() == CUIStoreIf::EStatusRunning )
+ {
+ if( startedTestCase->UIEngineContainer().State() == CUIEngineContainer::ENotStarted )
+ {
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+ }
+ else if( startedTestCase->UIEngineContainer().State() == CUIEngineContainer::ERunning )
+ {
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, EFalse );
+ }
+ else if( startedTestCase->UIEngineContainer().State() == CUIEngineContainer::EPaused )
+ {
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, EFalse );
+ }
+ else if( startedTestCase->UIEngineContainer().State() == CUIEngineContainer::EExecuted )
+ {
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+ }
+ else if( startedTestCase->UIEngineContainer().State() == CUIEngineContainer::EFinished )
+ {
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+ }
+
+ }
+ else
+ {
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+ }
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::OutputUpdate
+//
+// Receives output update notification from AppUI.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::OutputUpdateL( CStartedTestCase* /*aTestCase*/ )
+ {
+ PrintTestCaseStateL();
+ iContainer->OutputUpdateL();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::TestCaseStateChangedL
+//
+// Receives test case state changed notification from AppUI.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::TestCaseStateChangedL()
+ {
+ PrintTestCaseStateL();
+ iContainer->OutputUpdateL();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::PrintTestCaseState
+//
+// Prints test case state to title pane.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::PrintTestCaseStateL()
+ {
+ TBuf<50> statusMessage;
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
+
+ if ( iCurrentTestCase != NULL )
+ {
+ TUint status = iCurrentTestCase->Status();
+
+ if( status & CUIStoreIf::EStatusRunning )
+ {
+ CEikonEnv::Static()->ReadResource( statusMessage,
+ R_TESTCASE_STATE_RUNNING );
+ }
+ else if( status & CUIStoreIf::EStatusExecuted &&
+ status & CUIStoreIf::EStatusPassed )
+ {
+ CEikonEnv::Static()->ReadResource( statusMessage,
+ R_TESTCASE_STATE_PASSED );
+ }
+ else if( status & CUIStoreIf::EStatusExecuted &&
+ status & CUIStoreIf::EStatusFailed )
+ {
+ CEikonEnv::Static()->ReadResource( statusMessage,
+ R_TESTCASE_STATE_FAILED );
+ }
+ else if( status & CUIStoreIf::EStatusAborted )
+ {
+ CEikonEnv::Static()->ReadResource( statusMessage,
+ R_TESTCASE_STATE_CRASHED_ABORTED );
+ }
+ else if( status & CUIStoreIf::EStatusCrashed )
+ {
+ CEikonEnv::Static()->ReadResource( statusMessage,
+ R_TESTCASE_STATE_CRASHED_ABORTED );
+ }
+ else
+ {
+ CEikonEnv::Static()->ReadResource( statusMessage,
+ R_TESTCASE_STATE_UNKNOWN );
+ }
+
+ tp->SetTextL( statusMessage );
+ tp->DrawNow();
+
+ }
+
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestModulesMenuContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,310 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestModulesListBoxModel class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h> // ListBox
+#include <barsread.h> // for TResourceReader
+#include <aknnotewrappers.h>
+
+#include "Stifui.hrh"
+#include <Stifui.rsg>
+
+//#include "UIStoreIf.h"
+//#include "UIStore.h"
+//#include "UIEngine.h"
+//#include "UIEngineContainer.h"
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "TestModulesMenuContainer.h"
+#include "AppUIAppUi.h"
+
+#include "MenuListBox.h"
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestModulesListBoxModel::NewL
+//
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CTestModulesListBoxModel* CTestModulesListBoxModel::NewL(RRefArray<TDesC> aTestModules)
+ {
+
+ CTestModulesListBoxModel* self = new ( ELeave ) CTestModulesListBoxModel();
+ CleanupStack::PushL( self );
+ self->iBuffer = HBufC::NewL( 130 );
+ self->iTestModules = aTestModules;
+ CleanupStack::Pop();
+ return self;
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesListBoxModel::ConstructL
+//
+// Symbian OS two phased constructor.
+// Completes the construction of the object.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesListBoxModel::ConstructL()
+ {
+ //iBuffer = HBufC::NewLC( KMaxInfoName + KMaxName + 2 );
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesListBoxModel::~CTestCaseOutputView
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestModulesListBoxModel::~CTestModulesListBoxModel()
+ {
+ delete iBuffer;
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesListBoxModel::MdcaCount
+//
+// Returns the number of descriptor elements in the array.
+// ----------------------------------------------------------------------------
+//
+TInt CTestModulesListBoxModel::MdcaCount() const
+ {
+ return iTestModules.Count();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesListBoxModel::MdcaPoint
+//
+// Indexes into a descriptor array.
+// ----------------------------------------------------------------------------
+//
+TPtrC CTestModulesListBoxModel::MdcaPoint(TInt aIndex) const
+ {
+ TPtrC testModule = (iTestModules)[aIndex];
+ TPtr buffer( iBuffer->Des() );
+ buffer.Zero();
+
+ buffer.Append(_L("\t"));
+ buffer.Append( testModule );
+
+ return *iBuffer;
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::ConstructL
+//
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+ {
+ _LIT( KErrMessage, "Error loading modules! Check Test engine log.");
+ CreateWindowL();
+
+ iListBox = CMenuListBox::NewL(ETestModulesMenuViewId);
+ iListBox->SetContainerWindowL( *this );
+ iListBox->SetListBoxObserver( aListBoxObserver /*this*/ ); // jos peritty MEikListBoxObserver:sta
+ iListBox->ConstructL(this, EAknListBoxSelectionList /*EAknListBoxMarkableList*/ );
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ListBox constructed"));
+
+ //Create Scroller control for ListBox and set its visibility
+ iListBox->CreateScrollBarFrameL(ETrue);
+ iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+
+ iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+ if( iUIStore )
+ {
+ /*const CFixedFlatArray<TTestInfo>& allCases = iData->AllCases();
+ const TInt KTestCaseCount = allCases.Count();
+ for (TInt i=0; i < KTestCaseCount; i++)
+ {
+ iTestCasesInView.Append(&(allCases[i]));
+ } */
+
+ //RRefArray<TDesC> modules;
+ TInt ret = iUIStore->Modules( iModules );
+ if( ret != KErrNone )
+ {
+ //iModules.Reset();
+ //iModules.Close();
+ TMessageBoxUtil::ShowErrorNoteL( KErrMessage );
+ }
+
+ iListBoxModel = CTestModulesListBoxModel::NewL( iModules );
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ListBox model"));
+
+
+ iListBox->Model()->SetItemTextArray(iListBoxModel);
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ListBox model set"));
+
+ }
+ else
+ {
+ // General error becouse UIStore should be opened in AppUI when
+ // program starts.
+ User::Leave( KErrGeneral );
+ }
+
+ iListBox->ActivateL();
+ ((CMenuListBox*)iListBox)->SetPreviousFocus();
+ SetRect(aRect);
+ ActivateL();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::~CTestCaseOutputView
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestModulesMenuContainer::~CTestModulesMenuContainer()
+ {
+
+ iModules.Reset();
+ iModules.Close();
+
+ if( iListBox )
+ {
+ delete iListBox;
+ iListBox = NULL;
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::SizeChanged
+//
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuContainer::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestModulesMenuContainer::CountComponentControls() const
+ {
+ return 1; // return nbr of controls inside this container
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestModulesMenuContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::Draw
+//
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuContainer::Draw(const TRect& /*aRect*/) const
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::OfferKeyEventL
+//
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestModulesMenuContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType)
+ {
+ if (aType != EEventKey)
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ switch ( aKeyEvent.iCode )
+ {
+ case EKeyLeftArrow:
+ case EKeyRightArrow:
+ { /* Left ja right key eventit valitetaan AppUille joka hoitaa siirtymisen toisiin nakymiin */
+ return EKeyWasNotConsumed;
+ //break;
+ }
+ default:
+ {
+ //Muut Key eventit valitetaan listboxille, joka hoitaa ne
+ if (iListBox)
+ {
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ }
+ }
+ return EKeyWasNotConsumed;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::CurrentItemIndex
+//
+// Returns current item index in list box.
+// ----------------------------------------------------------------------------
+//
+TInt CTestModulesMenuContainer::CurrentItemIndex()
+ {
+ return iListBox->CurrentItemIndex();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuContainer::SaveActiveLine()
+ {
+ ((CMenuListBox*)iListBox)->SaveFocusPosition();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetBaseMenuContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,189 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetBaseMenuContainer class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include "TestSetBaseMenuContainer.h"
+#include "Stifui.hrh"
+
+#include <Stifui.rsg>
+
+#include <aknlists.h> //ListBox
+#include <barsread.h> // for TResourceReader
+
+#include <aknnotewrappers.h>
+
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::ConstructL
+//
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+ {
+ CreateWindowL();
+
+ iListBox = CMenuListBox::NewL(ETestSetMenuViewId);
+ iListBox->SetContainerWindowL( *this );
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC( reader, R_TESTSETBASE_MENU_LISTBOX );
+ iListBox->SetListBoxObserver( aListBoxObserver );
+ iListBox->ConstructFromResourceL( reader );
+ CleanupStack::PopAndDestroy(); // resource stuffs.
+
+ // Create Scroller control for ListBox and set its visibility
+ // !!! Not needed yet because there are only two items in list box.
+ // If items are added later, scroller may be taken to use
+ //iListBox->CreateScrollBarFrameL(ETrue);
+ //iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+
+ iListBox->ActivateL();
+ ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+ SetRect(aRect);
+ ActivateL();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::~CTestSetBaseMenuContainer
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetBaseMenuContainer::~CTestSetBaseMenuContainer()
+ {
+ if ( iListBox )
+ {
+ iListBox->Reset();
+ delete iListBox;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::SizeChanged
+//
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuContainer::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetBaseMenuContainer::CountComponentControls() const
+ {
+ return 1; // return nbr of controls inside this container
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestSetBaseMenuContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::Draw
+//
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuContainer::Draw(const TRect& /*aRect*/) const
+ {
+ // CWindowGc& gc = SystemGc();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::OfferKeyEventL
+//
+// Handles key events..
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestSetBaseMenuContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType)
+ {
+ if (aType != EEventKey)
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ switch ( aKeyEvent.iCode )
+ {
+ case EKeyLeftArrow:
+ case EKeyRightArrow:
+ { /* Left ja right key eventit valitetaan AppUille joka hoitaa siirtymisen toisiin nakymiin */
+ return EKeyWasNotConsumed;
+ //break;
+ }
+ default:
+ {
+ //Muut Key eventit valitetaan listboxille, joka hoitaa ne
+ if (iListBox)
+ {
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ }
+ }
+ return EKeyWasNotConsumed;
+}
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::GetActiveLine
+//
+// Get currently selected items index.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetBaseMenuContainer::GetActiveLine()
+ {
+ return iListBox->CurrentItemIndex();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuContainer::SaveActiveLine()
+ {
+ ((CMenuListBox*)iListBox)->SaveFocusPosition();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetBaseMenuView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetBaseMenuView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknViewAppUi.h>
+#include <aknlists.h>
+#include <barsread.h> //TResourceReader
+#include <Stifui.rsg>
+#include "TestSetBaseMenuView.h"
+#include "TestSetBaseMenuContainer.h"
+#include "Stifui.hrh"
+#include "AppUIAppUi.h" // loggerin kayttoa varten, muuten ei tarvittaisi
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CTestSetBaseMenuView::ConstructL
+//
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------
+//
+void CTestSetBaseMenuView::ConstructL()
+ {
+ CView::ConstructL();
+ BaseConstructL( R_APPUI_TESTSETBASEMENUVIEW );
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::~CTestSetBaseMenuView
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetBaseMenuView::~CTestSetBaseMenuView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::Id
+//
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestSetBaseMenuView::Id() const
+ {
+ return TUid::Uid(ETestSetBaseMenuViewId); //KTestSetBaseMenuViewId;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::HandleCommandL
+//
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuView::HandleCommandL(TInt aCommand)
+ {
+ switch ( aCommand )
+ {
+ case EAknSoftkeyBack:
+ {
+ AppUi()->HandleCommandL(EAppUIGoBack);
+ break;
+ }
+ case EAknCmdOpen:
+ {
+ break;
+ }
+ case ECmdCreateTestSet:
+ {
+ AppUi()->HandleCommandL(ECmdCreateTestSet);
+ break;
+ }
+ case ECmdLoadTestSet:
+ {
+ AppUi()->HandleCommandL(ECmdLoadTestSet);
+ break;
+ }
+ default:
+ {
+ AppUi()->HandleCommandL( aCommand );
+ break;
+ }
+ }
+ }
+
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::HandleListBoxEventL
+//
+// Handles a list box event.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuView::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
+ {
+ if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+ {
+ switch ( aListBox->CurrentItemIndex() )
+ {
+ case 0:
+ HandleCommandL( ECmdCreateTestSet );
+ break;
+ case 1:
+ HandleCommandL( ECmdLoadTestSet );
+ break;
+ }
+ }
+ }
+
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::DoActivateL
+//
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestSetBaseMenu: DoActivateL"));
+ //message = _L("eng.open ret:");
+ //message.AppendNum( ret , EDecimal );
+ //AppUi->iLogger->Log( message );
+ iContainer = new (ELeave) CTestSetBaseMenuContainer;
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect(), this );
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestSetBaseMenu: container constructed"));
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTSET_BASE);
+ iNaviDecorator = np->CreateNavigationLabelL( reader );
+ CleanupStack::PopAndDestroy(); // resource reader
+ np->PushL(*iNaviDecorator);
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::DoDeactivate
+//
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ iContainer->SaveActiveLine();
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetInsertMenuContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetInsertMenuContainer class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h> // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <aknnotewrappers.h>
+
+#include <eikclbd.h> // CColumnListBoxData
+
+#include "TestSetInsertMenuContainer.h"
+#include "TestSetInsertMenuView.h"
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::ConstructL
+//
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetInsertMenuContainer: ConstructL"));
+
+ iParentView = (CTestSetInsertMenuView*)aListBoxObserver;
+ CreateWindowL();
+
+ iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+ iTestCasesInView.Reset();
+ //((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetInsertMenuContainer: iTCInV Reset"));
+
+ iListBox = CMenuListBox::NewL(ETestSetInsertMenuViewId);
+ iListBox->SetContainerWindowL( *this );
+ iListBox->SetListBoxObserver( aListBoxObserver /*this*/ ); // jos peritty MEikListBoxObserver:sta
+ iListBox->ConstructL(this, EAknListBoxMarkableList /*EAknListBoxSelectionList*/);
+
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetInsertMenuContainer: ListBox constructed"));
+
+ //Create Scroller control for ListBox and set its visibility
+ iListBox->CreateScrollBarFrameL(ETrue);
+ iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+ iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+
+ if ( iUIStore )
+ {
+ RRefArray<CTestInfo> allCases;
+ TInt ret = iUIStore->TestCases( allCases );
+ if( KErrNone != ret )
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("iUIStore->TestCases() fails"));
+ allCases.Reset();
+ allCases.Close();
+ User::Leave( ret );
+ }
+
+ const TInt KTestCaseCount = allCases.Count();
+ for (TInt i=0; i < KTestCaseCount; i++)
+ {
+ iTestCasesInView.Append( &allCases[i] );
+ }
+
+ iListBoxModel = CTestCaseListBoxModel::NewL(&iTestCasesInView);
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetInsertMenuContainer: ListBox model"));
+
+ iListBox->Model()->SetItemTextArray(iListBoxModel);
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetInsertMenuContainer: ListBox model set"));
+
+ allCases.Reset();
+ allCases.Close();
+ }
+ else
+ {
+ //User::Leave( syy?? )
+ }
+
+ // Creates graphic.
+ SetGraphicIconL( iListBox );
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetInsertMenuContainer: icons created"));
+
+ iListBox->ActivateL();
+ ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+ SetRect(aRect);
+ ActivateL();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::~CTestSetInsertMenuContainer
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetInsertMenuContainer::~CTestSetInsertMenuContainer()
+ {
+ //iTestCasesInView.Close(); // does not delete objects whose pointers are contained in the array
+ //delete iListBox;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::SizeChanged
+//
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuContainer::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetInsertMenuContainer::CountComponentControls() const
+ {
+ return 1; // return nbr of controls inside this container
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestSetInsertMenuContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::Draw
+//
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuContainer::Draw(const TRect& /*aRect*/) const
+ {
+ // CWindowGc& gc = SystemGc();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::OfferKeyEventL
+//
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestSetInsertMenuContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType )
+ {
+ if (aType != EEventKey)
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ if (iListBox)
+ {
+ //if multiple items selected
+ if ( iListBox->SelectionIndexes()->Count() > 0 )
+ {
+ TUint mask = 0x40488;
+
+ //if event is enter key,
+ //don´t send it to listbox
+ if ( aKeyEvent.iScanCode == 0xa7
+ && ( aKeyEvent.iModifiers & mask ) == 0 )
+ {
+ iParentView->HandleListBoxEventL( iListBox, MEikListBoxObserver::EEventEnterKeyPressed );
+ return EKeyWasConsumed;
+ }
+ }
+
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ else
+ {
+ return EKeyWasNotConsumed;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuContainer::SaveActiveLine()
+ {
+ ((CMenuListBox*)iListBox)->SaveFocusPosition();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetInsertMenuView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,399 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetInsertMenuView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <eikmenub.h>
+#include <aknViewAppUi.h>
+#include <aknlistquerydialog.h>
+#include <aknnotewrappers.h>
+#include <barsread.h> //TResourceReader
+#include <Stifui.rsg>
+#include "TestSetInsertMenuView.h"
+#include "TestSetInsertMenuContainer.h"
+#include "TestSetMenuView.h"
+#include "AppUIAppUi.h"
+#include "Stifui.hrh"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::ConstructL
+//
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::ConstructL()
+ {
+ CView::ConstructL();
+ BaseConstructL( R_INSERT_TESTCASES_VIEW );
+ iCurrentTestCase = 0;
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::~CTestSetInsertMenuView
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetInsertMenuView::~CTestSetInsertMenuView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::Id
+//
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestSetInsertMenuView::Id() const
+ {
+ return TUid::Uid(ETestSetInsertMenuViewId);
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::HandleCommandL
+//
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::HandleCommandL(TInt aCommand)
+ {
+ if ( aCommand >= ECmdFilterByModule && aCommand < ECmdFilterByTestCaseFile ) // 0x1000 - 0x1FFF
+ {
+ TInt moduleNumber = aCommand - ECmdFilterByModule;
+ RRefArray<TDesC> allModules;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( allModules );
+ if( KErrNone != ret )
+ {
+ allModules.Reset();
+ allModules.Close();
+ User::Leave( ret );
+ }
+ TName moduleName = allModules[ moduleNumber ];
+
+ iContainer->FilterCasesByModuleL( moduleName );
+
+ allModules.Reset();
+ allModules.Close();
+ }
+ else if ( aCommand >= ECmdFilterByTestCaseFile && aCommand < ECmdNOFiltering )
+ {
+ TInt testCaseFileNumber = aCommand - ECmdFilterByTestCaseFile;
+ RRefArray<TDesC> allTestCases;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( allTestCases );
+ if( KErrNone != ret )
+ {
+ allTestCases.Reset();
+ allTestCases.Close();
+ User::Leave( ret );
+ }
+ TFileName testCaseFileName = allTestCases[ testCaseFileNumber ];
+
+ iContainer->FilterCasesByTCFileNameL( testCaseFileName );
+
+ allTestCases.Reset();
+ allTestCases.Close();
+ }
+ else if ( aCommand == ECmdNOFiltering )
+ {
+ iContainer->NoFilteringL();
+ }
+ else if ( aCommand == EAknCmdMark || aCommand == EAknCmdUnmark
+ || aCommand == EAknMarkAll || aCommand == EAknUnmarkAll )
+ {
+ iContainer->HandleMarkCommandL( aCommand );
+ }
+ else
+ {
+ switch ( aCommand )
+ {
+ case ECmdInsertSelectedCases:
+ {
+ ShowInsertCasesDialogL();
+ break;
+ }
+ case EAknSoftkeyCancel:
+ {
+ //iCurrentTestCase = 0;
+ ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(EAppUIGoToTestSetsMenu);
+ break;
+ }
+ default:
+ {
+ AppUi()->HandleCommandL( aCommand );
+ break;
+ }
+ }
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::DoActivateL
+//
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestSetInsertMenuView: DoActivateL"));
+ //message = _L("eng.open ret:");
+ //message.AppendNum( ret , EDecimal );
+ //AppUi()->iLogger->Log( message );
+ iContainer = new (ELeave) CTestSetInsertMenuContainer;
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect(), this );
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestSetInsertMenuView: container constructed"));
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+
+ //testing
+ iContainer->SetCurrentItemIndex(iCurrentTestCase);
+
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTSET_INSERT);
+ iNaviDecorator = np->CreateNavigationLabelL( reader );
+ CleanupStack::PopAndDestroy(); // resource reader
+ np->PushL(*iNaviDecorator);
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::DoDeactivate
+//
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ iContainer->SaveActiveLine();
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::DynInitMenuPaneL
+//
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::DynInitMenuPaneL(
+ TInt aResourceId, CEikMenuPane* aMenuPane)
+ {
+
+ // Test modules are added to filter by test module submenu if the submenu is opened
+ if (R_APPUI_FILTERBYMODULES_MENU == aResourceId)
+ {
+ RRefArray<TDesC> modules;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( modules );
+ if( KErrNone != ret )
+ {
+ modules.Reset();
+ modules.Close();
+ User::Leave( ret );
+ }
+
+ TInt moduleCount = modules.Count();
+
+ TInt i;
+ CEikMenuPaneItem::SData item;
+
+ item.iCommandId = ECmdFilterByModule;
+ item.iFlags = 0;
+ item.iCascadeId = 0;
+
+ for (i = 0; i < moduleCount; i++)
+ {
+ //item.iText = modules[i].iModuleName;
+ item.iText = modules[i];
+ aMenuPane->AddMenuItemL(item);
+ item.iCommandId++; // command IDs 0x1000 - 0x1FFF are reserved for modules in hrh file
+ }
+
+ modules.Reset();
+ modules.Close();
+
+ }
+
+ // Test case files are added to filter by test case file submenu if the submenu is opened
+ if (R_APPUI_FILTER_BY_TESTCASEFILE_MENU == aResourceId)
+ {
+ RRefArray<TDesC> testCaseFiles;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( testCaseFiles );
+ if( KErrNone != ret )
+ {
+ testCaseFiles.Reset();
+ testCaseFiles.Close();
+ User::Leave( ret );
+ }
+
+ TInt testCaseFileCount = testCaseFiles.Count();
+
+ TInt i;
+ CEikMenuPaneItem::SData item;
+
+ item.iCommandId = ECmdFilterByTestCaseFile;
+ item.iFlags = 0;
+ item.iCascadeId = 0;
+
+ for (i = 0; i < testCaseFileCount; i++)
+ {
+ item.iText = testCaseFiles[i];
+ aMenuPane->AddMenuItemL(item);
+ item.iCommandId++; // command IDs 0x2000 - 0x2FFF are reserved for test case files in hrh file
+ }
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::HandleListBoxEventL
+//
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+ {
+
+ if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+ {
+ ShowInsertCasesDialogL();
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::ShowInsertCasesDialogL
+//
+// Show confirmation dialog for inserting test cases.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::ShowInsertCasesDialogL()
+ {
+ TInt i(0);
+ TBuf<50> message;
+ CEikListBox* listBox = iContainer->ListBox();
+ TInt count = listBox->SelectionIndexes()->Count();
+
+ if ( count > 0 )
+ {
+ CEikonEnv::Static()->ReadResource( message, R_INSERT_CONFIRMATION_QUESTION );
+
+ CAknQueryDialog * dlg = CAknQueryDialog::NewL(CAknQueryDialog::ENoTone);
+ if ( dlg->ExecuteLD( R_GENERAL_CONFIRMATION_DIALOG, message ) )
+ {
+ CEikListBox* newListBox = iContainer->ListBox();
+ TInt newCount = newListBox->SelectionIndexes()->Count();
+ RArray<TInt> selectedIndices;
+ CleanupClosePushL( selectedIndices );
+ if ( newCount > 0 )
+ {
+ for( i = 0; i < newCount; i++ )
+ {
+ selectedIndices.InsertInOrder( (*newListBox->SelectionIndexes())[i] );
+ }
+
+ AddCasesToTestSet( selectedIndices );
+ // Test cases added, set save needed flag to true.
+ ((CTestSetMenuView*)AppUi()->View(
+ TUid::Uid(ETestSetMenuViewId) ))->SetSaveNeeded(ETrue);
+ }
+ CleanupStack::PopAndDestroy();
+
+ // Test cases added -> go to test set menu
+ AppUi()->HandleCommandL(EAppUIGoBack);
+ }
+ }
+ else
+ {
+ CAknWarningNote* dialog = new(ELeave)CAknWarningNote();
+ CEikonEnv::Static()->ReadResource( message, R_INSERT_NOCASES_TEXT );
+ dialog->ExecuteLD(message);
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::AddCasesToTestSet
+//
+// Adds selected test cases to the current test set.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::AddCasesToTestSet( RArray<TInt> aSelectedIndexes )
+ {
+ TInt ret(0);
+ TInt i(0);
+ RRefArray<CTestInfo> allCases;
+ CTestSetMenuView* testSetMenuView =
+ (CTestSetMenuView*)((CAppUIAppUi*)AppUi())->View( TUid::Uid(ETestSetMenuViewId) );
+
+ ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCases(allCases);
+
+ for ( i = 0; i < aSelectedIndexes.Count(); i++ )
+ {
+ ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->AddToTestSet(
+ testSetMenuView->CurrentTestSet(),
+ allCases[ aSelectedIndexes[i] ] );
+ }
+ if( ret != KErrNone )
+ {
+ RDebug::Print( _L("AddCasesToTestSet failed with value: %d"), ret );
+ }
+
+ allCases.Reset();
+ allCases.Close();
+
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetMenuContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,486 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetMenuContainer class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h> // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <aknnotewrappers.h>
+
+#include <eikclbd.h> // CColumnListBoxData
+
+#include "TestSetMenuContainer.h"
+#include "TestSetMenuView.h"
+#include "StartCasesContainer.h"
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::ConstructL
+//
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetMenuContainer: ConstructL"));
+
+ iParentView = (CTestSetMenuView*)aListBoxObserver;
+ CreateWindowL();
+
+ iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+ iTestCasesInView.Reset();
+ //((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetMenuContainer: iTCInV Reset"));
+
+ iListBox = CMenuListBox::NewL(ETestSetMenuViewId);
+ iListBox->SetContainerWindowL( *this );
+ iListBox->SetListBoxObserver( aListBoxObserver /*this*/ ); // jos peritty MEikListBoxObserver:sta
+ iListBox->ConstructL(this, EAknListBoxMarkableList /*EAknListBoxSelectionList*/);
+
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetMenuContainer: ListBox constructed"));
+
+ //Create Scroller control for ListBox and set its visibility
+ iListBox->CreateScrollBarFrameL(ETrue);
+ iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+ iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+ iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);
+ iListBox->HandleItemAdditionL();
+
+ if ( iUIStore )
+ {
+ //RRefArray<const CTestInfo> allCases;
+ //CTestSetInfo* testSetInfo;
+ //IMPORT_C const CTestSetInfo& TestSetL( const TDesC& aSetName );
+
+ TPtrC ptr = iParentView->CurrentTestSet();
+
+ const CTestSetInfo* testSetInfo =
+ &iUIStore->TestSetL( ptr );
+
+ //inline const RRefArray<const CTestInfo>& TestCases() const
+ const RRefArray<const CTestInfo>* allCases = &testSetInfo->TestCases();
+
+ /*if( ret != KErrNone )
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("iUIStore->TestCases() fails"));
+ // Leave
+ }
+ */
+
+ const TInt KTestCaseCount = allCases->Count();
+ for (TInt i=0; i < KTestCaseCount; i++)
+ {
+ iTestCasesInView.Append( &allCases->operator[](i) );
+ }
+
+ iListBoxModel = CTestCaseListBoxModel::NewL(&iTestCasesInView);
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetMenuContainer: ListBox model"));
+
+ iListBox->Model()->SetItemTextArray(iListBoxModel);
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetMenuContainer: ListBox model set"));
+
+ }
+ else
+ {
+ //User::Leave( syy?? )
+ }
+
+ // Creates graphic.
+ SetGraphicIconL( iListBox );
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetMenuContainer: icons created"));
+
+ iListBox->ActivateL();
+ ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+ SetRect(aRect);
+ ActivateL();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::SetGraphicIconL
+//
+// Sets graphic icon using listbox as CEikColumnListBox.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::SetGraphicIconL( CEikColumnListBox* aListBox )
+ {
+ if ( aListBox )
+ {
+ // Creates gul icon.
+ CAknIconArray* iconArray = new(ELeave) CAknIconArray(1);
+ CleanupStack::PushL( iconArray );
+
+ GraphicIconL( iconArray ); // Appends graphic data.
+
+ // Sets graphics as ListBox icon.
+ aListBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray );
+
+ CleanupStack::Pop();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::CurrentItemIndex
+//
+// Returns current item index in list box.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetMenuContainer::CurrentItemIndex()
+ {
+ return iListBox->CurrentItemIndex();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::SetCurrentItemIndex
+//
+// Sets current item index in list box.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::SetCurrentItemIndex(TInt aCurrentTestCase)
+ {
+ iListBox->SetCurrentItemIndexAndDraw(aCurrentTestCase);
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::GraphicIconL
+//
+// Appends graphics data.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::GraphicIconL( CArrayPtr<CGulIcon>* aIcons )
+ {
+ if ( aIcons )
+ {
+ CFbsBitmap* markBitmap = NULL;
+ CFbsBitmap* markBitmapMask = NULL;
+
+ TRgb defaultColor;
+ defaultColor = CEikonEnv::Static()->Color(EColorControlText);
+
+ AknsUtils::CreateColorIconL(AknsUtils::SkinInstance(),
+ KAknsIIDQgnIndiMarkedAdd,
+ KAknsIIDQsnIconColors,
+ EAknsCIQsnIconColorsCG13,
+ markBitmap,
+ markBitmapMask,
+ AknIconUtils::AvkonIconFileName(),
+ EMbmAvkonQgn_indi_marked_add,
+ EMbmAvkonQgn_indi_marked_add_mask,
+ defaultColor );
+
+ CGulIcon* markIcon = CGulIcon::NewL(markBitmap,markBitmapMask);
+ aIcons->AppendL(markIcon);
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::~CTestSetMenuContainer
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetMenuContainer::~CTestSetMenuContainer()
+ {
+ iTestCasesInView.Close(); // does not delete objects whose pointers are contained in the array
+ delete iListBox;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::SizeChanged
+//
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetMenuContainer::CountComponentControls() const
+ {
+ return 1; // return nbr of controls inside this container
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestSetMenuContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::Draw
+//
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::Draw(const TRect& /*aRect*/) const
+ {
+ // CWindowGc& gc = SystemGc();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::SelectedTestCases
+//
+// Returns pointers to selected test cases.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::SelectedTestCases
+ (RPointerArray<CTestInfo>& aSelectedTestCases)
+ {
+ aSelectedTestCases.Append( iTestCasesInView[iListBox->CurrentItemIndex()] );
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::OfferKeyEventL
+//
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestSetMenuContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType )
+ {
+ if (aType != EEventKey)
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ if (iListBox)
+ {
+ //if multiple items selected
+ if ( iListBox->SelectionIndexes()->Count() > 0 )
+ {
+ TUint mask = 0x40488;
+
+ //if event is enter key,
+ //don´t send it to listbox
+ if ( aKeyEvent.iScanCode == 0xa7
+ && ( aKeyEvent.iModifiers & mask ) == 0 )
+ {
+ iParentView->HandleListBoxEventL( iListBox, MEikListBoxObserver::EEventEnterKeyPressed );
+ return EKeyWasConsumed;
+ }
+ }
+
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ else
+ {
+ return EKeyWasNotConsumed;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::HandleMarkCommandL
+//
+// Handles mark commands.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::HandleMarkCommandL( TInt aCommand )
+ {
+ if (iListBox)
+ {
+ AknSelectionService::HandleMarkableListProcessCommandL( aCommand, iListBox );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::ProcessCommandL
+//
+// Processes user commands.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::ProcessCommandL( TInt aCommand )
+ {
+ AknSelectionService::HandleMarkableListProcessCommandL( aCommand, iListBox );
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::SelectionListProcessCommandL
+//
+// Processes user commands.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::SelectionListProcessCommandL( TInt aCommand )
+ {
+ AknSelectionService::HandleSelectionListProcessCommandL( aCommand, iListBox );
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::FilterCasesByModuleL
+//
+// Show only testcases which are defined is specified module.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::FilterCasesByModuleL( TName aModuleName )
+ {
+ iTestCasesInView.Reset(); // Clear testCasesInView pointer array
+
+ RRefArray<CTestInfo> allCases;
+ TInt ret = iUIStore->TestCases( allCases );
+ if( KErrNone != ret )
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("FilterCasesByModuleL(): iUIStore->TestCases() fails"));
+ allCases.Reset();
+ allCases.Close();
+ User::Leave( ret );
+ }
+ const TInt KTestCaseCount = allCases.Count();
+ for( TInt i=0; i < KTestCaseCount; i++ )
+ {
+ if ( allCases[i].ModuleName() == aModuleName )
+ {
+ iTestCasesInView.Append( &( allCases[i] ) );
+ }
+ }
+ allCases.Reset();
+ allCases.Close();
+
+ iListBox->Reset();
+ iListBox->DrawNow();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::FilterCasesByTCFileNameL
+//
+// Show only testcases which are defined is specified test case file.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::FilterCasesByTCFileNameL(
+ TFileName aTestCaseFileName )
+ {
+
+ iTestCasesInView.Reset(); // Clear testCasesInView pointer array
+
+ RRefArray<CTestInfo> allCases;
+ TInt ret = iUIStore->TestCases( allCases );
+ if( KErrNone != ret )
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("FilterCasesByModuleL(): iUIStore->TestCases() fails"));
+ allCases.Reset();
+ allCases.Close();
+ User::Leave( ret );
+ }
+ const TInt KTestCaseCount = allCases.Count();
+ for( TInt i=0; i < KTestCaseCount; i++ )
+ {
+ if ( allCases[i].TestCaseFile() == aTestCaseFileName )
+ {
+ iTestCasesInView.Append( &( allCases[i] ) );
+ }
+ }
+
+ allCases.Reset();
+ allCases.Close();
+
+ iListBox->Reset();
+ iListBox->DrawNow();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::NoFilteringL
+//
+// Remove possible filtering of test cases -> show all test cases.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::NoFilteringL()
+ {
+ iTestCasesInView.Reset(); // Clear testCasesInView pointer array
+
+ RRefArray<CTestInfo> allCases;
+ TInt ret = iUIStore->TestCases( allCases );
+ if( KErrNone != ret )
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("FilterCasesByModuleL(): iUIStore->TestCases() fails"));
+ allCases.Reset();
+ allCases.Close();
+ User::Leave( ret );
+ }
+ const TInt KTestCaseCount = allCases.Count();
+
+ // Add all cases to iTestCasesInView pointer array
+ for( TInt i=0; i < KTestCaseCount; i++ )
+ {
+ iTestCasesInView.Append( &( allCases[i] ) );
+ }
+
+ allCases.Reset();
+ allCases.Close();
+
+ iListBox->Reset();
+ iListBox->DrawNow();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::RemoveListBoxItemsL
+//
+// Removes items from list box.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::RemoveListBoxItemL( TInt aSelected )
+ {
+ TInt currentItem(0);
+ TBool remCurr(EFalse);
+
+ currentItem = iListBox->CurrentItemIndex();
+ if( aSelected == currentItem )
+ {
+ remCurr = ETrue;
+ }
+
+ iTestCasesInView.Remove( aSelected );
+ AknListBoxUtils::HandleItemRemovalAndPositionHighlightL(iListBox, aSelected, remCurr);
+ iListBox->HandleItemAdditionL();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::SaveActiveLine()
+ {
+ ((CMenuListBox*)iListBox)->SaveFocusPosition();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetMenuView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,553 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetMenuView class ddefinition.
+*
+*/
+
+// INCLUDE FILES
+#include <eikmenub.h>
+#include <aknViewAppUi.h>
+#include <aknlistquerydialog.h>
+#include <aknnotewrappers.h>
+#include <barsread.h> //TResourceReader
+#include <Stifui.rsg>
+#include "TestSetMenuView.h"
+#include "TestSetMenuContainer.h"
+#include "AppUIAppUi.h"
+#include "Stifui.hrh"
+
+
+
+// ================= MEMBER FUNCTIONS =========================================
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::ConstructL
+//
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::ConstructL()
+ {
+ CView::ConstructL();
+ BaseConstructL( R_APPUI_TESTSETMENUVIEW );
+ iCurrentTestCase = 0;
+ iSaveNeeded = ETrue;
+ iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::~CTestSetMenuView
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetMenuView::~CTestSetMenuView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::Id
+//
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestSetMenuView::Id() const
+ {
+ return TUid::Uid(ETestSetMenuViewId);
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::HandleCommandL
+//
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::HandleCommandL(TInt aCommand)
+ {
+ if ( aCommand == EAknCmdMark || aCommand == EAknCmdUnmark
+ || aCommand == EAknMarkAll || aCommand == EAknUnmarkAll )
+ {
+ iContainer->HandleMarkCommandL( aCommand );
+ }
+ else
+ {
+ switch ( aCommand )
+ {
+ case ECmdStartTestSet:
+ {
+ const CTestSetInfo& testSetInfo =
+ iUIStore->TestSetL( iCurrentTestSet );
+ const RRefArray<const CTestInfo>* allCases =
+ &testSetInfo.TestCases();
+
+ TInt testCaseCount = allCases->Count();
+ if (testCaseCount > 0 )
+ {
+ StartTestSetL();
+ }
+ break;
+ }
+ case ECmdShowStartedTestSet:
+ {
+ AppUi()->HandleCommandL(ECmdShowStartedTestSet);
+ break;
+ }
+ case ECmdSaveTestSet:
+ {
+ SaveCurrentTestSetL();
+ break;
+ }
+ case ECmdInsertTestCases:
+ {
+ // iSaveNeeded is set from
+ // CTestSetInsertMenuView::ShowInsertCasesDialog()
+ //iSaveNeeded = ETrue;
+ AppUi()->HandleCommandL(ECmdInsertTestCases);
+ break;
+ }
+ case ECmdRemoveTestCases:
+ {
+ RemoveSelectedTestCasesL();
+ break;
+ }
+ case EAknSoftkeyBack:
+ {
+ //iCurrentTestCase = 0;
+ // AppUi()->HandleCommandL(ECmdLoadTestSet/*EAppUIGoToTestSetsMenu*/);
+ //( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(EAppUIGoToTestSetsMenu);
+ SaveCurrentTestSetL();
+ break;
+ }
+ default:
+ {
+ AppUi()->HandleCommandL( aCommand );
+ break;
+ }
+ }
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::DoActivateL
+//
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(
+ _L("TestSetMenuView: DoActivateL") );
+ iContainer = new (ELeave) CTestSetMenuContainer;
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect(), this );
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(
+ _L("TestSetMenuView: container constructed") );
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+
+ //testing
+ iContainer->SetCurrentItemIndex(iCurrentTestCase);
+
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknNavigationControlContainer* np =
+ (CAknNavigationControlContainer *)sp->ControlL(
+ TUid::Uid(EEikStatusPaneUidNavi));
+
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTSET );
+ iNaviDecorator = np->CreateNavigationLabelL( reader );
+ CleanupStack::PopAndDestroy(); // resource reader
+ np->PushL(*iNaviDecorator);
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::DoDeactivate
+//
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ iContainer->SaveActiveLine();
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::DynInitMenuPaneL
+//
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::DynInitMenuPaneL(
+ TInt aResourceId, CEikMenuPane* aMenuPane)
+ {
+
+ // Test modules are added to filter by test module submenu
+ // if the submenu is opened
+ if (R_APPUI_FILTERBYMODULES_MENU == aResourceId)
+ {
+ RRefArray<TDesC> modules;
+ TInt ret = iUIStore->Modules( modules );
+ if( KErrNone != ret )
+ {
+ modules.Reset();
+ modules.Close();
+ User::Leave( ret );
+ }
+
+ TInt moduleCount = modules.Count();
+
+ TInt i;
+ CEikMenuPaneItem::SData item;
+
+ item.iCommandId = ECmdFilterByModule;
+ item.iFlags = 0;
+ item.iCascadeId = 0;
+
+ for (i = 0; i < moduleCount; i++)
+ {
+ item.iText = modules[i];
+ aMenuPane->AddMenuItemL(item);
+ item.iCommandId++; // Command IDs 0x1000 - 0x1FFF are reserved
+ // for modules in hrh file.
+ }
+
+ modules.Reset();
+ modules.Close();
+ }
+
+ // Test case files are added to filter by test case file submenu
+ // if the submenu is opened.
+ if (R_APPUI_FILTER_BY_TESTCASEFILE_MENU == aResourceId)
+ {
+ RRefArray<TDesC> testCaseFiles;
+ TInt ret = iUIStore->TestCaseFiles( testCaseFiles );
+ if( KErrNone != ret )
+ {
+ testCaseFiles.Reset();
+ testCaseFiles.Close();
+ User::Leave( ret );
+ }
+
+ TInt testCaseFileCount = testCaseFiles.Count();
+
+ TInt i;
+ CEikMenuPaneItem::SData item;
+
+ item.iCommandId = ECmdFilterByTestCaseFile;
+ item.iFlags = 0;
+ item.iCascadeId = 0;
+
+ for (i = 0; i < testCaseFileCount; i++)
+ {
+ item.iText = testCaseFiles[i];
+ aMenuPane->AddMenuItemL(item);
+ item.iCommandId++; // Command IDs 0x2000 - 0x2FFF are reserved for
+ // test case files in hrh file.
+ }
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::HandleListBoxEventL
+//
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::HandleListBoxEventL(CEikListBox* /*aListBox*/,
+ TListBoxEvent aEventType)
+ {
+
+ if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+ {
+ const CTestSetInfo& testSetInfo =
+ iUIStore->TestSetL( iCurrentTestSet );
+ const RRefArray<const CTestInfo>* allCases = &testSetInfo.TestCases();
+
+ TInt testCaseCount = allCases->Count();
+ if (testCaseCount > 0 )
+ {
+ StartTestSetL();
+ }
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::CreateTestSet
+//
+// Creates new test set.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetMenuView::CreateTestSetL( const TDesC& aTestSetName )
+ {
+ TInt error = 0;
+ TBuf<100> message;
+
+ _LIT(KPath, "c:\\TestFramework\\");
+ RFs fs;
+ User::LeaveIfError(fs.Connect());
+ CleanupClosePushL(fs);
+ TEntry entry;
+ // we check if the c:\testframework directory exists
+ // It is mandatory for this dir to exist if we want to save a test set.
+ // This dir must be localised on the C drive of the device
+ if(fs.Entry(KPath, entry) != KErrNone)
+ { // if the dir does not exist
+ TInt err = fs.MkDirAll(KPath); // we create it
+ if(err != KErrNone)
+ { // if of any reason it was impossible to create the dir - inform user about it
+ CAknInformationNote* note = new (ELeave) CAknInformationNote(ETrue);
+ note->ExecuteLD( _L("Could not create c:\\TestFramework dir!") );
+ }
+ }
+ CleanupStack::PopAndDestroy(&fs); // close and remove RFs object
+
+ error = iUIStore->LoadTestSet( aTestSetName );
+
+ // If testset is either active or already created and saved.
+ /* if ( KErrNone == error)// || KErrAlreadyExists == error )
+ {
+ CEikonEnv::Static()->ReadResource( message,
+ R_OVERWRITE_TESTSET_QUESTION );
+ CAknQueryDialog * dlg =
+ CAknQueryDialog::NewL(CAknQueryDialog::ENoTone);
+ // Confirm overwrite
+ if ( dlg->ExecuteLD( R_GENERAL_CONFIRMATION_DIALOG, message ) )
+ {
+ error = iUIStore->RemoveTestSet( aTestSetName );
+ error = iUIStore->CreateTestSet( aTestSetName );
+ if ( error == KErrNone )
+ {
+ iCurrentTestSet = aTestSetName;
+ iSaveNeeded = ETrue;
+ }
+ }
+ // Else load saved default test set
+ else
+ {
+ iSaveNeeded = EFalse;
+ iCurrentTestSet = aTestSetName;
+ error = KErrAlreadyExists;
+ }
+ }
+ else if ( KErrNotFound == error )
+ {
+ error = iUIStore->CreateTestSet( aTestSetName );
+ if ( KErrNone == error )
+ {
+ iCurrentTestSet = aTestSetName;
+ iSaveNeeded = ETrue;
+ }
+ }
+ else if ( KErrPathNotFound == error )
+ {
+ error = iUIStore->CreateTestSet( aTestSetName );
+ iCurrentTestSet = aTestSetName;
+ iSaveNeeded = EFalse;
+ }
+ else
+ {
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("Test set creation fails with error: %d"), error );
+ CAknInformationNote* informationNote = new (ELeave) CAknInformationNote(ETrue);
+ informationNote->ExecuteLD( _L("UNDEFINED ERROR!") );
+ }*/
+
+ error = iUIStore->CreateTestSet( aTestSetName );
+ iCurrentTestSet = aTestSetName;
+ iSaveNeeded = ETrue;
+ return error;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::LoadTestSetL
+//
+// Loads saved test set.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetMenuView::LoadTestSetL( const TDesC& aTestSetName )
+ {
+ TInt error = 0;
+ TBuf<100> message;
+ error = iUIStore->LoadTestSet( aTestSetName );
+ if ( KErrNone == error || KErrAlreadyExists == error )
+ {
+ iCurrentTestSet = aTestSetName;
+ iSaveNeeded = EFalse;
+ }
+ else
+ {
+ CEikonEnv::Static()->ReadResource( message,
+ R_LOAD_TESTSET_FAILED );
+
+ CAknInformationNote* informationNote = new (ELeave) CAknInformationNote(ETrue);
+ informationNote->ExecuteLD(message);
+ }
+
+ return error;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::SaveCurrentTestSet
+//
+// Saves current test set.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetMenuView::SaveCurrentTestSetL()
+ {
+ TInt error = 0;
+ TBuf<100> message;
+
+ CEikonEnv::Static()->ReadResource( message,
+ R_SAVE_TESTSET_QUESTION );
+
+ CAknQueryDialog * dlg =
+ CAknQueryDialog::NewL(CAknQueryDialog::ENoTone);
+
+ if ( dlg->ExecuteLD( R_GENERAL_CONFIRMATION_DIALOG, message ) )
+ {
+ error = iUIStore->SaveTestSet2( iCurrentTestSet );
+ iSaveNeeded = EFalse;
+
+ }
+ AppUi()->HandleCommandL(EAppUIGoBack);
+
+ return error;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::RemoveActiveTestSet
+//
+// Removes current test set.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetMenuView::RemoveActiveTestSet()
+ {
+ TInt error = 0;
+
+ error = iUIStore->RemoveTestSet( iCurrentTestSet );
+
+ return error;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::StartTestSetL
+//
+// Shows confirmation dialog and verify if user really want to start test set.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::StartTestSetL()
+ {
+ _LIT( KErrorStartingTestSet,
+ "TestSetMenuView: StartTestSetL() fails (%d)" );
+
+ TInt ret(KErrNone);
+ TInt index(0);
+ TInt selectedItem(0);
+
+ // Default mode is parallel.
+ CStartedTestSet::TSetType mode = CStartedTestSet::ESetParallel;
+
+ CAknListQueryDialog* startDialog =
+ new (ELeave) CAknListQueryDialog(&selectedItem);
+
+ // Show confirmation dialog.
+ if ( startDialog->ExecuteLD(R_START_MULTIPLE_TESTCASES_LIST_QUERY) )
+ {
+ index = ((CAppUIAppUi*)AppUi())->iStartedTestSet;
+ // Check mode
+ if ( 1 == selectedItem )
+ {
+ mode = CStartedTestSet::ESetSequential;
+ }
+
+ // Start test set cases.
+ ret = iUIStore->StartTestSet(
+ iUIStore->TestSetL( iCurrentTestSet ), index, mode );
+
+ if ( ret != KErrNone )
+ {
+ ((CAppUIAppUi*)AppUi())->iStartedTestSet = -1;
+ ((CAppUIAppUi*)AppUi())->iLogger->Log(
+ KErrorStartingTestSet, ret );
+ }
+ else
+ {
+ ((CAppUIAppUi*)AppUi())->iStartedTestSet = index;
+ }
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::RemoveSelectedTestCasesL
+//
+// Removes marked test cases from test set.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::RemoveSelectedTestCasesL()
+ {
+ TInt positionToRemove(0);
+
+ const CTestSetInfo& testSetInfo = iUIStore->TestSetL( iCurrentTestSet );
+ const RRefArray<const CTestInfo>* allCases = &testSetInfo.TestCases();
+ CEikListBox* listBox = iContainer->ListBox();
+
+ iSaveNeeded = ETrue;
+ positionToRemove = listBox->CurrentItemIndex();
+ // Remove selected test case from test set.
+ TInt ret = iUIStore->RemoveFromTestSet(iCurrentTestSet, allCases->operator[](positionToRemove));
+ iContainer->RemoveListBoxItemL(positionToRemove);
+
+ if( ret != KErrNone )
+ {
+ RDebug::Print( _L("RemoveFromTestSet failed with value: %d"), ret );
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetStartedCasesContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,465 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetStartedCasesContainer
+* class definition.
+*
+*/
+
+// INCLUDE FILES
+
+#include <aknlists.h> // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <badesca.h> // CDesCArray
+#include <eikclbd.h> // CColumnListBoxData
+#include <aknnotewrappers.h>
+
+#include <Stifui.rsg>
+
+//#include "UIStoreIf.h"
+//#include "UIStore.h"
+//#include "UIEngine.h"
+//#include "UIEngineContainer.h"
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "TestSetStartedCasesContainer.h"
+#include "ShowStartedCasesContainer.h"
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include "MenuListBox.h"
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::ConstructL
+//
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+ {
+ CreateWindowL();
+
+ iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+ iListBox = CMenuListBox::NewL(ETestSetStartedCasesViewId); /*CAknSingleStyleListBox();*/
+ iListBox->SetContainerWindowL( *this );
+ iListBox->SetListBoxObserver( aListBoxObserver );
+ iListBox->ConstructL(this, EAknListBoxSelectionList);
+
+ //Create Scroller control for ListBox and set its visibility
+ iListBox->CreateScrollBarFrameL(ETrue);
+ iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+
+ if ( iUIStore )
+ {
+
+ iListBoxModel = CStartedTestsListBoxModel::NewL( &iStartedTestsPtrs );
+ iListBox->Model()->SetItemTextArray(iListBoxModel);
+ ConstructListBoxModelL();
+ iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);
+ iListBox->HandleItemAdditionL();
+
+ }
+ else
+ {
+ //User::Leave( syy?? )
+ }
+ iListBox->ActivateL();
+ ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+ SetRect(aRect);
+ ActivateL();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::ConstructListBoxModelL
+//
+// Constructs list box model without any filtering.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::ConstructListBoxModelL()
+ {
+ TInt items(0);
+ TInt index = ((CAppUIAppUi*)iCoeEnv->AppUi())->iStartedTestSet;
+
+ // Check if there is started test sets and if there is,
+ // show test set´s info.
+ if ( index != -1 )
+ {
+ const RRefArray<CStartedTestCase>* startedTestCases;
+ CStartedTestSet* startedTestSet =
+ &iUIStore->StartedTestSetL( index );
+ startedTestCases = &startedTestSet->TestCases();
+
+ const TInt KStartedCaseCount = startedTestCases->Count();
+
+ items = iStartedTestsPtrs.Count();
+ iStartedTestsPtrs.Reset(); // Remove all pointers (does not delete objects)
+ iListBox->HandleItemRemovalL();
+
+ const TInt KSelectedMode = ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+
+ // Loop through all started cases
+ for( TInt i=0; i < KStartedCaseCount; i++ )
+ {
+ switch ( KSelectedMode )
+ {
+ case EShowAllStartedCases:
+ {
+ iStartedTestsPtrs.Append( startedTestCases->operator[](i) );
+ break;
+ }
+ case EShowOngoingCases:
+ {
+ // Note: PAUSE IS ALSO RUNNIN STATUS
+ if ( startedTestCases->operator[](i).Status() & CUIStoreIf::EStatusRunning )
+ {
+ iStartedTestsPtrs.Append( startedTestCases->operator[](i) );
+ }
+ break;
+ }
+ case EShowPassedCases:
+ {
+ if ( startedTestCases->operator[](i).Status() & CUIStoreIf::EStatusPassed )
+ {
+ iStartedTestsPtrs.Append( startedTestCases->operator[](i) );
+ }
+ break;
+ }
+ case EShowPausedCases:
+ {
+ if ( startedTestCases->operator[](i).Status() & CUIStoreIf::EStatusRunning )
+ {
+ if( startedTestCases->operator[](i).UIEngineContainer().State() == CUIEngineContainer::EPaused )
+ {
+ iStartedTestsPtrs.Append( startedTestCases->operator[](i) );
+ }
+ }
+ break;
+ }
+ case EShowFailedCases:
+ {
+ if ( startedTestCases->operator[](i).Status() & CUIStoreIf::EStatusFailed )
+ {
+ iStartedTestsPtrs.Append( startedTestCases->operator[](i) );
+ }
+ break;
+ }
+ case EShowCrashedAbortedCases:
+ {
+ if ( startedTestCases->operator[](i).Status() & CUIStoreIf::EStatusAborted
+ ||
+ startedTestCases->operator[](i).Status() & CUIStoreIf::EStatusCrashed)
+ {
+ iStartedTestsPtrs.Append( startedTestCases->operator[](i) );
+ }
+ break;
+ }
+ }
+ }
+
+ if ( items < iStartedTestsPtrs.Count() )
+ {
+ iListBox->HandleItemAdditionL();
+ }
+ else
+ {
+ iListBox->HandleItemRemovalL();
+ }
+
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::~CTestSetStartedCasesContainer
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetStartedCasesContainer::~CTestSetStartedCasesContainer()
+ {
+ delete iListBox;
+
+ iStartedTestsPtrs.Close(); // does not delete objects whose pointers are contained in the array
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::SizeChanged
+//
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::SizeChanged()
+ {
+ if ( iListBox )
+ {
+ iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetStartedCasesContainer::CountComponentControls() const
+ {
+ return 1; // return nbr of controls inside this container
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestSetStartedCasesContainer::ComponentControl(TInt aIndex) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iListBox;
+ default:
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::Draw
+//
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::Draw(const TRect& /*aRect*/) const
+ {
+ // CWindowGc& gc = SystemGc();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::OfferKeyEventL
+//
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestSetStartedCasesContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType)
+ {
+ if (aType != EEventKey)
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ if (iListBox)
+ {
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ else
+ {
+ return EKeyWasNotConsumed;
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::SelectedTestCase
+//
+// Returns reference to currently selected test case in view (listbox).
+// ----------------------------------------------------------------------------
+//
+CStartedTestCase* CTestSetStartedCasesContainer::SelectedTestCase()
+ {
+ if ( iStartedTestsPtrs.Count() > 0 )
+ {
+ return &(iStartedTestsPtrs[ iListBox->CurrentItemIndex() ]);
+ }
+ else
+ {
+ return NULL;
+ }
+/*
+ //if ( iListBox->ItemExists(0) ) // Check that list box is not empty
+ if ( ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount() ) // Check that list box is not empty
+ {
+ return &(iStartedTestsPtrs[ iListBox->CurrentItemIndex() ]);
+ }
+ else
+ {
+ return NULL;
+ }
+*/
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::DrawListBox
+//
+// Draws the list box.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::DrawListBox()
+ {
+ if ( iListBox )
+ {
+ iListBox->DrawNow();
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::HandleItemAdditionL
+//
+// Handles the addition of an item to the model.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::HandleItemAdditionL()
+ {
+ iListBox->HandleItemAdditionL();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::HandleItemRemovalL
+//
+// Handles the removal of an item from the model.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::HandleItemRemovalL()
+ {
+ //TInt itemIndexBeforeRemoval = iListBox->CurrentItemIndex();
+
+ iListBox->HandleItemRemovalL();
+
+ // HandleItemRemovalL "loses selection" if current item is removed
+ // -> we have to check it and set one item as current item to make it possible for
+ // user to select one item from items left after remove
+ if ( iListBox->CurrentItemIndex() == -1 ) // No item selected
+ if ( ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount() > 0 ) // there are items
+ SetCurrentItemIndex(0);
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::TestsInViewCount
+//
+// Returns count of test cases in view.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetStartedCasesContainer::TestsInViewCount()
+ {
+ return ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::CurrentTestCase
+//
+// Returns pointer to currently selected test case.
+// ----------------------------------------------------------------------------
+//
+CStartedTestCase* CTestSetStartedCasesContainer::CurrentTestCase()
+ {
+ return &iStartedTestsPtrs[ iListBox->CurrentItemIndex() ];
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::CurrentItemIndex
+//
+// Gets the index number of the current item in the view.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetStartedCasesContainer::CurrentItemIndex()
+ {
+ return iListBox->CurrentItemIndex();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::SetCurrentItemIndex
+//
+// Sets the current item.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::SetCurrentItemIndex(TInt aIndex)
+ {
+ TInt itemCount = ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount();
+ if ( aIndex < itemCount )
+ {
+ iListBox->SetCurrentItemIndex(aIndex);
+ }
+ else
+ {
+ iListBox->SetCurrentItemIndex(itemCount);
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::ResetListBox
+//
+// Resets the selection indices, top and current item indices,
+// the selection, and the horizontal scroll offset of this list box.
+// This function does not redraw the list box.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::ResetListBox()
+ {
+ iListBox->Reset();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::RemoveSelectedExecutionsL
+//
+// Removes items from list box.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::RemoveSelectedExecutionsL()
+ {
+ TInt indexOfRemovedExecution = 0;
+ iStartedTestsPtrs.Remove(indexOfRemovedExecution);
+ HandleItemRemovalL();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::RemoveAllExecutionsInViewL
+//
+// Removes all started test cases from list box.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::RemoveAllExecutionsInViewL()
+ {
+ iStartedTestsPtrs.Reset(); //Empties the array, does not delete the objects whose pointers are contained in the array
+ HandleItemRemovalL();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::SaveActiveLine()
+ {
+ ((CMenuListBox*)iListBox)->SaveFocusPosition();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetStartedCasesView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,485 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestSetStartedCasesView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <eikmenub.h>
+#include <aknViewAppUi.h>
+#include <barsread.h> //TResourceReader
+#include <Stifui.rsg>
+
+//#include "UIEngineContainer.h"
+#include <stifinternal/UIEngineContainer.h>
+
+#include "Stifui.hrh"
+
+#include "TestSetStartedCasesView.h"
+#include "TestSetStartedCasesContainer.h"
+#include "AppUIAppUi.h"
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::ConstructL
+//
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::ConstructL()
+ {
+ CView::ConstructL();
+ BaseConstructL( R_TESTSET_STARTEDCASESVIEW );
+ iFilterModule.Zero();
+ iFilterTestCaseFile.Zero();
+ iSelectedTestCase=0;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::~CTestSetStartedCasesView
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetStartedCasesView::~CTestSetStartedCasesView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::Id
+//
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestSetStartedCasesView::Id() const
+ {
+ return TUid::Uid(ETestSetStartedCasesViewId);
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::HandleCommandL
+//
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::HandleCommandL(TInt aCommand)
+ {
+ TBool refreshListBox = EFalse;
+ // Handle rest possible commands
+ switch ( aCommand )
+ {
+ case ECmdShowAllStartedCases:
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode = EShowAllStartedCases;
+ refreshListBox = ETrue;
+ break;
+ }
+ case ECmdShowOngoingCases:
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode = EShowOngoingCases;
+ refreshListBox = ETrue;
+ break;
+ }
+ case ECmdShowPausedCases:
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode = EShowPausedCases;
+ refreshListBox = ETrue;
+ break;
+ }
+ case ECmdShowPassedCases:
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode = EShowPassedCases;
+ refreshListBox = ETrue;
+ break;
+ }
+ case ECmdShowFailedCases:
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode = EShowFailedCases;
+ refreshListBox = ETrue;
+ break;
+ }
+ case ECmdShowCrashedAbortedCases:
+ {
+ ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode = EShowCrashedAbortedCases;
+ refreshListBox = ETrue;
+ break;
+ }
+ case ECmdShowStatistics:
+ {
+ //EShowStatistics
+ TMessageBoxUtil::ShowNotImplementedYetL();
+ break;
+ }
+ case ECmdViewOutput:
+ {
+ ViewTestCaseOutputL();
+ break;
+ }
+ case ECmdPauseTestCase:
+ {
+ CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+ if ( NULL != startedTestCase )
+ {
+ startedTestCase->UIEngineContainer().PauseTest();
+ }
+ break;
+ }
+ case ECmdResumeTestCase:
+ {
+ CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+ if ( NULL != startedTestCase )
+ {
+ startedTestCase->UIEngineContainer().ResumeTest();
+ }
+ break;
+ }
+ case ECmdAbortTestCase:
+ {
+ CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+ if ( NULL != startedTestCase )
+ {
+ startedTestCase->UIEngineContainer().CancelTest();
+ }
+ break;
+ }
+ case EAknSoftkeyOk:
+ {
+ iEikonEnv->InfoMsg( _L("TestCase Menu ok") );
+ break;
+ }
+ case EAknSoftkeyBack:
+ {
+ // Remove possible filterings so that they does not affect when coming again to this view
+ iFilterModule.Zero();
+ iFilterTestCaseFile.Zero();
+ iSelectedTestCase=0; //Reset selected test case information
+ AppUi()->HandleCommandL(EAppUIGoBack);
+ break;
+ }
+ default:
+ {
+ AppUi()->HandleCommandL( aCommand );
+ break;
+ }
+ }
+
+ if ( refreshListBox )
+ {
+ RefreshNaviTitleL();
+ iContainer->ConstructListBoxModelL();
+ iContainer->DrawListBox();
+ }
+
+ }
+
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::RefreshNaviTitleL
+//
+// Refreshes view name shown in the navi pane.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::RefreshNaviTitleL()
+ {
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+ TResourceReader reader;
+
+ switch ( ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode )
+ {
+ case EShowAllStartedCases:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED);
+ break;
+ case EShowOngoingCases:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_ONGOING);
+ break;
+ case EShowPausedCases:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_PAUSED);
+ break;
+ case EShowPassedCases:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_PASSED);
+ break;
+ case EShowFailedCases:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_FAILED);
+ break;
+ case EShowCrashedAbortedCases:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_CRASHED_ABORTED);
+ break;
+ default:
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTSET);
+ break;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ iNaviDecorator = np->CreateNavigationLabelL( reader );
+ CleanupStack::PopAndDestroy(); // resource reader
+ np->PushL(*iNaviDecorator);
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::HandleListBoxEventL
+//
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+ {
+ if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+ {
+ ViewTestCaseOutputL();
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::ViewTestCaseOutput
+//
+// Shows outputs of test case which is selected in Container.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::ViewTestCaseOutputL()
+ {
+ iSelectedTestCase = iContainer->CurrentItemIndex();
+
+ // Sets index of selected test case to AppUi
+ ( ( CAppUIAppUi* )AppUi() )->SetStartedTestCase( iContainer->CurrentTestCase() );
+
+ AppUi()->HandleCommandL(ECmdViewOutput);
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::DoActivateL
+//
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ iContainer = new (ELeave) CTestSetStartedCasesContainer;
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect(), this );
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+
+ if ( iSelectedTestCase )
+ iContainer->SetCurrentItemIndex(iSelectedTestCase);
+
+ iContainer->DrawListBox();
+
+ RefreshNaviTitleL();
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::DoDeactivate
+//
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ iContainer->SaveActiveLine();
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::DynInitMenuPaneL
+//
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::DynInitMenuPaneL(
+ TInt aResourceId, CEikMenuPane* aMenuPane)
+ {
+
+ // options menu
+ if ( R_TESTSET_STARTEDCASESVIEW_MENU == aResourceId )
+ {
+ CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+ if ( NULL != startedTestCase )
+ {
+ switch ( startedTestCase->Status() )
+ {
+ // test case running
+ case CUIStoreIf::EStatusRunning:
+ {
+ switch ( startedTestCase->UIEngineContainer().State() )
+ {
+ case CUIEngineContainer::ERunning:
+ case CUIEngineContainer::EPaused:
+ {
+ aMenuPane->SetItemDimmed( ECmdShowSetMenu, EFalse );
+ break;
+ }
+ //case CUIEngineContainer::ENotStarted:
+ //case CUIEngineContainer::EExecuted:
+ //case CUIEngineContainer::EFinished:
+ default:
+ {
+ aMenuPane->SetItemDimmed( ECmdShowSetMenu, ETrue );
+ }
+ }
+ break;
+ }
+
+ // test case not running
+ //case CUIStoreIf::EStatusPassed:
+ //case CUIStoreIf::EStatusFailed:
+ //case CUIStoreIf::EStatusAborted:
+ //case CUIStoreIf::EStatusExecuted
+ default:
+ {
+ aMenuPane->SetItemDimmed( ECmdShowSetMenu, ETrue );
+ }
+ }
+ }
+ else
+ {
+ aMenuPane->SetItemDimmed( ECmdViewOutput, ETrue );
+ aMenuPane->SetItemDimmed( ECmdShowSetMenu, ETrue );
+ }
+ }
+
+ // test case control menu
+ if ( R_TESTCASE_CONTROL_SUBMENU == aResourceId )
+ {
+ CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+
+ if ( NULL != startedTestCase )
+ {
+ if ( startedTestCase->Status() == CUIStoreIf::EStatusRunning )
+ {
+ switch ( startedTestCase->UIEngineContainer().State() )
+ {
+ case CUIEngineContainer::ERunning:
+ {
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, EFalse );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, EFalse );
+ break;
+ }
+ case CUIEngineContainer::EPaused:
+ {
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, EFalse );
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, EFalse );
+ break;
+ }
+ //case CUIEngineContainer::ENotStarted:
+ //case CUIEngineContainer::EExecuted:
+ //case CUIEngineContainer::EFinished:
+ default:
+ {
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+ break;
+ }
+ }
+ }
+ else
+ {
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+ }
+ }
+ else
+ {
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+ }
+ }
+
+ }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::TestCaseStateChangedL
+//
+// Handles status changes of test cases in view.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::TestCaseStateChangedL()
+ {
+ if ( iContainer )
+ {
+
+ //CStartedTestCase* currentlySelectedTest = iContainer->SelectedTestCase();
+
+ TInt numOfTestsInViewBeforeStateChange = iContainer->TestsInViewCount();
+
+ //((CStartedTestsListBoxModel*)iContainer->iListBox->Model())->MdcaCount();
+
+ iContainer->ConstructListBoxModelL();
+
+ // Check if filtering by module or by test case file is selected
+ /*
+ if ( iFilterModule.Length() )
+ {
+ iContainer->FilterCasesByModuleL(iFilterModule);
+ }
+ else if ( iFilterTestCaseFile.Length() )
+ {
+ iContainer->FilterCasesByTCFileNameL(iFilterTestCaseFile);
+ }
+ */
+
+ TInt numOfTestsInViewAfterStateChange = iContainer->TestsInViewCount();
+ //((CStartedTestsListBoxModel*)iContainer->iListBox->Model())->MdcaCount();
+
+ if ( numOfTestsInViewAfterStateChange >= numOfTestsInViewBeforeStateChange )
+ iContainer->HandleItemAdditionL();
+ else
+ iContainer->HandleItemRemovalL();
+
+ iContainer->DrawListBox();
+
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/Testmodulesmenuview.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,279 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CTestModulesMenuView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknViewAppUi.h>
+#include <Stifui.rsg>
+
+#include <barsread.h> //TResourceReader
+#include "TestModulesMenuView.h"
+#include "TestModulesMenuContainer.h"
+#include "Stifui.hrh"
+
+#include "AppUIAppUi.h" // For ShowNotImplementedYet() method
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::ConstructL
+//
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::ConstructL()
+ {
+ CView::ConstructL();
+ BaseConstructL( R_APPUI_TESTMODULESMENUVIEW );
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::~CTestCaseOutputView
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestModulesMenuView::~CTestModulesMenuView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::Id
+//
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestModulesMenuView::Id() const
+ {
+ return TUid::Uid(ETestModulesMenuViewId); //KTestCaseMenuViewId;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::HandleCommandL
+//
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::HandleCommandL(TInt aCommand)
+ {
+ switch ( aCommand )
+ {
+ case EAknSoftkeyOk:
+ {
+ iEikonEnv->InfoMsg( _L("TestCase Menu ok") );
+ break;
+ }
+ case EAknSoftkeyBack:
+ {
+ AppUi()->HandleCommandL(EAppUIGoBack);
+ break;
+ }
+ // Next is removed from Stifui.rss file in
+ // RESOURCE MENU_PANE r_appui_testmodulesmenuview_menu's
+ // items section. If want back to use remeve comment there
+ //case ECmdOpenModule:
+ // {
+ //TFileName fileName;
+ //AknCommonDialogs::RunSelectDlgLD (fileName,
+ // R_MEMORY_SELECTION_DIALOG,
+ // R_FILE_SELECTION_DIALOG
+ //
+ //);
+ // ShowNotImplementedYet();
+ // break;
+ // }
+ case ECmdAddModule:
+ {
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->LoadAllModules();
+ if( KErrNone != ret )
+ {
+ iEikonEnv->InfoMsg( _L("Module adding fails!") );
+ break;
+ }
+
+ AppUi()->HandleCommandL( EAppUIGoBack );
+ //ShowNotImplementedYet();
+ break;
+ }
+ case ECmdRemoveModule:
+ {
+ TInt moduleNumber = iContainer->CurrentItemIndex();
+ RRefArray<TDesC> allModules;
+ TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( allModules );
+ if( KErrNone != ret )
+ {
+ allModules.Reset();
+ allModules.Close();
+ User::Leave( ret );
+ }
+ // No modules exist...break...
+ if( allModules.Count() == 0 )
+ {
+ iEikonEnv->InfoMsg( _L("No modules available!") );
+ allModules.Reset();
+ allModules.Close();
+ break;
+ }
+ // Module found...remove module...
+ ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->RemoveTestModule(
+ allModules[ moduleNumber ] );
+ if( KErrNone != ret )
+ {
+ User::Leave( ret );
+ }
+ allModules.Reset();
+ allModules.Close();
+
+ //iContainer->UpdateView();
+ AppUi()->HandleCommandL( EAppUIGoBack );
+ //ShowNotImplementedYet();
+ break;
+ }
+ default:
+ {
+ AppUi()->HandleCommandL( aCommand );
+ break;
+ }
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::DynInitMenuPaneL
+//
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* /* aMenuPane */)
+ {
+
+ if (R_APPUI_TESTMODULESMENUVIEW_MENU == aResourceId)
+ {
+ /*switch ( iData->StartedCaseInOutputView()->State() )
+ {
+ case ENotStarted:
+ {
+ aMenuPane->SetItemDimmed( ECmdOpenModule, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAddModule, ETrue );
+ aMenuPane->SetItemDimmed( ECmdRemoveModule, ETrue );
+ break;
+ }
+ case ERunning:
+ {
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ break;
+ }
+ case EPaused:
+ {
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ break;
+ }
+ case EPassed:
+ case EFailed:
+ case EAborted:
+ case EExecuted:
+ {
+ aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+ aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+ break;
+ }
+ }*/
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::HandleListBoxEventL
+//
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+ {
+ if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+ {
+ // Open or edit test module or ???
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::DoActivateL
+//
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if (!iContainer)
+ {
+ iContainer = new (ELeave) CTestModulesMenuContainer;
+ iContainer->SetMopParent(this);
+ iContainer->ConstructL( ClientRect(), this);
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+ CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+ CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+
+ TResourceReader reader;
+ iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_MODULES);
+ iNaviDecorator = np->CreateNavigationLabelL( reader );
+ CleanupStack::PopAndDestroy(); // resource reader
+ np->PushL(*iNaviDecorator);
+ }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::DoDeactivate
+//
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ iContainer->SaveActiveLine();
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ delete iContainer;
+ iContainer = NULL;
+ }
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/UIStoreHandler.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This module contains implementation of
+* CUIStoreHandler class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "UIStoreHandler.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+class CUIStore;
+
+// ==================== LOCAL FUNCTIONS =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+// ----------------------------------------------------------------------------
+// CUIStoreHandler::CUIStoreHandler
+//
+// Default constructor.
+// C++ default constructor can NOT contain any code, that might leave.
+// ----------------------------------------------------------------------------
+//
+CUIStoreHandler::CUIStoreHandler( CAppUIAppUi* aAppUIAppUI ) :
+ iAppUIAppUI( aAppUIAppUI ),
+ iExecutedTestCaseCount( 0 )
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// CUIStoreHandler::ConstructL
+//
+// Symbian OS second phase constructor.
+// Symbian OS default constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CUIStoreHandler::ConstructL()
+ {
+ CUIStoreIf::ConstructL();
+
+ }
+
+// ----------------------------------------------------------------------------
+// CUIStoreHandler::NewL
+//
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CUIStoreHandler* CUIStoreHandler::NewL( CAppUIAppUi* aAppUIAppUI )
+ {
+ // Create CUIStoreHandler object uistorehandler
+ CUIStoreHandler* uistorehandler = new (ELeave) CUIStoreHandler( aAppUIAppUI );
+
+ CleanupStack::PushL( uistorehandler );
+ uistorehandler->ConstructL();
+ CleanupStack::Pop( uistorehandler );
+
+ return uistorehandler;
+
+ }
+
+// ----------------------------------------------------------------------------
+// CUIStoreHandler::~CUIStoreHandler
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CUIStoreHandler::~CUIStoreHandler()
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// CUIStoreHandler::Update
+//
+// Receives output update notify from started test case.
+// Checks if that test case is currently in output view then
+// sends notification to AppUI which handles notification onward.
+// ----------------------------------------------------------------------------
+//
+void CUIStoreHandler::Update( CStartedTestCase* aTestCase, TInt aStatus )
+ {
+ _LIT( KErrorMsg, "Error during output update" );
+ TRAPD(err,iAppUIAppUI->OutputUpdateL( aTestCase, aStatus ));
+ if ( err != KErrNone )
+ {
+ RDebug::Print( KErrorMsg );
+ }
+
+ //iAppUi->OutputUpdate();
+ //if( aStatus == EPrintUpdate )
+ // {
+ //iAppUIAppUI->OutputUpdate( aTestCase );
+ // }
+ //else
+ // {
+ //iAppUIAppUI->TestCaseStateChanged();
+ // }
+
+ }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/View.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains CView class definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknViewAppUi.h>
+#include <Stifui.rsg>
+#include "AppUIAppUi.h"
+#include "View.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CView::ConstructL
+//
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CView::ConstructL()
+ {
+ iUIStore = ( (CAppUIAppUi*)AppUi() )->UIStoreHandler();
+ }
+
+// ----------------------------------------------------------------------------
+// CView::~CView
+//
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CView::~CView()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CView::Id
+//
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CView::Id() const
+ {
+ return TUid::Uid(0);
+ }
+
+// ----------------------------------------------------------------------------
+// CView::HandleCommandL
+//
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CView::HandleCommandL(TInt /*aCommand*/)
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CView::HandleClientRectChange()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CView::DoActivateL
+//
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/ )
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CView::DoDeactivate
+//
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CView::DoDeactivate()
+ {
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/data/UITestServerStarter.rls Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains name of uitestserverstarter.
+*
+*/
+
+// LOCALISATION STRINGS
+
+// Caption string for app.
+#define qtn_caption_string "UITestServerStarter"
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/data/UITestServerStarter.rss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file defines UITestServerStarter resources.
+*
+*/
+
+// RESOURCE IDENTIFIER
+NAME UITE // 4 letter ID
+
+
+// INCLUDES
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <appinfo.rh>
+#include "UITestServerStarter.hrh"
+#include "UITestServerStarter.rls"
+
+// RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// Define the resource file signature
+// This resource should be empty.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE
+ {
+ }
+
+// -----------------------------------------------------------------------------
+//
+// Default Document Name
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_default_document_name
+ {
+ buf="UITE";
+ }
+
+// -----------------------------------------------------------------------------
+//
+// Define default menu and CBA key.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE EIK_APP_INFO
+ {
+ //menubar = r_menubar;
+ cba = R_AVKON_SOFTKEYS_EXIT;
+ }
+
+
+// -----------------------------------------------------------------------------
+//
+// r_menubar
+// Main menubar
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_menubar
+ {
+ titles =
+ {
+ MENU_TITLE { menu_pane = r_menu; }
+ };
+ }
+
+
+// -----------------------------------------------------------------------------
+//
+// r_menu
+// Menu for "Options"
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_menu
+ {
+ items =
+ {
+ MENU_ITEM
+ {
+ command = EAknSoftkeyExit;
+ txt = qtn_exit;
+ }
+ };
+ }
+
+// -----------------------------------------------------------------------------
+//
+// About dialog resource.
+//
+// -----------------------------------------------------------------------------
+//
+// None
+
+// -----------------------------------------------------------------------------
+//
+// Resources for messages.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF32 r_caption_string { buf=qtn_caption_string; }
+
+// ----------------------------------------------------------------------------
+//
+// r_localisable_app_info
+//
+// ----------------------------------------------------------------------------
+//
+RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info
+ {
+ short_caption = qtn_caption_string;
+ caption_and_icon =
+ CAPTION_AND_ICON_INFO
+ {
+ caption = qtn_caption_string;
+
+ number_of_icons = 1;
+ icon_file = "\\resource\\apps\\UITestServerStarter.mif";
+ };
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/data/UITestServerStarter_reg.rss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file defines UITestServerStarter resources.
+*
+*/
+
+#include "UITestServerStarter.hrh"
+#include "UITestServerStarter.rls"
+#include <appinfo.rh>
+#include <UITestServerStarter.rsg>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 _UID3
+
+RESOURCE APP_REGISTRATION_INFO
+ {
+ app_file="UITestServerStarter";
+// localisable_resource_file = qtn_loc_resource_file_1;
+// localisable_resource_id = R_LOCALISABLE_APP_INFO;
+ hidden=KAppIsHidden;
+ embeddability=KAppNotEmbeddable;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/group/UITestServerStarter.mmp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MMP file of UITestServerStarter.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+TARGET UITestServerStarter.exe
+TARGETTYPE exe
+UID 0x100039CE 0x2000F8E8
+VENDORID 0x101FB657
+SECUREID 0x2000F8E8
+CAPABILITY ALL -TCB
+
+START RESOURCE ../data/UITestServerStarter.rss
+ HEADER
+ TARGETPATH resource/apps
+END
+
+SOURCEPATH ../data
+START RESOURCE UITestServerStarter_reg.rss
+ DEPENDS uitestserverstarter.rsg
+ TARGETPATH /private/10003a3f/apps
+END
+
+SOURCEPATH ../src
+
+SOURCE TestServerThreadStarter.cpp
+SOURCE UITestServerStarter.cpp
+SOURCE UITestServerStarterAppView.cpp
+SOURCE UITestServerStarterAppUi.cpp
+SOURCE AknUiEnvProxy.cpp
+SOURCE EventUtil.cpp
+SOURCE UITestServerStarterApplication.cpp
+SOURCE UITestServerStarterDocument.cpp
+SOURCE UITestServerStarterAppContainer.cpp
+
+USERINCLUDE ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY apparc.lib
+LIBRARY cone.lib
+LIBRARY eikcore.lib
+LIBRARY avkon.lib
+LIBRARY commonengine.lib
+LIBRARY efsrv.lib
+LIBRARY estor.lib
+LIBRARY aknnotify.lib
+LIBRARY hlplch.lib
+LIBRARY apgrfx.lib
+LIBRARY ws32.lib
+LIBRARY aknskins.lib
+LIBRARY aknskinsrv.lib
+
+LIBRARY stiftestserver.lib
+
+START WINS
+// ?wins_specific_information
+END
+
+START MARM
+// ?marm_specific_information
+END
+
+/* Test Server requires large stack. In case of change update also thread creation parameters
+ in "void CTestServerThreadStarter::RunL" method.
+*/
+EPOCSTACKSIZE 40960
+EPOCHEAPSIZE 0x001000 0x400000
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/group/bld.inf Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: bld.inf build information for UITestServerStarter.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// ARM4 not supported in SDK
+
+ DEFAULT
+
+
+PRJ_EXPORTS
+// None
+
+PRJ_TESTEXPORTS
+// None
+
+PRJ_MMPFILES
+
+ UITestServerStarter.mmp
+
+PRJ_TESTMMPFILES
+// None
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/AknUiEnvProxy.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains the header file of the Akn UI
+* Proxy class implementations.
+*
+*/
+
+#ifndef AKNUIENVPROXY_H_
+#define AKNUIENVPROXY_H_
+
+// INCLUDES
+#include <stifinternal/UiEnvProxy.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CUITestServerStarterAppUi;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Akn implementation of UI Proxy interface.
+class CAknUiEnvProxy: public CUiEnvProxy
+ {
+ public: // Enumerations
+ // None
+
+ private: // Enumerations
+ // None
+
+ public: // Constructors and destructor
+ /**
+ * C++ destructor.
+ */
+ ~CAknUiEnvProxy();
+
+ public: // New functions
+ /**
+ * NewL is first phase of two-phased constructor.
+ */
+ static CAknUiEnvProxy* NewL( CUITestServerStarterAppUi* aAppUi );
+
+ public: // Functions from base classes
+
+ /**
+ * Parses key code.
+ */
+ virtual TInt ParseKeyCode( const TDesC& aKeyCodeName, TUint& aKeyCode ) const;
+
+ /**
+ * Parses key scan code.
+ */
+ virtual TInt ParseKeyScanCode( const TDesC& aKeyScanCodeName, TInt& aKeyScanCode ) const;
+
+ /**
+ * Parses key modifier.
+ */
+ virtual TInt ParseModifier( const TDesC& aModifierName, TUint& aModifier ) const;
+
+ /**
+ * Parse pointer event type
+ */
+ virtual TInt ParsePointerEventType( const TDesC& aPointerEventTypeName, TUint& aPointerEventType ) const;
+
+ /**
+ * Brings UI control container to foreground.
+ */
+ virtual void BringToForeground();
+
+ /**
+ * Sends UI control container to background.
+ */
+ virtual void SendToBackground();
+
+ /**
+ * Sends local key event to UI control.
+ */
+ virtual void PressKeyL( TRequestStatus* aStatus, TUint aKeyCode, TInt aKeyScanCode = 0,
+ TUint aKeyModifiers = 0, TInt aKeyRepeats = 0 );
+
+ /**
+ * Sends global key event to UI control.
+ */
+ virtual void PressKeyL( TUint aKeyCode, TInt aKeyScanCode = 0,
+ TUint aKeyModifiers = 0, TInt aKeyRepeats = 0 );
+
+ /**
+ * Sends text to UI control.
+ */
+ virtual void TypeTextL( TRequestStatus* aStatus, const TDesC& aText );
+
+ /**
+ * Sends global text to UI control.
+ */
+ virtual void TypeTextL( const TDesC& aText );
+
+ /**
+ * Send pointer event
+ */
+ virtual void SendPointerEventL( TUint aType, const TPoint& aPosition );
+
+ /**
+ * Send local pointer event
+ */
+ virtual void SendPointerEventL( TRequestStatus* aStatus, TUint aType, const TPoint& aPosition );
+
+ protected: // New functions
+ // None
+
+ protected: // Functions from base classes
+ // None
+
+ private: // New functions
+ /**
+ * C++ default constructor.
+ */
+ CAknUiEnvProxy();
+
+ /**
+ * By default Symbian OS constructor is private.
+ */
+ void ConstructL( CUITestServerStarterAppUi* aAppUi );
+
+ public: //Data
+ // None
+
+ protected: // Data
+ // None
+
+ private: // Data
+ CUITestServerStarterAppUi* iAppUi; // Pointer to AppUi
+
+ public: // Friend classes
+ // None
+
+ protected: // Friend classes
+ // None
+
+ private: // Friend classes
+ // None
+};
+
+#endif // AKNUIENVPROXY_H_
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/EventUtil.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains TEventUtil class declaration.
+*
+*/
+
+#ifndef EVENTUTIL_H_
+#define EVENTUTIL_H_
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Utility class for key codes parsing.
+class TEventUtil
+ {
+ private: // Enumerations
+ // none
+
+ public: // Enumerations
+ enum TCustomPointerEventType { EButton1 = 1000, EButton2, EButton3 };
+
+ public: // Constructors and destructor
+
+ public: // Constructors and destructor
+
+ public: // New functions
+ /**
+ * Returns descriptive key code name.
+ */
+ static TPtrC GetKeyCodeName( TUint aKeyCode );
+
+ /**
+ * Parses key code.
+ */
+ static TInt ParseKeyCode( const TDesC& aKeyCodeName, TUint& aKeyCode );
+
+ /**
+ * Returns descriptive key scan code name.
+ */
+ static TPtrC GetKeyScanCodeName( TInt aKeyScanCode );
+
+ /**
+ * Parses key scan code.
+ */
+ static TInt ParseKeyScanCode( const TDesC& aKeyScanCodeName, TInt& aKeyScanCode );
+
+ /**
+ * Returns descriptive key modifier name.
+ */
+ static TPtrC GetModifierName( TUint aModifier );
+
+ /**
+ * Parses key modifier.
+ */
+ static TInt ParseModifier( const TDesC& aModifierName, TUint& aModifier );
+
+ /**
+ * Parses pointer event type.
+ */
+ static TInt ParsePointerEventType( const TDesC& aPointerEventTypeName, TUint& aPointerEventType );
+
+ public: // Functions from base classes
+
+ protected: // New functions
+
+ protected: // Functions from base classes
+
+ private: // New functions
+
+ public: // Data
+
+ protected: // Data
+
+ private: // Data
+
+ public: // Friend classes
+
+ protected: // Friend classes
+
+ private: // Friend classes
+
+ };
+
+#endif /*EVENTUTIL_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/TestServerThreadStarter.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains the header file of the
+* TestServerThreadStarter class.
+*
+*/
+
+
+#ifndef TESTSERVERTHREADSTARTER_H_
+#define TESTSERVERTHREADSTARTER_H_
+
+// INCLUDES
+#include "e32base.h"
+
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestThreadContainerRunnerFactory;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Class used to create thread in which testserver execution code is placed.
+class CTestServerThreadStarter: public CActive
+ {
+ public: // Enumerations
+ // None
+
+ private: // Enumerations
+ // None
+
+ public: // Constructors and destructor
+ /**
+ * C++ destructor.
+ */
+ ~CTestServerThreadStarter();
+
+ public: // New functions
+ /**
+ * NewL is first phase of two-phased constructor.
+ */
+ static CTestServerThreadStarter* NewL();
+
+ /**
+ * Performs testserver execution request.
+ */
+ TInt RunTestServerThread( CTestThreadContainerRunnerFactory* aTestThreadContainerRunnerFactory );
+ public: // Functions from base classes
+ /**
+ * RunL derived from CActive handles the completed requests.
+ */
+ void RunL();
+
+ /**
+ * DoCancel derived from CActive handles the Cancel.
+ */
+ void DoCancel();
+
+ protected: // New functions
+ // None
+
+ protected: // Functions from base classes
+ // None
+
+ private: // New functions
+ /**
+ * Thread function in which testserver execution code is placed.
+ */
+ static TInt TestServerStarterThreadFunction( TAny* aParameters );
+
+ /**
+ * C++ default constructor.
+ */
+ CTestServerThreadStarter();
+
+ /**
+ * By default Symbian OS constructor is private.
+ */
+ void ConstructL();
+
+ public: //Data
+ // None
+
+ protected: // Data
+ // None
+
+ private: // Data
+ RTimer iTimer; // Timer which complets testserver execution request
+ CTestThreadContainerRunnerFactory* iTestThreadContainerRunnerFactory; // Pointer to test thread container
+ // runner factory passed as a parameter
+ // to function which executes testserver
+ TThreadId iMainThreadId; // UITestServerStarter main thread id
+ TInt iReturnCode; // TestServer execution return code
+ RSemaphore iServerThreadStartedSemaphore; // Semaphore which indicates that testserver execution thread
+ // was successfully created
+ public: // Friend classes
+ // None
+
+ protected: // Friend classes
+ // None
+
+ private: // Friend classes
+ // None
+ };
+
+
+
+#endif // TESTSERVERTHREADSTARTER_H_
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarter.hrh Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains UID3 definition.
+*
+*/
+
+#ifndef __UITESTSERVERSTARTER_HRH__
+#define __UITESTSERVERSTARTER_HRH__
+
+#define _UID3 0x2000F8E8
+
+#endif // __UITESTSERVERSTARTER_HRH__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarterAppContainer.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains the header file of the
+* UITestServerStarter AppUi container class.
+*
+*/
+
+#ifndef UITESTSERVERSTARTERAPPCONTAINER_H_
+#define UITESTSERVERSTARTERAPPCONTAINER_H_
+
+// INCLUDES
+#include <coecntrl.h>
+#include <coemop.h>
+
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CAknsBasicBackgroundControlContext;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// UITestServerStarter standard AppUi container class.
+class CUITestServerStarterAppContainer: public CCoeControl
+ {
+ public: // Enumerations
+ // None
+
+ private: // Enumerations
+ // None
+
+ public: // Constructors and destructor
+ /**
+ * Virtual Destructor.
+ */
+ ~CUITestServerStarterAppContainer();
+
+ private: // Constructors and destructor
+ /**
+ * C++ default constructor.
+ */
+ CUITestServerStarterAppContainer();
+
+ /**
+ * Perform the second phase construction of a
+ * CUITestServerStarterAppView object.
+ */
+ void ConstructL( const TRect& aRect );
+
+ public: // New functions
+ /**
+ * Two-phased constructor.
+ * Create a CUITestServerStarterAppContainer object, which will draw itself to aRect.
+ */
+ static CUITestServerStarterAppContainer* NewL( const TRect& aRect );
+
+ /**
+ * Two-phased constructor.
+ * Create a CUITestServerStarterAppContainer object, which will draw itself
+ */
+ static CUITestServerStarterAppContainer* NewLC( const TRect& aRect );
+
+
+ /**
+ * This function is used to allow controls to ask their owners
+ * for access to other objects that they own
+ */
+ TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+ public: // Functions from base classes
+ // None
+
+ protected: // New functions
+ // None
+
+ protected: // Functions from base classes
+ // None
+
+ private: // New functions
+ // None
+
+ private: // Functions from base classes
+
+ /**
+ * Draws the control
+ */
+ void Draw( const TRect& aRect ) const;
+
+ /**
+ * Responds to changes to the size and position of the
+ * contents of this control
+ */
+ void SizeChanged();
+
+ //void HandleResourceChange( TInt aType );
+ public: //Data
+ // None
+
+ protected: // Data
+ // None
+
+ private: // Data
+ CAknsBasicBackgroundControlContext* iBgContext; // Skin background object context pointer
+
+ public: // Friend classes
+ // None
+
+ protected: // Friend classes
+ // None
+
+ private: // Friend classes
+ // None
+ };
+
+#endif /*UITESTSERVERSTARTERAPPCONTAINER_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarterAppUi.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains the header file of the
+* UITestServerStarter AppUi class
+*
+*/
+
+#ifndef UITESTSERVERSTARTERAPPUI_H_
+#define UITESTSERVERSTARTERAPPUI_H_
+
+// INCLUDES
+#include <aknViewAppUi.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CUITestServerStarterAppView;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// UITestServerStarter AppUi class
+class CUITestServerStarterAppUi : public CAknViewAppUi
+ {
+ public: // Enumerations
+ // None
+
+ private: // Enumerations
+ /**
+ * Currently handled event type.
+ */
+ enum TEventType {
+ ENone, // None
+ EPressKey, // Press key event
+ ETypeText, // Type text event
+ EPointerEvent, // Pointer event
+ };
+
+ public: // Constructors and destructor
+ /**
+ * C++ default constructor. This needs to be public due to
+ * the way the framework constructs the AppUi
+ */
+ CUITestServerStarterAppUi();
+
+ /**
+ * Virtual Destructor.
+ */
+ virtual ~CUITestServerStarterAppUi();
+
+ public: // New functions
+ /**
+ * ConstructL.
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Prepares AppUi to recive type text event
+ */
+ virtual void PrepareToTypeText( TInt aTextLength );
+
+ /**
+ * Prepares AppUi to recive key press event
+ */
+ virtual void PrepareToPressKey();
+
+ /**
+ * Prepares AppUi to recive pointer event
+ */
+ virtual void PrepareToPointerEvent();
+
+ /**
+ * Notifies that key press event was recived.
+ */
+ virtual void KeyPressHandled();
+
+ /**
+ * Notifies that text type event was recived.
+ */
+ virtual void TextTypeHandled();
+
+ /**
+ * Notifies that pointer event was recived.
+ */
+ virtual void PointerEventHandled();
+
+ /**
+ * Requests notification when key press event is handled.
+ */
+ virtual void NotifyAboutHandledKeyPress( TRequestStatus* aStatus );
+
+ /**
+ * Requests notification when text type event is handled.
+ */
+ virtual void NotifyAboutHandledTextType( TRequestStatus* aStatus );
+
+ /**
+ * Requests notification when pointer event is handled.
+ */
+ virtual void NotifyAboutHandledPointerEvent( TRequestStatus* aStatus );
+
+ public: // Functions from base classes
+ /**
+ * Overwritten version of CCoeAppUi::HandleWsEventL() method.
+ */
+ void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination );
+
+ protected: // New functions
+ // None
+
+ protected: // Functions from base classes
+ // None
+
+ private: // New functions
+ // None
+
+ private: // Functions from base classes
+ /**
+ * From CEikAppUi, HandleCommandL.
+ * Takes care of command handling.
+ * @param aCommand Command to be handled.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ public: //Data
+ // None
+
+ protected: // Data
+ // None
+
+ private: // Data
+ CUITestServerStarterAppView* iAppView; // The application view owned by CUITestServerStarterAppUi
+ TRequestStatus* iEventStatus; // Pointer to request statuc which is completed when
+ // selected event is handled.
+ TEventType iEventType; // Currently handled event type;
+ TInt iTypeTextLength; // Length of text send by typetext testscripter keyword
+
+ public: // Friend classes
+ // None
+
+ protected: // Friend classes
+ // None
+
+ private: // Friend classes
+ // None
+ };
+
+#endif // UITESTSERVERSTARTERAPPUI_H_
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarterAppView.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains the header file of the
+* UITestServerStarter AppUi view class.
+*
+*/
+
+#ifndef UITESTSERVERSTARTERAPPVIEW_H_
+#define UITESTSERVERSTARTERAPPVIEW_H_
+
+// INCLUDES
+#include <aknview.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CUITestServerStarterAppContainer;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// UITestServerStarter standard AppUi view class.
+class CUITestServerStarterAppView : public CAknView
+ {
+ public: // Enumerations
+ // None
+
+ private: // Enumerations
+ // None
+
+ public: // Constructors and destructor
+ /**
+ * Virtual Destructor.
+ */
+ virtual ~CUITestServerStarterAppView();
+
+ private: // Constructors and destructor
+
+ /**
+ * Perform the second phase construction of a
+ * CUITestServerStarterAppView object.
+ */
+ void ConstructL();
+
+ /**
+ * C++ default constructor.
+ */
+ CUITestServerStarterAppView();
+
+ public: // New functions
+ /**
+ * Two-phased constructor.
+ * Create a CUITestServerStarterAppView object.
+ */
+ static CUITestServerStarterAppView* NewL();
+
+ /**
+ * Two-phased constructor.
+ * Create a CUITestServerStarterAppView object
+ */
+ static CUITestServerStarterAppView* NewLC();
+
+ public: // Functions from base classes
+ /**
+ * Return Uid
+ */
+ TUid Id() const;
+
+ /**
+ * Handle Commands
+ */
+ void HandleCommandL(TInt aCommand);
+
+ /**
+ * Handle size changes
+ */
+ void HandleClientRectChange();
+
+ protected: // New functions
+ // None
+
+ protected: // Functions from base classes
+ // None
+
+ private: // New functions
+ // None
+
+ private: // Functions from base classes
+ /**
+ * From AknView, Activates view
+ */
+ void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+ const TDesC8& aCustomMessage);
+
+ /**
+ * From AknView, Deactivates view
+ */
+ void DoDeactivate();
+
+ public: //Data
+ // None
+
+ protected: // Data
+ // None
+
+ private: // Data
+ CUITestServerStarterAppContainer* iContainer; // View container
+
+ public: // Friend classes
+ // None
+
+ protected: // Friend classes
+ // None
+
+ private: // Friend classes
+ // None
+ };
+
+#endif // UITESTSERVERSTARTERAPPVIEW_H_
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarterApplication.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains the header file of the
+* CUITestServerStarterApplication class.
+*
+*/
+
+#ifndef UITESTSERVERSTARTERAPPLICATION_H_
+#define UITESTSERVERSTARTERAPPLICATION_H_
+
+
+// INCLUDES
+#include <aknapp.h>
+#include "UITestServerStarter.hrh"
+
+// CONSTANTS
+
+// UID for the application;
+const TUid KUidUITestServerStarterApp =
+ {
+ _UID3
+ };
+
+const TUid KMainViewId = { 1982 };
+// CLASS DECLARATION
+
+// CLASS DECLARATION
+// DESCRIPTION
+/**
+ * UITestServerStarterApplication application class.
+ * Provides factory to create concrete document object.
+ * An instance of CUITestServerStarterApplication is the application part of the
+ * AVKON application framework for the CUITestServerStarterApplication application.
+ */
+class CUITestServerStarterApplication : public CAknApplication
+ {
+ public: // Enumerations
+ // None
+
+ private: // Enumerations
+ // None
+
+ public: // Constructors and destructor
+ /**
+ * C++ destructor.
+ */
+
+ public:
+ // Functions from base classes
+
+ /**
+ * From CApaApplication, AppDllUid.
+ * @return Application's UID (KUidUITestServerStarterApplication).
+ */
+ TUid AppDllUid () const;
+
+ protected: // Functions from base classes
+
+ /**
+ * From CApaApplication, CreateDocumentL.
+ * Creates CUITestServerStarterDocument document object. The returned
+ * pointer in not owned by the CUITestServerStarterApplication object.
+ * @return A pointer to the created document object.
+ */
+ CApaDocument* CreateDocumentL ();
+
+ virtual void PreDocConstructL();
+
+
+ protected: // New functions
+ // None
+
+ protected: // Functions from base classes
+ // None
+
+ private: // New functions
+ // None
+
+ public: //Data
+ // None
+
+ protected: // Data
+ // None
+
+ private: // Data
+ // None
+
+ public: // Friend classes
+ // None
+
+ protected: // Friend classes
+ // None
+
+ private: // Friend classes
+ // None
+ };
+
+
+
+#endif /*UITESTSERVERSTARTERAPPLICATION_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarterDocument.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains the header file of the
+* UITestServerStarter Document class.
+*
+*/
+
+#ifndef UITESTSERVERSTARTERDOCUMENT_H_
+#define UITESTSERVERSTARTERDOCUMENT_H_
+
+// INCLUDES
+#include <AknDoc.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CUITestServerStarterAppUi;
+class CEikApplication;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+/**
+ * CClockTestDocument application class.
+ * An instance of class CClockTestDocument is the Document part of the
+ * AVKON application framework for the ClockTest example application.
+ */
+class CUITestServerStarterDocument : public CAknDocument
+ {
+ public: // Enumerations
+ // None
+
+ private: // Enumerations
+ // None
+
+ private: // Constructors and destructor
+ // None
+ public: // New functions
+
+ /**
+ * NewL.
+ * Two-phased constructor.
+ * Construct a CUITestServerStarterDocument for the AVKON application aApp
+ * using two phase construction, and return a pointer
+ * to the created object.
+ * @param aApp Application creating this document.
+ * @return A pointer to the created instance of CUITestServerStarterDocument.
+ */
+ static CUITestServerStarterDocument* NewL (CEikApplication& aApp);
+
+ /**
+ * NewLC.
+ * Two-phased constructor.
+ * Construct a CUITestServerStarterDocument for the AVKON application aApp
+ * using two phase construction, and return a pointer
+ * to the created object.
+ * @param aApp Application creating this document.
+ * @return A pointer to the created instance of CUITestServerStarterDocument.
+ */
+ static CUITestServerStarterDocument* NewLC (CEikApplication& aApp);
+
+ /**
+ * ~CUITestServerStarterDocument
+ * Virtual Destructor.
+ */
+ virtual ~CUITestServerStarterDocument();
+
+ public: // Functions from base classes
+
+ /**
+ * CreateAppUiL
+ * From CEikDocument, CreateAppUiL.
+ * Create a CUITestServerStarterAppUi object and return a pointer to it.
+ * The object returned is owned by the Uikon framework.
+ * @return Pointer to created instance of AppUi.
+ */
+ CEikAppUi* CreateAppUiL ();
+
+ protected: // New functions
+ // None
+
+ protected: // Functions from base classes
+ // None
+
+ private: // New functions
+
+ /**
+ * ConstructL
+ * 2nd phase constructor.
+ */
+ void ConstructL ();
+
+ /**
+ * CUITestServerStarterDocument.
+ * C++ default constructor.
+ * @param aApp Application creating this document.
+ */
+ CUITestServerStarterDocument( CEikApplication& aApp );
+
+ private: // Functions from base classes
+ // None
+
+ public: //Data
+ // None
+
+ protected: // Data
+ // None
+
+ private: // Data
+ // None
+
+ public: // Friend classes
+ // None
+
+ protected: // Friend classes
+ // None
+
+ private: // Friend classes
+ // None
+ };
+
+
+#endif /*UITESTSERVERSTARTERDOCUMENT_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/AknUiEnvProxy.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,683 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This module contains the implementation of
+* CAknUiEnvProxy class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "AknUiEnvProxy.h"
+#include "UITestServerStarterAppUi.h"
+#include "EventUtil.h"
+
+#include <coeaui.h>
+#include <eikenv.h>
+#include <apgtask.h>
+#include <w32std.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: NewL
+
+ Description: NewL is first phase of two-phased constructor.
+
+ NewL is first phase of two-phased constructor.
+
+ Parameters: CUITestServerStarterAppUi* aAppUi: in: Pointer to CUITestServerStarterAppUi.
+
+ Return Values: Pointer to new CAknUiEnvProxy object.
+
+ Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CAknUiEnvProxy* CAknUiEnvProxy::NewL( CUITestServerStarterAppUi* aAppUi )
+ {
+ CAknUiEnvProxy* self = new(ELeave)CAknUiEnvProxy();
+ CleanupStack::PushL( self );
+ self->ConstructL( aAppUi );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: ConstructL
+
+ Description: ConstructL is second phase of two-phased constructor.
+
+ Performs construction of CAknUiEnvProxy object.
+
+ Parameters: CUITestServerStarterAppUi* aAppUi: in: Pointer to CUITestServerStarterAppUi.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::ConstructL( CUITestServerStarterAppUi* aAppUi )
+ {
+ iAppUi = aAppUi;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: BringToForeground
+
+ Description: Brings UI component container to foreground.
+
+ Brings UI component container to foreground.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::BringToForeground()
+ {
+ TApaTask task( CCoeEnv::Static()->WsSession() );
+ task.SetWgId( CCoeEnv::Static()->RootWin().Identifier() );
+ task.BringToForeground();
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: SendToBackground
+
+ Description: Sends UI component container to background.
+
+ Sends UI component container to background.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::SendToBackground( )
+ {
+ TApaTask task( CCoeEnv::Static()->WsSession() );
+ task.SetWgId( CCoeEnv::Static()->RootWin().Identifier() );
+ task.SendToBackground();
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: PressKeyL
+
+ Description: Sends local key press event to UI component.
+
+ Sends key press event to UI component. UI component must be first added to
+ AppUi stack to be able to recive this key event.
+
+ Parameters: TRequestStatus* aStatus: out: Pointer to request status used to notify that
+ key event was recived.
+ TUint aKeyCode: in: Key code.
+ TInt aKeyScanCode: in: Key scan code.
+ TUint aKeyModifiers: in: Key modifiers
+ TInt aKeyRepeats: in: Key press repeats count.
+
+ Return Values: None.
+
+ Errors/Exceptions: Leaves if some error occurs during key event sending.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::PressKeyL( TRequestStatus* aStatus, TUint aKeyCode, TInt aKeyScanCode,
+ TUint aKeyModifiers, TInt aKeyRepeats )
+ {
+ // Fill key event structure
+ TWsEvent wsEvent;
+ wsEvent.SetType(EEventKey);
+ TKeyEvent* keyEvent = wsEvent.Key();
+ keyEvent->iCode = aKeyCode;
+ keyEvent->iScanCode = aKeyScanCode;
+ keyEvent->iModifiers = aKeyModifiers;
+ keyEvent->iRepeats = aKeyRepeats;
+
+ // Send info to AppUi that we are going to send key event
+ iAppUi->PrepareToPressKey();
+
+ RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+ TInt wgId = CCoeEnv::Static()->RootWin().Identifier();
+ // Send key event
+ TInt ret = wsSession.SendEventToWindowGroup( wgId, wsEvent );
+ User::LeaveIfError( ret );
+
+ wsSession.Flush();
+
+ // Request notification when key press is handled
+ *aStatus = KRequestPending;
+ iAppUi->NotifyAboutHandledKeyPress( aStatus );
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: PressKeyL
+
+ Description: Sends global key press event to UI component.
+
+ Sends key press event to UI component which is currently focuused.
+
+ Parameters: TUint aKeyCode: in: Key code.
+ TInt aKeyScanCode: in: Key scan code.
+ TUint aKeyModifiers: in: Key modifiers
+ TInt aKeyRepeats: in: Key press repeats count.
+
+ Return Values: None.
+
+ Errors/Exceptions: Leaves if some error occurs during key event sending.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::PressKeyL( TUint aKeyCode, TInt aKeyScanCode,
+ TUint aKeyModifiers, TInt aKeyRepeats )
+ {
+ // Fill key event structure
+ TWsEvent wsEvent;
+ wsEvent.SetType(EEventKey);
+ TKeyEvent* keyEvent = wsEvent.Key();
+ keyEvent->iCode = aKeyCode;
+ keyEvent->iScanCode = aKeyScanCode;
+ keyEvent->iModifiers = aKeyModifiers;
+ keyEvent->iRepeats = aKeyRepeats;
+
+ RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+ TInt wgId = wsSession.GetFocusWindowGroup();
+ TInt ret = wsSession.SendEventToWindowGroup( wgId, wsEvent );
+ User::LeaveIfError( ret );
+ wsSession.Flush();
+ }
+
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: TypeTextL
+
+ Description: Sends text to UI component.
+
+ Sends text to UI component. UI component must be first added to
+ AppUi stack to be able to recive this key event.
+
+ Parameters: TRequestStatus* aStatus: out: Pointer to request status used to notify that
+ key event was recived.
+ TPtrC aText: in: Text which will be send to UI component.
+
+ Return Values: None.
+
+ Errors/Exceptions: Leaves if some error occurs during key event sending.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::TypeTextL( TRequestStatus* aStatus, const TDesC& aText )
+ {
+ TLex textParser( aText );
+
+ // Send info to AppUi that we are going to send text
+ iAppUi->PrepareToTypeText( aText.Length() );
+
+ TInt wgId = CCoeEnv::Static()->RootWin().Identifier();
+ RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+
+ TChar character = 0;
+ while ( ( character = textParser.Get() ) != 0 )
+ {
+ // Fill key event structure
+ TWsEvent wsEvent;
+ wsEvent.SetType(EEventKey);
+ TKeyEvent* keyEvent = wsEvent.Key();
+ keyEvent->iCode = character;
+ keyEvent->iScanCode = 0;
+ keyEvent->iModifiers = 0;
+ keyEvent->iRepeats = 0;
+
+ // Send single character from text to UI component
+ TInt ret = wsSession.SendEventToWindowGroup( wgId, wsEvent );
+ User::LeaveIfError( ret );
+ wsSession.Flush();
+ }
+
+ // Request notification when send text is recived
+ *aStatus = KRequestPending;
+ iAppUi->NotifyAboutHandledTextType( aStatus );
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: TypeTextL
+
+ Description: Sends global text to UI component.
+
+ Sends global text to UI component. UI component must be focused to receive that event.
+
+ Parameters: TPtrC aText: in: Text which will be send to UI component.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::TypeTextL( const TDesC& aText )
+ {
+ TLex textParser( aText );
+
+ RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+ TInt wgId = wsSession.GetFocusWindowGroup();
+
+ TChar character = 0;
+ while ( ( character = textParser.Get() ) != 0 )
+ {
+ // Fill key event structure
+ TWsEvent wsEvent;
+ wsEvent.SetType(EEventKey);
+ TKeyEvent* keyEvent = wsEvent.Key();
+ keyEvent->iCode = character;
+ keyEvent->iScanCode = 0;
+ keyEvent->iModifiers = 0;
+ keyEvent->iRepeats = 0;
+
+ // Send single character from text to UI component
+ TInt ret = wsSession.SendEventToWindowGroup( wgId, wsEvent );
+ User::LeaveIfError( ret );
+ wsSession.Flush();
+ }
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: SendPointerEventL
+
+ Description: Send pointer event
+
+ Send pointer event.
+
+ Parameters: TUint aType: in: KEvent type.
+ const TPoint& aPosition: in: Position.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::SendPointerEventL( TUint aType, const TPoint& aPosition )
+ {
+ RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+ TRawEvent pointerEvent;
+
+ if ( aType < TEventUtil::EButton1 ) {
+ pointerEvent.Set( ( TRawEvent::TType )aType, aPosition.iX, aPosition.iY );
+ wsSession.SimulateRawEvent( pointerEvent );
+ }
+ else if ( ( aType >= TEventUtil::EButton1 ) && ( aType <= TEventUtil::EButton3 ) )
+ {
+ TRawEvent pointerEventDown;
+ TRawEvent pointerEventUp;
+
+ switch ( aType )
+ {
+ case TEventUtil::EButton1:
+ {
+ pointerEventDown.Set( TRawEvent::EButton1Down, aPosition.iX, aPosition.iY );
+ pointerEventUp.Set( TRawEvent::EButton1Up, aPosition.iX, aPosition.iY );
+ }
+ break;
+ case TEventUtil::EButton2:
+ {
+ pointerEventDown.Set( TRawEvent::EButton2Down, aPosition.iX, aPosition.iY );
+ pointerEventUp.Set( TRawEvent::EButton2Up, aPosition.iX, aPosition.iY );
+ }
+ break;
+ case TEventUtil::EButton3:
+ {
+ pointerEventDown.Set( TRawEvent::EButton3Down, aPosition.iX, aPosition.iY );
+ pointerEventUp.Set( TRawEvent::EButton3Up, aPosition.iX, aPosition.iY );
+ }
+ break;
+ default:
+ User::Leave( KErrArgument );
+ }
+ wsSession.SimulateRawEvent( pointerEventDown );
+ wsSession.Flush();
+ wsSession.SimulateRawEvent( pointerEventUp );
+ wsSession.Flush();
+ }
+ else
+ {
+ User::Leave( KErrArgument );
+ }
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: SendPointerEventL
+
+ Description: Send pointer event
+
+ Send pointer event.
+
+ Parameters: TRequestStatus* aStatus: in: Pointer to request status used to notify that
+ pointer event was recived.
+ TUint aType: in: KEvent type.
+ const TPoint& aPosition: in: Position.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::SendPointerEventL( TRequestStatus* aStatus, TUint aType, const TPoint& aPosition )
+ {
+ RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+
+ if ( aType < TEventUtil::EButton1 ) {
+ TRawEvent pointerEvent;
+ pointerEvent.Set( ( TRawEvent::TType )aType, aPosition.iX, aPosition.iY );
+ // Send info to AppUi that we are going to send key event
+ iAppUi->PrepareToPointerEvent();
+ wsSession.SimulateRawEvent( pointerEvent );
+ // Request notification when key press is handled
+ *aStatus = KRequestPending;
+ iAppUi->NotifyAboutHandledPointerEvent( aStatus );
+ }
+ else if ( ( aType >= TEventUtil::EButton1 ) && ( aType <= TEventUtil::EButton3 ) )
+ {
+ TRawEvent pointerEventDown;
+ TRawEvent pointerEventUp;
+ switch ( aType )
+ {
+ case TEventUtil::EButton1:
+ {
+ pointerEventDown.Set( TRawEvent::EButton1Down, aPosition.iX, aPosition.iY );
+ pointerEventUp.Set( TRawEvent::EButton1Up, aPosition.iX, aPosition.iY );
+ }
+ break;
+ case TEventUtil::EButton2:
+ {
+ pointerEventDown.Set( TRawEvent::EButton2Down, aPosition.iX, aPosition.iY );
+ pointerEventUp.Set( TRawEvent::EButton2Up, aPosition.iX, aPosition.iY );
+ }
+ break;
+ case TEventUtil::EButton3:
+ {
+ pointerEventDown.Set( TRawEvent::EButton3Down, aPosition.iX, aPosition.iY );
+ pointerEventUp.Set( TRawEvent::EButton3Up, aPosition.iX, aPosition.iY );
+ }
+ break;
+ default:
+ User::Leave( KErrArgument );
+ }
+
+ CCoeEnv::Static()->RootWin().SimulatePointerEvent( pointerEventDown );
+ wsSession.Flush();
+
+ // Send info to AppUi that we are going to send key event
+ iAppUi->PrepareToPointerEvent();
+
+ CCoeEnv::Static()->RootWin().SimulatePointerEvent( pointerEventUp );
+ wsSession.Flush();
+
+ // Request notification when key press is handled
+ *aStatus = KRequestPending;
+ iAppUi->NotifyAboutHandledPointerEvent( aStatus );
+ }
+ else
+ {
+ User::Leave( KErrArgument );
+ }
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: ParseKeyCode
+
+ Description: Parses key code.
+
+ Parses key code.
+
+ Parameters: TDesC& aKeyCodeName: in: Key code name.
+ TUint& aKeyCode: out: Parsed key code.
+
+ Return Values: KErrNone if no error occures during parsing.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CAknUiEnvProxy::ParseKeyCode( const TDesC& aKeyCodeName, TUint& aKeyCode ) const
+ {
+ return TEventUtil::ParseKeyCode( aKeyCodeName, aKeyCode );
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: ParseKeyScanCode
+
+ Description: Parses key scan code.
+
+ Parses key scan code.
+
+ Parameters: TDesC& aKeyScanCodeName: in: Key scan code name.
+ TUint& aKeyScanCode: out: Parsed key scan code.
+
+ Return Values: KErrNone if no error occures during parsing.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CAknUiEnvProxy::ParseKeyScanCode( const TDesC& aKeyScanCodeName, TInt& aKeyScanCode ) const
+ {
+ return TEventUtil::ParseKeyScanCode( aKeyScanCodeName, aKeyScanCode );
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: ParseModifier
+
+ Description: Parses key modifier.
+
+ Parses key modifier.
+
+ Parameters: TDesC& aModifierName: in: Key modifier.
+ TUint& aModifier: out: Parsed key modifier.
+
+ Return Values: KErrNone if no error occures during parsing.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CAknUiEnvProxy::ParseModifier( const TDesC& aModifierName, TUint& aModifier ) const
+ {
+ return TEventUtil::ParseModifier( aModifierName, aModifier );
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: ParsePointerEventType
+
+ Description: Parses pointer event type.
+
+ Parses key modifier.
+
+ Parameters: const TDesC& aPointerEventTypeName: in: Pointer event type.
+ TUint& aModifier: out: Parsed pointer event type.
+
+ Return Values: KErrNone if no error occures during parsing.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CAknUiEnvProxy::ParsePointerEventType( const TDesC& aPointerEventTypeName, TUint& aPointerEventType ) const
+ {
+ return TEventUtil::ParsePointerEventType( aPointerEventTypeName, aPointerEventType );
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: CAknUiEnvProxy
+
+ Description: C++ constructor.
+
+ C++ constructor.
+
+ Parameters: None
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CAknUiEnvProxy::CAknUiEnvProxy()
+ {
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: ~CAknUiEnvProxy
+
+ Description: C++ destructor.
+
+ C++ destructor.
+
+ Parameters: None
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CAknUiEnvProxy::~CAknUiEnvProxy()
+ {
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/EventUtil.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,1100 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This module contains the implementation of
+* CAknUiEnvProxy class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "EventUtil.h"
+#include <e32def.h>
+#include <e32keys.h>
+#include <w32std.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+
+/**
+ * Key code names definition macro
+ */
+#define DefineKeyCodeNames( varName ) \
+ static TText* const varName[] = \
+ { \
+ (TText*)L"ekeynull", \
+ (TText*)L"ekeybell", \
+ (TText*)L"ekeybackspace", \
+ (TText*)L"ekeytab", \
+ (TText*)L"ekeylinefeed", \
+ (TText*)L"ekeyverticaltab", \
+ (TText*)L"ekeyformfeed", \
+ (TText*)L"ekeyenter", \
+ (TText*)L"ekeyescape", \
+ (TText*)L"ekeyspace", \
+ (TText*)L"ekeydelete", \
+ (TText*)L"ekeyprintscreen", \
+ (TText*)L"ekeypause", \
+ (TText*)L"ekeyhome", \
+ (TText*)L"ekeyend", \
+ (TText*)L"ekeypageup", \
+ (TText*)L"ekeypagedown", \
+ (TText*)L"ekeyinsert", \
+ (TText*)L"ekeyleftarrow", \
+ (TText*)L"ekeyrightarrow", \
+ (TText*)L"ekeyuparrow", \
+ (TText*)L"ekeydownarrow", \
+ (TText*)L"ekeyleftshift", \
+ (TText*)L"ekeyrightshift", \
+ (TText*)L"ekeyleftalt", \
+ (TText*)L"ekeyrightalt", \
+ (TText*)L"ekeyleftctrl", \
+ (TText*)L"ekeyrightctrl", \
+ (TText*)L"ekeyleftfunc", \
+ (TText*)L"ekeyrightfunc", \
+ (TText*)L"ekeycapslock", \
+ (TText*)L"ekeynumlock", \
+ (TText*)L"ekeyscrolllock", \
+ (TText*)L"ekeyf1", \
+ (TText*)L"ekeyf2", \
+ (TText*)L"ekeyf3", \
+ (TText*)L"ekeyf4", \
+ (TText*)L"ekeyf5", \
+ (TText*)L"ekeyf6", \
+ (TText*)L"ekeyf7", \
+ (TText*)L"ekeyf8", \
+ (TText*)L"ekeyf9", \
+ (TText*)L"ekeyf10", \
+ (TText*)L"ekeyf11", \
+ (TText*)L"ekeyf12", \
+ (TText*)L"ekeyf13", \
+ (TText*)L"ekeyf14", \
+ (TText*)L"ekeyf15", \
+ (TText*)L"ekeyf16", \
+ (TText*)L"ekeyf17", \
+ (TText*)L"ekeyf18", \
+ (TText*)L"ekeyf19", \
+ (TText*)L"ekeyf20", \
+ (TText*)L"ekeyf21", \
+ (TText*)L"ekeyf22", \
+ (TText*)L"ekeyf23", \
+ (TText*)L"ekeyf24", \
+ (TText*)L"ekeyoff", \
+ (TText*)L"ekeyinccontrast", \
+ (TText*)L"ekeydeccontrast", \
+ (TText*)L"ekeybacklighton", \
+ (TText*)L"ekeybacklightoff", \
+ (TText*)L"ekeybacklighttoggle", \
+ (TText*)L"ekeysliderdown", \
+ (TText*)L"ekeysliderup", \
+ (TText*)L"ekeymenu", \
+ (TText*)L"ekeydictaphoneplay", \
+ (TText*)L"ekeydictaphonestop", \
+ (TText*)L"ekeydictaphonerecord",\
+ (TText*)L"ekeyhelp", \
+ (TText*)L"ekeydial", \
+ (TText*)L"ekeyscreendimension0",\
+ (TText*)L"ekeyscreendimension1",\
+ (TText*)L"ekeyscreendimension2",\
+ (TText*)L"ekeyscreendimension3",\
+ (TText*)L"ekeyincvolume", \
+ (TText*)L"ekeydecvolume", \
+ (TText*)L"ekeydevice0", \
+ (TText*)L"ekeydevice1", \
+ (TText*)L"ekeydevice2", \
+ (TText*)L"ekeydevice3", \
+ (TText*)L"ekeydevice4", \
+ (TText*)L"ekeydevice5", \
+ (TText*)L"ekeydevice6", \
+ (TText*)L"ekeydevice7", \
+ (TText*)L"ekeydevice8", \
+ (TText*)L"ekeydevice9", \
+ (TText*)L"ekeydevicea", \
+ (TText*)L"ekeydeviceb", \
+ (TText*)L"ekeydevicec", \
+ (TText*)L"ekeydeviced", \
+ (TText*)L"ekeydevicee", \
+ (TText*)L"ekeydevicef", \
+ (TText*)L"ekeyapplication0", \
+ (TText*)L"ekeyapplication1", \
+ (TText*)L"ekeyapplication2", \
+ (TText*)L"ekeyapplication3", \
+ (TText*)L"ekeyapplication4", \
+ (TText*)L"ekeyapplication5", \
+ (TText*)L"ekeyapplication6", \
+ (TText*)L"ekeyapplication7", \
+ (TText*)L"ekeyapplication8", \
+ (TText*)L"ekeyapplication9", \
+ (TText*)L"ekeyapplicationa", \
+ (TText*)L"ekeyapplicationb", \
+ (TText*)L"ekeyapplicationc", \
+ (TText*)L"ekeyapplicationd", \
+ (TText*)L"ekeyapplicatione", \
+ (TText*)L"ekeyapplicationf", \
+ (TText*)L"ekeyyes", \
+ (TText*)L"ekeyno", \
+ (TText*)L"ekeyincbrightness", \
+ (TText*)L"ekeydecbrightness", \
+ (TText*)L"ekeykeyboardextend", \
+ (TText*)L"ekeydevice10", \
+ (TText*)L"ekeydevice11", \
+ (TText*)L"ekeydevice12", \
+ (TText*)L"ekeydevice13", \
+ (TText*)L"ekeydevice14", \
+ (TText*)L"ekeydevice15", \
+ (TText*)L"ekeydevice16", \
+ (TText*)L"ekeydevice17", \
+ (TText*)L"ekeydevice18", \
+ (TText*)L"ekeydevice19", \
+ (TText*)L"ekeydevice1a", \
+ (TText*)L"ekeydevice1b", \
+ (TText*)L"ekeydevice1c", \
+ (TText*)L"ekeydevice1d", \
+ (TText*)L"ekeydevice1e", \
+ (TText*)L"ekeydevice1f", \
+ (TText*)L"ekeyapplication10", \
+ (TText*)L"ekeyapplication11", \
+ (TText*)L"ekeyapplication12", \
+ (TText*)L"ekeyapplication13", \
+ (TText*)L"ekeyapplication14", \
+ (TText*)L"ekeyapplication15", \
+ (TText*)L"ekeyapplication16", \
+ (TText*)L"ekeyapplication17", \
+ (TText*)L"ekeyapplication18", \
+ (TText*)L"ekeyapplication19", \
+ (TText*)L"ekeyapplication1a", \
+ (TText*)L"ekeyapplication1b", \
+ (TText*)L"ekeyapplication1c", \
+ (TText*)L"ekeyapplication1d", \
+ (TText*)L"ekeyapplication1e", \
+ (TText*)L"ekeyapplication1f", \
+ }
+
+/**
+ * Key codes definition macro
+ */
+#define DefineKeyCodes( varName ) \
+ static TUint const varName[] = \
+ { \
+ (TUint)EKeyNull, \
+ (TUint)EKeyBell, \
+ (TUint)EKeyBackspace, \
+ (TUint)EKeyTab, \
+ (TUint)EKeyLineFeed, \
+ (TUint)EKeyVerticalTab, \
+ (TUint)EKeyFormFeed, \
+ (TUint)EKeyEnter, \
+ (TUint)EKeyEscape, \
+ (TUint)EKeySpace, \
+ (TUint)EKeyDelete, \
+ (TUint)EKeyPrintScreen, \
+ (TUint)EKeyPause, \
+ (TUint)EKeyHome, \
+ (TUint)EKeyEnd, \
+ (TUint)EKeyPageUp, \
+ (TUint)EKeyPageDown, \
+ (TUint)EKeyInsert, \
+ (TUint)EKeyLeftArrow, \
+ (TUint)EKeyRightArrow, \
+ (TUint)EKeyUpArrow, \
+ (TUint)EKeyDownArrow, \
+ (TUint)EKeyLeftShift, \
+ (TUint)EKeyRightShift, \
+ (TUint)EKeyLeftAlt, \
+ (TUint)EKeyRightAlt, \
+ (TUint)EKeyLeftCtrl, \
+ (TUint)EKeyRightCtrl, \
+ (TUint)EKeyLeftFunc, \
+ (TUint)EKeyRightFunc, \
+ (TUint)EKeyCapsLock, \
+ (TUint)EKeyNumLock, \
+ (TUint)EKeyScrollLock, \
+ (TUint)EKeyF1, \
+ (TUint)EKeyF2, \
+ (TUint)EKeyF3, \
+ (TUint)EKeyF4, \
+ (TUint)EKeyF5, \
+ (TUint)EKeyF6, \
+ (TUint)EKeyF7, \
+ (TUint)EKeyF8, \
+ (TUint)EKeyF9, \
+ (TUint)EKeyF10, \
+ (TUint)EKeyF11, \
+ (TUint)EKeyF12, \
+ (TUint)EKeyF13, \
+ (TUint)EKeyF14, \
+ (TUint)EKeyF15, \
+ (TUint)EKeyF16, \
+ (TUint)EKeyF17, \
+ (TUint)EKeyF18, \
+ (TUint)EKeyF19, \
+ (TUint)EKeyF20, \
+ (TUint)EKeyF21, \
+ (TUint)EKeyF22, \
+ (TUint)EKeyF23, \
+ (TUint)EKeyF24, \
+ (TUint)EKeyOff, \
+ (TUint)EKeyIncContrast, \
+ (TUint)EKeyDecContrast, \
+ (TUint)EKeyBacklightOn, \
+ (TUint)EKeyBacklightOff, \
+ (TUint)EKeyBacklightToggle, \
+ (TUint)EKeySliderDown, \
+ (TUint)EKeySliderUp, \
+ (TUint)EKeyMenu, \
+ (TUint)EKeyDictaphonePlay, \
+ (TUint)EKeyDictaphoneStop, \
+ (TUint)EKeyDictaphoneRecord, \
+ (TUint)EKeyHelp, \
+ (TUint)EKeyDial, \
+ (TUint)EKeyScreenDimension0, \
+ (TUint)EKeyScreenDimension1, \
+ (TUint)EKeyScreenDimension2, \
+ (TUint)EKeyScreenDimension3, \
+ (TUint)EKeyIncVolume, \
+ (TUint)EKeyDecVolume, \
+ (TUint)EKeyDevice0, \
+ (TUint)EKeyDevice1, \
+ (TUint)EKeyDevice2, \
+ (TUint)EKeyDevice3, \
+ (TUint)EKeyDevice4, \
+ (TUint)EKeyDevice5, \
+ (TUint)EKeyDevice6, \
+ (TUint)EKeyDevice7, \
+ (TUint)EKeyDevice8, \
+ (TUint)EKeyDevice9, \
+ (TUint)EKeyDeviceA, \
+ (TUint)EKeyDeviceB, \
+ (TUint)EKeyDeviceC, \
+ (TUint)EKeyDeviceD, \
+ (TUint)EKeyDeviceE, \
+ (TUint)EKeyDeviceF, \
+ (TUint)EKeyApplication0, \
+ (TUint)EKeyApplication1, \
+ (TUint)EKeyApplication2, \
+ (TUint)EKeyApplication3, \
+ (TUint)EKeyApplication4, \
+ (TUint)EKeyApplication5, \
+ (TUint)EKeyApplication6, \
+ (TUint)EKeyApplication7, \
+ (TUint)EKeyApplication8, \
+ (TUint)EKeyApplication9, \
+ (TUint)EKeyApplicationA, \
+ (TUint)EKeyApplicationB, \
+ (TUint)EKeyApplicationC, \
+ (TUint)EKeyApplicationD, \
+ (TUint)EKeyApplicationE, \
+ (TUint)EKeyApplicationF, \
+ (TUint)EKeyYes, \
+ (TUint)EKeyNo, \
+ (TUint)EKeyIncBrightness, \
+ (TUint)EKeyDecBrightness, \
+ (TUint)EKeyKeyboardExtend, \
+ (TUint)EKeyDevice10, \
+ (TUint)EKeyDevice11, \
+ (TUint)EKeyDevice12, \
+ (TUint)EKeyDevice13, \
+ (TUint)EKeyDevice14, \
+ (TUint)EKeyDevice15, \
+ (TUint)EKeyDevice16, \
+ (TUint)EKeyDevice17, \
+ (TUint)EKeyDevice18, \
+ (TUint)EKeyDevice19, \
+ (TUint)EKeyDevice1A, \
+ (TUint)EKeyDevice1B, \
+ (TUint)EKeyDevice1C, \
+ (TUint)EKeyDevice1D, \
+ (TUint)EKeyDevice1E, \
+ (TUint)EKeyDevice1F, \
+ (TUint)EKeyApplication10, \
+ (TUint)EKeyApplication11, \
+ (TUint)EKeyApplication12, \
+ (TUint)EKeyApplication13, \
+ (TUint)EKeyApplication14, \
+ (TUint)EKeyApplication15, \
+ (TUint)EKeyApplication16, \
+ (TUint)EKeyApplication17, \
+ (TUint)EKeyApplication18, \
+ (TUint)EKeyApplication19, \
+ (TUint)EKeyApplication1A, \
+ (TUint)EKeyApplication1B, \
+ (TUint)EKeyApplication1C, \
+ (TUint)EKeyApplication1D, \
+ (TUint)EKeyApplication1E, \
+ (TUint)EKeyApplication1F, \
+ }
+
+/**
+ * Key scan code names definition macro.
+ */
+#define DefineKeyScanCodeNames( varName ) \
+ static TText* const varName[] = \
+ { \
+ (TText*)L"estdkeynull", \
+ (TText*)L"estdkeybackspace", \
+ (TText*)L"estdkeytab", \
+ (TText*)L"estdkeyenter", \
+ (TText*)L"estdkeyescape", \
+ (TText*)L"estdkeyspace", \
+ (TText*)L"estdkeyprintscreen", \
+ (TText*)L"estdkeypause", \
+ (TText*)L"estdkeyhome", \
+ (TText*)L"estdkeyend", \
+ (TText*)L"estdkeypageup", \
+ (TText*)L"estdkeypagedown", \
+ (TText*)L"estdkeyinsert", \
+ (TText*)L"estdkeydelete", \
+ (TText*)L"estdkeyleftarrow", \
+ (TText*)L"estdkeyrightarrow", \
+ (TText*)L"estdkeyuparrow", \
+ (TText*)L"estdkeydownarrow", \
+ (TText*)L"estdkeyleftshift", \
+ (TText*)L"estdkeyrightshift", \
+ (TText*)L"estdkeyleftalt", \
+ (TText*)L"estdkeyrightalt", \
+ (TText*)L"estdkeyleftctrl", \
+ (TText*)L"estdkeyrightctrl", \
+ (TText*)L"estdkeyleftfunc", \
+ (TText*)L"estdkeyrightfunc", \
+ (TText*)L"estdkeycapslock", \
+ (TText*)L"estdkeynumlock", \
+ (TText*)L"estdkeyscrolllock", \
+ (TText*)L"estdkeyf1", \
+ (TText*)L"estdkeyf2", \
+ (TText*)L"estdkeyf3", \
+ (TText*)L"estdkeyf4", \
+ (TText*)L"estdkeyf5", \
+ (TText*)L"estdkeyf6", \
+ (TText*)L"estdkeyf7", \
+ (TText*)L"estdkeyf8", \
+ (TText*)L"estdkeyf9", \
+ (TText*)L"estdkeyf10", \
+ (TText*)L"estdkeyf11", \
+ (TText*)L"estdkeyf12", \
+ (TText*)L"estdkeyf13", \
+ (TText*)L"estdkeyf14", \
+ (TText*)L"estdkeyf15", \
+ (TText*)L"estdkeyf16", \
+ (TText*)L"estdkeyf17", \
+ (TText*)L"estdkeyf18", \
+ (TText*)L"estdkeyf19", \
+ (TText*)L"estdkeyf20", \
+ (TText*)L"estdkeyf21", \
+ (TText*)L"estdkeyf22", \
+ (TText*)L"estdkeyf23", \
+ (TText*)L"estdkeyf24", \
+ (TText*)L"estdkeyxxx", \
+ (TText*)L"estdkeycomma", \
+ (TText*)L"estdkeyfullstop", \
+ (TText*)L"estdkeyforwardslash", \
+ (TText*)L"estdkeybackslash", \
+ (TText*)L"estdkeysemicolon", \
+ (TText*)L"estdkeysinglequote", \
+ (TText*)L"estdkeyhash", \
+ (TText*)L"estdkeysquarebracketleft", \
+ (TText*)L"estdkeysquarebracketright", \
+ (TText*)L"estdkeyminus", \
+ (TText*)L"estdkeyequals", \
+ (TText*)L"estdkeynkpforwardslash", \
+ (TText*)L"estdkeynkpasterisk", \
+ (TText*)L"estdkeynkpminus", \
+ (TText*)L"estdkeynkpplus", \
+ (TText*)L"estdkeynkpenter", \
+ (TText*)L"estdkeynkp1", \
+ (TText*)L"estdkeynkp2", \
+ (TText*)L"estdkeynkp3", \
+ (TText*)L"estdkeynkp4", \
+ (TText*)L"estdkeynkp5", \
+ (TText*)L"estdkeynkp6", \
+ (TText*)L"estdkeynkp7", \
+ (TText*)L"estdkeynkp8", \
+ (TText*)L"estdkeynkp9", \
+ (TText*)L"estdkeynkp0", \
+ (TText*)L"estdkeynkpfullstop", \
+ (TText*)L"estdkeymenu", \
+ (TText*)L"estdkeybacklighton", \
+ (TText*)L"estdkeybacklightoff", \
+ (TText*)L"estdkeybacklighttoggle", \
+ (TText*)L"estdkeyinccontrast", \
+ (TText*)L"estdkeydeccontrast", \
+ (TText*)L"estdkeysliderdown", \
+ (TText*)L"estdkeysliderup", \
+ (TText*)L"estdkeydictaphoneplay", \
+ (TText*)L"estdkeydictaphonestop", \
+ (TText*)L"estdkeydictaphonerecord", \
+ (TText*)L"estdkeyhelp", \
+ (TText*)L"estdkeyoff", \
+ (TText*)L"estdkeydial", \
+ (TText*)L"estdkeyincvolume", \
+ (TText*)L"estdkeydecvolume", \
+ (TText*)L"estdkeydevice0", \
+ (TText*)L"estdkeydevice1", \
+ (TText*)L"estdkeydevice2", \
+ (TText*)L"estdkeydevice3", \
+ (TText*)L"estdkeydevice4", \
+ (TText*)L"estdkeydevice5", \
+ (TText*)L"estdkeydevice6", \
+ (TText*)L"estdkeydevice7", \
+ (TText*)L"estdkeydevice8", \
+ (TText*)L"estdkeydevice9", \
+ (TText*)L"estdkeydevicea", \
+ (TText*)L"estdkeydeviceb", \
+ (TText*)L"estdkeydevicec", \
+ (TText*)L"estdkeydeviced", \
+ (TText*)L"estdkeydevicee", \
+ (TText*)L"estdkeydevicef", \
+ (TText*)L"estdkeyapplication0", \
+ (TText*)L"estdkeyapplication1", \
+ (TText*)L"estdkeyapplication2", \
+ (TText*)L"estdkeyapplication3", \
+ (TText*)L"estdkeyapplication4", \
+ (TText*)L"estdkeyapplication5", \
+ (TText*)L"estdkeyapplication6", \
+ (TText*)L"estdkeyapplication7", \
+ (TText*)L"estdkeyapplication8", \
+ (TText*)L"estdkeyapplication9", \
+ (TText*)L"estdkeyapplicationa", \
+ (TText*)L"estdkeyapplicationb", \
+ (TText*)L"estdkeyapplicationc", \
+ (TText*)L"estdkeyapplicationd", \
+ (TText*)L"estdkeyapplicatione", \
+ (TText*)L"estdkeyapplicationf", \
+ (TText*)L"estdkeyyes", \
+ (TText*)L"estdkeyno", \
+ (TText*)L"estdkeyincbrightness", \
+ (TText*)L"estdkeydecbrightness", \
+ (TText*)L"estdkeykeyboardextend", \
+ (TText*)L"estdkeydevice10", \
+ (TText*)L"estdkeydevice11", \
+ (TText*)L"estdkeydevice12", \
+ (TText*)L"estdkeydevice13", \
+ (TText*)L"estdkeydevice14", \
+ (TText*)L"estdkeydevice15", \
+ (TText*)L"estdkeydevice16", \
+ (TText*)L"estdkeydevice17", \
+ (TText*)L"estdkeydevice18", \
+ (TText*)L"estdkeydevice19", \
+ (TText*)L"estdkeydevice1a", \
+ (TText*)L"estdkeydevice1b", \
+ (TText*)L"estdkeydevice1c", \
+ (TText*)L"estdkeydevice1d", \
+ (TText*)L"estdkeydevice1e", \
+ (TText*)L"estdkeydevice1f", \
+ (TText*)L"estdkeyapplication10", \
+ (TText*)L"estdkeyapplication11", \
+ (TText*)L"estdkeyapplication12", \
+ (TText*)L"estdkeyapplication13", \
+ (TText*)L"estdkeyapplication14", \
+ (TText*)L"estdkeyapplication15", \
+ (TText*)L"estdkeyapplication16", \
+ (TText*)L"estdkeyapplication17", \
+ (TText*)L"estdkeyapplication18", \
+ (TText*)L"estdkeyapplication19", \
+ (TText*)L"estdkeyapplication1a", \
+ (TText*)L"estdkeyapplication1b", \
+ (TText*)L"estdkeyapplication1c", \
+ (TText*)L"estdkeyapplication1d", \
+ (TText*)L"estdkeyapplication1e", \
+ (TText*)L"estdkeyapplication1f", \
+ }
+
+/**
+ * Key scan codes definition macro.
+ */
+#define DefineKeyScanCodes( varName ) \
+ static TUint const varName[] = \
+ { \
+ (TUint)EStdKeyNull, \
+ (TUint)EStdKeyBackspace, \
+ (TUint)EStdKeyTab, \
+ (TUint)EStdKeyEnter, \
+ (TUint)EStdKeyEscape, \
+ (TUint)EStdKeySpace, \
+ (TUint)EStdKeyPrintScreen, \
+ (TUint)EStdKeyPause, \
+ (TUint)EStdKeyHome, \
+ (TUint)EStdKeyEnd, \
+ (TUint)EStdKeyPageUp, \
+ (TUint)EStdKeyPageDown, \
+ (TUint)EStdKeyInsert, \
+ (TUint)EStdKeyDelete, \
+ (TUint)EStdKeyLeftArrow, \
+ (TUint)EStdKeyRightArrow, \
+ (TUint)EStdKeyUpArrow, \
+ (TUint)EStdKeyDownArrow, \
+ (TUint)EStdKeyLeftShift, \
+ (TUint)EStdKeyRightShift, \
+ (TUint)EStdKeyLeftAlt, \
+ (TUint)EStdKeyRightAlt, \
+ (TUint)EStdKeyLeftCtrl, \
+ (TUint)EStdKeyRightCtrl, \
+ (TUint)EStdKeyLeftFunc, \
+ (TUint)EStdKeyRightFunc, \
+ (TUint)EStdKeyCapsLock, \
+ (TUint)EStdKeyNumLock, \
+ (TUint)EStdKeyScrollLock, \
+ (TUint)EStdKeyF1, \
+ (TUint)EStdKeyF2, \
+ (TUint)EStdKeyF3, \
+ (TUint)EStdKeyF4, \
+ (TUint)EStdKeyF5, \
+ (TUint)EStdKeyF6, \
+ (TUint)EStdKeyF7, \
+ (TUint)EStdKeyF8, \
+ (TUint)EStdKeyF9, \
+ (TUint)EStdKeyF10, \
+ (TUint)EStdKeyF11, \
+ (TUint)EStdKeyF12, \
+ (TUint)EStdKeyF13, \
+ (TUint)EStdKeyF14, \
+ (TUint)EStdKeyF15, \
+ (TUint)EStdKeyF16, \
+ (TUint)EStdKeyF17, \
+ (TUint)EStdKeyF18, \
+ (TUint)EStdKeyF19, \
+ (TUint)EStdKeyF20, \
+ (TUint)EStdKeyF21, \
+ (TUint)EStdKeyF22, \
+ (TUint)EStdKeyF23, \
+ (TUint)EStdKeyF24, \
+ (TUint)EStdKeyXXX, \
+ (TUint)EStdKeyComma, \
+ (TUint)EStdKeyFullStop, \
+ (TUint)EStdKeyForwardSlash, \
+ (TUint)EStdKeyBackSlash, \
+ (TUint)EStdKeySemiColon, \
+ (TUint)EStdKeySingleQuote, \
+ (TUint)EStdKeyHash, \
+ (TUint)EStdKeySquareBracketLeft, \
+ (TUint)EStdKeySquareBracketRight, \
+ (TUint)EStdKeyMinus, \
+ (TUint)EStdKeyEquals, \
+ (TUint)EStdKeyNkpForwardSlash, \
+ (TUint)EStdKeyNkpAsterisk, \
+ (TUint)EStdKeyNkpMinus, \
+ (TUint)EStdKeyNkpPlus, \
+ (TUint)EStdKeyNkpEnter, \
+ (TUint)EStdKeyNkp1, \
+ (TUint)EStdKeyNkp2, \
+ (TUint)EStdKeyNkp3, \
+ (TUint)EStdKeyNkp4, \
+ (TUint)EStdKeyNkp5, \
+ (TUint)EStdKeyNkp6, \
+ (TUint)EStdKeyNkp7, \
+ (TUint)EStdKeyNkp8, \
+ (TUint)EStdKeyNkp9, \
+ (TUint)EStdKeyNkp0, \
+ (TUint)EStdKeyNkpFullStop, \
+ (TUint)EStdKeyMenu, \
+ (TUint)EStdKeyBacklightOn, \
+ (TUint)EStdKeyBacklightOff, \
+ (TUint)EStdKeyBacklightToggle, \
+ (TUint)EStdKeyIncContrast, \
+ (TUint)EStdKeyDecContrast, \
+ (TUint)EStdKeySliderDown, \
+ (TUint)EStdKeySliderUp, \
+ (TUint)EStdKeyDictaphonePlay, \
+ (TUint)EStdKeyDictaphoneStop, \
+ (TUint)EStdKeyDictaphoneRecord, \
+ (TUint)EStdKeyHelp, \
+ (TUint)EStdKeyOff, \
+ (TUint)EStdKeyDial, \
+ (TUint)EStdKeyIncVolume, \
+ (TUint)EStdKeyDecVolume, \
+ (TUint)EStdKeyDevice0, \
+ (TUint)EStdKeyDevice1, \
+ (TUint)EStdKeyDevice2, \
+ (TUint)EStdKeyDevice3, \
+ (TUint)EStdKeyDevice4, \
+ (TUint)EStdKeyDevice5, \
+ (TUint)EStdKeyDevice6, \
+ (TUint)EStdKeyDevice7, \
+ (TUint)EStdKeyDevice8, \
+ (TUint)EStdKeyDevice9, \
+ (TUint)EStdKeyDeviceA, \
+ (TUint)EStdKeyDeviceB, \
+ (TUint)EStdKeyDeviceC, \
+ (TUint)EStdKeyDeviceD, \
+ (TUint)EStdKeyDeviceE, \
+ (TUint)EStdKeyDeviceF, \
+ (TUint)EStdKeyApplication0, \
+ (TUint)EStdKeyApplication1, \
+ (TUint)EStdKeyApplication2, \
+ (TUint)EStdKeyApplication3, \
+ (TUint)EStdKeyApplication4, \
+ (TUint)EStdKeyApplication5, \
+ (TUint)EStdKeyApplication6, \
+ (TUint)EStdKeyApplication7, \
+ (TUint)EStdKeyApplication8, \
+ (TUint)EStdKeyApplication9, \
+ (TUint)EStdKeyApplicationA, \
+ (TUint)EStdKeyApplicationB, \
+ (TUint)EStdKeyApplicationC, \
+ (TUint)EStdKeyApplicationD, \
+ (TUint)EStdKeyApplicationE, \
+ (TUint)EStdKeyApplicationF, \
+ (TUint)EStdKeyYes, \
+ (TUint)EStdKeyNo, \
+ (TUint)EStdKeyIncBrightness, \
+ (TUint)EStdKeyDecBrightness, \
+ (TUint)EStdKeyKeyboardExtend, \
+ (TUint)EStdKeyDevice10, \
+ (TUint)EStdKeyDevice11, \
+ (TUint)EStdKeyDevice12, \
+ (TUint)EStdKeyDevice13, \
+ (TUint)EStdKeyDevice14, \
+ (TUint)EStdKeyDevice15, \
+ (TUint)EStdKeyDevice16, \
+ (TUint)EStdKeyDevice17, \
+ (TUint)EStdKeyDevice18, \
+ (TUint)EStdKeyDevice19, \
+ (TUint)EStdKeyDevice1A, \
+ (TUint)EStdKeyDevice1B, \
+ (TUint)EStdKeyDevice1C, \
+ (TUint)EStdKeyDevice1D, \
+ (TUint)EStdKeyDevice1E, \
+ (TUint)EStdKeyDevice1F, \
+ (TUint)EStdKeyApplication10, \
+ (TUint)EStdKeyApplication11, \
+ (TUint)EStdKeyApplication12, \
+ (TUint)EStdKeyApplication13, \
+ (TUint)EStdKeyApplication14, \
+ (TUint)EStdKeyApplication15, \
+ (TUint)EStdKeyApplication16, \
+ (TUint)EStdKeyApplication17, \
+ (TUint)EStdKeyApplication18, \
+ (TUint)EStdKeyApplication19, \
+ (TUint)EStdKeyApplication1A, \
+ (TUint)EStdKeyApplication1B, \
+ (TUint)EStdKeyApplication1C, \
+ (TUint)EStdKeyApplication1D, \
+ (TUint)EStdKeyApplication1E, \
+ (TUint)EStdKeyApplication1F, \
+ }
+
+/**
+ * Key modifier names definition macro.
+ */
+#define DefineModifiers( varName ) \
+ static TUint const varName[] = \
+ { \
+ (TUint)EModifierAutorepeatable, \
+ (TUint)EModifierKeypad, \
+ (TUint)EModifierLeftAlt, \
+ (TUint)EModifierRightAlt, \
+ (TUint)EModifierAlt, \
+ (TUint)EModifierLeftCtrl, \
+ (TUint)EModifierRightCtrl, \
+ (TUint)EModifierCtrl, \
+ (TUint)EModifierLeftShift, \
+ (TUint)EModifierRightShift, \
+ (TUint)EModifierShift, \
+ (TUint)EModifierLeftFunc, \
+ (TUint)EModifierRightFunc, \
+ (TUint)EModifierFunc, \
+ (TUint)EModifierCapsLock, \
+ (TUint)EModifierNumLock, \
+ (TUint)EModifierScrollLock, \
+ (TUint)EModifierKeyUp, \
+ (TUint)EModifierSpecial, \
+ (TUint)EModifierDoubleClick, \
+ (TUint)EModifierPureKeycode, \
+ (TUint)EModifierKeyboardExtend, \
+ (TUint)EModifierCancelRotation, \
+ (TUint)EModifierRotateBy90, \
+ (TUint)EModifierRotateBy180, \
+ (TUint)EModifierRotateBy270, \
+ (TUint)EModifierPointer3DButton1, \
+ (TUint)EModifierPointer3DButton2, \
+ (TUint)EModifierPointer3DButton3, \
+ (TUint)EAllModifiers, \
+ }
+
+/**
+ * Key modifiers definition macro.
+ */
+#define DefineModifierNames( varName ) \
+ static TText* const varName[] = \
+ { \
+ (TText*)L"estdkeynull", \
+ (TText*)L"emodifierautorepeatable", \
+ (TText*)L"emodifierkeypad", \
+ (TText*)L"emodifierleftalt", \
+ (TText*)L"emodifierrightalt", \
+ (TText*)L"emodifieralt", \
+ (TText*)L"emodifierleftctrl", \
+ (TText*)L"emodifierrightctrl", \
+ (TText*)L"emodifierctrl", \
+ (TText*)L"emodifierleftshift", \
+ (TText*)L"emodifierrightshift", \
+ (TText*)L"emodifiershift", \
+ (TText*)L"emodifierleftfunc", \
+ (TText*)L"emodifierrightfunc", \
+ (TText*)L"emodifierfunc", \
+ (TText*)L"emodifiercapslock", \
+ (TText*)L"emodifiernumlock", \
+ (TText*)L"emodifierscrolllock", \
+ (TText*)L"emodifierkeyup", \
+ (TText*)L"emodifierspecial", \
+ (TText*)L"emodifierdoubleclick", \
+ (TText*)L"emodifierpurekeycode", \
+ (TText*)L"emodifierkeyboardextend", \
+ (TText*)L"emodifiercancelrotation", \
+ (TText*)L"emodifierrotateby90", \
+ (TText*)L"emodifierrotateby180", \
+ (TText*)L"emodifierrotateby270", \
+ (TText*)L"emodifierpointer3dbutton1", \
+ (TText*)L"emodifierpointer3dbutton2", \
+ (TText*)L"emodifierpointer3dbutton3", \
+ (TText*)L"eallmodifiers", \
+ }
+
+
+/**
+ * Pointer event type names definition macro
+ */
+#define DefinePointerEventTypeNames( varName ) \
+ static TText* const varName[] = \
+ { \
+ (TText*)L"epointermove", \
+ (TText*)L"epointerswitchon", \
+ (TText*)L"ebutton1down", \
+ (TText*)L"ebutton1up", \
+ (TText*)L"ebutton2down", \
+ (TText*)L"ebutton2up", \
+ (TText*)L"ebutton3down", \
+ (TText*)L"ebutton3up", \
+ (TText*)L"ebutton1", \
+ (TText*)L"ebutton2", \
+ (TText*)L"ebutton3", \
+ }
+
+/**
+ * Pointer event type codes definition macro.
+ */
+#define DefinePointerEventTypes( varName ) \
+ static TInt const varName[] = \
+ { \
+ (TUint)TRawEvent::EPointerMove, \
+ (TUint)TRawEvent::EPointerSwitchOn, \
+ (TUint)TRawEvent::EButton1Down, \
+ (TUint)TRawEvent::EButton1Up, \
+ (TUint)TRawEvent::EButton2Down, \
+ (TUint)TRawEvent::EButton2Up, \
+ (TUint)TRawEvent::EButton3Down, \
+ (TUint)TRawEvent::EButton3Up, \
+ (TUint)TEventUtil::EButton1, \
+ (TUint)TEventUtil::EButton2, \
+ (TUint)TEventUtil::EButton3, \
+ }
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: TEventUtil
+
+ Method: GetKeyCodeName
+
+ Description: Gets key name.
+
+ Returns selected key name.
+
+ Parameters: TUint aKeyCode: out: Key code.
+
+ Return Values: Key name.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TPtrC TEventUtil::GetKeyCodeName( TUint aKeyCode )
+ {
+ DefineKeyCodeNames( keyCodeNames );
+ DefineKeyCodes( keyCodes );
+ int keyCodeNamesCount = (sizeof( keyCodeNames )/sizeof(TText*));
+
+ for ( int i = 0; i < keyCodeNamesCount; i++ ) {
+ if ( keyCodes[ i ] == aKeyCode )
+ {
+ return keyCodeNames[ i ];
+ }
+ }
+
+ return NULL;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: TEventUtil
+
+ Method: GetKeyScanCodeName
+
+ Description: Gets key scan code name.
+
+ Returns selected key scan code name.
+
+ Parameters: TUint aKeyCode: out: Key scan code.
+
+ Return Values: Key scan code name.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TPtrC TEventUtil::GetKeyScanCodeName( TInt aKeyScanCode )
+ {
+ DefineKeyScanCodeNames( keyScanCodeNames );
+ DefineKeyScanCodes( keyScanCodes );
+ int keyScanCodeNamesCount = (sizeof( keyScanCodeNames )/sizeof(TText*));
+
+ for ( int i = 0; i < keyScanCodeNamesCount; i++ ) {
+ if ( keyScanCodes[ i ] == (TUint)aKeyScanCode )
+ {
+ return keyScanCodeNames[ i ];
+ }
+ }
+
+ return NULL;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: TEventUtil
+
+ Method: GetModifierName
+
+ Description: Gets key modifier name.
+
+ Returns selected key modifier name.
+
+ Parameters: TUint aModifier: out: Key modifier.
+
+ Return Values: Key modifier name.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TPtrC TEventUtil::GetModifierName( TUint aModifier )
+ {
+ DefineModifierNames( modifierNames );
+ DefineModifiers( modifiers );
+ int modifierNamesCount = (sizeof( modifierNames )/sizeof(TText*));
+
+ for ( int i = 0; i < modifierNamesCount; i++ ) {
+ if ( modifiers[ i ] == aModifier )
+ {
+ return modifierNames[ i ];
+ }
+ }
+
+ return NULL;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: TEventUtil
+
+ Method: ParseKeyCode
+
+ Description: Parses key code.
+
+ Parses key code.
+
+ Parameters: TDesC& aKeyCodeName: in: Key code name.
+ TUint& aKeyCode: out: Parsed key code.
+
+ Return Values: KErrNone if key code was parsed successfuly,
+ KErrNotFound in other case.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt TEventUtil::ParseKeyCode( const TDesC& aKeyCodeName, TUint& aKeyCode )
+ {
+ DefineKeyCodeNames( keyCodeNames );
+ DefineKeyCodes( keyCodes );
+ int keyCodeNamesCount = (sizeof( keyCodeNames )/sizeof(TText*));
+
+ TBuf<64> keyCodeNameLowerCase( aKeyCodeName );
+ keyCodeNameLowerCase.LowerCase();
+ for ( int i = 0; i < keyCodeNamesCount; i++ ) {
+ if ( TPtrC( keyCodeNames[ i ] ).Compare( keyCodeNameLowerCase ) == 0 )
+ {
+ aKeyCode = keyCodes[ i ];
+ return KErrNone;
+ }
+ }
+
+ return KErrNotFound;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: TEventUtil
+
+ Method: ParseKeyScanCode
+
+ Description: Parses key scan code.
+
+ Parses key scan code.
+
+ Parameters: TDesC& aKeyScanCodeName: in: Key scan code name.
+ TUint& aKeyScanCode: out: Parsed key scan code.
+
+ Return Values: KErrNone if key scan code was parsed successfuly,
+ KErrNotFound in other case.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt TEventUtil::ParseKeyScanCode( const TDesC& aKeyScanCodeName, TInt& aKeyScanCode )
+ {
+ DefineKeyScanCodeNames( keyScanCodeNames );
+ DefineKeyScanCodes( keyScanCodes );
+ int keyScanCodeNamesCount = (sizeof( keyScanCodeNames )/sizeof(TText*));
+
+ TBuf<64> keyScanCodeNameLowerCase( aKeyScanCodeName );
+ keyScanCodeNameLowerCase.LowerCase();
+ for ( int i = 0; i < keyScanCodeNamesCount; i++ ) {
+ if ( TPtrC( keyScanCodeNames[ i ] ).Compare( keyScanCodeNameLowerCase ) == 0 )
+ {
+ aKeyScanCode = keyScanCodes[ i ];
+ return KErrNone;
+ }
+ }
+
+ return KErrNotFound;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: TEventUtil
+
+ Method: ParseModifier
+
+ Description: Parses key modifier.
+
+ Parses key modifier.
+
+ Parameters: TDesC& aModifierName: in: Key modifier name.
+ TUint& aModifier: out: Parsed key modifier.
+
+ Return Values: KErrNone if key modifier was parsed successfuly,
+ KErrNotFound in other case.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt TEventUtil::ParseModifier( const TDesC& aModifierName, TUint& aModifier )
+ {
+ DefineModifierNames( modifierNames );
+ DefineModifiers( modifiers );
+ int modifierNamesCount = (sizeof( modifierNames )/sizeof(TText*));
+
+ TBuf<64> modifierNameLowerCase( aModifierName );
+ modifierNameLowerCase.LowerCase();
+ for ( int i = 0; i < modifierNamesCount; i++ ) {
+ if ( TPtrC( modifierNames[ i ] ).Compare( modifierNameLowerCase ) == 0 )
+ {
+ aModifier = modifiers[ i ];
+ return KErrNone;
+ }
+ }
+
+ return KErrNotFound;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CAknUiEnvProxy
+
+ Method: ParsePointerEventType
+
+ Description: Parses pointer event type.
+
+ Parses key modifier.
+
+ Parameters: const TDesC& aPointerEventTypeName: in: Pointer event type.
+ TUint& aModifier: out: Parsed pointer event type.
+
+ Return Values: KErrNone if no error occures during parsing.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt TEventUtil::ParsePointerEventType( const TDesC& aPointerEventTypeName, TUint& aPointerEventType )
+ {
+ DefinePointerEventTypeNames( pointerEventTypeNames );
+ DefinePointerEventTypes( pointerEventTypes );
+ int pointerEventTypeNamesCount = (sizeof( pointerEventTypeNames )/sizeof(TText*));
+
+ TBuf<64> pointerEventTypeNamesLowerCase( aPointerEventTypeName );
+ pointerEventTypeNamesLowerCase.LowerCase();
+ for ( int i = 0; i < pointerEventTypeNamesCount; i++ ) {
+ if ( TPtrC( pointerEventTypeNames[ i ] ).Compare( pointerEventTypeNamesLowerCase ) == 0 )
+ {
+ aPointerEventType = pointerEventTypes[ i ];
+ return KErrNone;
+ }
+ }
+
+ return KErrNotFound;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/TestServerThreadStarter.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,393 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This module contains the implementation of
+* CTestServerThreadStarter class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "TestServerThreadStarter.h"
+#include <stifinternal/TestServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+/**
+ * CTestServerThreadStarter thread heap size.
+ */
+const TUint KDefaultHeapSize = 0x10000; // 64 K
+
+/**
+ * CTestServerThreadStarter thread max heap size.
+ */
+const TUint KMaxHeapSize = 0x20000; // 128 K
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CTestServerThreadStarter
+
+ Method: TestServerStarterThreadFunction
+
+ Description: CTestServerThreadStarter thread function.
+
+ CTestServerThreadStarter thread function in which testserver creation code
+ is executed.
+
+ Parameters: TAny* aParameters: in: Pointer to CTestServerThreadStarter object
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestServerThreadStarter::TestServerStarterThreadFunction( TAny* aParameters )
+ {
+ RDebug::Printf( "UITESTING: CTestServerThreadStarter::TestServerStarterThreadFunction" );
+
+ CTestServerThreadStarter* testServerStarter = (CTestServerThreadStarter*)aParameters;
+ TThreadId mainThreadId = testServerStarter->iMainThreadId;
+ CTestThreadContainerRunnerFactory* testThreadContainerRunnerFactory =
+ testServerStarter->iTestThreadContainerRunnerFactory;
+
+ // Signal that all needed data is copied and main thread can continue its execution
+ testServerStarter->iServerThreadStartedSemaphore.Signal();
+
+ // Get module name from command line
+ const TInt length = User().CommandLineLength();
+
+ HBufC* cmdLine = HBufC::New( length );
+
+ if ( cmdLine == NULL )
+ {
+ return KErrNoMemory;
+ }
+
+ TPtr moduleName = cmdLine->Des();
+
+ User().CommandLine( moduleName );
+
+ RDebug::Print(_L("CTestServerThreadStarter::TestServerStarterThreadFunction() Received data [%S]"), &moduleName);
+
+ // Extract semaphore name passed in data
+ TInt index = moduleName.Find(_L(" "));
+ RDebug::Print(_L("CTestServerThreadStarter::TestServerStarterThreadFunction() Space separator found at position [%d]"), index);
+ TPtrC semaphoreName = moduleName.Mid(index + 1);
+ moduleName = moduleName.Left(index);
+
+ RDebug::Print(_L("CTestServerThreadStarter::TestServerStarterThreadFunction() Extracted module name [%S] and sempahore name [%S]"), &moduleName, &semaphoreName);
+
+ // Open start-up synchronization semaphore
+ RSemaphore startup;
+ RDebug::Print(_L(" Openingstart-up semaphore"));
+ //TName semaphoreName = _L("startupSemaphore");
+ //semaphoreName.Append( moduleName );
+
+ TInt res = startup.OpenGlobal(semaphoreName);
+ RDebug::Print(_L("Opening result %d"), res);
+
+
+ TFileName serverName;
+ TInt r = StartNewServer ( moduleName, serverName, EFalse, startup, true, testThreadContainerRunnerFactory );
+
+ if ( r == KErrAlreadyExists )
+ {
+ // Ok, server was already started
+ RDebug::Print(_L("UI TestServer already started, signaling semaphore and exiting"));
+ startup.Signal();
+
+ delete cmdLine;
+
+ return KErrNone;
+ }
+ else
+ {
+ RDebug::Print(_L("UI TestServer is finished, code %d"), r);
+ }
+
+ delete cmdLine;
+
+ //delete testThreadContainerRunnerFactory;
+ testThreadContainerRunnerFactory = NULL;
+
+ // Kill main thread to end UITestServerStarter application
+ // when testserver is finished
+ RThread mainThread;
+ TInt ret = mainThread.Open( mainThreadId );
+ if( ret != KErrNone )
+ {
+ User::Panic( _L("ThreadHandleOpenError"), ret );
+ }
+ mainThread.Kill( KErrNone );
+
+ return r;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CTestServerThreadStarter
+
+ Method: NewL
+
+ Description: NewL is first phase of two-phased constructor.
+
+ NewL is first phase of two-phased constructor.
+
+ Parameters: None.
+
+ Return Values: Pointer to new CTestServerThreadStarter object.
+
+ Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestServerThreadStarter* CTestServerThreadStarter::NewL( )
+ {
+ CTestServerThreadStarter* self = new(ELeave) CTestServerThreadStarter();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CTestServerThreadStarter
+
+ Method: CTestServerThreadStarter
+
+ Description: Default constructor.
+
+ Default constructor.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestServerThreadStarter::CTestServerThreadStarter()
+:CActive( EPriorityNormal )
+ {
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CTestServerThreadStarter
+
+ Method: NewL
+
+ Description: Default destructor.
+
+ Default destructor.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestServerThreadStarter::~CTestServerThreadStarter()
+ {
+ Cancel();
+ iTimer.Close();
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CTestServerThreadStarter
+
+ Method: ConstructL
+
+ Description: Second phase of two-phased constructor.
+
+ Second phase of two-phased constructor.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestServerThreadStarter::ConstructL()
+ {
+ TInt ret = iTimer.CreateLocal();
+ if ( ret != KErrNone )
+ {
+ User::Leave( ret );
+ }
+
+ CActiveScheduler::Add( this );
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CTestServerThreadStarter
+
+ Method: RunTestServerThread
+
+ Description: Starts-up testserver.
+
+ Starts-up testserver.
+
+ Parameters: None.
+
+ Return Values: KErrNone when there was no error.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestServerThreadStarter::RunTestServerThread( CTestThreadContainerRunnerFactory* aTestThreadContainerRunnerFactory )
+ {
+ if ( IsActive() )
+ {
+ User::Panic( _L("E32USER-CBase"), 42 );
+ }
+
+ TInt ret = iServerThreadStartedSemaphore.CreateLocal( 0 );
+ if ( ret != KErrNone )
+ {
+ User::Leave( ret );
+ }
+
+ iTestThreadContainerRunnerFactory = aTestThreadContainerRunnerFactory;
+ iMainThreadId = RThread().Id();
+ iReturnCode = KErrNone;
+
+ iStatus = KRequestPending;
+
+ SetActive();
+ iTimer.After( iStatus, 0 );
+
+ return KErrNone;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CTestServerThreadStarter
+
+ Method: RunL
+
+ Description: RunL derived from CActive handles the completed requests.
+
+ RunL derived from CActive handles the completed requests.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: Leaves if one of the called method leavs.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestServerThreadStarter::RunL()
+ {
+ RThread testServerStarterThread;
+ TInt ret = testServerStarterThread.Create( _L("testserverstarterthread"),
+ TestServerStarterThreadFunction, 10 * KDefaultStackSize, 10 * KDefaultHeapSize, 10 * KMaxHeapSize, this );
+
+ User::LeaveIfError( ret );
+
+ testServerStarterThread.Resume();
+ testServerStarterThread.Close();
+
+ iServerThreadStartedSemaphore.Wait();
+ iServerThreadStartedSemaphore.Close();
+
+ // Delete CTestServerThreadStarter after testserver is started
+ delete this;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CTestServerThreadStarter
+
+ Method: DoCancel
+
+ Description: DoCancel derived from CActive handles the Cancel.
+
+ DoCancel derived from CActive handles the Cancel.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestServerThreadStarter::DoCancel()
+ {
+ if ( IsActive() )
+ {
+ iTimer.Cancel();
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarter.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This module contains the implementation of application
+* main function.
+*
+*/
+
+// INCLUDE FILES
+#include <eikstart.h>
+#include "UITestServerStarterAppUi.h"
+#include "UITestServerStarterApplication.h"
+#include <eikenv.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+/**
+ * Application factory function.
+ */
+LOCAL_C CApaApplication* NewApplication()
+ {
+ return new CUITestServerStarterApplication;
+ }
+
+// ================= MEMBER FUNCTIONS =========================================
+/**
+ * Application main function.
+ */
+GLDEF_C TInt E32Main()
+ {
+
+ RDebug::Printf( "UITESTING: UITestServerStarter - E32Main" );
+
+ TInt ret = EikStart::RunApplication( NewApplication );
+
+ RDebug::Printf( "UITESTING: UITestServerStarter - E32Main End" );
+
+ return ret;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarterAppContainer.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,290 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This module contains the implementation of
+* CUITestServerStarterAppContainer class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "UITestServerStarterAppContainer.h"
+#include <AknsDrawUtils.h>
+#include <AknsBasicBackgroundControlContext.h>
+#include <AknDef.h>
+#include <AknUtils.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppContainer
+
+ Method: NewL
+
+ Description: NewL is first phase of two-phased constructor.
+
+ NewL is first phase of two-phased constructor.
+
+ Parameters: const TRect& aRect: container rectangle.
+
+ Return Values: Pointer to new CUITestServerStarterAppContainer object.
+
+ Errors/Exceptions: Leave if one of the called functions leaves.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppContainer* CUITestServerStarterAppContainer::NewL( const TRect& aRect )
+ {
+ CUITestServerStarterAppContainer* self = NewLC( aRect );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppContainer
+
+ Method: NewLC
+
+ Description: NewL is first phase of two-phased constructor.
+
+ NewL is first phase of two-phased constructor.
+
+ Parameters: const TRect& aRect: container rect
+
+ Return Values: Pointer to new CUITestServerStarterAppContainer object.
+
+ Errors/Exceptions: Leave if one of the called functions leaves.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppContainer* CUITestServerStarterAppContainer::NewLC( const TRect& aRect )
+ {
+ CUITestServerStarterAppContainer* self =
+ new(ELeave)CUITestServerStarterAppContainer;
+ CleanupStack::PushL( self );
+ self->ConstructL( aRect );
+ return self;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppContainer
+
+ Method: CUITestServerStarterAppContainer
+
+ Description: C++ constructor.
+
+ C++ constructor.
+
+ Parameters: None
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppContainer::CUITestServerStarterAppContainer()
+ {
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppContainer
+
+ Method: CUITestServerStarterAppContainer
+
+ Description: C++ destructor.
+
+ C++ destructor.
+
+ Parameters: None
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppContainer::~CUITestServerStarterAppContainer()
+ {
+ delete iBgContext;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppContainer
+
+ Method: ConstructL
+
+ Description: ConstructL is second phase of two-phased constructor.
+
+ ConstructL is second phase of two-phased constructor.
+
+ Parameters: const TRect& aRect: container rectangle.
+
+ Return Values: None
+
+ Errors/Exceptions: Leave if one of the called functions leaves.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppContainer::ConstructL( const TRect& aRect )
+ {
+ CreateWindowL();
+
+ iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, aRect, ETrue );
+
+ SetRect( aRect );
+ ActivateL();
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppContainer
+
+ Method: Draw
+
+ Description: Draws the control.
+
+ Draws the control.
+
+ Parameters: const TRect& aRect: rectangle which should be redrawn.
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppContainer::Draw( const TRect& aRect ) const
+ {
+ // Get the standard graphics context
+ CWindowGc& gc = SystemGc();
+
+ // Redraw the background using the default skin
+ MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+ MAknsControlContext* controlContext = AknsDrawUtils::ControlContext( this );
+ AknsDrawUtils::Background( skin, controlContext, this, gc, aRect );
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppContainer
+
+ Method: SizeChanged
+
+ Description: Responds to changes to the size and position of the contents of this control
+
+ Responds to changes to the size and position of the
+ contents of this control
+
+ Parameters: None
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppContainer::SizeChanged()
+ {
+ if ( iBgContext )
+ {
+ iBgContext->SetRect( Rect() );
+ if ( &Window() )
+ {
+ iBgContext->SetParentPos( PositionRelativeToScreen() );
+ }
+ }
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppContainer
+
+ Method: MopSupplyObject
+
+ Description: This function is used to allow controls to ask their owners for access to other objects that they own
+
+ This function is used to allow controls to ask their owners
+ for access to other objects that they own
+
+ Parameters: TTypeUid aId: requested object type id.
+
+ Return Values: Pointer to requested object.
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TTypeUid::Ptr CUITestServerStarterAppContainer::MopSupplyObject( TTypeUid aId )
+ {
+ if ( iBgContext )
+ {
+ return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+ }
+ return CCoeControl::MopSupplyObject( aId );
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarterAppUi.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,510 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This module contains the implementation of
+* CUITestServerStarterAppUi class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <avkon.hrh>
+#include <aknmessagequerydialog.h>
+#include <aknnotewrappers.h>
+#include <StringLoader.h>
+#include <f32file.h>
+#include <s32file.h>
+#include <hlplch.h>
+
+#include <UITestServerStarter.rsg>
+
+#include "UITestServerStarter.hrh"
+#include "UITestServerStarterAppUi.h"
+#include "UITestServerStarterAppView.h"
+
+#include "TestServerThreadStarter.h"
+#include <stifinternal/TestThreadContainerRunnerFactory.h>
+#include "AknUiEnvProxy.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: ConstructL
+
+ Description: ConstructL is second phase of two-phased constructor.
+
+ ConstructL is second phase of two-phased constructor.
+
+ Parameters: None
+
+ Return Values: None.
+
+ Errors/Exceptions: Leaves if one of called functions leave.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::ConstructL()
+ {
+ RDebug::Printf( "UITESTING: CUITestServerStarterAppUi::ConstructL - Begin" );
+
+ // Initialise app UI with standard value.
+ BaseConstructL( ENoAppResourceFile || CAknAppUi::EAknEnableSkin );
+
+ CEikonEnv::Static()->DisableExitChecks( true );
+
+ // Create view object
+ iAppView = CUITestServerStarterAppView::NewL();
+
+ AddViewL( iAppView );
+ SetDefaultViewL( *iAppView );
+
+ CAknUiEnvProxy* uiEnvProxy = CAknUiEnvProxy::NewL( this );
+
+ CTestThreadContainerRunnerFactory* testThreadContainerRunnerFactory =
+ CTestThreadContainerRunnerFactory::NewL( RThread().Id(), CActiveScheduler::Current(), uiEnvProxy );
+
+ RDebug::Printf( "UITESTING: CUITestServerStarterAppUi::ConstructL - Starting TestServer" );
+ CTestServerThreadStarter* testServerThreadStarter = CTestServerThreadStarter::NewL( );
+ testServerThreadStarter->RunTestServerThread( testThreadContainerRunnerFactory );
+
+ RDebug::Printf( "UITESTING: CUITestServerStarterAppUi::ConstructL - Move to background" );
+
+ TApaTask task( CCoeEnv::Static()->WsSession() );
+ task.SetWgId( CCoeEnv::Static()->RootWin().Identifier() );
+ task.SendToBackground();
+
+ RDebug::Printf( "UITESTING: CUITestServerStarterAppUi::ConstructL - End" );
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: CUITestServerStarterAppUi
+
+ Description: C++ default constructor can NOT contain any code, that might leave.
+
+ C++ default constructor can NOT contain any code, that might leave.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppUi::CUITestServerStarterAppUi()
+ {
+ // No implementation required
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: ~CUITestServerStarterAppUi
+
+ Description: C++ destructor.
+
+ C++ destructor.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppUi::~CUITestServerStarterAppUi()
+ {
+ // No implementation required
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: HandleCommandL
+
+ Description: Handles user commands.
+
+ Derived from CCoeAppUi. Handles user commands.
+
+ Parameters: TInt aCommand: in: User command code.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::HandleCommandL( TInt )
+ {
+ // No implementation required
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: HandleWsEventL
+
+ Description: Handles window server event.
+
+ Derived from CCoeAppUi. Handles window server event.
+
+ Parameters: const TWsEvent& aEvent: in: Event.
+ CCoeControl* aDestination: in: Destination control.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination )
+ {
+ CAknAppUi::HandleWsEventL( aEvent, aDestination );
+
+ if ( ( aEvent.Type() == EEventKey ) )
+ {
+ switch( iEventType )
+ {
+ case EPressKey:
+ {
+ if ( iEventStatus != NULL )
+ {
+ KeyPressHandled();
+ }
+ }
+ break;
+ case ETypeText:
+ {
+ iTypeTextLength--;
+ if ( ( iEventStatus != NULL ) && ( iTypeTextLength == 0 ) )
+ {
+ TextTypeHandled();
+ }
+ }
+ break;
+ default:
+ // Do nothing
+ break;
+ }
+ }
+ else if ( aEvent.Type() == EEventPointer )
+ {
+ if ( iEventType == EPointerEvent )
+ {
+ PointerEventHandled();
+ }
+ }
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: PrepareToTypeText
+
+ Description: Prepares AppUi to recive type text event
+
+ Prepares AppUi to recive type text event
+
+ Parameters: TInt aTextLength: in: Text length.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::PrepareToTypeText( TInt aTextLength )
+ {
+ iTypeTextLength = aTextLength;
+ iEventType = ETypeText;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: PrepareToPressKey
+
+ Description: Prepares AppUi to recive key press event
+
+ Prepares AppUi to recive key press event
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::PrepareToPressKey()
+ {
+ iEventType = EPressKey;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: PrepareToPointerEvent
+
+ Description: Prepares AppUi to recive pointer event
+
+ Prepares AppUi to recive key press event
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::PrepareToPointerEvent()
+ {
+ iEventType = EPointerEvent;
+ }
+
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: KeyPressHandled
+
+ Description: Sends notification that key press was handled.
+
+ Notifies client that key press was handled.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::KeyPressHandled()
+ {
+ if ( ( iEventType == EPressKey ) && ( iEventStatus != NULL ) && ( iEventType == EPressKey ) )
+ {
+ iEventType = ENone;
+ User::RequestComplete( iEventStatus, KErrNone );
+ iEventStatus = NULL;
+ }
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: TextTypeHandled
+
+ Description: Sends notification that type text was handled.
+
+ Notifies client that type text was handled.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::TextTypeHandled()
+ {
+ if ( ( iEventType == ETypeText ) && ( iEventStatus != NULL ) && ( iEventType == ETypeText ) )
+ {
+ iEventType = ENone;
+ iTypeTextLength = 0;
+ User::RequestComplete( iEventStatus, KErrNone );
+ iEventStatus = NULL;
+ }
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: PointerEventHandled
+
+ Description: Sends notification that pointer event was handled.
+
+ Notifies client that pointer event was handled.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::PointerEventHandled()
+ {
+ if ( ( iEventType == EPointerEvent ) && ( iEventStatus != NULL ) )
+ {
+ iEventType = ENone;
+ User::RequestComplete( iEventStatus, KErrNone );
+ iEventStatus = NULL;
+ }
+ }
+
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: NotifyAboutHandledKeyPress
+
+ Description: Requests notification of press key completion.
+
+ Requests notification of press key completion.
+
+ Parameters: TRequestStatus* aStatus: in: Request status pointer.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::NotifyAboutHandledKeyPress( TRequestStatus* aStatus )
+ {
+ iEventStatus = aStatus;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: NotifyAboutHandledTextType
+
+ Description: Requests notification when text type event is handled.
+
+ Requests notification when text type event is handled.
+
+ Parameters: TRequestStatus* aStatus: in: Request status pointer.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::NotifyAboutHandledTextType( TRequestStatus* aStatus )
+ {
+ iEventStatus = aStatus;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppUi
+
+ Method: NotifyAboutHandledPointerEvent
+
+ Description: Requests notification when pointer event is handled.
+
+ Requests notification when pointer event is handled.
+
+ Parameters: TRequestStatus* aStatus: in: Request status pointer.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::NotifyAboutHandledPointerEvent( TRequestStatus* aStatus )
+ {
+ iEventStatus = aStatus;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarterAppView.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,345 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Description: This module contains the
+* implementation of CUITestServerStarterAppView class member
+* functions.
+*
+*/
+
+// INCLUDE FILES
+#include <coemain.h>
+#include <aknViewAppUi.h>
+#include "UITestServerStarterAppView.h"
+#include "UITestServerStarterApplication.h"
+#include "UITestServerStarterAppContainer.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppView
+
+ Method: NewL
+
+ Description: NewL is first phase of two-phased constructor.
+
+ NewL is first phase of two-phased constructor.
+
+ Parameters: None
+
+ Return Values: Pointer to new CUITestServerStarterAppView object.
+
+ Errors/Exceptions: Leave if one of the called functions leaves.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppView* CUITestServerStarterAppView::NewL()
+ {
+ CUITestServerStarterAppView* self = CUITestServerStarterAppView::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppView
+
+ Method: NewLC
+
+ Description: NewL is first phase of two-phased constructor.
+
+ NewL is first phase of two-phased constructor.
+
+ Parameters: None
+
+ Return Values: Pointer to new CUITestServerStarterAppView object.
+
+ Errors/Exceptions: Leave if one of the called functions leaves.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppView* CUITestServerStarterAppView::NewLC()
+ {
+ CUITestServerStarterAppView* self = new ( ELeave ) CUITestServerStarterAppView;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppView
+
+ Method: ConstructL
+
+ Description: ConstructL is second phase of two-phased constructor.
+
+ ConstructL is second phase of two-phased constructor.
+
+ Parameters: None
+
+ Return Values: None
+
+ Errors/Exceptions: Leave if one of the called functions leaves.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppView::ConstructL()
+ {
+ BaseConstructL( 0 );
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppView
+
+ Method: CUITestServerStarterAppView
+
+ Description: C++ constructor.
+
+ C++ constructor.
+
+ Parameters: None
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppView::CUITestServerStarterAppView()
+ {
+ // No implementation required
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppView
+
+ Method: CUITestServerStarterAppView
+
+ Description: C++ destructor.
+
+ C++ destructor.
+
+ Parameters: None
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppView::~CUITestServerStarterAppView()
+ {
+ if ( iContainer )
+ {
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ }
+
+ delete iContainer;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppView
+
+ Method: Id
+
+ Description: Returns view Uid.
+
+ Returns view Uid.
+
+ Parameters: None
+
+ Return Values: View Uid
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TUid CUITestServerStarterAppView::Id() const
+ {
+ return KMainViewId;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppView
+
+ Method: HandleCommandL
+
+ Description: Handle Commands.
+
+ Handle Commands.
+
+ Parameters: TInt aCommand: command id
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppView::HandleCommandL( TInt aCommand )
+ {
+ AppUi()->HandleCommandL( aCommand );
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppView
+
+ Method: HandleClientRectChange
+
+ Description: Handle size changes.
+
+ Handle size changes.
+
+ Parameters: None
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppView::HandleClientRectChange()
+ {
+ if ( iContainer )
+ {
+ iContainer->SetRect( ClientRect() );
+ }
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppView
+
+ Method: DoActivateL
+
+ Description: From AknView, Activates view.
+
+ From AknView, Activates view.
+
+ Parameters: const TVwsViewId& aPrevViewId: previouse view id
+ TUid aCustomMessageId: custom message id
+ const TDesC8& aCustomMessage: custom message data
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppView::DoActivateL(
+ const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/)
+ {
+ if ( !iContainer )
+ {
+ // Create view container
+ iContainer = CUITestServerStarterAppContainer::NewL( ClientRect() );
+ iContainer->SetMopParent( this );
+ // Add container to view stack
+ AppUi()->AddToStackL( *this, iContainer );
+ }
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterAppView
+
+ Method: DoDeactivate
+
+ Description: From AknView, Deactivates view.
+
+ From AknView, Deactivates view.
+
+ Parameters: None
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppView::DoDeactivate()
+ {
+ if ( iContainer )
+ {
+ // Remove container from view stack
+ AppUi()->RemoveFromViewStack( *this, iContainer );
+ }
+
+ // Delete container since it's not longer needed.
+ delete iContainer;
+ iContainer = NULL;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarterApplication.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This module contains the implementation of
+* CUITestServerStarterApplication class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "UITestServerStarter.hrh"
+#include "UITestServerStarterDocument.h"
+#include "UITestServerStarterApplication.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterApplication
+
+ Method: CreateDocumentL
+
+ Creates CUITestServerStarterDocument document object.
+
+ Creates CUITestServerStarterDocument document object. The returned
+ pointer in not owned by the CUITestServerStarterApplication object.
+
+ Parameters: None
+
+ Return Values: A pointer to the created document object.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CApaDocument* CUITestServerStarterApplication::CreateDocumentL ()
+ {
+ return (static_cast<CApaDocument*> (CUITestServerStarterDocument::NewL ( *this) ) );
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterApplication
+
+ Method: AppDllUid
+
+ Gets application Uid
+
+ Gets application Uid
+
+ Parameters: None
+
+ Return Values: Application Uid.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TUid CUITestServerStarterApplication::AppDllUid() const
+ {
+ return KUidUITestServerStarterApp;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: PreDocConstructL
+
+ Method: AppDllUid
+
+ Preconstructs document.
+
+ Preconstructs document.
+
+ Parameters: None
+
+ Return Values: None
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterApplication::PreDocConstructL()
+ {
+ // This call allow us to run multiple instances of UI application in same time.
+ CEikApplication::PreDocConstructL();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarterDocument.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,214 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This module contains the implementation of
+* CUITestServerStarterDocument class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "UITestServerStarterAppUi.h"
+#include "UITestServerStarterDocument.h"
+
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterDocument
+
+ Method: NewL
+
+ Description: NewL is first phase of two-phased constructor.
+
+ NewL is first phase of two-phased constructor.
+
+ Parameters: CEikApplication& aApp: in: Reference to application..
+
+ Return Values: Pointer to new CUITestServerStarterDocument object.
+
+ Errors/Exceptions: Leave if one of the called functions leaves.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterDocument* CUITestServerStarterDocument::NewL( CEikApplication& aApp )
+ {
+ CUITestServerStarterDocument* self = NewLC (aApp);
+ CleanupStack::Pop (self);
+ return self;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterDocument
+
+ Method: NewLC
+
+ Description: NewL is first phase of two-phased constructor.
+
+ NewL is first phase of two-phased constructor.
+
+ Parameters: CEikApplication& aApp: in: Reference to application.
+
+ Return Values: Pointer to new CUITestServerStarterDocument object.
+
+ Errors/Exceptions: Leave if one of the called functions leaves.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterDocument* CUITestServerStarterDocument::NewLC (CEikApplication& aApp)
+ {
+ CUITestServerStarterDocument* self = new ( ELeave ) CUITestServerStarterDocument( aApp );
+
+ CleanupStack::PushL (self);
+ self->ConstructL ();
+ return self;
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterDocument
+
+ Method: ConstructL
+
+ Description: This is second phase of two-phased constructor.
+
+ This is second phase of two-phased constructor.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterDocument::ConstructL()
+ {
+ // No implementation required
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterDocument
+
+ Method: CUITestServerStarterDocument
+
+ Description: Constructor.
+
+ Constructor.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterDocument::CUITestServerStarterDocument( CEikApplication& aApp ) :
+ CAknDocument(aApp)
+ {
+ // No implementation required
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterDocument
+
+ Method: ~CUITestServerStarterDocument
+
+ Description: Destructor.
+
+ Destructor.
+
+ Parameters: None.
+
+ Return Values: None.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterDocument::~CUITestServerStarterDocument ()
+ {
+ // No implementation required
+ }
+
+/*
+-------------------------------------------------------------------------------
+
+ Class: CUITestServerStarterDocument
+
+ Method: CreateAppUiL
+
+ Description: Creates AppUi object.
+
+ Creates AppUi object.
+
+ Parameters: None.
+
+ Return Values: Pointer to AppUi object.
+
+ Errors/Exceptions: None.
+
+ Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CEikAppUi* CUITestServerStarterDocument::CreateAppUiL ()
+ {
+ return ( static_cast <CEikAppUi*>( new ( ELeave ) CUITestServerStarterAppUi ) );
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/ReleaseNote.txt Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,45 @@
+========================================================================
+RELEASE NOTE FOR STFUI_201024 (7.3.35)
+========================================================================
+
+Product Description:
+====================
+STFUI is Series QT UI application for STF/STIF project.
+STF/STIF is a test harness for testing Symbian components.
+This widely used test framework can be used for both test case implementation and test cases execution.
+
+Features :
+=========
+- Easy to use
+- Multiple test cases can be executed concurrently.
+
+
+Enhancements:
+=============
+N/A
+
+
+New Features:
+=============
+N/A
+
+
+System Requirements:
+====================
+Basic Requirements:
+
+- StifQtUI project is written by QT C++ and Symbian C++.
+- It should be compiled by QT for S60 4.6.0 under proper S60 SDK.
+
+You can get QT for S60 from: http://qt.nokia.com/downloads/downloads
+
+- stif project needs to be compiled/installed before stifui can be used
+
+
+Compatibility Issues:
+=====================
+N/A
+
+
+Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/cstfcase.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+* CSTFCase used to describe a test case.
+*
+*/
+#ifndef CSTFCASE_H
+#define CSTFCASE_H
+#include "QString"
+
+enum TSTFCaseRunningType
+ {
+ Sequentially = 0,
+ Parallel
+ };
+
+enum TSTFCaseStatusType
+ {
+ EStatusRunning = 0x00000001,
+ EStatusExecuted = 0x00000002,
+ EStatusPassed = 0x00000004,
+ EStatusFailed = 0x00000008,
+ EStatusAborted = 0x00000010,
+ EStatusCrashed = 0x00000020,
+ EStatusAll = 0x000000ff,
+ };
+
+class CSTFCase
+{
+public:
+ CSTFCase() {isActive = true; caseIndex=-1;}
+ CSTFCase(QString name, int index) {caseName = name; caseIndex = index; isActive = true;}
+
+public:
+ QString& Name(){return caseName;}
+ int Index(){return caseIndex;}
+ bool IsActive(){return isActive;}
+ QString& ModuleName() {return moduleName;}
+
+public:
+ void SetName(const QString name){caseName = name; }
+ void SetIndex(const int index){caseIndex = index;}
+ void SetActive(const bool active) {isActive = active;}
+ void SetModuleName(const QString name){moduleName = name;}
+
+private:
+ QString caseName;
+ int caseIndex;
+ bool isActive;
+ QString moduleName;
+};
+#endif // CSTFCASE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/cstfmodule.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+* CSTFModule used to describe a test module.
+*
+*/
+#ifndef CSTFMODULE_H
+#define CSTFMODULE_H
+#include "QString"
+
+class CSTFModule
+{
+public:
+ CSTFModule(){isActive = true;}
+ CSTFModule(QString name, QString inifile, QString cfgfile)
+ {moduleName = name; iniFile = inifile; configFile = cfgfile; isActive = true;}
+
+public:
+ QString& Name(){return moduleName;}
+ QString& IniFile(){return iniFile;}
+ QString& ConfigFile(){return configFile;}
+ bool IsActive(){return isActive;}
+
+
+public:
+ void SetName(const QString& name){moduleName = name; }
+ void SetIniFile(const QString& inifile){iniFile = inifile;}
+ void SetConfigFile(const QString& cfgfile){configFile = cfgfile;}
+ void SetActive(const bool active) {isActive = active;}
+
+private:
+ QString moduleName;
+ QString iniFile;
+ QString configFile;
+ bool isActive;
+
+
+};
+#endif // CSTFMODULE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/dlgoutput.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+* DlgOutput is a QT based dialog.
+* Used to display case execution output and control the test case (pause/resume/abort).
+*
+*/
+#ifndef DLGOUTPUT_H_
+#define DLGOUTPUT_H_
+
+#include <QDialog>
+#include <QHash>
+#include "istfqtuicontroller.h"
+
+
+QT_BEGIN_NAMESPACE
+class QTabWidget;
+class QGridLayout;
+class QPlainTextEdit;
+class QPushButton;
+QT_END_NAMESPACE
+
+class DlgOutput : public QDialog, public IStfEventListener {
+ Q_OBJECT
+
+public:
+ DlgOutput(IStfQtUIController* ctl, QWidget *parent = 0);
+ ~DlgOutput();
+
+private:
+ void CreateItem(QString index, QString item);
+ void CloseItem(QString index);
+ void ShowMessage(QString index, QString msg);
+
+private://implement IStfEventListener
+ void OnGetMessage(const QString& ){};
+ void OnSetListChanged(){};
+ void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg);
+
+private slots:
+ void on_btnPause_clicked();
+ void on_btnAbort_clicked();
+ void on_btnClose_clicked();
+
+
+private:
+ IStfQtUIController* controller;
+ QTabWidget* tabMain;
+ QPushButton* btnPause;
+ QPushButton* btnAbort;
+ QPushButton* btnClose;
+ QHash<QString , QPlainTextEdit*> tabList;
+
+};
+
+
+#endif /* DLGOUTPUT_H_ */
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/dlgrepeatrun.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+*/
+
+#ifndef DLGREPEATRUN_H_
+#define DLGREPEATRUN_H_
+#include <QDialog>
+#include <QLineEdit>
+
+QT_BEGIN_NAMESPACE
+class QTabWidget;
+class QGridLayout;
+class QRadioButton;
+class QPushButton;
+QT_END_NAMESPACE
+
+class DlgRepeatRun : public QDialog {
+ Q_OBJECT
+
+public:
+ DlgRepeatRun(QWidget *parent = 0);
+ inline bool isRepeatInfinitely() {return isInfinite;};
+ inline int GetLoopTimes() {return loopTimes;};
+
+
+private:
+ void SetupUI();
+
+private:
+ QPushButton* btnOk;
+ QPushButton* btnCancel;
+ QLineEdit* lineEdit;
+ QRadioButton* rdoLoopInfinitely;
+ QRadioButton* rdoGiveLoopTimes;
+
+ int loopTimes;
+ bool isInfinite;
+
+private slots:
+ //on button clicked
+ void on_btnOk_clicked();
+ void on_btnCancel_clicked();
+
+ //on check box state changed
+ void on_rdoLoopInfinitely_stateChanged(bool checked);
+ void on_rdoGiveLoopTimes_stateChanged(bool checked);
+
+ };
+
+#endif /* DLGREPEATRUN_H_ */
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/dlgsetselector.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+* DlgSetSelector is a QT based dialog.
+* Used to display available test set for select to add cases into.
+*
+*/
+#ifndef DLGSETSELECTOR_H_
+#define DLGSETSELECTOR_H_
+
+#include <QDialog>
+#include <QList>
+
+QT_BEGIN_NAMESPACE
+class QGridLayout;
+class QPushButton;
+class QRadioButton;
+class QListWidget;
+QT_END_NAMESPACE
+
+class DlgSetSelector : public QDialog {
+ Q_OBJECT
+
+public:
+ DlgSetSelector(QList<QString> setList, QWidget *parent = 0);
+
+public:
+ inline QString SelectName(){return selectName;}
+
+private:
+ void SetupUI();
+
+private slots:
+ void on_btnOk_clicked();
+ void on_btnCancel_clicked();
+ void on_radio1Selection_Changed(bool checked);
+ void on_radio2Selection_Changed(bool checked);
+
+private:
+ QString selectName;
+
+ QRadioButton* rdoNewSet;
+ QRadioButton* rdoOldSet;
+ QListWidget* lstSet;
+ QPushButton* btnOk;
+ QPushButton* btnCancel;
+ QList<QString> setList;
+
+
+};
+
+
+#endif /* DLGSETSELECTOR_H_ */
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/dlgsetting.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+*/
+
+#ifndef DLGSETTING_H_
+#define DLGSETTING_H_
+#include <QDialog>
+#include "uisetting.h"
+
+
+QT_BEGIN_NAMESPACE
+class QTabWidget;
+class QGridLayout;
+class QCheckBox;
+class QPushButton;
+class QLabel;
+class QLineEdit;
+QT_END_NAMESPACE
+
+class DlgSetting : public QDialog {
+ Q_OBJECT
+
+public:
+ DlgSetting(UiSetting* settingObj, QWidget *parent = 0);
+
+private:
+ void SetupUI();
+
+private:
+ QPushButton* btnOk;
+ QPushButton* btnCancel;
+ QCheckBox* chkShowoutput;
+ QLabel* lblFilter;
+ QLineEdit* ledFilter;
+ QCheckBox* chkFilterCaseSens;
+
+private slots:
+ void on_btnOk_clicked();
+ void on_btnCancel_clicked();
+
+private:
+ UiSetting* setting;
+
+ };
+
+#endif /* DLGSETTING_H_ */
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/frmmain.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,205 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+* frmMain is a QT based Window.
+* Used to display STF executor main GUI.
+*
+*/
+#ifndef FRMMAIN_H
+#define FRMMAIN_H
+
+#include <QMainWindow>
+#include <QtGui>
+#include "istfqtuicontroller.h"
+#include "istfqtuimodel.h"
+#include "dlgoutput.h"
+#include "uisetting.h"
+#include "dlgsetting.h"
+#include "dlgsetselector.h"
+#include "uiversion.h"
+#include "dlgrepeatrun.h"
+
+QT_BEGIN_NAMESPACE
+class QAction;
+class QLabel;
+class QMenu;
+class QTabWidget;
+class QWidget;
+class QPushButton;
+class QComboBox;
+class QPlainTextEdit;
+class QTreeWidget;
+class QTreeWidgetItem;
+class QListWidget;
+class QCheckBox;
+class QMessageBox;
+class QFileDialog;
+QT_END_NAMESPACE
+
+
+
+class FrmMain : public QMainWindow, public IStfEventListener, public IStifModelEventListener
+{
+ Q_OBJECT
+
+public:
+ FrmMain();
+ ~FrmMain();
+
+
+public: //Implement IStfEventListener
+ void OnGetMessage(const QString& aMessage);
+ void OnSetListChanged();
+ void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg);
+
+
+public: //Implement IStifModelEventListener
+ void OnCaseStatisticChanged() ;
+ void OnRunningCaseChanged() ;
+
+protected:
+ void paintEvent(QPaintEvent *event);
+
+protected slots:
+ void onTabWidgetSelectIndexChanged();
+
+
+private:
+ void createMenus();
+ void LoadSubMenu();
+ void load();
+ void loadContent();
+ void loadModuleList();
+ void loadSetList();
+ void loadStatistic();
+ QList<CSTFCase> getSelectedCases();
+ void reloadStatisticItem(QString name, QTreeWidgetItem* item, TSTFCaseStatusType type);
+ void setSetting();
+ void startRunning();
+ void setItemClicked(QTreeWidgetItem* item);
+
+private:
+ IStfQtUIController* controller;
+ IStfQtUIModel* model;
+ DlgOutput* dlgOutput;
+ UiSetting* uiSetting;
+ bool layoutType;
+ QTreeWidgetItem* lastItemSelected;
+ QString currentFilter;
+ QString currentFilterCaseSens;
+
+private: //UI Components
+ QWidget* centerWidget;
+ QGridLayout *mainLayout;
+ QGroupBox *groupBox;
+
+ //menus and actions
+ QMenu *operateMenu;
+ //output panel
+ QPlainTextEdit *txtOutput;
+ //tab control.
+ QTabWidget *tabWidget;
+ QWidget *tabCase;
+ QWidget *tabSet;
+ QWidget *tabStarted;
+ QWidget *tabStatistic;
+
+ //Cases Tab
+ QTreeWidget *treeModuleList;
+
+ //Statistic Tab
+ QTreeWidget *treeStatistic;
+ QTreeWidgetItem *executedItems;
+ QTreeWidgetItem *passedItems;
+ QTreeWidgetItem *failedItems;
+ QTreeWidgetItem *abortedItems;
+ QTreeWidgetItem *crashedItems;
+
+
+ //Set Tab
+ QComboBox *cboSetList;
+ QListWidget *lstSetCases;
+
+ //Started Tab
+ QListWidget *lstStartedCases;
+ QPushButton *btnPauseCase;
+ QPushButton *btnAbortCase;
+ QPushButton *btnShowOutput;
+
+ //menu actions
+ QAction *actExit;
+ QAction *actAbout;
+
+ //cases actoins
+ QAction *actOpenFile;
+ QAction *actRunCaseSeq;
+ QAction *actRunCasePar;
+ QAction *actReapeatRunSeq;
+ QAction *actAddtoSet;
+ QAction *actSelectAll;
+ QAction *actExpandAll;
+ QAction *actCollapseAll;
+ QAction *actSetting;
+ QMenu *menuRunCase;
+ //sets actions
+ QAction *actRunSetSeq;
+ QAction *actRunSetPar;
+ QAction *actNewSet;
+ QAction *actDelSet;
+ QMenu *menuRunSet;
+ //running actions.
+ QAction *actPause;
+ QAction *actAbort;
+ QAction *actOutput;
+
+ //statistics actions
+ QAction *actClearStatistics;
+
+private slots:
+ void on_cboSetList_currentIndexChanged(QString );
+
+ void on_actAbout_triggered();
+ void on_actOpenFile_triggered();
+ void on_actRunCaseSeq_triggered();
+ void on_actRunCasePar_triggered();
+ void on_actReapeatRunSeq_triggered();
+ void on_actAddtoSet_triggered();
+ void on_actSelectAll_triggered();
+ void on_actExpandAll_triggered();
+ void on_actCollapseAll_triggered();
+ void on_actExpand_triggered();
+ void on_actCollapse_triggered();
+ void on_actSetting_triggered();
+
+ void on_actRunSetSeq_triggered();
+ void on_actRunSetPar_triggered();
+ void on_actNewSet_triggered();
+ void on_actDelSet_triggered();
+ void on_actPause_triggered();
+ void on_actAbort_triggered();
+ void on_actOutput_triggered();
+ void on_actClearStatistics_triggered();
+ void on_treeModuleList_itemClicked(QTreeWidgetItem* item, int column);
+
+
+
+
+
+
+
+};
+
+#endif // FrmMain_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/istfqtuicontroller.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+* IStfQtUIController is interface of appliction controller.
+* IStfEventListener is interface of Stf view observer.
+*
+*/
+#ifndef ISTFQTUICONTROLLER_H
+#define ISTFQTUICONTROLLER_H
+#include "cstfmodule.h"
+#include "cstfcase.h"
+#include <QList>
+#include "istfqtuimodel.h"
+
+class IStfEventListener
+{
+public:
+ enum CaseOutputCommand
+ {
+ ECreate,
+ EOutput,
+ EClose
+ };
+public:
+ virtual void OnGetMessage(const QString& aMessage) = 0;
+ virtual void OnSetListChanged() = 0;
+ virtual void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg) = 0;
+};
+
+class IStfQtUIController
+{
+public:
+ inline virtual ~IStfQtUIController(){}
+ //for cases
+ virtual bool OpenEngineIniFile(const QString& fileName) = 0;
+ virtual QList<QString> GetModuleList() = 0;
+ virtual QList<QString> GetCaseListByModule(const QString& moduleName) = 0;
+ virtual CSTFCase GetCase(const QString& moduleName, const int index) = 0;
+ virtual void RunCases(const QList<CSTFCase>& caseList, const TSTFCaseRunningType& type) = 0;
+ virtual void RepeatRunCases(const QList<CSTFCase>& aCaseList, const bool aIsLoopInfinitely, const int aLoopTimes = 1) = 0;
+ virtual bool AddCaseToSet(const QList<CSTFCase>& aCase, const QString& setName) = 0;
+
+ //for set
+ virtual QList<QString> GetSetList() = 0;
+ virtual QList<QString> GetCaseListBySet(const QString& setName) = 0;
+ virtual bool CreateSet(QString& setName) = 0;
+ virtual bool DeleteSet(const QString& setName) = 0;
+ virtual void RunSets(const QString& setName, const TSTFCaseRunningType& type) = 0;
+
+ //for Started
+ virtual void PauseCase() = 0;
+ virtual void ResumeCase() = 0;
+ virtual void AbortCase() = 0;
+ virtual CSTFCase GetRunningCase(int index) = 0;
+ virtual bool ShowOutput() = 0;
+ virtual void SetShowOutput(bool isShow) = 0;
+
+ //for staticstic
+ virtual QList<CSTFCase> GetCasesByStatus(const TSTFCaseStatusType& type) = 0;
+
+ //listener
+ virtual void AddStfEventListener(IStfEventListener* listener) = 0;
+ virtual void RemoveStfEventListener(IStfEventListener* listener) = 0;
+
+ //for repeat execution setting
+ virtual void InitRepeatSetting(const bool aIsLoopInfinitely, const int aLoopTimes) = 0;
+ virtual void ResetRepeatSetting() = 0;
+
+};
+
+
+
+#endif // ISTFQTUICONTROLLER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/istfqtuimodel.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+* IStfQtUIModel is interface of appliction data model.
+* IStifModelEventListener is used to listen event from data model.
+*
+*/
+#ifndef ISTFQTUIMODEL_H
+#define ISTFQTUIMODEL_H
+
+#include "cstfcase.h"
+#include "cstfmodule.h"
+#include <UIStoreIf.h>
+#include <UIStore.h>
+#include <UIEngine.h>
+
+class IStifModelEventListener
+ {
+public:
+ virtual void OnCaseStatisticChanged() = 0;
+ virtual void OnRunningCaseChanged() = 0;
+ };
+
+class IStfQtUIModel
+{
+public:
+ inline virtual ~IStfQtUIModel(){}
+ virtual void ClearCasesStatus() = 0;
+ virtual QList<CSTFCase> GetCasesByStatus(const TSTFCaseStatusType& type) = 0;
+ virtual void AddRunningCase(const CStartedTestCase* startedCase, const CSTFCase& stfCase) = 0;
+ virtual void RemoveRunningCase(const CStartedTestCase* startedCase) = 0;
+ virtual void AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase) = 0;
+ virtual CSTFCase GetRunningCase(const CStartedTestCase* startedCase) = 0;
+ virtual void PauseCase() = 0;
+ virtual void ResumeCase() = 0;
+ virtual void AbortCase() = 0;
+
+ virtual void AddStifModelEventListener(IStifModelEventListener* listener) = 0;
+ virtual void RemoveStifModelEventListener(IStifModelEventListener* listener) = 0;
+
+
+};
+
+#endif // ISTFQTUIMODEL_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/stfqtuicontroller.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+* Application's controller.
+*
+*/
+#ifndef STFQTUICONTROLLER_H_
+#define STFQTUICONTROLLER_H_
+
+#include "istfqtuicontroller.h"
+#include "istfqtuimodel.h"
+#include "stifexecutor.h"
+
+class StfQtUIController : public IStfQtUIController, public IStifCaseUpdateListener
+ {
+public:
+ StfQtUIController(IStfQtUIModel* aModel);
+ ~StfQtUIController();
+public: //Implement IStfQtUIController.
+ //for cases
+
+ bool OpenEngineIniFile(const QString& fileName);
+ QList<QString> GetModuleList();
+ QList<QString> GetCaseListByModule(const QString& moduleName);
+ CSTFCase GetCase(const QString& moduleName, const int index);
+ void RunCases(const QList<CSTFCase>& caseList, const TSTFCaseRunningType& type);
+ void RepeatRunCases(const QList<CSTFCase>& aCaseList, const bool aIsLoopInfinitely, const int aLoopTimes = 1);
+ bool AddCaseToSet(const QList<CSTFCase>& aCase, const QString& setName);
+
+ //for set
+ QList<QString> GetSetList();
+ QList<QString> GetCaseListBySet(const QString& setName);
+ bool CreateSet(QString& setName);
+ bool DeleteSet(const QString& setName);
+ void RunSets(const QString& setName, const TSTFCaseRunningType& type);
+
+ //for Started
+ void PauseCase();
+ void ResumeCase();
+ void AbortCase();
+ bool ShowOutput();
+ CSTFCase GetRunningCase(int index);
+ void SetShowOutput(bool isShow);
+
+ //for staticstic
+ QList<CSTFCase> GetCasesByStatus(const TSTFCaseStatusType& type);
+
+ //listener
+ void AddStfEventListener(IStfEventListener* listener);
+ void RemoveStfEventListener(IStfEventListener* listener);
+
+ //for repeat execution setting
+ void InitRepeatSetting(const bool aIsLoopInfinitely, const int aLoopTimes);
+ void ResetRepeatSetting();
+
+public://implement IStifCaseUpdateListener
+ void OnGetCaseUpdated(CStartedTestCase* aCase, CSTFCase& stfcase, int flags);
+ void OnGetCaseOutput(CStartedTestCase* aCase, QString& msg);
+
+private: //Fire event
+ void FireOnGetOutput(QString message);
+ void FireOnSetListChanged();
+ void FireOnCaseOutputChanged(IStfEventListener::CaseOutputCommand cmd, int index, QString msg);
+
+private:
+ // help methods
+ CSTFModule GetModuleByName(const QString& moduleName);
+ // Repeat execution cases
+ void Execution();
+
+private:
+ CStifExecutor* executor;
+ IStfQtUIModel* model;
+ QList<IStfEventListener*> listenerList;
+ bool isShowOutput;
+
+ // repeat run case related member
+ // repeat execution case list
+ QList<CSTFCase> repeatRunCaseList;
+ // current position of the case list
+ int iCurrentRunPos;
+ // is loop infinitely
+ bool isLoopInfinitely;
+ // loop times
+ int loopTimes;
+
+ };
+
+
+
+
+#endif /* STFQTUICONTROLLER_H_ */
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/stfqtuimodel.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+* application data model.
+*
+*/
+#include "istfqtuimodel.h"
+#include "stifexecutor.h"
+#include <QHash>
+
+class StfQtUIModel : public IStfQtUIModel
+ {
+public:
+ StfQtUIModel();
+ virtual ~StfQtUIModel();
+public://implement IStfQtUIModel
+ void ClearCasesStatus();
+ QList<CSTFCase> GetCasesByStatus(const TSTFCaseStatusType& type);
+ void AddRunningCase(const CStartedTestCase* startedCase, const CSTFCase& stfCase);
+ void RemoveRunningCase(const CStartedTestCase* startedCase);
+ void AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase);
+ void AddStifModelEventListener(IStifModelEventListener* listener);
+ void RemoveStifModelEventListener(IStifModelEventListener* listener);
+ CSTFCase GetRunningCase(const CStartedTestCase* startedCase);
+ void PauseCase();
+ void ResumeCase();
+ void AbortCase();
+
+private:
+ void FireOnCaseStatisticChangedEvent();
+ void FireOnRunningCaseChangedEvent();
+
+private:
+ QList<IStifModelEventListener*> listenerList;
+ QList<CSTFCase> executedCaseList;
+ QList<CSTFCase> passedCaseList;
+ QList<CSTFCase> failedCaseList;
+ QList<CSTFCase> abortCaseList;
+ QList<CSTFCase> crashedCaseList;
+ QHash<const CStartedTestCase*, CSTFCase> runningCaseList;
+
+
+
+
+
+
+ };
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/stifexecutor.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ and Symbian C++ combination Class.
+* Call STIF UI engine and UI interface to perform test operation.
+* All the public methods are QT C++ based object.
+*
+*/
+#ifndef STIFEXECUTOR_H_
+#define STIFEXECUTOR_H_
+
+#include "cstfcase.h"
+#include "cstfmodule.h"
+#include <UIStoreIf.h>
+#include <UIStore.h>
+#include <UIEngine.h>
+#include <QList>
+#include <StifLogger.h>
+
+class IStifCaseUpdateListener
+ {
+public:
+ virtual void OnGetCaseUpdated(CStartedTestCase* aCase,CSTFCase& stfcase, int flags) = 0;
+ virtual void OnGetCaseOutput(CStartedTestCase* aCase, QString& msg) = 0;
+ };
+
+
+class CStifExecutor : public CUIStoreIf
+ {
+public:
+ CStifExecutor();
+ ~CStifExecutor();
+public:
+ void AddStifCaseUpdateListener(IStifCaseUpdateListener* listener);
+ void RemoveStifCaseUpdateListener(IStifCaseUpdateListener* listener);
+ bool OpenIniFile(const QString& filename);
+ QList<CSTFModule> GetModuleList();
+ QList<CSTFCase> GetCaseList(const QString& moduleName);
+ void ExecuteSingleCase(const QString& moduleName, int caseIndex);
+ QList<QString> GetSetList();
+ QList<CSTFCase> GetCaseListFromSet(const QString& setName);
+ bool CreateSet(const QString& setName);
+ bool SaveSet(QString& setName);
+ bool RemoveSet(const QString& setName);
+ bool AddtoSet(const QString& setName, CSTFCase& caseInfo);
+ void ExecuteSet(const QString& SetName, const int startIndex, const TSTFCaseRunningType type);
+
+public://implement CUIStoreIf
+ void Update( CStartedTestCase* aTestCase,
+ TInt aFlags);
+
+public:
+ TPtrC QString2TPtrC(const QString& aString);
+ QString TDesC2QString(const TDesC& des);
+ //CTestInfo* GetTestInfo(CSTFCase aCase);
+
+private:
+ bool LogResult(const TInt result,const QString str);
+private:
+ QList<IStifCaseUpdateListener*> *listenerList;
+ HBufC* iBuffer;
+ // Pointer to logger
+ CStifLogger * iLog;
+ };
+
+
+
+#endif /* STIFEXECUTOR_H_ */
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/uisetting.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+*/
+
+#ifndef UISETTING_H_
+#define UISETTING_H_
+#include <QHash>
+
+const QString KShowOutput = "showoutput";
+const QString KStyleSheet = "StyleSheet";
+const QString KFilter = "filter";
+const QString KFilterCaseSens = "filtercasesens";
+
+class UiSetting
+ {
+public:
+ UiSetting();
+ ~UiSetting();
+
+public:
+ QString ReadSetting(const QString& item);
+ void SetSetting(const QString& item,const QString& value);
+
+private:
+ bool load();
+ bool save();
+ void loadDefault();
+ QString getDefaultValue(const QString& item);
+
+private:
+ QHash<QString, QString> settingList;
+ };
+
+#endif /* UISETTING_H_ */
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/uiversion.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+* frmMain is a QT based Window.
+* Used to display STF executor main GUI.
+*
+*/
+
+#ifndef UIVERSION_H_
+#define UIVERSION_H_
+
+const QString QtUIVersion = "v1.1.1";
+const QString QtUIName = "STFUI";
+
+#endif /* UIVERSION_H_ */
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/version.h Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: STIF version declaration
+*
+*/
+
+#ifndef VERSION_H_
+#define VERSION_H_
+
+#define STIF_MAJOR_VERSION 7
+#define STIF_MINOR_VERSION 3
+#define STIF_BUILD_VERSION 35
+
+#define STIF_REL_DATE "15th June 2010"
+
+#define TO_UNICODE(text) _L(text)
+
+#endif /*VERSION_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/qss/coffee.qss Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,326 @@
+QWidget {
+ background-color: cornsilk;
+}
+
+QMessageBox {
+ background-color: cornsilk;
+ border-width: 2px;
+ border-style: solid;
+ border-color: darkkhaki;
+ padding: 3px;
+ font-size:12px;
+ font: bold;
+}
+
+QDialog {
+ background-color: cornsilk;
+ border-width: 2px;
+ border-style: solid;
+ border-color: darkkhaki;
+ font-size:12px;
+ font: bold;
+}
+
+QInputDialog {
+ background-color: cornsilk;
+ border-width: 2px;
+ border-style: solid;
+ border-color: darkkhaki;
+ font-size:12px;
+ font: bold;
+}
+
+
+/*QPushButton*/
+QPushButton {
+ color: #0a214c;
+ background-color: palegoldenrod;
+ border-width: 2px;
+ border-color: darkkhaki;
+ border-style: solid;
+ border-radius: 5;
+ padding: 3px;
+ min-width: 100px;
+ min-height: 32px;
+ max-width: 100px;
+ max-height: 32px;
+ font-size:16px;
+ font: bold;
+}
+
+QPushButton:hover {
+ background-color: khaki;
+}
+
+QPushButton:pressed {
+ padding-left: 2px;
+ padding-top: 2px;
+ background-color: #d0d67c;
+}
+
+
+QPushButton::disabled {
+ color: #ffffff;
+}
+
+QRadioButton {
+ font: bold;
+ font-size: 14px;
+ border: none;
+ padding: 0;
+ background-color: cornsilk;
+ color: black;
+ background-color: cornsilk;
+ selection-color: #0a214c;
+ selection-background-color: #C19A6B;
+}
+
+QRadioButton:focus {
+ color:black;
+ background-color: cornsilk;
+}
+
+QRadioButton:selected {
+ background-color: cornsilk;
+ color:black;
+}
+
+QRadioButton:pressed {
+ background-color: cornsilk;
+ color:black;
+}
+
+
+/*QTabQWidget*/
+QTabWidget::pane { /* The tab widget frame */
+ border-top: 2px solid #C2C7CB;
+}
+
+QTabWidget::tab-bar {
+ left: 5px; /* move to the right by 5px */
+}
+
+/* Style the tab using the tab sub-control. Note that
+ it reads QTabBar _not_ QTabWidget */
+QTabBar::tab {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
+ stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
+ border: 2px solid #C4C4C3;
+ border-bottom-color: #C2C7CB; /* same as the pane color */
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+ /*min-width: 5ex;*/
+ padding: 2px;
+ color: #0a214c;
+ font-size:15px;
+}
+
+QTabBar::tab:selected, QTabBar::tab:hover {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #fafafa, stop: 0.4 #f4f4f4,
+ stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
+}
+
+QTabBar::tab:selected {
+ border-color: #9B9B9B;
+ border-bottom-color: #C2C7CB; /* same as pane color */
+ font: bold;
+ font-size:15px;
+}
+
+QTabBar::tab:!selected {
+ margin-top: 2px; /* make non-selected tabs look smaller */
+ font: bold;
+ font-size:14px;
+}
+
+/* make use of negative margins for overlapping tabs */
+QTabBar::tab:selected {
+ /* expand/overlap to the left and right by 4px */
+ /*
+ margin-left: -4px;
+ margin-right: -4px;
+ */
+}
+
+QTabBar::tab:first:selected {
+ margin-left: 0; /* the first selected tab has nothing to overlap with on the left */
+}
+
+QTabBar::tab:last:selected {
+ margin-right: 0; /* the last selected tab has nothing to overlap with on the right */
+}
+
+QTabBar::tab:only-one {
+ margin: 0; /* if there is only one tab, we don't want overlapping margins */
+}
+
+
+/* QLabel */
+QLabel {
+ font: bold;
+ font-size: 14px;
+ border: none;
+ padding: 0;
+ background: none;
+ color: black;
+
+}
+
+/* QLabel */
+QCheckBox {
+ font: bold;
+ font-size: 14px;
+ border: none;
+ padding: 0;
+ background-color: cornsilk;
+ color: black;
+ background-color: cornsilk;
+ selection-color: #0a214c;
+ selection-background-color: #C19A6B;
+}
+
+QCheckBox::focus {
+ color:black;
+ background-color: cornsilk;
+}
+
+QCheckBox:selected {
+ background-color: cornsilk;
+ color:black;
+}
+
+QCheckBox:pressed {
+ background-color: cornsilk;
+ color:black;
+}
+
+
+QFrame {
+ background-color: cornsilk;
+}
+
+QLineEdit, QPlainTextEdit {
+ background-color: cornsilk;
+ border-width: 1px;
+ padding: 1px;
+ border-style: solid;
+ border-color: darkkhaki;
+ border-radius: 3px;
+ color:black;
+ font-size:14px;
+}
+
+QLineEdit:focus, QPlainTextEdit:focus {
+ border-width: 3px;
+ padding: 0px;
+}
+
+/*QComboBox*/
+
+QComboBox {
+ background-color: cornsilk;
+ selection-color: #0a214c;
+ selection-background-color: #C19A6B;
+ color:black;
+ font-size:20px;
+ border-width: 1px;
+ padding: 1px;
+ border-style: solid;
+ border-color: darkkhaki;
+}
+
+/*QGroupBox*/
+QGroupBox {
+ background-color: cornsilk;
+ margin-top: 2ex;
+ border: 2px solid gray;
+ border-radius: 5px;
+
+
+}
+
+QGroupBox::title {
+ subcontrol-origin: margin;
+ padding: 0 3px;
+ color:black;
+ font-size:14px;
+ background-color: cornsilk;
+}
+
+
+/*QTreeWidget*/
+
+QTreeWidget {
+ color: brown;
+ show-decoration-selected: 1;
+ border-width: 1px;
+ padding: 1px;
+ border-style: solid;
+ border-color: darkkhaki;
+ border-radius: 3px;
+ background-color: cornsilk;
+ selection-color: #0a214c;
+ selection-background-color: #C19A6B;
+}
+
+QHeaderView {
+ color : black;
+ border-width: 1px;
+ padding: 1px;
+ border-style: solid;
+ border-color: darkkhaki;
+ border-radius: 3px;
+ background-color: khaki;
+}
+
+QHeaderView::section {
+ color : black;
+ border-width: 0px;
+ padding: 0px;
+ border-style: none;
+ background-color: palegoldenrod;
+}
+
+
+QTreeWidget::item{
+ height:35px;
+ font-size:20px;
+}
+
+QTreeWidget::item:hover{
+ background-color: wheat;
+}
+
+QListView {
+ color: brown;
+ show-decoration-selected: 1;
+ border-width: 1px;
+ padding: 1px;
+ border-style: solid;
+ border-color: darkkhaki;
+ border-radius: 3px;
+ background-color: cornsilk;
+ selection-color: #0a214c;
+ selection-background-color: #C19A6B;
+ font-size:16px;
+}
+
+QListView::item:hover {
+ background-color: wheat;
+}
+
+QListView::disabled {
+ color: #ffffff;
+ background-color: gray;
+}
+
+QListView::item {
+ height:30px;
+}
+
+QErrorMessage::text {
+ color: black;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/resource/StfQtUI.qrc Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,5 @@
+<RCC>
+<qresource prefix="/">
+<file>../qss/coffee.qss</file>
+</qresource>
+</RCC>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/rom/stfui.iby Wed Oct 13 14:32:52 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: Stifui.iby file specifies needed STIF and STIF UI
+* and UITetsServerstarter components for ROM image
+*
+*/
+
+#ifndef __STIF_UI_IBY__
+#define __STIF_UI_IBY__
+
+S60_APP_EXE(Stfqtui)
+
+#ifdef S60_UPGRADABLE_APP_REG_RSC
+ S60_UPGRADABLE_APP_REG_RSC(Stfqtui)
+#else
+ S60_APP_AIF_RSC(Stfqtui)
+#endif
+
+S60_APP_RESOURCE(Stfqtui)
+
+#endif
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/sis/stifqtui.pkg Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,27 @@
+; stifqtui_armv5_urel.pkg generated by qmake at 2010-05-31T09:56:39
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"STFUI"},(0x2002BCA0),1,0,0
+
+; Localised Vendor name
+%{"Nokia, Qt Software"}
+
+; Unique Vendor name
+:"Nokia, Qt Software"
+
+; Dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+(0x2001E61C), 4, 5, 2, {"QtLibs pre-release"}
+
+; Executable and default resource files
+"/epoc32/release/armv5/urel/STFUI.exe" - "!:\sys\bin\STFUI.exe"
+"/epoc32/data/z/resource/apps/STFUI.rsc" - "!:\resource\apps\STFUI.rsc"
+"/epoc32/data/z/private/10003a3f/import/apps/STFUI_reg.rsc" - "!:\private\10003a3f\import\apps\STFUI_reg.rsc"
Binary file stifui/qt/sis/stifqtui.sis has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/dlgoutput.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: QT C++ based Class.
+ *
+ */
+#include "dlgoutput.h"
+#include <QtGui>
+
+DlgOutput::DlgOutput(IStfQtUIController* ctl, QWidget *parent) :
+ QDialog(parent), controller(ctl)
+ {
+ QGridLayout *mainLayout = new QGridLayout(this);
+ this->setLayout(mainLayout);
+ this->setContextMenuPolicy(Qt::NoContextMenu);
+
+ tabMain = new QTabWidget(this);
+ tabMain->setContextMenuPolicy(Qt::NoContextMenu);
+
+ QWidget *toolWidget = new QWidget(this);
+ toolWidget->setContextMenuPolicy(Qt::NoContextMenu);
+ QGridLayout *toolLayout = new QGridLayout(this);
+ toolWidget->setLayout(toolLayout);
+ btnPause = new QPushButton(tr("Pause"), toolWidget);
+ btnPause->setContextMenuPolicy(Qt::NoContextMenu);
+ QObject::connect(btnPause, SIGNAL(clicked()), this,
+ SLOT(on_btnPause_clicked()));
+ btnAbort = new QPushButton(tr("Abort"), toolWidget);
+ btnAbort->setContextMenuPolicy(Qt::NoContextMenu);
+ QObject::connect(btnAbort, SIGNAL(clicked()), this,
+ SLOT(on_btnAbort_clicked()));
+
+ btnClose = new QPushButton(tr("Hide"), toolWidget);
+ btnClose->setContextMenuPolicy(Qt::NoContextMenu);
+ QObject::connect(btnClose, SIGNAL(clicked()), this,
+ SLOT(on_btnClose_clicked()));
+ toolLayout->addWidget(btnPause, 0, 0);
+ toolLayout->addWidget(btnAbort, 0, 1);
+ toolLayout->addWidget(btnClose, 0, 2);
+
+
+ mainLayout->addWidget(toolWidget, 0, 0);
+ mainLayout->addWidget(tabMain, 1, 0);
+ controller->AddStfEventListener(this);
+ }
+
+DlgOutput::~DlgOutput()
+ {
+ controller->RemoveStfEventListener(this);
+ }
+
+void DlgOutput::CreateItem(QString index, QString item)
+ {
+ QPlainTextEdit* edit = new QPlainTextEdit(this);
+ edit->setContextMenuPolicy(Qt::NoContextMenu);
+ tabMain->addTab(edit, item);
+ tabList.insert(index, edit);
+ }
+
+void DlgOutput::CloseItem(QString index)
+ {
+ delete tabList.value(index);
+ tabList.remove(index);
+ if (tabMain->count() == 0)
+ {
+ this->close();
+ }
+ }
+
+void DlgOutput::ShowMessage(QString index, QString msg)
+ {
+ if(tabList.contains(index))
+ {
+ tabList.value(index)->setPlainText(msg);
+ }
+ else
+ {
+// bool ok;
+// CSTFCase acase = controller->GetRunningCase(index.toInt(&ok, 10));
+// CreateItem(index, acase.Name());
+// ShowMessage(index, msg);
+ }
+ }
+
+void DlgOutput::on_btnPause_clicked()
+ {
+ if (btnPause->text() == "Pause")
+ {
+ controller->PauseCase();
+ btnPause->setText(tr("Resume"));
+ }
+ else
+ {
+ controller->ResumeCase();
+ btnPause->setText(tr("Pause"));
+ }
+ }
+
+void DlgOutput::on_btnAbort_clicked()
+ {
+ controller->AbortCase();
+ }
+
+void DlgOutput::on_btnClose_clicked()
+ {
+ controller->SetShowOutput(false);
+ this->close();
+ }
+
+void DlgOutput::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd,
+ const QString& index, const QString& msg)
+ {
+ if(controller->ShowOutput() && this->isVisible() == false)
+ {
+ this->showMaximized();
+ }
+ switch (cmd)
+ {
+ case IStfEventListener::ECreate:
+ CreateItem(index, msg);
+ break;
+ case IStfEventListener::EClose:
+ CloseItem(index);
+ break;
+ default:
+ ShowMessage(index, msg);
+ break;
+ }
+
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/dlgrepeatrun.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: QT C++ based Class.
+ *
+ */
+
+#include "dlgrepeatrun.h"
+#include <QtGui>
+
+DlgRepeatRun::DlgRepeatRun(QWidget *parent)
+ : QDialog(parent),
+ loopTimes(0),
+ isInfinite(true)
+ {
+ SetupUI();
+ }
+
+void DlgRepeatRun::SetupUI()
+ {
+ this->setContextMenuPolicy(Qt::NoContextMenu);
+ QGridLayout *mainLayout = new QGridLayout(this);
+ this->setLayout(mainLayout);
+
+ //nullWidget is just place holder for better looking.
+ QWidget *nullWidget = new QWidget(this);
+ nullWidget->setMinimumHeight(30);
+ mainLayout->addWidget(nullWidget, 0, 0);
+
+ // check box LoopInfinitely
+ rdoLoopInfinitely = new QRadioButton(this);
+ rdoLoopInfinitely->setMinimumHeight(40);
+ rdoLoopInfinitely->setText(tr("Repeat infinitely."));
+ rdoLoopInfinitely->setChecked(Qt::Checked);
+ QObject::connect(rdoLoopInfinitely, SIGNAL(clicked(bool)), this,
+ SLOT(on_rdoLoopInfinitely_stateChanged(bool)));
+
+
+ // check box LoopTime
+ rdoGiveLoopTimes = new QRadioButton(this);
+ rdoGiveLoopTimes->setMinimumHeight(40);
+ rdoGiveLoopTimes->setText(tr("Give loop times:"));
+ rdoGiveLoopTimes->setChecked(Qt::Unchecked);
+ QObject::connect(rdoGiveLoopTimes, SIGNAL(clicked(bool)), this,
+ SLOT(on_rdoGiveLoopTimes_stateChanged(bool)));
+
+ // lineEdit,
+ QValidator *validator = new QIntValidator(1, 999999, this);
+ lineEdit = new QLineEdit(this);
+ lineEdit->setValidator(validator);
+ lineEdit->setMinimumHeight(40);
+ lineEdit->setMaxLength(6);
+ lineEdit->setMaximumWidth(60);
+ lineEdit->setEchoMode(QLineEdit::NoEcho);
+ lineEdit->setReadOnly(true);
+
+ // add check box and lineEdit to layout.
+ QWidget *toolWidgetForLoopTimes = new QWidget(this);
+ QGridLayout *toolLayoutForLoopTimes = new QGridLayout(this);
+ toolWidgetForLoopTimes->setLayout(toolLayoutForLoopTimes);
+ toolLayoutForLoopTimes->addWidget(rdoLoopInfinitely, 0, 0);
+ toolLayoutForLoopTimes->addWidget(rdoGiveLoopTimes, 1, 0);
+ toolLayoutForLoopTimes->addWidget(lineEdit, 1, 1);
+ mainLayout->addWidget(toolWidgetForLoopTimes, 1, 0);
+
+ // add button
+ QWidget *toolWidgetForButtons = new QWidget(this);
+ QGridLayout *toolLayoutForButtons = new QGridLayout(this);
+ toolWidgetForButtons->setLayout(toolLayoutForButtons);
+ btnOk = new QPushButton(tr("Ok"), toolWidgetForButtons);
+ QObject::connect(btnOk, SIGNAL(clicked()), this,
+ SLOT(on_btnOk_clicked()));
+ btnCancel = new QPushButton(tr("Cancel"), toolWidgetForButtons);
+ QObject::connect(btnCancel, SIGNAL(clicked()), this,
+ SLOT(on_btnCancel_clicked()));
+ toolLayoutForButtons->addWidget(btnOk, 0, 0);
+ toolLayoutForButtons->addWidget(btnCancel, 0, 1);
+ mainLayout->addWidget(toolWidgetForButtons, 2, 0);
+ }
+
+void DlgRepeatRun::on_btnOk_clicked()
+ {
+ if(!isRepeatInfinitely())
+ {
+ loopTimes = lineEdit->text().toInt();
+ if (loopTimes < 0)
+ {
+ loopTimes = 0;
+ }
+ }
+ else
+ {
+ loopTimes = 0;
+ }
+ this->accept();
+ }
+
+void DlgRepeatRun::on_btnCancel_clicked()
+ {
+ this->reject();
+ }
+
+void DlgRepeatRun::on_rdoLoopInfinitely_stateChanged(bool checked)
+ {
+ if(checked)
+ {
+ isInfinite = true;
+ lineEdit->setEchoMode(QLineEdit::NoEcho);
+ lineEdit->setReadOnly(true);
+ }
+ }
+
+void DlgRepeatRun::on_rdoGiveLoopTimes_stateChanged(bool checked)
+ {
+ if(checked)
+ {
+ isInfinite = false;
+ lineEdit->setEchoMode(QLineEdit::Normal);
+ lineEdit->setReadOnly(false);
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/dlgsetselector.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: QT C++ based Class.
+ *
+ */
+
+#include "dlgsetselector.h"
+#include <QtGui>
+
+DlgSetSelector::DlgSetSelector(QList<QString> list, QWidget* parent):
+ QDialog(parent), selectName(""), setList(list)
+ {
+ SetupUI();
+ }
+
+void DlgSetSelector::SetupUI()
+ {
+ QGridLayout *mainLayout = new QGridLayout(this);
+ this->setLayout(mainLayout);
+ this->setContextMenuPolicy(Qt::NoContextMenu);
+
+ rdoNewSet = new QRadioButton(this);
+ rdoNewSet->setChecked(true);
+ rdoNewSet->setText(tr("Create a new Set"));
+ QObject::connect(rdoNewSet, SIGNAL(clicked(bool)), this,
+ SLOT(on_radio1Selection_Changed(bool)));
+ rdoOldSet = new QRadioButton(this);
+ rdoOldSet->setChecked(false);
+ rdoOldSet->setText(tr("Select a exist set:"));
+ QObject::connect(rdoOldSet, SIGNAL(clicked(bool)), this,
+ SLOT(on_radio2Selection_Changed(bool)));
+
+ lstSet = new QListWidget(this);
+ for(int i=0;i<setList.count();i++)
+ {
+ lstSet->addItem(setList[i]);
+ }
+ lstSet->setEnabled(false);
+
+ QWidget *toolWidget = new QWidget(this);
+ toolWidget->setContextMenuPolicy(Qt::NoContextMenu);
+ QGridLayout *toolLayout = new QGridLayout(this);
+ toolWidget->setLayout(toolLayout);
+ btnOk = new QPushButton(tr("Ok"), toolWidget);
+ btnOk->setContextMenuPolicy(Qt::NoContextMenu);
+ QObject::connect(btnOk, SIGNAL(clicked()), this,
+ SLOT(on_btnOk_clicked()));
+ btnCancel = new QPushButton(tr("Cancel"), toolWidget);
+ btnCancel->setContextMenuPolicy(Qt::NoContextMenu);
+ QObject::connect(btnCancel, SIGNAL(clicked()), this,
+ SLOT(on_btnCancel_clicked()));
+ toolLayout->addWidget(btnOk, 0, 0);
+ toolLayout->addWidget(btnCancel, 0, 1);
+
+
+ mainLayout->addWidget(rdoNewSet, 0, 0);
+ mainLayout->addWidget(rdoOldSet, 1, 0);
+ mainLayout->addWidget(lstSet, 2, 0);
+
+ mainLayout->addWidget(toolWidget, 3, 0);
+ this->showMaximized();
+
+ }
+void DlgSetSelector::on_radio1Selection_Changed(bool /* checked */)
+ {
+ lstSet->setEnabled(false);
+ }
+
+
+void DlgSetSelector::on_radio2Selection_Changed(bool checked)
+ {
+ lstSet->setEnabled(true);
+ if(checked)
+ {
+ if(setList.count() == 0)
+ {
+ rdoNewSet->setChecked(true);
+ }
+ else
+ {
+ lstSet->setCurrentRow(0);
+ }
+ }
+
+ }
+
+void DlgSetSelector::on_btnOk_clicked()
+ {
+ if(rdoOldSet->isChecked())
+ {
+ selectName = lstSet->selectedItems()[0]->text();
+ }
+ else
+ {
+ selectName = "";
+ }
+ this->accept();
+ }
+
+void DlgSetSelector::on_btnCancel_clicked()
+ {
+ this->reject();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/dlgsetting.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: QT C++ based Class.
+ *
+ */
+
+#include "dlgsetting.h"
+#include <QtGui>
+
+DlgSetting::DlgSetting(UiSetting* settingObj, QWidget *parent)
+ : QDialog(parent), setting(settingObj)
+ {
+ SetupUI();
+ }
+
+void DlgSetting::SetupUI()
+ {
+ this->setContextMenuPolicy(Qt::NoContextMenu);
+ QGridLayout *mainLayout = new QGridLayout(this);
+ this->setLayout(mainLayout);
+
+ chkShowoutput = new QCheckBox(this);
+ chkShowoutput->setText(tr("Show output in execution."));
+ chkShowoutput->setChecked(setting->ReadSetting(KShowOutput) == "true");
+
+ lblFilter = new QLabel(this);
+ lblFilter->setText(tr("Filter for displayed titles."));
+ ledFilter = new QLineEdit(this);
+ ledFilter->setFrame(true);
+ ledFilter->setText(setting->ReadSetting(KFilter));
+ chkFilterCaseSens = new QCheckBox(this);
+ chkFilterCaseSens->setText(tr("Filter is case sensitive."));
+ chkFilterCaseSens->setChecked(setting->ReadSetting(KFilterCaseSens) == "true");
+
+ QWidget *toolWidget = new QWidget(this);
+ QGridLayout *toolLayout = new QGridLayout(this);
+
+ toolWidget->setLayout(toolLayout);
+ btnOk = new QPushButton(tr("Ok"), toolWidget);
+ QObject::connect(btnOk, SIGNAL(clicked()), this,
+ SLOT(on_btnOk_clicked()));
+ btnCancel = new QPushButton(tr("Cancel"), toolWidget);
+ QObject::connect(btnCancel, SIGNAL(clicked()), this,
+ SLOT(on_btnCancel_clicked()));
+ toolLayout->addWidget(btnOk, 0, 0);
+ toolLayout->addWidget(btnCancel, 0, 1);
+
+ QWidget *nullWidget = new QWidget(this);
+ nullWidget->setMinimumHeight(30);
+
+ mainLayout->addWidget(nullWidget, 0, 0);
+ mainLayout->addWidget(chkShowoutput, 1, 0);
+ mainLayout->addWidget(lblFilter, 3, 0);
+ mainLayout->addWidget(ledFilter, 4, 0);
+ mainLayout->addWidget(chkFilterCaseSens, 5, 0);
+ mainLayout->addWidget(toolWidget, 7, 0);
+
+ }
+
+void DlgSetting::on_btnOk_clicked()
+ {
+ if(chkShowoutput->checkState() == Qt::Checked)
+ {
+ setting->SetSetting(KShowOutput, "true");
+ }
+ else
+ {
+ setting->SetSetting(KShowOutput, "false");
+ }
+ setting->SetSetting(KFilter, ledFilter->text());
+ setting->SetSetting(KFilterCaseSens, (chkFilterCaseSens->checkState() == Qt::Checked) ? ("true") : ("false"));
+ this->accept();
+ }
+
+void DlgSetting::on_btnCancel_clicked()
+ {
+ this->reject();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/frmmain.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,1160 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: QT C++ based Class.
+ *
+ */
+#include <QtGui>
+#include "frmmain.h"
+#include "stfqtuicontroller.h"
+#include "stfqtuimodel.h"
+#include <QList>
+#include "version.h"
+#include <QCursor>
+#include <QDesktopWidget>
+
+const QString SELECTITEMHEADER = " * ";
+const QString UNSELECTITEMHEADER = " ";
+
+FrmMain::FrmMain()
+ {
+ lastItemSelected = NULL;
+ uiSetting = new UiSetting();
+ createMenus();
+ load();
+ LoadSubMenu();
+
+ QFile file(uiSetting->ReadSetting(KStyleSheet));
+ bool rst = file.open(QFile::ReadOnly);
+ if(rst)
+ {
+ QString styleSheet = QLatin1String(file.readAll());
+ qApp->setStyleSheet(styleSheet);
+ }
+
+ model = new StfQtUIModel();
+ model->AddStifModelEventListener(this);
+ controller = new StfQtUIController(model);
+ controller->AddStfEventListener(this);
+ loadContent();
+ dlgOutput = new DlgOutput(controller);
+ setSetting();
+ }
+
+FrmMain::~FrmMain()
+ {
+ model->AbortCase();
+ controller->RemoveStfEventListener(this);
+ model->RemoveStifModelEventListener(this);
+
+ //lastItemSelected does not own any memory, don't need to delete.
+ lastItemSelected = NULL;
+ delete uiSetting;
+ delete dlgOutput;
+ delete controller;
+ delete model;
+ }
+
+void FrmMain::paintEvent(QPaintEvent* event)
+ {
+
+ if(mainLayout != NULL)
+ {
+ QDesktopWidget* desktop = QApplication::desktop();
+ QRect rect = desktop->screenGeometry(0);
+ bool temp = false;
+ if(rect.height() > rect.width())
+ {
+ temp = true;
+ }
+
+ if(temp != layoutType)
+ {
+ mainLayout->removeWidget(tabWidget);
+ mainLayout->removeWidget(groupBox);
+ if(temp)
+ {
+ mainLayout->addWidget(tabWidget, 0, 0);
+ mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom);
+ mainLayout->setRowStretch(0,4);
+ mainLayout->setRowStretch(1,1);
+ }
+ else
+ {
+ mainLayout->addWidget(tabWidget, 0, 0);
+ mainLayout->addWidget(groupBox, 0, 1);//Qt::AlignRight
+ //groupBox->setFixedSize(60,0);
+ mainLayout->setColumnStretch(0,1);
+ mainLayout->setColumnStretch(1,1);
+ }
+ layoutType = temp;
+
+ }
+
+ }
+ event->accept();
+ }
+
+void FrmMain::setSetting()
+ {
+ controller->SetShowOutput(uiSetting->ReadSetting(KShowOutput) == "true");
+ // Apply filter changes
+ QString newFilter = uiSetting->ReadSetting(KFilter);
+ QString newFilterCaseSens = uiSetting->ReadSetting(KFilterCaseSens);
+ if(currentFilter != newFilter || currentFilterCaseSens != newFilterCaseSens)
+ {
+ // Store new filter for further use
+ currentFilter = newFilter;
+ currentFilterCaseSens = newFilterCaseSens;
+
+ // Create and setup regular expression for wildcard searching
+ QRegExp filter;
+ filter.setPattern((newFilter == "") ? ("*") : (tr("*") + newFilter + tr("*")));
+ filter.setCaseSensitivity((newFilterCaseSens == "true") ? (Qt::CaseSensitive) : (Qt::CaseInsensitive));
+ filter.setPatternSyntax(QRegExp::Wildcard);
+
+ // Go through top level entries (modules)
+ bool isAnythingHidden = false;
+ for(int i = 0; i < treeModuleList->topLevelItemCount(); i++)
+ {
+ QTreeWidgetItem* top = treeModuleList->topLevelItem(i);
+ // And through test cases for each module
+ for(int j = 0; j < top->childCount(); j++)
+ {
+ QTreeWidgetItem *child = top->child(j);
+ // Remove first three chars to get valid test case title
+ QString title = (child->text(0)).mid(3);
+ // Check if title is matching to filter and show or hide it
+ if(filter.exactMatch(title))
+ {
+ child->setHidden(false);
+ }
+ else
+ {
+ child->setHidden(true);
+ child->setText(0, child->text(0).replace(0, 3, UNSELECTITEMHEADER));
+ isAnythingHidden = true;
+ }
+ }
+ }
+
+ if(isAnythingHidden)
+ treeModuleList->headerItem()->setText(0, tr("Module List (filtered)"));
+ else
+ treeModuleList->headerItem()->setText(0, tr("Module List"));
+ }
+ }
+
+void FrmMain::OnGetMessage(const QString& aMessage)
+ {
+ txtOutput->appendPlainText(aMessage);
+ }
+
+void FrmMain::OnRunningCaseChanged()
+ {
+ QList<CSTFCase> caseList = controller->GetCasesByStatus(EStatusRunning);
+ lstStartedCases->clear();
+ foreach(CSTFCase aCase, caseList)
+ {
+ lstStartedCases->addItem(aCase.Name());
+ }
+ if (caseList.size() != 0)
+ {
+ btnPauseCase->setEnabled(true);
+ btnAbortCase->setEnabled(true);
+ btnShowOutput->setEnabled(true);
+ actPause->setEnabled(true);
+ actAbort->setEnabled(true);
+ actOutput->setEnabled(true);
+ }
+ else
+ {
+ btnPauseCase->setEnabled(false);
+ btnAbortCase->setEnabled(false);
+ btnShowOutput->setEnabled(false);
+ actPause->setEnabled(false);
+ actAbort->setEnabled(false);
+ actOutput->setEnabled(false);
+ }
+ }
+
+void FrmMain::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& /*cmd*/, const QString& /*index*/, const QString& /*msg*/)
+ {
+ //nothing to do.
+ }
+
+void FrmMain::OnSetListChanged()
+ {
+ loadSetList();
+ }
+
+void FrmMain::OnCaseStatisticChanged()
+ {
+ loadStatistic();
+ }
+
+void FrmMain::createMenus()
+ {
+ //operateMenu = menuBar()->addMenu(tr("&Operation"));
+ actAbout = new QAction(tr("&About"), this);
+ connect(actAbout, SIGNAL(triggered()), this,
+ SLOT(on_actAbout_triggered()));
+
+ actExit = new QAction(tr("&Exit"), this);
+ connect(actExit, SIGNAL(triggered()), this, SLOT(close()));
+
+ actOpenFile = new QAction(tr("&Open Ini File"), this);
+ connect(actOpenFile, SIGNAL(triggered()), this,
+ SLOT(on_actOpenFile_triggered()));
+
+ menuRunCase = new QMenu(tr("Run Selected Case(s)"), this->menuBar());
+
+ actRunCaseSeq = new QAction(tr("Sequentially"), this);
+ connect(actRunCaseSeq, SIGNAL(triggered()), this,
+ SLOT(on_actRunCaseSeq_triggered()));
+
+ actRunCasePar = new QAction(tr("Parallel"), this);
+ connect(actRunCasePar, SIGNAL(triggered()), this,
+ SLOT(on_actRunCasePar_triggered()));
+
+ ////////////////////
+ actReapeatRunSeq = new QAction(tr("Repeat run sequentially"), this);
+ connect(actReapeatRunSeq, SIGNAL(triggered()), this,
+ SLOT(on_actReapeatRunSeq_triggered()));
+
+ actAddtoSet = new QAction(tr("Add cases to Set"), this);
+ connect(actAddtoSet, SIGNAL(triggered()), this,
+ SLOT(on_actAddtoSet_triggered()));
+
+ actSelectAll = new QAction(tr("Select All"), this);
+ connect(actSelectAll, SIGNAL(triggered()), this,
+ SLOT(on_actSelectAll_triggered()));
+
+ actExpandAll = new QAction(tr("Expand All"), this);
+ connect(actExpandAll, SIGNAL(triggered()), this,
+ SLOT(on_actExpandAll_triggered()));
+
+ actCollapseAll = new QAction(tr("Collapse All"), this);
+ connect(actCollapseAll, SIGNAL(triggered()), this,
+ SLOT(on_actCollapseAll_triggered()));
+
+ actSetting = new QAction(tr("Settings"), this);
+ connect(actSetting, SIGNAL(triggered()), this,
+ SLOT(on_actSetting_triggered()));
+
+ menuRunSet = new QMenu(tr("Run Case(s) in Selected Set"), this->menuBar());
+
+ actRunSetSeq = new QAction(tr("Sequentially"), this);
+ connect(actRunSetSeq, SIGNAL(triggered()), this,
+ SLOT(on_actRunSetSeq_triggered()));
+
+ actRunSetPar = new QAction(tr("Parallel"), this);
+ connect(actRunSetPar, SIGNAL(triggered()), this,
+ SLOT(on_actRunSetPar_triggered()));
+
+ actNewSet = new QAction(tr("Create New Set"), this);
+ connect(actNewSet, SIGNAL(triggered()), this,
+ SLOT(on_actNewSet_triggered()));
+
+ actDelSet = new QAction(tr("Delete Set"), this);
+ connect(actDelSet, SIGNAL(triggered()), this,
+ SLOT(on_actDelSet_triggered()));
+
+ actPause = new QAction(tr("Pause"), this);
+ actPause->setEnabled(false);
+ connect(actPause, SIGNAL(triggered()), this,
+ SLOT(on_actPause_triggered()));
+
+ actAbort = new QAction(tr("Abort"), this);
+ actAbort->setEnabled(false);
+ connect(actAbort, SIGNAL(triggered()), this,
+ SLOT(on_actAbort_triggered()));
+
+ actOutput = new QAction(tr("Output"), this);
+ actOutput->setEnabled(false);
+ connect(actAbort, SIGNAL(triggered()), this,
+ SLOT(on_actOutput_triggered()));
+
+ actClearStatistics = new QAction(tr("Clear Statistics"), this);
+ connect(actClearStatistics, SIGNAL(triggered()), this,
+ SLOT(on_actClearStatistics_triggered()));
+
+ }
+
+void FrmMain::load()
+ {
+ this->setContextMenuPolicy(Qt::NoContextMenu);
+
+ this->setWindowTitle(QtUIName);
+ centerWidget = new QWidget(this);
+ this->setCentralWidget(centerWidget);
+
+ mainLayout = new QGridLayout(this);
+ mainLayout->setVerticalSpacing(2);
+ mainLayout->setHorizontalSpacing(2);
+ mainLayout->setSpacing(2);
+ mainLayout->setMargin(2);
+
+ this->centralWidget()->setContextMenuPolicy(Qt::NoContextMenu);
+
+ //tab control
+ tabWidget = new QTabWidget(this);
+ tabWidget->setContextMenuPolicy(Qt::NoContextMenu);
+ tabCase = new QWidget(tabWidget);
+ tabCase->setContextMenuPolicy(Qt::NoContextMenu);
+ tabWidget->addTab(tabCase, tr("Cases"));
+ tabSet = new QWidget(tabWidget);
+ tabSet->setContextMenuPolicy(Qt::NoContextMenu);
+ tabWidget->addTab(tabSet, tr(" Set "));
+ tabStarted = new QWidget(tabWidget);
+ tabStarted->setContextMenuPolicy(Qt::NoContextMenu);
+ tabWidget->addTab(tabStarted, tr("Running"));
+ tabStatistic = new QWidget(tabWidget);
+ tabStatistic->setContextMenuPolicy(Qt::NoContextMenu);
+ tabWidget->addTab(tabStatistic, tr("Statistics"));
+ connect(tabWidget, SIGNAL(currentChanged(int)), this,
+ SLOT(onTabWidgetSelectIndexChanged()));
+
+ //output panel
+ groupBox = new QGroupBox(this);
+ //groupBox->setFixedHeight(150);
+ groupBox->setContextMenuPolicy(Qt::NoContextMenu);
+ groupBox->setTitle(tr("Information"));
+ txtOutput = new QPlainTextEdit(groupBox);
+ txtOutput->setContextMenuPolicy(Qt::NoContextMenu);
+ txtOutput->setReadOnly(true);
+ txtOutput->setFocusPolicy(Qt::NoFocus);
+ //txtOutput->setEditFocus(false);
+ QGridLayout *groupBoxLayout = new QGridLayout(this);
+ groupBoxLayout->setVerticalSpacing(2);
+ groupBoxLayout->setHorizontalSpacing(2);
+ groupBoxLayout->setSpacing(2);
+ groupBoxLayout->setMargin(2);
+ groupBoxLayout->addWidget(txtOutput, 0, 0);
+ groupBox->setLayout(groupBoxLayout);
+
+ QDesktopWidget* desktop = QApplication::desktop();
+ QRect rect = desktop->screenGeometry(0);
+ if(rect.height() > rect.width())
+ {
+ mainLayout->addWidget(tabWidget, 0, 0);
+ mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom);
+ mainLayout->setRowStretch(0,4);
+ mainLayout->setRowStretch(1,1);
+ layoutType = true;
+ }
+ else
+ {
+ mainLayout->addWidget(tabWidget, 0, 0);
+ mainLayout->addWidget(groupBox, 0, 1);//Qt::AlignRight
+ //groupBox->setFixedSize(60,0);
+ mainLayout->setColumnStretch(0,1);
+ mainLayout->setColumnStretch(1,1);
+ layoutType = false;
+ }
+
+ //Create MainLayout and MainWidget
+ this->centralWidget()->setLayout(mainLayout);
+ mainLayout->addWidget(tabWidget, 0, 0);
+ mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom);
+ mainLayout->setRowStretch(0,4);
+ mainLayout->setRowStretch(1,1);
+
+
+ //Tab page: Case
+ QGridLayout *tabCaseLayout = new QGridLayout(this);
+ tabCaseLayout->setVerticalSpacing(2);
+ tabCaseLayout->setHorizontalSpacing(2);
+ tabCaseLayout->setSpacing(2);
+ tabCaseLayout->setMargin(2);
+ treeModuleList = new QTreeWidget(tabCase);
+ treeModuleList->setContextMenuPolicy(Qt::NoContextMenu);
+ treeModuleList->headerItem()->setText(0, tr("Module List"));
+ treeModuleList->setSelectionBehavior(QAbstractItemView::SelectRows);
+ treeModuleList->setEditFocus(false);
+ connect(treeModuleList, SIGNAL(itemClicked(QTreeWidgetItem* , int)), this,
+ SLOT(on_treeModuleList_itemClicked(QTreeWidgetItem* , int)));
+
+
+ QWidget *caseToolWidget = new QWidget(tabCase);
+ caseToolWidget->setContextMenuPolicy(Qt::NoContextMenu);
+ QGridLayout *caseToolWidgetLayout = new QGridLayout(this);
+ QPushButton *btnRunCase = new QPushButton(tr("Run"), caseToolWidget);
+ btnRunCase->setContextMenuPolicy(Qt::NoContextMenu);
+ connect(btnRunCase, SIGNAL(clicked()), this,
+ SLOT(on_actRunCaseSeq_triggered()));
+ QPushButton *btnExpandAll = new QPushButton(tr("Expand"), caseToolWidget);
+ btnExpandAll->setContextMenuPolicy(Qt::NoContextMenu);
+ connect(btnExpandAll, SIGNAL(clicked()), this,
+ SLOT(on_actExpand_triggered()));
+ QPushButton *btnCollapseAll = new QPushButton(tr("Collapse"),
+ caseToolWidget);
+ btnCollapseAll->setContextMenuPolicy(Qt::NoContextMenu);
+ connect(btnCollapseAll, SIGNAL(clicked()), this,
+ SLOT(on_actCollapse_triggered()));
+
+ caseToolWidgetLayout->addWidget(btnRunCase, 0, 0);
+ caseToolWidgetLayout->addWidget(btnExpandAll, 0, 1);
+ caseToolWidgetLayout->addWidget(btnCollapseAll, 0, 2);
+ caseToolWidget->setLayout(caseToolWidgetLayout);
+
+ tabCaseLayout->addWidget(caseToolWidget, 1, 0);
+ tabCaseLayout->addWidget(treeModuleList, 0, 0);
+ tabCase->setLayout(tabCaseLayout);
+
+ //Tab page: Set
+
+ QGridLayout *tabSetLayout = new QGridLayout(this);
+ tabSetLayout->setVerticalSpacing(2);
+ tabSetLayout->setHorizontalSpacing(2);
+ tabSetLayout->setSpacing(2);
+ tabSetLayout->setMargin(2);
+
+ QGridLayout *tabSetMainLayout = new QGridLayout(this);
+ tabSetMainLayout->setVerticalSpacing(2);
+ tabSetMainLayout->setHorizontalSpacing(2);
+ tabSetMainLayout->setSpacing(2);
+ tabSetMainLayout->setMargin(2);
+ QWidget *tabSetMainWidget = new QWidget(tabSet);
+ tabSetMainWidget->setContextMenuPolicy(Qt::NoContextMenu);
+ QLabel *lblSet = new QLabel(tr("Test Set:"), tabSetMainWidget);
+ lblSet->setContextMenuPolicy(Qt::NoContextMenu);
+ QLabel *lblCase = new QLabel(tr("Cases:"), tabSetMainWidget);
+ lblCase->setContextMenuPolicy(Qt::NoContextMenu);
+ cboSetList = new QComboBox(tabSetMainWidget);
+ cboSetList->setContextMenuPolicy(Qt::NoContextMenu);
+ cboSetList->setEditable(false);
+ connect(cboSetList, SIGNAL(currentIndexChanged(QString)), this,
+ SLOT(on_cboSetList_currentIndexChanged(QString)));
+ lstSetCases = new QListWidget(tabSetMainWidget);
+ lstSetCases->setContextMenuPolicy(Qt::NoContextMenu);
+ tabSetMainLayout->addWidget(lblSet, 0, 0);
+ tabSetMainLayout->addWidget(cboSetList, 0, 1);
+ tabSetMainLayout->addWidget(lblCase, 1, 0,
+ (Qt::AlignTop | Qt::AlignRight));
+ tabSetMainLayout->addWidget(lstSetCases, 1, 1);
+ tabSetMainWidget->setLayout(tabSetMainLayout);
+
+ QWidget *setToolWidget = new QWidget(tabSet);
+ setToolWidget->setContextMenuPolicy(Qt::NoContextMenu);
+ QGridLayout *setToolWidgetLayout = new QGridLayout(this);
+ setToolWidgetLayout->setVerticalSpacing(2);
+ setToolWidgetLayout->setHorizontalSpacing(2);
+ setToolWidgetLayout->setSpacing(2);
+ setToolWidgetLayout->setMargin(2);
+ QPushButton *btnRunSetCase = new QPushButton(tr("Run"), setToolWidget);
+ btnRunSetCase->setContextMenuPolicy(Qt::NoContextMenu);
+ connect(btnRunSetCase, SIGNAL(clicked()), this,
+ SLOT(on_actRunSetSeq_triggered()));
+ QPushButton *btnNewSet = new QPushButton(tr("New Set"), setToolWidget);
+ btnNewSet->setContextMenuPolicy(Qt::NoContextMenu);
+ connect(btnNewSet, SIGNAL(clicked()), this,
+ SLOT(on_actNewSet_triggered()));
+ QPushButton *btnDelSet = new QPushButton(tr("Delete Set"), setToolWidget);
+ btnDelSet->setContextMenuPolicy(Qt::NoContextMenu);
+ connect(btnDelSet, SIGNAL(clicked()), this,
+ SLOT(on_actDelSet_triggered()));
+
+ setToolWidgetLayout->addWidget(btnRunSetCase, 0, 0);
+ setToolWidgetLayout->addWidget(btnNewSet, 0, 1);
+ setToolWidgetLayout->addWidget(btnDelSet, 0, 2);
+ setToolWidget->setLayout(setToolWidgetLayout);
+
+ tabSetLayout->addWidget(tabSetMainWidget, 0, 0);
+ tabSetLayout->addWidget(setToolWidget, 1, 0);
+ tabSet->setLayout(tabSetLayout);
+
+ //Tab Started
+ QGridLayout *tabStartedLayout = new QGridLayout(this);
+ tabStartedLayout->setVerticalSpacing(2);
+ tabStartedLayout->setHorizontalSpacing(2);
+ tabStartedLayout->setSpacing(2);
+ tabStartedLayout->setMargin(2);
+ lstStartedCases = new QListWidget(tabStarted);
+ lstStartedCases->setContextMenuPolicy(Qt::NoContextMenu);
+ QWidget *startedToolWidget = new QWidget(tabStarted);
+ startedToolWidget->setContextMenuPolicy(Qt::NoContextMenu);
+ QGridLayout *startedToolWidgetLayout = new QGridLayout(this);
+ startedToolWidgetLayout->setVerticalSpacing(2);
+ startedToolWidgetLayout->setHorizontalSpacing(2);
+ startedToolWidgetLayout->setSpacing(2);
+ startedToolWidgetLayout->setMargin(2);
+ btnPauseCase = new QPushButton(tr("Pause"), startedToolWidget);
+ btnPauseCase->setContextMenuPolicy(Qt::NoContextMenu);
+ connect(btnPauseCase, SIGNAL(clicked()), this,
+ SLOT(on_actPause_triggered()));
+ btnPauseCase->setEnabled(false);
+
+ btnAbortCase = new QPushButton(tr("Abort"), startedToolWidget);
+ btnAbortCase->setContextMenuPolicy(Qt::NoContextMenu);
+ connect(btnAbortCase, SIGNAL(clicked()), this,
+ SLOT(on_actAbort_triggered()));
+ btnAbortCase->setEnabled(false);
+
+ btnShowOutput = new QPushButton(tr("Output"), startedToolWidget);
+ connect(btnShowOutput, SIGNAL(clicked()), this,
+ SLOT(on_actOutput_triggered()));
+ btnShowOutput->setEnabled(false);
+
+
+ startedToolWidgetLayout->addWidget(btnPauseCase, 0, 0);
+ startedToolWidgetLayout->addWidget(btnAbortCase, 0, 1);
+ startedToolWidgetLayout->addWidget(btnShowOutput, 0, 2);
+ startedToolWidget->setLayout(startedToolWidgetLayout);
+
+ tabStartedLayout->addWidget(lstStartedCases, 0, 0);
+ tabStartedLayout->addWidget(startedToolWidget, 1, 0);
+ tabStarted->setLayout(tabStartedLayout);
+
+ //Tab Statistic
+ QGridLayout *tabStatisticLayout = new QGridLayout(this);
+ tabStatisticLayout->setVerticalSpacing(2);
+ tabStatisticLayout->setHorizontalSpacing(2);
+ tabStatisticLayout->setSpacing(2);
+ tabStatisticLayout->setMargin(2);
+
+ treeStatistic = new QTreeWidget(tabStatistic);
+ treeStatistic->setContextMenuPolicy(Qt::NoContextMenu);
+ treeStatistic->headerItem()->setText(0, tr("Statistics"));
+ tabStatisticLayout->addWidget(treeStatistic, 0, 0);
+ tabStatistic->setLayout(tabStatisticLayout);
+
+ executedItems = new QTreeWidgetItem(treeStatistic);
+ executedItems->setText(0, tr("Executed Cases(0)"));
+ passedItems = new QTreeWidgetItem(treeStatistic);
+ passedItems->setText(0, tr("Passed Cases(0)"));
+ failedItems = new QTreeWidgetItem(treeStatistic);
+ failedItems->setText(0, tr("Failed Cases(0)"));
+ crashedItems = new QTreeWidgetItem(treeStatistic);
+ crashedItems->setText(0, tr("Crashed Cases(0)"));
+ abortedItems = new QTreeWidgetItem(treeStatistic);
+ abortedItems->setText(0, tr("Aborted Cases(0)"));
+
+ //this->repaint();
+
+
+ }
+
+
+
+void FrmMain::LoadSubMenu()
+ {
+ menuBar()->clear();
+ menuBar()->setContextMenuPolicy(Qt::NoContextMenu);
+ if (tabWidget->currentIndex() == 0)
+ {
+ //Cases Tab
+ menuBar()->addAction(actOpenFile);
+ menuBar()->addMenu(menuRunCase);
+ menuRunCase->addAction(actRunCaseSeq);
+ menuRunCase->addAction(actRunCasePar);
+ menuBar()->addAction(actReapeatRunSeq);
+ menuBar()->addSeparator();
+ menuBar()->addAction(actAddtoSet);
+ menuBar()->addSeparator();
+ menuBar()->addAction(actSelectAll);
+ menuBar()->addAction(actExpandAll);
+ menuBar()->addAction(actCollapseAll);
+ }
+ else if (tabWidget->currentIndex() == 1)
+ {
+ //Set Tab
+ menuBar()->addMenu(menuRunSet);
+ menuRunSet->addAction(actRunSetSeq);
+ menuRunSet->addAction(actRunSetPar);
+ menuBar()->addSeparator();
+ menuBar()->addAction(actNewSet);
+ menuBar()->addAction(actDelSet);
+ }
+ else if (tabWidget->currentIndex() == 2)
+ {
+ //Started Tab
+ menuBar()->addAction(actPause);
+ menuBar()->addAction(actAbort);
+ menuBar()->addAction(actOutput);
+
+ }
+ else
+ {
+ //Staticstic tab
+ menuBar()->addAction(actClearStatistics);
+ }
+ menuBar()->addSeparator();
+ menuBar()->addAction(actSetting);
+ menuBar()->addAction(actAbout);
+ menuBar()->addAction(actExit);
+
+ }
+
+void FrmMain::onTabWidgetSelectIndexChanged()
+ {
+ LoadSubMenu();
+ }
+
+void FrmMain::loadContent()
+ {
+ //Load ModuleList
+ loadModuleList();
+ //Load SetList
+ loadSetList();
+ //Load Statistic List
+ loadStatistic();
+ }
+
+void FrmMain::loadModuleList()
+ {
+ treeModuleList->clear();
+
+ QList<QString> moduleList = controller->GetModuleList();
+ foreach(QString moduleName, moduleList)
+ {
+ QTreeWidgetItem* item = new QTreeWidgetItem(treeModuleList);
+ item->setText(0, UNSELECTITEMHEADER + moduleName);
+
+ QList<QString> caseList = controller->GetCaseListByModule(
+ moduleName);
+
+ foreach(QString caseName, caseList)
+ {
+ QTreeWidgetItem* caseItem = new QTreeWidgetItem(item);
+ caseItem->setText(0, UNSELECTITEMHEADER + caseName);
+ }
+ }
+ if (moduleList.size() > 0)
+ {
+ treeModuleList->setCurrentItem(treeModuleList->topLevelItem(0));
+ }
+ }
+
+void FrmMain::reloadStatisticItem(QString name, QTreeWidgetItem* item,
+ TSTFCaseStatusType type)
+ {
+ QList<CSTFCase> caseList = controller->GetCasesByStatus(type);
+ while (item->childCount() != 0)
+ {
+ item->removeChild(item->child(0));
+ }
+ item->setText(0, name + "(" + QString::number(caseList.size(), 10) + ")");
+ foreach(CSTFCase aCase, caseList)
+ {
+ QTreeWidgetItem* child = new QTreeWidgetItem(item);
+ child->setText(0, aCase.Name());
+ }
+ }
+
+void FrmMain::loadStatistic()
+ {
+ //executedItems;
+ reloadStatisticItem("Executed Cases", executedItems, EStatusExecuted);
+
+ //passedItems;
+ reloadStatisticItem("Passed Cases", passedItems, EStatusPassed);
+
+ //failedItems;
+ reloadStatisticItem("Failed Cases", failedItems, EStatusFailed);
+
+ //crashedItems;
+ reloadStatisticItem("Crashed Cases", crashedItems, EStatusCrashed);
+
+ //abortedItems;
+ reloadStatisticItem("Aborted Cases", abortedItems, EStatusAborted);
+
+ }
+
+void FrmMain::loadSetList()
+ {
+ cboSetList->clear();
+
+ QList<QString> setList = controller->GetSetList();
+ foreach(QString setName, setList)
+ {
+ cboSetList->addItem(setName);
+ }
+// if (setList.size() > 0)
+// {
+// //cboSetList->setCurrentIndex(0);
+// on_cboSetList_currentIndexChanged(setList.at(0));
+// }
+ }
+
+QList<CSTFCase> FrmMain::getSelectedCases()
+ {
+ int index = 0;
+ QTreeWidgetItem* item = treeModuleList->topLevelItem(index);
+ QList<CSTFCase> caseList;
+ while (item != 0)
+ {
+ for (int i = 0; i < item->childCount(); i++)
+ {
+ QTreeWidgetItem* child = item->child(i);
+ if (child->text(0).startsWith(SELECTITEMHEADER))
+ {
+ CSTFCase aCase(child->text(0).remove(0,3), i);
+ aCase.SetIndex(i);
+ //aCase.SetModuleName(moduleBox->text());
+ aCase.SetModuleName(item->text(0).remove(0,3));
+ caseList.append(aCase);
+ }
+ }
+ index++;
+ item = treeModuleList->topLevelItem(index);
+ }
+ return caseList;
+ }
+
+void FrmMain::on_cboSetList_currentIndexChanged(QString item)
+ {
+ lstSetCases->clear();
+ QList<QString> list = controller->GetCaseListBySet(item);
+ foreach(QString caseName, list)
+ {
+ lstSetCases->addItem(caseName);
+ }
+ }
+
+void FrmMain::startRunning()
+ {
+ setSetting();
+ tabWidget->setCurrentWidget(tabStarted);
+ }
+
+void FrmMain::on_actRunCaseSeq_triggered()
+ {
+ //run case seq
+ startRunning();
+ controller->RunCases(getSelectedCases(), Sequentially);
+ }
+
+void FrmMain::on_actRunCasePar_triggered()
+ {
+ startRunning();
+ controller->RunCases(getSelectedCases(), Parallel);
+ }
+
+void FrmMain::on_actReapeatRunSeq_triggered()
+ {
+ DlgRepeatRun dlgRepeatRun(this);
+ int result = dlgRepeatRun.exec();
+ if(result == QDialog::Accepted)
+ {
+ QList<CSTFCase> selectedCases = getSelectedCases();
+ if(selectedCases.count() > 0)
+ {
+ startRunning();
+ controller->RepeatRunCases( selectedCases,
+ dlgRepeatRun.isRepeatInfinitely(),
+ dlgRepeatRun.GetLoopTimes() );
+ }
+
+ }
+ }
+
+void FrmMain::on_actAddtoSet_triggered()
+ {
+ QList<CSTFCase> list = getSelectedCases();
+ if (list.size() == 0)
+ {
+ QErrorMessage *errorMessageDialog = new QErrorMessage(this);
+ errorMessageDialog->setAutoFillBackground(true);
+ errorMessageDialog->showMessage(tr(
+ "<font color =black>Please select cases you want to added to set.</font>"));
+ return;
+ }
+
+ QList<QString> setList = controller->GetSetList();
+
+ DlgSetSelector dlgSet(setList, this);
+ int result = dlgSet.exec();
+ QString setName;
+ if(result == QDialog::Accepted)
+ {
+ setName = dlgSet.SelectName();
+ }
+ else
+ {
+ return;
+ }
+ bool rst = false;
+ if(setName == "")
+ {
+ setName = "temp.set";
+ rst = controller->CreateSet(setName);
+ if(!rst)
+ {
+ return;
+ }
+ }
+ controller->AddCaseToSet(list, setName);
+//
+// bool ok;
+// QString setName = QInputDialog::getItem(this, tr(
+// "\r\nAdd select cases to Set"), tr("\r\n\r\nSets:"), setList, 0, false, &ok, Qt::Dialog);
+// if (ok && !setName.isEmpty())
+// {
+// if(setName == newSet)
+// {
+// ok = controller->CreateSet(setName);
+// if(!ok)
+// {
+// return;
+// }
+// }
+// controller->AddCaseToSet(list, setName);
+// }
+ tabWidget->setCurrentIndex(1);
+ int index = -1;
+ for(int i=0;i<cboSetList->count();i++)
+ {
+ if(cboSetList->itemText(i) == setName)
+ {
+ index = i;
+ break;
+ }
+ }
+ if(index != -1)
+ {
+ cboSetList->setCurrentIndex(index);
+ }
+
+
+ }
+
+void FrmMain::on_actSelectAll_triggered()
+ {
+ QString header = UNSELECTITEMHEADER;
+ if(actSelectAll->text() == "Select All")
+ {
+ actSelectAll->setText("UnSelect All");
+ header = SELECTITEMHEADER;
+ }
+ else
+ {
+ actSelectAll->setText("Select All");
+ }
+
+ int index = 0;
+ QTreeWidgetItem* item = treeModuleList->topLevelItem(index);
+ while (item != 0)
+ {
+ if(!item->isHidden())
+ item->setText(0, item->text(0).replace(0,3, header));
+ for (int i = 0; i < item->childCount(); i++)
+ {
+ QTreeWidgetItem* child = item->child(i);
+ if(!child->isHidden())
+ child->setText(0,child->text(0).replace(0,3,header));
+ }
+ index++;
+ item = treeModuleList->topLevelItem(index);
+ }
+ }
+
+void FrmMain::on_actExpandAll_triggered()
+ {
+ QTreeWidgetItem* item = treeModuleList->currentItem();
+ treeModuleList->expandAll();
+ if(item != NULL)
+ {
+ treeModuleList->setCurrentItem(item);
+ }
+
+ }
+
+void FrmMain::on_actCollapseAll_triggered()
+ {
+ QTreeWidgetItem* item = treeModuleList->currentItem();
+ if(item != NULL)
+ {
+ if(item->parent() != NULL)
+ {
+ item = item->parent();
+ }
+ }
+ treeModuleList->collapseAll();
+ if(item != NULL)
+ {
+ treeModuleList->setCurrentItem(item);
+ }
+
+ }
+
+void FrmMain::on_actSetting_triggered()
+ {
+ DlgSetting dlgSet(uiSetting);
+ currentFilter = uiSetting->ReadSetting(KFilter);
+ currentFilterCaseSens = uiSetting->ReadSetting(KFilterCaseSens);
+ int result = dlgSet.exec();
+ if(result == QDialog::Accepted)
+ {
+ setSetting();
+ }
+ }
+
+void FrmMain::on_actRunSetSeq_triggered()
+ {
+ startRunning();
+ QString setName = cboSetList->currentText();
+ controller->RunSets(setName, Sequentially);
+ }
+
+void FrmMain::on_actRunSetPar_triggered()
+ {
+ startRunning();
+ QString setName = cboSetList->currentText();
+ controller->RunSets(setName, Parallel);
+ }
+
+void FrmMain::on_actNewSet_triggered()
+ {
+ QString name;
+ bool rst = controller->CreateSet(name);
+ if(rst)
+ {
+ QMessageBox::information(this,
+ tr("Create Set Successfully"),
+ "Create a new test set, named: " + name);
+
+ int index = -1;
+ for(int i=0;i<cboSetList->count();i++)
+ {
+ if(cboSetList->itemText(i) == name)
+ {
+ index = i;
+ break;
+ }
+ }
+ if(index != -1)
+ {
+ cboSetList->setCurrentIndex(index);
+ }
+
+
+ }
+ else
+ {
+ QMessageBox::information(this,
+ tr("Create Set Failed"),
+ tr("Please check the log for more information."));
+
+ }
+
+ }
+
+void FrmMain::on_actDelSet_triggered()
+ {
+ QString setName = cboSetList->currentText();
+ QMessageBox msgBox(QMessageBox::Warning, tr("Delete a Set"), tr(
+ "Do you really want to delete the set?"), 0, this);
+ msgBox.addButton(tr("&Delete"), QMessageBox::AcceptRole);
+ msgBox.addButton(tr("&Cancel"), QMessageBox::RejectRole);
+ if (msgBox.exec() == QMessageBox::AcceptRole)
+ {
+ controller->DeleteSet(setName);
+ }
+
+ }
+
+void FrmMain::on_actPause_triggered()
+ {
+ if (btnPauseCase->text() == "Pause")
+ {
+ controller->PauseCase();
+ btnPauseCase->setText(tr("Resume"));
+ actPause->setText(tr("Resume"));
+ }
+ else
+ {
+ controller->ResumeCase();
+ btnPauseCase->setText(tr("Pause"));
+ actPause->setText(tr("Pause"));
+ }
+ }
+
+void FrmMain::on_actAbort_triggered()
+ {
+ controller->AbortCase();
+ }
+
+void FrmMain::on_treeModuleList_itemClicked(QTreeWidgetItem* item, int /*column*/)
+ {
+ //Check if shift key is pressed
+ bool isShiftPressed = false;
+ Qt::KeyboardModifiers keyMod = QApplication::keyboardModifiers();
+ isShiftPressed=keyMod.testFlag(Qt::ShiftModifier);
+
+ //Handle shift key.
+ //Shift not pressed.
+ if(!isShiftPressed)
+ {
+ setItemClicked(item);
+ }
+ //Shift pressed.
+ else
+ {
+ enum Direction
+ {
+ Item_NoDirection,
+ Item_Above,
+ Item_Below
+ };
+ Direction direction = Item_NoDirection;
+ QTreeWidgetItem* tempItem = item;
+ //check direction of last selected item comparing current one.
+ while(tempItem)
+ {
+ tempItem = treeModuleList->itemAbove(tempItem);
+ if(tempItem == lastItemSelected)
+ {
+ direction = Item_Above;
+ break;
+ }
+ }
+ if (direction != Item_Above)
+ {
+ tempItem = item;
+ while(tempItem)
+ {
+ tempItem = treeModuleList->itemBelow(tempItem);
+ if(tempItem == lastItemSelected)
+ {
+ direction = Item_Below;
+ break;
+ }
+ }
+ }
+
+ // Select all items between current item and last selected item.
+ tempItem = item;
+ if(direction != Item_NoDirection)
+ {
+ while(tempItem)
+ {
+ //check if this item been selected.
+ bool isItemSelected = false;
+ if ( tempItem->text(0).left(3).compare(SELECTITEMHEADER)==0 )
+ {
+ isItemSelected = true;
+ }
+ // If not selected, set to selected.
+ if (!isItemSelected )
+ {
+ setItemClicked(tempItem);
+ }
+
+ //Go above/below
+ if (direction == Item_Above)
+ {
+ tempItem = treeModuleList->itemAbove(tempItem);
+ }
+ if (direction == Item_Below)
+ {
+ tempItem = treeModuleList->itemBelow(tempItem);
+ }
+
+ if (tempItem == lastItemSelected)
+ {
+ break;
+ }
+ }
+ }
+ }
+
+ // Set current clicked item to last selected item.
+ lastItemSelected = item;
+
+
+ }
+
+void FrmMain::setItemClicked(QTreeWidgetItem* item)
+ {
+ QString header = UNSELECTITEMHEADER;
+ if(item->text(0).startsWith(UNSELECTITEMHEADER))
+ {
+ header = SELECTITEMHEADER;
+ }
+ item->setText(0 , item->text(0).replace(0, 3, header));
+ for(int i=0;i<item->childCount();i++)
+ {
+ item->child(i)->setText(0, item->child(i)->text(0).replace(0, 3, header));
+ }
+ }
+
+void FrmMain::on_actAbout_triggered()
+ {
+ QString str = QtUIName + "< >" + QtUIVersion;
+ str.append("<br>").append("engine version:");
+
+ str.append(QString::number(STIF_MAJOR_VERSION, 10)).append(".");
+ str.append(QString::number(STIF_MINOR_VERSION, 10)).append(".");
+ str.append(QString::number(STIF_BUILD_VERSION, 10));
+ str.append(" --").append(STIF_REL_DATE).append("<br>");
+ str.append("---");
+ str.append("Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. ");
+
+ QErrorMessage *errorMessageDialog = new QErrorMessage(this);
+ errorMessageDialog->showMessage("<font color =black size=12px><b>" + str + "</b></font>");
+
+ }
+
+void FrmMain::on_actOpenFile_triggered()
+ {
+ QString fileName = QFileDialog::getOpenFileName(this, tr(
+ "Select ini file"), tr("c:\\"), tr(
+ "Ini Files (*.ini);;All Files (*)"));
+ if (!fileName.isEmpty())
+ {
+ bool result = controller->OpenEngineIniFile(fileName);
+ if(result)
+ {
+ this->loadModuleList();
+ QMessageBox::information(this, tr("Open INI File"), "Load Engine INI file successfully!");
+ }
+ else
+ {
+ QMessageBox::warning(this, tr("Open INI File"),"Failed to Load Engine INI file. Please check the file format and its path.");
+ }
+
+ }
+ }
+
+void FrmMain::on_actClearStatistics_triggered()
+ {
+ model->ClearCasesStatus();
+ }
+
+
+void FrmMain::on_actExpand_triggered()
+ {
+ QTreeWidgetItem* item = treeModuleList->currentItem();
+ if(item != NULL)
+ {
+ item->setExpanded(true);
+ }
+ }
+
+void FrmMain::on_actCollapse_triggered()
+ {
+
+ QTreeWidgetItem* item = treeModuleList->currentItem();
+ if(item != NULL)
+ {
+ item->setExpanded(false);
+ }
+ }
+
+void FrmMain::on_actOutput_triggered()
+ {
+ controller->SetShowOutput(true);
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/main.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+* Application entrance.
+*
+*/
+#include <QApplication>
+#include "frmmain.h"
+
+int main(int argc, char* argv[])
+{
+ Q_INIT_RESOURCE(StfQtUI);
+ QApplication app(argc, argv);
+ FrmMain win;
+ win.showMaximized();
+ return app.exec();
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/stfqtuicontroller.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,411 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: QT C++ based Class.
+ * Stf Controller implementation.
+ *
+ */
+#include "stfqtuicontroller.h"
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+#include <QDateTime>
+
+const QString TEMPSETNAME = "TEMPSET";
+const QString DEFAULTINI = "c:\\testframework\\testframework.ini";
+
+
+
+StfQtUIController::StfQtUIController(IStfQtUIModel* aModel) :
+ model(aModel),
+ isShowOutput(false),
+ iCurrentRunPos(0),
+ isLoopInfinitely(false),
+ loopTimes(0)
+
+ {
+ executor = new CStifExecutor();
+ executor->OpenIniFile(DEFAULTINI);
+ executor->AddStifCaseUpdateListener(this);
+ }
+
+StfQtUIController::~StfQtUIController()
+ {
+ executor->RemoveStifCaseUpdateListener(this);
+ delete executor;
+ executor = NULL;
+ }
+//for cases
+
+bool StfQtUIController::OpenEngineIniFile(const QString& fileName)
+ {
+ QString path = fileName;
+ if(path.contains('/'))
+ {
+ path = path.replace('/', '\\');
+ }
+ executor->RemoveStifCaseUpdateListener(this);
+ delete executor;
+ executor = new CStifExecutor();
+ bool rst = executor->OpenIniFile(path);
+ executor->AddStifCaseUpdateListener(this);
+ return rst;
+ }
+
+QList<QString> StfQtUIController::GetModuleList()
+ {
+ QList<CSTFModule> modules = executor->GetModuleList();
+ QList<QString> moduleList;
+ foreach(CSTFModule m, modules)
+ {
+ moduleList.append(m.Name());
+ }
+ return moduleList;
+ }
+
+CSTFModule StfQtUIController::GetModuleByName(const QString& moduleName)
+ {
+ QList<CSTFModule> modules = executor->GetModuleList();
+ CSTFModule module;
+ foreach(CSTFModule m, modules)
+ {
+ if(m.Name() == moduleName)
+ {
+ module = m;
+ break;
+ }
+ }
+ return module;
+
+ }
+
+QList<QString> StfQtUIController::GetCaseListByModule(const QString& moduleName)
+ {
+ QList<QString> caseList;
+ if (moduleName != "")
+ {
+ QList<CSTFCase> cases = executor->GetCaseList(moduleName);
+ foreach(CSTFCase c, cases)
+ {
+ caseList.append(c.Name());
+ }
+ }
+
+ return caseList;
+ }
+
+CSTFCase StfQtUIController::GetCase(const QString& moduleName, const int index)
+ {
+ CSTFCase rst;
+ if(moduleName != "")
+ {
+ QList<CSTFCase> cases = executor->GetCaseList(moduleName);
+ if(index < cases.length())
+ {
+ rst = cases.at(index);
+ }
+ }
+ return rst;
+ }
+
+void StfQtUIController::RunCases(const QList<CSTFCase>& caseList,
+ const TSTFCaseRunningType& type)
+ {
+ if (caseList.size() == 1)
+ {
+ CSTFCase aCase = caseList.at(0);
+ QString msg = "Start execute case:" + aCase.Name();
+ FireOnGetOutput(msg);
+ executor->ExecuteSingleCase(aCase.ModuleName(), aCase.Index());
+ }
+ else
+ {
+ //create a temp set, append cases into the set and execute it.
+ executor->CreateSet(TEMPSETNAME);
+ foreach(CSTFCase aCase, caseList)
+ {
+ executor->AddtoSet(TEMPSETNAME, aCase);
+ }
+ RunSets(TEMPSETNAME, type);
+ executor->RemoveSet(TEMPSETNAME);
+ }
+ }
+
+// run cases repeatly.
+// By default, loopTimes = -1 means loop infinitely util user stop it.
+void StfQtUIController::RepeatRunCases(const QList<CSTFCase>& aCaseList, const bool aIsLoopInfinitely, const int aLoopTimes)
+ {
+ InitRepeatSetting(aIsLoopInfinitely, aLoopTimes);
+ repeatRunCaseList = aCaseList;
+
+ Execution();
+
+ }
+
+void StfQtUIController::InitRepeatSetting(const bool aIsLoopInfinitely, const int aLoopTimes)
+ {
+ loopTimes = aLoopTimes;
+ isLoopInfinitely = aIsLoopInfinitely;
+ iCurrentRunPos = 0;
+ }
+
+void StfQtUIController::ResetRepeatSetting()
+ {
+ iCurrentRunPos = 0;
+ isLoopInfinitely = false;
+ loopTimes = 0;
+ }
+
+// Repeat execution cases
+void StfQtUIController::Execution()
+ {
+ if(loopTimes > 0 || isLoopInfinitely)
+ {
+ int count = repeatRunCaseList.count();
+ CSTFCase aCase = repeatRunCaseList.at(iCurrentRunPos);
+ QString msg = "Start execute case:" + aCase.Name();
+ FireOnGetOutput(msg);
+ executor->ExecuteSingleCase(aCase.ModuleName(), aCase.Index());
+
+ iCurrentRunPos++;
+ if( iCurrentRunPos >= count )
+ {
+ iCurrentRunPos = 0;
+ loopTimes --;
+ }
+ }
+ }
+
+bool StfQtUIController::AddCaseToSet(const QList<CSTFCase>& caseList,
+ const QString& setName)
+ {
+ QString name = setName;
+ bool rst = true;
+ foreach(CSTFCase aCase, caseList)
+ {
+ rst = executor->AddtoSet(name, aCase);
+ if(!rst)
+ {
+ break;
+ }
+ }
+ if(!rst)
+ {
+ return false;
+ }
+ rst = executor->SaveSet(name);
+ FireOnSetListChanged();
+ return rst;
+ }
+
+//for set
+
+QList<QString> StfQtUIController::GetSetList()
+ {
+ return executor->GetSetList();
+ }
+QList<QString> StfQtUIController::GetCaseListBySet(const QString& setName)
+ {
+ QList<CSTFCase> cases = executor->GetCaseListFromSet(setName);
+ QList<QString> caseList;
+ foreach(CSTFCase c, cases)
+ {
+ caseList.append(c.Name());
+ }
+ return caseList;
+ }
+
+bool StfQtUIController::CreateSet(QString& setName)
+ {
+ bool rst = executor->CreateSet(setName);
+ if(!rst)
+ {
+ return rst;
+ }
+ rst = executor->SaveSet(setName);
+ FireOnSetListChanged();
+ return rst;
+ }
+
+bool StfQtUIController::DeleteSet(const QString& setName)
+ {
+ bool rst = executor->RemoveSet(setName);
+ if(!rst)
+ {
+ return false;
+ }
+ QString name = setName;
+ rst = executor->SaveSet(name);
+ FireOnSetListChanged();
+ return rst;
+ }
+
+void StfQtUIController::RunSets(const QString& setName, const TSTFCaseRunningType& type)
+ {
+ executor->ExecuteSet(setName, 0, type);
+ }
+
+//for Started
+void StfQtUIController::PauseCase()
+ {
+ model->PauseCase();
+ QString msg = "Execution Paused";
+ FireOnGetOutput(msg);
+ }
+
+void StfQtUIController::ResumeCase()
+ {
+ model->ResumeCase();
+ FireOnGetOutput("Execution Resumed");
+ }
+
+void StfQtUIController::AbortCase()
+ {
+ model->AbortCase();
+ FireOnGetOutput("Case Aborted");
+ }
+
+CSTFCase StfQtUIController::GetRunningCase(int index)
+ {
+ CStartedTestCase* startedCase = (CStartedTestCase*) index;
+ return model->GetRunningCase(startedCase);
+ }
+
+bool StfQtUIController::ShowOutput()
+ {
+ return isShowOutput;
+ }
+
+void StfQtUIController::SetShowOutput(bool isShow)
+ {
+ isShowOutput = isShow;
+ }
+
+QList<CSTFCase> StfQtUIController::GetCasesByStatus(const TSTFCaseStatusType& type)
+ {
+ return model->GetCasesByStatus(type);
+ }
+
+void StfQtUIController::AddStfEventListener(IStfEventListener* listener)
+ {
+ if (!listenerList.contains(listener))
+ {
+ listenerList.append(listener);
+ }
+ }
+void StfQtUIController::RemoveStfEventListener(IStfEventListener* listener)
+ {
+ if (listenerList.contains(listener))
+ {
+ listenerList.removeOne(listener);
+ }
+ }
+
+void StfQtUIController::OnGetCaseUpdated(CStartedTestCase* aCase,
+ CSTFCase& stfcase, int flags)
+ {
+ if (flags & CUIStoreIf::EPrintUpdate || aCase == NULL)
+ {
+ return;
+ }
+ QString msg = "case Name:";
+ msg += stfcase.Name() + "\r\n Status:";
+ flags = aCase->Status();
+ if (flags & CUIStoreIf::EStatusRunning)
+ {
+ model->AddRunningCase(aCase, stfcase);
+ msg += "start running";
+ FireOnCaseOutputChanged(IStfEventListener::ECreate, (int) aCase,
+ stfcase.Name());
+ }
+ else if (flags & CUIStoreIf::EStatusAborted)
+ {
+ FireOnCaseOutputChanged(IStfEventListener::EClose, (int) aCase, "");
+ model->RemoveRunningCase(aCase);
+ model->AddCaseByStatus(EStatusAborted, stfcase);
+ msg += "aborted";
+
+ //reset repeat execution information
+ ResetRepeatSetting();
+
+ }
+ else if (flags & CUIStoreIf::EStatusExecuted)
+ {
+ FireOnCaseOutputChanged(IStfEventListener::EClose, (int) aCase, "");
+ model->RemoveRunningCase(aCase);
+ model->AddCaseByStatus(EStatusExecuted, stfcase);
+
+ if (flags & CUIStoreIf::EStatusCrashed)
+ {
+ model->AddCaseByStatus(EStatusCrashed, stfcase);
+ msg += "crashed";
+ }
+ else if (flags & CUIStoreIf::EStatusFailed)
+ {
+ model->AddCaseByStatus(EStatusFailed, stfcase);
+ msg += "failed";
+ }
+ else if (flags & CUIStoreIf::EStatusPassed)
+ {
+ model->AddCaseByStatus(EStatusPassed, stfcase);
+ msg += "passed";
+ }
+
+ // if repeat execution is choosed, start to execution again.
+ if(loopTimes > 0 || isLoopInfinitely)
+ {
+ Execution();
+ }
+ }
+ else
+ {
+ return;
+ }
+
+ FireOnGetOutput(msg);
+ }
+
+void StfQtUIController::OnGetCaseOutput(CStartedTestCase* aCase, QString& msg)
+ {
+ FireOnCaseOutputChanged(IStfEventListener::EOutput, (int) aCase, msg);
+ }
+
+void StfQtUIController::FireOnCaseOutputChanged(
+ IStfEventListener::CaseOutputCommand cmd, int index, QString msg)
+ {
+ if (true)//ShowOutput
+ {
+ foreach(IStfEventListener* listener, listenerList)
+ {
+ listener->OnCaseOutputChanged(cmd,
+ QString::number(index, 10), msg);
+ }
+ }
+ }
+
+void StfQtUIController::FireOnGetOutput(QString message)
+ {
+ foreach(IStfEventListener* listener, listenerList)
+ {
+ listener->OnGetMessage(message);
+ }
+ }
+
+void StfQtUIController::FireOnSetListChanged()
+ {
+ foreach(IStfEventListener* listener, listenerList)
+ {
+ listener->OnSetListChanged();
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/stfqtuimodel.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: QT C++ based Class.
+ * application model implementation.
+ *
+ */
+#include "stfqtuimodel.h"
+#include <UIEngineContainer.h>
+
+StfQtUIModel::StfQtUIModel()
+ {
+ //nothing to do.
+ }
+
+StfQtUIModel::~StfQtUIModel()
+ {
+ //nothing to do.
+ }
+
+void StfQtUIModel::PauseCase()
+ {
+ foreach(const CStartedTestCase* startedCase, runningCaseList.keys())
+ {
+ startedCase->UIEngineContainer().PauseTest();
+ }
+ }
+
+void StfQtUIModel::ResumeCase()
+ {
+ foreach(const CStartedTestCase* startedCase, runningCaseList.keys())
+ {
+ startedCase->UIEngineContainer().ResumeTest();
+ }
+ }
+
+void StfQtUIModel::AbortCase()
+ {
+ foreach(const CStartedTestCase* startedCase, runningCaseList.keys())
+ {
+ startedCase->UIEngineContainer().CancelTest();
+ }
+ }
+
+void StfQtUIModel::AddRunningCase(const CStartedTestCase* startedCase,
+ const CSTFCase& stfCase)
+ {
+ runningCaseList.insert(startedCase, stfCase);
+ FireOnRunningCaseChangedEvent();
+ }
+
+void StfQtUIModel::RemoveRunningCase(const CStartedTestCase* startedCase)
+ {
+ runningCaseList.remove(startedCase);
+ FireOnRunningCaseChangedEvent();
+ }
+
+CSTFCase StfQtUIModel::GetRunningCase(const CStartedTestCase* startedCase)
+ {
+ return runningCaseList.value(startedCase);
+ }
+
+void StfQtUIModel::AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase)
+ {
+ switch (type)
+ {
+ case EStatusRunning:
+ break;
+ case EStatusExecuted:
+ executedCaseList.append(aCase);
+ break;
+ case EStatusPassed:
+ passedCaseList.append(aCase);
+ break;
+ case EStatusFailed:
+ failedCaseList.append(aCase);
+ break;
+ case EStatusAborted:
+ abortCaseList.append(aCase);
+ break;
+ case EStatusCrashed:
+ crashedCaseList.append(aCase);
+ break;
+ default:
+ break;
+ }
+ FireOnCaseStatisticChangedEvent();
+ }
+
+QList<CSTFCase> StfQtUIModel::GetCasesByStatus(const TSTFCaseStatusType& type)
+ {
+ switch (type)
+ {
+ case EStatusRunning:
+ return runningCaseList.values();
+ case EStatusExecuted:
+ return executedCaseList;
+ case EStatusPassed:
+ return passedCaseList;
+ case EStatusFailed:
+ return failedCaseList;
+ case EStatusAborted:
+ return abortCaseList;
+ case EStatusCrashed:
+ return crashedCaseList;
+ default:
+ break;
+ }
+ QList<CSTFCase> list;
+ return list;
+ }
+
+void StfQtUIModel::AddStifModelEventListener(
+ IStifModelEventListener* listener)
+ {
+ if (!listenerList.contains(listener))
+ {
+ listenerList.append(listener);
+ }
+ }
+
+void StfQtUIModel::RemoveStifModelEventListener(
+ IStifModelEventListener* listener)
+ {
+ if (!listenerList.contains(listener))
+ {
+ listenerList.removeOne(listener);
+ }
+ }
+
+void StfQtUIModel::FireOnCaseStatisticChangedEvent()
+ {
+ foreach(IStifModelEventListener* listener, listenerList)
+ {
+ listener->OnCaseStatisticChanged();
+ }
+ }
+
+void StfQtUIModel::FireOnRunningCaseChangedEvent()
+ {
+ foreach(IStifModelEventListener* listener, listenerList)
+ {
+ listener->OnRunningCaseChanged();
+ }
+ }
+
+void StfQtUIModel::ClearCasesStatus()
+ {
+ executedCaseList.clear();
+ passedCaseList.clear();
+ failedCaseList.clear();
+ abortCaseList.clear();
+ crashedCaseList.clear();
+ FireOnCaseStatisticChangedEvent();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/stifexecutor.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,407 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: QT C++ and Symbian C++ combination Class.
+ * STIF UI interface and engine caller implementaion.
+ *
+ */
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32svr.h>
+#include <f32file.h>
+#include <HAL.h>
+#include <hal_data.h>
+#include "stiflogger.h"
+#include <QString>
+#include "stifexecutor.h"
+#include "StifTFwIf.h"
+
+_LIT( KLogPath, "\\Logs\\STFUI\\" );
+// Log file
+_LIT( KLogFile, "StifUi.log" );
+
+CStifExecutor::CStifExecutor() :
+ listenerList(NULL)
+ {
+ iLog = CStifLogger::NewL( KLogPath,
+ KLogFile,
+ CStifLogger::ETxt,
+ CStifLogger::EFile,
+ ETrue,
+ ETrue,
+ ETrue,
+ EFalse,
+ ETrue,
+ EFalse,
+ 100 );
+
+
+ iLog->Log(_L("started"));
+ TInt result;
+ TRAP(result, CUIStoreIf::ConstructL());
+ iLog->Log(_L("CUIStoreIf ConstructL, result=%d"), result);
+ if (result != KErrNone)
+ {
+ return;
+ }
+ TRAP(result, iBuffer = HBufC::NewL(500));
+ iLog->Log(_L("Create Case Execution output buffer, result=%d"), result);
+
+ }
+
+CStifExecutor::~CStifExecutor()
+ {
+ UIStore().Close();
+ delete iBuffer;
+ if (listenerList)
+ {
+ delete listenerList;
+ listenerList = NULL;
+ }
+ iLog->Log(_L("finished"));
+ }
+
+bool CStifExecutor::OpenIniFile(const QString& filename)
+ {
+ TInt result = UIStore().Open(QString2TPtrC(filename));
+ iLog->Log(_L("Open ini file %s.result=%d"),QString2TPtrC(filename).Ptr(),result);
+ return (result == KErrNone);
+ }
+
+TPtrC CStifExecutor::QString2TPtrC(const QString& aString)
+ {
+ TPtrC ret(reinterpret_cast<const TText*> (aString.constData()),
+ aString.length());
+ return ret;
+ }
+QString CStifExecutor::TDesC2QString(const TDesC& des)
+ {
+ //#ifdef QT_NO_UNICODE
+ //return QString::fromLocal8Bit((char*)des.Ptr(), des.Length());
+ //#else
+ QString rst = QString::fromUtf16(des.Ptr(), des.Length());
+ return rst;
+ //#endif
+ }
+
+bool CStifExecutor::LogResult(const TInt result,const QString str)
+ {
+ QString tmp = str + " result=%d";
+ iLog->Log(QString2TPtrC(tmp), result);
+ bool rst = true;
+ if(result != KErrNone)
+ {
+ rst = false;
+ }
+ return rst;
+ }
+
+void CStifExecutor::AddStifCaseUpdateListener(
+ IStifCaseUpdateListener* listener)
+ {
+ iLog->Log(_L("AddStifCaseUpdateListener"));
+ if (!listenerList)
+ {
+ listenerList = new QList<IStifCaseUpdateListener*> ();
+ }
+ if (!listenerList->contains(listener))
+ {
+ listenerList->append(listener);
+ }
+ }
+
+void CStifExecutor::RemoveStifCaseUpdateListener(
+ IStifCaseUpdateListener* listener)
+ {
+ iLog->Log(_L("RemoveStifCaseUpdateListener"));
+ if (!listenerList)
+ {
+ return;
+ }
+
+ if (listenerList->contains(listener))
+ {
+ listenerList->removeOne(listener);
+ }
+
+ }
+
+QList<CSTFModule> CStifExecutor::GetModuleList()
+ {
+ QList<CSTFModule> list;
+ RRefArray<TDesC> modules;
+ iLog->Log(_L("GetModuleList"));
+ TInt ret = UIStore().Modules(modules);
+ iLog->Log(_L("LoadAllModules %d"), ret);
+ iLog->Log(_L("Modules number=%d"), modules.Count());
+ for (TInt i = 0; i < modules.Count(); i++)
+ {
+ iLog->Log(_L("Get Module Names %d"), i);
+ iLog->Log(_L("Get Module Name = %d .=%s"),i,modules[i].Ptr());
+
+ CSTFModule module;
+ module.SetName(QString::fromUtf16(modules[i].Ptr(),
+ modules[i].Length()));
+ //module.SetName(TDesC2QString(modules[i]));
+ list.append(module);
+ }
+ modules.Reset();
+ modules.Close();
+ return list;
+ }
+
+QList<CSTFCase> CStifExecutor::GetCaseList(const QString& moduleName)
+ {
+ TPtrC name = QString2TPtrC(moduleName);
+ QList<CSTFCase> list;
+ RRefArray<CTestInfo> testCases;
+ TInt ret = UIStore().TestCases(testCases, name, KNullDesC);
+ iLog->Log(_L("Get TestCases: %d"), ret);
+ for (TInt i = 0; i < testCases.Count(); i++)
+ {
+ iLog->Log(_L("Case Number: %d"),testCases[i].TestCaseNum());
+ iLog->Log(_L("Case Name: %s"),testCases[i].TestCaseTitle().Ptr());
+ CSTFCase testcase;
+ testcase.SetName(TDesC2QString(testCases[i].TestCaseTitle()));
+ testcase.SetIndex(i);
+ list.append(testcase);
+ }
+ testCases.Reset();
+ testCases.Close();
+ return list;
+ }
+
+void CStifExecutor::ExecuteSingleCase(const QString& moduleName, const int caseIndex)
+ {
+ iLog->Log(_L("ExecuteCase start"));
+ TPtrC name = QString2TPtrC(moduleName);
+ RRefArray<CTestInfo> testCases;
+ TInt ret = UIStore().TestCases(testCases, name, KNullDesC);
+ iLog->Log(_L("Get TestCases return code=%d"), ret);
+ if (testCases.Count() > caseIndex)
+ {
+ TInt index;
+ UIStore().StartTestCase(testCases[caseIndex], index);
+ iLog->Log(_L("start test case index=%d"), index);
+ }
+ testCases.Reset();
+ testCases.Close();
+ iLog->Log(_L("ExecuteCase end"));
+
+ }
+
+QList<QString> CStifExecutor::GetSetList()
+ {
+ QList<QString> list;
+ RRefArray<TDesC> aArray;
+ TInt ret = UIStore().GetTestSetsList(aArray);
+ iLog->Log(_L("Get TestSet list return code=%d"), ret);
+ if (ret != KErrNone) //setInfos.Count() != 1
+ {
+ return list;
+ }
+ for (int i = 0; i < aArray.Count(); i++)
+ {
+ list.append(TDesC2QString(aArray[i]));
+ }
+ aArray.Reset();
+ aArray.Close();
+ return list;
+ }
+
+QList<CSTFCase> CStifExecutor::GetCaseListFromSet(const QString& setName)
+ {
+ iLog->Log(_L("GetCaseListFromSet start."));
+ QList<CSTFCase> list;
+ TPtrC name = QString2TPtrC(setName);
+
+ //iLog->Log(name);
+ if (name.Length() == 0)
+ {
+ return list;
+ }
+
+ iLog->Log(_L("name.Length()=%d"), name.Length());
+ TInt ret = UIStore().LoadTestSet(name);
+ iLog->Log(_L("Load Test Set return=%d"),ret);
+ const CTestSetInfo* set = NULL;
+ TRAP(ret , set = &UIStore().TestSetL(name));
+ iLog->Log(_L("GetCaseListFromSet TestSetL."));
+ if(ret != KErrNone)
+ {
+ return list;
+ }
+ const RRefArray<const CTestInfo>& testCases = set->TestCases();
+ iLog->Log(_L("GetCaseListFromSet TestCases."));
+ TInt count = testCases.Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ CSTFCase testcase;
+ testcase.SetName(TDesC2QString(testCases[i].TestCaseTitle()));
+ testcase.SetIndex(testCases[i].TestCaseNum());
+ testcase.SetModuleName(TDesC2QString(testCases[i].ModuleName()));
+ list.append(testcase);
+ }
+ iLog->Log(_L("GetCaseListFromSet end."));
+ return list;
+ }
+
+bool CStifExecutor::CreateSet(const QString& setName)
+ {
+ TPtrC name = QString2TPtrC(setName);
+ TInt ret = UIStore().CreateTestSet(name);
+ return LogResult(ret, "CreateSet");
+ }
+
+bool CStifExecutor::SaveSet(QString& setName)
+ {
+ TPtrC name = QString2TPtrC(setName);
+ TFileName testSetName;
+ testSetName.Copy(name);
+ TInt ret = UIStore().SaveTestSet(testSetName);
+ setName = TDesC2QString(testSetName);
+ return LogResult(ret, "SaveSet");
+ }
+
+bool CStifExecutor::RemoveSet(const QString& setName)
+ {
+ //This method wil not work at this stage.
+ TPtrC name = QString2TPtrC(setName);
+ TInt ret = UIStore().RemoveTestSet(name);
+ return LogResult(ret, "RemoveSet");
+ }
+
+bool CStifExecutor::AddtoSet(const QString& setName, CSTFCase& caseInfo)
+ {
+ iLog->Log(_L("AddToSet Start"));
+
+ //IMPORT_C TInt AddToTestSet( const TDesC& aSetName, const CTestInfo& aTestInfo );
+ TPtrC modulename = QString2TPtrC(caseInfo.ModuleName());
+ iLog->Log(_L("AddToSet dealwith module: %s"), modulename.Ptr());
+ iLog->Log(_L("Case name: %s"),QString2TPtrC(caseInfo.Name()).Ptr());
+ iLog->Log(_L("Case index: %d"),caseInfo.Index());
+ TInt caseIndex = caseInfo.Index();
+ if(caseInfo.ModuleName().toLower() == "testscripter"
+ ||caseInfo.ModuleName().toLower() == "teftestmodule")
+ {
+ caseIndex++;
+ }
+ RRefArray<CTestInfo> testCases;
+ TInt ret = UIStore().TestCases(testCases, modulename, KNullDesC);
+ if(!LogResult(ret, "AddToSet, GetTestCases"))
+ {
+ return false;
+ }
+
+ ret = -1;
+ for (TInt i = 0; i < testCases.Count(); i++)
+ {
+ iLog->Log(_L("Case Number: %d"),testCases[i].TestCaseNum());
+ iLog->Log(_L("Case Title: %s"),testCases[i].TestCaseTitle().Ptr());
+
+ if (testCases[i].TestCaseNum() == caseIndex)
+ {
+ ret = UIStore().AddToTestSet(QString2TPtrC(setName), testCases[i]);
+ iLog->Log(_L("AddToTestSet: %d"), ret);
+ break;
+ }
+ }
+ testCases.Reset();
+ testCases.Close();
+ return LogResult(ret, "AddToSet");
+ }
+
+void CStifExecutor::ExecuteSet(const QString& SetName, const int startIndex,
+ const TSTFCaseRunningType type)
+ {
+ CStartedTestSet::TSetType setType = CStartedTestSet::ESetSequential;
+ if (type == Parallel)
+ {
+ setType = CStartedTestSet::ESetParallel;
+ }
+ const CTestSetInfo* set = NULL;
+ TInt ret;
+ TBuf<30> test;
+ test.Append(QString2TPtrC(SetName));
+ iLog->Log(_L("StartTestSet GetSetName:"));
+ iLog->Log(test);
+ TRAP(ret, set = &UIStore().TestSetL(test));
+
+ //const CTestSetInfo& set = UIStore().TestSetL(QString2TPtrC(SetName));
+ if(ret != KErrNone)
+ {
+ iLog->Log(_L("StartTestSet GetTestSet Error return=%d"),ret);
+ return;
+ }
+ int a = startIndex;
+ ret = UIStore().StartTestSet(*set, a, setType);
+ iLog->Log(_L("StartTestSet return=%d"),ret);
+ }
+
+void CStifExecutor::Update(CStartedTestCase* aCase, int flags)
+ {
+ iLog->Log(_L("CStifExecutor::Update return case=%d"),aCase);
+ iLog->Log(_L("CStifExecutor::Update return status=%d"),flags);
+
+ if(aCase == NULL)
+ {
+ return;
+ }
+
+ if (flags & CUIStoreIf::EPrintUpdate)
+ {
+ //Cases output information update.
+ const RPointerArray<CTestProgress> printArray = aCase->PrintArray();
+ TInt rows = aCase->PrintArray().Count();
+ TPtr buffer(iBuffer->Des());
+ buffer.Zero();
+ for (int i = 0; i < rows; i++)
+ {
+ buffer.Append(_L("\r\n"));
+ buffer.Append(printArray[i]->iDescription);
+ buffer.Append(_L(" "));
+ buffer.Append(printArray[i]->iText);
+ buffer.Append(_L("\r\n"));
+ }
+ QString msg = TDesC2QString(buffer);
+ iLog->Log(_L("Get output msg:"));
+ iLog->Log(buffer);
+ if (listenerList)
+ {
+ for (int i = 0; i < listenerList->size(); i++)
+ {
+ listenerList->at(i)->OnGetCaseOutput(aCase, msg);
+ }
+ }
+
+ }
+ else
+ {
+ //case status changed update.
+ CSTFCase testcase;
+ testcase.SetName(TDesC2QString(aCase->TestInfo().TestCaseTitle()));
+ testcase.SetIndex(aCase->TestInfo().TestCaseNum());
+ testcase.SetModuleName(TDesC2QString(aCase->TestInfo().ModuleName()));
+ if (listenerList)
+ {
+ for (int i = 0; i < listenerList->size(); i++)
+ {
+ listenerList->at(i)->OnGetCaseUpdated(aCase, testcase, flags);
+ }
+ }
+
+ }
+
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/uisetting.cpp Wed Oct 13 14:32:52 2010 +0300
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: QT C++ based Class.
+ *
+ */
+
+#include <QFile>
+#include <QTextStream>
+#include <QDateTime>
+#include "uisetting.h"
+const QString SETTINGFILE = "c:\\TestFramework\\StfQtUISetting.ini";
+
+UiSetting::UiSetting()
+ {
+ if(!load())
+ {
+ loadDefault();
+ }
+ }
+
+UiSetting::~UiSetting()
+ {
+ }
+
+QString UiSetting::ReadSetting(const QString& item)
+ {
+ QString value = "";
+ if(settingList.contains(item))
+ {
+ value = settingList.value(item);
+ }
+ else
+ {
+ value = getDefaultValue(item);
+ settingList.insert(item, value);
+ }
+ return value;
+ }
+
+
+void UiSetting::SetSetting(const QString& item, const QString& value)
+ {
+ if(settingList.contains(item))
+ {
+ settingList.remove(item);
+ }
+ settingList.insert(item, value);
+ save();
+ }
+
+
+void UiSetting::loadDefault()
+ {
+ settingList.clear();
+ settingList.insert(KShowOutput, getDefaultValue(KShowOutput));
+ settingList.insert(KStyleSheet, getDefaultValue(KStyleSheet));
+ settingList.insert(KFilter, getDefaultValue(KFilter));
+ settingList.insert(KFilterCaseSens, getDefaultValue(KFilterCaseSens));
+ //add mor default setting here.
+ }
+
+QString UiSetting::getDefaultValue(const QString& item)
+ {
+ QString result = "";
+ if(item == KShowOutput)
+ {
+ result = "true";
+ }
+ else if(item == KStyleSheet)
+ {
+ result = ":/qss/coffee.qss";
+ }
+ else if(item == KFilter)
+ {
+ result = "";
+ }
+ else if(item == KFilterCaseSens)
+ {
+ result = "false";
+ }
+ return result;
+ }
+
+bool UiSetting::load()
+ {
+ QFile file(SETTINGFILE);
+ if(!file.open(QIODevice::ReadOnly))
+ {
+ return false;
+ }
+ QTextStream in(&file);
+ QString line, item, value;
+ int index;
+ while(!in.atEnd())
+ {
+ line = in.readLine().trimmed();
+ if(!line.startsWith("//"))
+ {
+ index = line.indexOf("=");
+ if(index > 0 && index < line.length() - 1)
+ {
+ item = line.left(index).trimmed();
+ value = line.right(line.length() - index -1);
+ if(item == KFilter) //For filter do not care about stored value
+ value = "";
+ settingList.insert(item, value);
+ }
+ }
+ //end while.
+ }
+ return true;
+ }
+
+bool UiSetting::save()
+ {
+ QFile file(SETTINGFILE);
+ if(!file.open(QIODevice::WriteOnly))
+ {
+ return false;
+ }
+ QTextStream in(&file);
+ in << "//STFQtUI Setting.\r\n";
+ in << "//Created at: " + QDateTime::currentDateTime().toString("yyyy.mm.dd hh:mm::ss");
+ in << "\r\n";
+ for(int i=0;i< settingList.size();i++)
+ {
+ in << settingList.keys()[i];
+ in << "=";
+ in << settingList.value(settingList.keys()[i]);
+ in << "\r\n";
+ }
+ return true;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/stifqtui.pro Wed Oct 13 14:32:52 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: QT project file.
+TARGET = STFUI
+HEADERS += inc/dlgrepeatrun.h \
+ inc/dlgsetselector.h \
+ inc\version.h \
+ inc\frmmain.h \
+ inc\istfqtuicontroller.h \
+ inc\stfqtuicontroller.h \
+ inc\cstfcase.h \
+ inc\cstfmodule.h \
+ inc\istfqtuimodel.h \
+ inc\stfqtuimodel.h \
+ inc\dlgoutput.h \
+ inc\uisetting.h \
+ inc\dlgsetting.h \
+ inc\uiversion.h
+SOURCES += src/dlgrepeatrun.cpp \
+ src\dlgsetselector.cpp \
+ src\frmmain.cpp \
+ src\main.cpp \
+ src\stfqtuimodel.cpp \
+ src\stfqtuicontroller.cpp \
+ src\dlgoutput.cpp \
+ src\uisetting.cpp \
+ src\dlgsetting.cpp
+RESOURCES += resource\StfQtUI.qrc
+symbian {
+ TARGET.UID3 = 0x2002BCA0
+ TARGET.EPOCALLOWDLLDATA = 1
+ //HEADERS += ../../../inc/.
+ INCLUDEPATH += /epoc32/include/mw
+ INCLUDEPATH += /epoc32/include/platform
+ INCLUDEPATH += /epoc32/include/platform/stifinternal
+ INCLUDEPATH += /epoc32/include/domain/osextensions
+ INCLUDEPATH += /epoc32/include/domain/osextensions/stif
+ HEADERS += inc\stifexecutor.h
+ SOURCES += src\stifexecutor.cpp
+ LIBS += -lstiftfwif \
+ -lstiftestinterface
+ TARGET.CAPABILITY = AllFiles \
+ CommDD
+
+ # Export headers to SDK Epoc32/include directory
+ deploy.path = $$EPOCROOT
+}