--- a/emailcontacts/contactactionservice/inc/cfscactionutils.h Wed Sep 01 12:28:57 2010 +0100
+++ b/emailcontacts/contactactionservice/inc/cfscactionutils.h Tue Sep 14 20:48:24 2010 +0300
@@ -20,9 +20,7 @@
#define C_FSCACTIONUTILS_H
#include <e32base.h>
-//<cmail>
#include "mfscactionutils.h"
-//</cmail>
#include <RPbkViewResourceFile.h>
// FORWARD DECLARATIONS
@@ -238,7 +236,6 @@
*/
TPtrC GetFileDirL( const TDesC& aFilePath );
- // Fix for EMZG-7M23KX
/**
* Find and add resource file to the list maintained by CCoeEnv.
* Resource file must be deleted (remove from the list) after usage.
@@ -246,6 +243,26 @@
*/
TInt FindAndAddResourceFileL();
+ /**
+ * Helper method that appends a specific field to a buffer of contact
+ * data.
+ * The method assumes that fsactionutils.rsc resource file has been
+ * already added to CCoeEnv before being called.
+ *
+ * @param aContact Buffer to which the field data is appended.
+ * @param aFieldResourceId Id of the field data (which is being added to
+ * contact buffer.
+ * @param aStoreContact Reference to the contact in Phonebook store
+ * from which the field data that is added to
+ * contact buffer is fetched.
+ * @param aAddSpace Whether to add a whitespace before appending
+ * the field data to contact buffer.
+ */
+ void AppendFieldToContactL( TDes& aContact,
+ TInt aFieldResourceId,
+ MVPbkStoreContact& aStoreContact,
+ TBool aAddSpace = EFalse );
+
private:
// Private members
--- a/emailcontacts/contactactionservice/src/cfscactionutils.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailcontacts/contactactionservice/src/cfscactionutils.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -31,9 +31,7 @@
#include <centralrepository.h>
#include <CoreApplicationUIsSDKCRKeys.h>
#include <settingsinternalcrkeys.h>
-//<cmail> Header neither in Cmail nor in the platform
#include <crcseprofileregistry.h>
-//</cmail>
#include <NetworkHandlingDomainPSKeys.h>
#include <MVPbkStoreContact.h>
#include <MVPbkStoreContactFieldCollection.h>
@@ -42,10 +40,8 @@
#include <TVPbkFieldVersitProperty.h>
#include <MVPbkContactFieldData.h>
#include <MVPbkContactFieldTextData.h>
-//<cmail>
#include "fscactionplugincrkeys.h"
#include "fsccontactactionservicedefines.h"
-//</cmail>
#include <FscActionUtils.rsg>
#include <barsread.h>
#include <Pbk2ContactNameFormatterFactory.h>
@@ -56,11 +52,8 @@
#include <CVPbkFieldTypeSelector.h>
#include <CVPbkFieldFilter.h>
#include <commonphoneparser.h>
-#include <bautils.h> // Fix for EMZG-7M23KX
-//<cmail> hardcoded paths removal
+#include <bautils.h>
#include <data_caging_path_literals.hrh>
-//</cmail>
-
#include "cfscactionutils.h"
#include "cfsccontactaction.h"
#include "mfscreasoncallback.h"
@@ -87,15 +80,11 @@
const TUint32 KPoCDefaultSettings = 0x199;
const TInt KMaxLengthOfNumber = 100;
-
-//Fix for: ECWG-7QYAVS
-const TInt KMaxLengthOfName = 100;
-//end for fix
+const TInt KMaxLengthOfAddrData = 255;
+const TInt KMaxLengthOfName = 256; // same as max addr len + extra whitespace
_LIT( KSpace, " " );
-//<cmail> hard coded path removed
_LIT( KFscRscFileName, "fscactionutils.rsc" );
-//</cmail>
// ======== MEMBER FUNCTIONS ========
@@ -135,9 +124,7 @@
delete iRep;
if ( iRCSEProfileRegistry != NULL )
{
- //<cmail>
delete iRCSEProfileRegistry;
- //</cmail>
}
}
@@ -160,7 +147,6 @@
FUNC_LOG;
HBufC* noteText = NULL;
- // Fix for EMZG-7M23KX
TInt offset = FindAndAddResourceFileL();
if ( aContactName )
@@ -189,7 +175,6 @@
FUNC_LOG;
HBufC* noteText = NULL;
- // Fix for EMZG-7M23KX
TInt offset = FindAndAddResourceFileL();
noteText = StringLoader::LoadL( aNote, aCounter );
@@ -210,7 +195,6 @@
{
FUNC_LOG;
- // Fix for EMZG-7M23KX
TInt offset = FindAndAddResourceFileL();
HBufC* noteText = NULL;
@@ -269,102 +253,38 @@
HBufC* CFscActionUtils::GetContactNameL( MVPbkStoreContact& aStoreContact )
{
FUNC_LOG;
- HBufC* contactName = HBufC::NewLC( KMaxLengthOfName + 1 ); // one ' ' char
+
+ TBuf<KMaxLengthOfName> contactName;
- // Search for the contact name
- // Fix for EMZG-7M23KX
TInt offset = FindAndAddResourceFileL();
- TResourceReader selectorReader;
- CCoeEnv::Static()->CreateResourceReaderLC( selectorReader,
- R_FSC_FIRST_NAME_SELECTOR );
-
- CVPbkFieldTypeSelector* fieldTypeSelector = CVPbkFieldTypeSelector::NewL(
- selectorReader, iContactManager.FieldTypes() );
- CleanupStack::PopAndDestroy(); // selectorReader
-
- CVPbkFieldFilter::TConfig config(
- const_cast<MVPbkStoreContactFieldCollection&> (
- aStoreContact.Fields() ), fieldTypeSelector, NULL );
-
- CVPbkFieldFilter* fieldFilter = CVPbkFieldFilter::NewL( config );
- TInt fieldCount = fieldFilter->FieldCount();
- const MVPbkStoreContactField* field = NULL;
- if ( fieldCount == 1 )
+ TInt err( KErrNone );
+ TRAP( err, AppendFieldToContactL(
+ contactName, R_FSC_FIRST_NAME_SELECTOR, aStoreContact ) );
+ if ( err == KErrNone )
{
- field = fieldFilter->FieldAtLC(0);
- contactName->Des().Append(
- MVPbkContactFieldTextData::Cast(
- field->FieldData() ).Text() );
- CleanupStack::PopAndDestroy();//field
+ TRAP( err, AppendFieldToContactL(
+ contactName, R_FSC_LAST_NAME_SELECTOR, aStoreContact,
+ ETrue ) );
+ }
+ if ( err == KErrNone && contactName.Length() <= 0 )
+ {
+ // If no first or last name was found, try to append company name
+ TRAP_IGNORE( AppendFieldToContactL(
+ contactName, R_FSC_COMPANY_NAME_SELECTOR, aStoreContact ) );
}
- delete fieldFilter;
- delete fieldTypeSelector;
-
- // Search for the contact second name
- CCoeEnv::Static()->CreateResourceReaderLC( selectorReader,
- R_FSC_LAST_NAME_SELECTOR );
- fieldTypeSelector = CVPbkFieldTypeSelector::NewL( selectorReader,
- iContactManager.FieldTypes() );
- CleanupStack::PopAndDestroy();//selectorReader
- config.iFieldSelector = fieldTypeSelector;
-
- fieldFilter = CVPbkFieldFilter::NewL( config );
- fieldCount = fieldFilter->FieldCount();
- if ( fieldCount == 1 )
+ // If there was an error or the contact name is zero length, use
+ // pre-defined unnamed string instead..
+ if ( err != KErrNone || contactName.Length() <= 0 )
{
- field = fieldFilter->FieldAtLC(0);
- if ( contactName->Des().Length() > 0 )
- {
- contactName->Des().Append( KSpace );
- }
- contactName->Des().Append(
- MVPbkContactFieldTextData::Cast(
- field->FieldData() ).Text() );
- CleanupStack::PopAndDestroy();//field
- }
-
- // If first or second name hasn't been found -> find company name
- if ( contactName->Des().Length() <= 0 )
- {
- delete fieldFilter;
- delete fieldTypeSelector;
-
- CCoeEnv::Static()->CreateResourceReaderLC( selectorReader,
- R_FSC_COMPANY_NAME_SELECTOR );
- fieldTypeSelector = CVPbkFieldTypeSelector::NewL( selectorReader,
- iContactManager.FieldTypes() );
- CleanupStack::PopAndDestroy();//selectorReader
- config.iFieldSelector = fieldTypeSelector;
-
- fieldFilter = CVPbkFieldFilter::NewL( config );
- fieldCount = fieldFilter->FieldCount();
- if ( fieldCount == 1 )
- {
- field = fieldFilter->FieldAtLC(0);
- contactName->Des().Append(
- MVPbkContactFieldTextData::Cast(
- field->FieldData() ).Text() );
- CleanupStack::PopAndDestroy();//field
- }
- }
- // no first or second name, nor company name -> return "unnamed" string
- if ( contactName->Des().Length() <= 0 )
- {
- //append (Unnamed)
HBufC* unnamed = StringLoader::LoadL( R_QTN_FS_UNNAMED );
- contactName->Des().Append( *unnamed );
+ contactName.Zero();
+ contactName.Append( *unnamed );
delete unnamed;
}
-
- delete fieldFilter;
- delete fieldTypeSelector;
- CleanupStack::Pop( contactName );
-
CCoeEnv::Static()->DeleteResourceFile( offset );
-
- return contactName;
+ return contactName.AllocL();
}
// ---------------------------------------------------------------------------
@@ -388,7 +308,6 @@
CFscFieldPropertyArray* fieldProperties =
CFscFieldPropertyArray::NewL( iContactManager.FieldTypes() );
- // Fix for EMZG-7M23KX
TInt offset = FindAndAddResourceFileL();
// Create resource reader for new resource
@@ -440,7 +359,6 @@
{
defaultPrioritiesArray.Append( EVPbkDefaultTypeSms );
defaultPrioritiesArray.Append( EVPbkDefaultTypeMms );
- // Fix for ELWG-7SPH5H
params.SetUseDefaultDirectly( ETrue );
break;
}
@@ -518,10 +436,8 @@
}
// Format phone number
- //Fix for: MHOA-7SQF6T
CommonPhoneParser::ParsePhoneNumber( aNumber,
CommonPhoneParser::EPlainPhoneNumber );
- //end for fix
}
// Destroy objects
@@ -569,10 +485,8 @@
}
// Format phone number
- //Fix for: MHOA-7SQF6T
CommonPhoneParser::ParsePhoneNumber( aNumber,
CommonPhoneParser::EPlainPhoneNumber );
- //end for fix
}
// Destroy objects
@@ -624,10 +538,8 @@
}
// Format phone number
- //Fix for: MHOA-7SQF6T
CommonPhoneParser::ParsePhoneNumber( aVoipAddress,
CommonPhoneParser::EPlainPhoneNumber );
- //end for fix
// Destroy objects
delete selectedField;
@@ -655,7 +567,6 @@
TInt ret = KErrNone;
// Search for conference number
- // Fix for EMZG-7M23KX
TInt offset = FindAndAddResourceFileL();
TResourceReader selectorReader;
CCoeEnv::Static()->CreateResourceReaderLC( selectorReader,
@@ -825,7 +736,7 @@
}
// ---------------------------------------------------------------------------
-// CFscActionUtils::GetEmailAddressL
+// CFscActionUtils::GetMessageAddressL
// ---------------------------------------------------------------------------
//
TInt CFscActionUtils::GetMessageAddressL( MVPbkStoreContact& aStoreContact,
@@ -858,7 +769,8 @@
TPtrC msgAddress = MVPbkContactFieldTextData::Cast(
selectedField->FieldData() ).Text();
- if ( msgAddress.Length() )
+ if ( msgAddress.Length() &&
+ msgAddress.Length() <= KMaxLengthOfAddrData )
{
aMsgAddress.Copy( msgAddress );
}
@@ -907,7 +819,8 @@
TPtrC emailAddress = MVPbkContactFieldTextData::Cast(
selectedField->FieldData() ).Text();
- if ( emailAddress.Length() )
+ if ( emailAddress.Length() &&
+ emailAddress.Length() <= KMaxLengthOfAddrData )
{
aEmailAddress.Copy( emailAddress );
}
@@ -953,13 +866,11 @@
TBool available( EFalse );
// Search for the contact name
- // Fix for EMZG-7M23KX
TInt offset = FindAndAddResourceFileL();
TResourceReader selectorReader;
CVPbkFieldTypeSelector* fieldTypeSelector = NULL;
CVPbkFieldFilter* fieldFilter = NULL;
- TInt fieldCount = 0;
TInt selector = 0;
switch ( aContactNumberType )
@@ -1025,15 +936,16 @@
fieldTypeSelector = CVPbkFieldTypeSelector::NewL( selectorReader,
iContactManager.FieldTypes() );
CleanupStack::PopAndDestroy(); // selectorReader
-
+ CleanupStack::PushL( fieldTypeSelector );
+
CVPbkFieldFilter::TConfig config(
const_cast<MVPbkStoreContactFieldCollection&> (
aStoreContact.Fields() ), fieldTypeSelector, NULL);
fieldFilter = CVPbkFieldFilter::NewL( config );
- fieldCount = fieldFilter->FieldCount();
+ CleanupStack::PushL( fieldFilter );
- if ( fieldCount )
+ if ( fieldFilter->FieldCount() )
{
if ( selector == R_FSC_CONF_NUMBER_SELECTOR )
{
@@ -1042,7 +954,7 @@
field = fieldFilter->FieldAtLC(0);
confNum.Append( MVPbkContactFieldTextData::Cast(
field->FieldData() ).Text() );
- CleanupStack::PopAndDestroy();//field
+ CleanupStack::PopAndDestroy(); // field
if ( CommonPhoneParser::IsValidPhoneNumber( confNum,
CommonPhoneParser::EContactCardNumber ) )
@@ -1055,9 +967,7 @@
available = ETrue;
}
}
-
- delete fieldFilter;
- delete fieldTypeSelector;
+ CleanupStack::PopAndDestroy( 2 ); // fieldFilter, fieldTypeSelector
}
CCoeEnv::Static()->DeleteResourceFile( offset );
@@ -1133,7 +1043,7 @@
TInt err = cenRep->Get( KPoCDefaultSettings, settingsId );
if ( err == KErrNone )
{
- result = (settingsId != KErrNotFound );
+ result = ( settingsId != KErrNotFound );
}
delete cenRep;
}
@@ -1154,9 +1064,7 @@
{
RArray<TUint32> ids;
CleanupClosePushL( ids );
- //<cmail>
iRCSEProfileRegistry->GetAllIdsL( ids );
- //</cmail>
configured = ids.Count() > 0;
CleanupStack::PopAndDestroy( &ids );
}
@@ -1251,15 +1159,8 @@
if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
{
- //<cmail>
TRAP_IGNORE( iRCSEProfileRegistry = CRCSEProfileRegistry::NewL() );
- //</cmail>
}
-
- //<cmail>
- //iRCSEProfileRegistry = NULL;
- //</cmail>
-
}
// ---------------------------------------------------------------------------
@@ -1291,7 +1192,6 @@
return fileName;
}
-// Fix for EMZG-7M23KX
// ---------------------------------------------------------------------------
// CFscActionUtils::FindAndAddResourceFileL
// ---------------------------------------------------------------------------
@@ -1299,14 +1199,10 @@
TInt CFscActionUtils::FindAndAddResourceFileL()
{
FUNC_LOG;
- //<cmail> hardcoded removed
TFileName resourceFileName( KDC_RESOURCE_FILES_DIR );
- resourceFileName.Append(KFscRscFileName);
- //</cmail>
+ resourceFileName.Append( KFscRscFileName );
BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), resourceFileName );
- TInt offset = CCoeEnv::Static()->AddResourceFileL( resourceFileName );
-
- return offset;
+ return CCoeEnv::Static()->AddResourceFileL( resourceFileName );
}
// ---------------------------------------------------------------------------
// CFscActionUtils::CloseSelectDialogL
@@ -1321,6 +1217,52 @@
}
}
+// ---------------------------------------------------------------------------
+// CFscActionUtils::AppendFieldToContactL
+// ---------------------------------------------------------------------------
+//
+void CFscActionUtils::AppendFieldToContactL( TDes& aContact,
+ TInt aFieldResourceId,
+ MVPbkStoreContact& aStoreContact,
+ TBool aAddSpace )
+ {
+ FUNC_LOG;
-// ======== GLOBAL FUNCTIONS ========
+ TResourceReader selectorReader;
+ CCoeEnv::Static()->CreateResourceReaderLC( selectorReader,
+ aFieldResourceId );
+
+ CVPbkFieldTypeSelector* fieldTypeSelector = CVPbkFieldTypeSelector::NewL(
+ selectorReader, iContactManager.FieldTypes() );
+ CleanupStack::PopAndDestroy(); // selectorReader
+ CleanupStack::PushL( fieldTypeSelector );
+
+ CVPbkFieldFilter::TConfig config(
+ const_cast<MVPbkStoreContactFieldCollection&> (
+ aStoreContact.Fields() ), fieldTypeSelector, NULL );
+
+ CVPbkFieldFilter* fieldFilter = CVPbkFieldFilter::NewL( config );
+ CleanupStack::PushL( fieldFilter );
+ if ( fieldFilter->FieldCount() == 1 )
+ {
+ MVPbkStoreContactField* field = fieldFilter->FieldAtLC( 0 );
+ if ( aAddSpace && aContact.Length() > 0 )
+ {
+ aContact.Append( KSpace );
+ }
+ TPtrC castFieldText = MVPbkContactFieldTextData::Cast(
+ field->FieldData() ).Text();
+
+ if ( ( aContact.Length() + castFieldText.Length() ) > KMaxLengthOfName )
+ {
+ User::Leave( KErrOverflow );
+ }
+
+ aContact.Append( MVPbkContactFieldTextData::Cast(
+ field->FieldData() ).Text() );
+ CleanupStack::PopAndDestroy(); // field
+ }
+ CleanupStack::PopAndDestroy( 2 ); // fieldFilter, fieldTypeSelector
+ }
+
--- a/emailservices/emailframework/bwins/FSMailFrameworkU.DEF Wed Sep 01 12:28:57 2010 +0100
+++ b/emailservices/emailframework/bwins/FSMailFrameworkU.DEF Tue Sep 14 20:48:24 2010 +0300
@@ -29,4 +29,5 @@
?AddObserverL@CFSMailClient@@QAEXAAVMFSMailEventObserver@@@Z @ 28 NONAME ; void CFSMailClient::AddObserverL(class MFSMailEventObserver &)
?GetMailBoxByUidLC@CFSMailClient@@QAEPAVCFSMailBox@@VTFSMailMsgId@@@Z @ 29 NONAME ; class CFSMailBox * CFSMailClient::GetMailBoxByUidLC(class TFSMailMsgId)
?PrepareMrDescriptionL@CFSMailClient@@UAEXABVTFSMailMsgId@@0@Z @ 30 NONAME ; void CFSMailClient::PrepareMrDescriptionL(class TFSMailMsgId const &, class TFSMailMsgId const &)
+ ?AreAllPluginsLoaded@CFSMailClient@@QAEHXZ @ 31 NONAME ; int CFSMailClient::AreAllPluginsLoaded(void)
--- a/emailservices/emailframework/eabi/FSMailFrameworkU.DEF Wed Sep 01 12:28:57 2010 +0100
+++ b/emailservices/emailframework/eabi/FSMailFrameworkU.DEF Tue Sep 14 20:48:24 2010 +0300
@@ -43,4 +43,5 @@
_ZTV26CFSClientAPIRequestHandler @ 42 NONAME
_ZN13CFSMailClient17GetMailBoxByUidLCE12TFSMailMsgId @ 43 NONAME
_ZN13CFSMailClient21PrepareMrDescriptionLERK12TFSMailMsgIdS2_ @ 44 NONAME
+ _ZN13CFSMailClient19AreAllPluginsLoadedEv @ 45 NONAME
--- a/emailservices/emailframework/inc/CFSMailClient.h Wed Sep 01 12:28:57 2010 +0100
+++ b/emailservices/emailframework/inc/CFSMailClient.h Tue Sep 14 20:48:24 2010 +0300
@@ -398,6 +398,14 @@
*/
IMPORT_C virtual void PrepareMrDescriptionL( const TFSMailMsgId& aMailBoxId,
const TFSMailMsgId& aMessageId );
+
+ /**
+ * Checks if plugins are loaded. If they aren't tries to load them
+ *
+ * Returns ETrue if all plugins are loaded.
+ */
+ IMPORT_C TBool AreAllPluginsLoaded( );
+
public: // from CExtendableEmail
/**
--- a/emailservices/emailframework/inc/CFSMailPluginManager.h Wed Sep 01 12:28:57 2010 +0100
+++ b/emailservices/emailframework/inc/CFSMailPluginManager.h Tue Sep 14 20:48:24 2010 +0300
@@ -110,10 +110,11 @@
RPointerArray<CImplementationInformation>& aInfo );
/**
- * recheck existing plugins
+ * Recheck existing plugins
*
+ * Returns ETrue if all plugins loaded.
*/
- void CFSMailPluginManager::RecheckPlugins( );
+ TBool RecheckPluginsL( );
protected:
--- a/emailservices/emailframework/src/CFSMailBrandManagerImpl.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailservices/emailframework/src/CFSMailBrandManagerImpl.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -409,7 +409,7 @@
CFSMailBrand* CFSMailBrandManagerImpl::FindMatchingBrandL( const TDesC& aBrandId )
{
FUNC_LOG;
- if( aBrandId.Length() )
+ if( ( NULL != &aBrandId ) && aBrandId.Length() )
{
TInt brandCount( iBrands->Count() );
for ( TInt i( 0 ); i < brandCount; i++ )
--- a/emailservices/emailframework/src/CFSMailClient.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailservices/emailframework/src/CFSMailClient.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -130,7 +130,7 @@
}
else
{
- iFWImplementation->GetPluginManager().RecheckPlugins();
+ iFWImplementation->GetPluginManager().RecheckPluginsL();
plugin = iFWImplementation->GetPluginManager().GetPluginByUid(aMailBoxId);
if(plugin)
{
@@ -251,7 +251,10 @@
CFSMailBox *mailBox = NULL;
// </cmail>
- iFWImplementation->GetPluginManager().RecheckPlugins();
+ // it is ok to ignore leave of this, because calling this we just ensure
+ // that all plugins are loaded and if not then it tries to load missing ones.
+ // Anyway we have to continue even not all plugins are loaded.
+ TRAP_IGNORE( iFWImplementation->GetPluginManager().RecheckPluginsL() );
if(aPlugin.IsNullId())
{
@@ -583,6 +586,16 @@
}
// -----------------------------------------------------------------------------
+// CFSMailClient::AreAllPluginsLoaded
+// -----------------------------------------------------------------------------
+EXPORT_C TBool CFSMailClient::AreAllPluginsLoaded( )
+ {
+ TBool result = EFalse;
+ TRAP_IGNORE( result = iFWImplementation->GetPluginManager().RecheckPluginsL( ) );
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
// CFSMailClient::Close
// -----------------------------------------------------------------------------
EXPORT_C void CFSMailClient::Close()
--- a/emailservices/emailframework/src/CFSMailPluginManager.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailservices/emailframework/src/CFSMailPluginManager.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -140,10 +140,10 @@
}
// -----------------------------------------------------------------------------
-// CFSMailPluginManager::RecheckPlugins
+// CFSMailPluginManager::RecheckPluginsL
// -----------------------------------------------------------------------------
-void CFSMailPluginManager::RecheckPlugins( )
+TBool CFSMailPluginManager::RecheckPluginsL( )
{
FUNC_LOG;
@@ -177,4 +177,6 @@
}
}
}
+ // return ETrue if all plugins loaded
+ return ( iPluginInfo.Count() == iPluginList.Count() );
}
Binary file emailuis/emailui/conf/freestyleemailui.confml has changed
Binary file emailuis/emailui/conf/freestyleemailui_2001E277.crml has changed
--- a/emailuis/emailui/data/FreestyleEmailUi.rss Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/data/FreestyleEmailUi.rss Tue Sep 14 20:48:24 2010 +0300
@@ -979,7 +979,7 @@
RESOURCE AVKON_VIEW r_fsemailui_mail_search_view
{
menubar = r_fsemailui_searchlist_menubar;
- cba = r_freestyle_emauil_ui_sk_options_back__open;
+ cba = r_freestyle_emauil_ui_sk_options_back;
}
RESOURCE AVKON_VIEW r_fsemailui_html_view
--- a/emailuis/emailui/inc/FreestyleEmailCenRepKeys.h Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/inc/FreestyleEmailCenRepKeys.h Tue Sep 14 20:48:24 2010 +0300
@@ -93,6 +93,8 @@
// PS2 variation
// one centrep key for every feature, 0 means disabled
const TUint32 KEmailFeatureSplitScreen = {0x00001001};
+const TUint32 KMfEFeatureCertificateBasedAuthentication = {0x00001003};
+const TUint32 KMfEFeatureAdvancedSecurity = {0x00001004};
//
// TP Wizard repository in the central repository
--- a/emailuis/emailui/inc/FreestyleEmailUiAppui.h Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/inc/FreestyleEmailUiAppui.h Tue Sep 14 20:48:24 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007 - 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"
@@ -502,6 +502,9 @@
// wouldn't have any visible effect.
void RunFakeSyncAnimL();
+ // Sets text to navi pane
+ void SetNaviPaneTextL( const TDesC& aText );
+
public: //from MFSMailEventObserver
/**
* Framework event message.
@@ -538,14 +541,6 @@
*/
void StopEndKeyCapture();
- /**
- * Accessor for navipane decorator object.
- * @param aViewId: Caller identify itself by giving the view Id (see FreestyleEmailUiConstants.h)
- * This is used for choosing correct decorator.
- * @return instance of correct navidecorator. NULL if aView doesn't match.
- */
- CAknNavigationDecorator* NaviDecoratorL( const TUid aViewId );
-
public:
/**
@@ -614,12 +609,6 @@
// Send self to background.
void SendToBackground();
- /*
- * Called from ConstructL during start of application.
- * Constructs navipane(s) that are used by different views.
- */
- void ConstructNaviPaneL();
-
// Create custom status pane indicators. (priority and followup)
void CreateStatusPaneIndicatorsL();
// Delete custom status pane indicators
@@ -796,8 +785,7 @@
CEUiExitGuardian* iExitGuardian;
// navipane decorator
- // (used at least in mail viewer)
- CAknNavigationDecorator* iNaviDecorator2MailViewer;
+ CAknNavigationDecorator* iNaviDecorator;
// Resource file offset for message editor external resources
TInt iMsgEditorResourceOffset;
--- a/emailuis/emailui/inc/FreestyleEmailUiCLSListsHandler.h Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/inc/FreestyleEmailUiCLSListsHandler.h Tue Sep 14 20:48:24 2010 +0300
@@ -125,6 +125,8 @@
void OperationErrorL( TInt aErrorCode );
+ TBool UseLastNameFirstOrder();
+
protected:
/**
@@ -240,6 +242,7 @@
TBool iRemoteLookupSupported;
+ TBool iUseLastNameFirstOrder;
};
#endif // FREESTYLEEMAILUICLSLISTSHANDLER_H
--- a/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h Tue Sep 14 20:48:24 2010 +0300
@@ -353,6 +353,8 @@
void WriteToFileL( const TDesC& aFileName, RBuf& aHtmlText );
+ HBufC* CreateModifiedUrlIfNeededL( const TDesC& aUrl );
+
private: // data
// Reference to AppUi.
--- a/emailuis/emailui/inc/FreestyleEmailUiMailListVisualiser.h Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/inc/FreestyleEmailUiMailListVisualiser.h Tue Sep 14 20:48:24 2010 +0300
@@ -573,7 +573,7 @@
// Control bar functions
void CreateControlBarLayoutL();
void ScaleControlBarL();
- void SetSortButtonTextAndIconL();
+ void SetSortButtonIconL();
HBufC* GetSortButtonTextLC();
void HandleControlBarEvent( TFsControlBarEvent aEvent, TInt aData );
@@ -647,12 +647,12 @@
/**
* Display marking mode title text
*/
- void DisplayMarkingModeTitleTextL();
+ void DisplayMarkingModeTextOnButtonsL();
/**
* Remove marking mode title text
*/
- void RemoveMarkingModeTitleTextL();
+ void RemoveMarkingModeTextOnButtonsL();
/**
* Displays or remove marking mode background
@@ -805,11 +805,6 @@
void FocusVisibilityChange( TBool aVisible );
/**
- * Update texts in command area buttons
- */
- void UpdateButtonTextsL();
-
- /**
* Tests whether a point is inside the control.
*
* @param aControl Control that is tested.
@@ -842,7 +837,9 @@
*/
TBool HandleArrowEventInLandscapeL( const TInt aScancode,
const TAlfEvent& aEvent, const TBool aShiftState );
-
+
+ void UpdateFolderAndMarkingModeTextsL();
+
private: // data types
--- a/emailuis/emailui/inc/FreestyleEmailUiSearchListVisualiser.h Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/inc/FreestyleEmailUiSearchListVisualiser.h Tue Sep 14 20:48:24 2010 +0300
@@ -252,8 +252,6 @@
void UpdatePreviewPaneTextForItemL( CFsTreePlainTwoLineItemData* aItemData, CFSMailMessage* aMsgPtr );
void FilterPreviewPaneTextL( TDes& aText ) const;
- void SetMskL();
-
void DoFirstStartL();
void SetHeaderAttributesL();
--- a/emailuis/emailui/inc/FreestyleEmailUiUtilities.h Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/inc/FreestyleEmailUiUtilities.h Tue Sep 14 20:48:24 2010 +0300
@@ -277,10 +277,10 @@
static void StripDisplayName( HBufC& aDisplayName );
// Creates a displayname of firstname and lastname components
- static HBufC* CreateDisplayNameLC( const TDesC& aFirstname, const TDesC& aLastname );
+ static HBufC* CreateDisplayNameLC( const TDesC& aFirstname, const TDesC& aLastname, TBool aSwitchOrder = EFalse );
// Creates a displayname of firstname, lastname, emailfield components
- static HBufC* CreateDisplayNameLC( const TDesC& aFirstname, const TDesC& aLastname, const TDesC& aEmailField );
+ static HBufC* CreateDisplayNameLC( const TDesC& aFirstname, const TDesC& aLastname, const TDesC& aEmailField, TBool aSwitchOrder = EFalse );
/**
* Determines if the descriptor is a Chinese word
--- a/emailuis/emailui/inc/ncscomposeview.h Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/inc/ncscomposeview.h Tue Sep 14 20:48:24 2010 +0300
@@ -80,6 +80,16 @@
// This is final commit, no more incoming changes
EFinal
};
+
+ // can't close view if ChildDoActivateL()
+ enum TChildActivationState
+ {
+ EChildActivationDeactivated,
+ EChildActivationStarted,
+ EChildActivationError, // error during activation
+ EChildActivationExitRequired, // activation ended, exit the view
+ EChildActivationProcessed
+ };
public: // constructors and destructor
@@ -724,6 +734,8 @@
* Flag indicating that adding attachment dialog is opened.
*/
TBool iAddingAttachmentDialogOpened;
+
+ TChildActivationState iChildActivationState;
};
/**
--- a/emailuis/emailui/src/FreestyleEmailUiAppui.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/FreestyleEmailUiAppui.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007 - 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"
@@ -89,7 +89,7 @@
#include "cfsccontactactionmenu.h"
//</cmail>
#include <layoutmetadata.cdl.h> // for Layout_Meta_Data
-
+#include <aknnavilabel.h>
#include <AknPriv.hrh>
#include "freestyleemailcenrepkeys.h"
#include <centralrepository.h>
@@ -158,6 +158,7 @@
const TUint KConnectionStatusIconRotationInterval = 100;
const TUint KFakeSyncAnimStopTimerInterval = 3000; // 3 secs
const TInt KConnectionStatusIconRotationAmount = 18;
+const TInt KFullCircleInDegrees = 360;
// Length of the drive letter descriptor (e.g. "c:")
const TInt KDriveDescLength = 2;
@@ -748,7 +749,7 @@
// Destruction must be done here as other Tls data depends on it.
CFSEmailDownloadInfoMediator::Destroy();
- delete iNaviDecorator2MailViewer;
+ delete iNaviDecorator;
delete iConnectionStatusIconAnimTimer;
delete iFakeSyncAnimStopTimer;
@@ -891,6 +892,12 @@
return;
}
+ if( aViewId == MailListId )
+ {
+ // notify Eik that SplitInput was disabled when entering the list form homescreen
+ CEikAppUi::HandleResourceChangeL( KAknSplitInputDisabled );
+ }
+
// Do nothing if the externally activated view was already active
if ( iCurrentActiveView->Id() != aViewId )
{
@@ -1601,8 +1608,7 @@
{
iPendingLayoutSwitch = ETrue;
}
-
- if ( iCurrentActiveView && !iSettingsViewActive )
+ if ( iCurrentActiveView && !iSettingsViewActive && !iMRViewer )
{
iCurrentActiveView->HandleDynamicVariantSwitchL( type );
}
@@ -2586,7 +2592,7 @@
if ( iConnectionIconBitmap )
{
TSize iconSize = LayoutHandler()->statusPaneIconSize();
- AknIconUtils::SetSize( iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved );
+ AknIconUtils::SetSizeAndRotation(iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved, iConnectionStatusIconAngle);
}
titlePane->SetSmallPicture( iConnectionIconBitmap, iConnectionIconMask, iConnectionIconBitmap && iConnectionIconMask);
}
@@ -2696,7 +2702,7 @@
if ( iConnectionIconBitmap )
{
TSize iconSize( LayoutHandler()->statusPaneIconSize() );
- AknIconUtils::SetSize( iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved );
+ AknIconUtils::SetSizeAndRotation(iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved, iConnectionStatusIconAngle);
}
titlePane->SetSmallPicture( iConnectionIconBitmap, iConnectionIconMask, iConnectionIconMask && iConnectionIconBitmap );
if (startTimer)
@@ -3057,13 +3063,15 @@
iConnectionIconMask );
if ( iConnectionIconBitmap && iConnectionIconMask )
{
- AknIconUtils::SetSize(
- iConnectionIconBitmap,
- LayoutHandler()->statusPaneIconSize(),
- EAspectRatioNotPreserved );
- titlePane->SetSmallPicture(
- iConnectionIconBitmap,
- iConnectionIconMask,
+ AknIconUtils::SetSizeAndRotation(
+ iConnectionIconBitmap,
+ LayoutHandler()->statusPaneIconSize(),
+ EAspectRatioNotPreserved,
+ iConnectionStatusIconAngle );
+
+ titlePane->SetSmallPicture(
+ iConnectionIconBitmap,
+ iConnectionIconMask,
ETrue );
iConnectionStatusIconAnimTimer->Start(
KConnectionStatusIconRotationInterval );
@@ -3077,60 +3085,6 @@
}
}
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-void CFreestyleEmailUiAppUi::ConstructNaviPaneL()
- {
- FUNC_LOG;
-
- CAknNavigationControlContainer* naviPaneContainer =
- static_cast<CAknNavigationControlContainer*>(
- StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
-
- // Following navipane is for mailviewer view
- if ( !iNaviDecorator2MailViewer )
- {
- // Constructing a decorator with own decorated control,
- // which is (currently an empty) container.
- CFreestyleEmailUiNaviPaneControlContainer2MailViewer* c =
- CFreestyleEmailUiNaviPaneControlContainer2MailViewer::NewL();
- c->SetContainerWindowL( *naviPaneContainer );
- iNaviDecorator2MailViewer = CAknNavigationDecorator::NewL(
- naviPaneContainer,
- c,
- CAknNavigationDecorator::ENotSpecified );
-
- // In order to get navi arrows visible, they must be set visible AND not dimmed...
- iNaviDecorator2MailViewer->SetContainerWindowL( *naviPaneContainer );
- iNaviDecorator2MailViewer->MakeScrollButtonVisible( ETrue );
- iNaviDecorator2MailViewer->SetScrollButtonDimmed( CAknNavigationDecorator::ELeftButton, EFalse );
- iNaviDecorator2MailViewer->SetScrollButtonDimmed( CAknNavigationDecorator::ERightButton, EFalse );
-
- iNaviDecorator2MailViewer->SetComponentsToInheritVisibility( ETrue );
- naviPaneContainer->PushL( *iNaviDecorator2MailViewer );
- }
- }
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-CAknNavigationDecorator* CFreestyleEmailUiAppUi::NaviDecoratorL( const TUid aViewId )
- {
- FUNC_LOG;
- CAknNavigationDecorator* decorator( NULL );
- // Depending on who's asking, return proper navipane instance
- if ( aViewId.iUid == MailViewerId.iUid )
- {
- if ( !iNaviDecorator2MailViewer )
- {
- ConstructNaviPaneL();
- }
- decorator = iNaviDecorator2MailViewer;
- }
- return decorator;
- }
-
void CFreestyleEmailUiAppUi::TimerEventL( CFSEmailUiGenericTimer* aTriggeredTimer )
{
if ( aTriggeredTimer == iConnectionStatusIconAnimTimer )
@@ -3149,6 +3103,7 @@
TSize iconSize = LayoutHandler()->statusPaneIconSize();
iConnectionStatusIconAngle += KConnectionStatusIconRotationAmount;
+ iConnectionStatusIconAngle %= KFullCircleInDegrees;
AknIconUtils::SetSizeAndRotation(iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved, iConnectionStatusIconAngle);
titlePane->DrawNow();
iConnectionStatusIconAnimTimer->Start(KConnectionStatusIconRotationInterval);
@@ -3220,7 +3175,35 @@
}
}
-
+void CFreestyleEmailUiAppUi::SetNaviPaneTextL( const TDesC& aText )
+ {
+ if (aText.Length())
+ {
+ CAknNavigationControlContainer* np =
+ static_cast<CAknNavigationControlContainer*>(
+ StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
+
+ if (!iNaviDecorator)
+ {
+ iNaviDecorator = np->CreateNavigationLabelL( KNullDesC() );
+ np->PushL( *iNaviDecorator );
+ }
+ CAknNaviLabel* naviLabel = static_cast<CAknNaviLabel*>( iNaviDecorator->DecoratedControl() );
+ if( naviLabel )
+ {
+ naviLabel->SetTextL( aText );
+ iNaviDecorator->DrawDeferred();
+ }
+ }
+ else
+ {
+ if (iNaviDecorator)
+ {
+ delete iNaviDecorator;
+ iNaviDecorator = NULL;
+ }
+ }
+ }
////////////////////////////////////////////////////////////////////////////////
//
--- a/emailuis/emailui/src/FreestyleEmailUiCLSListsHandler.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/FreestyleEmailUiCLSListsHandler.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -172,7 +172,8 @@
iContactManager( aContactManager ),
iClsListObserver( NULL ),
iFs( aFs ),
- iMailBox ( NULL )
+ iMailBox ( NULL ),
+ iUseLastNameFirstOrder( EFalse )
{
FUNC_LOG;
// Nothing
@@ -323,44 +324,29 @@
}
searchSettings->SetSearchUrisL(databases);
- // Set displayfields (first name, last name, email addresses)
- RArray<TInt> displayFields(6);
- CleanupClosePushL(displayFields);
- displayFields.AppendL(R_VPBK_FIELD_TYPE_FIRSTNAME);
- displayFields.AppendL(R_VPBK_FIELD_TYPE_LASTNAME);
- displayFields.AppendL(R_VPBK_FIELD_TYPE_EMAILGEN);
- displayFields.AppendL(R_VPBK_FIELD_TYPE_EMAILHOME);
- displayFields.AppendL(R_VPBK_FIELD_TYPE_EMAILWORK);
- searchSettings->SetDisplayFieldsL(displayFields);
- CleanupStack::Pop(&displayFields);
- displayFields.Close();
-
- // Set the new sort order of data fields
+ // Set displayfields according to sort order
RArray<TInt> sortOrder;
- CleanupClosePushL(sortOrder);
-
- // change sorting order for Chinese to LNFN
- if ( User::Language() == ELangPrcChinese )
+ CleanupClosePushL( sortOrder );
+ iRequestHandler->GetSortOrderL( *store1, sortOrder );
+ if ( sortOrder.Count() )
+ {
+ iUseLastNameFirstOrder = ( sortOrder[0] == R_VPBK_FIELD_TYPE_LASTNAME );
+ }
+ else
{
- sortOrder.AppendL( R_VPBK_FIELD_TYPE_LASTNAME );
- sortOrder.AppendL( R_VPBK_FIELD_TYPE_FIRSTNAME );
- }
- else // default sorting order FN LN
- {
- sortOrder.AppendL( R_VPBK_FIELD_TYPE_FIRSTNAME );
- sortOrder.AppendL( R_VPBK_FIELD_TYPE_LASTNAME );
+ iUseLastNameFirstOrder = EFalse; // default is not to change order
}
-
- sortOrder.AppendL(R_VPBK_FIELD_TYPE_EMAILGEN);
- sortOrder.AppendL(R_VPBK_FIELD_TYPE_EMAILHOME);
- sortOrder.AppendL(R_VPBK_FIELD_TYPE_EMAILWORK);
- iRequestHandler->ChangeSortOrderL(*store1, sortOrder);
- if ( store2 )
- {
- iRequestHandler->ChangeSortOrderL(*store2, sortOrder);
- }
-
- CleanupStack::Pop(&sortOrder);
+ RArray<TInt> displayFields( 6 );
+ CleanupClosePushL( displayFields );
+ displayFields.AppendL( sortOrder[0] );
+ if ( sortOrder.Count() >= 1 ) displayFields.AppendL( sortOrder[1] );
+ displayFields.AppendL( R_VPBK_FIELD_TYPE_EMAILGEN );
+ displayFields.AppendL( R_VPBK_FIELD_TYPE_EMAILHOME );
+ displayFields.AppendL( R_VPBK_FIELD_TYPE_EMAILWORK );
+ searchSettings->SetDisplayFieldsL( displayFields );
+ CleanupStack::Pop( &displayFields );
+ CleanupStack::Pop( &sortOrder );
+ displayFields.Close();
sortOrder.Close();
// Set maximum for search results
@@ -437,3 +423,8 @@
iClsListObserver->OperationErrorL( aErrorCode );
}
+TBool CFSEmailUiClsListsHandler::UseLastNameFirstOrder()
+ {
+ FUNC_LOG;
+ return iUseLastNameFirstOrder;
+ }
--- a/emailuis/emailui/src/FreestyleEmailUiCLSMatchObserverInterface.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/FreestyleEmailUiCLSMatchObserverInterface.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -259,7 +259,8 @@
CleanupStack::PushL( matchSet );
// Create display name, this will be used in UI.
- displayname = TFsEmailUiUtility::CreateDisplayNameLC( firstname, lastname, KNullDesC );
+ displayname = TFsEmailUiUtility::CreateDisplayNameLC(
+ firstname, lastname, KNullDesC, iListHandler.UseLastNameFirstOrder() );
RArray<TPsMatchLocation> matchLocation;
CleanupClosePushL( matchLocation );
@@ -294,7 +295,7 @@
// contact does not contain either firstname nor lastname,
// the displayname is left empty.
displayname = TFsEmailUiUtility::CreateDisplayNameLC(
- firstname, lastname );
+ firstname, lastname, iListHandler.UseLastNameFirstOrder() );
// Create match text field, containing display field and email address
HBufC* matchText = HBufC::NewLC( displayname->Length() +
--- a/emailuis/emailui/src/FreestyleEmailUiContactHandler.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/FreestyleEmailUiContactHandler.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -761,7 +761,6 @@
CleanupStack::PopAndDestroy( selectedEmailAddress );
selectedEmailAddress = NULL;
-
CleanupStack::PopAndDestroy( displayname );
CleanupStack::PopAndDestroy( &emailAddresses );
CleanupStack::PopAndDestroy( &lastname );
@@ -770,12 +769,17 @@
// Get index of Next ContactLink if there's no LinkSet
// or iCurrenLink index is set to 0
- TInt index = (iLinksSet && iCurrentLink ? iLinksSet->Find
- (*iCurrentLink) + 1 : 0);
-
- if (iLinksSet && index < iLinksSet->Count())
+ TInt index = ( iLinksSet && iCurrentLink ?
+ iLinksSet->Find( *iCurrentLink ) + 1 : 0 );
+
+ if ( iLinksSet && index < iLinksSet->Count() )
{
- iCurrentLink = &iLinksSet->At(index);
+ delete iCurrentLink;
+ iCurrentLink = NULL;
+
+ iCurrentLink = iLinksSet->At(index).CloneLC();
+ CleanupStack::Pop();
+
delete iLinkOperationFetch;
iLinkOperationFetch = NULL;
@@ -789,7 +793,9 @@
delete iLinkOperationFetch;
iLinkOperationFetch = NULL;
+ delete iCurrentLink;
iCurrentLink = NULL;
+
iState = EContactHandlerIdle;
delete iLinksSet;
iLinksSet = NULL;
@@ -860,7 +866,7 @@
// Store contact
iContactForMsgCreation = aContact;
// Create clonelink for address selection
- MVPbkContactLink* cloneLink = iCurrentLink->CloneLC();
+ MVPbkContactLink* cloneLink = iCurrentLink->CloneLC();
CleanupStack::Pop();
switch ( iMsgCreationHelperState )
{
@@ -979,10 +985,15 @@
CleanupStack::Pop();
if ( iLinksSet->Count() )
{
- iCurrentLink = &iLinksSet->At(0);
+ delete iCurrentLink;
+ iCurrentLink = NULL;
+
+ iCurrentLink = iLinksSet->At(0).CloneLC();
+ CleanupStack::Pop();
//Async operation, callback VPbkSingleContactOperationCompleteL
//Error situations: VPbkSingleContactOperationFailed
- iLinkOperationFetch = iContactManager->RetrieveContactL( iLinksSet->At(0), *this );
+ iLinkOperationFetch = iContactManager->RetrieveContactL(
+ iLinksSet->At(0), *this );
}
iContactManager->ContactStoresL().OpenAllL( *this );
@@ -1121,12 +1132,11 @@
delete iLinkOperationFetch;
iLinkOperationFetch = NULL;
}
-
+
//Async operation, callback VPbkSingleContactOperationCompleteL
//Error situations: VPbkSingleContactOperationFailed
- iLinkOperationFetch = iContactManager->RetrieveContactL
- (*iCurrentLink, *this);
-
+ iLinkOperationFetch = iContactManager->RetrieveContactL(
+ *iCurrentLink, *this);
}
}
@@ -1238,8 +1248,8 @@
//Async operation, callback VPbkSingleContactOperationCompleteL
//Error situations: VPbkSingleContactOperationFailed
- iLinkOperationFetch = iContactManager->RetrieveContactL
- (*iCurrentLink, *this);
+ iLinkOperationFetch = iContactManager->RetrieveContactL(
+ *iCurrentLink, *this);
}
}
}
--- a/emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -1043,6 +1043,21 @@
}
else
{
+ // special handling for such file links that for which corresponding
+ // file is not found in local disk. We try to modify such links to
+ // have http prefix so that browser could open them as they're likely
+ // <href=www...> type tags (i.e., tags missing the scheme) which the
+ // browser control has interpreted as local files
+ HBufC* modifiedUrl = CreateModifiedUrlIfNeededL( aUrl );
+ if ( modifiedUrl )
+ {
+ TBool rVal( ETrue );
+ CleanupStack::PushL( modifiedUrl );
+ rVal = iEventHandler->HandleEventL( *modifiedUrl );
+ CleanupStack::PopAndDestroy( modifiedUrl );
+ return rVal;
+ }
+
if ( NeedToLaunchBrowserL( aUrl ) )
{
LaunchBrowserL( aUrl );
@@ -2165,6 +2180,42 @@
CleanupStack::PopAndDestroy( content8 );
}
+HBufC* CFsEmailUiHtmlViewerContainer::CreateModifiedUrlIfNeededL(
+ const TDesC& aUrl )
+ {
+ _LIT( KFileLink, "file:///");
+ HBufC* modifiedUrl = NULL;
+
+ // check if this really is file-URL
+ if ( aUrl.Left( KFileLink().Length() ).CompareF( KFileLink ) == 0 )
+ {
+ // convert URL-style slashes to backslashes
+ _LIT( KBackslash, "\\" );
+ HBufC* url = aUrl.Mid( KFileLink().Length() ).AllocLC();
+ TPtr urlPtr = url->Des();
+ for ( TInt pos = urlPtr.Locate('/'); pos >= 0; pos = urlPtr.Locate('/') )
+ {
+ urlPtr.Replace( pos, 1, KBackslash );
+ }
+ // check if the file exists, if not convert the file-URL to http-URL
+ // (i.e., remove the whole path and replace the prefix with "http:")
+ if ( !BaflUtils::FileExists( iFs, *url ) )
+ {
+ TInt pos = url->FindF( iTempHtmlFolderPath );
+ if ( pos >= 0 )
+ {
+ _LIT( KHttpPrefix, "http://" );
+ TPtrC filename = url->Mid( pos + iTempHtmlFolderPath.Length() );
+ modifiedUrl = HBufC::NewL( filename.Length() + KHttpPrefix().Length() );
+ TPtr modifiedPtr = modifiedUrl->Des();
+ modifiedPtr.Append( KHttpPrefix );
+ modifiedPtr.Append( filename );
+ }
+ }
+ CleanupStack::PopAndDestroy( url );
+ }
+ return modifiedUrl;
+ }
/******************************************************************************
--- a/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -38,6 +38,8 @@
#include <brctlinterface.h>
#include <csxhelp/cmail.hlp.hrh>
#include <baclipb.h> // for clipboard copy
+#include <fsmailserver.rsg>
+#include <aknnotewrappers.h>
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
#include <txtclipboard.h>
@@ -349,7 +351,18 @@
break;
case EFsEmailUiCmdActionsMoveMessage:
{
- OpenFolderListForMessageMovingL();
+ TBool asyncFetchStatus = GetAsyncFetchStatus();
+ if ( asyncFetchStatus )
+ {
+ HBufC* noteText = StringLoader::LoadLC( R_FS_MSERVER_TEXT_SERVER_CURRENTLY_BUSY_TRY_AGAIN );
+ CAknInformationNote* note = new (ELeave) CAknInformationNote();
+ note->ExecuteLD( *noteText );
+ CleanupStack::PopAndDestroy( noteText );
+ }
+ else
+ {
+ OpenFolderListForMessageMovingL();
+ }
}
break;
case EFsEmailUiCmdActionsFlag:
@@ -635,6 +648,10 @@
iMessage = iOpenMessages->Head();
iCreateNewMsgFromEmbeddedMsg = EFalse;
+ if (iMessage && !iMailBox)
+ {
+ iMailBox = iAppUi.GetMailClient()->GetMailBoxByUidL( iMessage->GetMailBoxId() );
+ }
delete iAttachmentsListModel;
iAttachmentsListModel = NULL;
iAttachmentsListModel = CFSEmailUiAttachmentsListModel::NewL( iAppUi, *this );
--- a/emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -1280,7 +1280,7 @@
{
// Size sorting does not use nodes, so disable those, otherwise check from CR
iNodesInUse = iAppUi.GetCRHandler()->TitleDividers();
- SetSortButtonTextAndIconL();
+ SetSortButtonIconL();
iFocusedControl = EControlBarComponent;
iMailList->SetFocusedL( EFalse );
@@ -1360,6 +1360,12 @@
if( aTriggeredTimer == iNewMailTimer )
{
+ if ( ! iThisViewActive ) // don't proceed if view is not active
+ {
+ iNewMailTimer->Stop();
+ return;
+ }
+
TInt count = Min( KNewMailMaxBatch, iNewMailIds.Count() );
CFSMailClient* mailClient = iAppUi.GetMailClient();
@@ -1380,10 +1386,16 @@
return; // leave method
}
- CFSMailMessage* msgPtr = mailClient->GetMessageByUidL( iAppUi.GetActiveMailboxId(),
+ CFSMailMessage* msgPtr(NULL);
+ TRAPD( err, msgPtr = mailClient->GetMessageByUidL( iAppUi.GetActiveMailboxId(),
iMailFolder->GetFolderId(),
iNewMailIds[ 0 ],
- EFSMsgDataEnvelope );
+ EFSMsgDataEnvelope ) );
+ if ( KErrNone != err )
+ {
+ iNewMailTimer->iStatus = KErrNone;
+ User::Leave(err);
+ }
if ( msgPtr != NULL )
{
__ASSERT_DEBUG( FolderId() == msgPtr->GetFolderId(), User::Invariant() );
@@ -1658,6 +1670,8 @@
}
DisableMailList( EFalse );
+ UpdateFolderAndMarkingModeTextsL();
+
// inform baseView if view entered with forward navigation
TBool forwardNavigation = EFalse;
if ( aCustomMessageId != KStartListReturnToPreviousFolder &&
@@ -1678,7 +1692,7 @@
SetMailListLayoutAnchors();
//if the view is already active don't update the icons so they won't "blink"
//when the view is activated.
- if(!iThisViewActive)
+ if(!iThisViewActive && !iMarkingMode)
{
ScaleControlBarL();
@@ -1858,7 +1872,7 @@
// Set initial sort criteria when folder is changed
iCurrentSortCriteria.iField = EFSMailSortByDate;
iCurrentSortCriteria.iOrder = EFSMailDescending;
- SetSortButtonTextAndIconL();
+ SetSortButtonIconL();
SafeDelete(iMailFolder);
TRAP_IGNORE( iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL(
@@ -1873,9 +1887,6 @@
TFSMailMsgId inboxId = iAppUi.GetActiveMailbox()->GetStandardFolderId( EFSInbox );
iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( activationData.iMailBoxId, inboxId );
}
- HBufC* newFolderName = CreateFolderNameLC( iMailFolder );
- iFolderListButton->SetTextL( *newFolderName );
- CleanupStack::PopAndDestroy( newFolderName );
iMailList->SetFocusedItemL( KFsTreeNoneID );
refreshState = EFullRefreshNeeded;
}
@@ -1976,11 +1987,17 @@
SetControlBarFocusedL();
iControlBarControl->MakeSelectorVisible( iAppUi.IsFocusShown() );
}
- UpdateButtonTextsL();
FocusVisibilityChange( iAppUi.IsFocusShown() );
iAppUi.ShowTitlePaneConnectionStatus();
+
+ // if timer stoped when quitting view then restart if more messages available
+ if ( iNewMailIds.Count() && ( ! iNewMailTimer->IsActive() ) && iSortState == ESortNone )
+ {
+ iNewMailTimer->Start( KNewMailTimerDelay );
+ }
+
TIMESTAMP( "Message list view opened" );
- }
+ } // CFSEmailUiMailListVisualiser::ChildDoActivateL
// ---------------------------------------------------------------------------
// Sets status bar layout
@@ -2022,6 +2039,7 @@
iMailList->SetFocusedL( EFalse );
} );
iMailTreeListVisualizer->NotifyControlVisibilityChange( EFalse );
+ TRAP_IGNORE( UpdateFolderAndMarkingModeTextsL() );
}
iThisViewActive = EFalse;
}
@@ -2518,10 +2536,10 @@
//
void CFSEmailUiMailListVisualiser::ExitMarkingModeL()
{
- FUNC_LOG;
+ FUNC_LOG;
+ iMarkingMode = EFalse;
// Hide marking mode text on the place of drop down menus
- RemoveMarkingModeTitleTextL();
- iMarkingMode = EFalse;
+ UpdateFolderAndMarkingModeTextsL();
UnmarkAllItemsL();
// Change softkeys back to normal
SetViewSoftkeysL( R_FREESTYLE_EMAUIL_UI_SK_OPTIONS_BACK );
@@ -2537,6 +2555,10 @@
iFolderListButton->SetDimmed( EFalse );
iSortButton->SetDimmed( EFalse );
ScaleControlBarL();
+
+ iMailTreeListVisualizer->HideList();
+ SetMailListLayoutAnchors();
+ iMailTreeListVisualizer->ShowListL();
}
// ---------------------------------------------------------------------------
@@ -2556,19 +2578,19 @@
CEikMenuBar* menu = iAppUi.CurrentActiveView()->MenuBar();
menu->StopDisplayingMenuBar();
menu->SetMenuTitleResourceId(R_FSEMAILUI_MAILLIST_MENUBAR_MARKING_MODE);
- // Change background to marking mode
- DisplayMarkingModeBgL( ETrue );
// Hide drop down menu buttons
iNewEmailButton->SetDimmed();
iFolderListButton->SetDimmed();
iSortButton->SetDimmed();
- if( !Layout_Meta_Data::IsLandscapeOrientation() )
- {
- TRect rect(0,0,0,0);
- iControlBarControl->SetRectL( rect );
- // Display marking mode text on the place of drop down menus
- DisplayMarkingModeTitleTextL();
- }
+ TRect rect(0,0,0,0);
+ iControlBarControl->SetRectL( rect );
+ UpdateFolderAndMarkingModeTextsL();
+
+ iMailTreeListVisualizer->HideList();
+ SetMailListLayoutAnchors();
+ iMailTreeListVisualizer->ShowListL();
+ // Change background to marking mode
+ DisplayMarkingModeBgL( ETrue );
}
// ---------------------------------------------------------------------------
@@ -2582,29 +2604,21 @@
if ( iMarkingMode )
{
// Hide drop down menu buttons
- if( !Layout_Meta_Data::IsLandscapeOrientation() )
- {
- TRect rect(0,0,0,0);
- iControlBarControl->SetRectL( rect );
- DisplayMarkingModeTitleTextL();
- }
- else
- {
- iControlBarControl->SetRectL( iAppUi.LayoutHandler()->GetControlBarRect() );
- iNewEmailButton->SetDimmed();
- iFolderListButton->SetDimmed();
- iSortButton->SetDimmed();
- RemoveMarkingModeTitleTextL();
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-//
-// ---------------------------------------------------------------------------
-//
-void CFSEmailUiMailListVisualiser::DisplayMarkingModeTitleTextL()
+ TRect rect(0,0,0,0);
+ iControlBarControl->SetRectL( rect );
+ iNewEmailButton->SetDimmed();
+ iFolderListButton->SetDimmed();
+ iSortButton->SetDimmed();
+ UpdateFolderAndMarkingModeTextsL();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+//
+// ---------------------------------------------------------------------------
+//
+void CFSEmailUiMailListVisualiser::DisplayMarkingModeTextOnButtonsL()
{
FUNC_LOG;
if (!iMarkingModeTextVisual)
@@ -2642,15 +2656,15 @@
{
iMarkingModeTextVisual->SetTextL( KNullDesC );
}
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-//
-// ---------------------------------------------------------------------------
-//
-void CFSEmailUiMailListVisualiser::RemoveMarkingModeTitleTextL()
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+//
+// ---------------------------------------------------------------------------
+//
+void CFSEmailUiMailListVisualiser::RemoveMarkingModeTextOnButtonsL()
{
FUNC_LOG;
if (iMarkingModeTextVisual)
@@ -3357,7 +3371,6 @@
if ( aType == EScreenLayoutChanged )
{
SetStatusBarLayout();
- UpdateButtonTextsL();
}
if ( aType == ESkinChanged )
@@ -3394,7 +3407,8 @@
if (iMarkingMode)
{
RefreshMarkingModeL();
- }
+ }
+ UpdateFolderAndMarkingModeTextsL();
}
// ---------------------------------------------------------------------------
@@ -3411,36 +3425,6 @@
{
UpdateThemeL();
}
- else if ( aType == EScreenLayoutChanged )
- {
- UpdateButtonTextsL();
- }
- }
-
-// ---------------------------------------------------------------------------
-// Update texts for command area buttons
-// ---------------------------------------------------------------------------
-//
-void CFSEmailUiMailListVisualiser::UpdateButtonTextsL()
- {
- if ( !Layout_Meta_Data::IsLandscapeOrientation() )
- {
- // No texts in portrait mode
- iNewEmailButton->SetTextL( KNullDesC() );
- iSortButton->SetTextL( KNullDesC() );
- }
- else
- {
- // Set button text if necessary
- HBufC* buttonText = GetSortButtonTextLC();
- if ( buttonText )
- {
- iSortButton->SetTextL( *buttonText );
- CleanupStack::PopAndDestroy( buttonText );
- }
-
- iNewEmailButton->SetTextL( *iNewEmailText );
- }
}
// ---------------------------------------------------------------------------
@@ -3951,7 +3935,8 @@
aCommand == EFsEmailUiCmdActionsMoveMessage ||
aCommand == EFsEmailUiCmdMarkingModeFromPopUp ||
aCommand == EFsEmailUiCmdActionsCollapseAll ||
- aCommand == EFsEmailUiCmdActionsExpandAll ) )
+ aCommand == EFsEmailUiCmdActionsExpandAll ||
+ aCommand == EFsEmailUiCmdActionsFlag ) )
{
// We end up here if the user selects an option from the pop up menu
// or exits the menu by tapping outside of it's area.
@@ -4648,7 +4633,6 @@
if ( aDestinationFolderId.IsNullId() )
{
// Activate folder selection view and handle moving after callback gets destination
- RemoveMarkingModeTitleTextL();
iMoveToFolderOngoing = ETrue;
TFolderListActivationData folderListData;
folderListData.iCallback = this;
@@ -5921,11 +5905,10 @@
{
horizontalAlign = EAlfAlignHRight;
}
-
// Icons and sort button text
iFolderListButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListControlBarMailboxDefaultIcon ) );
iNewEmailButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListTextureCreateNewMessageIcon ) );
- SetSortButtonTextAndIconL();
+ SetSortButtonIconL();
iNewEmailButton->SetElemAlignL(
ECBElemIconA,
@@ -6011,27 +5994,9 @@
//
// ---------------------------------------------------------------------------
//
-void CFSEmailUiMailListVisualiser::SetSortButtonTextAndIconL()
+void CFSEmailUiMailListVisualiser::SetSortButtonIconL()
{
FUNC_LOG;
-
- // Set button text if necessary
- HBufC* buttonText = GetSortButtonTextLC();
-
- if ( !Layout_Meta_Data::IsLandscapeOrientation() )
- {
- if ( buttonText )
- {
- buttonText->Des().Zero();
- }
- }
-
- if ( buttonText )
- {
- iSortButton->SetTextL( *buttonText );
- }
- CleanupStack::PopAndDestroy( buttonText );
-
iSortButton->SetIconL(
iAppUi.FsTextureManager()->TextureByIndex( GetSortButtonTextureIndex() ),
ECBElemIconA );
@@ -6193,7 +6158,6 @@
EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricAbsolute,
TAlfTimedPoint(1, iAppUi.LayoutHandler()->ControlBarHeight() ));
- // <cmail> Platform layout changes
TRect listRect = iAppUi.LayoutHandler()->GetListRect();
// Set anchors so that list leaves space for control bar
if( Layout_Meta_Data::IsMirrored() )
@@ -6208,15 +6172,23 @@
EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
TAlfTimedPoint(listRect.iTl.iX, listRect.iTl.iY));
- iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1,
- EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
- EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
- TAlfTimedPoint(listRect.iBr.iX, listRect.iBr.iY));
- // </cmail> Platform layout changes
+
+ if (iMarkingMode && Layout_Meta_Data::IsLandscapeOrientation())
+ {
+ iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1,
+ EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
+ EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricAbsolute,
+ TAlfTimedPoint(1, listRect.iBr.iY));
+ }
+ else
+ {
+ iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1,
+ EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
+ EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
+ TAlfTimedPoint(listRect.iBr.iX, listRect.iBr.iY));
+ }
// Set anchors for connection icon
-
- // <cmail> Platform layout changes
TRect connectionIconRect( iAppUi.LayoutHandler()->GetControlBarConnectionIconRect() );
const TPoint& tl( connectionIconRect.iTl );
iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 2,
@@ -6228,7 +6200,6 @@
EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
TAlfTimedPoint( br.iX, br.iY ));
- // </cmail> Platform layout changes
iScreenAnchorLayout->UpdateChildrenLayout();
}
@@ -7130,10 +7101,6 @@
switch ( aResponse )
{
case EFSEmailUiCtrlBarResponseCancel:
- if ( iMarkingMode )
- {
- DisplayMarkingModeTitleTextL();
- }
iMarkingModeWaitingToExit = EFalse;
SetMskL();
return;
@@ -7177,17 +7144,13 @@
case EFSEmailUiCtrlBarResponseCancel:
iMarkingModeWaitingToExit = EFalse;
SetMskL();
- // <cmail> Touch
//Set touchmanager back to active
DisableMailList(EFalse);
- // </cmail>
return;
case EFSEmailUiCtrlBarResponseSelect:
SetMskL();
- // <cmail> Touch
//Set touchmanager back to active
DisableMailList(EFalse);
- // </cmail>
default:
break;
}
@@ -7206,17 +7169,14 @@
return;
}
- // Set new text to folder button in control bar
- HBufC* newFolderName = CreateFolderNameLC( iMailFolder );
- iFolderListButton->SetTextL( *newFolderName );
- CleanupStack::PopAndDestroy( newFolderName );
+ UpdateFolderAndMarkingModeTextsL();
// Set initial sort criteria when folder has changed
iCurrentSortCriteria.iField = EFSMailSortByDate;
iCurrentSortCriteria.iOrder = EFSMailDescending;
// reload node state because in file sort mode this is disabled even when globally enabled
iNodesInUse = iAppUi.GetCRHandler()->TitleDividers();
- SetSortButtonTextAndIconL();
+ SetSortButtonIconL();
// Update the mail list contents
UpdateMailListModelL();
@@ -7250,12 +7210,10 @@
iCurrentSortCriteria.iOrder = EFSMailDescending;
// reload node state because in file sort mode this is disabled even when globally enabled
iNodesInUse = iAppUi.GetCRHandler()->TitleDividers();
- SetSortButtonTextAndIconL();
+ SetSortButtonIconL();
// Set folder name to the control bar button
- HBufC* newFolderName = CreateFolderNameLC( iMailFolder );
- iFolderListButton->SetTextL( *newFolderName );
- CleanupStack::PopAndDestroy( newFolderName );
+ UpdateFolderAndMarkingModeTextsL();
// Set mailbox name and icons
SetMailboxNameToStatusPaneL();
@@ -7751,9 +7709,7 @@
iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( aMailboxId, inboxId );
UpdateMailListModelL();
RefreshL();
- HBufC* newFolderName = CreateFolderNameLC( iMailFolder );
- iFolderListButton->SetTextL( *newFolderName );
- CleanupStack::PopAndDestroy( newFolderName );
+ UpdateFolderAndMarkingModeTextsL();
}
else
{
@@ -7808,9 +7764,7 @@
// Check that mailfolder fetching succeeded
if ( iMailFolder )
{
- HBufC* newFolderName = CreateFolderNameLC( iMailFolder );
- iFolderListButton->SetTextL( *newFolderName );
- CleanupStack::PopAndDestroy( newFolderName );
+ UpdateFolderAndMarkingModeTextsL();
}
}
}
@@ -8402,8 +8356,14 @@
void CFSEmailUiMailListVisualiser::GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const
{
- aLayoutArray.AppendL( iScreenAnchorLayout );
- aLayoutArray.AppendL( iControlBarControl->Visual() );
+ if ( iScreenAnchorLayout )
+ {
+ aLayoutArray.AppendL( iScreenAnchorLayout );
+ }
+ if ( iControlBarControl )
+ {
+ aLayoutArray.AppendL( iControlBarControl->Visual() );
+ }
}
// hide or show CAlfVisuals ( used for activation or deactivation )
@@ -8474,6 +8434,49 @@
return manualSync;
}
+
+void CFSEmailUiMailListVisualiser::UpdateFolderAndMarkingModeTextsL()
+ {
+ if ( iAppUi.CurrentActiveView()->Id() == MailListId )
+ {
+ HBufC* folder = CreateFolderNameLC( iMailFolder );
+ if( Layout_Meta_Data::IsLandscapeOrientation() )
+ {
+ iFolderListButton->SetTextL( KNullDesC );
+ if (iMarkingMode)
+ {
+ RemoveMarkingModeTextOnButtonsL();
+ HBufC* txt = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MARKINGMODE );
+ iAppUi.SetNaviPaneTextL( *txt );
+ CleanupStack::PopAndDestroy( txt );
+ }
+ else
+ {
+ iAppUi.SetNaviPaneTextL( *folder );
+ }
+ }
+ else // Portrait orientation
+ {
+ iAppUi.SetNaviPaneTextL( KNullDesC );
+ if (iMarkingMode)
+ {
+ DisplayMarkingModeTextOnButtonsL();
+ }
+ else
+ {
+ RemoveMarkingModeTextOnButtonsL();
+ iFolderListButton->SetTextL( *folder );
+ }
+ }
+ CleanupStack::PopAndDestroy( folder );
+ }
+ else
+ {
+ iAppUi.SetNaviPaneTextL( KNullDesC );
+ RemoveMarkingModeTextOnButtonsL();
+ }
+ }
+
//////////////////////////////////////////////////////////////////
// Class implementation CMailListUpdater
///////////////////////////////////////////////////////////////////
--- a/emailuis/emailui/src/FreestyleEmailUiSearchListVisualiser.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/FreestyleEmailUiSearchListVisualiser.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -443,8 +443,6 @@
iAppUi.SetActiveMailboxNameToStatusPaneL();
}
CAknEnv::Static()->GetCurrentGlobalUiZoom( iCurrentZoomLevel );
- // Set msk always empty when view is activated.
- SetMskL();
// <cmail>
ReScaleUiL(); // In case that Landscape/Portrait has changed.
// </cmail>
@@ -1696,8 +1694,6 @@
sortCriteria.iField = EFSMailSortByDate;
sortCriteria.iOrder = EFSMailDescending;
iSearchOngoing = ETrue;
- // Model and list is set to be empty, set also MSK to empty
- SetMskL();
// Initialisr TextSearcher
// Start search.
@@ -1913,9 +1909,6 @@
// Set the extendedability and extended size
iSearchTreeListVisualizer->SetItemsAlwaysExtendedL( EFalse );
}
-
- // Set msk to "Open when first is found".
- SetMskL();
}
}
@@ -2467,11 +2460,6 @@
LaunchStylusPopupMenuL( aPoint );
}
break;
- case MFsTreeListObserver::EFsTreeListItemWillGetFocused:
- {
- SetMskL();
- break;
- }
case MFsTreeListObserver::EFsFocusVisibilityChange:
{
iAppUi.SetFocusVisibility( EFalse );
@@ -2564,27 +2552,6 @@
return EFalse; //no calling key up will execute Call app
}
-
-// ---------------------------------------------------------------------------
-// Logic for changing msk
-// ---------------------------------------------------------------------------
-//
-void CFSEmailUiSearchListVisualiser::SetMskL()
- {
- FUNC_LOG;
- if ( iFirstStartCompleted )
- {
- if ( iSearchList && iSearchList->Count() )
- {
- ChangeMskCommandL( R_FSE_QTN_MSK_OPEN );
- }
- else
- {
- ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
- }
- }
- }
-
//<cmail>
// ---------------------------------------------------------------------------
// CFSEmailUiSearchListVisualiser::SetHeaderTextAttributesL()
--- a/emailuis/emailui/src/FreestyleEmailUiTextureManager.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/FreestyleEmailUiTextureManager.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007 - 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"
@@ -1889,18 +1889,20 @@
case EMarkingModeBackgroundIcon:
{
TRect mailListRect(iAppUi->LayoutHandler()->GetListRect());
+ TRect appRect;
+ AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EApplicationWindow, appRect);
if ( mailListRect.Width() > mailListRect.Height() )
{
- iconSize.SetSize( mailListRect.Width(), mailListRect.Width() );
+ iconSize.SetSize( appRect.Width(), appRect.Width() );
}
else
{
- iconSize.SetSize( mailListRect.Height(), mailListRect.Height() );
- }
+ iconSize.SetSize( appRect.Height(), appRect.Height() );
+ }
AknIconUtils::CreateIconL( bitmap, mask, iconFileName,
EMbmFreestyleemailuiCmail_marking_mode_bg,
EMbmFreestyleemailuiCmail_marking_mode_bg);
- }
+ }
break;
case EGridAboutTexture:
default:
--- a/emailuis/emailui/src/FreestyleEmailUiUtilities.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/FreestyleEmailUiUtilities.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -3020,10 +3020,10 @@
// -----------------------------------------------------------------------------
//
HBufC* TFsEmailUiUtility::CreateDisplayNameLC( const TDesC& aFirstname,
- const TDesC& aLastname )
+ const TDesC& aLastname, TBool aSwitchOrder )
{
FUNC_LOG;
- return CreateDisplayNameLC( aFirstname, aLastname, KNullDesC );
+ return CreateDisplayNameLC( aFirstname, aLastname, KNullDesC, aSwitchOrder );
}
// -----------------------------------------------------------------------------
@@ -3031,7 +3031,7 @@
// -----------------------------------------------------------------------------
//
HBufC* TFsEmailUiUtility::CreateDisplayNameLC( const TDesC& aFirstname,
- const TDesC& aLastname, const TDesC& aEmailField )
+ const TDesC& aLastname, const TDesC& aEmailField, TBool aSwitchOrder )
{
FUNC_LOG;
HBufC* displayname = NULL;
@@ -3073,10 +3073,19 @@
TInt length = aFirstname.Length() + KSpace().Length()
+ aLastname.Length();
displayname = HBufC::NewLC( length );
- displayname->Des().Copy( aFirstname );
- displayname->Des().Append( KSpace );
- displayname->Des().Append( aLastname );
- }
+ if ( aSwitchOrder )
+ {
+ displayname->Des().Copy( aLastname );
+ displayname->Des().Append( KSpace );
+ displayname->Des().Append( aFirstname );
+ }
+ else
+ {
+ displayname->Des().Copy( aFirstname );
+ displayname->Des().Append( KSpace );
+ displayname->Des().Append( aLastname );
+ }
+ }
}
return displayname;
--- a/emailuis/emailui/src/FreestyleEmailUiWizardObserver.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/FreestyleEmailUiWizardObserver.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -417,7 +417,6 @@
// back to the launcher grid, which should be the view at
// the bottom of the stack) and then erase the history just
// to make sure it's really all gone.
- iAppUi->EnterFsEmailViewL( AppGridId );
iAppUi->EraseViewHistory();
// Now switch to the mail list.
iAppUi->EnterFsEmailViewL( MailListId, KStartListWithFolderId,
--- a/emailuis/emailui/src/FreestyleMessageHeaderURLEventHandler.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/FreestyleMessageHeaderURLEventHandler.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -101,7 +101,7 @@
iUrl = NULL;
}
iUrl = aUri.AllocL();
- LaunchWebAddressMenuL( );
+ iView.HandleWebAddressCommandL( EFsEmailUiCmdActionsOpenWeb, *iUrl );
return ETrue;
}
//Link wasn't handled
--- a/emailuis/emailui/src/ncscomposeview.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/ncscomposeview.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -87,9 +87,10 @@
iMsvSession( aMsvSession ), iEnv( aEnv ),
iFakeSyncGoingOn(EFalse), iFetchDialogCancelled(EFalse),
iExecutingDoExitL( EFalse ),
- iMessageTextPartModified( EFalse ), iMessageModified( EFalse )
+ iMessageTextPartModified( EFalse ), iMessageModified( EFalse ),
+ iIncludeMessageTextAsync( EFalse ), iChildActivationState( EChildActivationDeactivated )
{
- FUNC_LOG;
+ FUNC_LOG;
iAttachmentListSaveDraft = EFalse;
@@ -289,7 +290,7 @@
TUid aCustomMessageId, const TDesC8& aCustomMessage )
{
FUNC_LOG;
-
+ iChildActivationState = EChildActivationStarted;
// needed when "Opening" (replying/forwarding)note is shown and
// we receive incoming call- Email application goes to background.
// When coming back to application the view is activated and reseted.
@@ -435,41 +436,51 @@
Toolbar()->SetDimmed( EFalse );
RefreshToolbar();
iContainer->ActivateL();
- }
+
// if there is a embedded app in FSEmail.
if( iAppUi.EmbeddedApp() )
- {
- // Set email editor started from embedded app flag to true
- // so that we can switch view correct when sent email.
- iAppUi.SetEditorStartedFromEmbeddedApp( ETrue );
+ {
+ // Set email editor started from embedded app flag to true
+ // so that we can switch view correct when sent email.
+ iAppUi.SetEditorStartedFromEmbeddedApp( ETrue );
RWsSession rwsSession;
- User::LeaveIfError( rwsSession.Connect() );
- CleanupClosePushL( rwsSession );
+ User::LeaveIfError( rwsSession.Connect() );
+ CleanupClosePushL( rwsSession );
// Simulate a back key to exit embedded app
- // so that email editor could show on the top level.
- TKeyEvent KeyEvent = TKeyEvent();
- // this is neccesary for photogalery image viewer (don't remove)
- KeyEvent.iScanCode = EStdKeyUpArrow;
- rwsSession.SimulateKeyEvent( KeyEvent );
- KeyEvent.iCode = EKeyCBA2;
- rwsSession.SimulateKeyEvent( KeyEvent );
+ // so that email editor could show on the top level.
+ TKeyEvent KeyEvent = TKeyEvent();
+ // this is neccesary for photogalery image viewer (don't remove)
+ KeyEvent.iScanCode = EStdKeyUpArrow;
+ rwsSession.SimulateKeyEvent( KeyEvent );
+ KeyEvent.iCode = EKeyCBA2;
+ rwsSession.SimulateKeyEvent( KeyEvent );
rwsSession.Close();
- CleanupStack::PopAndDestroy( &rwsSession );
- }
+ CleanupStack::PopAndDestroy( &rwsSession );
+ }
if ( iIncludeMessageTextAsync )
- {
- // including message body in async way
- IncludeMessageTextAsyncL( ETrue );
- }
-
- iViewFullyActivated = ETrue;
+ {
+ // including message body in async way
+ IncludeMessageTextAsyncL( ETrue );
+ }
+
+ iViewFullyActivated = ETrue;
+ iChildActivationState = EChildActivationProcessed;
TIMESTAMP( "Editor launched" );
+ return; // ok
+ }
+// problems with init close the view asynchronously
+ iViewFullyActivated = EFalse;
+ iChildActivationState = EChildActivationExitRequired;
+// iFakeSyncGoingOn = EFalse; iExecutingDoExitL = EFalse;
+ iActiveHelper->Start(); // calls AsyncExit()
+ TIMESTAMP( "Editor NOT launched" );
+ return;
}
// -----------------------------------------------------------------------------
@@ -796,7 +807,9 @@
{
SaveAndCleanPreviousMessage();
}
-
+
+ iChildActivationState = EChildActivationDeactivated ;
+
}
// -----------------------------------------------------------------------------
@@ -942,6 +955,10 @@
{
case ENcsCmdSend:
{
+ // Set focus on body of message need for correct
+ // MSK setting for CAknConfirmationNote dialog.
+ iContainer->SetFocusToMessageFieldL();
+
// Show query if the Subject field is empty
if ( iContainer->IsSubjectFieldEmpty() )
{
@@ -1060,29 +1077,38 @@
break;
case ENcsCmdPriorityHigh:
{
- iNewMessage->ResetFlag( EFSMsgFlag_Low );
- iNewMessage->SetFlag( EFSMsgFlag_Important );
- iNewMessage->SaveMessageL();
- iMessageModified = EFalse;
- iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityHigh );
+ if ( iNewMessage )
+ {
+ iNewMessage->ResetFlag( EFSMsgFlag_Low );
+ iNewMessage->SetFlag( EFSMsgFlag_Important );
+ iNewMessage->SaveMessageL();
+ iMessageModified = EFalse;
+ iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityHigh );
+ }
}
break;
case ENcsCmdPriorityNormal:
{
- iNewMessage->ResetFlag( EFSMsgFlag_Low );
- iNewMessage->ResetFlag( EFSMsgFlag_Important );
- iNewMessage->SaveMessageL();
- iMessageModified = EFalse;
- iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityNormal );
+ if ( iNewMessage )
+ {
+ iNewMessage->ResetFlag( EFSMsgFlag_Low );
+ iNewMessage->ResetFlag( EFSMsgFlag_Important );
+ iNewMessage->SaveMessageL();
+ iMessageModified = EFalse;
+ iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityNormal );
+ }
}
break;
case ENcsCmdPriorityLow:
{
- iNewMessage->ResetFlag( EFSMsgFlag_Important );
- iNewMessage->SetFlag( EFSMsgFlag_Low );
- iNewMessage->SaveMessageL();
- iMessageModified = EFalse;
- iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityLow );
+ if ( iNewMessage )
+ {
+ iNewMessage->ResetFlag( EFSMsgFlag_Important );
+ iNewMessage->SetFlag( EFSMsgFlag_Low );
+ iNewMessage->SaveMessageL();
+ iMessageModified = EFalse;
+ iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityLow );
+ }
}
break;
case ENcsCmdShowCc:
@@ -1169,7 +1195,8 @@
break;
case EAknSoftkeyClose:
{
- DoSafeExit();
+ if ( !iAddingAttachmentDialogOpened )
+ DoSafeExit();
}
break;
case ENcsCmdExit:
@@ -1204,7 +1231,12 @@
User::Leave( KErrNotFound );
}
- CommitL( ETrue, EAllFields, ETrue );
+ TRAPD( commitErr, CommitL( ETrue, EAllFields, ETrue ) );
+ if ( KErrNone != commitErr )
+ {
+ iMailSendFailed = ETrue;
+ User::Leave( commitErr );
+ }
TRAPD(r, iMailBox->SendMessageL( *iNewMessage ) );
if ( KErrNone != r )
@@ -1780,7 +1812,7 @@
{
FUNC_LOG;
- if ( iFirstStartCompleted && iContainer )
+ if ( iFirstStartCompleted && iContainer && !iExecutingDoExitL )
{
if ( aType == CFsEmailUiViewBase::EScreenLayoutChanged )
{
@@ -2244,56 +2276,70 @@
break;
}
- if ( commitToField )
- {
- RPointerArray<CFSMailAddress>& recipients =
- iNewMessage->GetToRecipients();
- recipients.ResetAndDestroy();
- NcsUtility::ConvertAddressArrayL(
- iContainer->GetToFieldAddressesL( aParseAddresses ), recipients );
+ if ( iNewMessage )
+ {
+ if ( commitToField )
+ {
+ RPointerArray<CFSMailAddress>& recipients =
+ iNewMessage->GetToRecipients();
+ recipients.ResetAndDestroy();
+ NcsUtility::ConvertAddressArrayL(
+ iContainer->GetToFieldAddressesL( aParseAddresses ), recipients );
+ }
+
+ if ( commitCcField )
+ {
+ RPointerArray<CFSMailAddress>& recipients =
+ iNewMessage->GetCCRecipients();
+ recipients.ResetAndDestroy();
+ NcsUtility::ConvertAddressArrayL(
+ iContainer->GetCcFieldAddressesL( aParseAddresses ), recipients );
+ }
+
+ if ( commitBccField )
+ {
+ RPointerArray<CFSMailAddress>& recipients =
+ iNewMessage->GetBCCRecipients();
+ recipients.ResetAndDestroy();
+ NcsUtility::ConvertAddressArrayL(
+ iContainer->GetBccFieldAddressesL( aParseAddresses ), recipients );
+ }
+
+ if ( commitSubjectField )
+ {
+ // get subject from UI to MSG object
+ HBufC* subject = iContainer->GetSubjectLC();
+ TPtr ptr = subject->Des();
+ // replace new line characters with spaces as Subject is normally
+ // one line only
+ AknTextUtils::ReplaceCharacters(
+ ptr, KLineSeparators, KReplacementChar );
+ iNewMessage->SetSubject( *subject );
+ CleanupStack::PopAndDestroy( subject );
+ }
}
-
- if ( commitCcField )
- {
- RPointerArray<CFSMailAddress>& recipients =
- iNewMessage->GetCCRecipients();
- recipients.ResetAndDestroy();
- NcsUtility::ConvertAddressArrayL(
- iContainer->GetCcFieldAddressesL( aParseAddresses ), recipients );
- }
-
- if ( commitBccField )
+ else // iNewMessage is still NULL
{
- RPointerArray<CFSMailAddress>& recipients =
- iNewMessage->GetBCCRecipients();
- recipients.ResetAndDestroy();
- NcsUtility::ConvertAddressArrayL(
- iContainer->GetBccFieldAddressesL( aParseAddresses ), recipients );
+ User::Leave( KErrNotFound );
}
-
- if ( commitSubjectField )
+
+ if ( iNewMessageTextPart )
{
- // get subject from UI to MSG object
- HBufC* subject = iContainer->GetSubjectLC();
- TPtr ptr = subject->Des();
- // replace new line characters with spaces as Subject is normally
- // one line only
- AknTextUtils::ReplaceCharacters(
- ptr, KLineSeparators, KReplacementChar );
- iNewMessage->SetSubject( *subject );
- CleanupStack::PopAndDestroy( subject );
+ if ( commitBodyField )
+ {
+ HBufC* body = iContainer->GetBodyContentLC();
+ TPtr bodyPtr = body->Des(); // this TPtr is needed only because of
+ // incorrect argument type in FW API, can be removed when API fixed
+ iNewMessageTextPart->SetContent( bodyPtr );
+ CleanupStack::PopAndDestroy( body );
+ iMessageTextPartModified = ETrue;
+ }
}
-
- if ( commitBodyField )
- {
- HBufC* body = iContainer->GetBodyContentLC();
- TPtr bodyPtr = body->Des(); // this TPtr is needed only because of
- // incorrect argument type in FW API, can be removed when API fixed
- iNewMessageTextPart->SetContent( bodyPtr );
- CleanupStack::PopAndDestroy( body );
- iMessageTextPartModified = ETrue;
- }
-
+ else // iNewMessageTextPart is still NULL
+ {
+ User::Leave( KErrNotFound );
+ }
+
iMessageModified = ETrue;
RefreshToolbar();
@@ -2872,6 +2918,10 @@
}
TFsEmailUiUtility::CreatePlainTextPartL( *iNewMessage, iNewMessageTextPart );
+ if (NULL == iNewMessageTextPart) // problems with creating
+ {
+ User::Leave( KErrUnknown );
+ }
}
// -----------------------------------------------------------------------------
@@ -2923,7 +2973,10 @@
TFsEmailUiUtility::CreatePlainTextPartL(
*iNewMessage, iNewMessageTextPart );
-
+ if (NULL == iNewMessageTextPart) // problems with creating
+ {
+ User::Leave( KErrUnknown );
+ }
}
// -----------------------------------------------------------------------------
@@ -3149,7 +3202,11 @@
{
if ( !aError )
{
+ // may leave if unable to create new message part
TRAP( aError, InitReplyOrForwardUiL() );
+ }
+ if ( !aError )
+ {
iAutoSaver->Enable( ETrue );
}
else
@@ -3199,6 +3256,16 @@
{
FUNC_LOG;
+ // dont exit while in child activation
+ if ( EChildActivationStarted == iChildActivationState )
+ {
+ iChildActivationState = EChildActivationError;
+ }
+ if ( EChildActivationError == iChildActivationState )
+ {
+ return;
+ }
+
if ( iStatusPaneIndicators )
{
iStatusPaneIndicators->HideStatusPaneIndicators();
@@ -3268,7 +3335,7 @@
delete iContainer;
iContainer = NULL;
}
-
+ iIncludeMessageTextAsync = EFalse;
}
// -----------------------------------------------------------------------------
@@ -3326,7 +3393,11 @@
void CNcsComposeView::AsyncExitL()
{
FUNC_LOG;
- if ( iFakeSyncGoingOn || iExecutingDoExitL )
+ if ( EChildActivationExitRequired == iChildActivationState )
+ {
+ ExitComposer();
+ }
+ else if ( iFakeSyncGoingOn || iExecutingDoExitL )
{
// if some sync method is still going on, we continue waiting
iActiveHelper->Cancel();
@@ -3493,7 +3564,9 @@
void CActiveHelper::RunL()
{
if( iComposeView )
+ {
iComposeView->AsyncExitL();
+ }
}
// ---------------------------------------------------------------------------
--- a/emailuis/emailui/src/ncscomposeviewcontainer.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/ncscomposeviewcontainer.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -400,7 +400,7 @@
if ( iIsDragging )
{
TPoint delta( 0, iPreviousPosition.iY - position.iY );
- if ( !iMessageField->SelectionLength() )
+ if ( !( iMessageField->SelectionLength() || iReadOnlyQuoteField->SelectionLength() ) )
iPhysics->RegisterPanningPosition( delta );
}
}
--- a/emailuis/emailui/src/ncsutility.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/emailui/src/ncsutility.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -308,29 +308,37 @@
TPtr prefixPtr = prefix->Des();
prefixPtr.Trim();
- TInt subjectLineLength = formattedSubjectLinePtr.Length();
- TInt length = subjectLineLength;
- TInt prefixLength = prefixPtr.Length();
HBufC* fwdPrefix = StringLoader::LoadLC( R_NCS_ENGINE_EMAIL_FORWARD_PREFIX );
+ HBufC* rePrefix = StringLoader::LoadLC( R_NCS_ENGINE_EMAIL_REPLY_PREFIX );
TPtr fwdPrt = fwdPrefix->Des();
- TInt fwdLength = fwdPrt.Length();
+ TPtr rePtr = rePrefix->Des();
fwdPrt.Trim();
+ rePtr.Trim();
- for(TInt index = formattedSubjectLinePtr.FindC( prefixPtr ); index != KErrNotFound ; index = formattedSubjectLinePtr.FindC( prefixPtr ))
+ TInt indexRe;
+ TInt indexFw;
+
+
+ // Start to analyse the original subject string and remove
+ // all prefixes at the beggining. When no prefix found as
+ // first word, than loop ends
+ do
{
- formattedSubjectLinePtr = formattedSubjectLinePtr.RightTPtr( length );
- length = formattedSubjectLinePtr.Length() - index - prefixLength;
+ indexRe = formattedSubjectLinePtr.FindC( rePtr );
+ if( indexRe == 0 )
+ {
+ formattedSubjectLinePtr.Delete( indexRe, rePtr.Length() );
+ formattedSubjectLinePtr.Trim();
+ }
+
+ indexFw = formattedSubjectLinePtr.FindC( fwdPrt );
+ if( indexFw == 0 )
+ {
+ formattedSubjectLinePtr.Delete( indexFw, rePtr.Length() );
+ formattedSubjectLinePtr.Trim();
+ }
}
- formattedSubjectLinePtr.Trim();
-
- for(TInt index = formattedSubjectLinePtr.FindC( fwdPrt) ; index != KErrNotFound ; index = formattedSubjectLinePtr.FindC( fwdPrt ))
- {
- formattedSubjectLinePtr = formattedSubjectLinePtr.RightTPtr( length );
- length = formattedSubjectLinePtr.Length() - index - fwdLength;
- }
-
- formattedSubjectLinePtr.Trim();
-
+ while( !( indexRe != 0 && indexFw != 0) );
HBufC* finalSubject = HBufC::NewL( formattedSubjectLinePtr.Length() + prefixPtr.Length() + KSpace().Length() );
TPtr ptr = finalSubject->Des();
@@ -348,6 +356,7 @@
ptr.Append( formattedSubjectLinePtr );
}
+ CleanupStack::PopAndDestroy( rePrefix );
CleanupStack::PopAndDestroy( fwdPrefix );
CleanupStack::PopAndDestroy( prefix );
CleanupStack::PopAndDestroy( formattedSubjectLine );
--- a/emailuis/uicomponents/src/fstreevisualizerbase.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/emailuis/uicomponents/src/fstreevisualizerbase.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -4908,7 +4908,6 @@
{
UpdatePhysicsL();
}
- UpdateScrollBarL();
}
// ---------------------------------------------------------------------------
--- a/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -2359,13 +2359,21 @@
FUNC_LOG;
for ( TInt i = 0; i < iActivitytimers.Count(); i++ )
{
- // do not disconnect automatically mailboxes that are set to
- // "connected"
+ // do disconnect automatically mailboxes that are set to
+ // "connected" when time expired
+ // if ConnOpRunning return ETrue, then reset the timer
if ( iActivitytimers[i]->FSMailboxId().Id() == aMailboxId.Id() )
{
- // 0 for request id
- DisconnectL( iActivitytimers[i]->FSMailboxId(), *this, 0 );
- }
+
+ if( !ConnOpRunning( aMailboxId ) )
+ {
+ // 0 for request id
+ DisconnectL( iActivitytimers[i]->FSMailboxId(), *this, 0 );
+ }else
+ {
+ iActivitytimers[i]->ResetTimerOperation();
+ }
+ }
}
}
--- a/ipsservices/ipssossettings/src/ipssetdataapi.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/ipsservices/ipssossettings/src/ipssetdataapi.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -665,18 +665,23 @@
FUNC_LOG;
TInt sizeLimit = aImap4Settings.BodyTextSizeLimit();
-
+ TInt limit(KMaxTInt);
CRepository* centRep = NULL;
TRAP_IGNORE( centRep = CRepository::NewL( KFreestyleEmailCenRep ) );
-
- TInt limit( 0 );
- TInt err = centRep->Get( KFreestyleMaxBodySize , limit );
- limit *= KKilo;
- if ( limit == 0 || err )
+ if (NULL != centRep)
{
- limit = KMaxTInt;
- }
-
+ //not necessary to push centRep as no leave function is called
+ TInt err = centRep->Get(KFreestyleMaxBodySize, limit);
+ limit *= KKilo;
+ if (limit == 0 || err)
+ {
+ limit = KMaxTInt;
+ }
+ //free
+ delete centRep;
+ centRep = NULL;
+ }//end if (NULL != centRep)
+
if ( sizeLimit == KIpsSetDataHeadersOnly )
{
aInfo.iTotalSizeLimit = KIpsSetDataHeadersOnly;
--- a/ipsservices/ipssossettings/src/ipssetutilsoperationwait.cpp Wed Sep 01 12:28:57 2010 +0100
+++ b/ipsservices/ipssossettings/src/ipssetutilsoperationwait.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -170,6 +170,7 @@
if ( iWaitDialog )
{
iWaitDialog->ProcessFinishedL();
+ delete iWaitDialog;
iWaitDialog = NULL;
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/group/bld.inf Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* ============================================================================
+* Name : bld.inf
+* Part of : eas / tsrc
+* Description : Build information file for tsrc subprojects
+* Version : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+*
+* Copyright ?2010-2010 Nokia and/or its subsidiary(-ies). All rights reserved.
+* This material, including documentation and any related computer
+* programs, is protected by copyright controlled by Nokia. All
+* rights are reserved. Copying, including reproducing, storing,
+* adapting or translating, any or all of this material requires the
+* prior written consent of Nokia. This material also contains
+* confidential information which may not be disclosed to others
+* without the prior written consent of Nokia.
+* ============================================================================
+*/
+
+#include <platform_paths.hrh>
+PRJ_PLATFORMS
+DEFAULT
+
+//--------------------
+PRJ_EXPORTS
+//--------------------
+#include "../profiletester/group/bld.inf"
+
+//--------------------
+PRJ_TESTMMPFILES
+//--------------------
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/bwins/popimapprofiletesteru.def Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/conf/imapprofiletester.cfg Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,155 @@
+[StifSettings]
+CheckHeapBalance=on
+TestThreadStackSize= 32768 // 32K stack
+TestThreadMinHeap= 4096 // 4K heap min
+TestThreadMaxHeap= 2097152 // 2M heap max
+[EndStifSettings]
+
+[Define]
+AccountType imap
+AccountsConfigured 1
+MaxAccountsReached 0
+EmailAddress ipstest.nokia@gmail.com
+Username ipstest.nokia@gmail.com
+Password STIFtest
+MailboxName gmail
+IncomingServer imap.gmail.com
+IncomingPort 993
+OutgoingServer smtp.gmail.com
+OutgoingPort 465
+IncomingSecurityAuth 1
+IncomingSecurityProtocol 2
+OutgoingSecurityAuth 1
+OutgoingSecurityProtocol 2
+OperatorSecurityAuth 1
+OperatorSecurityProtocol 2
+OperatorPort 0
+[Enddefine]
+
+[Test]
+title SetupAccount
+create popimapprofiletester client
+pause 4000
+client SetupAccount
+delete client
+[Endtest]
+
+[Test]
+title GoOnline
+create popimapprofiletester client
+allowerrorcodes -2
+client GoOffline
+pause 4000
+client GoOnline
+delete client
+[Endtest]
+
+[Test]
+title GoOffline
+create popimapprofiletester client
+allowerrorcodes -2
+client GoOnline
+pause 4000
+client GoOffline
+delete client
+[Endtest]
+
+[Test]
+title RefreshNow
+create popimapprofiletester client
+client RefreshNow
+delete client
+[Endtest]
+
+[Test]
+title CancelSync
+create popimapprofiletester client
+client CancelSync
+delete client
+[Endtest]
+
+[Test]
+title ListStandardFolders
+create popimapprofiletester client
+client ListStandardFolders
+delete client
+[Endtest]
+
+[Test]
+title ListFolders
+create popimapprofiletester client
+client ListFolders _expectedFoldersCount: 4 _parentFolder: Inbox
+delete client
+[Endtest]
+
+[Test]
+title ListMessages
+create popimapprofiletester client
+client ListMessages _folder: Inbox
+client ListMessages _folder: Sent
+delete client
+[Endtest]
+
+[Test]
+title FetchMessages
+create popimapprofiletester client
+client FetchMessages
+delete client
+[Endtest]
+
+[Test]
+title SendMessage
+create popimapprofiletester client
+client SendMessage
+delete client
+[Endtest]
+
+[Test]
+title BasicMsgOperations
+create popimapprofiletester client
+client BasicMsgOperations
+delete client
+[Endtest]
+
+[Test]
+title CopyMoveMsgs
+create popimapprofiletester client
+client CopyMoveMsgs
+delete client
+[Endtest]
+
+[Test]
+title Search
+create popimapprofiletester client
+client Search
+delete client
+[Endtest]
+
+[Test]
+title AttachmentHandling
+create popimapprofiletester client
+client AttachmentHandling
+delete client
+[Endtest]
+
+[Test]
+title Branding
+create popimapprofiletester client
+client Branding _isBranded: true
+delete client
+[Endtest]
+
+[Test]
+title DeleteMsgs
+create popimapprofiletester client
+client DeleteMsgs _folder: Inbox
+delete client
+[Endtest]
+
+[Test]
+title RemoveAccount
+create popimapprofiletester client
+client RemoveAccount
+delete client
+[Endtest]
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/conf/popprofiletester.cfg Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,154 @@
+[StifSettings]
+CheckHeapBalance=on
+TestThreadStackSize= 32768 // 32K stack
+TestThreadMinHeap= 4096 // 4K heap min
+TestThreadMaxHeap= 2097152 // 2M heap max
+[EndStifSettings]
+
+[Define]
+AccountType pop
+AccountsConfigured 1
+MaxAccountsReached 0
+EmailAddress ipstest.nokia@gmail.com
+Username ipstest.nokia@gmail.com
+Password STIFtest
+MailboxName gmail
+IncomingServer pop.gmail.com
+IncomingPort 995
+OutgoingServer smtp.gmail.com
+OutgoingPort 465
+IncomingSecurityAuth 1
+IncomingSecurityProtocol 2
+OutgoingSecurityAuth 1
+OutgoingSecurityProtocol 2
+OperatorSecurityAuth 1
+OperatorSecurityProtocol 2
+OperatorPort 0
+[Enddefine]
+
+[Test]
+title SetupAccount
+create popimapprofiletester client
+pause 4000
+client SetupAccount
+delete client
+[Endtest]
+
+[Test]
+title GoOnline
+create popimapprofiletester client
+allowerrorcodes -2
+client GoOffline
+pause 4000
+client GoOnline
+delete client
+[Endtest]
+
+[Test]
+title GoOffline
+create popimapprofiletester client
+allowerrorcodes -2
+client GoOnline
+pause 4000
+client GoOffline
+delete client
+[Endtest]
+
+[Test]
+title RefreshNow
+create popimapprofiletester client
+client RefreshNow
+delete client
+[Endtest]
+
+[Test]
+title CancelSync
+create popimapprofiletester client
+client CancelSync
+delete client
+[Endtest]
+
+[Test]
+title ListStandardFolders
+create popimapprofiletester client
+client ListStandardFolders
+delete client
+[Endtest]
+
+[Test]
+title ListFolders
+create popimapprofiletester client
+client ListFolders _expectedFoldersCount: 4 _parentFolder: Inbox
+delete client
+[Endtest]
+
+[Test]
+title ListMessages
+create popimapprofiletester client
+client ListMessages _folder: Inbox
+delete client
+[Endtest]
+
+[Test]
+title FetchMessages
+create popimapprofiletester client
+client FetchMessages
+delete client
+[Endtest]
+
+[Test]
+title SendMessage
+create popimapprofiletester client
+client SendMessage
+delete client
+[Endtest]
+
+[Test]
+title BasicMsgOperations
+create popimapprofiletester client
+client BasicMsgOperations
+delete client
+[Endtest]
+
+[Test]
+title CopyMoveMsgs
+create popimapprofiletester client
+client CopyMoveMsgs
+delete client
+[Endtest]
+
+[Test]
+title Search
+create popimapprofiletester client
+client Search
+delete client
+[Endtest]
+
+[Test]
+title AttachmentHandling
+create popimapprofiletester client
+client AttachmentHandling
+delete client
+[Endtest]
+
+[Test]
+title Branding
+create popimapprofiletester client
+client Branding _isBranded: true
+delete client
+[Endtest]
+
+[Test]
+title DeleteMsgs
+create popimapprofiletester client
+client DeleteMsgs _folder: Inbox
+delete client
+[Endtest]
+
+[Test]
+title RemoveAccount
+create popimapprofiletester client
+client RemoveAccount
+delete client
+[Endtest]
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/eabi/popimapprofiletesteru.def Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+ _Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+ _ZTI13CTimeoutTimer @ 2 NONAME
+ _ZTV13CTimeoutTimer @ 3 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/group/bld.inf Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* ============================================================================
+* Name : bld.inf
+* Part of : ipsservices / tsrc
+* Description : Build information file for tsrc subprojects
+* Version : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+*
+* Copyright ?2010-2010 Nokia and/or its subsidiary(-ies). All rights reserved.
+* This material, including documentation and any related computer
+* programs, is protected by copyright controlled by Nokia. All
+* rights are reserved. Copying, including reproducing, storing,
+* adapting or translating, any or all of this material requires the
+* prior written consent of Nokia. This material also contains
+* confidential information which may not be disclosed to others
+* without the prior written consent of Nokia.
+* ============================================================================
+*/
+
+#include <platform_paths.hrh>
+PRJ_PLATFORMS
+DEFAULT
+
+//--------------------
+PRJ_TESTEXPORTS
+//--------------------
+
+../conf/imapprofiletester.cfg /epoc32/winscw/c/testframework/popimapprofiletester/imapprofiletester.cfg
+../conf/popprofiletester.cfg /epoc32/winscw/c/testframework/popimapprofiletester/popprofiletester.cfg
+../conf/imapprofiletester.cfg /epoc32/data/z/system/data/testframework/popimapprofiletester/imapprofiletester.cfg
+../conf/popprofiletester.cfg /epoc32/data/z/system/data/testframework/popimapprofiletester/popprofiletester.cfg
+
+../init/popimapprofiletester.ini /epoc32/winscw/c/testframework/testframework.ini
+../init/popimapprofiletester.ini /epoc32/data/z/system/data/testframework/testframework_ips.ini
+
+//--------------------
+PRJ_TESTMMPFILES
+//--------------------
+
+popimapprofiletester.mmp
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/group/popimapprofiletester.mmp Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright ?2010-2010 Nokia and/or its subsidiary(-ies). All rights reserved.
+* This material, including documentation and any related computer
+* programs, is protected by copyright controlled by Nokia. All
+* rights are reserved. Copying, including reproducing, storing,
+* adapting or translating, any or all of this material requires the
+* prior written consent of Nokia. This material also contains
+* confidential information which may not be disclosed to others
+* without the prior written consent of Nokia.
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MMP file for STIF Test Framework's TestScripter
+* testclass test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET popimapprofiletester.dll
+TARGETTYPE dll
+UID 0x1000008D 0x101FB3E9
+
+CAPABILITY ALL -TCB
+
+// VENDORID 0x00000000
+// SECUREID 0x00000000
+
+DEFFILE popimapprofiletester.def
+
+USERINCLUDE ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+
+SYSTEMINCLUDE /epoc32/include /epoc32/include/platform /epoc32/include/platform/loc /epoc32/include/platform/loc/sc /epoc32/include/app /epoc32/include/mw
+
+USERINCLUDE ..\inc
+USERINCLUDE \sf\app\commonemail\inc
+
+SOURCEPATH ../src
+
+SOURCE popimapprofiletester.cpp
+SOURCE popimapprofiletesterBlocks.cpp
+SOURCE timeouttimer.cpp
+
+LIBRARY euser.lib
+LIBRARY stiftestinterface.lib
+LIBRARY stiftestengine.lib
+LIBRARY imcm.lib // CEmailAccounts
+
+// For creating mailboxes
+LIBRARY FSMailFramework.lib
+LIBRARY FSFWCommonLib.lib
+LANG SC
+
+// Library to be tested
+
+
+// Other Libraries needed
+LIBRARY centralrepository.lib
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/group/popimapprofiletester.pkg Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,38 @@
+; ============================================================================
+; Name : ipsprofiletester.pkg
+; Part of : ips / popimapprofiletester
+; Description : Package file for project mfeprofiletester
+; Version : %version: % << Don't touch! Updated by Synergy at check-out.
+;
+; Copyright 2010-2010 Nokia and/or its subsidiary(-ies). All rights reserved.
+; This material, including documentation and any related computer
+; programs, is protected by copyright controlled by Nokia. All
+; rights are reserved. Copying, including reproducing, storing,
+; adapting or translating, any or all of this material requires the
+; prior written consent of Nokia. This material also contains
+; confidential information which may not be disclosed to others
+; without the prior written consent of Nokia.
+; ============================================================================
+&EN
+
+; standard SIS file header
+#{"ipsprofiletester"},(0x101FB3E9),0,0,0,TYPE=SA
+
+;Supports S60 v 5.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+;Localised Vendor name
+%{"Symbian"}
+
+;Unique Vendor name
+:"Symbian"
+
+"\epoc32\release\armv5\urel\popimapprofiletester.dll" -"!:\sys\bin\popimapprofiletester.dll"
+
+; PRJ_TESTEXPORTS
+
+"..\conf\imapprofiletester.cfg" -"!:\testframework\popimapprofiletester\imapprofiletester.cfg"
+"..\conf\popprofiletester.cfg" -"!:\testframework\popimapprofiletester\popprofiletester.cfg"
+"..\init\popimapprofiletester.ini" -"!:\testframework\testframework_ips.ini"
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/inc/popimapprofiletester.h Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,324 @@
+/*
+ * Copyright ?2010-2010 Nokia and/or its subsidiary(-ies). All rights reserved.
+ * This material, including documentation and any related computer
+ * programs, is protected by copyright controlled by Nokia. All
+ * rights are reserved. Copying, including reproducing, storing,
+ * adapting or translating, any or all of this material requires the
+ * prior written consent of Nokia. This material also contains
+ * confidential information which may not be disclosed to others
+ * without the prior written consent of Nokia.
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: STIF testclass declaration
+ *
+ */
+
+#ifndef POPIMAPPROFILETESTER_H
+#define POPIMAPPROFILETESTER_H
+
+// INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+#include <cemailaccounts.h>
+#include <centralrepository.h>
+
+//cmail side
+#include "cfsmailbox.h" //for cmail observer
+#include "cfsmailclient.h"
+#include "cfsmailcommon.h" //for cmail common flags
+#include "timeouttimer.h" //for timeout timer
+#include "baseplugincommonutils.h" //for cleanup
+#include "FreestyleEmailCenRepKeys.h"
+#include "../../../ipssossettings/inc/ipssetwizardsettingscenrepkeys.h"
+
+#include "mfsmaileventobserver.h"
+#include "mfsmailrequestobserver.h"
+#include "mfsmailboxsearchobserver.h"
+
+// CONSTANTS
+#define KIPSSosImap4PluginUid 0x2000e53f
+#define KIPSSosPop3PluginUid 0x2000e53e
+
+const TUint KTenSecondsTime(10);
+const TUint KHalfMinuteTime(30);
+const TUint KOneMinuteTime(60);
+
+// MACROS
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+#define DELANDNULL( a ) { if( a ) { delete a; a = NULL; } }
+
+class CPopImapProfileTester;
+class CTimeoutTimer;
+class CFSMailClient;
+class CFSMailBox;
+class CActiveSchedulerWait;
+
+enum TWaitingState
+ {
+ EWaitingNothing = 0,
+ EWaitingEvent,
+ EWaitingResponse,
+ EWaitingSearchComplete,
+ };
+
+class TAccountSetting
+ {
+public:
+ //Other TInt values
+ // amount of accounts configured
+ TInt iAccountsConfigured;
+ // maximum accounts reached 1 = yes, 0 = no
+ TInt iMaxAccountsReached;
+ // protocol 0= POP, 1= IMAP //-->imap
+ TInt iProtocolIndicator;
+ // Incoming security auth 0 = no, 1 = yes
+ TInt iIncomingSecurityAuth;
+ // Incoming security protocol (0 = OFF, 1 = StartTLS, 2 = SSL/TLS)
+ TInt iIncomingSecurityProtocol;
+ // Outgoing security auth 0 = no, 1 = yes
+ TInt iOutgoingSecurityAuth;
+ // Outgoing security protocol (0 = OFF, 1 = StartTLS, 2 = SSL/TLS)
+ TInt iOutgoingSecurityProtocol;
+ // Operators security auth 0 = no, 1 = yes
+ TInt iOperatorSecurityAuth;
+ // Operators Security protocol (0 = OFF, 1 = StartTLS, 2 = SSL/TLS)
+ TInt iOperatorSecurityProtocol;
+ // Operators outgoing port number
+ TInt iOperatorPort;
+
+ TInt iIncomingPort;
+ TInt iOutgoingPort;
+
+ TBuf<10> iAccountType;
+ TBuf<50> iEmailAddress;
+ TBuf<50> iUserName;
+ TBuf<100> iPassWord;
+ TBuf<50> iIncomingServer;
+ TBuf<50> iOutgoingServer;
+ TBuf<20> iMailboxName;
+
+ /****
+ * Using the default value
+ */
+ TBuf<5> iWizardAccountType;
+ TBuf<2> iOperatorOutgoingServer;
+ TBool iHideUserNameInSetting;
+ TBuf<10> iAccessPoint;
+ };
+
+NONSHARABLE_CLASS(CPopImapProfileTester) : public CScriptBase,
+ public MFSMailEventObserver,
+ public MFSMailRequestObserver,
+ public MFSMailBoxSearchObserver,
+ public MTimeoutObserver
+
+ {
+public:
+ // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CPopImapProfileTester* NewL(CTestModuleIf& aTestModuleIf);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CPopImapProfileTester();
+
+public:
+ // New functions
+
+
+public:
+ // Functions from base classes
+
+ /**
+ * From CScriptBase Runs a script line.
+ * @since
+ * @param aItem Script line containing method name and parameters
+ * @return Symbian OS error code
+ */
+ virtual TInt RunMethodL(CStifItemParser& aItem);
+
+ // from MFSMailEventObserver
+ void EventL(TFSMailEvent aEvent, TFSMailMsgId aMailbox, TAny* aParam1,
+ TAny* aParam2, TAny* aParam3);
+
+ // from MFSMailRequestObserver
+ void RequestResponseL(TFSProgress aEvent, TInt aRequestId);
+
+ // from MFSMailBoxSearchObserver
+ void MatchFoundL(CFSMailMessage* aMatchMessage);
+ void SearchCompletedL();
+ void ClientRequiredSearchPriority(TInt *apRequiredSearchPriority);
+
+ //from MTimeoutObserver
+ void TimeoutNotify();
+
+protected:
+ // New functions
+
+
+protected:
+ // Functions from base classes
+
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CPopImapProfileTester(CTestModuleIf& aTestModuleIf);
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ /**
+ * Frees all resources allocated from test methods.
+ * @since
+ */
+ void Delete();
+
+ // _______________________ Test Methods __________________________
+
+ // Ordinary test cases
+ TInt SetupAccountL(CStifItemParser& /* aItem */);
+ TInt GoOnlineL(CStifItemParser& /* aItem */);
+ TInt GoOfflineL(CStifItemParser& /* aItem */);
+ TInt RefreshNowL(CStifItemParser& /* aItem */);
+ TInt CancelSyncL(CStifItemParser& /* aItem */);
+ TInt ListStandardFoldersL(CStifItemParser& /* aItem */);
+
+ // list folders from all mailboxes
+ TInt ListFoldersL(CStifItemParser& /* aItem */);
+ // lists messages in folders of each found mailbox
+ TInt ListMessagesL(CStifItemParser& /* aItem */);
+ // Fetch the specified messages
+ TInt FetchMessagesL(CStifItemParser& /* aItem */);
+ // Send out a mail
+ TInt SendMessageL(CStifItemParser& /* aItem */);
+ // Basic operation of user for creating email
+ TInt BasicMsgOperationsL(CStifItemParser& /* aItem */);
+ // Copy or move message between folders
+ TInt CopyMoveMsgsL(CStifItemParser& /* aItem */);
+ // Search data from messages
+ TInt SearchL(CStifItemParser& /* aItem */);
+ // Add a attachment to new email
+ TInt AttachmentHandlingL(CStifItemParser& /* aItem */);
+ // check if the mailbox is a nokia branding one.
+ TInt BrandingL(CStifItemParser& /* aItem */);
+ // Delete message from Inbox
+ TInt DeleteMsgsL(CStifItemParser& /* aItem */);
+ //remove mailbox
+ TInt RemoveAccountL(CStifItemParser& /* aItem */);
+
+ /**
+ * Method used to log version of test class
+ */
+ void SendTestClassVersion();
+
+ CFSMailMessage* CreatePlainTextMsgL(const TDesC& aSubject,
+ const TDesC& aMsgText);
+ TInt MoveMessageToFolderL(CFSMailMessage& aMsg, TFSFolderType aFolderType);
+
+ TInt GetMessagesFromFolderL(RPointerArray<CFSMailMessage>& aMessages,
+ CFSMailFolder* aFolder, TFSMailDetails aDet,
+ TFSMailSortField aSort, TUint aCount);
+
+ TInt WaitForEvent(TFSMailEvent aWaitedEvent, TAny *aEventParam1 = NULL,
+ TAny *aEventParam2 = NULL, TInt aTimeout = 60);
+
+ TInt WaitForResponse(TFSProgress::TFSProgressStatus aWaitedResponse,
+ TInt aTimeout = 60);
+
+ void OpComplete();
+
+ TInt InitMailboxL();
+
+ TInt DeleteTestMsgL(TDesC& aFolderName);
+ TInt ReadAccountSettings(TAccountSetting& aAccountSetting);
+
+ TInt WriteToWizardCRL(TAccountSetting aAccountSetting);
+
+ void LogEvent(const TDesC& aLogText, TFSMailEvent aEvents, TAny* aParam1,
+ TAny* aParam2, TAny* /*aParam3*/);
+ void LogTFSProgress(const TDesC& aLogText,
+ const TFSProgress::TFSProgressStatus aProgress, TInt aReqId);
+
+ void LogTSSMailSyncState(const TDesC& aLogText,
+ const TSSMailSyncState aState);
+
+ TInt DoSearch(const RPointerArray<TDesC>& aSearchStrings,
+ const TFSMailSortCriteria& aSortCriteria, TInt aTimeout);
+
+ TInt SendMsgL(CFSMailMessage& aMsg, const TDesC &aSubject,
+ TFSMailMsgId& aGotMsgId);
+
+ TInt GetFolderNameFromId(TFSMailMsgId aFolderId, TDes& aFolderName);
+
+ TFSMailMsgId GetFolderIdFromName(const TDesC& aFolderName);
+
+ TBool ParseEventParams(TAny *aEventParam1, TAny *aEventParam2);
+
+ CFSMailFolder* FindFolder(const TDesC& aFolderName);
+
+public:
+ // Data
+
+
+protected:
+ // Data
+
+
+private:
+ // Data
+ TBool iEventSynchronousCall;
+ CFSMailClient* iMailClient;
+
+ CFSMailBox* iIPSMailbox;
+
+ //variables for mfsMailEvent
+ TBool iTimeout;
+ TInt iErr;
+
+ CTimeoutTimer* iTimeoutTimer;
+ TFSMailEvent iCurrWaitedEvent;
+ TAny* iEventParam1;
+ TAny* iEventParam2;
+
+ TFSProgress::TFSProgressStatus iCurrWaitedResponse;
+
+ //OWN: Active scheduler wait and Cb received indication
+ CActiveSchedulerWait* iWait;
+ TWaitingState iWaitingState;
+ TFSMailMsgId iPluginId;
+
+ //checking status of searching
+ TBool iSearchOngoing;
+ TInt iSearchMatches;
+
+public:
+ // Friend classes
+
+protected:
+ // Friend classes
+
+private:
+ // Friend classes
+
+
+ };
+
+#endif // POPIMAPPROFILETESTER_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/inc/timeouttimer.h Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,65 @@
+/*
+ * ============================================================================
+ * Name : timeouttimer.h
+ * Part of : ipsservice / profiletester
+ * Description : timer implementation
+ * Version : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+ *
+ * Copyright ©2010-2010 Nokia and/or its subsidiary(-ies). All rights reserved.
+ * This material, including documentation and any related computer
+ * programs, is protected by copyright controlled by Nokia. All
+ * rights are reserved. Copying, including reproducing, storing,
+ * adapting or translating, any or all of this material requires the
+ * prior written consent of Nokia. This material also contains
+ * confidential information which may not be disclosed to others
+ * without the prior written consent of Nokia.
+ * ============================================================================
+ */
+
+#ifndef C_TIMEOUTTIMER_H
+#define C_TIMEOUTTIMER_H
+
+#include <e32base.h>
+#include <e32std.h>
+class MTimeoutObserver;
+
+/**
+ * TimeoutObserver
+ * Api for timeout observers
+ */
+class MTimeoutObserver
+ {
+
+public:
+ virtual void TimeoutNotify() = 0;
+
+ };
+
+class CTimeoutTimer : protected CTimer
+ {
+public:
+
+ static CTimeoutTimer* NewL(MTimeoutObserver& aHandle);
+ static CTimeoutTimer* NewLC(MTimeoutObserver& aHandle);
+ void Start(TInt aTimePeriod);
+ void Stop();
+ virtual ~CTimeoutTimer();
+
+protected:
+
+ // from CTimer
+ void RunL();
+ TInt RunError(TInt aError);
+
+private:
+
+ CTimeoutTimer(MTimeoutObserver& aHandle);
+ void ConstructL();
+
+private:
+
+ // timetout notifier handle
+ MTimeoutObserver& iNotifyHandle;
+ };
+
+#endif // C_TIMEOUTTIMER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/init/popimapprofiletester.ini Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,45 @@
+[Engine_Defaults]
+TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment',
+ 'TestCases' or 'FullReport'
+
+CreateTestReport= YES # Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= PopImapProfileTestReport
+
+TestReportFormat= TXT # Possible values: TXT or HTML
+TestReportOutput= FILE # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= APPEND # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+[End_Defaults]
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+
+CreateLogDirectories= YES # Possible values: YES or NO
+
+EmulatorBasePath= C:
+EmulatorFormat= TXT # Possible values: TXT or HTML
+EmulatorOutput= FILE # Possible values: FILE or RDEBUG
+
+HardwareBasePath= C:
+HardwareFormat= TXT # Possible values: TXT or HTML
+HardwareOutput= FILE # Possible values: FILE or RDEBUG
+
+FileCreationMode= APPEND # Possible values: OVERWRITE or APPEND
+
+ThreadIdToLogFile= YES # Possible values: YES or NO
+WithTimeStamp= YES # Possible values: YES or NO
+WithLineBreak= YES # Possible values: YES or NO
+WithEventRanking= YES # Possible values: YES or NO
+[End_Logger_Defaults]
+
+[New_Module]
+ModuleName= TestScripter
+TestCaseFile= c:\testframework\popimapprofiletester\imapprofiletester.cfg
+TestCaseFile= c:\testframework\popimapprofiletester\popprofiletester.cfg
+[End_Module]
+
+# End of file
\ No newline at end of file
Binary file ipsservices/tsrc/profiletester/sis/S60/RDTest_02.der has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/sis/S60/RDTest_02.key Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQC/TDP7KKIaf5+uW4OD2iVZuUMC2a+SeQTjf6srlKcOm+CpPNXn
+uLNm/8fdEnyOIuRXPRKmqhs1n0JkxEGHynELWMTuKXbQx9SRAGUXzyneGn+IJNnO
+vOKHWgKCouX2hfI8rtkdqJpqmO460gGsMgw+lsbeyWyW9lnfLxq+ZC7sqQIDAQAB
+AoGBALmUWZE8GBaQ3P4u9WUCSd3DJkkrmXIFSULSZeH/chlwCwDjbbhArHothVzo
+REE3hEFFlERvHbplZ+mNouzy7boduvgUzbksGrbGMLJ2qO1GzWWVwV+GzOWKd3ss
+/98Gwoy5R8pjnkqUE2wP1iJFw0FjvUTKcYv/z6t3LLJ0CsoBAkEA+c7ixvsviQ3J
+s0INytCKU2bf8fqFQJi1VI82ukxNsujGTQ9upVSjuvqPvWyDvvTdrUBHqO+3qPut
+sEh01Q8aiQJBAMQKDJPVRu4ud3mwUfEavzL5EjqwG1k9VCNGYsT4FwtrHcxu1oP/
+pk6M3rIZukqomoEEnHWPMwhrK3fhBqi0OSECQQDr40VXege4FnH5OI2Hj4afHMyp
+VdQQXGMWFyopnzXblFz0lXb43cTCIiorR9XcMqNFHybLypkWE5o+lRzlt55pAkBQ
+P/zeF5Sts//cpL0mgdh7OVKpC6ZmZaCnwAx2rUhhuDu+kDDoYCLoTOps5fNI1LRK
+1GRoC3LMo3Jr5IYhUYWBAkBpCpN6k4JU/mszq98EojHerQNxk8sPqvQKUzTutohT
+1gLX9yepGayB/TtT2EEJDkWOlnTy/dvN6W3vzbJYz97x
+-----END RSA PRIVATE KEY-----
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/sis/createSisx.bat Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,3 @@
+makesis ..\group\popimapprofiletester.pkg
+signsis ..\group\popimapprofiletester.sis popimapprofiletester.sisx S60\RDTest_02.der S60\RDTest_02.key
+del ..\group\popimapprofiletester.sis
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/src/popimapprofiletester.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,1611 @@
+/* ============================================================================
+ * Name : popimapprofiletester.cpp
+ * Part of : ipsservices / ipsprofiletester
+ * Description :: STIF test cases
+ * Version : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+ *
+ * Copyright © 2010-2010 Nokia and/or its subsidiary(-ies). All rights reserved.
+ * This material, including documentation and any related computer
+ * programs, is protected by copyright controlled by Nokia. All
+ * rights are reserved. Copying, including reproducing, storing,
+ * adapting or translating, any or all of this material requires the
+ * prior written consent of Nokia. This material also contains
+ * confidential information which may not be disclosed to others
+ * without the prior written consent of Nokia.
+ * ============================================================================
+ */
+
+// INCLUDE FILES
+#include <StifTestInterface.h>
+#include "popimapprofiletester.h"
+#include <SettingServerClient.h>
+/*
+ * define flag in ctg file
+ */
+_LIT( KSetupWizAccountType,"AccountType" );
+_LIT( KSetupWizAccountsConfigured,"AccountsConfigured" );
+_LIT( KSetupWizMaxAccountsReached,"MaxAccountsReached" );
+_LIT( KSetupWizEmailAddress,"EmailAddress" );
+_LIT( KSetupWizUsername,"Username" );
+_LIT( KSetupWizPassword,"Password" );
+_LIT( KSetupWizMailboxName,"MailboxName" );
+_LIT( KSetupWizIncomingServer,"IncomingServer" );
+_LIT( KSetupWizIncomingPort,"IncomingPort" );
+_LIT( KSetupWizOutgoingServer,"OutgoingServer" );
+_LIT( KSetupWizOutgoingPort,"OutgoingPort" );
+_LIT( KSetupWizIncomingSecurityAuth,"IncomingSecurityAuth" );
+_LIT( KSetupWizIncomingSecurityProtocol,"IncomingSecurityProtocol" );
+_LIT( KSetupWizOutgoingSecurityAuth,"OutgoingSecurityAuth" );
+_LIT( KSetupWizOutgoingSecurityProtocol,"OutgoingSecurityProtocol" );
+_LIT( KSetupWizOperatorSecurityAuth,"OperatorSecurityAuth" );
+_LIT( KSetupWizOperatorSecurityProtocol,"OperatorSecurityProtocol" );
+_LIT( KSetupWizOperatorPort,"OperatorPort" );
+_LIT(KProfileTesterDLL,"popimapprofiletester.dll");
+_LIT(KAccountType,"AccountType");
+_LIT(KIMAPAccount,"imap");
+_LIT(KPOPAccount,"pop");
+_LIT(KInboxType,"inbox");
+_LIT(KOutboxType,"outbox");
+_LIT(KDraftsType,"drafts");
+_LIT(KSentType,"sent");
+// Logging path
+_LIT( KpopimapprofiletesterLogPath, "\\logs\\testframework\\popimapprofiletester\\" );
+// Log file
+_LIT( KpopimapprofiletesterLogFile, "popimapprofiletester.txt" );
+_LIT( KpopimapprofiletesterLogFileWithTitle, "popimapprofiletester_[%S].txt" );
+/*
+ * default value for settings
+ */
+_LIT( KWizAccountTypeDefault,"fsp" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::CPopImapProfileTester
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPopImapProfileTester::CPopImapProfileTester(CTestModuleIf& aTestModuleIf) :
+ CScriptBase(aTestModuleIf), iTimeoutTimer(NULL), iMailClient(NULL),
+ iIPSMailbox(NULL), iTimeout(EFalse), iEventParam1(NULL),
+ iEventParam2(NULL), iEventSynchronousCall(EFalse), iErr(KErrNone),
+ iWaitingState(EWaitingNothing), iPluginId(TFSMailMsgId()),
+ iSearchOngoing(EFalse), iSearchMatches(NULL)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPopImapProfileTester::ConstructL()
+ {
+ //Read logger settings to check whether test case name is to be
+ //appended to log file name.
+ RSettingServer settingServer;
+ TInt ret = settingServer.Connect();
+ if (ret != KErrNone)
+ {
+ User::Leave(ret);
+ }
+ // Struct to StifLogger settigs.
+ TLoggerSettings loggerSettings;
+ // Parse StifLogger defaults from STIF initialization file.
+ ret = settingServer.GetLoggerSettings(loggerSettings);
+ if (ret != KErrNone)
+ {
+ User::Leave(ret);
+ }
+ // Close Setting server session
+ settingServer.Close();
+
+ TFileName logFileName;
+
+ if (loggerSettings.iAddTestCaseTitle)
+ {
+ TName title;
+ TestModuleIf().GetTestCaseTitleL(title);
+ logFileName.Format(KpopimapprofiletesterLogFileWithTitle, &title);
+ }
+ else
+ {
+ logFileName.Copy(KpopimapprofiletesterLogFile);
+ }
+
+ iLog = CStifLogger::NewL(KpopimapprofiletesterLogPath, logFileName,
+ CStifLogger::ETxt, CStifLogger::EFile, EFalse);
+
+ SendTestClassVersion();
+
+ iWait = new (ELeave) CActiveSchedulerWait();
+ iTimeoutTimer = CTimeoutTimer::NewL(*this);
+
+ // create a mail client
+ iMailClient = CFSMailClient::NewL();
+ if (iMailClient)
+ {
+ iMailClient->AddObserverL(*this);
+ iLog->Log(_L( "Mail Client was created" ));
+ }
+ else
+ {
+ iLog->Log(_L( "ERROR: Mail Client not created" ));
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPopImapProfileTester* CPopImapProfileTester::NewL(CTestModuleIf& aTestModuleIf)
+ {
+ CPopImapProfileTester* self = new (ELeave) CPopImapProfileTester(
+ aTestModuleIf);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+
+ }
+
+// Destructor
+CPopImapProfileTester::~CPopImapProfileTester()
+ {
+ // Delete resources allocated from test methods
+ Delete();
+ if (iMailClient)
+ {
+ if (NULL != iIPSMailbox)
+ {
+ iMailClient->UnsubscribeMailboxEvents(iIPSMailbox->GetId(), *this);
+ delete iIPSMailbox;
+ iIPSMailbox = NULL;
+ }
+ iMailClient->Close();
+ }
+ DELANDNULL(iTimeoutTimer);
+
+ // Delete logger
+ DELANDNULL(iLog);
+
+ //Delete waiter
+ if (NULL != iWait && iWait->IsStarted())
+ {
+ iWait->AsyncStop();
+ }
+ DELANDNULL(iWait);
+ }
+
+//-----------------------------------------------------------------------------
+// CPopImapProfileTester::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CPopImapProfileTester::SendTestClassVersion()
+ {
+ TVersion moduleVersion;
+ moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+ moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+ moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+
+ TFileName moduleName;
+ moduleName = KProfileTesterDLL;
+
+ TBool newVersionOfMethod = ETrue;
+ TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName,
+ newVersionOfMethod);
+ }
+//-----------------------------------------------------------------------------
+// CPopImapProfileTester::DeleteTestMsgL
+// Method used to delete msgs in a specific folder
+//-----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::DeleteTestMsgL(TDesC& aFolderName)
+ {
+ TInt err(KErrNone);
+ TInt msgCount(0); //number of messages in folder
+
+ // Step 01: to find a folder
+ CFSMailFolder* folder = FindFolder(aFolderName);
+ RArray<TFSMailMsgId> msgsToBeDeleted;
+ CleanupClosePushL(msgsToBeDeleted);
+
+ if (NULL != folder)
+ {
+ // Step 02: to list all test messages to be deleted from this folder
+ RPointerArray<CFSMailMessage> messages;
+ TInt gotMsgs = GetMessagesFromFolderL(messages, folder,
+ EFSMsgDataSubject, EFSMailSortByDate, msgCount);
+
+ // Step 03: to find to be deleted msgs
+ for (TInt i = 0; i < messages.Count(); i++)
+ {
+ //deleted msgs with STIF
+ if (messages[i]->GetSubject().Find(_L("STIF" )) != KErrNotFound)
+ {
+ iLog->Log(_L("Found: %d. %S"), i + 1,
+ &messages[i]->GetSubject());
+ msgsToBeDeleted.Append(messages[i]->GetMessageId());
+ }
+ }//end loop: 'for'
+
+ if (msgsToBeDeleted.Count() > 0)
+ {
+ iLog->Log(_L(" -Deleting %d message(s)"), msgsToBeDeleted.Count());
+ iMailClient->DeleteMessagesByUidL(iIPSMailbox->GetId(),
+ folder->GetFolderId(), msgsToBeDeleted);
+ err = WaitForEvent(TFSEventMailDeleted, NULL, NULL, KOneMinuteTime);
+ iIPSMailbox->RefreshNowL(*this);
+ if (KErrNone == WaitForEvent(TFSEventMailboxOnline))
+ {
+ WaitForResponse(TFSProgress::EFSStatus_RequestComplete,
+ KHalfMinuteTime);
+ }
+ }//end if: 'count()>0'
+ else
+ {
+ iLog->Log(_L("Not find messages(STIF) to delete"));
+ err = KErrNotFound;
+ }
+ messages.ResetAndDestroy();
+ }// end if 'inboxFolder'
+ else
+ {
+ err = KErrNotFound;
+ iLog->Log(_L(" %S is NOT found.(Error's ID:%d)"), &aFolderName, err);
+ }
+ CleanupStack::PopAndDestroy(&msgsToBeDeleted);
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::FindFoler
+// Method used to find a folder with folder's name
+// -----------------------------------------------------------------------------
+CFSMailFolder* CPopImapProfileTester::FindFolder(const TDesC& aFolderName)
+ {
+ CFSMailFolder* folder(NULL);
+ RPointerArray<CFSMailFolder>& allFolders = iIPSMailbox->ListFolders();
+
+ TFSMailMsgId folderId = GetFolderIdFromName(aFolderName);
+ for (TInt i = 0; i < allFolders.Count(); ++i)
+ {
+ if (allFolders[i]->GetFolderId() == folderId)
+ {
+ iLog->Log(_L("Found: %S folder"), &allFolders[i]->GetFolderName());
+ folder = allFolders[i];
+ break;
+ }
+ }
+ return folder;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::GetMessagesFromFolderL
+// Method used to get messages from specific folder
+// -----------------------------------------------------------------------------
+TInt CPopImapProfileTester::GetMessagesFromFolderL(
+ RPointerArray<CFSMailMessage>& aMessages, CFSMailFolder* aFolder,
+ TFSMailDetails aDet, TFSMailSortField aSort, TUint aCount)
+ {
+ TFSMailSortCriteria sortCriteria;
+ sortCriteria.iField = aSort;
+ sortCriteria.iOrder = EFSMailDescending; // default sort order: Descending
+
+ RArray<TFSMailSortCriteria> sorting;
+ CleanupClosePushL(sorting);
+
+ // append primary criteria
+ sorting.Append(sortCriteria);
+
+ MFSMailIterator* iterator = aFolder->ListMessagesL(aDet, sorting);
+ CleanupStack::PopAndDestroy(&sorting);
+ CleanupDeletePushL(iterator);
+
+ TInt messageCount = aFolder->GetMessageCount();
+ iLog->Log(_L(" %d message(s) in '%S'"), messageCount,
+ &aFolder->GetFolderName());
+
+ if (aCount > 0)
+ {
+ if (messageCount < aCount)
+ {
+ aCount = messageCount;
+ }
+ }
+ else
+ {
+ aCount = messageCount;
+ }
+
+ iterator->NextL(TFSMailMsgId(), aCount, aMessages);
+ CleanupStack::PopAndDestroy(iterator);
+ return aCount;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::EventL
+// from MFSMailEventObserver
+// -----------------------------------------------------------------------------
+//
+void CPopImapProfileTester::EventL(TFSMailEvent aEvent,
+ TFSMailMsgId /*aMailbox*/, TAny* aParam1, TAny* aParam2, TAny* aParam3)
+ {
+ LogEvent(_L("Receive Event->"), aEvent, aParam1, aParam2, aParam3);
+ if ((aEvent == iCurrWaitedEvent) && (iWait->IsStarted()) && (iWaitingState
+ == EWaitingEvent) && ParseEventParams(aParam1, aParam2))
+ OpComplete();
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::RequestResponseL
+// from MFSMailRequestObserver
+// It proivdes progress/status information of requested functions
+// i.e. DeleteMailBoxByUidL, RefreshNowL
+// -----------------------------------------------------------------------------
+//
+void CPopImapProfileTester::RequestResponseL(TFSProgress aEvent,
+ TInt aRequestId)
+ {
+ LogTFSProgress(_L("Receive Response->"), aEvent.iProgressStatus, aRequestId);
+ if ((aEvent.iProgressStatus == iCurrWaitedResponse) && (iWaitingState
+ == EWaitingResponse) && (iWait->IsStarted()))
+ OpComplete();
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::MatchFoundL
+// from MFSMailBoxSearchObserver
+// -----------------------------------------------------------------------------
+//
+void CPopImapProfileTester::MatchFoundL(CFSMailMessage* aMatchMessage)
+ {
+ TBuf<20> tempFolderName;
+ GetFolderNameFromId(aMatchMessage->GetFolderId(), tempFolderName);
+ TPtrC folderName = tempFolderName.Mid(0);
+ iLog->Log(_L(" MatchFound %S in %S"), &aMatchMessage->GetSubject(),
+ &folderName);
+ if (iSearchOngoing)
+ {
+ iSearchMatches++;
+ }
+ delete aMatchMessage;
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::SearchCompletedL
+// from MFSMailBoxSearchObserver
+// -----------------------------------------------------------------------------
+//
+void CPopImapProfileTester::SearchCompletedL()
+ {
+ if (iWait->IsStarted())
+ {
+ OpComplete();
+ iLog->Log(_L(" SearchCompleted"));
+ }
+ else
+ {
+ iLog->Log(_L("Error: SearchCompleted callback"));
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::ClientRequiredSearchPriority
+// from MFSMailBoxSearchObserver
+// -----------------------------------------------------------------------------
+//
+void CPopImapProfileTester::ClientRequiredSearchPriority(TInt* /*apRequiredSearchPriority*/)
+ {
+ iLog->Log(_L(" ClientRequiredSearchPriority"));
+ }
+
+void CPopImapProfileTester::TimeoutNotify()
+ {
+ iTimeout = ETrue;
+ OpComplete();
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::SendMsgL
+// Method is a actual sending message function.
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::SendMsgL(CFSMailMessage& aMsg,
+ const TDesC &aSubject, TFSMailMsgId& aGotMsgId)
+ {
+ TInt err(KErrNone);
+ TInt msgCount(0);
+
+ //to call actual function to send message
+ TRAP( err, iIPSMailbox->SendMessageL( aMsg ) );
+
+ //second asynchronous when moving msg from Outbox to Sent Items ( this actually tells msg was sent )
+ if (KErrNone == err)
+ {
+ //Wait for email to be sent
+ TFSMailMsgId folderId = iIPSMailbox->GetStandardFolderId(EFSSentFolder);
+ iIPSMailbox->RefreshNowL();
+ err = WaitForEvent(TFSEventMailMoved, NULL, &folderId);
+ iIPSMailbox->GoOfflineL();
+ WaitForEvent(TFSEventMailboxOffline);
+ iIPSMailbox->RefreshNowL(*this);
+ WaitForResponse(TFSProgress::EFSStatus_RequestComplete);
+
+ if (KErrNone == err)
+ {
+ // Step04: To check 'Inbox' folder to sure message sent
+ TFSMailMsgId folderId = iIPSMailbox->GetStandardFolderId(EFSInbox);
+ CFSMailFolder* folder = iMailClient->GetFolderByUidL(
+ iIPSMailbox->GetId(), folderId);
+ CleanupStack::PushL(folder);
+ if (NULL != folder)
+ {
+ RPointerArray<CFSMailMessage> messages;
+ TInt gotMsgs = GetMessagesFromFolderL(messages, folder,
+ EFSMsgDataSubject, EFSMailSortByDate, msgCount);
+ if (gotMsgs > 0)
+ {
+ iLog->Log(_L(" Listing first %d emails:"), gotMsgs);
+ for (TInt i = 0; i < messages.Count(); i++)
+ {
+ iLog->Log(_L("Found: %S"), &messages[i]->GetSubject());
+
+ if (messages[i]->GetSubject().Compare(aSubject) == 0)
+ {
+ iLog->Log(
+ _L("Success:Email '%S' sent to own mail address"),
+ &messages[i]->GetSubject());
+ aGotMsgId.SetPluginId(
+ messages[i]->GetMessageId().PluginId());
+ aGotMsgId.SetId(messages[i]->GetMessageId().Id());
+ err = KErrNone;
+ break;
+ }
+ else
+ {
+ err = KErrNotFound;
+ }
+ }//end loop: 'for'
+ }//end if 'msgCount'
+ else
+ {
+ err = KErrNotFound;
+ iLog->Log(_L("No message in %S folder"),
+ &folder->GetFolderName());
+ }
+ messages.ResetAndDestroy();
+ }//end if 'folder'
+ else
+ {
+ err = KErrNotFound;
+ iLog->Log(_L("Folder is NOT found.(Error's ID:%d)"), err);
+ }
+ CleanupStack::PopAndDestroy(folder);
+ }//end if: checking whether 'msg' sent or not
+ }//end if 'KErrNone == err'
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::DoSearch
+// Method used to launches SearchL and waits for completion
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::DoSearch(
+ const RPointerArray<TDesC>& aSearchStrings,
+ const TFSMailSortCriteria& aSortCriteria, TInt aTimeout)
+ {
+ TInt err(KErrNone);
+ if (iSearchOngoing)
+ {
+ iLog->Log(_L(" Error: Search in progress"));
+ err = KErrInUse;
+ }
+ else
+ {
+ iIPSMailbox->ClearSearchResultCache();
+ iSearchMatches = EFalse;
+ TRAP( err, iIPSMailbox->SearchL( aSearchStrings, aSortCriteria, *this ) );
+ if (KErrNone != err)
+ {
+ iLog->Log(_L(" Error: SearchL leaves with %d"), err);
+ }
+ else
+ {
+ iLog->Log(_L(" Searching for '%S':"), aSearchStrings[0]);
+ iSearchOngoing = ETrue;
+ iTimeoutTimer->Start(aTimeout * 1000000);
+ iWait->Start();
+ if (iTimeout)
+ {
+ iLog->Log(_L(" Error: Search not completed within %d sec"),
+ aTimeout);
+ err = KErrTimedOut;
+ }
+ else
+ {
+ iLog->Log(_L(" Search completed with %d result(s)"),
+ iSearchMatches);
+ err = KErrNone;
+ }
+ iSearchOngoing = EFalse;
+ }
+ }
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::WaitForEvent
+// Method used to wait incoming events from obsever
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::WaitForEvent(TFSMailEvent aWaitedEvent,
+ TAny *aEventParam1, TAny *aEventParam2, TInt aTimeout)
+ {
+ LogEvent(_L("Waiting for Event->"), aWaitedEvent, aEventParam1,
+ aEventParam2, NULL);
+ iWaitingState = EWaitingEvent;
+ iCurrWaitedEvent = aWaitedEvent;
+ iEventParam1 = aEventParam1;
+ iEventParam2 = aEventParam2;
+ iTimeoutTimer->Start(aTimeout * 1000000);
+ if (iWait->IsStarted() == EFalse)
+ {
+ iWait->Start();
+ iWaitingState = EWaitingNothing;
+ iEventParam1 = NULL;
+ iEventParam2 = NULL;
+ if (iTimeout)
+ {
+ iLog->Log(_L(" Operation is timeout over %d"), aTimeout);
+ iTimeout = EFalse;
+ return KErrTimedOut;
+ }
+ else
+ {
+ iTimeoutTimer->Stop();
+ return KErrNone;
+ }
+ }
+ else
+ {
+ iLog->Log(_L(" Stop the wait before start it"));
+ return KErrGeneral;
+ }
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::WaitForResponse
+// Method used to wait response from observer
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::WaitForResponse(
+ TFSProgress::TFSProgressStatus aWaitedResponse, TInt aTimeout)
+ {
+ LogTFSProgress(_L("Waiting for Response->"), aWaitedResponse, 0);
+ iWaitingState = EWaitingResponse;
+ iCurrWaitedResponse = aWaitedResponse;
+ iTimeoutTimer->Start(aTimeout * 1000000);
+ if (iWait->IsStarted() == EFalse)
+ {
+ iWait->Start();
+ iWaitingState = EWaitingNothing;
+ if (iTimeout)
+ {
+ iLog->Log(_L(" Operation is timeout over %d"), aTimeout);
+ iTimeout = EFalse;
+ return KErrTimedOut;
+ }
+ else
+ {
+ iTimeoutTimer->Stop();
+ return KErrNone;
+ }
+ }
+ else
+ return KErrGeneral;
+ }
+
+void CPopImapProfileTester::OpComplete()
+ {
+ if (iWait)
+ iWait->AsyncStop();
+ if (iTimeoutTimer)
+ iTimeoutTimer->Stop();
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::InitMailbox()
+// Method to initiate mailbxo, depends on type of account in .cfg file
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::InitMailboxL()
+ {
+ if (NULL != iIPSMailbox)
+ return KErrNone;
+
+ TBuf<10> accountType;
+
+ //to separate type of mailbox: 'imap or pop'
+ GetConstantValue(KAccountType, accountType);
+ accountType.TrimAll();
+ accountType.LowerCase();
+ if (accountType.Compare(KIMAPAccount) == 0)
+ iPluginId.SetPluginId(TUid::Uid(KIPSSosImap4PluginUid));
+ else if (accountType.Compare(KPOPAccount) == 0)
+ {
+ iPluginId.SetPluginId(TUid::Uid(KIPSSosPop3PluginUid));
+ }
+ else
+ {
+ iLog->Log(_L("Wrong mailbox type %S"), &accountType);
+ return KErrGeneral;
+ }
+
+ //to create mail
+ RPointerArray<CFSMailBox> mailboxes;
+ iMailClient->ListMailBoxes(iPluginId, mailboxes);
+ if (mailboxes.Count() > 0)
+ {
+ iIPSMailbox = iMailClient->GetMailBoxByUidL(mailboxes[0]->GetId());
+ //to subscribe mailbox's event,remember to unsubscribe
+ iMailClient->SubscribeMailboxEventsL(iIPSMailbox->GetId(), *this);
+ iLog->Log(_L("%S mailbox was found"), &accountType);
+ }
+ else
+ {
+ iLog->Log(_L("%S mailbox was not found"), &accountType);
+ }
+ mailboxes.ResetAndDestroy();
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::MoveMessageToFolderL
+// Method used to move messages to a specific folder
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::MoveMessageToFolderL(CFSMailMessage& aMsg,
+ TFSFolderType aFolderType)
+ {
+ // check if msg is not in given folder already
+ TInt err(KErrNone);
+ TFSMailMsgId folderId = iIPSMailbox->GetStandardFolderId(aFolderType);
+ TFSMailMsgId msgFolderId = aMsg.GetFolderId();
+ if (folderId != msgFolderId)
+ {
+ // move message
+ RArray<TFSMailMsgId> msgs;
+ CleanupClosePushL(msgs);
+ msgs.Append(aMsg.GetMessageId());
+ TRAP(err, iIPSMailbox->MoveMessagesL( msgs, msgFolderId, folderId ));
+ msgs.Reset();
+ CleanupStack::PopAndDestroy(&msgs);
+ }
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::CreatePlainTextMsgL
+// Info: Creates defalult msg with plain text body part in 'Drafts' folder
+// with own mail address in 'To' recipient
+// Params: DesC& aSubject, subject text
+// TDesC& aMsgBodyText, message body text ( max. 256 chars )
+// -----------------------------------------------------------------------------
+//
+CFSMailMessage* CPopImapProfileTester::CreatePlainTextMsgL(
+ const TDesC& aSubject, const TDesC& aMsgBodyText)
+ {
+ TInt err(KErrNone);
+ CFSMailMessage* newMsg(NULL);
+ CFSMailMessagePart* newMsgPart(NULL);
+
+ newMsg = iIPSMailbox->CreateMessageToSend();
+ if (NULL != newMsg)
+ {
+ CleanupStack::PushL(newMsg);
+ // add subject
+ newMsg->SetSubject(aSubject);
+
+ // add default sender address
+ CFSMailAddress* senderAddr = CFSMailAddress::NewL();
+ senderAddr->SetEmailAddress(_L("stif.testcase@stif.com"));
+ newMsg->SetSender(senderAddr);
+ // senderAddr - do not delete it, ownership transferred from user
+
+ // add default To recipient ( own mail address )
+ CFSMailAddress* toAddr = CFSMailAddress::NewL();
+ toAddr->SetEmailAddress(iIPSMailbox->OwnMailAddress().GetEmailAddress());
+ newMsg->AppendToRecipient(toAddr);
+ // toAddr - do not delete it, ownership transferred from user
+
+ // assert: move message to Drafts ( it should be already in Drafts )
+ err = MoveMessageToFolderL(*newMsg, EFSDraftsFolder);
+ if (KErrNone == err)
+ {
+ newMsg->SetContentType(KFSMailContentTypeMultipartMixed);
+ newMsg->SaveMessageL();
+ newMsgPart = newMsg->PlainTextBodyPartL();
+ if (NULL == newMsgPart)
+ {
+ newMsgPart = newMsg->NewChildPartL(TFSMailMsgId(),
+ KFSMailContentTypeTextPlain);
+ }
+ if (NULL != newMsgPart)
+ {
+ CleanupStack::PushL(newMsgPart);
+ TBuf<256> buf(aMsgBodyText);
+ newMsgPart->SetContent(buf);
+ newMsgPart->SetContentSize(buf.Length());
+ newMsgPart->SetFetchedContentSize(buf.Length());
+ newMsgPart->SaveL();
+ CleanupStack::PopAndDestroy(newMsgPart);
+ }
+ else
+ {
+ iLog->Log(_L( "Error: Failed to create msg part" ));
+ err = KErrNoMemory;
+ }
+ }//end if 'KErrNone == err'
+ else
+ {
+ iLog->Log(_L( "Error: Failed to move new msg to Drafts folder" ));
+ }
+ CleanupStack::Pop(newMsg);
+ }//end if 'NULL != newMsg'
+ else
+ {
+ iLog->Log(_L( " Error: Failed to create new msg" ));
+ err = KErrNoMemory;
+ }
+ return newMsg;
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::ReadAccountSettings()
+// Method used to read setting data from .cfg file
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::ReadAccountSettings(
+ TAccountSetting& aAccountSetting)
+ {
+ TInt err(KErrNone);
+ err = GetConstantValue(KSetupWizAccountType, aAccountSetting.iAccountType);
+ aAccountSetting.iAccountType.TrimAll();
+ aAccountSetting.iAccountType.LowerCase();
+ if (aAccountSetting.iAccountType.Compare(KIMAPAccount) == 0)
+ {
+ aAccountSetting.iProtocolIndicator = 1;
+ }
+ else if (aAccountSetting.iAccountType.Compare(KPOPAccount) == 0)
+ {
+ aAccountSetting.iProtocolIndicator = 0;
+ }
+ else
+ {
+ iLog->Log(_L("Wrong Account Type %S, "), &aAccountSetting.iAccountType);
+ return KErrNotFound;
+ }
+ err = GetConstantValue(KSetupWizAccountsConfigured,
+ aAccountSetting.iAccountsConfigured);
+ err = GetConstantValue(KSetupWizMaxAccountsReached,
+ aAccountSetting.iMaxAccountsReached);
+ err
+ = GetConstantValue(KSetupWizEmailAddress,
+ aAccountSetting.iEmailAddress);
+ err = GetConstantValue(KSetupWizUsername, aAccountSetting.iUserName);
+ err = GetConstantValue(KSetupWizPassword, aAccountSetting.iPassWord);
+ err = GetConstantValue(KSetupWizMailboxName, aAccountSetting.iMailboxName);
+ err = GetConstantValue(KSetupWizIncomingServer,
+ aAccountSetting.iIncomingServer);
+ err = GetConstantValue(KSetupWizOutgoingServer,
+ aAccountSetting.iOutgoingServer);
+ err
+ = GetConstantValue(KSetupWizIncomingPort,
+ aAccountSetting.iIncomingPort);
+ err
+ = GetConstantValue(KSetupWizOutgoingPort,
+ aAccountSetting.iOutgoingPort);
+
+ err = GetConstantValue(KSetupWizIncomingSecurityAuth,
+ aAccountSetting.iIncomingSecurityAuth);
+ err = GetConstantValue(KSetupWizOutgoingSecurityAuth,
+ aAccountSetting.iOutgoingSecurityAuth);
+ err = GetConstantValue(KSetupWizIncomingSecurityProtocol,
+ aAccountSetting.iIncomingSecurityProtocol);
+ err = GetConstantValue(KSetupWizOutgoingSecurityProtocol,
+ aAccountSetting.iOutgoingSecurityProtocol);
+ err = GetConstantValue(KSetupWizOperatorSecurityAuth,
+ aAccountSetting.iOperatorSecurityAuth);
+ err = GetConstantValue(KSetupWizOperatorSecurityProtocol,
+ aAccountSetting.iOperatorSecurityProtocol);
+ err
+ = GetConstantValue(KSetupWizOperatorPort,
+ aAccountSetting.iOperatorPort);
+
+ aAccountSetting.iWizardAccountType = KWizAccountTypeDefault;
+ aAccountSetting.iOperatorOutgoingServer = KNullDesC;
+ aAccountSetting.iHideUserNameInSetting = ETrue;
+ aAccountSetting.iAccessPoint = KNullDesC;
+
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::WriteToWizardCRL
+// Prepare data for profile settings
+// write configuration settings to cenrep, just like SW6 would do
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::WriteToWizardCRL(TAccountSetting aAccountSetting)
+ {
+ TInt err(KErrNone);
+ TUint32 keyInfo;
+ CRepository* rep = CRepository::NewLC(KCRUidWizardSettings);
+ err = rep->StartTransaction(CRepository::EConcurrentReadWriteTransaction);
+ iLog->Log(_L( "== Start a transaction in SetupAccount ==" ));
+ if (KErrNone == err)
+ {
+ err = rep->Set(ECRKSetupWizAccountType,
+ aAccountSetting.iWizardAccountType);
+ err = rep->Set(ECRKAccountsConfigured,
+ aAccountSetting.iAccountsConfigured);
+ err = rep->Set(ECRKMaxAccountsReached,
+ aAccountSetting.iMaxAccountsReached);
+ err = rep->Set(ECRKPopImapEmailAddressId,
+ aAccountSetting.iEmailAddress);
+ err = rep->Set(ECRKPopImapUsernameId, aAccountSetting.iUserName);
+ err = rep->Set(ECRKPopImapPasswordId, aAccountSetting.iPassWord);
+ err = rep->Set(ECRKPopImapIncomingServerId,
+ aAccountSetting.iIncomingServer);
+ err = rep->Set(ECRKPopImapOutgoingServerId,
+ aAccountSetting.iOutgoingServer);
+ err = rep->Set(ECRKPopImapProtocolIndicatorId,
+ aAccountSetting.iProtocolIndicator);
+ err = rep->Set(ECRKPopImapIncomingPortId,
+ aAccountSetting.iIncomingPort);
+ err = rep->Set(ECRKPopImapOutgoingPortId,
+ aAccountSetting.iOutgoingPort);
+ err = rep->Set(ECRKPopImapIncomingSecurityAuthId,
+ aAccountSetting.iIncomingSecurityAuth);
+ err = rep->Set(ECRKPopImapIncomingSecurityProtocolId,
+ aAccountSetting.iIncomingSecurityProtocol);
+ err = rep->Set(ECRKPopImapOutgoingSecurityAuthId,
+ aAccountSetting.iOutgoingSecurityAuth);
+ err = rep->Set(ECRKPopImapOutgoingSecurityProtocolId,
+ aAccountSetting.iOutgoingSecurityProtocol);
+ err = rep->Set(ECRKPopImapOperatorOutgoingServerId,
+ aAccountSetting.iOperatorOutgoingServer);
+ err = rep->Set(ECRKPopImapOperatorSecurityAuthId,
+ aAccountSetting.iOperatorSecurityAuth);
+ err = rep->Set(ECRKPopImapOperatorSecurityProtocolId,
+ aAccountSetting.iOperatorSecurityProtocol);
+ err = rep->Set(ECRKPopImapOperatorPortId,
+ aAccountSetting.iOperatorPort);
+ err = rep->Set(ECRKHideUsernameInSettings,
+ aAccountSetting.iHideUserNameInSetting); // 1 = ETrue if there are some field that should be hidden from ui
+ err = rep->Set(ECRKPopImapAccessPointId, aAccountSetting.iAccessPoint);
+ err = rep->Set(ECRKPopImapMailboxName, aAccountSetting.iMailboxName);
+ iLog->Log(_L( "==Error:=%d" ), err);
+
+ err = rep->CommitTransaction(keyInfo);
+ if (KErrLocked == err || KErrAbort == err || KErrNone != err)
+ {
+ rep->CancelTransaction();
+ iLog->Log(
+ _L( "== Error occurs in transaction processed in SetupAccount=%d" ),
+ err);
+ }
+ }
+ else
+ {
+ rep->CancelTransaction();
+ iLog->Log(_L( "== The transaction was canceled in SetupAccount=%d" ),
+ err);
+ }
+ CleanupStack::PopAndDestroy(rep);
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::LogEvent
+// Method used to print log about event
+// -----------------------------------------------------------------------------
+//
+void CPopImapProfileTester::LogEvent(const TDesC& aLogText,
+ TFSMailEvent aEvent, TAny* aParam1, TAny* aParam2, TAny* aParam3)
+ {
+ TBuf<256> log(aLogText);
+
+ switch (aEvent)
+ {
+ // Mailbox is unavailable
+ // params NULL
+ case TFSMailboxUnavailable:
+ log.Append(_L("MailboxUnavailable"));
+ break;
+
+ // Mailbox is available
+ // params NULL
+ case TFSMailboxAvailable:
+ log.Append(_L( "MailboxAvailable" ));
+ break;
+
+ // New mailbox created
+ // params NULL
+ case TFSEventNewMailbox:
+ log.Append(_L( "NewMailbox" ));
+ break;
+
+ // New mailbox creation failure
+ // params NULL
+ case TFSEventMailboxCreationFailure:
+ log.Append(_L( "MailboxCreationFailure" ));
+ break;
+
+ // Mailbox renamed
+ // params NULL
+ case TFSEventMailboxRenamed:
+ log.Append(_L( "MailboxRenamed" ));
+ break;
+
+ // Mailbox deleted
+ // params NULL
+ case TFSEventMailboxDeleted:
+ log.Append(_L( "MailboxDeleted" ));
+ break;
+
+ //
+ // Following events need to be subscribed per mailbox
+ //
+
+ // Mailbox capability changed
+ // params NULL
+ case TFSEventMailboxCapabilityChanged:
+ log.Append(_L( "MailboxCapabilityChanged" ));
+ break;
+
+ // Mailbox settings changed
+ // params NULL
+ case TFSEventMailboxSettingsChanged:
+ log.Append(_L( "MailboxSettingsChanged" ));
+ break;
+
+ // Mailbox went online
+ // params NULL
+ case TFSEventMailboxOnline:
+ log.Append(_L( "MailboxOnline" ));
+ break;
+
+ // Mailbox went offline
+ // params NULL
+ case TFSEventMailboxOffline:
+ log.Append(_L( "MailboxOffline" ));
+ break;
+
+ // Mailbox sync state changed
+ // aParam1: TSSMailSyncState* newState
+ // aParam2: NULL
+ // aParam3: NULL
+ case TFSEventMailboxSyncStateChanged:
+ {
+ TSSMailSyncState state = *((TSSMailSyncState*) aParam1);
+ log.Append(_L( "SyncStateChanged" ));
+ switch (state)
+ {
+ case Idle:
+ log.Append(_L("(Idle)"));
+ break;
+ case StartingSync:
+ log.Append(_L("(StartingSync)"));
+ break;
+ case DataSyncStarting:
+ log.Append(_L("(DataSyncStarting)"));
+ break;
+ case EmailSyncing:
+ log.Append(_L("(EmailSyncing)"));
+ break;
+ case InboxSyncing:
+ log.Append(_L("(InboxSyncing)"));
+ break;
+ case OutboxSyncing:
+ log.Append(_L("(OutboxSyncing)"));
+ break;
+ case SentItemsSyncing:
+ log.Append(_L("(SentItemsSyncing)"));
+ break;
+ case DraftsSyncing:
+ log.Append(_L("(DraftsSyncing)"));
+ break;
+ case CalendarSyncing:
+ log.Append(_L("(CalendarSyncing)"));
+ break;
+ case ContactsSyncing:
+ log.Append(_L("(ContactsSyncing)"));
+ break;
+ case TasksSyncing:
+ log.Append(_L("(TasksSyncing)"));
+ break;
+ case NotesSyncing:
+ log.Append(_L("(NotesSyncing)"));
+ break;
+ case FilesSyncing:
+ log.Append(_L("(FilesSyncing)"));
+ break;
+ case FinishedSuccessfully:
+ log.Append(_L("(FinishedSuccessfully)"));
+ break;
+ case SyncError:
+ log.Append(_L("(SyncError)"));
+ break;
+ case SyncCancelled:
+ log.Append(_L("(SyncCancelled)"));
+ break;
+ case PasswordExpiredError:
+ log.Append(_L("(PasswordExpiredError)"));
+ break;
+ case PasswordVerified:
+ log.Append(_L("(PasswordVerified)"));
+ break;
+ case PasswordNotVerified:
+ log.Append(_L("(PasswordNotVerified)"));
+ break;
+ case PushChannelOff:
+ log.Append(_L("(PushChannelOff)"));
+ break;
+ case PushChannelEstablished:
+ log.Append(_L("(PushChannelEstablished)"));
+ break;
+ case PushChannelOffBecauseBatteryIsLow:
+ log.Append(_L("(PushChannelOffBecauseBatteryIsLow)"));
+ break;
+ case OutOfDiskSpace:
+ log.Append(_L("(OutOfDiskSpace)"));
+ break;
+ default:
+ log.Append(_L("( no description )"));
+ }
+ }
+ break;
+
+ // New mails created
+ // aParam1: RArray<TFSMailMsgId>* aNewEntries
+ // aParam2: TFSMailMsgId* aParentFolder
+ // aParam3: NULL
+ case TFSEventNewMail:
+ log.Append(_L( "NewEmail" ));
+ if (aParam1)
+ {
+ RArray<TFSMailMsgId>* newEntries = static_cast<RArray<
+ TFSMailMsgId>*> (aParam1);
+ TInt newEntriesCount = newEntries->Count();
+ log.AppendFormat(_L("(%d)"), newEntriesCount);
+ }
+ if (aParam2)
+ {
+ TFSMailMsgId* parentFolder =
+ static_cast<TFSMailMsgId*> (aParam2);
+ TBuf<20> folderName;
+ if (KErrNone == GetFolderNameFromId(*parentFolder, folderName))
+ {
+ log.Append(folderName);
+ }
+ }
+ break;
+
+ // Mails changed
+ // aParam1: RArray<TFSMailMsgId>* aEntries
+ // aParam2: TFSMailMsgId* aParentFolder
+ // aParam3: NULL
+ case TFSEventMailChanged:
+ log.Append(_L( "MailChanged" ));
+ if (aParam1)
+ {
+ RArray<TFSMailMsgId>* newEntries = static_cast<RArray<
+ TFSMailMsgId>*> (aParam1);
+ TInt newEntriesCount = newEntries->Count();
+ log.AppendFormat(_L("(%d)"), newEntriesCount);
+ }
+ if (aParam2)
+ {
+ TFSMailMsgId* parentFolder =
+ static_cast<TFSMailMsgId*> (aParam2);
+ TBuf<20> folderName;
+ if (KErrNone == GetFolderNameFromId(*parentFolder, folderName))
+ {
+ log.Append(folderName);
+ }
+ }
+ break;
+
+ // Mails deleted
+ // aParam1: RArray<TFSMailMsgId>* aEntries
+ // aParam2: TFSMailMsgId* aParentFolder
+ // aParam3: NULL
+ case TFSEventMailDeleted:
+ log.Append(_L( "MailDeleted" ));
+ if (aParam1)
+ {
+ RArray<TFSMailMsgId>* newEntries = static_cast<RArray<
+ TFSMailMsgId>*> (aParam1);
+ TInt newEntriesCount = newEntries->Count();
+ log.AppendFormat(_L("(%d)"), newEntriesCount);
+ }
+ if (aParam2)
+ {
+ TFSMailMsgId* parentFolder =
+ static_cast<TFSMailMsgId*> (aParam2);
+ TBuf<20> folderName;
+ if (KErrNone == GetFolderNameFromId(*parentFolder, folderName))
+ {
+ log.Append(folderName);
+ }
+ }
+ break;
+
+ // Mails moved
+ // aParam1: RArray<TFSMailMsgId>* aEntries
+ // aParam2: TFSMailMsgId* aNewParentFolder
+ // aParam3: TFSMailMsgId* aOldParentFolder
+ case TFSEventMailMoved:
+ log.Append(_L( "MailMoved" ));
+ if (aParam1)
+ {
+ RArray<TFSMailMsgId>* newEntries = static_cast<RArray<
+ TFSMailMsgId>*> (aParam1);
+ TInt newEntriesCount = newEntries->Count();
+ log.AppendFormat(_L("(%d)"), newEntriesCount);
+ }
+ if (aParam2)
+ {
+ TFSMailMsgId* parentFolder =
+ static_cast<TFSMailMsgId*> (aParam2);
+ TBuf<20> folderName;
+ if (KErrNone == GetFolderNameFromId(*parentFolder, folderName))
+ {
+ log.Append(_L("---"));
+ log.Append(folderName);
+ }
+ }
+ if (aParam3)
+ {
+ TFSMailMsgId* parentFolder =
+ static_cast<TFSMailMsgId*> (aParam3);
+ TBuf<20> folderName;
+ if (KErrNone == GetFolderNameFromId(*parentFolder, folderName))
+ {
+ log.Append(folderName);
+ }
+ }
+ break;
+
+ // Mails copied
+ // aParam1: RArray<TFSMailMsgId>* aNewEntries
+ // aParam2: TFSMailMsgId* aNewParentFolder
+ // aParam3: TFSMailMsgId* aOldParentFolder
+ case TFSEventMailCopied:
+ log.Append(_L( "MailCopied" ));
+ break;
+
+ // New folders created
+ // aParam1: RArray<TFSMailMsgId>* aNewEntries
+ // aParam2: TFSMailMsgId* aParentFolder
+ // aParam3: NULL
+ case TFSEventNewFolder:
+ log.Append(_L( "NewFolder" ));
+ if (aParam1)
+ {
+ RArray<TFSMailMsgId>* newEntries = static_cast<RArray<
+ TFSMailMsgId>*> (aParam1);
+ TInt newEntriesCount = newEntries->Count();
+ log.AppendFormat(_L("(%d)"), newEntriesCount);
+ }
+ if (aParam2)
+ {
+ TFSMailMsgId* parentFolder =
+ static_cast<TFSMailMsgId*> (aParam2);
+ TBuf<20> folderName;
+ if (KErrNone == GetFolderNameFromId(*parentFolder, folderName))
+ {
+ log.Append(folderName);
+ }
+ }
+ break;
+
+ // Folders changed
+ // aParam1: RArray<TFSMailMsgId>* aEntries
+ // aParam2: TFSMailMsgId* aParentFolder
+ // aParam3: NULL
+ case TFSEventFolderChanged:
+ log.Append(_L( "FolderChanged" ));
+ if (aParam1)
+ {
+ RArray<TFSMailMsgId>* newEntries = static_cast<RArray<
+ TFSMailMsgId>*> (aParam1);
+ TInt newEntriesCount = newEntries->Count();
+ log.AppendFormat(_L("(%d)"), newEntriesCount);
+ }
+ if (aParam2)
+ {
+ TFSMailMsgId* parentFolder =
+ static_cast<TFSMailMsgId*> (aParam2);
+ TBuf<20> folderName;
+ if (KErrNone == GetFolderNameFromId(*parentFolder, folderName))
+ {
+ log.Append(folderName);
+ }
+ }
+ break;
+
+ // Folders deleted
+ // aParam1: RArray<TFSMailMsgId>* aEntries
+ // aParam2: TFSMailMsgId* aParentFolder
+ // aParam3: NULL
+ case TFSEventFoldersDeleted:
+ log.Append(_L( "FoldersDeleted" ));
+ if (aParam1)
+ {
+ RArray<TFSMailMsgId>* newEntries = static_cast<RArray<
+ TFSMailMsgId>*> (aParam1);
+ TInt newEntriesCount = newEntries->Count();
+ log.AppendFormat(_L("(%d)"), newEntriesCount);
+ }
+ if (aParam2)
+ {
+ TFSMailMsgId* parentFolder =
+ static_cast<TFSMailMsgId*> (aParam2);
+ TBuf<20> folderName;
+ if (KErrNone == GetFolderNameFromId(*parentFolder, folderName))
+ {
+ log.Append(folderName);
+ }
+ }
+ break;
+
+ // Folders moved
+ // aParam1: RArray<TFSMailMsgId>* aEntries
+ // aParam2: TFSMailMsgId* aNewParentFolder
+ // aParam3: TFSMailMsgId* aOldParentFolder
+ case TFSEventFoldersMoved:
+ log.Append(_L( "FoldersMoved" ));
+ break;
+
+ // exception / error happened
+ // aParam1: TInt (TFsEmailNotifierSystemMessageType) aEventType
+ // aParam2: TDesC* aCustomMessage or NULL (optional)
+ // aParam3: MFSMailExceptionEventCallback* aCallback or NULL(optional)
+ case TFSEventException:
+ {
+ log.Append(_L( "Exception " ));
+ }
+ break;
+
+ // Mail deleted from viewer
+ // aParam1: RArray<TFSMailMsgId>* aEntries
+ // aParam2: TFSMailMsgId* aParentFolder
+ // aParam3: NULL
+ case TFSEventMailDeletedFromViewer:
+ log.Append(_L( "MailDeletedFromViewer" ));
+ if (aParam1)
+ {
+ RArray<TFSMailMsgId>* newEntries = static_cast<RArray<
+ TFSMailMsgId>*> (aParam1);
+ TInt newEntriesCount = newEntries->Count();
+ log.AppendFormat(_L("(%d)"), newEntriesCount);
+ }
+ if (aParam2)
+ {
+ TFSMailMsgId* parentFolder =
+ static_cast<TFSMailMsgId*> (aParam2);
+ TBuf<20> folderName;
+ if (KErrNone == GetFolderNameFromId(*parentFolder, folderName))
+ {
+ log.Append(folderName);
+ }
+ }
+ break;
+
+ default:
+ log.Append(_L( "Unknown" ));
+ break;
+ }
+ iLog->Log(log);
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::LogTFSProgress
+// Method used to print logs about TFSProgress state
+// -----------------------------------------------------------------------------
+//
+void CPopImapProfileTester::LogTFSProgress(const TDesC& aLogText,
+ const TFSProgress::TFSProgressStatus aProgress, TInt aReqId)
+ {
+ TBuf<100> log(aLogText);
+ if (aReqId >= 0)
+ {
+ log.AppendFormat(_L("%d-"), aReqId);
+ }
+
+ switch (aProgress)
+ {
+ case TFSProgress::EFSStatus_Waiting:
+ log.Append(_L("Waiting"));
+ break;
+
+ case TFSProgress::EFSStatus_Started:
+ log.Append(_L("Started"));
+ break;
+
+ case TFSProgress::EFSStatus_Connecting:
+ log.Append(_L("Connecting"));
+ break;
+
+ case TFSProgress::EFSStatus_Connected:
+ log.Append(_L("Connected"));
+ break;
+
+ case TFSProgress::EFSStatus_Authenticating:
+ log.Append(_L("Authenticating"));
+ break;
+
+ case TFSProgress::EFSStatus_Authenticated:
+ log.Append(_L("Authenticated"));
+ break;
+
+ case TFSProgress::EFSStatus_Status:
+ log.Append(_L("Status"));
+ break;
+
+ case TFSProgress::EFSStatus_RequestComplete:
+ log.Append(_L("Complete"));
+ break;
+
+ case TFSProgress::EFSStatus_RequestCancelled:
+ log.Append(_L("Cancelled"));
+ break;
+
+ default:
+ log.Append(_L("UnknownStatus"));
+ }
+ iLog->Log(log);
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::LogTSSMailSyncState
+// Method used to print logs about TSSMailSyncState state
+// -----------------------------------------------------------------------------
+//
+void CPopImapProfileTester::LogTSSMailSyncState(const TDesC& aLogText,
+ const TSSMailSyncState aState)
+ {
+ TBuf<100> log(aLogText);
+ switch (aState)
+ {
+ case Idle:
+ log.Append(_L("Idle"));
+ break;
+
+ case StartingSync:
+ log.Append(_L("StartingSync"));
+ break;
+
+ case DataSyncStarting:
+ log.Append(_L("DataSyncStarting"));
+ break;
+
+ case EmailSyncing:
+ log.Append(_L("EmailSyncing"));
+ break;
+
+ case InboxSyncing:
+ log.Append(_L("InboxSyncing"));
+ break;
+
+ case OutboxSyncing:
+ log.Append(_L("OutboxSyncing"));
+ break;
+
+ case SentItemsSyncing:
+ log.Append(_L("SentItemsSyncing"));
+ break;
+
+ case DraftsSyncing:
+ log.Append(_L("DraftsSyncing"));
+ break;
+
+ case CalendarSyncing:
+ log.Append(_L("CalendarSyncing"));
+ break;
+
+ case ContactsSyncing:
+ log.Append(_L("ContactsSyncing"));
+ break;
+
+ case TasksSyncing:
+ log.Append(_L("TasksSyncing"));
+ break;
+
+ case NotesSyncing:
+ log.Append(_L("NotesSyncing"));
+ break;
+
+ case FilesSyncing:
+ log.Append(_L("FilesSyncing"));
+ break;
+
+ case FinishedSuccessfully:
+ log.Append(_L("FinishedSuccessfully"));
+ break;
+
+ case SyncError:
+ log.Append(_L("SyncError"));
+ break;
+
+ case SyncCancelled:
+ log.Append(_L("SyncCancelled"));
+ break;
+
+ case PasswordExpiredError:
+ log.Append(_L("PasswordExpiredError"));
+ break;
+
+ case PasswordVerified:
+ log.Append(_L("PasswordVerified"));
+ break;
+
+ case PasswordNotVerified:
+ log.Append(_L("PasswordNotVerified"));
+ break;
+
+ case PushChannelOff:
+ log.Append(_L("PushChannelOff"));
+ break;
+
+ case PushChannelEstablished:
+ log.Append(_L("PushChannelEstablished"));
+ break;
+
+ case PushChannelOffBecauseBatteryIsLow:
+ log.Append(_L("PushChannelOffBecauseBatteryIsLow"));
+ break;
+
+ case OutOfDiskSpace:
+ log.Append(_L("OutOfDiskSpace"));
+ break;
+ }
+ iLog->Log(log);
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::GetFolderNameFromId
+// Method used to get name of folder with given ID
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::GetFolderNameFromId(TFSMailMsgId aFolderId,
+ TDes& aFolderName)
+ {
+ RPointerArray<CFSMailFolder>& folders = iIPSMailbox->ListFolders();
+ TInt err(KErrNotFound);
+ for (TInt i = 0; i < folders.Count(); i++)
+ {
+ if (folders[i]->GetFolderId() == aFolderId)
+ {
+ aFolderName = folders[i]->GetFolderName();
+ err = KErrNone;
+ break;
+ }
+ }
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::GetFolderIdFromName
+// Method used to get ID of folder with given name
+// -----------------------------------------------------------------------------
+//
+TFSMailMsgId CPopImapProfileTester::GetFolderIdFromName(
+ const TDesC& aFolderName)
+ {
+ TBuf<10> bufFolderName(aFolderName);
+ TFSMailMsgId folderId;
+
+ bufFolderName.TrimAll();
+ bufFolderName.LowerCase();
+
+ if (bufFolderName.Compare(KInboxType) == 0)
+ {
+ folderId = iIPSMailbox->GetStandardFolderId(EFSInbox);
+ }
+ else if (bufFolderName.Compare(KOutboxType) == 0)
+ {
+ folderId = iIPSMailbox->GetStandardFolderId(EFSOutbox);
+ }
+ else if (bufFolderName.Compare(KDraftsType) == 0)
+ {
+ folderId = iIPSMailbox->GetStandardFolderId(EFSDraftsFolder);
+ }
+ else if (bufFolderName.Compare(KSentType) == 0)
+ {
+ folderId = iIPSMailbox->GetStandardFolderId(EFSSentFolder);
+ }
+ else
+ {
+ folderId = iIPSMailbox->GetStandardFolderId(EFSOther);
+ }
+ return folderId;
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::ParseEventParams
+// Method used to parese params from event
+// -----------------------------------------------------------------------------
+//
+TBool CPopImapProfileTester::ParseEventParams(TAny *aEventParam1,
+ TAny *aEventParam2)
+ {
+ TBool ret(EFalse);
+ switch (iCurrWaitedEvent)
+ {
+ case TFSEventMailboxSyncStateChanged:
+ if (NULL == iEventParam1)
+ {
+ ret = ETrue;
+ }
+ else if (NULL == aEventParam1)
+ {
+ ret = EFalse;
+ }
+ else if (*((TSSMailSyncState*) aEventParam1)
+ == *((TSSMailSyncState*) iEventParam1))
+ {
+ ret = ETrue;
+ }
+ else
+ {
+ ret = EFalse;
+ }
+ break;
+
+ case TFSEventMailMoved:
+ if (NULL == iEventParam1)
+ {
+ ret = ETrue;
+ }
+ else if (NULL == aEventParam2)
+ {
+ ret = EFalse;
+ }
+ else if (*((TFSMailMsgId*) aEventParam2)
+ == *((TFSMailMsgId*) iEventParam2))
+ {
+ ret = ETrue;
+ }
+ else
+ {
+ ret = EFalse;
+ }
+ break;
+
+ default:
+ ret = ETrue;
+ break;
+ }
+ return ret;
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL(CTestModuleIf& aTestModuleIf) // Backpointer to STIF Test Framework
+ {
+
+ return (CScriptBase*) CPopImapProfileTester::NewL(aTestModuleIf);
+
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/src/popimapprofiletesterBlocks.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,1347 @@
+/* ============================================================================
+ * Name : popimapprofiletesterBlocks.cpp
+ * Part of : ipsservices / profiletester
+ * Description :: STIF test cases
+ * Version : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+ *
+ * Copyright © 2010-2010 Nokia and/or its subsidiary(-ies). All rights reserved.
+ * This material, including documentation and any related computer
+ * programs, is protected by copyright controlled by Nokia. All
+ * rights are reserved. Copying, including reproducing, storing,
+ * adapting or translating, any or all of this material requires the
+ * prior written consent of Nokia. This material also contains
+ * confidential information which may not be disclosed to others
+ * without the prior written consent of Nokia.
+ * ============================================================================
+ */
+
+//--INCLUDE FILES--
+#include <e32svr.h>
+#include <StifParser.h>
+#include <StifTestInterface.h>
+#include <e32math.h>
+#include <msvids.h>
+#include "popimapprofiletester.h"
+_LIT( KPopImapProfileTester, "c:\\TestFramework\\TestFramework_ips.ini" );
+_LIT( KStifEmailSubject, "STIF Basic Operations test" );
+_LIT( KStifEmailSubjectDes,"STIF_");
+_LIT( KStifEmailBodyText, "This is a temporary STIF test message");
+_LIT( KStifEmailSubjectAttHandling, "STIF Attachment Handling Test" );
+_LIT( KStifEmailToRec1, "dummyTo1@empty.com" );
+_LIT( KStifEmailCcRec1, "dummyCc1@empty.com" );
+_LIT( KStifEmailCcRec2, "dummyCc2@empty.com" );
+_LIT( KStifEmailBccRec1, "dummyBcc1@empty.com" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::Delete
+// Delete here all resources allocated and opened from test methods.
+// Called from destructor.
+// -----------------------------------------------------------------------------
+//
+void CPopImapProfileTester::Delete()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::RunMethodL(CStifItemParser& aItem)
+ {
+ static TStifFunctionInfo const
+ KFunctions[] =
+ {
+ // Copy this line for every implemented function.
+ // First string is the function name used in TestScripter script file.
+ // Second is the actual implementation member function.
+ ENTRY( "SetupAccount", CPopImapProfileTester::SetupAccountL ),
+ ENTRY( "GoOnline", CPopImapProfileTester::GoOnlineL ),
+ ENTRY( "GoOffline", CPopImapProfileTester::GoOfflineL ),
+ ENTRY( "RefreshNow", CPopImapProfileTester::RefreshNowL ),
+ ENTRY( "CancelSync", CPopImapProfileTester::CancelSyncL ),
+ ENTRY( "ListStandardFolders", CPopImapProfileTester::ListStandardFoldersL ),
+ ENTRY( "ListFolders", CPopImapProfileTester::ListFoldersL ),
+ ENTRY( "ListMessages", CPopImapProfileTester::ListMessagesL ),
+ ENTRY( "FetchMessages", CPopImapProfileTester::FetchMessagesL ),
+ ENTRY( "SendMessage", CPopImapProfileTester::SendMessageL ),
+ ENTRY( "BasicMsgOperations", CPopImapProfileTester::BasicMsgOperationsL ),
+ ENTRY( "CopyMoveMsgs", CPopImapProfileTester::CopyMoveMsgsL ),
+ ENTRY( "Search", CPopImapProfileTester::SearchL ),
+ ENTRY( "AttachmentHandling", CPopImapProfileTester::AttachmentHandlingL ),
+ ENTRY( "Branding", CPopImapProfileTester::BrandingL ),
+ ENTRY( "DeleteMsgs", CPopImapProfileTester::DeleteMsgsL ),
+ ENTRY( "RemoveAccount", CPopImapProfileTester::RemoveAccountL ),
+ };
+
+ const TInt count = sizeof(KFunctions) / sizeof(TStifFunctionInfo);
+
+ InitMailboxL();
+ return RunInternalL(KFunctions, count, aItem);
+ }
+
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester:: SetupAccountL
+// Method used to create an imap or pop account, depends on .cfg file
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::SetupAccountL(CStifItemParser& /* aItem */)
+ {
+ //I.Check if mail client exists
+ if (NULL == iMailClient)
+ {
+ iLog->Log(_L( "Error: Failed to create test instance(No Memory)." ));
+ return KErrNoMemory;
+ }
+ TInt err(KErrNone);
+
+ // II. Check if imap/pop profile already exists
+
+ if (NULL != iIPSMailbox)
+ {
+ iLog->Log(_L("Error: There is IMAP/POP profile alredy existed"));
+ return KErrAlreadyExists;
+ }
+
+ iLog->Log(_L( "== SetupAccount Begins ==" ));
+ TAccountSetting settings;
+ // III. Read settings and write to CR
+ ReadAccountSettings(settings);
+ err = WriteToWizardCRL(settings);
+ iLog->Log(_L( "== WriteToWizardCR Ends err=%d" ), err);
+ iLog->Log(_L( "== End a transaction in SetupAccount ==" ));
+
+ // IV. Create mailbox through WizardDataAvailableL()
+ err = iMailClient->WizardDataAvailableL();
+ if (KErrNone == err)
+ WaitForEvent(TFSEventNewMailbox, NULL, NULL, KTenSecondsTime);
+ err = InitMailboxL();
+ if ((KErrNone == err) && NULL != iIPSMailbox)
+ err = KErrNone;
+ else
+ err = KErrGeneral;
+
+ iLog->Log(_L( "== SetupAccount Ends err=%d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester:: GoOnlineL
+// Method used to let phone online
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::GoOnlineL(CStifItemParser& /* aItem */)
+ {
+ TInt err(KErrNone);
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrGeneral;
+ }
+
+ iLog->Log(_L( "== GoOnline Begins ==" ));
+
+ // check current mailbox status
+ TBuf<10> statusDes;
+ TFSMailBoxStatus status = iIPSMailbox->GetMailBoxStatus();
+ if (status == EFSMailBoxOffline)
+ {
+ statusDes.Copy(_L("offline"));
+ }
+ else if (status == EFSMailBoxOnline)
+ {
+ statusDes.Copy(_L("online"));
+ iLog->Log(_L("Mailbox has been Online, go offline firstly"));
+ iLog->Log(_L( "== GoOnline ends err=%d" ), err);
+ return KErrGeneral;
+ }
+ else
+ {
+ statusDes.Copy(_L("unknown"));
+ }
+
+ iLog->Log(_L("Going online (from %S)..."), &statusDes);
+ TSSMailSyncState syncstatus = iIPSMailbox->CurrentSyncState();
+ // call function to go online
+ iEventSynchronousCall = ETrue;
+ iIPSMailbox->GoOnlineL();
+ syncstatus = iIPSMailbox->CurrentSyncState();
+ // we should likely base on TFSEventMailboxOnline, but this does not come always (?)
+ err = WaitForEvent(TFSEventMailboxOnline, NULL, NULL, KOneMinuteTime);
+
+ syncstatus = iIPSMailbox->CurrentSyncState();
+
+ //check status of current mailbox again
+ status = iIPSMailbox->GetMailBoxStatus();
+
+ if (status == EFSMailBoxOnline)
+ {
+ err = KErrNone;
+ iLog->Log(_L("Success: mailbox online"));
+ }
+ else
+ {
+ err = KErrGeneral;
+ iLog->Log(_L("Failed: mailbox status- %S"), &statusDes);
+ }
+
+ iLog->Log(_L( "== GoOnline ends err=%d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester:: GoOfflineL
+// Method used to let phone offline
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::GoOfflineL(CStifItemParser& /* aItem */)
+ {
+ TInt err(KErrNone);
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrGeneral;
+ }
+
+ iLog->Log(_L( "== GoOffline Begins ==" ));
+ TBuf<10> statusDes;
+ TFSMailBoxStatus status = iIPSMailbox->GetMailBoxStatus();
+ if (status == EFSMailBoxOffline)
+ {
+ statusDes.Copy(_L("offline"));
+ iLog->Log(_L("Mailbox has been Offline, go online firstly"));
+ iLog->Log(_L( "== GoOffline ends err=%d" ), err);
+ return KErrGeneral;
+ }
+ else if (status == EFSMailBoxOnline)
+ {
+ statusDes.Copy(_L("online"));
+ }
+ else
+ {
+ statusDes.Copy(_L("unknown"));
+ }
+
+ iLog->Log(_L("Going offline (from %S)..."), &statusDes);
+
+ // call function to go offline
+ iEventSynchronousCall = ETrue;
+ TSSMailSyncState syncstatus = iIPSMailbox->CurrentSyncState();
+ iIPSMailbox->GoOfflineL();
+ syncstatus = iIPSMailbox->CurrentSyncState();
+ err = WaitForEvent(TFSEventMailboxOffline, NULL, NULL, KOneMinuteTime);
+ syncstatus = iIPSMailbox->CurrentSyncState();
+ //check status of current mailbox again
+ status = iIPSMailbox->GetMailBoxStatus();
+
+ if (status == EFSMailBoxOffline)
+ {
+ iLog->Log(_L("Success: mailbox offline"));
+ }
+ else
+ {
+ err = KErrGeneral;
+ iLog->Log(_L("Failed: mailbox status- %S"), &statusDes);
+ }
+
+ iLog->Log(_L( "GoOffline ends err=%d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester:: RefreshNowL
+// Method used to let phone refresh
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::RefreshNowL(CStifItemParser& /* aItem */)
+ {
+ TInt err(KErrNone);
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrGeneral;
+ }
+ iLog->Log(_L( "RefreshNow begins" ));
+ TInt reqId = iIPSMailbox->RefreshNowL(*this);
+ iLog->Log(_L("Request Id -> %d"), reqId);
+ TSSMailSyncState syncstatus = iIPSMailbox->CurrentSyncState();
+ if ((StartingSync == syncstatus) || (EmailSyncing == syncstatus))
+ err = WaitForEvent(TFSEventMailboxOnline);
+ else
+ err = KErrGeneral;
+ if (err == KErrNone)
+ {
+ WaitForResponse(TFSProgress::EFSStatus_RequestComplete, KOneMinuteTime*3);
+ syncstatus = iIPSMailbox->CurrentSyncState();
+ }
+ iLog->Log(_L( "RefreshNow ends err=%d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester:: CancelSyncL
+// Method used to cancle action of Sync.
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::CancelSyncL(CStifItemParser& /* aItem */)
+ {
+ TInt err(KErrNone);
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrGeneral;
+ }
+ iLog->Log(_L( "CancelSync begins" ));
+ iIPSMailbox->RefreshNowL(*this);
+ err = WaitForEvent(TFSEventMailboxOnline);
+ if (KErrNone == err)
+ {
+ iIPSMailbox->CancelSyncL();
+ err = WaitForEvent(TFSEventMailboxOffline);
+ TSSMailSyncState syncstatus = iIPSMailbox->CurrentSyncState();
+ if ((err != KErrNone) || (Idle != syncstatus))
+ {
+ err = KErrGeneral;
+ }
+ }
+ iLog->Log(_L( "CancelSync ends err=%d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::ListStandardFoldersL
+// Method used to list standard folders
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::ListStandardFoldersL(CStifItemParser& /* aItem */)
+ {
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrGeneral;
+ }
+
+ TInt err(KErrNone);
+ iLog->Log(_L( "ListStandardFolders begins" ));
+
+ // list all root folders
+ RPointerArray<CFSMailFolder> rootFolders;
+ iIPSMailbox->ListFolders(TFSMailMsgId(), rootFolders);
+
+ // how many root folders we have
+ TInt rootFolderCount = rootFolders.Count();
+
+ /* Standard folders are:
+ * EFSInbox, EFSOutbox, EFSDraftsFolder, EFSSentFolder, EFSDeleted
+ * IMAP/POP may not have 'EFSDeleted'? Four only?
+ */
+
+ // check if all standard folders are present among root folders
+ TFSMailMsgId folderId = TFSMailMsgId();
+ iLog->Log(_L("== List of Standard Folders == "));
+ for (TInt i = 1; i < EFSDeleted; ++i)
+ {
+ folderId = iIPSMailbox->GetStandardFolderId((TFSFolderType) i);
+ TBool folderPresent = EFalse;
+ for (TInt ii = 0; ii < rootFolderCount; ++ii)
+ {
+ if (rootFolders[ii]->GetFolderId() == folderId)
+ {
+ iLog->Log(_L(" %S"), &rootFolders[ii]->GetFolderName());
+ folderPresent = ETrue;
+ break;
+ }
+ }
+ if (NULL == folderPresent)
+ {
+ iLog->Log(_L(" Error: folder of id %d is missing"), i);
+ err = KErrNotFound;
+ }
+ }
+ rootFolders.ResetAndDestroy();
+
+ iLog->Log(_L( "ListStandardFolders ends err=%d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::ListFoldersL
+// Method used to list all folders
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::ListFoldersL(CStifItemParser& aItem)
+ {
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrGeneral;
+ }
+ /**
+ * 1. Check subfolders of given folder - use ListFolders(FSMailMsgId, RPointerArray<CFSMailFolder>&)
+ * 2. List all folders and compare check cout of listed folders - use ListFolders()
+ *
+ */
+ TInt paramErr(KErrNone);
+ TInt err(KErrNone);
+ iLog->Log(_L( "ListFoldersL begins" ));
+ iLog->Log(_L( "Mailbox's Id: %x"), iIPSMailbox->GetId().Id());
+
+ RPointerArray<CFSMailFolder>& folders = iIPSMailbox->ListFolders();
+ //..
+ // 1. subfolders check
+ TPtrC parentFolderS, subfolderSetS, subfolderS;
+
+ //get parent folder name
+ paramErr = aItem.GetString(_L("_parentFolder:"), parentFolderS);
+ TFSMailMsgId parentFolderId = GetFolderIdFromName(parentFolderS);
+
+ if (!parentFolderId.IsNullId())
+ {
+ iLog->Log(_L("Testing folder hierachy"));
+ iLog->Log(_L("Parent folder found; id: %x"), parentFolderId.Id());
+
+ RPointerArray<CFSMailFolder> subfolders;
+ iIPSMailbox->ListFolders(parentFolderId, subfolders);
+
+ TInt subfolderErr(KErrNone);
+ //there should be at least one subfolder defined
+ paramErr &= aItem.GetString(_L("_subfolders:"), subfolderSetS);
+
+ TInt idx(0);
+ do
+ {
+ idx = subfolderSetS.Locate(',');
+ if (idx > 0)
+ {
+ // extract next subfolder
+ subfolderS.Set(subfolderSetS.Left(idx));
+ // skip current subfolder
+ subfolderSetS.Set(subfolderSetS.Mid(idx + 1));
+ }
+ else
+ {
+ subfolderS.Set(subfolderSetS);
+ }
+
+ // check subfolder
+ subfolderErr = KErrNotFound;
+ for (TInt i = 0; (i < folders.Count() && !paramErr); i++)
+ {
+ if (folders[i]->GetFolderName().Compare(subfolderS) == 0)
+ {
+ subfolderErr = KErrNone;
+ iLog->Log(
+ _L("Subfolder %S of parent folder %S found; id: %x"),
+ &(folders[i]->GetFolderName()), &parentFolderS,
+ folders[i]->GetFolderId().Id());
+ break;
+ }
+ }
+
+ }
+ while (!subfolderErr && idx >= 0);
+
+ //set global err value - zeroes err if OK
+ err &= subfolderErr;
+ subfolders.ResetAndDestroy();
+ }//end if '!parentFolderId.IsNullId()'
+
+ //parse params - we have to know what actualy we are testing
+ TInt foldersCount(0);
+ paramErr &= aItem.GetInt(_L("_expectedFoldersCount:"), foldersCount);
+ //..
+ // 2. total number of folders
+ if (foldersCount > 0)
+ {
+ (folders.Count() == foldersCount) ? err = KErrNone : err = KErrGeneral;
+ iLog->Log(_L("Actual folders count: %d vs. %d expected"),
+ folders.Count(), foldersCount);
+ }
+ //..
+
+ if (paramErr != 0)
+ {
+ iLog->Log(_L(" Error: Invalid test case parameters!"));
+ }
+
+ iLog->Log(_L( "ListFolders ends err=%d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::ListMessagesL
+// Method used to list messages in a specific folder
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::ListMessagesL(CStifItemParser& aItem)
+ {
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrGeneral;
+ }
+
+ TInt err(KErrNone);
+ iLog->Log(_L( "ListMessagesL begins" ));
+
+ // I. get test case params
+ TPtrC folderName;
+ TInt msgCount(0);
+
+ // since folder name might consists of more than one word
+ // lets use quote parsing for param
+ aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
+ if (aItem.GetString(_L("_folder:"), folderName))
+ {
+ iLog->Log(_L("Error: test case argument is missing"));
+ err = KErrArgument;
+ }
+ else
+ {
+ // II. Get folder of given name and list its emails
+ CFSMailFolder* folder = FindFolder(folderName);
+ if (NULL != folder)
+ {
+ RPointerArray<CFSMailMessage> messages;
+ TInt gotMsgs = GetMessagesFromFolderL(messages, folder,
+ EFSMsgDataSubject, EFSMailSortByDate, msgCount);
+ if (gotMsgs > 0)
+ {
+ iLog->Log(_L(" Listing first %d emails:"), gotMsgs);
+ }
+ for (TInt i = 0; i < messages.Count(); ++i)
+ {
+ iLog->Log(_L(" %d. %S"), i + 1, &messages[i]->GetSubject());
+ }
+ if (gotMsgs != messages.Count())
+ { // warning, NextL() returned fewer entries than expected
+ TInt diff = gotMsgs > messages.Count() ? gotMsgs
+ - messages.Count() : messages.Count() - gotMsgs;
+ iLog->Log(_L("Warning: %d entries are still not be listed."),
+ diff);
+ err = KErrNotFound;
+ }
+ messages.ResetAndDestroy();
+ }//end if 'folder'
+ else
+ {
+ iLog->Log(_L("Error: %S folder not found"), &folderName);
+ err = KErrNotFound;
+ }
+ }//end if 'folderName'
+
+ iLog->Log(_L( "ListMessages ends err=%d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::FetchMessagesL
+// Method used to fetch messages in a specific folder
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::FetchMessagesL(CStifItemParser& aItem)
+ {
+ TInt err(KErrNone);
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrGeneral;
+ }
+ iLog->Log(_L( "FetchMessages begins" ));
+
+ /**
+ * Params:
+ * - folder name; Inbox if not provided
+ */
+ TFSMailMsgId msgFolderId;
+ TPtrC folderS;
+
+ //get folder name
+ if (aItem.GetString(_L("_messageFolder:"), folderS) == KErrNone)
+ {
+ RPointerArray<CFSMailFolder>& folders = iIPSMailbox->ListFolders();
+ // find and get folder id
+ for (TInt i = 0; i < folders.Count(); i++)
+ {
+ if (folders[i]->GetFolderName().Compare(folderS) == 0)
+ {
+ msgFolderId = folders[i]->GetFolderId();
+ iLog->Log(_L("Message will be fetched from %S folder"),
+ &folderS);
+ break;
+ }
+ }
+ }
+ if (msgFolderId.IsNullId())
+ {
+ iLog->Log(
+ _L("Proper message folder not provided, Inbox folder will be used instead"));
+ msgFolderId = iIPSMailbox->GetStandardFolderId(EFSInbox);
+ }
+ CFSMailFolder* folder = NULL;
+ // get message folder
+ TRAPD(trapErr, folder = iMailClient->GetFolderByUidL(iIPSMailbox->GetId(),msgFolderId));
+ CleanupStack::PushL(folder);
+
+ if (KErrNone == trapErr)
+ {
+ //to get messages from folder
+ RPointerArray<CFSMailMessage> allMessages;
+ GetMessagesFromFolderL(allMessages, folder, EFSMsgDataIdOnly,
+ EFSMailSortByDate, folder->GetMessageCount());
+
+ if (allMessages.Count() > 0)
+ {
+ RArray<TFSMailMsgId> messages;
+ CleanupClosePushL(messages);
+ messages.Append(allMessages[0]->GetMessageId());
+
+ // not used in function
+ TFSMailDetails ruleToFetch = EFSMsgDataEnvelope;
+
+ TRAP(err,folder->FetchMessagesL(messages,ruleToFetch,*this));
+ WaitForResponse(TFSProgress::EFSStatus_RequestComplete,
+ KOneMinuteTime);
+ if (KErrNone == err)
+ {
+ iLog->Log(_L("Messages fetched successfuly"));
+ }
+ else
+ {
+ iLog->Log(_L("Messages fetching failed"));
+ }
+ CleanupStack::PopAndDestroy(&messages);
+ }//end if 'allMessages'
+ else
+ {
+ iLog->Log(_L("No message in %S folder"), &folder->GetFolderName());
+ err = KErrNotFound;
+ }
+ allMessages.ResetAndDestroy();
+ }//end 'trapErr'
+ else
+ {
+ iLog->Log(_L("Message folder could not be created"));
+ }
+ CleanupStack::PopAndDestroy(folder);
+
+ iLog->Log(_L( "FetchMessages ends err=%d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::SendMessagesL
+// Method used to send messages
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::SendMessageL(CStifItemParser& /* aItem*/)
+ {
+ TInt err(KErrNone);
+ TBuf<20> buf;
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrNotFound;
+ }
+ iLog->Log(_L( "SendMessageL begins" ));
+
+ // Step01: Create a message subject
+ buf.Append(KStifEmailSubjectDes);
+ buf.AppendNum(Math::Random());
+ TPtrC subject = buf.Mid(0);
+ iLog->Log(_L("Message is to be sent(Subject:%S)"), &subject);
+
+ // Step02: Create default msg
+ CFSMailMessage* newMsg = CreatePlainTextMsgL(subject, KStifEmailBodyText());
+
+ //Step03: To send message and check it
+ if (NULL != newMsg)
+ {
+ iLog->Log(_L("Tested message with subject '%S' was created"), &subject);
+ CleanupStack::PushL(newMsg);
+ TFSMailMsgId newMsgId = TFSMailMsgId();
+ iLog->Log(_L("Message is to be sent..."));
+ err = SendMsgL(*newMsg, subject, newMsgId); //sending message..
+
+ if (KErrNone == err)
+ iLog->Log(_L("Message was sent successfully"));
+ else
+ iLog->Log(_L("Failed to send message with error (ID:%d)"), err);
+
+ CleanupStack::PopAndDestroy(newMsg);
+ }
+ else
+ {
+ iLog->Log(_L("Error: Tested message was NOT created"));
+ err = KErrNoMemory;
+ }
+ iLog->Log(_L( "SendMessageL ends: %d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::BasicMsgOperationsL
+// Method used to test basic operations of messages
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::BasicMsgOperationsL(CStifItemParser& /* aItem */)
+ {
+ TInt err(KErrNone);
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrNotFound;
+ }
+
+ iLog->Log(_L( "BasicMsgOperationsL begins" ));
+ // I. Prepare test message to send, using basic operations to set msg details
+ CFSMailMessage* newMsg = CreatePlainTextMsgL(KStifEmailSubject,
+ KStifEmailBodyText);
+ CleanupStack::PushL(newMsg);
+
+ // update msg details, add one more recipient in 'To' field (first is own mail address)
+ CFSMailAddress* rec = CFSMailAddress::NewL();
+ rec->SetEmailAddress(KStifEmailToRec1);
+ newMsg->AppendToRecipient(rec);
+
+ // add some recipients to 'Cc' filed
+ rec = CFSMailAddress::NewL();
+ rec->SetEmailAddress(KStifEmailCcRec1);
+ newMsg->AppendCCRecipient(rec);
+
+ rec = CFSMailAddress::NewL();
+ rec->SetEmailAddress(KStifEmailCcRec2);
+ newMsg->AppendCCRecipient(rec);
+
+ // add one recipient in 'Bcc' filed
+ rec = CFSMailAddress::NewL();
+ rec->SetEmailAddress(KStifEmailBccRec1);
+ newMsg->AppendBCCRecipient(rec);
+ rec = NULL;
+
+ // set low priority flag
+ newMsg->SetFlag(EFSMsgFlag_Low);
+
+ // save all changes
+ newMsg->SaveMessageL();
+
+ // II. Send test message
+ TFSMailMsgId newMsgId = TFSMailMsgId();
+ err = SendMsgL(*newMsg, KStifEmailSubject, newMsgId);
+ CleanupStack::PopAndDestroy(newMsg);
+ newMsg = NULL;
+ TFSMailMsgId msgFolderId = iIPSMailbox->GetStandardFolderId(EFSInbox);
+ CFSMailFolder* pFolder = NULL;
+ // get message folder
+ TRAPD(trapErr, pFolder = iMailClient->GetFolderByUidL(iIPSMailbox->GetId(),msgFolderId));
+ CleanupStack::PushL(pFolder);
+
+ if (KErrNone == trapErr)
+ {
+ TFSMailDetails dymmy = EFSMsgDataEnvelope;
+ RArray<TFSMailMsgId> messages;
+ CleanupClosePushL(messages);
+ messages.Append(newMsgId);
+ TRAP(err,pFolder->FetchMessagesL(messages,dymmy,*this));
+ err = WaitForResponse(TFSProgress::EFSStatus_RequestComplete,
+ KOneMinuteTime);
+ if (KErrNone == err)
+ {
+ iLog->Log(_L("Messages fetched successfuly"));
+ }
+ else
+ {
+ iLog->Log(_L("Messages fetching failed"));
+ }
+ CleanupStack::PopAndDestroy(&messages);
+ }
+ CleanupStack::PopAndDestroy(pFolder);
+
+ // III. Check message details, using basic operations to read msg details
+ if (KErrNone == err)
+ {
+ // Test message successfully received
+ // pass null id, not used by BasePlugin anyway
+ newMsg = iMailClient->GetMessageByUidL(iIPSMailbox->GetId(),
+ TFSMailMsgId(), newMsgId, EFSMsgDataEnvelope);
+ if (NULL != newMsg)
+ {
+ CleanupStack::PushL(newMsg);
+ iLog->Log(_L(" Checking message details:"));
+
+ // check sender
+ CFSMailAddress* sender = newMsg->GetSender();
+ TPtrC senderAddr = sender->GetEmailAddress();
+ if (senderAddr.Compare(
+ iIPSMailbox->OwnMailAddress().GetEmailAddress()))
+ {
+ iLog->Log(_L(" Error: Sender '%S' does not match"),
+ &senderAddr);
+ err = KErrGeneral;
+ }
+
+ // check subject
+ TPtrC subject = newMsg->GetSubject();
+ if (subject.Compare(KStifEmailSubject()))
+ {
+ iLog->Log(_L(" Error: Subject '%S' does not match"), &subject);
+ err = KErrGeneral;
+ }
+
+ // check To recipients
+ RPointerArray<CFSMailAddress>& toRecipients =
+ newMsg->GetToRecipients();
+ TInt toRec = toRecipients.Count();
+ if (toRec != 2)
+ {
+ iLog->Log(_L(" Error: Got %d 'To' recipients, expected 2"),
+ toRec);
+ err = KErrGeneral;
+ }
+ else
+ {
+ TPtrC recMail = toRecipients[0]->GetEmailAddress();
+ if (recMail.Compare(
+ iIPSMailbox->OwnMailAddress().GetEmailAddress()))
+ {
+ iLog->Log(_L(" Error: 1. 'To' recipient does not match"));
+ err = KErrGeneral;
+ }
+ recMail.Set(toRecipients[1]->GetEmailAddress());
+ if (recMail.Compare(KStifEmailToRec1))
+ {
+ iLog->Log(_L(" Error: 2. 'To' recipient does not match"));
+ err = KErrGeneral;
+ }
+ }
+ toRecipients.ResetAndDestroy();
+ // check Cc recipients
+ RPointerArray<CFSMailAddress>& ccRecipients =
+ newMsg->GetCCRecipients();
+ TInt ccRec = ccRecipients.Count();
+ if (ccRec != 2)
+ {
+ iLog->Log(_L(" Error: Got %d 'Cc' recipients, expected 2"),
+ ccRec);
+ err = KErrGeneral;
+ }
+ else
+ {
+ TPtrC recMail = ccRecipients[0]->GetEmailAddress();
+ if (recMail.Compare(KStifEmailCcRec1))
+ {
+ iLog->Log(_L(" Error: 1. 'Cc' recipient does not match"));
+ err = KErrGeneral;
+ }
+ recMail.Set(ccRecipients[1]->GetEmailAddress());
+ if (recMail.Compare(KStifEmailCcRec2))
+ {
+ iLog->Log(_L(" Error: 2. 'Cc' recipient does not match"));
+ err = KErrGeneral;
+ }
+ }
+ ccRecipients.ResetAndDestroy();
+ // check Bcc recipients, should be 0
+ RPointerArray<CFSMailAddress>& bccRecipients =
+ newMsg->GetBCCRecipients();
+ TInt bccRec = bccRecipients.Count();
+ if (bccRec != 0)
+ {
+ iLog->Log(_L(" Error: Got %d 'Bcc' recipients, expected 0"),
+ bccRec);
+ err = KErrGeneral;
+ }
+
+ // check priority
+ if (!(newMsg->GetFlags() & EFSMsgFlag_Low))
+ {
+ iLog->Log(_L(" Error: Priority not set to low" ));
+ err = KErrGeneral;
+ }
+
+ // check msg's mailboxId
+ if (newMsg->GetMailBoxId() != iIPSMailbox->GetId())
+ {
+ iLog->Log(_L(" Error: Msg's mailboxId not correct"));
+ err = KErrGeneral;
+ }
+
+ // check test msg's folderId
+ if (newMsg->GetFolderId() != iIPSMailbox->GetStandardFolderId(
+ EFSInbox))
+ {
+ iLog->Log(_L(" Error: Msg's folderId not correct"));
+ err = KErrGeneral;
+ }
+ if (!err)
+ {
+ iLog->Log(_L(" Message details all ok"));
+ }
+ bccRecipients.ResetAndDestroy();
+ CleanupStack::PopAndDestroy(newMsg);
+ }
+ }
+ else
+ {
+ // some problems with sending or receiving came up
+ iLog->Log(_L(" Error: Sending/Receiving failed"));
+ }
+
+ iLog->Log(_L( "BasicMsgOperationsL ends: %d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::CopyMoveMsgsL
+// Method used to copy and move messages from 'Inbox' to a specific folder
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::CopyMoveMsgsL(CStifItemParser& /* aItem */)
+ {
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrNotFound;
+ }
+ iLog->Log(_L( "CopyMoveMsgs begins" ));
+ TInt err(KErrNone);
+ TInt errMove(KErrNone);
+
+ if (iPluginId.PluginId() == TUid::Uid(KIPSSosPop3PluginUid))
+ {
+ //POP plugin not support Move And Copy message functionality.
+ iLog->Log(
+ _L( "POP plugin not support Move And Copy message functionality." ));
+ iLog->Log(_L( "CopyMoveMsgs ends err=%d(Move)" ), errMove);
+ return err;
+ }
+
+ TFSMailMsgId newMsgId = TFSMailMsgId();
+ TFSMailMsgId inboxFolderId = iIPSMailbox->GetStandardFolderId(EFSInbox);
+ TFSMailMsgId draftsFolderId = iIPSMailbox->GetStandardFolderId(
+ EFSDraftsFolder);
+ TFSMailMsgId sentFolderId = iIPSMailbox->GetStandardFolderId(EFSSentFolder);
+
+ CFSMailFolder* folder = iMailClient->GetFolderByUidL(iIPSMailbox->GetId(),
+ inboxFolderId);
+
+ if (NULL != folder)
+ {
+ CleanupStack::PushL(folder);
+ RPointerArray<CFSMailMessage> messages;
+ TInt msgCount(0);
+ TInt gotMsgs = GetMessagesFromFolderL(messages, folder,
+ EFSMsgDataSubject, EFSMailSortByDate, msgCount);
+ RArray<TFSMailMsgId> originalArray;
+ CleanupClosePushL(originalArray);
+ /*
+ * CIpsPlgSosBasePlugin::CopyMessagesL() is empty.
+ * So, it can't test this function
+ */
+ //Moving tested messages from 'Inbox' to 'Sent Items'
+ if (gotMsgs > 0)
+ {
+ iLog->Log(_L(" Listing %d messages:"), gotMsgs);
+ for (TInt i = 0; i < messages.Count(); i++)
+ {
+ iLog->Log(_L("%d.ID:,Subject: %S"), i + 1,
+ &messages[i]->GetSubject());
+ originalArray.Append(messages[i]->GetMessageId());
+ }//end loop: 'for'
+ // Note: Messages cannot be moved from Deleted Items, Drafts, Outbox folders
+
+ //Different between 'IMAP' and 'POP'
+ iLog->Log(_L("IMAP: Moving from 'Inbox' to 'Sent'..."));
+ iIPSMailbox->MoveMessagesL(originalArray, inboxFolderId,
+ sentFolderId);
+ originalArray.Reset();
+
+ // there is no TFSEventMailMoved or TFSEventMailCopied event coming, just TFSEventMailDeleted?
+ errMove = WaitForEvent(TFSEventMailDeleted);
+ }// end of 'gotMsgs > 0'
+ else
+ {
+ iLog->Log(_L("No message in %S folder"), &folder->GetFolderName());
+ errMove = KErrNotFound;
+ }
+ if (KErrNone == errMove)
+ {
+ iLog->Log(_L("Successfully move messages."));
+ }
+ else
+ {
+ iLog->Log(_L("Failed to move with error(ID:%d)"), errMove);
+ err = errMove;
+ }
+ CleanupStack::PopAndDestroy(&originalArray);
+ messages.ResetAndDestroy();
+ CleanupStack::PopAndDestroy(folder);
+ }//end if: 'NULL!=Folder'
+ else
+ {
+ iLog->Log(_L(" Folder is NOT found.(Error's ID:%d)"), err);
+ }
+ iLog->Log(_L( "CopyMoveMsgs ends err=%d(Move)" ), errMove);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::SearchL
+// Method used to test searching functionality
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::SearchL(CStifItemParser& /* aItem */)
+ {
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrNotFound;
+ }
+
+ TInt err(KErrNone);
+ iLog->Log(_L( "Search begins" ));
+
+ // Step01: to prepare testing msg
+ HBufC* bufSubject = HBufC::NewL(30);
+ HBufC* bufBody = HBufC::NewL(128);
+ TPtr subject = bufSubject->Des();
+ TPtr body = bufBody->Des();
+ subject.Append(KStifEmailSubjectDes);
+ body.Append(KStifEmailBodyText);
+
+ TUint randomNum = Math::Random();
+ subject.AppendNum(randomNum);
+ body.Append(_L("-"));
+ body.AppendNum(randomNum);
+
+ iLog->Log(_L("==Testing Email=="));
+ iLog->Log(_L("=Subject is:%S"), &subject);
+ iLog->Log(_L("=Body is:%S"), &body);
+
+ // Step02: Send testing msg to own mail address
+ CFSMailMessage* newMsg = CreatePlainTextMsgL(subject, body);
+ if (NULL != newMsg)
+ {
+ CleanupStack::PushL(newMsg);
+ TFSMailMsgId newMsgId = TFSMailMsgId();
+ err = SendMsgL(*newMsg, subject, newMsgId);
+ if (KErrNone == err)
+ {
+ // Step03: to setup searchL params
+ TFSMailSortCriteria criteria;
+ criteria.iField = EFSMailSortByDate;
+ criteria.iOrder = EFSMailDescending;
+ RPointerArray<TDesC> searchStrings;
+ // Step04: to perform 'Subject' search
+ searchStrings.Append(bufSubject);
+ err = DoSearch(searchStrings, criteria, KOneMinuteTime);
+
+ // Check results for subject Search
+ if (KErrNone == err && iSearchMatches > 0)
+ {
+ iLog->Log(_L("Success: Subject search passed"));
+ }
+ else
+ {
+ iLog->Log(_L("Failed: 'Subject' search with error(%d)"), err);
+ err = KErrNotFound;
+ }
+
+ // Step05: to perform 'Body' search
+ searchStrings.ResetAndDestroy();
+ searchStrings.Append(bufBody);
+
+ //Check results for body Search
+ err = DoSearch(searchStrings, criteria, KOneMinuteTime);
+ if (KErrNone == err && iSearchMatches > 0)
+ {
+ iLog->Log(_L("Success:Body search passed"));
+ }
+ else
+ {
+ iLog->Log(_L("Failed to 'Body' search with error(%d)"), err);
+ err = KErrNotFound;
+ }
+ searchStrings.ResetAndDestroy();
+ }//end if 'KErrNone == err'(sent 'msg' with KErrNone)
+ else
+ {
+ iLog->Log(_L(" Failed to sent message with error(ID:%d)"), err);
+ }
+ CleanupStack::PopAndDestroy(newMsg);
+ }//end if 'NULL != newMsg'
+ else
+ {
+ iLog->Log(_L("Error: tested message was NOT created"));
+ err = KErrGeneral;
+ }
+ iLog->Log(_L( "Search ends err=%d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::AttachmentHandlingL
+// Method used to test functionality of hanlding attachments
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::AttachmentHandlingL(CStifItemParser& /* aItem */)
+ {
+ TInt err(KErrNone);
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrNotFound;
+ }
+
+ iLog->Log(_L( "AttachmentHandlingL begins" ));
+
+ // Create default msg in 'Drafts' folder
+ CFSMailMessage* newMsg = CreatePlainTextMsgL(KStifEmailSubjectAttHandling,
+ KStifEmailBodyText);
+
+ if (NULL != newMsg)
+ {
+ CleanupStack::PushL(newMsg);
+ iLog->Log(_L("Test Email created"));
+ TFSMailMsgId dummyId = TFSMailMsgId();
+
+ //add attachment
+ TFSMailMsgId aInsertBefore;
+ CFSMailMessagePart* msgPart = NULL;
+ TRAP(err,msgPart = newMsg->AddNewAttachmentL(KPopImapProfileTester,aInsertBefore));
+ CleanupStack::PushL(msgPart);
+
+ if (KErrNone != err)
+ {
+ iLog->Log(_L("Adding attachment failed. Error: %d"), err);
+ }
+ else
+ {
+ iLog->Log(_L("New attachment added."));
+ newMsg->SaveMessageL();
+
+ //check if attachment was added
+ RPointerArray<CFSMailMessagePart> attParts;
+ TRAP( err,newMsg->AttachmentListL(attParts) );
+
+ if (KErrNone != err)
+ {
+ iLog->Log(_L("Unable to take attachment list. Error %d"), err);
+ }
+ else
+ {
+ if (attParts.Count() > 0)
+ {
+ TPtrC filename(KPopImapProfileTester);
+ filename.Set(filename.Mid(filename.LocateReverse('\\') + 1));
+ err = attParts[0]->AttachmentNameL().Compare(filename);
+ iLog->Log(
+ _L("Attachment's names comparison: %S (attached file name) vs. %S (expected). Result: %d"),
+ &(attParts[0]->AttachmentNameL()), &filename, err);
+ }
+ }//end if 'KErrNone!=err'
+ attParts.ResetAndDestroy();
+ }//end if 'KErrNone!=err'
+ CleanupStack::PopAndDestroy(msgPart);
+ CleanupStack::PopAndDestroy(newMsg);
+ }//end if 'newMsg'
+ else
+ {
+ iLog->Log(_L("Error: Test Email not created"));
+ err = KErrNoMemory;
+ }
+
+ iLog->Log(_L( "AttachmentHandlingL ends: %d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::BrandingL
+// Method used to test functionality of branding
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::BrandingL(CStifItemParser& aItem)
+ {
+ TInt err(KErrNone);
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L("Error: IMAP/POP profile does NOT exist"));
+ return KErrNotFound;
+ }
+
+ iLog->Log(_L( "== Branding begins ==" ));
+
+ // get brand manager
+ MFSMailBrandManager* brandManager = NULL;
+
+ TRAP( err, brandManager = &iMailClient->GetBrandManagerL() );
+
+ //to check brand manager
+ if (KErrNone != err)
+ {
+ iLog->Log(
+ _L("Error: CFSMailClient::GetBrandManagerL() leaved with %d"),
+ err);
+ }
+ else if (NULL == brandManager)
+ {
+ iLog->Log(_L("Error: CFSMailClient::GetBrandManagerL() returns NULL"));
+ err = KErrGeneral;
+ }
+ else
+ {
+ // test updating mailbox names with real mailbox id
+ TRAP( err, brandManager->UpdateMailboxNamesL( iIPSMailbox->GetId() ) );
+ if (KErrNone != err)
+ {
+ iLog->Log(
+ _L("Error: MFSMailBrandManager::UpdateMailboxNamesL() leaved with %d"),
+ err);
+ }
+ else
+ {
+ // get param regarding expected branding status
+ TBool brand = EFalse;
+ TPtrC expectBrandS;
+ aItem.GetString(_L("_isBranded:"), expectBrandS);
+
+ if (expectBrandS.Compare(_L("true")) == 0)
+ {
+ iLog->Log(_L("Branding expected..."));
+ brand = ETrue;
+ }
+ else
+ {
+ iLog->Log(_L("Branding not expected..."));
+ }
+
+ // check mailbox name branding
+ TPtrC textBrand;
+ TRAP( err, textBrand.Set( brandManager->GetTextL( EFSMailboxName, iIPSMailbox->GetId() ) ) );
+ if (KErrNone != err)
+ {
+ iLog->Log(
+ _L("Error: MFSMailBrandManager::GetTextL() leaved with %d"),
+ err);
+ }
+ TBool textBranded = textBrand.Length() != 0 ? ETrue : EFalse;
+ if (textBranded)
+ {
+ iLog->Log(_L("Mailbox's name (%S) branded."), &textBrand);
+ }
+ else
+ {
+ iLog->Log(_L("Mailbox's name (%S) was not branded."),
+ &textBrand);
+ }
+ //to check whether it is expected?
+ if (brand == textBranded)
+ {
+ iLog->Log(_L("Successfully test, it was a expected retult."));
+ err = KErrNone;
+ }
+ else
+ {
+ iLog->Log(_L("Failed to test, it was NOT a expected retult."));
+ err = KErrGeneral;
+ }
+ } // end if 'UpdateMailboxNames'
+ } //end if 'BrandManager'
+
+ iLog->Log(_L( "Branding ends ret=%d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::DeleteMsgsL
+// Method used to delete messages
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::DeleteMsgsL(CStifItemParser& aItem)
+ {
+ TInt err(KErrNone);
+ iLog->Log(_L( "DeleteMessagesL begins" ));
+
+ // Step 01: To refresh mailbox
+ iLog->Log(_L(" Step 01: To synchronize mailbox"));
+ TInt reqId = iIPSMailbox->RefreshNowL(*this);
+ err = WaitForEvent(TFSEventMailboxOnline);
+ WaitForResponse(TFSProgress::EFSStatus_RequestComplete, KOneMinuteTime);
+ if (KErrNone == err)
+ {
+ // Step 02: To delete tested messages
+ iLog->Log(_L(" Step 02: To delete tested messages"));
+ TPtrC folderName;
+ // We intended to delete messages in a folder only. Here, it is 'Inbox' folder.
+ aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
+ if (aItem.GetString(_L("_folder:"), folderName))
+ {
+ iLog->Log(_L("Error: test case argument is missing"));
+ err = KErrArgument;
+ }
+ else
+ err = DeleteTestMsgL(folderName);
+
+ if (KErrNone == err)
+ {
+ //Step 03: To check whether tested messages were sucessfully deleted
+ iLog->Log(_L(" Step 03: To tested if messages really deleted"));
+ err = DeleteTestMsgL(folderName);
+
+ if (err == KErrNotFound)
+ {
+ iLog->Log(_L("Succesfully deleted tested messages"));
+ err = KErrNone;
+ }
+ else
+ {
+ iLog->Log(_L("Failed to delete tested messages"));
+ err = KErrGeneral;
+ }
+ }//end if 'KErrNone == err'
+ else
+ {
+ iLog->Log(_L(" Warning: No tested messages to delete"));
+ }
+ }//end outer if
+ else
+ {
+ iLog->Log(_L(" Warning: synchronize mailbox failed!"));
+ err = KErrGeneral;
+ }
+ iLog->Log(_L( "DeleteMessagesL ends: %d" ), err);
+ return err;
+ }
+// -----------------------------------------------------------------------------
+// CPopImapProfileTester::RemoveAccountL
+// Method used to remove an imap or pop account
+// -----------------------------------------------------------------------------
+//
+TInt CPopImapProfileTester::RemoveAccountL(CStifItemParser& /* aItem */)
+ {
+ iLog->Log(_L( "RemoveAccount begins" ));
+ TInt err(KErrNone);
+ if (NULL == iIPSMailbox)
+ {
+ iLog->Log(_L( " Error: IMAP/POP profile does NOT exist" ));
+ err = KErrNotFound;
+ }
+ else
+ {
+ iLog->Log(_L( "Mailbox Id: %x"), iIPSMailbox->GetId().Id());
+ // start test case
+ TInt reqId = iMailClient->DeleteMailBoxByUidL(iIPSMailbox->GetId(),
+ *this);
+ // end test case
+ iLog->Log(_L("-->ReqResp: %d"), reqId);
+
+ // Check if mailbox is really deleted
+ RPointerArray<CFSMailBox> mailboxes;
+ iMailClient->ListMailBoxes(iIPSMailbox->GetId(), mailboxes);
+ if (mailboxes.Count() > 0)
+ {
+ iLog->Log(_L( " Failed: Mailbox was not deleted" ));
+ err = KErrGeneral;
+ }
+ else
+ {
+ iLog->Log(_L( " Success: Mailbox was deleted" ));
+ iMailClient->UnsubscribeMailboxEvents(iIPSMailbox->GetId(), *this);
+ DELANDNULL(iIPSMailbox);
+ err = KErrNone;
+ }
+ mailboxes.ResetAndDestroy();
+ }//end if 'count'
+
+ iLog->Log(_L( "RemoveAccount ends err=%d" ), err);
+ return err;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/tsrc/profiletester/src/timeouttimer.cpp Tue Sep 14 20:48:24 2010 +0300
@@ -0,0 +1,122 @@
+/*
+ * ============================================================================
+ * Name : timeouttimer.cpp
+ * Part of : ipsservice / profiletester
+ * Description :: timer implementation
+ * Version : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+ *
+ * Copyright © 2010-2010 Nokia and/or its subsidiary(-ies). All rights reserved.
+ * This material, including documentation and any related computer
+ * programs, is protected by copyright controlled by Nokia. All
+ * rights are reserved. Copying, including reproducing, storing,
+ * adapting or translating, any or all of this material requires the
+ * prior written consent of Nokia. This material also contains
+ * confidential information which may not be disclosed to others
+ * without the prior written consent of Nokia.
+ * ============================================================================
+ */
+
+#include "timeouttimer.h"
+
+// -----------------------------------------------------------------------------
+// CTimeoutTimer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CTimeoutTimer* CTimeoutTimer::NewL(MTimeoutObserver& aHandle)
+ {
+ CTimeoutTimer* self = CTimeoutTimer::NewLC(aHandle);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CTimeoutTimer::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CTimeoutTimer* CTimeoutTimer::NewLC(MTimeoutObserver& aHandle)
+ {
+ CTimeoutTimer* self = new (ELeave) CTimeoutTimer(aHandle);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CTimeoutTimer::CTimeoutTimer
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CTimeoutTimer::CTimeoutTimer(MTimeoutObserver& aHandle) :
+ CTimer(EPriorityStandard), iNotifyHandle(aHandle)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CTimeoutTimer::~CTimeoutTimer
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CTimeoutTimer::~CTimeoutTimer()
+ {
+ Stop();
+ }
+
+// -----------------------------------------------------------------------------
+// CTimeoutTimer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CTimeoutTimer::ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+ }
+
+// -----------------------------------------------------------------------------
+// CTimeoutTimer::Start
+// Start
+// -----------------------------------------------------------------------------
+//
+void CTimeoutTimer::Start(TInt aTimePeriod)
+ {
+ After(aTimePeriod);
+ }
+
+// -----------------------------------------------------------------------------
+// CTimeoutTimer::Stop
+// Stop
+// -----------------------------------------------------------------------------
+//
+void CTimeoutTimer::Stop()
+ {
+ Cancel();
+ }
+
+// -----------------------------------------------------------------------------
+// CTimeoutTimer::RunL
+// RunL
+// -----------------------------------------------------------------------------
+//
+void CTimeoutTimer::RunL()
+ {
+ if (iStatus == KErrNone)
+ {
+ iNotifyHandle.TimeoutNotify();
+ }
+ else
+ {
+ User::Leave(iStatus.Int());
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CTimeoutTimer::RunError
+// RunError
+// -----------------------------------------------------------------------------
+//
+TInt CTimeoutTimer::RunError(TInt /*aError*/)
+ {
+ return KErrNone;
+ }