--- a/email/imap4mtm/imapmailstore/src/cstoreutilities.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/email/imap4mtm/imapmailstore/src/cstoreutilities.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -48,7 +48,6 @@
void CStoreUtilities::ConstructL()
{
- User::LeaveIfError(iFs.Connect());
// Create converter objects
iCharacterConverter=CCnvCharacterSetConverter::NewL();
iCharConv=CImConvertCharconv::NewL(*iCharacterConverter, iFs);
--- a/email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -1574,6 +1574,11 @@
CImHeader *messageheader=CImHeader::NewLC();
ProcessEnvelopeL(messageheader, aMessage, aBodyStructure->GetRfc822EnvelopeStructureL());
+ if(aBodyStructure->EmbeddedBodyStructureList().Count() == 0)
+ {
+ aMessage.iType=KUidMsvAttachmentEntry;
+ }
+
// Create message
User::LeaveIfError(iServerEntry.CreateEntryBulk(aMessage)); // bulk op completed at the end of ProcessBodyStructureL()
SetEntryL(aMessage.Id());
@@ -1592,9 +1597,17 @@
TInt attachments=0;
TInt relatedAttachments;
TBool isMHTML=EFalse;
+ CImapBodyStructure* bodystructure = NULL;
- CImapBodyStructure* bodystructure = aBodyStructure->EmbeddedBodyStructureList()[0];
- BuildTreeL(aMessage.Id(), bodystructure, aPath, aMessage.Id(), attachments, isMHTML, relatedAttachments);
+ if(aBodyStructure->EmbeddedBodyStructureList().Count() > 0)
+ {
+ bodystructure = aBodyStructure->EmbeddedBodyStructureList()[0];
+ }
+ if (bodystructure)
+ {
+ BuildTreeL(aMessage.Id(), bodystructure, aPath, aMessage.Id(), attachments, isMHTML, relatedAttachments);
+ }
+
__LOG_FORMAT((iSession->LogId(), " Built embedded message id %x attachments %d MHTML %d", aMessage.Id(), attachments, isMHTML));
// Save attachment and MHTML flags
@@ -1879,10 +1892,15 @@
iHeaderConverter->DecodeAllHeaderFieldsL(*aHeader);
// Set from line in TMsvEntry
- aEntry.iDetails.Set(aHeader->From());
-
+ if(aHeader->From().Length() > 0)
+ {
+ aEntry.iDetails.Set(aHeader->From());
+ }
+ if(aHeader->Subject().Length() > 0)
+ {
// Set subject in TMsvEntry
- aEntry.iDescription.Set(aHeader->Subject());
+ aEntry.iDescription.Set(aHeader->Subject());
+ }
__LOG_TEXT(iSession->LogId(), " Finished processing envelope information");
}
--- a/email/imap4mtm/imapservermtm/inc/cimapupsresponsewaiter.h Tue Jul 06 14:12:40 2010 +0300
+++ b/email/imap4mtm/imapservermtm/inc/cimapupsresponsewaiter.h Wed Aug 18 09:45:25 2010 +0300
@@ -1,6 +1,6 @@
// cimapupsresponsewaiter.h
-// Copyright (c) 2007-2009 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"
@@ -50,6 +50,7 @@
void DoRunL();
void DoCancel();
private:
+ CImapSettings* iImapSettings;
CMsvServerEntry& iServerEntry;
CImapProtocolController& iImapProtocolController;
CMsvEntrySelection* iEntrySelection;
--- a/email/imap4mtm/imapservermtm/src/cimapupsresponsewaiter.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/email/imap4mtm/imapservermtm/src/cimapupsresponsewaiter.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 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"
@@ -37,7 +37,8 @@
CImapUpsResponseWaiter::CImapUpsResponseWaiter(CMsvServerEntry& aServerEntry, CImapProtocolController& aImapProtocolController)
:CMsgActive(EPriorityStandard), iServerEntry(aServerEntry), iImapProtocolController(aImapProtocolController)
{
- CActiveScheduler::Add(this);
+ iImapSettings = CImapSettings::NewL(iServerEntry);
+ CActiveScheduler::Add(this);
}
/**
@@ -46,6 +47,7 @@
CImapUpsResponseWaiter::~CImapUpsResponseWaiter()
{
Cancel();
+ delete iImapSettings;
iUpsSubsession.Close();
iUpsSession.Close();
}
@@ -73,28 +75,32 @@
{
iState = EIMAP4MTMConnectAndSynchronise;
}
- iEntrySelection = &aEntrySelection;
+
+ iEntrySelection = &aEntrySelection;
iDecision = EUpsDecNo;
- CImapSettings* imapSettings = CImapSettings::NewL(iServerEntry);
- CleanupStack::PushL(imapSettings);
- imapSettings->LoadSettingsL(iServerEntry.Entry().Id());
+ if( iImapSettings->SettingsLoaded() == EFalse)
+ {
+ iImapSettings->LoadSettingsL(iServerEntry.Entry().Id());
+ }
// Connect to UPS service.....
User::LeaveIfError(iUpsSession.Connect());
+
RThread clientThread;
User::LeaveIfError(clientThread.Open(aClientThreadId));
CleanupClosePushL(clientThread);
- User::LeaveIfError(iUpsSubsession.Initialise(iUpsSession, clientThread));
+
+ User::LeaveIfError(iUpsSubsession.Initialise(iUpsSession, clientThread));
CleanupStack::PopAndDestroy(&clientThread);
-
iStatus=KRequestPending;
- iUpsSubsession.Authorise(aHasCapability, KUidIMAPService, imapSettings->ServerAddress(), iDecision, iStatus);
+ iUpsSubsession.Authorise(aHasCapability, KUidIMAPService, iImapSettings->ServerAddress(), iDecision, iStatus);
+
Queue(aStatus);
SetActive();
- CleanupStack::PopAndDestroy();// imapSettings
+
}
--- a/email/imap4mtm/imapsession/src/cimapbodystructurebuilder.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/email/imap4mtm/imapsession/src/cimapbodystructurebuilder.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -216,8 +216,16 @@
// Found a "MESSAGE/RFC822" body structure.
// This contains an embedded bodystructure, so parse up to the structure,
// and then allow the loop to parse the embedded structure.
- ParseBodyTypeMessageRfc822L();
- parseStep = EParseNewBodyStructure;
+ TRAPD(err, ParseBodyTypeMessageRfc822L());
+ if(err == KErrImapCorrupt)
+ {
+ parseStep =EParseRemainderMessageRfc822;
+ }
+ else
+ {
+ parseStep = EParseNewBodyStructure;
+ }
+
}
break;
case EParseRemainderMessageRfc822:
@@ -520,13 +528,13 @@
{
// body-fields SP SP body SP body-fld-lines
ParseBodyFieldsL();
-
- // envelope
- ParseEnvelopeL();
-
- // Expect a body substructure next.
- // Position iAtomWalker at the opening bracket, ready for ParseBodyStructureTypeL
- iAtomWalker->WalkAcrossL(ETrue);
+ TRAPD(err, ParseEnvelopeL());
+
+ // Expect a body substructure next.
+ // Position iAtomWalker at the opening bracket, ready for ParseBodyStructureTypeL
+ iAtomWalker->WalkAcrossL(ETrue);
+ if(err == KErrImapCorrupt)
+ CImapCommand::CorruptDataL(iLogId);
}
/**
--- a/email/imap4mtm/imapsettings/src/cimapsettings.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/email/imap4mtm/imapsettings/src/cimapsettings.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -170,7 +170,7 @@
void CImapSettings::ReadResourceFileL()
{
RFs fs;
- fs.Connect();
+ User::LeaveIfError(fs.Connect());
CleanupClosePushL(fs);
// NB need to check on all drives - won't necessarily be on
--- a/email/imap4mtm/imapsyncmanager/src/cimapfolder.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/email/imap4mtm/imapsyncmanager/src/cimapfolder.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 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"
@@ -96,6 +96,12 @@
iMatchingMessageIds.Reset();
iDeletedMessageIds.Reset();
iMissingMessageIds.Reset();
+
+ if(iCachedEntryData)
+ {
+ iCachedEntryData->Close();
+ }
+
delete iSelection;
iFolderIndex->Reset();
iMessageFlagInfoArray.Reset();
@@ -1121,9 +1127,12 @@
SetEntryL(aFolder);
GetChildrenL(*aChildren);
+ if(iCachedEntryData)
+ {
+ iCachedEntryData->Close();
+ }
delete iCachedEntryData;
iCachedEntryData = NULL;
-
iCachedEntryData = new(ELeave) RArray<TMsvCacheData>(5);
// Go through them, checking to see if they're messages and removing ones that aren't
--- a/email/pop3andsmtpmtm/clientmtms/src/cemailaccounts.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/email/pop3andsmtpmtm/clientmtms/src/cemailaccounts.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-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"
@@ -809,6 +809,7 @@
*/
EXPORT_C void CEmailAccounts::GetPopAccountsL(RArray<TPopAccount>& aAccounts)
{
+ CleanupClosePushL( aAccounts );
aAccounts.Reset();
CRepository& popRepository = PopRepositoryL();
@@ -855,7 +856,8 @@
}
}
- CleanupStack::PopAndDestroy(3, &popAccountIds);
+ CleanupStack::PopAndDestroy(3, &popAccountIds);
+ CleanupStack::Pop(&aAccounts); // aAccounts
}
/**
@@ -921,6 +923,7 @@
*/
EXPORT_C void CEmailAccounts::GetImapAccountsL(RArray<TImapAccount>& aAccounts)
{
+ CleanupClosePushL( aAccounts );
aAccounts.Reset();
CRepository& imapRepository = ImapRepositoryL();
@@ -967,7 +970,8 @@
}
}
- CleanupStack::PopAndDestroy(3, &imapAccountIds);
+ CleanupStack::PopAndDestroy(3, &imapAccountIds);
+ CleanupStack::Pop(&aAccounts); // aAccounts
}
void CEmailAccounts::GetEmailServicesL(CMsvEntrySelection& aServices, TUid aMTMType, CMsvEntry& aMsvEntry)
@@ -1057,6 +1061,7 @@
*/
EXPORT_C void CEmailAccounts::GetSmtpAccountsL(RArray<TSmtpAccount>& aAccounts)
{
+ CleanupClosePushL( aAccounts );
aAccounts.Reset();
CRepository& smtpRepository = SmtpRepositoryL();
@@ -1103,7 +1108,8 @@
}
}
- CleanupStack::PopAndDestroy(3, &smtpAccountIds);
+ CleanupStack::PopAndDestroy(3, &smtpAccountIds);
+ CleanupStack::Pop(&aAccounts); // aAccounts
}
/**
@@ -1116,6 +1122,7 @@
*/
EXPORT_C void CEmailAccounts::GetSmtpMobilityAccountsL(const TSmtpAccount& aSmtpAccount, RArray<TSmtpMobilityAccount>& aAccounts)
{
+ CleanupClosePushL( aAccounts );
aAccounts.Reset();
CRepository& repository = SmtpRepositoryL();
@@ -1150,6 +1157,8 @@
{
User::Leave(err);
}
+
+ CleanupStack::Pop(&aAccounts); // aAccounts
}
/**
@@ -1161,6 +1170,7 @@
*/
EXPORT_C void CEmailAccounts::GetSmtpMobilityAccountsL(RArray<TSmtpMobilityAccount>& aAccounts)
{
+ CleanupClosePushL( aAccounts );
aAccounts.Reset();
CRepository& repository = SmtpRepositoryL();
@@ -1190,6 +1200,7 @@
}
CleanupStack::PopAndDestroy(&smtpAccountIds);
+ CleanupStack::Pop(&aAccounts); // aAccounts
}
/**
--- a/email/pop3andsmtpmtm/popservermtm/src/POPSMTM.CPP Tue Jul 06 14:12:40 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/src/POPSMTM.CPP Wed Aug 18 09:45:25 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -1432,6 +1432,14 @@
{
CommandComplete( eCode );
}
+ else if(iState.iLastCurrentOperation == EPopConnectedAndIdle && iState.iCurrentOperation == EPopDisconnected && eCode != KErrNone)
+ {
+ // Some email servers doesn’t wait for QUIT command, in such cases need to close RConnection
+ delete iSessionManager;
+ iSessionManager = NULL;
+
+ iPopProgress.iErrorCode = eCode;
+ }
else
{
iPopProgress.iErrorCode = eCode;
--- a/email/pop3andsmtpmtm/servermtmutils/src/IMCVSEND.CPP Tue Jul 06 14:12:40 2010 +0300
+++ b/email/pop3andsmtpmtm/servermtmutils/src/IMCVSEND.CPP Wed Aug 18 09:45:25 2010 +0300
@@ -2222,7 +2222,7 @@
iIsNewChunk = ETrue;
iCurrentChunk.Close();
- iCurrentChunk.Create(KChunkSize);
+ iCurrentChunk.CreateL(KChunkSize);
if (aServerEntry.HasStoreL())
{
@@ -2303,7 +2303,7 @@
TInt currentChunkLength = iCurrentChunk.Length();
// Resize iCurrentChunk as per data left for send operation.
- iCurrentChunk.ReAlloc(KChunkSize + currentChunkLength);
+ iCurrentChunk.ReAllocL(KChunkSize + currentChunkLength);
iCurrentChunk.SetMax();
TPtr16 restoredChunkPtr = iCurrentChunk.MidTPtr(currentChunkLength);
--- a/email/pop3andsmtpmtm/servermtmutils/src/imcvrecv.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/email/pop3andsmtpmtm/servermtmutils/src/imcvrecv.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-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"
@@ -415,11 +415,9 @@
iStore8BitData = reader.ReadInt8();
CleanupStack::PopAndDestroy(buf);
- //read iStorePlainBodyText flag for writing bodytext chunk bu chunk.
- buf = resFile.AllocReadLC( STORE_PLAIN_BODY_TEXT );
- reader.SetBuffer(buf);
- iStorePlainBodyText = reader.ReadInt8();
- CleanupStack::PopAndDestroy(buf);
+ //read iStorePlainBodyText flag for writing bodytext chunk by chunk.
+ //For Pop case, it always writes bodytext chunk by chunk
+ iStorePlainBodyText = 1;
buf = resFile.AllocReadLC( REMOVED_ATTACHMENT_TAG );
@@ -3976,7 +3974,11 @@
iLex.UnGetToMark(initMark);
ParseRfc2231ParameterInfoL(aTag, rBuffer, offset );
}
- CleanupStack::Pop(rBuffer8);
+ if( param.Length() > 0 )
+ {
+ CleanupStack::Pop(rBuffer8);
+ }
+
}
}
--- a/email/pop3andsmtpmtm/smtpservermtm/src/IMSM.CPP Tue Jul 06 14:12:40 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/src/IMSM.CPP Wed Aug 18 09:45:25 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-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"
@@ -791,24 +791,10 @@
*/
void CMsgImOutboxSend::Complete(TInt status)
{
- if (iState != EStateMobilityError)
- {
- // Respond to any outstanding bearer mobility requests as we are about
- // to exit and we don't need to hold up the migration.
- if (PreparingForMigration())
- {
- SignalMigrate();
- }
- else if (iMobilityOperation == EMobilityOperationMigrating &&
- iState == EStateConnectingSession)
- {
- if (iMobilityManager)
- {
- iMobilityManager->NewCarrierAccepted();
- }
- }
- }
-
+ // sending of all the emails has completed, no need listen for Mobility Manager
+ delete iMobilityManager;
+ iMobilityManager=NULL;
+
delete iSession;
iSession = NULL;
delete iSessionManager;
@@ -1224,8 +1210,8 @@
delete iWaiter;
#endif
+ delete iMobilityManager;
delete iSessionManager;
- delete iMobilityManager;
}
CDesCArray& CMsgImOutboxSend::BccRcptArray()
--- a/inc/unieditorplugininterface.h Tue Jul 06 14:12:40 2010 +0300
+++ b/inc/unieditorplugininterface.h Wed Aug 18 09:45:25 2010 +0300
@@ -34,7 +34,8 @@
*/
enum EditorOperation
{
- Forward = 0,
+ Forward = 0,
+ Reply,
ReplyAll,
Default
};
Binary file messagingapp/conf/CI_messaging.confml has changed
Binary file messagingapp/conf/messaging.confml has changed
--- a/messagingapp/conf/messaging_conf.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/conf/messaging_conf.pro Wed Aug 18 09:45:25 2010 +0300
@@ -24,6 +24,7 @@
BLD_INF_RULES.prj_exports += \
"$${LITERAL_HASH}include <platform_paths.hrh>" \
"messaging.confml APP_LAYER_CONFML(messaging.confml)" \
+ "CI_messaging.confml APP_LAYER_CONFML(CI_messaging.confml)" \
"messaging_101F87EB.crml APP_LAYER_CRML(messaging_101F87EB.crml)" \
"messaging_101F87EC.crml APP_LAYER_CRML(messaging_101F87EC.crml)" \
"messaging_101F87ED.crml APP_LAYER_CRML(messaging_101F87ED.crml)" \
--- a/messagingapp/msgappfw/client/bwins/csserverclientapiu.def Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/client/bwins/csserverclientapiu.def Wed Aug 18 09:45:25 2010 +0300
@@ -7,22 +7,22 @@
?GetTotalUnreadCountL@CCSRequestHandler@@QAEKXZ @ 6 NONAME ; unsigned long CCSRequestHandler::GetTotalUnreadCountL(void)
?RemoveResultsEventL@CCSRequestHandler@@QAEXPAVMCsResultsObserver@@@Z @ 7 NONAME ; void CCSRequestHandler::RemoveResultsEventL(class MCsResultsObserver *)
?MarkMessagingHistoryReadL@CCSRequestHandler@@QAEXH@Z @ 8 NONAME ; void CCSRequestHandler::MarkMessagingHistoryReadL(int)
- ?NewLC@CCSRequestHandler@@SAPAV1@XZ @ 9 NONAME ; class CCSRequestHandler * CCSRequestHandler::NewLC(void)
- ?RemoveCachingStatusEventL@CCSRequestHandler@@QAEXPAVMCsCachingStatusObserver@@@Z @ 10 NONAME ; void CCSRequestHandler::RemoveCachingStatusEventL(class MCsCachingStatusObserver *)
+ ?RemoveCachingStatusEventL@CCSRequestHandler@@QAEXPAVMCsCachingStatusObserver@@@Z @ 9 NONAME ; void CCSRequestHandler::RemoveCachingStatusEventL(class MCsCachingStatusObserver *)
+ ?NewLC@CCSRequestHandler@@SAPAV1@XZ @ 10 NONAME ; class CCSRequestHandler * CCSRequestHandler::NewLC(void)
?RequestResultsEventL@CCSRequestHandler@@QAEXPAVMCsResultsObserver@@@Z @ 11 NONAME ; void CCSRequestHandler::RequestResultsEventL(class MCsResultsObserver *)
?GetConversationUnreadListL@CCSRequestHandler@@QAEXPAV?$RPointerArray@VCCsClientConversation@@@@@Z @ 12 NONAME ; void CCSRequestHandler::GetConversationUnreadListL(class RPointerArray<class CCsClientConversation> *)
?GetConversationListL@CCSRequestHandler@@QAEXXZ @ 13 NONAME ; void CCSRequestHandler::GetConversationListL(void)
- ?GetMessagingHistoryL@CCSRequestHandler@@QAEXH@Z @ 14 NONAME ; void CCSRequestHandler::GetMessagingHistoryL(int)
- ?Version@CCSRequestHandler@@QBE?AVTVersion@@XZ @ 15 NONAME ; class TVersion CCSRequestHandler::Version(void) const
- ?GetCachingStatusL@CCSRequestHandler@@QAEEXZ @ 16 NONAME ; unsigned char CCSRequestHandler::GetCachingStatusL(void)
- ?RequestCachingStatusEventL@CCSRequestHandler@@QAEXPAVMCsCachingStatusObserver@@@Z @ 17 NONAME ; void CCSRequestHandler::RequestCachingStatusEventL(class MCsCachingStatusObserver *)
- ?RequestConversationChangeEventL@CCSRequestHandler@@QAEXPAVMCsConversationChangeObserver@@PAVCCsClientConversation@@@Z @ 18 NONAME ; void CCSRequestHandler::RequestConversationChangeEventL(class MCsConversationChangeObserver *, class CCsClientConversation *)
- ?ClearMessagingHistoryL@CCSRequestHandler@@QAEXH@Z @ 19 NONAME ; void CCSRequestHandler::ClearMessagingHistoryL(int)
- ?MarkConversationReadL@CCSRequestHandler@@QAEXH@Z @ 20 NONAME ; void CCSRequestHandler::MarkConversationReadL(int)
- ?RemoveConversationListChangeEventL@CCSRequestHandler@@QAEXPAVMCsConversationListChangeObserver@@@Z @ 21 NONAME ; void CCSRequestHandler::RemoveConversationListChangeEventL(class MCsConversationListChangeObserver *)
- ?GetConversationsL@CCSRequestHandler@@QAEXPAVCCsClientConversation@@@Z @ 22 NONAME ; void CCSRequestHandler::GetConversationsL(class CCsClientConversation *)
+ ?GetMessagingHistoryL@CCSRequestHandler@@QAEXHHH@Z @ 14 NONAME ; void CCSRequestHandler::GetMessagingHistoryL(int, int, int)
+ ?GetConversationFromMessageIdL@CCSRequestHandler@@QAEPAVCCsClientConversation@@H@Z @ 15 NONAME ; class CCsClientConversation * CCSRequestHandler::GetConversationFromMessageIdL(int)
+ ?Version@CCSRequestHandler@@QBE?AVTVersion@@XZ @ 16 NONAME ; class TVersion CCSRequestHandler::Version(void) const
+ ?GetCachingStatusL@CCSRequestHandler@@QAEEXZ @ 17 NONAME ; unsigned char CCSRequestHandler::GetCachingStatusL(void)
+ ?RequestCachingStatusEventL@CCSRequestHandler@@QAEXPAVMCsCachingStatusObserver@@@Z @ 18 NONAME ; void CCSRequestHandler::RequestCachingStatusEventL(class MCsCachingStatusObserver *)
+ ?RequestConversationChangeEventL@CCSRequestHandler@@QAEXPAVMCsConversationChangeObserver@@PAVCCsClientConversation@@@Z @ 19 NONAME ; void CCSRequestHandler::RequestConversationChangeEventL(class MCsConversationChangeObserver *, class CCsClientConversation *)
+ ?ClearMessagingHistoryL@CCSRequestHandler@@QAEXH@Z @ 20 NONAME ; void CCSRequestHandler::ClearMessagingHistoryL(int)
+ ?MarkConversationReadL@CCSRequestHandler@@QAEXH@Z @ 21 NONAME ; void CCSRequestHandler::MarkConversationReadL(int)
+ ?RemoveConversationListChangeEventL@CCSRequestHandler@@QAEXPAVMCsConversationListChangeObserver@@@Z @ 22 NONAME ; void CCSRequestHandler::RemoveConversationListChangeEventL(class MCsConversationListChangeObserver *)
?GetConversationIdL@CCSRequestHandler@@QAEHH@Z @ 23 NONAME ; int CCSRequestHandler::GetConversationIdL(int)
- ?NewL@CCSRequestHandler@@SAPAV1@XZ @ 24 NONAME ; class CCSRequestHandler * CCSRequestHandler::NewL(void)
- ?GetConversationFromMessageIdL@CCSRequestHandler@@QAEPAVCCsClientConversation@@H@Z @ 25 NONAME ; class CCsClientConversation * CCSRequestHandler::GetConversationFromMessageIdL(int)
- ?GetConversationFromConversationIdL@CCSRequestHandler@@QAEPAVCCsClientConversation@@H@Z @ 26 NONAME ; class CCsClientConversation * CCSRequestHandler::GetConversationFromConversationIdL(int)
+ ?GetConversationFromConversationIdL@CCSRequestHandler@@QAEPAVCCsClientConversation@@H@Z @ 24 NONAME ; class CCsClientConversation * CCSRequestHandler::GetConversationFromConversationIdL(int)
+ ?GetConversationsL@CCSRequestHandler@@QAEXPAVCCsClientConversation@@HH@Z @ 25 NONAME ; void CCSRequestHandler::GetConversationsL(class CCsClientConversation *, int, int)
+ ?NewL@CCSRequestHandler@@SAPAV1@XZ @ 26 NONAME ; class CCSRequestHandler * CCSRequestHandler::NewL(void)
--- a/messagingapp/msgappfw/client/eabi/csserverclientapiu.def Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/client/eabi/csserverclientapiu.def Wed Aug 18 09:45:25 2010 +0300
@@ -1,12 +1,12 @@
EXPORTS
_ZN17CCSRequestHandler15ShutdownServerLEv @ 1 NONAME
_ZN17CCSRequestHandler17GetCachingStatusLEv @ 2 NONAME
- _ZN17CCSRequestHandler17GetConversationsLEP21CCsClientConversation @ 3 NONAME
+ _ZN17CCSRequestHandler17GetConversationsLEP21CCsClientConversationii @ 3 NONAME
_ZN17CCSRequestHandler18GetConversationIdLEi @ 4 NONAME
_ZN17CCSRequestHandler19DeleteConversationLEi @ 5 NONAME
_ZN17CCSRequestHandler19RemoveResultsEventLEP18MCsResultsObserver @ 6 NONAME
_ZN17CCSRequestHandler20GetConversationListLEv @ 7 NONAME
- _ZN17CCSRequestHandler20GetMessagingHistoryLEi @ 8 NONAME
+ _ZN17CCSRequestHandler20GetMessagingHistoryLEiii @ 8 NONAME
_ZN17CCSRequestHandler20GetTotalUnreadCountLEv @ 9 NONAME
_ZN17CCSRequestHandler20RequestResultsEventLEP18MCsResultsObserver @ 10 NONAME
_ZN17CCSRequestHandler21MarkConversationReadLEi @ 11 NONAME
@@ -19,16 +19,16 @@
_ZN17CCSRequestHandler29GetConversationIdFromAddressLER7TDesC16 @ 18 NONAME
_ZN17CCSRequestHandler30RemoveConversationChangeEventLEP29MCsConversationChangeObserverP21CCsClientConversation @ 19 NONAME
_ZN17CCSRequestHandler31RequestConversationChangeEventLEP29MCsConversationChangeObserverP21CCsClientConversation @ 20 NONAME
- _ZN17CCSRequestHandler34RemoveConversationListChangeEventLEP33MCsConversationListChangeObserver @ 21 NONAME
- _ZN17CCSRequestHandler35RequestConversationListChangeEventLEP33MCsConversationListChangeObserver @ 22 NONAME
- _ZN17CCSRequestHandler4NewLEv @ 23 NONAME
- _ZN17CCSRequestHandler5NewLCEv @ 24 NONAME
- _ZNK17CCSRequestHandler7VersionEv @ 25 NONAME
- _ZTI17CCSRequestHandler @ 26 NONAME
- _ZTI22CCsNotificationHandler @ 27 NONAME
- _ZTI29CCsConversationChangeObserver @ 28 NONAME
- _ZTV17CCSRequestHandler @ 29 NONAME
- _ZTV22CCsNotificationHandler @ 30 NONAME
- _ZTV29CCsConversationChangeObserver @ 31 NONAME
- _ZN17CCSRequestHandler34GetConversationFromConversationIdLEi @ 32 NONAME
+ _ZN17CCSRequestHandler34GetConversationFromConversationIdLEi @ 21 NONAME
+ _ZN17CCSRequestHandler34RemoveConversationListChangeEventLEP33MCsConversationListChangeObserver @ 22 NONAME
+ _ZN17CCSRequestHandler35RequestConversationListChangeEventLEP33MCsConversationListChangeObserver @ 23 NONAME
+ _ZN17CCSRequestHandler4NewLEv @ 24 NONAME
+ _ZN17CCSRequestHandler5NewLCEv @ 25 NONAME
+ _ZNK17CCSRequestHandler7VersionEv @ 26 NONAME
+ _ZTI17CCSRequestHandler @ 27 NONAME
+ _ZTI22CCsNotificationHandler @ 28 NONAME
+ _ZTI29CCsConversationChangeObserver @ 29 NONAME
+ _ZTV17CCSRequestHandler @ 30 NONAME
+ _ZTV22CCsNotificationHandler @ 31 NONAME
+ _ZTV29CCsConversationChangeObserver @ 32 NONAME
--- a/messagingapp/msgappfw/client/src/ccsrequesthandler.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/client/src/ccsrequesthandler.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -232,6 +232,8 @@
TInt error = KErrNone;
RPointerArray<CCsConversationEntry> ConversationEntryList;
+ TInt totalConversationCount(0);
+
// Parse the results
RDesReadStream resultStream(iConvResultsBuffer->Des());
TInt conversationEntryCount = 0;
@@ -240,6 +242,9 @@
conversationEntryCount = resultStream.ReadInt32L();
+ //Read total conversation count
+ totalConversationCount = resultStream.ReadInt32L();
+
resultStream.Pop());
if(error != KErrNone)
@@ -289,7 +294,7 @@
// Pass the results to the observer
if ( iResultsObserver )
{
- iResultsObserver->Conversations(ConversationEntryList);
+ iResultsObserver->Conversations(ConversationEntryList, totalConversationCount);
}
// cleanup heap data
@@ -705,7 +710,9 @@
// convresation view.
// -----------------------------------------------------------------------------
EXPORT_C void CCSRequestHandler::GetConversationsL(
- CCsClientConversation* aClientConversation)
+ CCsClientConversation* aClientConversation,
+ TInt aKnownIndex,
+ TInt aPageSize)
{
PRINT( _L("Enter CCSRequestHandler::GetConversationsL") );
@@ -724,7 +731,11 @@
// Stream over the temp buffer
RBufWriteStream dataStream(*dataBuf);
dataStream.PushL();
-
+
+ //Write requested details in buffer.
+ dataStream.WriteInt32L(aKnownIndex);
+ dataStream.WriteInt32L(aPageSize);
+
// Write the Client Conversation in the stream
aClientConversation->ExternalizeL(dataStream);
dataStream.CommitL();
@@ -1332,7 +1343,9 @@
// -----------------------------------------------------------------------------
// CCSRequestHandler::GetMessagingHistoryL()
// -----------------------------------------------------------------------------
-EXPORT_C void CCSRequestHandler::GetMessagingHistoryL(TInt aContactId)
+EXPORT_C void CCSRequestHandler::GetMessagingHistoryL(TInt aContactId,
+ TInt aKnownIndex,
+ TInt aPageSize)
{
TInt conversationId = GetConversationIdL(aContactId);
if ( conversationId == -1 )
@@ -1343,7 +1356,7 @@
//set dummy entry
CCsConversationEntry *entry = CCsConversationEntry::NewL();
clientConversation->SetConversationEntryL(entry);
- GetConversationsL(clientConversation);
+ GetConversationsL(clientConversation,aKnownIndex,aPageSize);
//delete
delete clientConversation;
--- a/messagingapp/msgappfw/msghistory/inc/msghistoryprivate.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/msghistory/inc/msghistoryprivate.h Wed Aug 18 09:45:25 2010 +0300
@@ -28,6 +28,7 @@
class MsgItem;
class MsgHistoryPrivate : public CBase,
+public CActive,
public MCsResultsObserver,
public MCsConversationChangeObserver
{
@@ -42,12 +43,24 @@
*/
~MsgHistoryPrivate();
+public:// CActive
+
+ /**
+ * RunL.
+ */
+ void RunL();
+
+ /**
+ * DoCancel
+ */
+ void DoCancel();
+
public:
/*
* GetMessagingHistory
* @param aContactId, contactId
*/
- TBool GetMessagingHistory( TInt aContactId );
+ TBool GetMessagingHistory( TInt aContactId , TInt aKnownIndex = 0 );
/*
* ClearMessagingHistory
@@ -96,10 +109,12 @@
*
* @param aConversationEntryList List of conversation entries
* returned by server.
+ * @param aTotalCount total number of conversaitons entries in the conversation
*/
void Conversations(
- RPointerArray<CCsConversationEntry>& aConversationEntryList);
+ RPointerArray<CCsConversationEntry>& aConversationEntryList,
+ TInt& aTotalCount);
public://MCsConversationChangeObserver
@@ -157,20 +172,56 @@
void SetMsgAttributes
(MsgItem& item, const CCsConversationEntry& entry);
-
+private :
+ /**
+ * Make the active object alive
+ */
+ void IssueRequest();
+
private:
+ /**
+ * Msghistory Internal States
+ */
+ enum MsgHistoryStates
+ {
+ EInit = 500,
+ EFetchMoreConversations
+ };
+ /**
+ * MsgHistoryStates
+ * Own
+ */
+ MsgHistoryStates currentState;
+
+ /**
+ * Current entry being processed
+ * Own.
+ */
+ TInt mCurrentIndex;
+
/*
* MsgHistoryImpl
* Not Own
*/
MsgHistoryImpl* q_ptr;
-
+
/*
* CCSRequestHandler
* Own
*/
CCSRequestHandler* handler;
+ /*
+ * List of MsgItem's
+ * Own
+ */
+ QList<MsgItem> msgs;
+
+ /*
+ * Contact Id
+ * Own
+ */
+ TInt contactId;
};
#endif // __MSG_HISTORY_PRIVATE__
--- a/messagingapp/msgappfw/msghistory/src/msghistoryimpl.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/msghistory/src/msghistoryimpl.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -27,7 +27,7 @@
MsgHistoryImpl::MsgHistoryImpl(QObject* parent)
:QObject(parent)
{
- d_ptr = new MsgHistoryPrivate(this);
+ d_ptr = q_check_ptr (new MsgHistoryPrivate(this));
//connect signals
connect(this, SIGNAL(messagesReady(QList<MsgItem>&)),
--- a/messagingapp/msgappfw/msghistory/src/msghistoryprivate.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/msghistory/src/msghistoryprivate.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -29,14 +29,20 @@
// CONSTANTS
_LIT(KUnixEpoch, "19700000:000000.000000");
+const TInt KMaxConversationIPCLimit = 250;
+
//---------------------------------------------------------------
// MsgHistoryPrivate::MsgHistoryPrivate
// @see header
//---------------------------------------------------------------
MsgHistoryPrivate::MsgHistoryPrivate( MsgHistoryImpl* ptr )
-:q_ptr(ptr)
- {
+:CActive(EPriorityStandard),
+currentState(EInit),
+q_ptr(ptr)
+
+ {
+ CActiveScheduler::Add(this);
handler = CCSRequestHandler::NewL();
handler->RequestResultsEventL(this);
}
@@ -49,15 +55,69 @@
{
if ( handler )
delete handler;
+ if(msgs.count())
+ {
+ msgs.clear();
+ }
+ // Cancel the active Object
+ Cancel();
}
+// ---------------------------------------------------------------------------
+// RunL
+// ---------------------------------------------------------------------------
+//
+void MsgHistoryPrivate::RunL()
+{
+ if (iStatus != KErrNone)
+ {
+ return;
+ }
+ //process
+ switch (currentState)
+ {
+ case EFetchMoreConversations:
+ GetMessagingHistory(contactId, msgs.count());
+ break;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// DoCancel
+// ---------------------------------------------------------------------------
+//
+void MsgHistoryPrivate::DoCancel()
+{
+ currentState = EInit;
+ contactId = -1;
+
+}
+
+// ---------------------------------------------------------------------------
+// Make the active object alive.
+// ---------------------------------------------------------------------------
+//
+void MsgHistoryPrivate::IssueRequest()
+{
+ if (!IsActive())
+ {
+ iStatus = KRequestPending;
+ TRequestStatus* status = &iStatus;
+ SetActive();
+ User::RequestComplete(status, KErrNone);
+ }
+}
//---------------------------------------------------------------
// MsgHistoryPrivate::GetMessagingHistory
// @see header
//---------------------------------------------------------------
-TBool MsgHistoryPrivate::GetMessagingHistory( const TInt aContactId )
+TBool MsgHistoryPrivate::GetMessagingHistory( const TInt aContactId ,
+ TInt aKnownIndex)
{
- TRAPD(err, handler->GetMessagingHistoryL(aContactId));
+ contactId = aContactId;
+ TRAPD(err, handler->GetMessagingHistoryL(contactId,
+ aKnownIndex,
+ KMaxConversationIPCLimit));
if ( err == KErrNone )
return ETrue;
@@ -160,18 +220,29 @@
// @see header
//---------------------------------------------------------------
void MsgHistoryPrivate::Conversations
-( RPointerArray<CCsConversationEntry>& aConversationEntryList )
+( RPointerArray<CCsConversationEntry>& aConversationEntryList,
+ TInt& aTotalCount)
{
- QList<MsgItem> msgs;
-
- for(TInt i=aConversationEntryList.Count()-1; i >= 0; --i )
+
+ for(TInt i = 0 ; i < aConversationEntryList.Count(); i++ )
{
MsgItem item;
PopulateMsgItem(item,*(aConversationEntryList[i]));
msgs.append(item);
}
- //emit signal
- q_ptr->messagesReadyEvent(msgs);
+ //emit signal, when all the messages in the conversation are fetched.
+ if(msgs.count()== aTotalCount)
+ {
+ currentState = EInit;
+ q_ptr->messagesReadyEvent(msgs);
+ msgs.clear();
+
+ }
+ else
+ {
+ currentState = EFetchMoreConversations;
+ IssueRequest();
+ }
}
//---------------------------------------------------------------
--- a/messagingapp/msgappfw/plugins/msgplugin/src/ccsmsghandler.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/plugins/msgplugin/src/ccsmsghandler.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -306,8 +306,26 @@
{
error = iSession->GetEntry(aSelection->At(i),service,entry);
- if ( entry.Visible() == EFalse )
- {
+ if (aParent == KMsvGlobalInBoxIndexEntryIdValue && KSenduiMtmSmsUidValue == entry.iMtm.iUid)
+ {
+ iSmsMtm->SwitchCurrentEntryL(entry.Id());
+ iSmsMtm->LoadMessageL();
+
+ CSmsHeader& header = static_cast<CSmsClientMtm*> (iSmsMtm)->SmsHeader();
+ CSmsPDU& pdu = header.Message().SmsPDU();
+ TSmsDataCodingScheme::TSmsClass smsClass;
+
+ if (pdu.Class(smsClass) && smsClass == TSmsDataCodingScheme::ESmsClass0
+ && entry.ReadOnly())
+ {
+ iSmsMtm->SwitchCurrentEntryL(entry.iServiceId);
+ // for class 0 sms dont create conversation entry..
+ continue;
+ }
+
+ }
+ if (entry.Visible() == EFalse)
+ {
// Do a delete if entry becomes invisible.
// e.g) My Nokia registration messages.
RPointerArray<CCsConversationEntry>* hiddenEntries =
@@ -630,7 +648,27 @@
CMsvEntry* msvEntry= iSession->
GetEntryL(iMessageArray->operator[](0));
CleanupStack::PushL(msvEntry);
+ TBool isNotClass0 = ETrue;
+
+ if (msvEntry->Entry().iMtm.iUid == KSenduiMtmSmsUidValue && msvEntry->Entry().Parent()
+ == KMsvGlobalInBoxIndexEntryIdValue)
+ {
+ iSmsMtm->SwitchCurrentEntryL(msvEntry->Entry().Id());
+ iSmsMtm->LoadMessageL();
+
+ CSmsHeader& header = static_cast<CSmsClientMtm*> (iSmsMtm)->SmsHeader();
+ CSmsPDU& pdu = header.Message().SmsPDU();
+ TSmsDataCodingScheme::TSmsClass smsClass;
+
+ if (pdu.Class(smsClass) && smsClass == TSmsDataCodingScheme::ESmsClass0)
+ {
+ isNotClass0 = EFalse;
+ }
+ }
+ if (isNotClass0)
+ {
ProcessResultsL(msvEntry->Entry());
+ }
CleanupStack::PopAndDestroy(msvEntry);
iMessageArray->Remove(0);
}
@@ -737,6 +775,18 @@
break;
case KSenduiMtmBioUidValue:
{
+ if (aEntry.iMtmData1 == KSenduiMtmBtUidValue)
+ {
+ if (aEntry.iBioType == KMsgBioUidVCard.iUid)
+ {
+ type = ECsBlueTooth_VCard;
+ }
+ else if (aEntry.iBioType == KMsgBioUidVCalendar.iUid)
+ {
+ type = ECsBlueTooth_VCal;
+ }
+ break;
+ }
type = ECsBioMsg;
// based on the biotype uid set message type
--- a/messagingapp/msgappfw/plugins/previewplugin/inc/ccspreviewpluginhandler.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/plugins/previewplugin/inc/ccspreviewpluginhandler.h Wed Aug 18 09:45:25 2010 +0300
@@ -40,6 +40,7 @@
class CCsPreviewPlugin;
class CClientMtmRegistry;
class CMmsClientMtm;
+class CBIOClientMtm;
class CUniDataModel;
class MMsvAttachmentManager;
@@ -132,6 +133,18 @@
*@param aSelection, CMsvEntrySelections
*/
void HandleEventL(CMsvEntrySelection* aSelection);
+
+ /**
+ * Process MMS entry
+ *@param aEntry, TMsvEntry
+ */
+ void HandleMMSEntryL(const TMsvEntry& aEntry);
+
+ /**
+ * Process VCard enry
+ *@param aEntry, TMsvEntry
+ */
+ void HandleVCardEntryL(const TMsvEntry& aEntry);
/**
* Bind bodytext to sql statement.
@@ -233,6 +246,12 @@
* Own.
*/
CMmsClientMtm* iMmsMtm;
+
+ /**
+ * BioMsg client mtm object
+ * Own.
+ */
+ CBIOClientMtm* iBioClientMtm;
/*
* File session
--- a/messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -18,7 +18,10 @@
// USER INCLUDES
#include "ccspreviewpluginhandler.h"
#include "UniObject.h"
+#include "msgbiouids.h"
// SYSTEM INCLUDES
+#include <bioscmds.h>
+#include <biocmtm.h>
#include <mmsclient.h>
#include <mtclreg.h>
#include <msvids.h>
@@ -53,6 +56,8 @@
_LIT(KSelectProcessingStateStmt, " SELECT message_id, msg_processingstate FROM conversation_messages WHERE message_id=:message_id ");
// Remove record from conversation_messages table.
_LIT(KRemoveMsgStmnt,"DELETE FROM conversation_messages WHERE message_id=:message_id");
+//Insert vcard meta-daa query
+_LIT(KSqlInsertBioMsgStmt, "INSERT OR REPLACE INTO conversation_messages ( message_id, msg_processingstate, preview_path ) VALUES( :message_id, :msg_processingstate, :preview_path )");
const TInt KDefaultMaxSize = 300 * 1024;
//Preview thumbnail size
@@ -101,6 +106,12 @@
iMmsMtm = NULL;
}
+ if (iBioClientMtm)
+ {
+ delete iBioClientMtm;
+ iBioClientMtm = NULL;
+ }
+
if (iMtmRegistry)
{
delete iMtmRegistry;
@@ -144,7 +155,11 @@
//create mms client mtm
iMmsMtm = static_cast<CMmsClientMtm*> (iMtmRegistry-> NewMtmL(
- KSenduiMtmMmsUid));
+ KSenduiMtmMmsUid));
+
+ // create biomsg client mtm
+ iBioClientMtm = static_cast<CBIOClientMtm*> (iMtmRegistry->NewMtmL(
+ KSenduiMtmBioUid));
//create thumbnail manager
iThumbnailManager = CThumbnailManager::NewL(*this);
@@ -275,7 +290,7 @@
//
void CCsPreviewPluginHandler::HandleEventL(CMsvEntrySelection* aSelection)
{
- PRINT ( _L("Enter CCsPreviewPluginHandler::HandleEvent") );
+ PRINT ( _L("Enter CCsPreviewPluginHandler::HandleEvent start.") );
TMsvEntry entry;
TMsvId service;
@@ -285,190 +300,277 @@
{
error = iSession->GetEntry(aSelection->At(i), service, entry);
- if ( (KErrNone == error) && !entry.InPreparation() && entry.Visible()
- && (KSenduiMtmMmsUidValue == entry.iMtm.iUid))
+ if ((KErrNone == error) && !entry.InPreparation() && entry.Visible())
{
PRINT ( _L("Enter CCsPreviewPluginHandler::HandleEvent for loop started.") );
-
- TInt msgId = entry.Id();
-
- // check if the msg is already under processing Or processed
- if( EPreviewMsgNotProcessed != msgProcessingState(msgId) )
- {
- // skip processing this event for the given message
- continue;
- }
- else
- {
- // start processing message, set flag
- setMsgProcessingState(msgId, EPreviewMsgProcessing);
- }
-
- // update db with message preview data
- RSqlStatement sqlInsertStmt;
- CleanupClosePushL(sqlInsertStmt);
- sqlInsertStmt.PrepareL(iSqlDb, KSqlInsertStmt);
-
- // parse message
- iMmsMtm->SwitchCurrentEntryL(msgId);
- iMmsMtm->LoadMessageL();
-
- CUniDataModel* iUniDataModel = CUniDataModel::NewL(ifsSession,
- *iMmsMtm);
- CleanupStack::PushL(iUniDataModel);
- iUniDataModel->RestoreL(*this, ETrue);
-
- //msg property
- TInt msgProperty = 0;
- if (iUniDataModel->AttachmentList().Count() > 0)
- {
- msgProperty |= EPreviewAttachment;
- }
-
- //check for msg forward
- //Validate if the mms msg can be forwarded or not
- if (ValidateMsgForForward(iUniDataModel))
- {
- msgProperty |= EPreviewForward;
- }
-
- TPtrC videoPath;
- TPtrC imagePath;
-
- // preview parsing
- TInt slideCount = iUniDataModel->SmilModel().SlideCount();
- TBool isBodyTextSet = EFalse;
- TBool isImageSet = EFalse;
- TBool isAudioSet = EFalse;
- TBool isVideoSet = EFalse;
-
- for (int i = 0; i < slideCount; i++)
- {
- int slideobjcount =
- iUniDataModel->SmilModel().SlideObjectCount(i);
- for (int j = 0; j < slideobjcount; j++)
+ if ((KSenduiMtmMmsUidValue == entry.iMtm.iUid))
{
- CUniObject *obj =
- iUniDataModel->SmilModel(). GetObjectByIndex(i, j);
- CMsgMediaInfo *mediaInfo = obj->MediaInfo();
-
- TPtrC8 mimetype = obj->MimeType();
- TMsvAttachmentId attachId = obj->AttachmentId();
-
- //bodytext
- if (!isBodyTextSet && (mimetype.Find(_L8("text"))
- != KErrNotFound))
- {
- //bind bodytext into statement
- BindBodyText(sqlInsertStmt, attachId);
- isBodyTextSet = ETrue;
- }
-
- //image parsing
- if (!isVideoSet && !isImageSet && (mimetype.Find(_L8("image"))
- != KErrNotFound))
- {
- //get thumbnail for this image
- isImageSet = ETrue;
- imagePath.Set(mediaInfo->FullFilePath());
- msgProperty |= EPreviewImage;
-
- if (EFileProtNoProtection != mediaInfo->Protection())
- {
- msgProperty |= EPreviewProtectedImage;
- }
- if (mediaInfo->Corrupt())
- {
- msgProperty |= EPreviewCorruptedImage;
- }
-
- if (!(EPreviewProtectedImage & msgProperty) &&
- !(EPreviewCorruptedImage & msgProperty))
- {
- //Generate thumbnail for non protected,
- //non corrupted image.
- GetThumbNailL(attachId, mimetype, msgId);
- }
- }
-
- //audio content
- if (!isVideoSet && !isAudioSet && (mimetype.Find(_L8("audio"))
- != KErrNotFound))
- {
- isAudioSet = ETrue;
- msgProperty |= EPreviewAudio;
- if (EFileProtNoProtection != mediaInfo->Protection())
- {
- msgProperty |= EPreviewProtectedAudio;
- }
- if (mediaInfo->Corrupt())
- {
- msgProperty |= EPreviewCorruptedAudio;
- }
- }
-
- //video content
- if (!( isImageSet || isAudioSet) && !isVideoSet && (mimetype.Find(_L8("video"))
- != KErrNotFound))
- {
- videoPath.Set(mediaInfo->FullFilePath());
- isVideoSet = ETrue;
- msgProperty |= EPreviewVideo;
- if (EFileProtNoProtection != mediaInfo->Protection())
- {
- msgProperty |= EPreviewProtectedVideo;
- }
- if (mediaInfo->Corrupt())
- {
- msgProperty |= EPreviewCorruptedVideo;
- }
+ HandleMMSEntryL(entry);
+ }
+ else if ((KSenduiMtmSmsUidValue == entry.iMtm.iUid) || (KSenduiMtmBioUidValue == entry.iMtm.iUid))
+ {
+ if ((KMsgBioUidVCard.iUid == entry.iBioType))
+ {
+ HandleVCardEntryL(entry);
}
}
}
+ }//end for loop
- //set preview path
- TInt previewPathIndex = sqlInsertStmt.ParameterIndex(_L(
- ":preview_path"));
- if (isVideoSet)
+ PRINT ( _L("Exit CCsPreviewPluginHandler::HandleEvent end.") );
+ }
+// -----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::HandleMMSEntryL()
+//
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::HandleMMSEntryL(const TMsvEntry& aEntry)
+ {
+ PRINT ( _L("Enter CCsPreviewPluginHandler::HandleMMSEntry start.") );
+
+ TInt msgId = aEntry.Id();
+
+ // check if the msg is already under processing Or processed
+ if (EPreviewMsgNotProcessed != msgProcessingState(msgId))
+ {
+ // skip processing this event for the given message
+ return;
+ }
+
+ // start processing message, set flag
+ setMsgProcessingState(msgId, EPreviewMsgProcessing);
+
+ // update db with message preview data
+ RSqlStatement sqlInsertStmt;
+ CleanupClosePushL(sqlInsertStmt);
+ sqlInsertStmt.PrepareL(iSqlDb, KSqlInsertStmt);
+
+ // parse message
+ iMmsMtm->SwitchCurrentEntryL(msgId);
+ iMmsMtm->LoadMessageL();
+
+ CUniDataModel* iUniDataModel = CUniDataModel::NewL(ifsSession, *iMmsMtm);
+ CleanupStack::PushL(iUniDataModel);
+ iUniDataModel->RestoreL(*this, ETrue);
+
+ //msg property
+ TInt msgProperty = 0;
+ if (iUniDataModel->AttachmentList().Count() > 0)
+ {
+ msgProperty |= EPreviewAttachment;
+ }
+
+ //check for msg forward
+ //Validate if the mms msg can be forwarded or not
+ if (ValidateMsgForForward(iUniDataModel))
+ {
+ msgProperty |= EPreviewForward;
+ }
+
+ TPtrC videoPath;
+ TPtrC imagePath;
+
+ // preview parsing
+ TInt slideCount = iUniDataModel->SmilModel().SlideCount();
+ TBool isBodyTextSet = EFalse;
+ TBool isImageSet = EFalse;
+ TBool isAudioSet = EFalse;
+ TBool isVideoSet = EFalse;
+
+ for (int i = 0; i < slideCount; i++)
+ {
+ int slideobjcount = iUniDataModel->SmilModel().SlideObjectCount(i);
+ for (int j = 0; j < slideobjcount; j++)
{
- User::LeaveIfError(sqlInsertStmt.BindText(previewPathIndex,
- videoPath));
- }
- else if (isImageSet)
- {
- User::LeaveIfError(sqlInsertStmt.BindText(previewPathIndex,
- imagePath));
- }
+ CUniObject *obj = iUniDataModel->SmilModel(). GetObjectByIndex(i,
+ j);
+ CMsgMediaInfo *mediaInfo = obj->MediaInfo();
+
+ TPtrC8 mimetype = obj->MimeType();
+ TMsvAttachmentId attachId = obj->AttachmentId();
+
+ //bodytext
+ if (!isBodyTextSet
+ && (mimetype.Find(_L8("text")) != KErrNotFound))
+ {
+ //bind bodytext into statement
+ BindBodyText(sqlInsertStmt, attachId);
+ isBodyTextSet = ETrue;
+ }
+
+ //image parsing
+ if (!isVideoSet && !isImageSet && (mimetype.Find(_L8("image"))
+ != KErrNotFound))
+ {
+ //get thumbnail for this image
+ isImageSet = ETrue;
+ imagePath.Set(mediaInfo->FullFilePath());
+ msgProperty |= EPreviewImage;
- //msg_id
- TInt msgIdIndex = sqlInsertStmt.ParameterIndex(_L(":message_id"));
- User::LeaveIfError(sqlInsertStmt.BindInt(msgIdIndex, msgId));
+ if (EFileProtNoProtection != mediaInfo->Protection())
+ {
+ msgProperty |= EPreviewProtectedImage;
+ }
+ if (mediaInfo->Corrupt())
+ {
+ msgProperty |= EPreviewCorruptedImage;
+ }
+
+ if (!(EPreviewProtectedImage & msgProperty)
+ && !(EPreviewCorruptedImage & msgProperty))
+ {
+ //Generate thumbnail for non protected,
+ //non corrupted image.
+ GetThumbNailL(attachId, mimetype, msgId);
+ }
+ }
+
+ //audio content
+ if (!isVideoSet && !isAudioSet && (mimetype.Find(_L8("audio"))
+ != KErrNotFound))
+ {
+ isAudioSet = ETrue;
+ msgProperty |= EPreviewAudio;
+ if (EFileProtNoProtection != mediaInfo->Protection())
+ {
+ msgProperty |= EPreviewProtectedAudio;
+ }
+ if (mediaInfo->Corrupt())
+ {
+ msgProperty |= EPreviewCorruptedAudio;
+ }
+ }
- //subjext
- TInt subjectIndex = sqlInsertStmt.ParameterIndex(_L(":subject"));
- User::LeaveIfError(sqlInsertStmt.BindText(subjectIndex,
- iMmsMtm->SubjectL()));
+ //video content
+ if (!(isImageSet || isAudioSet) && !isVideoSet && (mimetype.Find(
+ _L8("video")) != KErrNotFound))
+ {
+ videoPath.Set(mediaInfo->FullFilePath());
+ isVideoSet = ETrue;
+ msgProperty |= EPreviewVideo;
+ if (EFileProtNoProtection != mediaInfo->Protection())
+ {
+ msgProperty |= EPreviewProtectedVideo;
+ }
+ if (mediaInfo->Corrupt())
+ {
+ msgProperty |= EPreviewCorruptedVideo;
+ }
+ }
+ }
+ }
- //msg_property
- TInt msgPropertyIndex = sqlInsertStmt.ParameterIndex(_L(
- ":msg_property"));
- User::LeaveIfError(sqlInsertStmt.BindInt(msgPropertyIndex,
- msgProperty));
+ //set preview path
+ TInt previewPathIndex = sqlInsertStmt.ParameterIndex(_L(
+ ":preview_path"));
+ if (isVideoSet)
+ {
+ User::LeaveIfError(
+ sqlInsertStmt.BindText(previewPathIndex, videoPath));
+ }
+ else if (isImageSet)
+ {
+ User::LeaveIfError(
+ sqlInsertStmt.BindText(previewPathIndex, imagePath));
+ }
+
+ //msg_id
+ TInt msgIdIndex = sqlInsertStmt.ParameterIndex(_L(":message_id"));
+ User::LeaveIfError(sqlInsertStmt.BindInt(msgIdIndex, msgId));
+
+ //subjext
+ TInt subjectIndex = sqlInsertStmt.ParameterIndex(_L(":subject"));
+ User::LeaveIfError(sqlInsertStmt.BindText(subjectIndex,
+ iMmsMtm->SubjectL()));
+
+ //msg_property
+ TInt msgPropertyIndex = sqlInsertStmt.ParameterIndex(_L(
+ ":msg_property"));
+ User::LeaveIfError(sqlInsertStmt.BindInt(msgPropertyIndex, msgProperty));
+
+ //msg_processingstate
+ TInt msgProcessingStateIndex = sqlInsertStmt.ParameterIndex(
+ _L(":msg_processingstate"));
+ User::LeaveIfError(sqlInsertStmt.BindInt(msgProcessingStateIndex,
+ EPreviewMsgProcessed));
+
+ //execute sql stament
+ User::LeaveIfError(sqlInsertStmt.Exec());
+
+ //cleanup
+ CleanupStack::PopAndDestroy(2, &sqlInsertStmt);
+
+ PRINT ( _L("Enter CCsPreviewPluginHandler::HandleMMSEntry end.") );
+ }
- //msg_processingstate
- TInt msgProcessingStateIndex = sqlInsertStmt.ParameterIndex(_L(":msg_processingstate"));
- User::LeaveIfError(sqlInsertStmt.BindInt(msgProcessingStateIndex, EPreviewMsgProcessed));
+// -----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::HandleVCardEntryL()
+//
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::HandleVCardEntryL(const TMsvEntry& aEntry)
+ {
+ PRINT ( _L("Enter CCsPreviewPluginHandler::HandleBioMsgEntry start.") );
- //execute sql stament
- User::LeaveIfError(sqlInsertStmt.Exec());
+ TMsvId msgId = aEntry.Id();
+
+ // check if the msg is already under processing Or processed
+ TInt msgProcessState = EPreviewMsgNotProcessed;
+ msgProcessState = msgProcessingState(msgId);
+ if (EPreviewMsgProcessed == msgProcessState)
+ {
+ return;
+ }
+ //get attachments
+ CMsvEntry* cMsvEntry = CMsvEntry::NewL(iBioClientMtm->Session(), msgId,
+ TMsvSelectionOrdering());
+
+ CleanupStack::PushL(cMsvEntry);
+ CMsvStore* store = cMsvEntry->ReadStoreL();
+ CleanupStack::PushL(store);
+ MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
- //cleanup
- CleanupStack::PopAndDestroy(2, &sqlInsertStmt);
+ TInt attachmentCount = attachMan.AttachmentCount();
+ if (attachmentCount)
+ {
+ // get attachment file path
+ RFile file = attachMan.GetAttachmentFileL(0);
+ CleanupClosePushL(file);
+ TFileName fullName;
+ User::LeaveIfError(file.FullName(fullName));
+
+ // update db with meta-data
+ RSqlStatement sqlInsertStmt;
+ CleanupClosePushL(sqlInsertStmt);
+ sqlInsertStmt.PrepareL(iSqlDb, KSqlInsertBioMsgStmt);
+
+ //msg_id
+ TInt msgIdIndex = sqlInsertStmt.ParameterIndex(_L(":message_id"));
+ User::LeaveIfError(sqlInsertStmt.BindInt(msgIdIndex, msgId));
+
+ //set attachment path
+ TInt previewPathIndex = sqlInsertStmt.ParameterIndex(_L(
+ ":preview_path"));
+ User::LeaveIfError(sqlInsertStmt.BindText(previewPathIndex, fullName));
+
+ //msg_processingstate
+ TInt msgProcessingStateIndex = sqlInsertStmt.ParameterIndex(
+ _L(":msg_processingstate"));
+ User::LeaveIfError(sqlInsertStmt.BindInt(msgProcessingStateIndex,
+ EPreviewMsgProcessed));
+
+ //execute sql stament
+ User::LeaveIfError(sqlInsertStmt.Exec());
+
+ //cleanup
+ CleanupStack::PopAndDestroy(&sqlInsertStmt);
+ CleanupStack::PopAndDestroy(&file);
}
-}//end for loop
+
+ CleanupStack::PopAndDestroy(2, cMsvEntry);//cMsvEntry,store
-PRINT ( _L("Exit CCsPreviewPluginHandler::HandleEvent") );
-}
+ PRINT ( _L("Enter CCsPreviewPluginHandler::HandleBioMsgEntry End.") );
+ }
// -----------------------------------------------------------------------------
// CCsPreviewPluginHandler::RestoreReady()
--- a/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.mmp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.mmp Wed Aug 18 09:45:25 2010 +0300
@@ -63,8 +63,10 @@
USERINCLUDE ..\inc
USERINCLUDE ..\..\inc
+USERINCLUDE ..\..\..\..\..\..\inc
USERINCLUDE ..\..\..\..\..\msgutils\unidatautils\unidatamodel\inc
USERINCLUDE ..\..\..\..\..\..\messagingappbase\obexmtms\TObexMTM\INC
+USERINCLUDE ..\..\..\..\utils\inc
APP_LAYER_SYSTEMINCLUDE
MW_LAYER_SYSTEMINCLUDE
--- a/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.pkg Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.pkg Wed Aug 18 09:45:25 2010 +0300
@@ -31,11 +31,11 @@
;rom will not allow to update it if name is testframework, after install need to rename it to testframework.ini
;INI FILE
-"..\init\test_plugin.ini" -"c:\Testframework\testframework.ini"
+"..\init\testframework.ini" -"c:\Testframework\ttestframework.ini"
;CFG FILES
-"..\conf\test_plugin.cfg" -"c:\Testframework\test_plugin.cfg"
+"..\conf\test_pluginpreview.cfg" -"c:\Testframework\test_pluginpreview.cfg"
-"\EPOC32\RELEASE\ARMV5\UREL\test_plugin.dll" -"!:\sys\bin\test_plugin.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\test_pluginpreview.dll" -"!:\sys\bin\test_pluginpreview.dll"
--- a/messagingapp/msgappfw/server/inc/ccsconversation.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/server/inc/ccsconversation.h Wed Aug 18 09:45:25 2010 +0300
@@ -112,6 +112,19 @@
void
GetEntryListL(
RPointerArray<CCsConversationEntry>* aConversationEntryList);
+
+ /**
+ * GetEntryListL
+ * This function shall return all the entries this conversation holds
+ *
+ * @param aConversationEntryList, list of conversation entries
+ * @param aStartIndex, start index for conversation entries.
+ * @param aEndIndex, end index for conversation entries.
+ */
+ void GetEntryListL(
+ RPointerArray<CCsConversationEntry>* aConversationEntryList,
+ TInt aStartIndex,
+ TInt aEndIndex);
/**
* GetEntryL
--- a/messagingapp/msgappfw/server/inc/ccsconversationcache.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/server/inc/ccsconversationcache.h Wed Aug 18 09:45:25 2010 +0300
@@ -74,6 +74,23 @@
GetConversationListL(
RPointerArray<CCsClientConversation>* aClientConversationList);
+/**
+ * GetConversationsL
+ * Gets the Conversation Entries of a given Client Conversation
+ *
+ * @param aClientConversation object of CCsClientConversation
+ * for which the Converstion entries needs to be fetched
+ * @param aConversationEntryList list of CCsConversationEntries
+ * @param aKnownIndex - last message index of client total messages.
+ * @param aPageSize - Number of messages need to be fetched.
+ * @param aTotalConversationCount - Has total number of message count
+ */
+ void GetConversationsL(
+ const CCsClientConversation* aClientConversation,
+ RPointerArray<CCsConversationEntry>* aConversationEntryList,
+ TInt aKnownIndex, TInt aPageSize,
+ TInt& aTotalConversationCount);
+
/**
* GetConversationUnreadListL
* Get Conversation list with contact details and unread conversation
--- a/messagingapp/msgappfw/server/server.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/server/server.pro Wed Aug 18 09:45:25 2010 +0300
@@ -80,7 +80,6 @@
-leikcore \
-lefsrv \
-lestor \
- -laknnotify \
-lflogger \
-lecom \
-lcsutils \
--- a/messagingapp/msgappfw/server/src/ccsconversation.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccsconversation.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -219,6 +219,33 @@
}
// ----------------------------------------------------------------------------
+// CCsConversation::GetEntryListL
+// This function shall return segment of Conversation Entry
+// of ConversationEntry based on aStartIndex and aEndIndex
+// ----------------------------------------------------------------------------
+void
+CCsConversation::GetEntryListL (
+ RPointerArray<CCsConversationEntry>* aConversationEntryList,
+ TInt aStartIndex,
+ TInt aEndIndex)
+ {
+ TInt EntryCount = iEntryList->Count();
+ if (EntryCount > 0 && aStartIndex>=0 && aEndIndex<=EntryCount)
+ {
+ // loop through each entry make a clone and add
+ // it to aConversationEntryList class
+ for (TInt index=aEndIndex-1 ; index>=aStartIndex ; index--)
+ {
+ CCsConversationEntry* conEntry =
+ (static_cast<CCsConversationEntry*>(
+ (*iEntryList)[index]))->CloneL();
+ aConversationEntryList->Append(conEntry);
+ }
+ }
+ }
+
+
+// ----------------------------------------------------------------------------
// CCsConversation::AddEntryL
// Add a entry to this conversation
// ----------------------------------------------------------------------------
--- a/messagingapp/msgappfw/server/src/ccsconversationcache.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccsconversationcache.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -200,6 +200,54 @@
// ----------------------------------------------------------------------------
// CCsConversationCache::GetConversationsL
+// Get segment of conversations for a given conversation Id, knownIndex and page size.
+// The return list is set inside aConversationEntryList and aTotalConversationCount
+// has total conversation count.
+// ----------------------------------------------------------------------------
+void
+CCsConversationCache::GetConversationsL(
+ const CCsClientConversation* aClientConversation,
+ RPointerArray<CCsConversationEntry>* aConversationEntryList,
+ TInt aKnownIndex,
+ TInt aPageSize,
+ TInt& aTotalConversationCount)
+ {
+ TInt conversationCount = iConversationList->Count();
+
+ // Get the entry id from Client Conversation for which conversations are required
+ TCsConversationEntryID conversationEntryID =
+ aClientConversation->GetConversationEntryId();
+
+ for (TInt loop= 0; loop < conversationCount; loop++ )
+ {
+ //match entry ID;
+ CCsConversation* conversation =
+ static_cast<CCsConversation*>((*iConversationList)[loop]);
+
+ if(conversationEntryID == conversation->GetConversationId())
+ {
+ TInt endIndex = conversation->GetEntryCount();
+ TInt startIndex(0);
+ if((aKnownIndex!= 0) || (aPageSize !=0 ))
+ {
+ endIndex = endIndex- aKnownIndex;
+ startIndex = endIndex - aPageSize;
+ if( startIndex < 0 ) startIndex = 0;
+ }
+ // Search the conversation id and get the list inside
+ // No need to check, becz it is initialize here only.
+ conversation->GetEntryListL(aConversationEntryList,
+ startIndex,endIndex);
+ // May, meanwhile new conversation cached.
+ aTotalConversationCount = conversation->GetEntryCount();
+ break;
+ }
+ }
+ PRINT1 ( _L("CCsConversationCache::GetConversationsL - conversationCount:%d"),
+ conversationCount );
+ }
+// ----------------------------------------------------------------------------
+// CCsConversationCache::GetConversationsL
// Get All Conversations for a given conversation Id
// the return list is set inside aConversationEntryList
// ----------------------------------------------------------------------------
@@ -689,7 +737,7 @@
CCsClientConversation* CCsConversationCache::GetConversationFromMessageIdL(TInt aMessageId)
{
TInt conversationCount = iConversationList->Count();
-
+ CCsClientConversation *clientConv = NULL;
for ( TInt loop = 0; loop < conversationCount; loop++ )
{
CCsConversation* conversation =
@@ -704,13 +752,13 @@
TInt messageId = entryList[loop1]->EntryId();
if ( messageId == aMessageId )
{
- CCsClientConversation *clientConv = CreateClientConvLC(conversation, entryList[loop1]);
+ clientConv = CreateClientConvLC(conversation, entryList[loop1]);
CleanupStack::Pop();
- return clientConv;
+ break;
}
}
}
- return NULL;
+ return clientConv;
}
//end of file
--- a/messagingapp/msgappfw/server/src/ccsconversationcachehelper.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccsconversationcachehelper.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -249,7 +249,7 @@
CCsConversationEntry* conEntry =
iConversationEvent->ClientConversation()->GetConversationEntry();
- if (ECsBlueTooth == conEntry->GetType())
+ if (ECsBlueTooth == conEntry->GetType()|| ECsBlueTooth_VCard == conEntry->GetType()|| ECsBlueTooth_VCal == conEntry->GetType())
{
AddConversationEntryL(conEntry, KBluetoothMsgsConversationId);
}
@@ -290,7 +290,7 @@
TUint8 CCsConversationCacheHelper::NeedsSpecialProcessing(
CCsConversationEntry* aConversationEntry)
{
- if (ECsBlueTooth == aConversationEntry->GetType())
+ if (ECsBlueTooth == aConversationEntry->GetType() || ECsBlueTooth_VCard == aConversationEntry->GetType() || ECsBlueTooth_VCal == aConversationEntry->GetType())
{
return 1;
}
--- a/messagingapp/msgappfw/server/src/ccssession.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccssession.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -489,7 +489,11 @@
// Stream over the buffer
RDesReadStream stream(bufferPtr);
stream.PushL();
-
+
+ //Read known index and page size
+ TInt knownIndex = stream.ReadInt32L();
+ TInt pageSize = stream.ReadInt32L();
+
// get cache pointer
CCsConversationCache* cache = iServer->ConversationCacheInterface();
@@ -506,8 +510,13 @@
new (ELeave) RPointerArray<CCsConversationEntry>(10);
CleanupResetAndDestroyPushL(conversationEntryList);
- // get conversationlist for given ClientConversation
- cache->GetConversationsL(ClientConversation, conversationEntryList);
+ // get conversation entry list for given ClientConversation
+ TInt totalCount(0);
+ cache->GetConversationsL (ClientConversation,
+ conversationEntryList,
+ knownIndex,
+ pageSize,
+ totalCount);
// create a new buffer for writing into stream
// write all list data into stream
@@ -520,7 +529,10 @@
TInt ItemCount = conversationEntryList->Count();
//write recent conversation entry list
writeStream.WriteInt32L(ItemCount);
-
+
+ //Write total count in the stream to update UI
+ writeStream.WriteInt32L(totalCount);
+
// Write the conversation entry
for (TInt iloop = 0; iloop < ItemCount; iloop++)
{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/flashmsgnotifier/flashmsgnotifier.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,58 @@
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# Contributors:
+# Description: Message Error Notifier Exe Pro File
+
+TEMPLATE = app
+TARGET = flashmsgnotifier
+CONFIG += hb service
+
+QT += core
+
+INCLUDEPATH += . inc ../inc
+INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+INCLUDEPATH += ../msgnotifier/inc
+INCLUDEPATH += ../../../inc
+
+
+HEADERS += inc/flashmsgnotifier.h \
+ inc/flashmsgnotifier_p.h
+
+SOURCES += src/main.cpp \
+ src/flashmsgnotifier.cpp \
+ src/flashmsgnotifier_p.cpp
+
+LIBS += -lxqservice \
+ -lxqserviceutil \
+ -lmsgs \
+ -letext \
+ -lsmcm \
+ -lgsmu \
+ -lxqutils \
+ -lcsserverclientapi \
+ -lxqsystemtoneservice
+
+SERVICE.FILE = service_conf.xml
+SERVICE.OPTIONS = embeddable
+SERVICE.OPTIONS += hidden
+
+# Capability
+symbian {
+ TARGET.UID3 = 0x2001FE72
+ TARGET.CAPABILITY = All -TCB
+}
+
+TRANSLATIONS = messaging.ts
+
+# Build.inf rules
+BLD_INF_RULES.prj_exports += \
+ "$${LITERAL_HASH}include <platform_paths.hrh>" \
+ "rom/flashmsgnotifier.iby CORE_APP_LAYER_IBY_EXPORT_PATH(flashmsgnotifier.iby)"
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/flashmsgnotifier/inc/flashmsgnotifier.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implements interface for showing flash messages
+ *
+ */
+
+#ifndef FLASHMSGNOTIFIER_H
+#define FLASHMSGNOTIFIER_H
+
+#include <QObject>
+#include <xqserviceprovider.h>
+#include <qvariant.h>
+#include <qbytearray.h>
+
+class FlashMsgNotifierPrivate;
+class XQSystemToneService;
+
+/**
+ * @class FlashMsgNotifier
+ * Implements interface for showing flash messages
+ */
+class FlashMsgNotifier: public XQServiceProvider
+{
+Q_OBJECT
+
+public:
+ /**
+ * Constructor
+ */
+ FlashMsgNotifier(QObject *parent = 0);
+
+ /**
+ * Destructor
+ */
+ ~FlashMsgNotifier();
+
+private:
+ /**
+ * onDeleteAction
+ * @param msgId message Id
+ */
+ void onSaveAction(int msgId);
+
+ /**
+ * onDeleteAction
+ * @param msgId message Id
+ */
+ void onDeleteAction(int msgId);
+
+public slots:
+
+ /**
+ * displayFlashMsg
+ * @param displayParams QVariantList
+ */
+ void displayFlashMsg(QByteArray displayParams);
+
+private:
+
+ /**
+ * FlashMsgNotifierPrivate obj
+ * Owned.
+ */
+ FlashMsgNotifierPrivate* d_ptr;
+
+ /**
+ * XQSystemToneService obj
+ * Owned.
+ */
+ XQSystemToneService* mSts;
+
+ /**
+ * Address string
+ */
+ QString mAddress;
+};
+
+#endif // MSGERRORNOTIFIER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/flashmsgnotifier/inc/flashmsgnotifier_p.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: handler for saving and deleting flash messages
+ *
+ */
+
+#ifndef FLASH_MSG_NOTIFIER_H
+#define FLASH_MSG_NOTIFIER_H
+
+// INCLUDE FILES
+#include <msvapi.h>
+
+// FORWARD DECLARATIONS
+class CMsvSession;
+class MMsvSessionObserver;
+class FlashMsgNotifier;
+class CCSRequestHandler;
+
+/**
+ * @class MsgStoreHandler
+ * handler for saving and deleting flash messages
+ */
+class FlashMsgNotifierPrivate: public CBase, public MMsvSessionObserver
+{
+public:
+
+ /**
+ * Constructor.
+ */
+ explicit FlashMsgNotifierPrivate(FlashMsgNotifier* notifier);
+
+ /**
+ * Destructor
+ */
+ virtual ~FlashMsgNotifierPrivate();
+
+ /**
+ * DeleteMessage
+ * @param aMsgId TMsvId
+ */
+ void DeleteMessage(TMsvId aMsgId);
+
+ /**
+ * SaveMessageL
+ * @param aMsgId TMsvId
+ */
+ void SaveMessageL(TMsvId aMsgId);
+
+ /**
+ * GetConversationIdFromAddressL
+ * @param aContactAddress
+ * @return conversationId
+ */
+ TInt GetConversationIdFromAddressL(TDesC& aContactAddress);
+
+public:
+
+ /**
+ * From MMsvSessionObserver. HandleSessionEventL.
+ */
+ void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
+
+private:
+ /**
+ * Initializes the MsgStoreHandler class.
+ */
+ void InitL();
+
+private:
+ /**
+ * Owned. Msv Session
+ */
+ CMsvSession* iMsvSession;
+
+ /**
+ * Conversation server client
+ * Owned
+ */
+ CCSRequestHandler* iRequestHandler;
+
+ /**
+ * Not Owned. Message notifier.
+ */
+ FlashMsgNotifier* iNotifier;
+
+};
+
+#endif // FLASH_MSG_NOTIFIER_H
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/flashmsgnotifier/rom/flashmsgnotifier.iby Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef __FLASH_MSG_NOTIFIER_IBY__
+#define __FLASH_MSG_NOTIFIER_IBY__
+
+file=ABI_DIR\UREL\flashmsgnotifier.exe SHARED_LIB_DIR\flashmsgnotifier.exe
+data=DATAZ_\resource\apps\flashmsgnotifier.rsc resource\apps\flashmsgnotifier.rsc
+data=DATAZ_\private\10003a3f\import\apps\flashmsgnotifier_reg.rsc private\10003a3f\import\apps\flashmsgnotifier_reg.rsc
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/flashmsgnotifier/service_conf.xml Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<service>
+ <name>flashmsgnotifier</name>
+ <filepath>No path</filepath>
+ <description>Messaging services</description>
+ <interface>
+ <name>com.nokia.symbian.IFlashMsgNotifier</name>
+ <version>1.0</version>
+ <description>Interface which will display the flash message.</description>
+ </interface>
+</service>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/flashmsgnotifier/src/flashmsgnotifier.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implements interface for showing flash messages
+ *
+ */
+
+#include "flashmsgnotifier.h"
+
+#include <hbapplication.h>
+#include <hbdevicemessagebox.h>
+#include <hbmessagebox.h>
+#include <hbtextitem.h>
+#include <QAction>
+#include <debugtraces.h>
+#include <xqconversions.h>
+#include <xqapplicationmanager.h>
+#include <xqaiwrequest.h>
+#include <xqsystemtoneservice.h>
+#include "flashmsgnotifier_p.h"
+
+#define LOC_NOTIFICATION_MSG_TITLE hbTrId("txt_messaging_title_notification_message")
+#define LOC_BUTTON_SAVE hbTrId("txt_common_menu_save")
+#define LOC_BUTTON_DELETE hbTrId("txt_common_menu_delete")
+
+//-------------------------------------------------------
+// FlashMsgNotifier::FlashMsgNotifier()
+// Constructor
+//-------------------------------------------------------
+FlashMsgNotifier::FlashMsgNotifier(QObject *parent) :
+ XQServiceProvider(QLatin1String("flashmsgnotifier.com.nokia.symbian.IFlashMsgNotifier"),
+ parent)
+{
+ publishAll();
+ mSts = new XQSystemToneService;
+ d_ptr = q_check_ptr(new FlashMsgNotifierPrivate(this));
+}
+
+//-------------------------------------------------------
+// FlashMsgNotifier::~FlashMsgNotifier()
+// Destructor
+//-------------------------------------------------------
+FlashMsgNotifier::~FlashMsgNotifier()
+{
+ delete d_ptr;
+ delete mSts;
+}
+
+//-------------------------------------------------------
+// FlashMsgNotifier::displayFlashMsg()
+// @see header
+//-------------------------------------------------------
+void FlashMsgNotifier::displayFlashMsg(QByteArray displayParams)
+{
+ QCRITICAL_WRITE("FlashMsgNotifier::displayFlashMsg start.")
+
+ // Dialog
+ HbDeviceMessageBox notificationDialog(HbMessageBox::MessageTypeNone, this);
+
+ QDataStream stream(displayParams);
+
+ QString body;
+ QString address;
+ QString alias;
+ QString time;
+
+ int msgId;
+
+ stream >> body;
+ stream >> address;
+ stream >> alias;
+ stream >> time;
+ stream >> msgId;
+
+ //Save the address to be used later
+ mAddress.clear();
+ mAddress.append(address);
+
+ QString class0SmsBody;
+
+ class0SmsBody = LOC_NOTIFICATION_MSG_TITLE;
+
+ class0SmsBody.append("\n");
+
+ if (alias.isEmpty()) {
+ class0SmsBody.append(address);
+ class0SmsBody.append("\n");
+ }
+ else {
+ class0SmsBody.append(alias);
+ class0SmsBody.append("\n");
+ }
+
+ class0SmsBody.append(time);
+ class0SmsBody.append("\n");
+ class0SmsBody.append(body);
+
+ QDEBUG_WRITE_FORMAT("flashmsgnotifier launch message ", class0SmsBody);
+
+ notificationDialog.setText(class0SmsBody);
+
+ notificationDialog.setDismissPolicy(HbDialog::NoDismiss);
+ notificationDialog.setTimeout(HbPopup::NoTimeout);
+
+ notificationDialog.setTimeout(HbPopup::NoTimeout);
+ QAction* actionSave = new QAction(LOC_BUTTON_SAVE, this);
+ notificationDialog.setAction(actionSave, HbDeviceMessageBox::AcceptButtonRole);
+
+ QAction* actionQuit = new QAction(LOC_BUTTON_DELETE, this);
+ notificationDialog.setAction(actionQuit, HbDeviceMessageBox::RejectButtonRole);
+
+ //Play audio alert when flash msg is shown
+ mSts->playTone(XQSystemToneService::SmsAlertTone);
+
+ const QAction* result = notificationDialog.exec();
+ // if accepted launch view else quit
+ if (notificationDialog.isAcceptAction(result))
+ {
+ onSaveAction(msgId);
+ }
+ else
+ {
+ onDeleteAction(msgId);
+ }
+ QCRITICAL_WRITE("FlashMsgNotifier::displayFlashMsg end.")
+
+}
+
+//-------------------------------------------------------
+// FlashMsgNotifier::onSaveAction()
+// @see header
+//-------------------------------------------------------
+void FlashMsgNotifier::onSaveAction(int msgId)
+{
+ TRAPD(err, d_ptr->SaveMessageL(msgId));
+ QDEBUG_WRITE_FORMAT("error while saving", err);
+
+ HBufC* addr = NULL;
+ qint64 conversationId = -1;
+ addr = XQConversions::qStringToS60Desc(mAddress);
+ QDEBUG_WRITE_FORMAT("onSaveAction", mAddress);
+ TRAP(err, conversationId = d_ptr->GetConversationIdFromAddressL(*addr));
+ delete addr;
+ QDEBUG_WRITE_FORMAT("error while fetching address", err);
+
+ if (conversationId != -1) {
+ //Switch to CV
+ QList<QVariant> args;
+ QString serviceName("com.nokia.services.hbserviceprovider");
+ QString operation("open(qint64)");
+ XQAiwRequest* request;
+ XQApplicationManager appManager;
+ request = appManager.create(serviceName, "conversationview",
+ operation,false); // embedded
+ if (request == NULL) {
+ QDEBUG_WRITE_FORMAT("error while fetching address",
+ request->lastErrorMessage());
+ return;
+ }
+ args << QVariant(conversationId);
+ request->setArguments(args);
+ request->send();
+ delete request;
+ }
+}
+
+//-------------------------------------------------------
+// FlashMsgNotifier::onDeleteAction()
+// @see header
+//-------------------------------------------------------
+void FlashMsgNotifier::onDeleteAction(int msgId)
+{
+ d_ptr->DeleteMessage(msgId);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/flashmsgnotifier/src/flashmsgnotifier_p.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: handler for saving and deleting flash messages
+ *
+ */
+
+#include "flashmsgnotifier_p.h"
+#include <xqconversions.h>
+#include <msvids.h>
+#include <txtrich.h>
+#include <smuthdr.h>
+#include <debugtraces.h>
+#include <ccsrequesthandler.h>
+#include <tmsvsmsentry.h>
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// FlashMsgNotifierPrivate::FlashMsgNotifierPrivate
+// constructor.
+// ---------------------------------------------------------
+//
+FlashMsgNotifierPrivate::FlashMsgNotifierPrivate(FlashMsgNotifier* notifier) :
+ iMsvSession(NULL), iRequestHandler(NULL),iNotifier(notifier)
+{
+ InitL();
+}
+
+// ---------------------------------------------------------
+// FlashMsgNotifierPrivate::~FlashMsgNotifierPrivate
+// Destructor.
+// ---------------------------------------------------------
+//
+FlashMsgNotifierPrivate::~FlashMsgNotifierPrivate()
+{
+ if (iMsvSession) {
+ delete iMsvSession;
+ iMsvSession = NULL;
+ }
+ if(iRequestHandler) {
+ delete iRequestHandler;
+ iRequestHandler = NULL;
+ }
+ iNotifier = NULL;
+
+}
+
+// ---------------------------------------------------------
+// InitL( )
+// @see header
+// ---------------------------------------------------------
+void FlashMsgNotifierPrivate::InitL()
+{
+ iMsvSession = CMsvSession::OpenSyncL(*this);
+ iRequestHandler = CCSRequestHandler::NewL();
+}
+
+// ---------------------------------------------------------
+// FlashMsgNotifierPrivate::HandleSessionEventL()
+// @see header
+// ---------------------------------------------------------
+//
+void FlashMsgNotifierPrivate::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/,
+ TAny* /*aArg2*/, TAny* /*aArg3*/)
+{
+
+}
+
+// ---------------------------------------------------------
+// FlashMsgNotifierPrivate::DeleteMessage()
+// @see header
+// ---------------------------------------------------------
+//
+void FlashMsgNotifierPrivate::DeleteMessage(TMsvId aMsgId)
+{
+ iMsvSession->RemoveEntry(aMsgId);
+}
+
+// ---------------------------------------------------------
+// FlashMsgNotifierPrivate::SaveMessageL()
+// @see header
+// ---------------------------------------------------------
+//
+void FlashMsgNotifierPrivate::SaveMessageL(TMsvId aMsgId)
+{
+ QDEBUG_WRITE_FORMAT("SaveMessageL Begin", aMsgId);
+
+ CMsvEntry* msgEntry = iMsvSession->GetEntryL(aMsgId);
+ CleanupStack::PushL( msgEntry );
+
+ TMsvEntry entry = msgEntry->Entry();
+
+ // If the entry is readonly we need to make it read...
+ if(entry.ReadOnly())
+ {
+ entry.SetReadOnly(EFalse);
+ entry.SetUnread(EFalse);
+ entry.SetNew(EFalse);
+ msgEntry->ChangeL(entry);
+ }
+
+ CPlainText* nullString = CPlainText::NewL();
+ CleanupStack::PushL( nullString );
+
+ CSmsHeader* smsheader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *nullString);
+ CleanupStack::PushL( smsheader );
+
+ CMsvStore* store = msgEntry->EditStoreL();
+ CleanupStack::PushL( store );
+
+ smsheader->RestoreL(*store);
+ smsheader->Message().SmsPDU().SetClass(ETrue, TSmsDataCodingScheme::ESmsClass1 );
+ smsheader->StoreL( *store );
+ store->Commit();
+
+ TMsvSmsEntry entry1 = msgEntry->Entry();
+ entry1.SetClass(ETrue, TSmsDataCodingScheme::ESmsClass1 );
+ msgEntry->ChangeL(entry1);
+ CleanupStack::PopAndDestroy(4);
+ QDEBUG_WRITE_FORMAT("SaveMessageL End", aMsgId);
+}
+
+// ---------------------------------------------------------
+// FlashMsgNotifierPrivate::GetConversationIdFromAddressL()
+// @see header
+// ---------------------------------------------------------
+//
+TInt FlashMsgNotifierPrivate::GetConversationIdFromAddressL(
+ TDesC& aContactAddress)
+{
+ return
+ iRequestHandler->GetConversationIdFromAddressL(aContactAddress);
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/flashmsgnotifier/src/main.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+#include <QTranslator>
+#include <QLocale>
+#include <QFile>
+#include <hbapplication.h>
+#include <QDateTime>
+#include "flashmsgnotifier.h"
+
+#define LOC_TITLE hbTrId("")
+
+#include "debugtraces.h"
+
+const QString debugFileName("c:/flashmessage.txt");
+
+#ifdef _DEBUG_TRACES_
+void debugInit(QtMsgType type, const char *msg)
+{
+
+ QFile ofile(debugFileName);
+ if (!ofile.open(QIODevice::Append | QIODevice::Text)) {
+ qFatal("error opening results file");
+ return;
+ }
+ QDateTime dt = QDateTime::currentDateTime();
+
+ QTextStream out(&ofile);
+ switch (type) {
+ case QtDebugMsg:
+ out << "\n DEBUG:";
+ out << msg;
+ break;
+ case QtWarningMsg:
+ out << "\n WARN:";
+ out << msg;
+ break;
+ case QtCriticalMsg:
+ out << "\n ";
+ out << dt.toString("dd/MM/yyyy hh:mm:ss.zzz:ap");
+ out << " CRITICAL:";
+ out << msg;
+ break;
+ case QtFatalMsg:
+ out << "\n FATAL:";
+ out << msg;
+ abort();
+ break;
+ default:
+ out << " No Log Selection Type:";
+ out << msg;
+ break;
+
+ }
+}
+#endif
+
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+ app.hideSplash();
+ QString locale = QLocale::system().name();
+ QString path = "z:/resource/qt/translations/";
+ QTranslator translator;
+ QTranslator translator_comm;
+ translator.load(path + QString("messaging_") + locale);
+ translator_comm.load(path + QString("common_") + locale);
+ //translator.load( "messaging_en_GB", ":/translations" );
+ app.installTranslator(&translator);
+ app.installTranslator(&translator_comm);
+
+ app.setApplicationName(LOC_TITLE);
+#ifdef _DEBUG_TRACES_
+ //Debug Logs
+ QFile ofile;
+ if (ofile.exists(debugFileName)) {
+ ofile.remove(debugFileName);
+ }
+ qInstallMsgHandler(debugInit);
+#endif
+ FlashMsgNotifier* w = new FlashMsgNotifier;
+ int rv = app.exec();
+
+ delete w;
+ return rv;
+}
--- a/messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicator_p.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicator_p.h Wed Aug 18 09:45:25 2010 +0300
@@ -18,7 +18,11 @@
#ifndef MSGINDICATOR_PRIVATE_H
#define MSGINDICATOR_PRIVATE_H
+
+#include <e32base.h>
#include "msginfodefs.h"
+
+// Forward Declarations
class MsgIndicator;
class CCSRequestHandler;
class IndicatorData;
@@ -27,7 +31,7 @@
* Message indicator class.
* Handles client request and showing the indications.
*/
-class MsgIndicatorPrivate
+class MsgIndicatorPrivate : public CBase
{
public:
/**
--- a/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -43,6 +43,7 @@
#define LOC_OUTGOING_MULTIPLE_MESSAGES hbTrId("Outgoing Messages")
#define STATUS_MONO_NEW_MESSAGE QString("qtg_status_new_message")
#define LOC_BUSINESSCARD hbTrId("Business card")
+#define LOC_MULTIMEDIA_MSG hbTrId("txt_messaging_list_indimenu_multimedia_message")
/**
* The number of indicators.
*/
@@ -121,7 +122,7 @@
InteractionActivated),
mIndicatorType(NULL)
{
- d_ptr = new MsgIndicatorPrivate(this);
+ d_ptr = q_check_ptr(new MsgIndicatorPrivate(this));
}
// ----------------------------------------------------------------------------
@@ -321,7 +322,11 @@
secondaryText = fname.fileName();
}
else if(ECsBioMsg_VCard == info.mMessageType) {
- secondaryText = LOC_BUSINESSCARD;
+ secondaryText = LOC_BUSINESSCARD;
+ }
+ else if (secondaryText.isEmpty() &&
+ (ECsMMS == info.mMessageType || ECsAudio == info.mMessageType)) {
+ secondaryText = LOC_MULTIMEDIA_MSG;
}
}
else {
--- a/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator_p.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator_p.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -33,7 +33,7 @@
MsgIndicatorPrivate::MsgIndicatorPrivate(MsgIndicator* inidcator) :
q_ptr(inidcator), mCvServer(NULL)
{
- TRAP_IGNORE(initL());
+ initL();
}
// ----------------------------------------------------------------------------
--- a/messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -36,11 +36,8 @@
const int NoError = 0;
const int ParameterError = 10000;
-const QString BT_ICON("qtg_large_bluetooth");
-const QString SMS_ICON("qtg_large_new_message");
-const QString MMS_ICON("qtg_large_new_message");
-const QString RINGTONE_ICON("qtg_large_new_message");
-const QString VCARD_ICON("qtg_large_new_message");
+static const char NEW_MSG_ICON[] = "qtg_large_new_message";
+
// ----------------------------------------------------------------------------
// ServiceRequestSenderTask::ServiceRequestSenderTask
// @see msgnotificationdialogwidget.h
@@ -126,50 +123,22 @@
prepareDisplayName(parameters);
+ setIcon(HbIcon(NEW_MSG_ICON));
+
int messageType = parameters.value(KMessageTypeKey).toInt();
if( messageType == ECsSMS)
{
- HbIcon icon(SMS_ICON);
- setIcon(icon);
QString messageBody;
messageBody = parameters.value(KMessageBodyKey).toString();
messageBody.replace(QChar::ParagraphSeparator, QChar::LineSeparator);
messageBody.replace('\r', QChar::LineSeparator);
setText(messageBody);
}
- else if(messageType == ECsMMS)
- {
- HbIcon icon(MMS_ICON);
- setIcon(icon);
- setText(parameters.value(KMessageSubjectKey).toString());
- }
- else if(messageType == ECsMmsNotification)
- {
- HbIcon icon(MMS_ICON);
- setIcon(icon);
- setText(parameters.value(KMessageSubjectKey).toString());
- }
- else if(messageType == ECsRingingTone)
- {
- HbIcon icon(RINGTONE_ICON);
- setIcon(icon);
- setText(parameters.value(KMessageBodyKey).toString());
- }
- else if(messageType == ECsBlueTooth)
- {
- HbIcon icon(BT_ICON); // show default for other message types
- setIcon(icon);
- setText(parameters.value(KMessageBodyKey).toString());
- }
- else if(messageType == ECsBioMsg_VCard)
- {
- HbIcon icon(VCARD_ICON); // show default for other message types
- setIcon(icon);
- setText(parameters.value(KMessageBodyKey).toString());
- }
else
{
- setText(parameters.value(KMessageBodyKey).toString());
+ // No special handling required for other message types.
+ // Subject & Body text are both set to description in msgnotifier.
+ setText(parameters.value(KMessageSubjectKey).toString());
}
// enable touch activation and connect to slot
--- a/messagingapp/msgnotifications/msgnotifications.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifications.pro Wed Aug 18 09:45:25 2010 +0300
@@ -21,4 +21,5 @@
SUBDIRS += msgindicatorplugin/msgindicatorplugin.pro
SUBDIRS += msgnotifier/msgnotifier.pro
SUBDIRS += msgerrornotifier/msgerrornotifier.pro
+SUBDIRS += flashmsgnotifier/flashmsgnotifier.pro
--- a/messagingapp/msgnotifications/msgnotifier/inc/msgnotifier_p.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/inc/msgnotifier_p.h Wed Aug 18 09:45:25 2010 +0300
@@ -20,6 +20,7 @@
#define MSGNOTIFIER_PRIVATE_H
#include <mcsconversationlistchangeobserver.h>
+#include <QRunnable>
// CLASS DECLARATION
class MsgNotifier;
@@ -30,10 +31,22 @@
class XQSystemToneService;
/**
+ * Structure to hold the details of a class 0 SMS
+ */
+struct Class0Info
+{
+ QString body;
+ QString address;
+ QString alias;
+ QString time;
+ int messageId;
+};
+
+/**
* @class MsgNotifierPrivate
*/
-class MsgNotifierPrivate : public MCsConversationListChangeObserver
+class MsgNotifierPrivate : public CBase, public MCsConversationListChangeObserver
{
public:
@@ -114,6 +127,13 @@
*/
void displayFailedNote(MsgInfo msgInfo);
+ /**
+ * ShowClass0Message
+ * Popups a Dialog with Class 0 SMS message...
+ * @param msgInfo MsgInfo The message information object
+ */
+ void ShowClass0Message(Class0Info& aClass0Info);
+
private:
/**
* Does all the initializations.
@@ -180,5 +200,35 @@
XQSystemToneService* mSts;
};
+
+/**
+ * Class for launching the Class0 SMS dialog in a separate thread..
+ */
+class Class0SmsServiceTask : public QRunnable
+{
+public:
+ /**
+ * Constructor
+ */
+ Class0SmsServiceTask(Class0Info& class0info);
+
+ /**
+ * Destructor
+ */
+ ~Class0SmsServiceTask();
+
+ /**
+ * create and send service request
+ */
+ void run();
+
+private:
+ Class0Info mClass0info;
+};
+
+
+
+
+
#endif // MSGNOTIFIER_PRIVATE_H
//EOF
--- a/messagingapp/msgnotifications/msgnotifier/inc/msgstorehandler.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/inc/msgstorehandler.h Wed Aug 18 09:45:25 2010 +0300
@@ -22,6 +22,7 @@
#include <msvapi.h>
#include <ccsdefs.h>
#include <QString>
+#include <platform/ssm/ssmstateawaresession.h>
//USER INCLUDES
#include "msginfodefs.h"
@@ -40,7 +41,7 @@
* @class MsgStoreHandler
* handles the Messaging store for outbox events.
*/
-class MsgStoreHandler: public MMsvSessionObserver, public MMsvEntryObserver
+class MsgStoreHandler: public CActive, public MMsvSessionObserver, public MMsvEntryObserver
{
public:
@@ -116,6 +117,18 @@
*/
TBool OperationOngoing(const TMsvEntry& aEntry) const;
+ /**
+ * Process the class0 SMS and extract all the relevant information
+ * @param aHeader, Class0 SMS header
+ */
+ void HandleClass0SmsL(CMsvEntry* aMsgEntry, TMsvId aMsgId);
+
+ /**
+ * From CActive
+ */
+ void DoCancel();
+ void RunL();
+
private:
/**
* Own. Msv Session
@@ -141,7 +154,12 @@
* List of messages in Fialed states
*/
CMsvEntrySelection* iFailedMessages;
-
+
+ /**
+ * Interface to receive notifications when the
+ * System State changes.
+ */
+ RSsmStateAwareSession iStateAwareSession;
};
#endif // MSG_STORE_HANDLER_H
--- a/messagingapp/msgnotifications/msgnotifier/msgnotifier.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/msgnotifier.pro Wed Aug 18 09:45:25 2010 +0300
@@ -30,6 +30,7 @@
TARGET.CAPABILITY = ALL -TCB
TARGET.UID3 = 0x2002E678
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+INCLUDEPATH += $$OS_LAYER_SYSTEMINCLUDE
SYMBIAN_PLATFORMS = WINSCW ARMV5
}
@@ -70,5 +71,7 @@
-lxqutils \
-lws32 \
-lapgrfx \
- -lxqsystemtoneservice
+ -lxqsystemtoneservice \
+ -lgsmu \
+ -lssmcmn
--- a/messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -35,9 +35,10 @@
#include "debugtraces.h"
// LOCALIZATION CONSTANTS
-#define LOC_RECEIVED_FILES hbTrId("txt_messaging_title_received_files")
-#define LOC_BUSINESS_CARD hbTrId("txt_messaging_dpopinfo_business_card")
+#define LOC_RECEIVED_FILES hbTrId("txt_messaging_title_received_files")
+#define LOC_BUSINESS_CARD hbTrId("txt_messaging_dpopinfo_business_card")
#define CARD_SEPERATOR "-"
+#define LOC_MULTIMEDIA_MSG hbTrId("txt_messaging_dpopinfo_multimedia_message")
// plugin ids
const QString IndicationsPluginId("com.nokia.messaging.newindicatorplugin");
@@ -54,7 +55,7 @@
{
QDEBUG_WRITE("MsgNotifier::MsgNotifier : Enter")
- d_ptr = new MsgNotifierPrivate(this);
+ d_ptr = q_check_ptr(new MsgNotifierPrivate(this));
mSimHandler = new MsgSimNumDetector();
@@ -118,10 +119,15 @@
}
delete pluginLoader;
}
+ else if( data.mDescription.isEmpty() && (ECsMMS == data.mMsgType || ECsAudio == data.mMsgType) )
+ {
+ description = LOC_MULTIMEDIA_MSG;
+ }
else
{
description = data.mDescription;
}
+
notificationData[QString(KDisplayNameKey)] = data.mDisplayName ;
notificationData[QString(KConversationIdKey)] = data.mConversationId;
notificationData[QString(KMessageTypeKey)] = data.mMsgType;
--- a/messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -26,9 +26,12 @@
#include <w32std.h>
#include <apgtask.h>
#include <XQSettingsManager>
+#include <xqaiwrequest.h>
+#include <xqappmgr.h>
#include <xqpublishandsubscribeutils.h>
#include <xqsystemtoneservice.h>
#include <xqconversions.h>
+#include <QThreadPool>
//USER INCLUDES
#include "msgnotifier.h"
@@ -48,7 +51,7 @@
{
QDEBUG_WRITE("MsgNotifierPrivate::MsgNotifierPrivate : Enter")
- TRAP_IGNORE(initL());
+ initL();
QDEBUG_WRITE("MsgNotifierPrivate::MsgNotifierPrivate : Exit")
}
@@ -60,7 +63,7 @@
{
QDEBUG_WRITE("MsgNotifierPrivate::~MsgNotifierPrivate : Enter")
if (mCvServer) {
- mCvServer->RemoveConversationListChangeEventL(this);
+ TRAP_IGNORE(mCvServer->RemoveConversationListChangeEventL(this));
delete mCvServer;
mCvServer = NULL;
}
@@ -103,10 +106,11 @@
updateUnreadIndications(true);
updateOutboxIndications();
- mSettingsManager = new XQSettingsManager();
+ QT_TRYCATCH_LEAVING(mSettingsManager = new XQSettingsManager());
// define property
- mPSUtils = new XQPublishAndSubscribeUtils(*mSettingsManager);
+ QT_TRYCATCH_LEAVING(mPSUtils = new XQPublishAndSubscribeUtils(*mSettingsManager));
+
XQPublishAndSubscribeSettingsKey convIdKey(
KMsgCVIdProperty, KMsgCVIdKey);
bool success = mPSUtils->defineProperty(convIdKey,
@@ -121,7 +125,7 @@
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL "
"writing ret value",success)
- mSts = new XQSystemToneService();
+ QT_TRYCATCH_LEAVING(mSts = new XQSystemToneService());
QDEBUG_WRITE("MsgNotifierPrivate::initL : Exit")
}
@@ -133,12 +137,12 @@
void MsgNotifierPrivate::AddConversationList(
const CCsClientConversation& aClientConversation)
{
- QDEBUG_WRITE("MsgNotifierPrivate::AddConversationList : Enter")
+ QCRITICAL_WRITE("MsgNotifierPrivate::AddConversationList : Enter")
processListEntry(aClientConversation);
updateUnreadIndications();
- QDEBUG_WRITE("MsgNotifierPrivate::AddConversationList : Exit")
+ QCRITICAL_WRITE("MsgNotifierPrivate::AddConversationList : Exit")
}
// ----------------------------------------------------------------------------
@@ -159,12 +163,12 @@
// ----------------------------------------------------------------------------
void MsgNotifierPrivate::ModifyConversationList(const CCsClientConversation& aClientConversation)
{
- QDEBUG_WRITE("MsgNotifierPrivate::ModifyConversationList : Enter")
+ QCRITICAL_WRITE("MsgNotifierPrivate::ModifyConversationList : Enter")
processListEntry(aClientConversation);
updateUnreadIndications();
- QDEBUG_WRITE("MsgNotifierPrivate::ModifyConversationList : Exit")
+ QCRITICAL_WRITE("MsgNotifierPrivate::ModifyConversationList : Exit")
}
// ----------------------------------------------------------------------------
@@ -183,7 +187,7 @@
void MsgNotifierPrivate::processListEntry(
const CCsClientConversation& aClientConversation)
{
- QDEBUG_WRITE("MsgNotifierPrivate::processListEntry : Enter")
+ QCRITICAL_WRITE("MsgNotifierPrivate::processListEntry : Enter")
CCsConversationEntry* convEntry =
aClientConversation.GetConversationEntry();
@@ -237,7 +241,7 @@
}
- QDEBUG_WRITE("MsgNotifierPrivate::processListEntry : Exit")
+ QCRITICAL_WRITE("MsgNotifierPrivate::processListEntry : Exit")
}
// ----------------------------------------------------------------------------
@@ -384,6 +388,82 @@
// @see mcsconversationclientchangeobserver.h
// ----------------------------------------------------------------------------
void MsgNotifierPrivate::PartialDeleteConversationList(
- const CCsClientConversation& aClientConversation){/*empty implementation*/}
+ const CCsClientConversation& /*aClientConversation*/){/*empty implementation*/}
+
+
+// ----------------------------------------------------------------------------
+// MsgNotifierPrivate::ShowClass0Message
+// @see msgnotifier_p.h
+// ----------------------------------------------------------------------------
+
+void MsgNotifierPrivate::ShowClass0Message(Class0Info& class0Info)
+{
+ QCRITICAL_WRITE("flashmsgnotifier BEGIN");
+ QThreadPool::globalInstance()->start(new Class0SmsServiceTask(class0Info));
+ QCRITICAL_WRITE("flashmsgnotifier END");
+}
+
+
+
+
+// ----------------------------------------------------------------------------
+// Class0SmsServiceTask::Class0SmsServiceTask
+// @see msgnotifier_p.h
+// ----------------------------------------------------------------------------
+Class0SmsServiceTask::Class0SmsServiceTask(Class0Info& class0Info):
+mClass0info(class0Info)
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// Class0SmsServiceTask::~Class0SmsServiceTask
+// @see msgnotifier_p.h
+// ----------------------------------------------------------------------------
+Class0SmsServiceTask::~Class0SmsServiceTask()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// Class0SmsServiceTask::run
+// @see msgnotifier_p.h
+// ----------------------------------------------------------------------------
+void Class0SmsServiceTask::run()
+ {
+ QList<QVariant> args;
+ QString serviceName("flashmsgnotifier");
+ QString interfaceName("com.nokia.symbian.IFlashMsgNotifier");
+ QString operation("displayFlashMsg(QByteArray)");
+ XQAiwRequest* request;
+ XQApplicationManager appManager;
+
+ request = appManager.create(interfaceName, operation, false); //non-embedded
+
+ if ( request == NULL )
+ {
+ QCRITICAL_WRITE("flashmsgnotifier request == NULL");
+ return;
+ }
+
+ QByteArray ba;
+ QDataStream stream(&ba, QIODevice::ReadWrite);
+ stream << mClass0info.body;
+ stream << mClass0info.address;
+ stream << mClass0info.alias;
+ stream << mClass0info.time;
+ stream << mClass0info.messageId;
+
+ args << ba;
+ request->setArguments(args);
+
+ if(!request->send())
+ {
+ QString lastErr;
+ lastErr = request->lastErrorMessage();
+ QDEBUG_WRITE_FORMAT("flashmsgnotifier launch failed", lastErr);
+ }
+
+ QCRITICAL_WRITE("flashmsgnotifier END");
+ delete request;
+ }
//EOF
--- a/messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -21,14 +21,20 @@
#include <ccsrequesthandler.h>
#include <ccsconversationentry.h>
#include <ccsclientconversation.h>
-
+#include "msgcontacthandler.h"
#include <msvids.h>
#include <mmsconst.h>
+#include <smuthdr.h>
#include <SendUiConsts.h>
#include <msvsearchsortquery.h>
#include <msvsearchsortoperation.h>
+#include <tmsvsmsentry.h>
+#include <txtrich.h>
+#include <ssm/ssmdomaindefs.h>
+#include "debugtraces.h"
// CONSTANTS
+_LIT(KUnixEpoch, "19700000:000000.000000");
// ================= MEMBER FUNCTIONS =======================
@@ -37,9 +43,9 @@
// ---------------------------------------------------------
//
MsgStoreHandler::MsgStoreHandler(MsgNotifierPrivate* notifier, CCSRequestHandler* aCvServer) :
- iMsvSession(NULL), iNotifier(notifier), iRequestHandler(aCvServer)
+ CActive(EPriorityStandard), iMsvSession(NULL), iNotifier(notifier), iRequestHandler(aCvServer)
{
- TRAP_IGNORE(InitL());
+ InitL();
}
// ---------------------------------------------------------
@@ -48,6 +54,9 @@
//
MsgStoreHandler::~MsgStoreHandler()
{
+ Cancel();
+ iStateAwareSession.Close();
+
if (iMsvEntry) {
delete iMsvEntry;
iMsvEntry = NULL;
@@ -76,8 +85,82 @@
iMsvEntry->AddObserverL(*this);
iFailedMessages = new (ELeave) CMsvEntrySelection;
+
+ User::LeaveIfError(iStateAwareSession.Connect(KSM2GenMiddlewareDomain3));
+ CActiveScheduler::Add(this);
+
+ TSsmState ssmState = iStateAwareSession.State();
+
+ if (ssmState.MainState() != ESsmNormal)
+ {
+ iStateAwareSession.RequestStateNotification(iStatus);
+ SetActive();
+ }
+ else
+ {
+ RunL();
+ }
+
}
+void MsgStoreHandler::RunL()
+{
+ TSsmState ssmState = iStateAwareSession.State();
+ if (ssmState.MainState() != ESsmNormal)
+ {
+ iStateAwareSession.RequestStateNotification(iStatus);
+ SetActive();
+ }
+ else
+ {
+ //Create the query/operation object
+ CMsvSearchSortOperation *operation = CMsvSearchSortOperation::NewL(*iMsvSession);
+ CleanupStack::PushL(operation);
+ CMsvSearchSortQuery *query = CMsvSearchSortQuery::NewL();
+ CleanupStack::PushL(query);
+
+ //set the query options
+ query->SetParentId(KMsvGlobalInBoxIndexEntryId);
+ query->SetResultType(EMsvResultAsTMsvId);
+ query->AddSearchOptionL(EMsvMtmTypeUID, KSenduiMtmSmsUidValue, EMsvEqual);
+ query->AddSearchOptionL(EMsvUnreadMessages, ETrue);
+ CleanupStack::Pop(query);
+
+ CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC();
+ //ownership of Query transferred to Operation
+ operation->RequestL(query, EFalse, wait->iStatus);
+ wait->Start();
+
+ //Get No of entries
+ RArray<TMsvId> messageArray;
+ operation->GetResultsL(messageArray);
+
+ CMsvEntry* entry = NULL;
+ for (TInt i = 0; i < messageArray.Count(); ++i)
+ {
+ entry = iMsvSession->GetEntryL(messageArray[i]);
+ TMsvSmsEntry smsEntry = entry->Entry();
+ TSmsDataCodingScheme::TSmsClass classType(TSmsDataCodingScheme::ESmsClass0);
+ if (smsEntry.Class(classType))
+ {
+ HandleClass0SmsL(entry, smsEntry.Id());
+ }
+ else
+ {
+ delete entry;
+ entry = NULL;
+ }
+ }
+ messageArray.Close();
+ CleanupStack::PopAndDestroy(2, operation);
+ }
+
+}
+
+void MsgStoreHandler::DoCancel()
+{
+ iStateAwareSession.RequestStateNotificationCancel();
+}
// ---------------------------------------------------------
// MsgStoreHandler::HandleSessionEventL()
// ---------------------------------------------------------
@@ -102,8 +185,32 @@
return;
}
+ // check for incoming class 0 sms
+ if (parent == KMsvGlobalInBoxIndexEntryIdValue && aEvent == EMsvEntriesChanged) {
+ CMsvEntry* inboxEntry = iMsvSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ for (TInt i = 0; i < selection->Count(); ++i) {
+ TMsvEntry entry = inboxEntry->ChildDataL(selection->At(i));
+ if (KSenduiMtmSmsUidValue == entry.iMtm.iUid) {
+ CMsvEntry* msgEntry = iMsvSession->GetEntryL(entry.Id());
+ TMsvSmsEntry smsEntry = msgEntry->Entry();
+ TSmsDataCodingScheme::TSmsClass classType(TSmsDataCodingScheme::ESmsClass0);
+
+ if (smsEntry.Class(classType) && smsEntry.Unread())
+ {
+ HandleClass0SmsL(msgEntry, smsEntry.Id());
+ }
+ else
+ {
+ delete msgEntry;
+ msgEntry = NULL;
+ }
+ }
+
+ } // for (TInt i = 0; i < selection->Count(); ++i)
+ delete inboxEntry;
+ }
//Handling for outbox entries
- if (parent == KMsvGlobalOutBoxIndexEntryIdValue) {
+ else if (parent == KMsvGlobalOutBoxIndexEntryIdValue) {
CMsvEntry* rootEntry = iMsvSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
for (TInt i = 0; i < selection->Count(); ++i) {
@@ -166,6 +273,79 @@
}
// ---------------------------------------------------------
+// MsgStoreHandler::HandleClass0SmsL()
+// ---------------------------------------------------------
+//
+void MsgStoreHandler::HandleClass0SmsL(CMsvEntry* aMsgEntry, TMsvId aMsgId)
+{
+ CleanupStack::PushL(aMsgEntry);
+
+ CMsvStore* store = aMsgEntry->ReadStoreL();
+ CleanupStack::PushL(store);
+
+ CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
+ CleanupStack::PushL(paraFormatLayer);
+
+ CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
+ CleanupStack::PushL(charFormatLayer);
+
+ CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer);
+ CleanupStack::PushL(richText);
+
+ store->RestoreBodyTextL(*richText);
+
+ TInt len = richText->DocumentLength();
+ HBufC* bufBody = HBufC::NewLC(len * 2);
+
+ // Get Body content of SMS message
+ TPtr bufBodyPtr = bufBody->Des();
+ richText->Extract(bufBodyPtr, 0, len);
+
+ //convert bufbody to qstring..
+ QString body = XQConversions::s60DescToQString(*bufBody);
+
+ Class0Info class0Info;
+
+ class0Info.body = body;
+ CleanupStack::PopAndDestroy(bufBody);
+
+ // Get From address of SMS message
+ CPlainText* nullString = CPlainText::NewL();
+ CleanupStack::PushL(nullString);
+
+ CSmsHeader* smsheader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *nullString);
+ CleanupStack::PushL(smsheader);
+ smsheader->RestoreL(*store);
+
+ QString address = XQConversions::s60DescToQString(smsheader->FromAddress());
+ class0Info.address = address;
+
+ // Get alias of SMS message
+ QString alias;
+ int count;
+ MsgContactHandler::resolveContactDisplayName(address, alias, count);
+ class0Info.alias = alias;
+
+ // Get timestamp of SMS message
+ QDateTime timeStamp;
+ TTime time = aMsgEntry->Entry().iDate;
+ TTime unixEpoch(KUnixEpoch);
+ TTimeIntervalSeconds seconds;
+ time.SecondsFrom(unixEpoch, seconds);
+ timeStamp.setTime_t(seconds.Int());
+
+ const QString times = timeStamp.toString("dd/MM/yy hh:mm ap");
+ class0Info.time = times;
+
+ class0Info.messageId = aMsgId;
+ CleanupStack::PopAndDestroy(7);
+ aMsgEntry = NULL;
+
+ // Show the SMS message..
+ iNotifier->ShowClass0Message(class0Info);
+}
+
+// ---------------------------------------------------------
// MsgStoreHandler::HandleEntryEventL()
// ---------------------------------------------------------
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmsreadfile.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,471 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSREADFILE_H
-#define MMSREADFILE_H
-
-// INCLUDES
-#include <e32base.h>
-#include <badesca.h>
-#include <f32file.h>
-#include <msvstd.h>
-
-// forward references
-class CMmsAttaStructure;
-class CMmsHeaders;
-class CEikonEnv;
-class CMmsClientMtm;
-
-// Out-of-range value for any MMS header with assigned number
-// Used in coverage tests to get coverage for "default" branches
-// in "case" statements.
-const TInt KMmsTestIllegalValue = 255;
-
-//
-// TEST KEY WORDS
-// Extended to include all MMS headers to allow generation of arbitrary PDUs
-// Content type header cannot be separately defined,
-// it will always be "multipat/mixed" or "multipart/related"
-_LIT8( KTestEndOfFile, "EOF" );
-_LIT8( KTestNewMessage, "MESSAGE BEGIN" );
-//------------------------------------------------
-_LIT8( KTestMessageType, "MESSAGE-TYPE" ); //X-Mms-Message-Type
-_LIT8( KTestDate, "DATE" ); // Date
-_LIT8( KTestFrom, "FROM" ); // From
-_LIT8( KTestTo, "TO" ); // To
-_LIT8( KTestCc, "CC" ); // Cc
-_LIT8( KTestBcc, "BCC" ); // Bcc
-_LIT8( KTestSubject, "SUBJECT" ); // Subject
-_LIT8( KTestExpiryRel, "EXPIRY-REL" ); // X-Mms-Expiry, relative
-_LIT8( KTestExpiryAbs, "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
-_LIT8( KTestDeliveryTimeRel, "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
-_LIT8( KTestDeliveryTimeAbs, "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
-_LIT8( KTestPriority, "PRIORITY" ); // X-Mms-Priority
-_LIT8( KTestSenderVisibility, "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
-_LIT8( KTestDeliveryReport, "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
-_LIT8( KTestReadReply, "READ-REPLY" ); // X-Mms-Read-Report
-// ---------------------------------------------------
-_LIT8( KTestNewAttachment, "ATTACHMENT" );
-_LIT8( KTestAttachmentType, "ATTACHMENTTYPE" );
-_LIT8( KTestAttachmentName, "ATTACHMENTNAME" );
-_LIT8( KTestAttachmentContLoc, "ATTACHMENTCONTLOC" );
-_LIT8( KTestAttachmentCharset, "ATTACHMENTCHARSET" );
-_LIT8( KTestAttachmentCid, "ATTACHMENTCID" );
-_LIT8( KTestAttachmentRoot, "ATTACHMENTROOT" );
-// content-type and x-type parameters for attachments
-// should appear in name-value pairs.
-// Test program is not responsible for verifying illegal scripts
-_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
-_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
-_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
-_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
-// -----------------------------------------------------
-_LIT8( KTestMessageClass, "MESSAGE-CLASS" ); // X-Mms-Message-Class
-_LIT8( KTestDelivRepSendAllow, "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
-_LIT8( KTestAcceptAdvertis, "ACCEPT-ADVERTISEMENTS" );
-_LIT8( KTestRetryCount, "RETRY-COUNT" );
-_LIT8( KTestRetryInterval, "RETRY-INTERVAL" );
-// -------------------------------------------------
-_LIT8( KTestAlias, "ALIAS" );
-_LIT8( KTestFromAlias, "FROMALIAS" );
-_LIT8( KTestToAlias, "TOALIAS" );
-_LIT8( KTestCcAlias, "CCALIAS" );
-_LIT8( KTestBccAlias, "BCCALIAS" );
-// -------------------------------------------------
-// more Message headers to allow testing all possible PDUs and
-// MMS 1.1 headers
-_LIT8( KTestReplyCharging, "REPLY-CHARGING" ); // X-Mms-Reply-Charging
-_LIT8( KTestReplyChargAbs, "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
-_LIT8( KTestReplyChargRel, "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
-_LIT8( KTestReplyChargSize, "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
-_LIT8( KTestReplyChargID, "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
-_LIT8( KTestTID, "TID" );
-_LIT8( KTestContentLocation, "CONTLOC" ); // X-Mms-Content-Location
-// The following three must appear as triplets.
-// index must be first, address and date may appear in any order
-_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
-_LIT8( KTestPreviouslySentBy, "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
-_LIT8( KTestPreviouslySentDate, "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
-//---
-_LIT8( KTestMessageId, "MESSAGE-ID" ); // Message-ID
-_LIT8( KTestMessageSize, "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
-_LIT8( KTestVersion, "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
-_LIT8( KTestReadStatus, "READ-STATUS" ); // X-Mms-Read-Status
-_LIT8( KTestResponseStatus, "RESPONSE-STATUS" ); // X-Mms-Response-Status
-_LIT8( KTestResponseText, "RESPONSE-TEXT" ); // X-Mms-Response-Text
-_LIT8( KTestRetrieveStatus, "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
-_LIT8( KTestRetrieveText, "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
-_LIT8( KTestStatus, "STATUS" ); // X-Mms-Status
-// -------------------------------------------------
-// MMS 1.2 headers
-_LIT8( KTestAttribute, "ATTRIBUTE" ); // X-Mms-Attribute
-// The value should be one of the following:
-// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
-// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
-// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
-// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
-// PREV-SENT-DATE, ADDITIONAL-HEADERS
-_LIT8( KTestDistributionIndicator, "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
-_LIT8( KTestLimit, "LIMIT" ); // X-Mms-Limit
-_LIT8( KTestMessageQuota, "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
-_LIT8( KTestSizeQuota, "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
-_LIT8( KTestMessageTotal, "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
-_LIT8( KTestSizeTotal, "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
-_LIT8( KTestMessageCount, "MESSAGE-COUNT" ); // X-Mms-Message-Count
-_LIT8( KTestAddKeyword, "ADD-KEYWORD" ); // X-Mms-MM-Flags
-_LIT8( KTestRemoveKeyword, "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
-_LIT8( KTestFilterKeyword, "FILTER-KEYWORD" ); // X-Mms-MM-FLags
-_LIT8( KTestMMState, "MESSAGE-STATE" ); // X-Mms-MM-State
-_LIT8( KTestQuota, "QUOTA" ); // X-Mms-Quotas
-_LIT8( KTestStart, "START" ); // X-Mms-Start
-_LIT8( KTestStore, "STORE" ); // X-Mms-Store
-_LIT8( KTestStored, "STORED" ); // X-Mms-Stored
-_LIT8( KTestStoreStatus, "STORE-STATUS" ); // X-Mms-Store-Status
-_LIT8( KTestStoreStatusText, "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
-_LIT8( KTestTotals, "TOTALS" ); // X-Mms-Totals
-// Delete confirmation header structure
-// This consists of index, content location, response status and response status text.
-// All three values are not always necessary for each index, but at least content-location
-// and response status should be present.
-// The index retains its value until a new index is encountered.
-_LIT8( KTestDeleteInfoIndex, "DELETESTATUSINDEX" ); // index for next delete info fields
-// This header must precede content-location, response-status and response-text fields
-// in a delete confirmation. Index retains its value until a new index is encountered.
-
-// Element descriptor header not implemented
-
-// Application id headers
-// These will officially be supported in MMS encapsulation version 1.3
-// Java has non-standard support even earlier
-
-_LIT8( KTestApplicId, "APPLIC-ID" ); // X-Mms-Applic-ID
-_LIT8( KTestReplyApplicId, "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
-_LIT8( KTestApplicInfo, "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
-
-// Since Encapsulation 1.3
-_LIT8( KTestContentClass, "CONTENT-CLASS" ); // X-Mms-Content-Class
-_LIT8( KTestDrmContent, "DRM-CONTENT" ); // X-Mms-DRM-Content
-_LIT8( KTestAdaptationAllowed, "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
-_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
-_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
-_LIT8( KTestReplaceId, "REPLACE-ID" ); // X-Mms-Replace-ID
-_LIT8( KTestStatusText, "STATUS-TEXT" ); // X-Mms-Status-Text
-_LIT8( KTestCancelId, "CANCEL-ID" ); // X-Mms-Cancel-ID
-_LIT8( KTestCancelStatus, "CANCEL-STATUS" ); // X-Mms-Cancel-Status
-
-// DATA TYPES
-#define aSet 1
-#define aReset 0
-#define PartCount 100
-#define MaxAttaCount 10
-#define DefaultBufLen 256
-#define MaxRecipients 5
-
-// status returned by ReadRow
-enum TTestReadStatus
- {
- ETestUnknown,
- ETestNewMessage,
- ETestNewAttachment,
- ETestEof, // End of file
- ETestMessageType,
- ETestDate,
- ETestFrom,
- ETestTo,
- ETestCc,
- ETestBcc,
- ETestAlias,
- ETestFromAlias,
- ETestToAlias,
- ETestCcAlias,
- ETestBccAlias,
- ETestSubject,
- ETestExpiryRel,
- ETestExpiryAbs,
- ETestDeliveryTimeRel,
- ETestDeliveryTimeAbs,
- ETestPriority,
- ETestSenderVisibility,
- ETestDeliveryReport,
- ETestReadReply,
- ETestAttachmentType,
-// ETestAttachmentName,
- ETestAttachmentCharset,
- ETestAttachmentCid,
- ETestAttachmentRoot,
- ETestSettings,
- ETestMessageClass,
- ETestDelivReportSendAllow,
- ETestSingleMessageClass,
- ETestReplyCharging,
- ETestReplyChargAbs,
- ETestReplyChargRel,
- ETestReplyChargSize,
- ETestReplyChargID,
- ETestTID,
- ETestContentLocation,
- ETestPreviouslySentIndex,
- ETestPreviouslySentBy,
- ETestPreviouslySentDate,
- ETestMessageId,
- ETestMessageSize,
- ETestVersion,
- ETestReadStatus,
- ETestResponseStatus,
- ETestResponseText,
- ETestRetrieveStatus,
- ETestRetrieveText,
- ETestStatus,
- ETestAttribute,
- ETestDistributionIndicator,
- ETestLimit,
- ETestMessageQuota,
- ETestSizeQuota,
- ETestMessageTotal,
- ETestSizeTotal,
- ETestMessageCount,
- ETestAddKeyword,
- ETestRemoveKeyword,
- ETestFilterKeyword,
- ETestMMState,
- ETestQuota,
- ETestStart,
- ETestStore,
- ETestStored,
- ETestStoreStatus,
- ETestStoreStatusText,
- ETestTotals,
- ETestDeleteInfoIndex,
- ETestApplicId,
- ETestReplyApplicId,
- ETestApplicInfo,
- ETestContentClass,
- ETestDrmContent,
- ETestAdaptationAllowed,
- ETestRecommendedRetrievalMode,
- ETestRecRetrievalModeText,
- ETestReplaceId,
- ETestStatusText,
- ETestCancelId,
- ETestCancelStatus,
- ETestAttaRecommendedName,
- ETestAttachmentContLoc,
- ETestAttContTypeParamName,
- ETestAttContTypeParamValue,
- ETestAttXTypeParamName,
- ETestAttXTypeParamValue
-
- };
-
-// VALUE KEYWORDS
-_LIT( KPersonal, "Personal" );
-_LIT( KAdvertisement, "Advertisement" );
-_LIT( KInformational, "Informational" );
-_LIT( KAuto, "Auto" );
-_LIT( KLow, "Low" );
-_LIT( KNormal, "Normal" );
-_LIT( KHigh, "High" );
-_LIT( KHide, "Hide" );
-_LIT( KShow, "Show" );
-_LIT( KYes, "Yes" );
-_LIT( KNo, "No" );
-_LIT( KOn, "On" );
-_LIT( KOff, "Off" );
-_LIT( KDeferred, "Deferred" );
-_LIT( KExpired, "Expired" );
-_LIT( KRetrieved, "Retrieved" );
-_LIT( KRejected, "Rejected" );
-_LIT( KUnrecognized, "Unrecognized" );
-_LIT( KIndeterminate, "Indeterminate" );
-_LIT( KForwarded, "Forwarded" );
-_LIT( KUnreachable, "Unreachable" );
-_LIT( KDraft, "Draft");
-_LIT( KSent, "Sent" );
-_LIT( KNew, "New" );
-// X-Mms-Message-Type
-_LIT( KSendReq, "SendReq" );
-_LIT( KSendConf, "SendConf" );
-_LIT( KNotifInd, "NotifInd" );
-_LIT( KNotifResp, "NotifResp" );
-_LIT( KRetrConf, "RetrConf" );
-_LIT( KAckInd, "AckInd" );
-_LIT( KDelInd, "DelInd" );
-_LIT( KReadReqInd, "ReadReqInd" );
-_LIT( KReadOrigInd, "ReadOrigInd" );
-_LIT( KForwardRec, "ForwardReq" );
-_LIT( KForwardConf, "ForwardConf" );
-_LIT( KMBoxStoreReq, "MBoxStoreReq" );
-_LIT( KMBoxStoreConf, "MBoxStoreConf" );
-_LIT( KMBoxViewReq, "MBoxViewReq" );
-_LIT( KMBoxViewConf, "MBoxViewConf" );
-_LIT( KMBoxUploadReq, "MBoxUploadReq" );
-_LIT( KMBoxUploadConf, "MBoxUploadConf" );
-_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
-_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
-_LIT( KMBoxDescr, "MBoxDescr" );
-_LIT( KDeleteReq, "DeleteReq" );
-_LIT( KDeleteConf, "DeleteConf" );
-_LIT( KCancelReq, "CancelReq" );
-_LIT( KCancelResp, "CancelConf" );
-// X-Mms-Read-Status
-_LIT( KRead, "Read" );
-_LIT( KDelNotRead, "DeletedNotRead" );
-// X-Mms-Reply-Charging
-_LIT( KRequested, "Requested" );
-_LIT( KReqTextOnly, "ReqTextOnly" );
-_LIT( KAccepted, "Accepted" );
-_LIT( KAccTextOnly, "AccTextOnly" );
-// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
-_LIT( KCancelSuccessful, "CancelSuccess" );
-_LIT( KCancelCorrupted, "CancelCorrupted" );
-// X-Mms-Content-Class
-_LIT( KText, "Text" );
-_LIT( KImageBasic, "ImageBasic" );
-_LIT( KImageRich, "ImageRich" );
-_LIT( KVideoBasic, "VideoBasic" );
-_LIT( KVideoRich, "VideoRich" );
-_LIT( KMegaPixel, "MegaPixel" );
-_LIT( KContentBasic, "ContentBasic" );
-_LIT( KContentRich, "ContentRich" );
-// X-Mms-Recommended-Retrieval-Mode
-_LIT( KManual, "Manual" );
-
-//X-Mms-ResponseStatus
-// legacy values
-_LIT( KOk, "OK" );
-_LIT( KErrUnspecified, "Unspecified" );
-_LIT( KErrServiceDenied, "ServiceDenied" );
-_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
-_LIT( KErrAddressUnresolved, "AddressUnresolved" );
-_LIT( KErrMessageNotFound, "MessageNotFound" );
-_LIT( KErrNetworkProblem, "NetworkProblem" );
-_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
-_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
-// values since 1.1 (and 1.2)
-_LIT( KErrTransient, "TransientFailure" );
-_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
-_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
-_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
-_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
-_LIT( KErrPermanent, "PermanentFailure" );
-_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
-_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
-_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
-_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
-_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
-_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
-_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
-_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
-_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
-_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
-_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
-//X-Mms-RetrieveStatus (one extra value)
-_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
-//X-Mms-Store-Status (one extra value)
-_LIT( KErrMMBoxFull, "MMBoxFull" );
-
-_LIT8( KTestContent, "Content" ); // For attribute list only
-_LIT8( KTestAdditionalHeaders, "ADDITIONAL-HEADERS" ); // For attribute list only
-_LIT8( KTestDeliveryTime, "DELIVERY-TIME"); // for attribute list only
-_LIT8( KTestExpiry, "EXPIRY"); // for attribute list only
-_LIT8( KTestReplyCharg, "REPLY-CHARG-DEADLINE" ); // for attribute list only
-_LIT8( KTestContentType, "CONTENT-TYPE" ); // for attribute list only
-
-/**
-* CMmsReadFile
-*/
-NONSHARABLE_CLASS( CMmsReadFile ):public CBase
- {
- public: // Constructors and destructor
-
- static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
- virtual ~CMmsReadFile(); // Destructor
-
- public: // New functions
-
- TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
- TTestReadStatus ReadRowL();
- void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
- TInt FindAlias(TPtrC alias);
- void SetAttaStructure( TBool aOldAttaStructure = EFalse );
-
- protected: // Functions from base classes
-
- private:
-
- CMmsReadFile(); // C++ default constructor.
- // By default constructor is private.
- void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
- void Reset();
-
- public: // data
- TInt iMessageType;
-
-
- private: // Data
-
- RFs iFs;
- RFileReadStream* iReader;
- TBuf<DefaultBufLen> iValueBuffer;
- CDesCArray* iAliasArray; // aliases
- HBufC8* iByteBuffer;
- TTime iDate;
- CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
- TInt iAttaCount;
- TInt iAttaRoot;
- TInt iAliasCount;
- TInt iNextMessageType;
- TParse iParse;
- TFileName iFilename;
-
- protected: // Data
- private: // Data
-
- // CArrayFixFlat <TestMessage>* iMessages;
-
- public: // Friend classes
- protected: // Friend classes
- private: // Friend classes
-
- };
-
-
-NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
- {
- public: // Constructors and destructor
- static CMmsAttaStructure* NewL(); // Two-phased constructor.
- virtual ~CMmsAttaStructure(); // Destructor
- private:
- CMmsAttaStructure(); // C++ default constructor.
- // By default constructor is private.
- void ConstructL();
-
- public: // Data
- HBufC8* iAtta;
- HBufC8* iAttaName; // content location
- HBufC8* iAttaType;
- HBufC8* iAttaCid;
- TInt iAttaCharset;
- HBufC* iAttaRecommendedName; // recommended filename
- CDesC8ArrayFlat* iContentTypeParams; // zero or more "parameter"
- CDesC8ArrayFlat* iXTypeParams; // zero or more X-Type "parameters"
-
- };
-
-
-#endif // MMSREADFILE_H
-
-// End of File
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestbed.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSTESTBED_H
-#define MMSTESTBED_H
-
-#ifdef BUILD_MMSTESTBED_DLL
-#define MMSTESTBED_EXPORT Q_DECL_EXPORT
-#else
-#define MMSTESTBED_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <QString>
-
-#include <msvids.h> //for consts like KMsvNullIndexEntryIdValue
-#include <MSVAPI.H>
-#include <MTCLREG.H>
-#include <mmsclient.h>
-//#include <mmsservercommon.h>
-
-class CTestUiTimer;
-class CMsvSession;
-class CMmsClientMtm;
-class CMmsSettings;
-class CMmsHeaders;
-class CLogEvent;
-class CLogViewEvent;
-class CLogFilter;
-class CLogClient;
-
-class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
- {
- Q_OBJECT
-
-public:
- /**
- *
- */
- MmsTestBed();
- ~MmsTestBed();
- void setConnectionLocal(bool value);
- void fromOutboxToMmsc();
- void fromMmscToInbox();
- /**
- * cleanup MMS service
- */
- void cleanupAndCreateNewService();
- void deleteNotifications();
- void restoreFactorySettings();
- void setFetchingState( TMmsReceivingMode aState );
- void sendFromFile();
- void sendOneByOne();
- void sendNotifications();
- void copyDrafts();
- void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
- void messageVariation();
- void cancelSendScheduling();
- void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
- void deleteSendSchedule();
- void cancelFetchScheduling();
- void fetchForced(TInt aDelay = 5);
- void deleteFetchSchedule();
- void doAFetchCycle();
- void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
- void cleanOutbox();
- void cleanInbox();
- void cleanSent();
- void cleanDrafts();
- void cleanAll();
- void reply();
- void replyToAll();
- void forward();
- void sendReadReport(); // send a read report
- int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
- int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
- void sendViaClient();
- void scheduledFetch(TInt aDelay = 5);
- void fetchForcedImmediate();
- void getEventType();
- void addEventType();
- void deleteEventType();
- void cleanLog();
- void setOnline(bool value);
- void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
- void sendDeliveryReport();
-
-signals:
- void entryCreatedInDraft(long int id);
- void entryMovedToOutbox(long int id);
- void entryMovedToSent(long int id);
- void entryCreatedInInbox(long int id);
-
-protected:
- /**
- * From MMsvSessionObserver
- */
- void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
- TAny* aArg2, TAny* aArg3);
-
-private:
- void findDefaultL();
- void createMmsService();
- void cleanup();
- void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
- void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
- void addMMBoxDescriptions();
- void encodeMessageFromDrafts();
- TMsvId findMMSFolder();
- bool checkLogClient();
- int getLogEntries();
-
-private:
- //data
- CTestUiTimer* iTimer;
- CMsvOperationActiveSchedulerWait* iWait;
- CMsvSession* iSession;
- CClientMtmRegistry* iClientMtmRegistry;
- CMmsClientMtm* iMmsClient;
- CMmsSettings* iSettings;
- CMmsHeaders* iMmsHeaders;
- TMsvId iServiceId;
- TMsvId iDefaultServiceId;
- TMsvSessionEvent iEvent;
- RFs iFs;
- TFileName iFilename;
- TFileName iCurrentFile;
- TFileName iCurrentPath;
- TParse iParse; // parse buffer as member to save stack space
- CBufFlat* iEncodeBuffer;
- CMsvEntrySelection* iMsvEntrySelection;
- CLogEvent* iLogEvent;
- CLogClient* iLogClient;
- CLogViewEvent* iLogView;
- CLogFilter* iLogFilter;
- };
-
-#endif // MMSTESTBED_H
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestbed.hrh Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <bldvariant.hrh>
-
-
-#ifndef MMSTESTBED_HRH
-#define MMSTESTBED_HRH
-
-enum
-{
- EAppMainOk = 1,
- EAppMainCancel,
- //
- EMenufrmCmdCascadeTest,
- ECleanup,
- ECleanOutbox,
- ESaveSettings,
- ELoadSettings,
- ECleanInbox,
- EShowIn,
- EShowOut,
- EOutToMMSC,
- EMMSCToIn,
- ESendScheduled,
- EReceiveScheduled,
- EShowSent,
- ECleanSent,
- EStartMyNotifier,
- EGetEventType,
- EAddEventType,
- EDeleteEventType,
- EViewLog,
- ECleanLog,
- EShowWapAccessPoints,
- ESelectWapAccessPoint,
- EShowConnectionMode,
- EShowIAP,
- EConnectToIAP,
- EDeleteSendSchedule,
- EDeleteReceiveSchedule,
- EDeleteNotifications,
- ERestoreFactorySettings,
- ECreateFromFile,
- EShowNotifications,
- ESendDeliveryReport,
- EShowDrafts,
- ECleanDrafts,
- ECleanAll,
- EFetchingDeferred,
- EFetchingOn,
- ESendFromFile,
- ESwitchToLocal,
- ESwitchToGlobal,
- EDecodeLoggingOn,
- EDecodeLoggingOff,
- EBinaryDumpOn,
- EBinaryDumpOff,
- ESendNotification,
- ECreateToInbox,
- ECreateToSentItems,
- ESendFromDrafts,
- EFindMMSFolder,
- ESendOneByOne,
- ECreateToDrafts,
- ESendViaClient,
- ESendMemFail,
- EFetchMemFail,
- EReceiveForced,
- ECreateHeadersFromFile,
- ESwitchToOffline,
- ESwitchToOnline,
- ECopyDrafts,
- ECreateNotification,
- EReply,
- EReplyToAll,
- EForward,
- EFetchingManual,
- EFirstBoot,
- ENoFirstBoot,
- EFindNetworkStatus,
- ESendReadReport,
- ECreateMMBoxViewConf,
- EGetMMBoxView,
- ECleanMMBox,
- EShowMMBox
-};
-
-#define ETestLabel1 1
-#define ETestLabel2 2
-#define ETestLabel3 3
-#define ETestLabel4 4
-
-#define EServiceList 2
-
-
-enum TTestBedDlgCtrlIds
- {
- ETestEditField = 1
- };
-
-enum TEditServiceControls
- {
- EFolderLabel = 1,
- EEditUri
-// EEditServiceFolder,
-// ENameLabel,
-// EEditServiceName,
-// ENumberLabel,
-// EEditServiceNumber
- };
-
-enum
- {
- EFsViewDialogId = 1
- };
-
-#endif
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmsteststaticutils.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,203 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSTESTSTATICUTILS_H
-#define MMSTESTSTATICUTILS_H
-
-#include <e32std.h>
-#include <msvstd.h>
-#include <badesca.h>
-
-#include "mmsconst.h"
-
-class RFs;
-class CMsvSession;
-class CMmsEncode;
-class CMmsHeaders;
-
-#ifdef __WINS__
-_LIT( KRootPath, "c:\\" );
-#else
-// This is removable disk.
-// drive letter should not be hard coded, must be investigated further
-// We use c: for a while for the tests (to be cahnged later)
-_LIT( KRootPath, "c:\\" );
-//_LIT( KRootPath, "e:\\" );
-#endif
-
-// directory where mmbox descriptions are created
-_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
-// directory where created headers are dumped
-_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
-// content type of MMS PDUs
-_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
-
-_LIT( KWild, "*" );
-
-
-/**
- * joined array structure
- *
- */
-NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
- {
-public:
- TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
- TInt MdcaCount() const;
- TPtrC16 MdcaPoint(TInt aIndex) const;
-private:
- CDesCArray* const & iArray1;
- CDesCArray* const & iArray2;
- };
-
-/**
- * static utility functions
- *
- */
-class TMmsTestUtils
- {
-
-public:
-
- /**
- *
- */
- TMmsTestUtils();
-
- /**
- * read phone number for sending messages
- *
- * @param aFileName full path for filename
- * @param aFs file system handle
- * @return allocated pointer containing the name
- * The caller must delete the pointer when no longer needed
- */
- static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
-
- static void DecodeLoggingOnL();
- static void DecodeLoggingOffL();
- static void BinaryDumpOnL();
- static void BinaryDumpOffL();
-
- /**
- * Clean all temporary directories used in local mode.
- * Does not delete the directories, only the contents
- *
- * @param aFs file system handle
- */
- static void CleanDirectoryL( RFs& aFs );
-
- /**
- * Dump a binary message
- *
- * @param aBuffer buffer containing the binary message
- * @param aFilename full path of the directory whenre the dump goes
- * @param aParse reference to parser (to save stack space)
- * @param aFs file system handle
- */
- static void Dump(
- CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
-
- /**
- * Delete all MMS messages and notifications from a given folder
- *
- * @param aBoxId folder id
- * @param aSession Messaging server session
- */
- static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
-
- /**
- * turn on logging messages sent to email addresses
- */
- static void EmailLoggingOnL();
-
- /**
- * turn off logging messages sent to email addresses
- */
- static void EmailLoggingOffL();
-
- /**
- * load list of children into selection and return count
- *
- * @param aBoxId folder id
- * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
- * caller is responsible of deleting the pointer afterwards.
- * Pointer may be NULL at entry, and a new pointer will be allocated
- * @param aSession messge server session
- * @param aMessageType child MTM type, default is multimedia message
- * @return number of entries in selection
- */
- static TInt CountChildrenL(
- TMsvId aBoxId,
- CMsvEntrySelection*& aMsvEntrySelection,
- CMsvSession& aSession,
- TUid aMessageType = KUidMsgTypeMultimedia);
-
- /**
- * Create a folder entry
- *
- * @param aSession messge server session
- * @param aParentFolder the parent folder
- * @param aFolderName name of the folder
- * @param aFolderId will contain the if of the new folder if creation was successful
- */
- static void CreateFolderEntryL(
- CMsvSession& aSession,
- TMsvId aParentFolder,
- const TDesC& aFolderName,
- TMsvId& aFolderId );
-
- /**
- * Create an MMS notification from data in buffer
- * @param aNotificationFolder mms notification folder (target folder)
- * @param aServiceId id of MMS service
- * @param aEncodeBuffer buffer that contains the data
- * @param aSession message server session
- * @return id of the created notification
- */
- static TMsvId CreateNotificationEntryL(
- TMsvId aNotificationFolder,
- TMsvId aServiceId,
- CBufFlat* aEncodeBuffer,
- CMsvSession& aSession );
-
- /**
- * Encode an MMS notification into buffer
- * @param aUrl url of the notification for local messages a filepath
- * @param aSize size of the message
- * @param aMmsHeaders MMS headers structure for creating the notification
- * @param aMmsEncoder reference to CMmsEncode class
- * @param aEncodeBuffer flat buffer that will contain the encoded notification
- */
- static void FormNotification(
- TDesC8& aUrl,
- TInt aSize,
- CMmsHeaders& aMmsHeaders,
- CMmsEncode& aMmsEncoder,
- CBufFlat* aEncodeBuffer );
-
-
- static TBool IsDrive(const TDesC& aFileName);
- static TBool IsDir(const TDesC& aFileName, RFs& aFs);
- static TBool IsFile(const TDesC& aFileName, RFs& aFs);
-
-
-private:
-
- };
-
-
-#endif // MMSTESTSTATICUTILS_H
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestuitimer.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef C_TESTUITIMER_H
-#define C_TESTUITIMER_H
-
-
-#include <e32base.h>
-
-#define KPeriod 10000 // period of timer
-
-/**
- * timer for test programs
- */
-NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
- {
-public:
-
- static CTestUiTimer* NewL();
- virtual ~CTestUiTimer();
-
- void RunL();
- void DoCancel();
- void ConstructL();
- void IssueRequest();
- void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
-
-private:
- CTestUiTimer();
-
-public:
- TTimeIntervalMicroSeconds32 period;
-
-private: // data
- CActive* iObject;
- };
-
-#endif // C_TESTUITIMER_H
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/mmstestbed.pro Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-QT += testlib
-QT -= gui
-
-TEMPLATE = lib
-
-TARGET = mmstestbed
-
-INCLUDEPATH += .
-INCLUDEPATH += inc
-INCLUDEPATH += ../../inc
-
-INCLUDEPATH += ../../../../../mmsengine/inc
-INCLUDEPATH += ../../../../../mmsengine/mmsserver/inc
-INCLUDEPATH += ../../../../../mmsengine/mmsmessage/inc
-INCLUDEPATH += ../../../../../mmsengine/mmscodec/inc
-INCLUDEPATH += ../../../../../inc
-INCLUDEPATH += ../../../../../mmsengine/mmsengine/inc
-INCLUDEPATH += ../../../../../../../mmsengine/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmscodec/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmshttptransport/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsmessage/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsconninit/inc
-#INCLUDEPATH += ../../../mmsengine/mmscodec/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsserver/inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_MMSTESTBED_DLL
-
-SOURCES += src/mmstestbed.cpp \
- src/mmsteststaticutils.cpp \
- src/mmsreadfile.cpp \
- src/mmstestuitimer.cpp
-
-HEADERS += inc/mmstestbed.h \
- inc/mmsteststaticutils.h \
- inc/mmsreadfile.h \
- inc/mmstestuitimer.h \
- inc/mmstestbed.hrh
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-symbian {
- TARGET.CAPABILITY = CAP_GENERAL_DLL
- TARGET.EPOCSTACKSIZE = 0x8000
- TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
- TARGET.EPOCALLOWDLLDATA = 1
- }
-
-# Build.inf rules
-BLD_INF_RULES.prj_exports += \
- "$${LITERAL_HASH}include <platform_paths.hrh>"
-
-LIBS += -lmsgs \
- -lmmsmessage \
- -lmmsconninit \
- -lmmscodec \
- -lmmsserversettings \
- -lcentralrepository \
- -lapparc \
- -lbafl \
- -lefsrv \
- -lesock \
- -lestor \
- -leuser \
- -llogcli \
- -llogwrap \
- -lapgrfx \
- -lapmime
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmsreadfile.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1799 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-// INCLUDE FILES
-#include <e32base.h>
-#include <badesca.h>
-#include <e32def.h>
-#include <s32file.h>
-#include <msvids.h>
-#include <mtmdef.h>
-//#include <eikenv.h>
-#include <apgcli.h>
-#include <CMsvMimeHeaders.h>
-#include <AknNoteWrappers.h>
-
-#include <mmsservercommon.h>
-#include "mmsconst.h"
-#include "mmsclient.h"
-#include "mmsheaders.h"
-#include "mmsreadfile.h"
-#include "mmsmmboxviewheaders.h"
-#include "mmsmmboxmessageheaders.h"
-#include "mmsmmboxflags.h"
-#include "mmssettings.h"
-
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-const TInt KMmsGranularity = 8;
-_LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
-
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// ==================== LOCAL FUNCTIONS ====================
-
-
-// ================= MEMBER FUNCTIONS =======================
-
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CMmsReadFile::CMmsReadFile()
- {
- // all member variables in a class derived from CBase
- // are automatically set to 0.
- }
-
-
-//
-void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
- {
- // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
- iFs = aFs;
- iReader = &aReadStream;
- iByteBuffer = HBufC8::NewL( DefaultBufLen );
- iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
- iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
- Reset();
- }
-
-// Two-phased constructor.
-CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
- {
- CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
- CleanupStack::PushL( self );
- self->ConstructL( aFs, aReadStream );
- CleanupStack::Pop();
- return self;
- }
-
-
-// Destructor
-CMmsReadFile::~CMmsReadFile()
- {
- Reset(); // resets and destroys all array data
- if (iAliasArray != NULL) iAliasArray->Reset();
- delete iByteBuffer;
- delete iAliasArray;
- delete iAttaStructures;
- }
-
-void CMmsReadFile::Reset()
- {
- // reset all arrays
- if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
- iAttaCount = 0;
- iAttaRoot = 0;
- }
-
-// ---------------------------------------------------------
-// CMmsReadFile()::CompleteTest
-// ---------------------------------------------------------
-//
-TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
-{
- Reset(); // new message
-
- TUint32 val;
- TUint limit = 1000000;
- TUint sizeLimit = 1000 * 1024; //max message size 1000 kB!
- TUint allLimit = 999999;
- TInt error;
- TRadix radix = EDecimal;
- TLex16 lex;
- TTestReadStatus readStatus = ETestUnknown;
- CMmsAttaStructure* oneAtta = NULL;
- TInt index;
- TTime y1970( K1970 );
- TTimeIntervalMicroSeconds interval;
- TTime date;
- TInt order = 0;
- TInt16 shortInteger = 0;
-
- //iso luuppi, joka kiertää ja lukee kunnes EOF tule vastaan
- //Big Loop, which passes around and read until the EOF
-
- iMessageType = iNextMessageType;
- while(readStatus != ETestEof)
- {
- readStatus = ReadRowL();
- if ( readStatus == ETestEof )
- {
- return(-1);
- }
- if ( readStatus == ETestUnknown )
- {
- // A line containing only comments, or an unknown tag
- // As using the scripts to test settings is no longer supported,
- // any old keywords used to test CMmsSettings class are ignored
- continue;
- }
- if( readStatus == ETestNewMessage )
- {
- iNextMessageType = readStatus;
- if(aMessageCounter++)
- {
- return(NULL);
- }
- else
- {
- iMessageType = iNextMessageType;
- continue;
- }
- }
- if ( iMessageType == ETestNewMessage)
- {
- switch(readStatus)
- {
- case ETestFrom:
- aMmsHeaders.SetSenderL( iValueBuffer );
- break;
- case ETestFromAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
- }
- break;
- case ETestTo:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
- break;
- case ETestToAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
- }
- break;
- case ETestCc:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
- break;
- case ETestCcAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
- }
- break;
- case ETestBcc:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
- break;
- case ETestBccAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
- }
- break;
- case ETestSubject:
- aMmsHeaders.SetSubjectL( iValueBuffer );
- break;
- case ETestExpiryRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetExpiryInterval( val );
- }
- break;
- case ETestExpiryAbs:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- // expiry date in seconds from 1.1.1970.
- aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
- break;
- case ETestDeliveryTimeRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetDeliveryTimeInterval( val );
- }
- break;
- case ETestDeliveryTimeAbs:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
- break;
- case ETestDate:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetDate( (interval.Int64())/1000000 );
- case ETestPriority:
- val = 0;
- if ((iValueBuffer.CompareF(KLow)) == 0)
- {
- val = EMmsPriorityLow;
- }
- else if ((iValueBuffer.CompareF(KNormal)) == 0)
- {
- val = EMmsPriorityNormal;
- }
- else if ((iValueBuffer.CompareF(KHigh)) == 0)
- {
- val = EMmsPriorityHigh;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessagePriority( val );
- break;
- case ETestSenderVisibility:
- val = 0;
- if ((iValueBuffer.CompareF(KHide)) == 0)
- {
- val = EMmsSenderVisibilityHide;
- }
- else if ((iValueBuffer.CompareF(KShow)) == 0)
- {
- val = EMmsSenderVisibilityShow;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetSenderVisibility( val );
- break;
- case ETestDeliveryReport:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDeliveryReport( val );
- break;
- case ETestDelivReportSendAllow:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReportAllowed( val );
- break;
-
- case ETestReadReply:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReadReply( val );
- break;
- case ETestNewAttachment:
- oneAtta = CMmsAttaStructure::NewL();
- iAttaStructures->AppendL(oneAtta);
- oneAtta->iAtta->Des().Copy( iValueBuffer );
- iAttaCount++;
- break;
- case ETestAttachmentType:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaType->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttachmentContLoc:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaName->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttaRecommendedName:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttachmentCharset:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- if (oneAtta != NULL)
- {
- oneAtta->iAttaCharset = val;
- }
- }
- break;
- case ETestAttachmentCid:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaCid->Des().Copy(iValueBuffer);
- }
- break;
- case ETestAttContTypeParamName:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttContTypeParamValue:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttXTypeParamName:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttXTypeParamValue:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttachmentRoot:
- iAttaRoot = iAttaCount;
- break;
- case ETestAlias:
- // all aliases are global even if they appear
- // in the middle of a message
- iAliasArray->AppendL( iValueBuffer );
- iAliasCount++;
- break;
- case ETestMessageClass: // should be handled!
- val = EMmsClassPersonal;
- if ((iValueBuffer.CompareF(KPersonal)) == 0)
- {
- val = EMmsClassPersonal;
- }
- else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
- {
- val = EMmsClassAdvertisement;
- }
- else if ((iValueBuffer.CompareF(KInformational)) == 0)
- {
- val = EMmsClassInformational;
- }
- else if ((iValueBuffer.CompareF(KAuto)) == 0)
- {
- val = EMmsClassAuto;
- }
- else
- {
- val = (TMmsMessageClass)KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessageClass( val );
- break;
- case ETestReplyCharging:
- val = 0;
- if ((iValueBuffer.CompareF(KRequested)) == 0)
- {
- val = KMmsReplyChargingRequested;
- }
- else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
- {
- val = KMmsReplyChargingRequestedTextOnly;
- }
- else if ((iValueBuffer.CompareF(KAccepted)) == 0)
- {
- val = KMmsReplyChargingAccepted;
- }
- else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
- {
- val = KMmsReplyChargingAcceptedTextOnly;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReplyCharging( val );
- break;
- case ETestReplyChargAbs:
- error = date.Set(iValueBuffer);
- if ( error == KErrNone )
- {
- interval = date.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
- }
- break;
- case ETestReplyChargRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetReplyChargingInterval( val );
- }
- break;
- case ETestReplyChargSize:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,sizeLimit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetReplyChargingSize( val );
- }
- break;
- case ETestReplyChargID:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
- break;
- case ETestTID:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetTidL( iByteBuffer->Des() );
- break;
- case ETestContentLocation:
- iByteBuffer->Des().Copy( iValueBuffer );
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
- {
- aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
- }
- else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
- }
- else
- {
- aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
- }
- break;
- case ETestPreviouslySentIndex:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- order = val;
- break;
- case ETestPreviouslySentBy:
- aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
- break;
- case ETestPreviouslySentDate:
- error = date.Set(iValueBuffer);
- if ( error == KErrNone )
- {
- interval = date.MicroSecondsFrom( y1970 );
- aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
- }
- break;
- case ETestMessageId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
- break;
- case ETestMessageSize:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,sizeLimit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetMessageSize( val );
- }
- break;
- case ETestVersion:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,EHex,limit);
- shortInteger = TInt16( val );
- if (error == KErrNone)
- {
- aMmsHeaders.SetMmsVersion( shortInteger );
- }
- break;
- case ETestReadStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KRead)) == 0)
- {
- val = KMmsReadStatusRead;
- }
- else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
- {
- val = KMmsReadStatusDeletedWithoutBeingRead;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReadStatus( val );
- break;
- case ETestResponseStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
- {
- val = KMmsErrorUnspecified;
- }
- else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
- {
- val = KMmsErrorServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
- {
- val = KMmsErrorSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
- {
- val = KMmsErrorMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
- {
- val = KMmsErrorNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
- {
- val = KMmsErrorNoContentAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
- {
- val = KMmsErrorUnsupportedMessage;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
- {
- val = KMmsErrorTransientSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
- {
- val = KMmsErrorTransientMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorPermanentMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
- {
- val = KMmsErrorPermanentSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorPermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
- {
- val = KMmsErrorPermanentContentNotAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingForwardingDenied;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingNotSupported;
- }
- else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
- {
- val = KMmsErrorTransientPartialSuccess;
- }
- else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
- {
- val = KMmsErrorPermanentAddressHidingNotSupported;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteStatusL( order, val );
- }
- else
- {
- aMmsHeaders.SetResponseStatus( val );
- }
- break;
- case ETestResponseText:
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
- }
- else
- {
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- }
- break;
- case ETestRetrieveStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
- {
- val = KMmsErrorReceiveTransientMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorReceiveTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorReceivePermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
- {
- val = KMmsErrorReceivePermanentContentUnsupported;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetResponseStatus( val );
- break;
- case ETestRetrieveText:
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- break;
- case ETestStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KDeferred)) == 0)
- {
- val = KMmsMessageStatusDeferred;
- }
- else if ((iValueBuffer.CompareF(KExpired)) == 0)
- {
- val = KMmsMessageStatusExpired;
- }
- else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
- {
- val = KMmsMessageStatusRetrieved;
- }
- else if ((iValueBuffer.CompareF(KRejected)) == 0)
- {
- val = KMmsMessageStatusRejected;
- }
- else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
- {
- val = KMmsMessageStatusUnrecognized;
- }
- else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
- {
- val = KMmsMessageStatusIndeterminate;
- }
- else if ((iValueBuffer.CompareF(KForwarded)) == 0)
- {
- val = KMmsMessageStatusForwarded;
- }
- else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
- {
- val = KMmsMessageStatusUnreachable;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetStatus( val );
- break;
- case ETestMessageType:
- val = 0;
- if ((iValueBuffer.CompareF(KSendReq)) == 0)
- {
- val = KMmsMessageTypeMSendReq;
- }
- else if ((iValueBuffer.CompareF(KSendConf)) == 0)
- {
- val = KMmsMessageTypeMSendConf;
- }
- else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
- {
- val = KMmsMessageTypeMNotificationInd;
- }
- else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
- {
- val = KMmsMessageTypeMNotifyRespInd;
- }
- else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
- {
- val = KMmsMessageTypeMRetrieveConf;
- }
- else if ((iValueBuffer.CompareF(KAckInd)) == 0)
- {
- val = KMmsMessageTypeAcknowledgeInd;
- }
- else if ((iValueBuffer.CompareF(KDelInd)) == 0)
- {
- val = KMmsMessageTypeDeliveryInd;
- }
- else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
- {
- val = KMmsMessageTypeReadRecInd;
- }
- else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
- {
- val = KMmsMessageTypeReadOrigInd;
- }
- else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
- {
- val = KMmsMessageTypeForwardReq;
- }
- else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
- {
- val = KMmsMessageTypeForwardConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
- {
- val = KMmsMessageTypeMboxStoreReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
- {
- val = KMmsMessageTypeMboxStoreConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
- {
- val = KMmsMessageTypeMboxViewReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
- {
- val = KMmsMessageTypeMboxViewConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
- {
- val = KMmsMessageTypeMBoxUploadReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
- {
- val = KMmsMessageTypeMBoxUploadConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
- {
- val = KMmsMessageTypeMBoxDeleteReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
- {
- val = KMmsMessageTypeMBoxDeleteConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
- {
- val = KMmsMessageTypeMBoxDescr;
- }
- else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
- {
- val = KMmsMessageTypeDeleteReq;
- }
- else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
- {
- val = KMmsMessageTypeDeleteConf;
- }
- else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
- {
- val = KMmsMessageTypeCancelReq;
- }
- else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
- {
- val = KMmsMessageTypeCancelConf;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessageType( val );
- break;
- case ETestAttribute:
- val = 0;
- iByteBuffer->Des().Copy( iValueBuffer );
- if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
- {
- val = KMmsAssignedBcc;
- }
- else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
- {
- val = KMmsAssignedCc;
- }
- else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
- {
- val = KMmsAssignedContent;
- }
- else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
- {
- val = KMmsAssignedContentType;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
- {
- val = KMmsAssignedDate;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
- {
- val = KMmsAssignedDeliveryReport;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
- {
- val = KMmsAssignedDeliveryTime;
- }
- else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
- {
- val = KMmsAssignedExpiry;
- }
- else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
- {
- val = KMmsAssignedFrom;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
- {
- val = KMmsAssignedMessageClass;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
- {
- val = KMmsAssignedMessageId;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
- {
- val = KMmsAssignedMessageSize;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
- {
- val = KMmsAssignedPriority;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
- {
- val = KMmsAssignedReadReply;
- }
- else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
- {
- val = KMmsAssignedSubject;
- }
- else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
- {
- val = KMmsAssignedTo;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
- {
- val = KMmsAssignedReplyCharging;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
- {
- val = KMmsAssignedReplyChargingID;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
- {
- val = KMmsAssignedReplyChargingDeadline;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
- {
- val = KMmsAssignedReplyChargingSize;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
- {
- val = KMmsAssignedPreviouslySentBy;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
- {
- val = KMmsAssignedPreviouslySentDate;
- }
- else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
- {
- val = KMmsAssignedAdditionalHeaders;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
- break;
- case ETestDistributionIndicator:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDistributionIndicator( val );
- break;
- case ETestLimit:
- aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if( error == KErrNone )
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
- }
- break;
- case ETestMessageQuota:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
- }
- break;
- case ETestSizeQuota:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
- }
- break;
- case ETestMessageTotal:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
- }
- break;
- case ETestSizeTotal:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
- }
- break;
- case ETestMessageCount:
- aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
- }
- break;
- case ETestAddKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
- break;
- case ETestRemoveKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
- break;
- case ETestFilterKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
- break;
- case ETestMMState:
- val = 0;
- if ((iValueBuffer.CompareF(KDraft)) == 0)
- {
- val = KMmsDraft;
- }
- else if ((iValueBuffer.CompareF(KSent)) == 0)
- {
- val = KMmsSent;
- }
- else if ((iValueBuffer.CompareF(KNew)) == 0)
- {
- val = KMmsNew;
- }
- else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
- {
- val = KMmsRetrieved;
- }
- else if ((iValueBuffer.CompareF(KForwarded)) == 0)
- {
- val = KMmsForwarded;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
- {
- aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
- }
- else
- {
- aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
- }
- break;
- case ETestQuota:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
- break;
- case ETestStart:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
- }
- break;
- case ETestStore:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
- break;
- case ETestStored:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
- break;
- case ETestStoreStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorStoreStatusTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorPermanentMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorStoreStatusPermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
- {
- val = KMmsErrorStoreStatusPermanentMmboxFull;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
- break;
- case ETestStoreStatusText:
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
- break;
- case ETestTotals:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
- break;
-
- case ETestDeleteInfoIndex:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- order = val;
- break;
-
- case ETestApplicId:
- aMmsHeaders.SetApplicIdL( iValueBuffer );
- break;
- case ETestReplyApplicId:
- aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
- break;
- case ETestApplicInfo:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
- break;
- case ETestContentClass:
- val = 0;
- if ((iValueBuffer.CompareF(KText)) == 0)
- {
- val = KMmsContentClassText;
- }
- else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
- {
- val = KMmsContentClassImageBasic;
- }
- else if ((iValueBuffer.CompareF(KImageRich)) == 0)
- {
- val = KMmsContentClassImageRich;
- }
- else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
- {
- val = KMmsContentClassVideoBasic;
- }
- else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
- {
- val = KMmsContentClassVideoRich;
- }
- else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
- {
- val = KMmsContentClassMegaPixel;
- }
- else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
- {
- val = KMmsContentClassContentBasic;
- }
- else if ((iValueBuffer.CompareF(KContentRich)) == 0)
- {
- val = KMmsContentClassContentRich;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetContentClass( val );
- break;
- case ETestDrmContent:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDrmContent( val );
- break;
- case ETestAdaptationAllowed:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetAdaptationAllowed( val );
- break;
- case ETestRecommendedRetrievalMode:
- val = 0;
- if ((iValueBuffer.CompareF(KManual)) == 0)
- {
- val = KMmsRecommendedRetrievalModeManual;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetRecommendedRetrievalMode( val );
- break;
- case ETestRecRetrievalModeText:
- aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
- break;
- case ETestReplaceId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
- break;
- case ETestStatusText:
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- break;
- case ETestCancelId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
- break;
- case ETestCancelStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
- {
- val = KMmsCancelRequestSuccessfullyReceived;
- }
- else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
- {
- val = KMmsCancelRequestCorrupted;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetCancelStatus( val );
- break;
- default:
- break;
- }
- }
- else
- {
- switch(readStatus)
- {
- case ETestAlias:
- iAliasArray->AppendL( iValueBuffer );
- iAliasCount++;
- break;
-
- default:
- break;
- }
-
- }
- }
- return(-1);
-}
-
-// ---------------------------------------------------------
-// CMmsReadFile()::ReadRowL
-// ---------------------------------------------------------
-//
-TTestReadStatus CMmsReadFile::ReadRowL()
- {
-
- TBuf8<DefaultBufLen> RowBuffer;
- TBuf8<32> KeyBuffer;
-
- // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
- TChar delim( 10 );
- iReader->ReadL( RowBuffer, delim);
- TInt length = RowBuffer.Length();
- if ( RowBuffer.Length() < 2 )
- {
- return ETestEof;
- }
- RowBuffer.Delete(length - 2,2);
-
- // DROP POSSIBLE COMMENT OUT
- TInt pos = RowBuffer.Locate( ';' );
- if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
-
- if ( RowBuffer.Length() == 0 )
- {
- // the line contained only comment
- return ETestUnknown;
- }
-
- // First split the row (:)
- pos = RowBuffer.Locate( ':' );
- if (pos > 0)
- {
- TPtrC8 p = RowBuffer.Mid( pos+1 );
- length = p.Length();
- iValueBuffer.Zero();
- for (TInt i=0; i < length; ++i)
- {
- iValueBuffer.Append(p[i]);
- }
- iValueBuffer.Trim();
- TPtrC8 pp = RowBuffer.Left(pos);
- KeyBuffer.CopyUC(pp);
- KeyBuffer.Trim();
- }
- // TRY TO FIND CORRECT TAG
- if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
- if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
- if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
- if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
- if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
- if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
- if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
- if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
- if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
- if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
- if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
- if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
- if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
- if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
- if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
- if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
- if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
- if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
- if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
- if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
- if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
- if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
- if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
- if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
- if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
- if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
- if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
- if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
- if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
- if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
- if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
- if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
- if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
- if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
- if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
- if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
- if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
- if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
- if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
- if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
- if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
- if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
- if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
- if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
- if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
- if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
- if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
- if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
- if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
- if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
- if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
- if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
- if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
- if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
- if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
- if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
- if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
- if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
- if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
- if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
- if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
- if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
- if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
- if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
- if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
- if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
- if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
- if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
- if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
- if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
- if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
- if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
- if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
- if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
- if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
- if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
- if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
- if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
- if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
- if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
- if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
- if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
- if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
- if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
- if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
- if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
- return ETestUnknown;
- }
-
-// ---------------------------------------------------------
-// CMmsReadFile()::CreateMessageL
-// program build a message from given parts
-// ---------------------------------------------------------
-//
-void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
- {
-
- // Reset inactivity timer to keem viewServer from crashing
- User::ResetInactivityTime();
-
- TInt i;
- TInt error = KErrNone;
- RFile attaFile;
- _LIT8(KLeftAngle, "<");
- _LIT8(KRightAngle, ">");
- // we can't use "seconds from" as it only returns a
- // 32 bit signed integer. If fails in 2038.
- // "microseconds from" returns a 64 bit signed integer
-
- CMsvStore* store = aMmsClient->Entry().EditStoreL();
- CleanupStack::PushL(store);
- aMmsHeaders->StoreL(*store);
- store->CommitL();
- CleanupStack::PopAndDestroy( store );
- store = NULL;
-
- aMmsClient->LoadMessageL(); // read store is needed to do this
-
- store = aMmsClient->Entry().EditStoreL();
- CleanupStack::PushL(store);
- CMsvAttachment* attaInfo = NULL;
- TMsvAttachmentId attaId = 0;
-
- for ( i=0; i < iAttaStructures->Count(); ++i)
- {
- attaId = KMsvNullIndexEntryId;
- iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
-
- error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
- User::LeaveIfError( error );
-
- CleanupClosePushL(attaFile);
-
- CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
- CleanupStack::PushL( mimeHeaders );
- TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
-
- TDataRecognitionResult result;
- result.Reset(); // make sure that it is cleared
-
- if(iAttaStructures->At(i)->iAttaCid->Length())
- {
- TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
- if (attaCID.Find(KLeftAngle) == 0 &&
- attaCID.Find(KRightAngle) == attaCID.Length()-1 )
- {
- // remove angle brackets from cid
- attaCID = attaCID.Mid(1,attaCID.Length()-2);
- }
- mimeHeaders->SetContentIdL(attaCID);
- }
-
- if (iAttaStructures->At(i)->iAttaCharset)
- {
- mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
- }
-
- if (iAttaStructures->At(i)->iAttaName->Length())
- {
- iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
- }
- iParse.Set( iFilename, NULL, NULL );
- iFilename.Copy( iParse.NameAndExt() );
-
- mimeHeaders->SetContentLocationL( iFilename );
-
- // if Mime type has not been set, use RapaRecognizer
- if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
- {
- // TO BE IMPLEMENTED
-
- RApaLsSession lsSession;
-
- if ( lsSession.Connect() == KErrNone )
- {
- CleanupClosePushL( lsSession );
-
- iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
- if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
- {
- // Check confidence level. Recognization must be at least
- // "EProbable". We don't accept the result if it is "EPossible"
- // or "EUnlikely" or "ENotRecognized"!
-
- if ( result.iConfidence < CApaDataRecognizerType::EProbable )
- {
- result.Reset(); // clear buffer and try again with longer buffer
- }
-
- TPtrC8 mimeBuf8 = result.iDataType.Des8();
-
- if ( mimeBuf8.Length() == 0 )
- {
- // Open file buffer and try again..
-
- TInt bufSize = 0;
- (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
- if ( bufSize <= 0 )
- {
- bufSize = 30;
- }
- HBufC8* buf = HBufC8::NewLC( bufSize );
- TPtr8 des = buf->Des();
-
- RFile file;
- TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
- if ( err == KErrNone )
- {
- err = file.Read( des );
- file.Close();
- if ( err == KErrNone )
- {
- if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
- {
- mimeBuf8.Set( result.iDataType.Des8() );
- }
- }
-
- }
- CleanupStack::PopAndDestroy(); // buf
- }
- if ( mimeBuf8.Length() > 0 &&
- result.iConfidence >= CApaDataRecognizerType::EProbable )
- {
- contentType.Set( result.iDataType.Des8() );
- }
- }
- CleanupStack::PopAndDestroy(1); // lssession
- }
- }
-
- if ( contentType.Length() > 0 )
- {
- TInt position = contentType.Find( KMmsSlash8 );
- if ( position >= 0 )
- {
- mimeHeaders->SetContentTypeL( contentType.Left( position ) );
- }
- if ( position < contentType.Length() - 1 )
- {
- mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
- }
-// CreateAttachment2L sets the content type to attaInfo
-// attaInfo->SetMimeTypeL( contentType );
- }
-
- if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
- {
- iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
- iParse.Set( iFilename, NULL, NULL );
- iFilename.Copy( iParse.NameAndExt() );
- mimeHeaders->SetSuggestedFilenameL( iFilename );
- }
-
- TInt j = 0;
- for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
- {
- mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
- }
- for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
- {
- mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
- }
-
- attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
- // attaInfo does not go onto cleaunpstack because ownership will
- // be transferred to attachment manager.
-
- aMmsClient->CreateAttachment2L(
- *store,
- attaFile,
- contentType,
- *mimeHeaders,
- attaInfo,
- attaId);
- attaInfo = NULL; // ownership transferred
-
- CleanupStack::PopAndDestroy(); // mimeHeaders
- CleanupStack::PopAndDestroy(); // attaFile.Close()
-
- if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
- {
- aMmsClient->SetMessageRootL( attaId );
- }
- }
-
- store->CommitL();
- CleanupStack::PopAndDestroy(); // store
-
- // This frees all memory and resets all values
- Reset();
- // Reset inactivity timer to keem viewServer from crashing
- User::ResetInactivityTime();
- }
-
-
-// ---------------------------------------------------------
-// CMmsReadFile()::FindAlias
-// program build a message from given parts
-// ---------------------------------------------------------
-//
-TInt CMmsReadFile::FindAlias( TPtrC aAlias )
- {
- TBuf<DefaultBufLen> abuf;
- for( TInt i=0; i < iAliasCount; ++i )
- {
- abuf.Copy( iAliasArray->MdcaPoint(i) );
- abuf.SetLength( abuf.Locate('=') );
- if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
- }
- return( -1 );
- }
-
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CMmsAttaStructure::CMmsAttaStructure()
- {
- iAtta = NULL;
- iAttaType = NULL;
- iAttaName = NULL;
- iAttaCid = NULL;
- iAttaRecommendedName = NULL;
- }
-
-
-//
-void CMmsAttaStructure::ConstructL()
- {
- iAtta = HBufC8::NewL(DefaultBufLen);
- iAttaType = HBufC8::NewL(DefaultBufLen);
- iAttaName = HBufC8::NewL(DefaultBufLen);
- iAttaCid = HBufC8::NewL(DefaultBufLen);
- iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
- iAttaCharset = 0;
- iXTypeParams = new(ELeave) CDesC8ArrayFlat(4);
- iContentTypeParams = new(ELeave) CDesC8ArrayFlat(4);
-
- }
-
-// Two-phased constructor.
-CMmsAttaStructure* CMmsAttaStructure::NewL()
- {
- CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// Destructor
-CMmsAttaStructure::~CMmsAttaStructure()
- {
- delete iAtta;
- delete iAttaName;
- delete iAttaType;
- delete iAttaCid;
- delete iAttaRecommendedName;
- if ( iContentTypeParams )
- {
- iContentTypeParams->Reset();
- }
- delete iContentTypeParams;
- if ( iXTypeParams )
- {
- iXTypeParams->Reset();
- }
- delete iXTypeParams;
- }
-
-
-// End of File
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmstestbed.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2357 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <mtmdef.h>
-#include <CoreApplicationUIsSDKCRKeys.h>
-#include <mmsheaders.h>
-#include <mmscmds.h>
-#include <mmsencode.h>
-#include <mmscliententry.h>
-#include <logwrap.h>
-#include <logcli.h>
-#include <logview.h>
-#include "mmssettings.h" //use mmssettings.h instead of cmmssettings.h
-#include "mmstestbed.h"
-#include "mmsreadfile.h"
-#include "mmstestuitimer.h"
-#include "mmsteststaticutils.h"
-#include "mmstestbed.hrh"
-
-//constants
-_LIT( KMmsSender, "0601234567" );
-
-MmsTestBed::MmsTestBed()
- {
- //start the timer
- iTimer = CTestUiTimer::NewL();
- iTimer->Cancel();
-
- iWait = CMsvOperationActiveSchedulerWait::NewLC();
- // don't leave iWait on cleanup stack
- CleanupStack::Pop();
-
- //open msvsession
- iSession = CMsvSession::OpenSyncL(*this);
- //create client registry
- iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
- //create client mtm
- iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
- KUidMsgTypeMultimedia);
-
- User::LeaveIfError( iFs.Connect() );
- iFs.SetSessionPath( KRootPath );
- iSettings = CMmsSettings::NewL();
- iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
- findDefaultL();
- iServiceId = iDefaultServiceId;
-
- //validate the settings
- iSettings->ValidateSettings();
-
- iLogEvent = CLogEvent::NewL();
- iLogEvent->SetEventType(KLogMmsEventTypeUid);
- iLogClient = NULL; // we test soon if this is available
- iLogView = NULL; // needs log client
- if ( checkLogClient() )
- {
- // first we generate a general view of all events
- // we'll set the filter when we update the view
- iLogView = CLogViewEvent::NewL( *iLogClient );
- }
- iLogFilter = CLogFilter::NewL();
- // we try to filter MMS events
- iLogFilter->SetEventType(KLogMmsEventTypeUid);
- }
-
-MmsTestBed::~MmsTestBed()
- {
- delete iLogView;
- delete iLogFilter;
- delete iLogClient;
- delete iLogEvent;
- delete iSettings;
- delete iMmsHeaders;
- if(iTimer)
- {
- iTimer->Cancel();
- delete iTimer;
- }
- //delete iMsvEntrySelection;
- delete iMmsClient;
- delete iClientMtmRegistry;
- //delete iClientMtmRegistry;
- delete iSession;
- delete iWait;
- }
-
-void MmsTestBed::setConnectionLocal(bool value)
- {
- //value = true for global off, local on
- //value = false for global on, local off
- iSettings->LoadSettingsL();
- iSettings->SetLocalMode( value );
- iSettings->SaveSettingsL();
- }
-
-void MmsTestBed::fromOutboxToMmsc()
- {
- CMsvEntry* cEntry = NULL;
-
- // Get List of services
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
- KUidMsgTypeMultimedia);
- CleanupStack::PushL(selection);
-
- // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
- for (TInt i = 0; i < selection->Count(); ++i)
- {
- cEntry->SetEntryL(selection->At(i));
- TMsvEntry entry = cEntry->Entry();
- entry.SetReadOnly(EFalse);
- entry.SetSendingState(KMsvSendStateUnknown);
- cEntry->ChangeL(entry);
- }
-
- selection->InsertL(0, iServiceId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack(parameters);
-
- op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending)
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if (iWait->iStatus.Int() != KErrNone)
- {
- //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- CleanupStack::PopAndDestroy(); //cEntry
- }
-
-void MmsTestBed::fromMmscToInbox()
- {
- CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
- CleanupStack::PushL(msvEntrySelection);
-
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- msvEntrySelection->InsertL(0, iServiceId);
- }
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack(parameters);
-
- op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
- paramPack, iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending)
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if (iWait->iStatus.Int() != KErrNone)
- {
- //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); //msvEntrySelection
- }
-
-void MmsTestBed::findDefaultL()
- {
- iSettings->LoadSettingsL();
- iDefaultServiceId = iSettings->Service();
- }
-
-void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
- TAny* aArg2, TAny* /*aArg3*/)
- {
- iEvent = aEvent;
- if (aEvent == EMsvGeneralError)
- {
- return;
- }
- TMsvId parentId = KMsvNullIndexEntryId;
- if (aArg2 != NULL)
- {
- parentId = *(TMsvId*) aArg2;
- }
-
- CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
- TMsvEntry tEntry;
- TMsvId service;
- TInt error = KErrNone;
- error = iSession->GetEntry(selection->At(0), service, tEntry);
-
- CMsvEntry* cEntry = NULL;
- switch (aEvent)
- {
- case EMsvEntriesCreated:
- {
- if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
- {
- // emit signal for new entry into INBOX
- emit entryCreatedInInbox(tEntry.Id());
- }
- else if (parentId == KMsvDraftEntryIdValue)
- {
- // emit signal for new entry into Draft
- emit entryCreatedInDraft(tEntry.Id());
- }
- else if (parentId == iServiceId)
- {
- // emit signal for new Entry into SERVICE
- }
- else
- {
- // do nothing
- }
- }
- break;
- case EMsvEntriesChanged:
- {
- TMsvId id;
- CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
- if (selection == NULL)
- {
- // no selection, cannot handle
- return;
- }
- id = selection->At(0);
- //DEBUG Entry changed"));
- if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
- {
-/*
- cEntry = iSession->GetEntryL( parentId );
- CleanupStack::PushL( cEntry );
- TRAPD (error, cEntry->SetEntryL( id ));
- if ( error != KErrNone )
- {
- CleanupStack::PopAndDestroy(); // cEntry
- return;
- }
- TMsvEntry tEntry = cEntry->Entry();
- if ( tEntry.Visible() )
- {
- // generate fake delivery report
- CMsvStore* store = cEntry->ReadStoreL();
- CleanupStack::PushL( store );
- CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
- CleanupStack::PushL( mmsHeaders );
- mmsHeaders->RestoreL( *store );
- iEncodeBuffer->ResizeL( 0 );
- generateDeliveryReport( mmsHeaders );
- CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
- }
- CleanupStack::PopAndDestroy(); // cEntry
-*/
- }
- }
- break;
- case EMsvEntriesDeleted:
- {
- //emit signal for entry deleted
- }
- break;
- case EMsvEntriesMoved:
- {
- if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
- {
- // entry moved to outbox
- emit entryMovedToOutbox(tEntry.Id());
- }
- else if (parentId == KMsvSentEntryIdValue)
- {
- // entry moved to sent folder
- emit entryMovedToSent(tEntry.Id());
- }
- else
- {
- // do nothing
- }
- }
- break;
- default:
- break;
- }
- }
-
-void MmsTestBed::createMmsService()
- {
- CMmsSettings * settings = CMmsSettings::NewL();
- CleanupStack::PushL( settings );
- settings->CreateNewServiceL( *iSession );
- CleanupStack::PopAndDestroy(); // settings
- return;
- }
-
-void MmsTestBed::cleanup()
- {
- TMsvId entryToBeKilled;
- // Get access to root index
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
-
- entryToBeKilled = iSettings->Service();
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- while (entryToBeKilled != KMsvNullIndexEntryId)
- {
- // delete child of root entry
- deleteEntry(entryToBeKilled, *cEntry);
- entryToBeKilled = iSettings->Service();
- }
-
- CleanupStack::PopAndDestroy(); // cEntry
- // We deleted everything!
- iDefaultServiceId = KMsvNullIndexEntryId;
- iServiceId = KMsvNullIndexEntryId;
- }
-
-void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
- {
- aClientEntry.DeleteL(aEntryId);
- }
-
-void MmsTestBed::cleanupAndCreateNewService()
- {
- cleanup();
- // all old service entries have been destroyed, create a new one
- createMmsService();
- }
-
-void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
- {
- // update settings in mmsclient
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
-
- RFileReadStream readStream;
- readStream.PushL();
-// TMsvId id = KMsvNullIndexEntryId;
- CBufFlat* encodeBuffer = NULL;
- CMmsEncode* encoder = NULL;
-
- // Open the file
- TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
- if (err != KErrNone) User::Leave( err );
-
- TInt retCode = 0;
- CMmsReadFile* readFile = NULL;
- readFile = CMmsReadFile::NewL( iFs, readStream );
- CleanupStack::PushL( readFile );
-
- TInt messageCounter = 0;
- CMsvEntry* cEntry = NULL;
-
- while(!retCode)
- {
- // READ MESSAGE TO BUFFERS
- iMmsHeaders->Reset(iSettings);
- // put in some message type just for fun (testing...)
- iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
- retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
- if(readFile->iMessageType == ETestNewMessage)
- {
- // CREATE MESSAGE ENTRY
- switch ( aCommand )
- {
- case ECreateToInbox:
- case ECreateNotification:
- cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- break;
- case ECreateToSentItems:
- cEntry = iSession->GetEntryL(KMsvSentEntryId);
- break;
- case ECreateToDrafts:
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- break;
- case ECreateHeadersFromFile:
- // here we just encode headers, no message entry
- // the entry is fake.
- break;
- case ECreateMMBoxViewConf:
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- // entry is not created for the description items
- // they become attachments
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- }
- break;
- default:
- cEntry = iSession->GetEntryL(aBox);
- break;
- }
-
- // if we are just playing with headers we have no entry
- if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
- {
- CleanupStack::PushL(cEntry);
- iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
-
- // CREATE MESSAGE
- iMmsClient->CreateMessageL(iServiceId);
- }
- else if ( aCommand == ECreateMMBoxViewConf )
- {
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- CleanupStack::PushL(cEntry);
- iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
-
- // CREATE MESSAGE
- iMmsClient->CreateMessageL(iServiceId);
- }
- else
- {
- encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
- CleanupStack::PushL( encodeBuffer );
- encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
-
- // encode headers to a binary file
- encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
-
- iFilename = KMmsMMBoxDescriptionDirectory;
- TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
-
- CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
- encodeBuffer = NULL;
- encoder = NULL;
- }
- }
- else
- {
- encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
- CleanupStack::PushL( encodeBuffer );
- encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
-
- // encode headers to a binary file
- encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
-
- iFilename = KMmsDumpDirectory;
- TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
-
- CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
- encodeBuffer = NULL;
- encoder = NULL;
- }
- }
-
- if ( aCommand != ECreateHeadersFromFile &&
- ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
- {
- if(readFile->iMessageType == ETestSettings)
- {
- TMsvId ServiceId = iMmsClient->DefaultServiceL();
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
- }
-
- TMemoryInfoV1Buf memory;
- UserHal::MemoryInfo( memory );
- TInt available = memory().iFreeRamInBytes;
-// TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
-
- TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
-
- available = memory().iFreeRamInBytes;
-// TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
-
- if(readFile->iMessageType == ETestNewMessage)
- {
- TMsvEntry tEntry = iMmsClient->Entry().Entry();
- TMsvId id = tEntry.Id();
- if ( err == KErrNone )
- {
- // SAVE MESSAGE
- iMmsClient->SaveMessageL();
-
- // If we are creating a MMBox View confirmation,
- // we add all binary files from KMmsMMBoxDirectory
- // as attachments.
-
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- addMMBoxDescriptions();
- }
-
- // reload the entry in case mms client put something into it
- // MESSAGE MUST BE SET VISIBLE
- tEntry = iMmsClient->Entry().Entry();
- if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
- {
- tEntry.iMtmData1 |= KMmsMessageAdvertisement;
- }
- else if ( iMmsClient->MessageClass() == EMmsClassInformational )
- {
- tEntry.iMtmData1 |= KMmsMessageInformational;
- }
- tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
-
- // Test: Set all as editor oriented - except notifications!
- if ( aCommand == ECreateNotification )
- {
- tEntry.iMtm = KUidMsgMMSNotification;
- }
- else
- {
- tEntry.iMtmData1 |= KMmsMessageEditorOriented;
- }
- if ( aCommand == ECreateToInbox )
- {
- tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
- tEntry.SetReadOnly( ETrue );
- tEntry.SetNew( ETrue );
- tEntry.SetUnread( ETrue );
- }
- else if ( aCommand == ECreateToSentItems )
- {
- tEntry.SetReadOnly( ETrue );
- }
- tEntry.SetVisible( ETrue );
- tEntry.SetInPreparation( EFalse );
- TTime now;
- now.UniversalTime();
- tEntry.iDate = now;
- TMsvId entryId = tEntry.Id();
- iMmsClient->Entry().ChangeL( tEntry );
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- // Encode to the directory that is used to fetch MMBox view
- iFilename.Copy( KMmsMMBoxDirectory );
- encodeMessageFromDrafts();
- cEntry->SetEntryL( KMsvDraftEntryId );
- cEntry->DeleteL( entryId );
- }
- }
- else
- {
- //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
- iSession->RemoveEntry(id);
- err = KErrNone; // clear error
- }
- CleanupStack::PopAndDestroy(); // cEntry
- cEntry = NULL;
- }
- if(readFile->iMessageType == ETestSettings)
- {
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
- }
- }
-
- CleanupStack::PopAndDestroy(); //readFile
-
- readStream.Close();
- readStream.Pop();
-
- /*
- iMmsClient->SwitchCurrentEntryL(id);
- */
- }
-
-void MmsTestBed::addMMBoxDescriptions()
- {
- // add the contents of KMmsMMBoxDescriptionDirectory as attachments
- CDir* fileList = NULL;
- TInt i = 0; // general counter
- TInt error = KErrNone;
- iCurrentPath = KMmsMMBoxDescriptionDirectory;
-
- iFs.SetSessionPath(iCurrentPath);
-
- TFindFile finder( iFs );
- error = finder.FindWildByPath( KWild, NULL, fileList );
- CleanupStack::PushL( fileList );
- TInt fileCounter = 0;
-
- if ( error == KErrNone )
- {
- fileCounter = fileList->Count();
- }
-
- TEntry entry;
-
- if ( error == KErrNone )
- {
- for ( i = 0; i < fileCounter; ++i )
- {
- // Reset inactivity timer to keep viewServer from crashing
- User::ResetInactivityTime();
- entry = (*fileList)[i]; // name is entry.iName
- iFilename.Copy( iCurrentPath );
- iFilename.Append( entry.iName );
- TPtrC ptr;
- ptr.Set( iFilename );
- iWait->iStatus = KErrNone;
- iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
-
- iWait->Start();
- // The descriptions are cleared after being used
- iFs.Delete( ptr);
- }
- }
-
- iMmsClient->SaveMessageL(); // just in case somthing must be updated
- CleanupStack::PopAndDestroy(); // fileList
- fileList = NULL;
- }
-
-void MmsTestBed::encodeMessageFromDrafts()
- {
- CMmsEncode* encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
- // encode a message iMmsClientPoints to
- iMmsClient->LoadMessageL();
- CMsvStore* store = iMmsClient->Entry().ReadStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->RestoreL( *store );
- CleanupStack::PopAndDestroy(); // store
- store = NULL;
- iWait->iStatus = KErrNone;
-
-// caller sets the directory
-// iFilename = KMmsMessageDumpDirectory;
-
- CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
- CleanupStack::PushL( entryWrapper );
- iEncodeBuffer->ResizeL(0);
- encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
- iWait->Start();
- if ( iWait->iStatus == KErrNone )
- {
- TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
- }
- iEncodeBuffer->ResizeL(0);
- CleanupStack::PopAndDestroy(); // entryWrapper
- CleanupStack::PopAndDestroy(); // encoder
- }
-
-void MmsTestBed::deleteNotifications()
- {
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
-
- CMsvEntry* cEntry = NULL;
- // delete all messages from the specified box
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
-
- if ( mmsFolderId != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL(mmsFolderId);
-
- // show invisible entries
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL(msvEntrySelection);
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- if (msvEntrySelection->Count() > 0)
- {
- CMsvOperation* op = iSession->TransferCommandL(
- *msvEntrySelection,
- EMmsDeleteEntries,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- CleanupStack::PopAndDestroy(); // op
- }
-
- // These cannot be deleted unless we have the a server mtm
- // corresponding to this mtm type.
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CleanupStack::PopAndDestroy(); //msvEntrySelection
- msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
- CleanupStack::PushL(msvEntrySelection);
-
- if (msvEntrySelection->Count() > 0)
- {
- CMsvOperation* op = iSession->TransferCommandL(
- *msvEntrySelection,
- EMmsDeleteEntries,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- CleanupStack::PopAndDestroy(); // op
- }
-
- CleanupStack::PopAndDestroy(); //msvEntrySelection
-
- CleanupStack::PopAndDestroy(); //cEntry
- }
- }
-
-TMsvId MmsTestBed::findMMSFolder()
- {
- return iSettings->NotificationFolder();
- }
-
-void MmsTestBed::restoreFactorySettings()
- {
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
- // do not reset access point
- TInt accessPoint = iSettings->AccessPoint( 0 );
- iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
- TInt count = iSettings->AccessPointCount();
- TInt i = 0;
- for ( i = count - 1; i >= 0; --i )
- {
- iSettings->DeleteAccessPointL( i );
- }
- // restore the original access point
- if ( accessPoint > 0 )
- {
- // a negative access point is an error (most likely "KErrNotFound")
- iSettings->AddAccessPointL( accessPoint, 0 );
- }
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
-
-void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
- {
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
-
- iSettings->SetReceivingModeHome( aState );
-
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
-
-void MmsTestBed::sendFromFile()
- {
- CMsvOperation * op = NULL;
-
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
- CleanupStack::PushL( cEntry );
-
- CMsvEntrySelection* selection = NULL;
- selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy(); // cEntry
- CleanupStack::PushL( selection );
-
- TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
- if ( error != KErrNone )
- {
- CleanupStack::PopAndDestroy(); // selection
- delete op;
- return;
- }
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(2); // op, selection
- }
-
-void MmsTestBed::sendOneByOne()
- {
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
- CleanupStack::PushL( cEntry );
-
- CMsvEntrySelection* selection = NULL;
- selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL( selection );
-
- CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( shortSelection );
-
- TInt i;
-
- for ( i = 0; i < selection->Count(); ++i )
- {
- shortSelection->Reset();
- shortSelection->AppendL( selection->At( i ) );
-
- CMsvOperation * op = NULL;
-
- TTime now;
- now.UniversalTime();
-
- TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
- if ( error != KErrNone )
- {
- delete op;
- CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
- return;
- }
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
-
- }
- CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
- }
-
-void MmsTestBed::sendNotifications()
- {
- // Only send one notification!!
-
- TInt error = KErrNone;
-
- if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
- {
- //Not a file
- return;
- }
- TMsvId mmsFolder = findMMSFolder();
-
- TEntry entry;
-
-
- // now I think we have a filename
- TEntry orgEntry;
- TUint size = 0;
- error = iFs.Entry( iCurrentFile, orgEntry );
- size = orgEntry.iSize;
-
- //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
- if ( size == 0 )
- {
- //empty file
- //TMmsLogger::Log(_L("- empty file"));
- return;
- }
-
- if ( iEncodeBuffer == NULL )
- {
- iEncodeBuffer = CBufFlat::NewL( size );
- }
- else
- {
- iEncodeBuffer->ResizeL( 0 );
- iEncodeBuffer->ResizeL( size );
- }
-
- RFile inFile;
- error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
- TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
- if ( error == KErrNone )
- {
- error = inFile.Read( ptr, size );
- inFile.Close();
- }
- else
- {
- //Error
- //TMmsLogger::Log(_L("- can't read file"));
- return;
- }
-
- TUint8 byte;
- TUint position = 0;
- TUint32 uintvar = 0;
-
- if ( size > 2 )
- {
- iEncodeBuffer->Read( 1, &byte, 1 );
- if ( byte == 6 ) // PUSH PDU
- {
- // try to find out length of header
- position = 2;
- iEncodeBuffer->Read( position, &byte, 1);
-
- while ( byte & 0x80 && position < size )
- {
- uintvar += ( byte & 0x7f );
- uintvar <<= 7;
- position++;
- iEncodeBuffer->Read( position, &byte, 1 );
- }
-
- // add last byte without shift
- uintvar += byte;
- position++;
- }
- }
-
- position += uintvar;
-
- if ( position < size )
- {
- ptr = iEncodeBuffer->Ptr( position );
- size = ptr.Length();
- }
-
- if ( size == 0 )
- {
- //no MMS stuff
- //TMmsLogger::Log(_L("- no MMS stuff"));
- return;
- }
-
- TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
-
- // Now we have streamed our data into this entry.
- // Now we have an entry that says: local service, MMS MTM
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- if ( entryId != KMsvNullIndexEntryId )
- {
- selection->AppendL( entryId );
- }
- else
- {
- selection->AppendL( iDefaultServiceId );
- }
-
- TWatcherParameters parameters; // initialized to zero
- parameters.iWatcherId = RThread().Id();
- parameters.iDataPointer = &ptr;
- TWatcherParametersBuf paramPack( parameters );
-
- CMsvOperation * op = NULL;
-
- op = iSession->TransferCommandL(
- *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- User::After(1000000);
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::copyDrafts()
- {
- CMsvEntry* cEntry = NULL;
-// Copies contents of sent folder to drafts for retrying sending.
-
- cEntry = iSession->GetEntryL(KMsvSentEntryId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages in drafts
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-
- TMsvLocalOperationProgress progress;
- cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
-
- TInt i = 0;
- for ( i = 0; i < selection->Count(); ++i )
- {
- cEntry->SetEntryL( selection->At( i ) );
- TMsvEntry entry = cEntry->Entry();
- entry.SetReadOnly( EFalse );
- cEntry->ChangeL( entry );
- }
-
- CleanupStack::PopAndDestroy(2); // selection, cEntry
- }
-
-void MmsTestBed::garbageCollection(TUint32 aReason)
- {
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
-
- TMMSGarbageCollectionParameters parameters; // initialized to zero
- parameters.iReasonFlags = aReason;
- TMMSGarbageCollectionParametersBuf paramPack( parameters );
- op = iSession->TransferCommandL(
- *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::messageVariation()
- {
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
-
- op = iSession->TransferCommandL(
- *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::cancelSendScheduling()
- {
- CMsvEntry* cEntry = NULL;
- setFetchingState( EMmsReceivingPostpone );
- testFile( iCurrentFile );
- scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
- deleteSendSchedule();
-
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- if (iMsvEntrySelection != NULL)
- {
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- }
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy();
- }
-
-void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
- {
- CMsvEntry* cEntry = NULL;
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- cEntry = iSession->GetEntryL(aBoxId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-// selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledSend,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::deleteSendSchedule()
- {
- CMsvEntry* cEntry = NULL;
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsDeleteSchedule,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::cancelFetchScheduling()
- {
- TMsvId mmsFolder = findMMSFolder();
- CMsvEntry* cEntry = NULL;
- setFetchingState( EMmsReceivingPostpone );
- testFile( iCurrentFile );
- fromOutboxToMmsc(); // immediate send (EMmsSend)
-
- // Wait until notification has arrived - may take a while in global mode
- TInt i = 0;
- while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
- && i < 2000 )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- i++;
- if ( (i/100) * 100 == i )
- {
- //TMmsLogger::Log(_L("%d:th wait cycle"), i );
- }
- CActiveScheduler::Start();
- }
- iTimer->Cancel();
-
- fetchForced( 10000 ); // delay to allow cancelling
- deleteFetchSchedule();
-
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(mmsFolder);
- if (iMsvEntrySelection != NULL)
- {
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- }
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
- {
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledReceiveForced,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::deleteFetchSchedule()
- {
- CMsvEntry* cEntry = NULL;
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
- cEntry = iSession->GetEntryL( mmsFolderId );
- CleanupStack::PushL(cEntry);
- // Get all notifications
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsDeleteSchedule,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::doAFetchCycle()
- {
- // Sends a message from iCurrentFile and lets it come back
- TMsvId mmsFolder = findMMSFolder();
- testFile( iCurrentFile );
- fromOutboxToMmsc(); // immediate send (EMmsSend)
- // fetching will start automatically
-
- TInt i = 0;
- while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
- && i < 2000
- && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- i++;
- if ( (i/100) * 100 == i )
- {
- //TMmsLogger::Log(_L("%d:th wait cycle"), i );
- }
- CActiveScheduler::Start();
- }
- iTimer->Cancel();
- }
-
-bool MmsTestBed::checkLogClient()
- {
- if ( iLogClient == NULL )
- {
- TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
- }
- return ( iLogClient != NULL );
- }
-
-int MmsTestBed::getLogEntries()
- {
- TInt count = 0;
- if ( !iLogView )
- {
- return 0;
- }
-
- if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
- {
- // should complete with KErrNone
- iWait->Start();
- if ( iWait->iStatus.Int() == KErrNone )
- {
- count = iLogView->CountL();
- }
- }
- return count;
- }
-
-void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
- {
- CMsvOperation* opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
- iWait->Start();
- if (!opert->iStatus.Int()==KErrNone)
- {
- // what should we do? panic?
- }
-
- TPckgBuf<TMsvLocalOperationProgress> package;
- package.Copy(opert->ProgressL());
- *(TMsvId*)&aNewEntry = package().iId;
-
- delete opert; opert=NULL;
- }
-
-void MmsTestBed::cleanOutbox()
- {
- TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
- }
-
-void MmsTestBed::cleanInbox()
- {
- TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
- }
-
-void MmsTestBed::cleanSent()
- {
- TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
- }
-
-void MmsTestBed::cleanDrafts()
- {
- TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
- }
-
-void MmsTestBed::cleanAll()
- {
- cleanInbox();
- cleanOutbox();
- cleanSent();
- cleanDrafts();
- TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
- deleteNotifications();
- }
-
-void MmsTestBed::reply()
- {
- // The first message from inbox is replied to
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
- CMsvOperation * op = NULL;
- op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::replyToAll()
- {
- // The first message from inbox is replied to
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
-
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
- KMsvMessagePartRecipient;
- CMsvOperation * op = NULL;
- op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::forward()
- {
- // The first message from inbox is forwarded
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
-
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
- KMsvMessagePartRecipient | KMsvMessagePartAttachments;
- CMsvOperation * op = NULL;
- op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- iMmsClient->SwitchCurrentEntryL( newEntry );
- // Add a sender: 0601234567
- iMmsClient->LoadMessageL();
- iMmsClient->SetSenderL( KMmsSender );
- iMmsClient->SaveMessageL();
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::sendReadReport()
- {
- // TURN READ REPORTS ON (until available from menu)
- iSettings->LoadSettingsL();
- iSettings->SetReadReplyReportSendingAllowed( ETrue );
- iSettings->SaveSettingsL();
- iMmsClient->RestoreSettingsL();
-
-
- // Read report is sent for the first message in inbox
- CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
-
- if ( iMsvEntrySelection->Count() == 0 )
- {
- return;
- }
- TMsvId originalEntry = iMsvEntrySelection->At( 0 );
-
- // new test using Client MTM
- CMsvOperation * op = NULL;
- op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy( op );
- op = NULL;
-
- // Try sending the read report to current entry
-
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy( op );
- op = NULL;
-
-/*
- cEntry->SetEntryL( originalEntry );
- iMmsHeaders->Reset();
- CMsvStore* store = cEntry->ReadStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->RestoreL( *store );
- CleanupStack::PopAndDestroy( store );
- store = NULL;
- HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
- CleanupStack::PushL( messageId );
- messageId->Des().Copy( iMmsHeaders->MessageId() );
-
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- iMmsClient->LoadMessageL();
-
- iMmsHeaders->Reset();
- iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
- // Message id cannot be accessed via MMS Client MTM!
-
- iMmsHeaders->SetMessageIdL( messageId->Des() );
- CleanupStack::PopAndDestroy( messageId );
-
- iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
- // sender must be insert-address-token because we don't know our number
- TTime now;
- now.UniversalTime();
-
- _LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
-
- TTime y1970( K1970 );
- TTimeIntervalMicroSeconds interval;
- // we can't use "seconds from" as it only returns a
- // 32 bit signed integer. If fails in 2038.
- // "microseconds from" returns a 64 bit signed integer
- interval = now.MicroSecondsFrom( y1970 );
- // date in iMmsHeaders() in seconds from 1.1.1970.
- iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
- iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
-
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = FindMMSFolderL();
-
- cEntry->SetEntryL( mmsFolderId );
-
- TMsvEntry entry;
- entry.iType = KUidMsvMessageEntry;
- entry.iMtm = KUidMsgTypeMultimedia;
- entry.SetVisible( ETrue );
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- entry.iRelatedId = iDefaultServiceId;
- entry.iMtmData1 = KMmsMessageReadRecInd;
- cEntry->CreateL( entry );
- TMsvId entryId = entry.Id();
-
- cEntry->SetEntryL( entryId );
-
- store = cEntry->EditStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->StoreL( *store );
- store->CommitL();
- CleanupStack::PopAndDestroy( store );
- store = NULL;
-
- CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, entryId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy( op );
- CleanupStack::PopAndDestroy( selection );
-*/
- CleanupStack::PopAndDestroy( cEntry );
- }
-
-int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
- {
- TInt error = KErrNone;
- TInt messageCount = 0;
- TInt failureCount = 0;
- do {
- CMsvEntry* cEntry = NULL;
-
- // Get List of services
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- failureCount++;
- // These are failures that fail in Message server.
- if ( failureCount >= 63 && failureCount <= 64 )
- {
- failureCount = 65;
- }
- cEntry->SetEntryL( iServiceId );
- TMsvEntry entry = cEntry->Entry();
- entry.iMtmData3 &= 0x0000000FF;
- entry.iMtmData3 |= failureCount << 8;
- cEntry->ChangeL( entry );
-
- selection->InsertL(0, iServiceId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
-
- if ( error == KErrNone )
- {
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- error = iWait->iStatus.Int();
- if ( iWait->iStatus.Int() != KErrNoMemory )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
- }
-
- CleanupStack::PopAndDestroy(); // op
- }
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // selection
- CleanupStack::PopAndDestroy(); // cEntry
- selection = NULL;
- cEntry = NULL;
- cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
- CleanupStack::PushL(cEntry);
- selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- messageCount = selection->Count();
- delete selection;
- selection = 0;
- CleanupStack::PopAndDestroy(); //cEntry
- }
- while ( error == KErrNoMemory || messageCount > 0 );
- return failureCount;
- }
-
-int MmsTestBed::fromMmscToInboxWithMemoryFailure()
- {
- TInt error = KErrNone;
- TInt failureCount = 0;
- TInt messageCount = 0;
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
-
- do {
- // Inbox must be cleaned if failure makes message to be fetched more than once.
- // should not happen, but this test is quite stressful, and perfect result
- // cannot be guaranteed.
- // What is expected:
- // 1. Program does not crash
- // 2. After sufficient number of retries the message is fetched and notification deleted.
- TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
- CMsvEntry* cEntry = NULL;
- CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
- CleanupStack::PushL(msvEntrySelection);
-
- cEntry = iSession->GetEntryL(iServiceId);
- CleanupStack::PushL(cEntry);
-
- failureCount++;
- // These are failures that fail in Message server.
- if ( failureCount >= 63 && failureCount <= 64 )
- {
- failureCount = 65;
- }
- cEntry->SetEntryL( iServiceId );
-
- TMsvEntry entry = cEntry->Entry();
- entry.iMtmData3 &= 0x0000000FF;
- entry.iMtmData3 |= failureCount << 8;
- cEntry->ChangeL( entry );
-
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- msvEntrySelection->InsertL(0, iServiceId);
- }
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
- EMmsReceiveForced,
- *msvEntrySelection,
- paramPack,
- iWait->iStatus) );
-
- if ( error == KErrNone )
- {
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- error = iWait->iStatus.Int();
- if ( iWait->iStatus.Int() != KErrNoMemory )
- {
- //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
- }
- }
-
- CleanupStack::PopAndDestroy(); // op
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // msvEntrySelection
- CleanupStack::PopAndDestroy(); // cEntry
- msvEntrySelection = NULL;
- cEntry = NULL;
- cEntry = iSession->GetEntryL( mmsFolderId );
- CleanupStack::PushL(cEntry);
- msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- messageCount = msvEntrySelection->Count();
- delete msvEntrySelection;
- msvEntrySelection = 0;
- CleanupStack::PopAndDestroy(); //cEntry
- }
- while ( error == KErrNoMemory || messageCount > 0 );
- if ( error != KErrNoMemory && error != KErrNone )
- {
- //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
- }
- return failureCount;
- }
-
-void MmsTestBed::sendViaClient()
- {
- CMsvEntry* cEntry = NULL;
-
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages in drafts
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-
- CMsvOperation * op = NULL;
- TTime now;
- now.UniversalTime();
- op = iMmsClient->SendL( *selection, iWait->iStatus, now );
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
- {
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledReceive,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::fetchForcedImmediate()
- {
- TCommandParameters parameters;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsReceiveForced,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::getEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-
- CLogEventType* eventType = CLogEventType::NewL();
- CleanupStack::PushL( eventType );
- eventType->SetUid(iLogEvent->EventType());
- iLogClient->GetEventType( *eventType, iWait->iStatus );
-
- iWait->Start();
- CleanupStack::PopAndDestroy(); // eventType
- }
-
-void MmsTestBed::addEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-
- CLogEventType* eventType = CLogEventType::NewL();
- CleanupStack::PushL( eventType );
- eventType->SetUid(iLogEvent->EventType());
- eventType->SetDescription(_L("Multimedia Message") );
- eventType->SetLoggingEnabled( ETrue );
-
-// iWait->iStatus = KRequestPending;
- iLogClient->AddEventType( *eventType, iWait->iStatus );
- iWait->Start();
- CleanupStack::PopAndDestroy(); // eventType
- }
-
-void MmsTestBed::deleteEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-// iWait->iStatus = KRequestPending;
- iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
- iWait->Start();
- }
-
-void MmsTestBed::cleanLog()
- {
- TInt count = 0;
-
- count = getLogEntries();
-
- TInt i;
- for ( i = 0; i < count; ++i )
- {
- // when a view is created, it will be positioned on the first event
-// iWait->iStatus = KRequestPending;
- iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
- iWait->Start();
-
- if ( iLogView->NextL( iWait->iStatus ) )
- {
- // should complete with KErrNone
- iWait->Start();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- // could not get next event!
- break;
- }
- }
- else
- {
- break; // no more events!
- }
- }
- }
-
-void MmsTestBed::setOnline(bool value)
- {
- //value = true for online mode
- //value = false for offline mode
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
- if( retval == KErrNone )
- {
- repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
- delete repository;
- }
- }
-
-void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
- {
- iEncodeBuffer->ResizeL( 1024 );
-
- TInt position = 0;
-
- // encode message type
- iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
- position++;
- iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
- position++;
-
- // version
- iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
- position++;
-
- TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
- iEncodeBuffer->Write( position, &version, 1 );
- position++;
-
- // message id from the headers
- // At least once MMSC did not send us the message id!
- // if message id is missing, we cannot match the entry!
- // This only a fake. Real delivery reports should always
- // contain the message id.
- if ( aMmsHeaders->MessageId().Length() > 0 )
- {
- iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
- position++;
- iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
- position += aMmsHeaders->MessageId().Length();
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
- }
-
- // To is taken from the headers
- iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
- position++;
-
- TPtrC recipient;
- if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
- aMmsHeaders->ToRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->ToRecipients()[0] );
- }
- else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
- aMmsHeaders->CcRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->CcRecipients()[0] );
- }
- else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
- aMmsHeaders->BccRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->BccRecipients()[0] );
- }
- else
- {
- recipient.Set( _L("Jasso-Kissa@jii.fi") );
- }
-
- TMmsAddressType addressType = EMmsAddressTypeUnknown;
-
- if ( recipient.Find( KMiuMau ) != KErrNotFound )
- {
- addressType = EMmsAddressTypeEmail;
- }
- else
- {
- addressType = EMmsAddressTypeMobile;
- }
-
- TUint8 character;
- TInt i;
- if ( addressType == EMmsAddressTypeEmail )
- {
- // email address - ASCII ONLY - THIS IS JUST A TEST!
-
- for ( i = 0; i < recipient.Length(); ++i )
- {
- character = TUint8( recipient[i] & 0xff );
- iEncodeBuffer->Write( position, &character, 1 );
- position++;
- }
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
-
- }
- else
- {
- // must be a phone number
- // We expect for now that the format is correct as is
- // All legal characters present in a phone number are ASCII
-
- TInt i;
- for ( i = 0; i < recipient.Length(); ++i )
- {
- character = TUint8( recipient[i] & 0xff );
- iEncodeBuffer->Write( position, &character, 1 );
- position++;
- }
- iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
- position += KMmsPlmnLength;
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
- }
-
- // date
- iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
- position++;
-
- TLocale locale;
- locale.Refresh();
- TInt64 UtcDate;
- TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
-
- TTime now;
- now.UniversalTime();
- UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
-
- UtcDate -= universalTimeOffset.Int();
-
- if ( locale.QueryHomeHasDaylightSavingOn() )
- {
- TTimeIntervalSeconds daylightSaving( 60 * 60 );
- UtcDate -= daylightSaving.Int();
- }
-
- TUint8 len; // number of bytes we will need
- len = 0;
- TUint8 array[8];
-
- TInt64 temp = UtcDate;
-
- for (i = 7; i >= 0; --i)
- {
- array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
- I64LSR( temp, 8 );
- }
-
- len = 8;
- i = 0;
- while( ( array[i]== 0 ) && ( i < 8 ) )
- {
- i++;
- len--;
- }
-
- // a zero should be coded as short integer.
- // However, if there is a valid reason to code a zero as a long integer,
- // we allow it. The caller should know what he is doing.
- if ( len == 0 )
- {
- len = 1;
- }
- // write short length
- iEncodeBuffer->Write( position, &len, 1 );
- position++;
- // write as many bytes as were non-zero
- iEncodeBuffer->Write( position, &(array[8 - len] ), len );
- position+= len;
- // status
- iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
- position++;
- iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
- position++;
- // DONE!!!
- iEncodeBuffer->ResizeL( position );
- return;
- }
-
-void MmsTestBed::sendDeliveryReport()
- {
- if ( iEncodeBuffer->Size() == 0 )
- {
- //No delivery report
- return;
- }
-
-
- TMsvId mmsFolder = findMMSFolder();
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
-
- TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
- TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
-
- // Now we have streamed our data into this entry.
- // Now we have an entry that says: local service, MMS MTM
-
- if ( entryId != KMsvNullIndexEntryId )
- {
- selection->AppendL( entryId );
- }
- else
- {
- selection->AppendL( iDefaultServiceId );
- }
-
- TWatcherParameters parameters; // initialized to zero
- parameters.iWatcherId = RThread().Id();
- parameters.iDataPointer = &ptr;
- TWatcherParametersBuf paramPack( parameters );
-
- CMsvOperation * op = NULL;
-
-// iWait->iStatus = KRequestPending;
- op = iSession->TransferCommandL(
- *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmsteststaticutils.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,528 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <f32file.h>
-#include <centralrepository.h>
-#include <apparc.h>
-#include <msvapi.h>
-#include <msvids.h>
-
-#include "mmsteststaticutils.h"
-#include "mmsconst.h"
-#include <MmsEnginePrivateCRKeys.h>
-#include "mmssettings.h"
-#include <mmsheaders.h>
-#include "mmsservercommon.h"
-#include <mmsencode.h>
-
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
-: iArray1(aArray1), iArray2(aArray2)
- {
- }
-
-TInt TMmsJoinedArrays::MdcaCount() const
- {
- TInt count=0;
- if (iArray1)
- count += iArray1->MdcaCount();
- if (iArray2)
- count += iArray2->MdcaCount();
- return count;
- }
-
-TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
- {
- if (iArray1)
- {
- if (aIndex < iArray1->MdcaCount())
- return iArray1->MdcaPoint(aIndex);
- else
- aIndex -= iArray1->MdcaCount();
- }
- return iArray2->MdcaPoint(aIndex);
- }
-
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-TMmsTestUtils::TMmsTestUtils()
- {
-
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
- {
- RFile file;
- TInt error = KErrNone;
-
- TInt textBufferSize = 256;
- HBufC* textBuffer = HBufC::NewL( textBufferSize );
- TPtr textPtr = textBuffer->Des();
- TFileText textFile;
-
- error = file.Open( aFs, aFileName,
- EFileRead|EFileShareReadersOnly );
-
- if ( error == KErrNone )
- {
- textFile.Set( file );
- error = textFile.Seek( ESeekStart );
- }
-
- if ( error == KErrNone )
- {
- error = textFile.Read( textPtr );
- }
-
- file.Close();
-
- if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
- {
- textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
- }
-
- return textBuffer;
- }
-
-//----------------------------------------------------------------------------------------
-// turn on detailed logging while decoding a message
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::DecodeLoggingOnL()
- {
- // CenRep for decodelogging
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 1;
- repository->Set( KMmsEngineDecodeLog, temp );
- delete repository;
- }
- }
-
-//----------------------------------------------------------------------------------------
-// turn off detailed logging while decoding a message
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::DecodeLoggingOffL()
- {
- // CenRep for decodelogging
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 0;
- repository->Set( KMmsEngineDecodeLog, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn on binary dump of incoming messages
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::BinaryDumpOnL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 1;
- repository->Set( KMmsEngineBinaryDump, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn off binary dump of incoming messages
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::BinaryDumpOffL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 0;
- repository->Set( KMmsEngineBinaryDump, temp );
- delete repository;
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
- {
- // Delete the files in the directory
- CFileMan* fileMan = CFileMan::NewL( aFs );
- CleanupStack::PushL( fileMan );
- fileMan->RmDir( KMmsDefaultLocalModeDir );
- fileMan->RmDir( KMmsMMBoxDirectory );
- fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
- CleanupStack::PopAndDestroy(); // fileManager
- // we don't want to throw these away!
- aFs.MkDirAll( KMmsDefaultLocalModeDir );
- aFs.MkDirAll( KMmsMMBoxDirectory );
- aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
- {
- TInt error = KErrNone;
- aFs.MkDirAll( aFilename );
- TUint att;
- if ( aFs.Att( aFilename, att ) == KErrNone )
- {
- _LIT( KRelated, "dump.mms");
- aParse.Set( aFilename, &KRelated, NULL );
- aFilename = aParse.FullName();
- error = CApaApplication::GenerateFileName( aFs, aFilename );
- if ( error == KErrNone )
- {
- RFile file;
- error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
- // for message id generation
- aParse.Set( aFilename, NULL, NULL );
- if ( error == KErrNone )
- {
- // the data is supposed to be in the encode buffer
- TPtr8 ptr = aBuffer.Ptr( 0 );
- file.Write( ptr );
- file.Flush();
- }
-
- // done - close files
- file.Close();
- }
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
- {
- CMsvEntry* cEntry = NULL;
- // delete all messages from the specified box
- cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(aBoxId);
- // show invisible entries
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL(msvEntrySelection);
-
- CMsvEntrySelection* selection = NULL;
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
- CleanupStack::PushL( selection );
- if ( selection->Count() > 0 )
- {
- msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
- }
- CleanupStack::PopAndDestroy(); // selection
-
- int i;
- for (i = 0; i < msvEntrySelection->Count(); ++i)
- {
- CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
- CleanupStack::PushL( entry );
- TMsvEntry tEntry = entry->Entry();
- tEntry.SetReadOnly(EFalse);
- entry->ChangeL(tEntry);
- cEntry->DeleteL( msvEntrySelection->At(i) );
- CleanupStack::PopAndDestroy( entry );
- }
-
- CleanupStack::PopAndDestroy(msvEntrySelection);
- CleanupStack::PopAndDestroy(cEntry);
- }
-
-//----------------------------------------------------------------------------------------
-// turn on logging email recipients
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::EmailLoggingOnL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
- if( retval == KErrNone )
- {
- TInt temp = 1;
- repository->Set( KMmsEngineLogEmailRecipients, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn off logging email recipients
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::EmailLoggingOffL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
- if( retval == KErrNone )
- {
- TInt temp = 0;
- repository->Set( KMmsEngineLogEmailRecipients, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
- {
- CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(aBoxId);
- if (aMsvEntrySelection != NULL)
- {
- delete aMsvEntrySelection;
- aMsvEntrySelection = NULL;
- }
- aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
- CleanupStack::PopAndDestroy(); // cEntry
- return aMsvEntrySelection->Count();
- }
-
-
-// -----------------------------------------------------------------------------
-// CreateFolderEntryL
-//
-// -----------------------------------------------------------------------------
-//
-void TMmsTestUtils::CreateFolderEntryL(
- CMsvSession& aSession,
- TMsvId aParentFolder,
- const TDesC& aFolderName,
- TMsvId& aFolderId )
- {
- aFolderId = KMsvNullIndexEntryId;
- CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
- CleanupStack::PushL( cEntry );
-
- // Create a new folder.
-
- TMsvEntry entry;
- entry.iType = KUidMsvFolderEntry;
- entry.iMtm = KUidMsvLocalServiceMtm;
- entry.iDetails.Set( aFolderName );
- entry.SetVisible( EFalse );
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- cEntry->CreateL( entry );
- aFolderId = entry.Id();
- CleanupStack::PopAndDestroy( cEntry );
-
- }
-
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TMsvId TMmsTestUtils::CreateNotificationEntryL(
- TMsvId aNotificationFolder,
- TMsvId aServiceId,
- CBufFlat* aEncodeBuffer,
- CMsvSession& aSession )
- {
- TMsvId entryId = KMsvNullIndexEntryId;
- if ( aNotificationFolder == KMsvNullIndexEntryId )
- {
- // no folder no entry
- return entryId;
- }
-
- CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
- CleanupStack::PushL(cEntry);
-
- TMsvEntry entry;
- entry.iType = KUidMsvMessageEntry;
- entry.iMtm = KUidMsgTypeMultimedia;
- entry.SetVisible( ETrue );
- // If we want to put data here, InPreparation must be set to true first
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- entry.iRelatedId = aServiceId;
- entry.iMtmData2 = KMmsNotificationBinary;
- cEntry->CreateL( entry );
- entryId = entry.Id();
-
- //
- // Stream
- // 1) length of the data as 32 bit integer
- // 2) pushed message data
- // into created entry's stream
- //
- cEntry->SetEntryL( entryId );
- CMsvStore* store = cEntry->EditStoreL();
- CleanupStack::PushL( store ); // ***
- RMsvWriteStream outs;
- outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
- TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
- outs.WriteUint32L( ptr.Length() );
- outs.WriteL( ptr );
- outs.CommitL();
- outs.Close();
- store->CommitL();
-
- CleanupStack::PopAndDestroy( &outs ); // close outs
- CleanupStack::PopAndDestroy( store );
- CleanupStack::PopAndDestroy( cEntry );
-
- return entryId;
-
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::FormNotification(
- TDesC8& aUrl,
- TInt aSize,
- CMmsHeaders& aMmsHeaders,
- CMmsEncode& aMmsEncoder,
- CBufFlat* aEncodeBuffer )
- {
- // for test purposes aUrl will contain the filename.
-
- // Reset sets the default encapsulation version
- // The default version has been set from MmsSettings in NewL
- aMmsHeaders.Reset();
-
- // construct the notification into iMmsHeaders, and call encode
-
- aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
-
- TTime currentTime;
- currentTime.UniversalTime();
- currentTime.Int64();
-
- TPtrC8 tid;
- TBufC8<KMMSMAXTIDLENGTH> target;
- TInt random = 0;
-
- // we don't generate a true random TID: We generate the
- // TID from the URL so that if we generate a notification
- // twice from the same file, we get the same TID and the
- // same URL. This way we can test the pruning function in
- // server MTM
-
- TInt i;
- for ( i = 0; i < aUrl.Length(); ++i )
- {
- random += aUrl[ i ];
- }
-
- target.Des().Num( random );
- tid.Set( target.Des() );
- aMmsHeaders.SetTidL( tid );
-
- aMmsHeaders.SetMessageClass( EMmsClassPersonal );
- aMmsHeaders.SetMessageSize( aSize );
- const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
- aMmsHeaders.SetExpiryInterval( KTenHours );
- aMmsHeaders.SetContentLocationL( aUrl );
-
- aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
-
- }
-
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
- {
- //Is the name a file?
- if (IsDrive(aFileName))
- return EFalse;
- return !(IsDir(aFileName, aFs));
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
- {
- //Is the name a directory?
- TEntry entry;
- TInt err = aFs.Entry(aFileName, entry);
- if (err)
- return EFalse;
- else
- return entry.IsDir();
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
- {
- //horrible little function to figure if the path is just a drive
- TBool retVal = EFalse;
- if (aFileName.Length()==3) //eg "c:\"
- {
- if ((aFileName[1] == ':') && (aFileName[2] == '\\'))
- retVal=ETrue;
- }
- else if (aFileName.Length()==2) //eg "c:"
- {
- if (aFileName[1] == ':')
- retVal=ETrue;
- }
- return retVal;
- }
-
-// end of file
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmstestuitimer.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include "mmstestuitimer.h"
-
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer::CTestUiTimer(): CTimer( 5 )
- {
- period = KPeriod;
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::ConstructL()
- {
- CTimer::ConstructL();
- CActiveScheduler::Add(this);
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer* CTestUiTimer::NewL()
- {
- CTestUiTimer* self = new(ELeave) CTestUiTimer();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer::~CTestUiTimer()
- {
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::IssueRequest()
- {
- // No operation to cancel if this function is called
- iObject = NULL;
- After(period);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
- {
- iObject = aObject;
- TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
- After( timeout );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::DoCancel()
- {
- CTimer::DoCancel();
- if ( iObject )
- {
- iObject->Cancel();
- iObject = NULL;
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::RunL()
- {
- if ( iObject )
- {
- // If we timeout while holding an active object, we cancel it
- iObject->Cancel();
- iObject = NULL;
- }
- else
- {
- CActiveScheduler::Stop();
- }
- }
-
-// ======== GLOBAL FUNCTIONS ========
-
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/group/testmmsplugin.pro Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-QT += testlib
-QT -= gui
-
-TEMPLATE = lib
-TARGET = test-mms-plugin
-
-INCLUDEPATH += ../inc
-INCLUDEPATH += ../../../inc
-#INCLUDEPATH += ../../../../inc
-
-INCLUDEPATH += ../../../../../../../../inc
-INCLUDEPATH += ../../../../../../inc
-INCLUDEPATH += ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc
-INCLUDEPATH += ../../../../../msgutils/unidatautils/unidatamodel/inc
-INCLUDEPATH += ../../../../../msgutils/unieditorutils/editorgenutils/inc
-INCLUDEPATH += ../../../../../msgutils/s60qconversions/inc
-INCLUDEPATH += ../../../../../../../../mmsengine/mmsmessage/inc
-INCLUDEPATH += ../../../../../../../../mmsengine/inc
-INCLUDEPATH += ../../mmstestbed/inc
-INCLUDEPATH +=
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_TEST_DLL
-
-CONFIG += hb plugin
-
-SOURCES += \
- ../src/testmmsplugin.cpp \
- ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp \
- ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp
-
-
-# Input
-HEADERS += \
- ../inc/testmmsplugin.h \
- ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin.h \
- ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h
-
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
- symbian {
- TARGET.CAPABILITY = CAP_GENERAL_DLL
- TARGET.EPOCSTACKSIZE = 0x8000
- TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
- TARGET.EPOCALLOWDLLDATA = 1
- }
-
- LIBS += -leuser \
- -lconvergedmessageutils \
- -ls60qconversions \
- -lMsgMedia \
- -leikctl \
- -leditorgenutils \
- -lcone \
- -leikcoctl \
- -leikcore \
- -leikdlg \
- -lmsgs \
- -letext \
- -lmmsserversettings \
- -lgsmu \
- -lmmsgenutils \
- -lefsrv \
- -lestor \
- -lsmcm \
- -lCommonEngine \
- -lbafl \
- -lCdlEngine \
- -lFeatMgr \
- -lapmime \
- -lapgrfx \
- -lcharconv \
- -lInetProtUtil \
- -lsmildtd \
- -lxmldom \
- -lxmlparser \
- -lcone \
- -lQtCore \
- -letel \
- -lmmsmessage \
- -lcommdb \
- -lcommsdat \
- -letelmm \
- -lunidatamodelloader \
- -lunidatamodel \
- -lavkon \
- -leikcoctl \
- -leikctl \
- -lform \
- -luiklaf\
- -lxqutils\
- -lmmstestbed
-
-
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/inc/testmmsplugin.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: - Main test class for Msgnotification -indicator plugin,
- * -notification dialog plugin
- */
-
-#ifndef TEST_MMS_PLUGIN_H
-#define TEST_MMS_PLUGIN_H
-
-#ifdef BUILD_TEST_DLL
-#define TEST_EXPORT Q_DECL_EXPORT
-#else
-#define TEST_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <e32const.h>
-
-class UniEditorMmsPlugin;
-class ConvergedMessage;
-class MmsTestBed;
-class QSignalSpy;
-
-class TEST_EXPORT TestMmsPlugin: public QObject
- {
- Q_OBJECT
-
-private slots:
-
- /**
- * Called by framework,its called before the 1st test function is executed.
- */
-
- void initTestCase();
-
- /**
- * Called by framework,its called before each test function is executed.
- */
-
- void init();
-
- /**
- * Test Sending MMS
- */
-
- void testSendMMS();
-
- /**
- * Test receiving MMS
- */
-
- void testMmsReceived();
-
- /**
- * Called by framework,its called after each test function is executed.
- */
-
- void cleanup();
-
- /**
- * Called by framework,its called after the last test function is executed.
- */
-
- void cleanupTestCase();
-
-private:
-
- QSignalSpy *spy_draft;
- QSignalSpy *spy_outbox;
- QSignalSpy *spy_sent;
-
- UniEditorMmsPlugin* msgPlugin;
- int mmsId;
- MmsTestBed* mmstestbed;
-
- };
-#endif //TEST_MMS_PLUGIN_H
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/inc/testmmsplugin.ini Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-//this file is used to provide predefined set of input data.
-
-const char TEST_MSG_RECIEPIENT[] = "+919000";
-const char TEST_MSG_FROM2[] = "999";
-const char TEST_MSG_SUBJECT[] = "Message Subject";
-const char TEST_SERVICE_NAME_MMS[] = "messaging.mserver.testservice.MMS";
-const char TEST_SENDER[] = "+918888";
-const char TEST_ATTACHMENT[] = "c:\\sample.txt";
-const char TEST_ATTACHMENT4[] = "c:\\SmileyFace.gif";
-const char TEST_ATTACHMENT5[] = "c:\\sample.txt";
-const char TEST_CC[] = "DummyCCAddress";
-const char TEST_BCC[] = "DummyBCCAddress";
\ No newline at end of file
Binary file messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/mms.rsc has changed
Binary file messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/not.rsc has changed
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/plugin_commonU.def Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-; ==============================================================================
-; Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-06-21T15:39:25
-; This file is generated by qmake and should not be modified by the
-; user.
-; Name : plugin_commonU.def
-; Part of : test-mms-plugin
-; Description : Fixes common plugin symbols to known ordinals
-; Version :
-;
-; ==============================================================================
-
-
-EXPORTS
- qt_plugin_query_verification_data @ 1 NONAME
- qt_plugin_instance @ 2 NONAME
- ?qt_metacast@TestMmsPlugin@@UAEPAXPBD@Z @ 3 NONAME ; void * TestMmsPlugin::qt_metacast(char const *)
- ?init@TestMmsPlugin@@AAEXXZ @ 4 NONAME ; void TestMmsPlugin::init(void)
- ?staticMetaObject@TestMmsPlugin@@2UQMetaObject@@B @ 5 NONAME ; struct QMetaObject const TestMmsPlugin::staticMetaObject
- ?tr@TestMmsPlugin@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString TestMmsPlugin::tr(char const *, char const *, int)
- ?initTestCase@TestMmsPlugin@@AAEXXZ @ 7 NONAME ; void TestMmsPlugin::initTestCase(void)
- ?cleanup@TestMmsPlugin@@AAEXXZ @ 8 NONAME ; void TestMmsPlugin::cleanup(void)
- ?trUtf8@TestMmsPlugin@@SA?AVQString@@PBD0H@Z @ 9 NONAME ; class QString TestMmsPlugin::trUtf8(char const *, char const *, int)
- ?qt_metacall@TestMmsPlugin@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int TestMmsPlugin::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?testMmsReceived@TestMmsPlugin@@AAEXXZ @ 11 NONAME ; void TestMmsPlugin::testMmsReceived(void)
- ?testSendMMS@TestMmsPlugin@@AAEXXZ @ 12 NONAME ; void TestMmsPlugin::testSendMMS(void)
- ?trUtf8@TestMmsPlugin@@SA?AVQString@@PBD0@Z @ 13 NONAME ; class QString TestMmsPlugin::trUtf8(char const *, char const *)
- ?tr@TestMmsPlugin@@SA?AVQString@@PBD0@Z @ 14 NONAME ; class QString TestMmsPlugin::tr(char const *, char const *)
- ?metaObject@TestMmsPlugin@@UBEPBUQMetaObject@@XZ @ 15 NONAME ; struct QMetaObject const * TestMmsPlugin::metaObject(void) const
- ?getStaticMetaObject@TestMmsPlugin@@SAABUQMetaObject@@XZ @ 16 NONAME ; struct QMetaObject const & TestMmsPlugin::getStaticMetaObject(void)
- ?cleanupTestCase@TestMmsPlugin@@AAEXXZ @ 17 NONAME ; void TestMmsPlugin::cleanupTestCase(void)
-
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/src/testmmsplugin.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: - Main test class for Msgnotification -indicator plugin,
- * -notification dialog plugin
- */
-
-#include "testmmsplugin.h"
-#include <QtTest/QtTest>
-#include "debugtraces.h"
-#include <QTimer>
-#include <QSignalSpy>
-#include "convergedmessage.h"
-#include "convergedmessageid.h"
-#include "unieditormmsplugin.h"
-#include "mmstestbed.h"
-#include "testmmsplugin.ini"
-#include <QSignalSpy>
-
-
-//---------------------------------------------------------------
-// TestMmsPlugin::initTestCase
-//---------------------------------------------------------------
-
-void TestMmsPlugin::initTestCase()
-{
- qRegisterMetaType<long int> ("long int");
- msgPlugin = new UniEditorMmsPlugin();
- QVERIFY(msgPlugin != 0);
- mmsId = -1;
- mmstestbed = new MmsTestBed;
- QVERIFY(mmstestbed != 0);
- if(!mmstestbed)
- {
- QSKIP("Mmstestbed creation failed", SkipAll);
- }
-
- spy_draft = new QSignalSpy(mmstestbed,SIGNAL(entryCreatedInDraft(long int)));
- spy_outbox = new QSignalSpy(mmstestbed,SIGNAL(entryMovedToOutbox(long int)));
- spy_sent = new QSignalSpy(mmstestbed,SIGNAL(entryMovedToSent(long int)));
-
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::init
-//---------------------------------------------------------------
-
-void TestMmsPlugin::init()
-{
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testSendMMS
-//---------------------------------------------------------------
-
-void TestMmsPlugin::testSendMMS()
-{
-
- qRegisterMetaType<long int> ("long int");
- QString service = TEST_SERVICE_NAME_MMS;
-
- QString subject = TEST_MSG_SUBJECT;
- qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
-
- QString sender(TEST_SENDER);
- ConvergedMessageAddress address(sender);
- ConvergedMessageAttachmentList attachmentList;
-
- QString attachment2Path = TEST_ATTACHMENT4;
- ConvergedMessageAttachment* attachment2 =
- new ConvergedMessageAttachment(attachment2Path, ConvergedMessageAttachment::EAttachment);
-
- QString attachmentPath = TEST_ATTACHMENT5;
- ConvergedMessageAttachment* attachment =
- new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
-
- attachmentList.append(attachment);
- attachmentList.append(attachment2);
- ConvergedMessage msg;
- msg.setMessageType(ConvergedMessage::Mms);
- msg.setSubject(subject);
- msg.setTimeStamp(timeStamp);
- msg.addToRecipient(address);
- msg.addAttachments(attachmentList);
- msg.setPriority(ConvergedMessage::Normal);
- //Adding alias
- ConvergedMessageAddress address1;
- address1.setAlias(QString(TEST_MSG_RECIEPIENT));
- msg.addToRecipient(address1);
-
- //Adding CC Address
- QString ccAddress(TEST_CC);
- ConvergedMessageAddress ccAdd(ccAddress);
- msg.addCcRecipient(ccAdd);
-
- //Adding BCC Address
- QString bccAddress(TEST_BCC);
- ConvergedMessageAddress bccAdd(bccAddress);
- msg.addBccRecipient(bccAdd);
-
- mmstestbed->cleanAll();
- mmstestbed->setConnectionLocal(true);
- long int id = msgPlugin->convertTo(&msg);
-
- QVERIFY(id != 0);
- msgPlugin->send(id);
- QTest::qWait(5000);
- long int idRec;
-
- if( 1 == spy_draft->count())
- {
- void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
- idRec = *reinterpret_cast< long int(*)>(temp);
- QDEBUG_WRITE("passed: spy_draft.count");
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to create message in Draft");
- mmstestbed->setConnectionLocal(false);
- return;
- }
- if( 1 == spy_outbox->count())
- {
- mmstestbed->fromOutboxToMmsc();
- QDEBUG_WRITE("passed: spy_outbox.count");
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
- mmstestbed->setConnectionLocal(false);
- return;
- }
-
- if( 1 == spy_sent->count())
- {
- void * temp = const_cast<void*>(spy_sent->at(0).at(0).data());
- long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
- QCOMPARE(sentmsgid, idRec);
- mmstestbed->fromMmscToInbox();
- QDEBUG_WRITE("passed: spy_sent.count");
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
- mmstestbed->setConnectionLocal(false);
- return;
- }
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testMmsReceived
-//---------------------------------------------------------------
-void TestMmsPlugin::testMmsReceived()
-{
- QTest::qWait(5000);
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::cleanup
-//---------------------------------------------------------------
-void TestMmsPlugin::cleanup()
-{
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::cleanupTestCase
-//---------------------------------------------------------------
-void TestMmsPlugin::cleanupTestCase()
-{
- delete msgPlugin;
- delete mmstestbed;
-}
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/tsrc.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+CONFIG += symbian_test
+
+#Sub .pro files
+SUBDIRS += unittest_mmsplugin/unittest_mmsplugin.pro
+
+# Platforms
+SYMBIAN_PLATFORMS = DEFAULT
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/bwins/mmstestbedu.def Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,71 @@
+EXPORTS
+ ?sendReadReport@MmsTestBed@@QAEXXZ @ 1 NONAME ; void MmsTestBed::sendReadReport(void)
+ ?cleanAll@MmsTestBed@@QAEXXZ @ 2 NONAME ; void MmsTestBed::cleanAll(void)
+ ??0MmsTestBed@@QAE@XZ @ 3 NONAME ; MmsTestBed::MmsTestBed(void)
+ ?entryCreatedInDraft@MmsTestBed@@IAEXJ@Z @ 4 NONAME ; void MmsTestBed::entryCreatedInDraft(long)
+ ?trUtf8@MmsTestBed@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString MmsTestBed::trUtf8(char const *, char const *)
+ ?encodeMessageFromDrafts@MmsTestBed@@AAEXXZ @ 6 NONAME ; void MmsTestBed::encodeMessageFromDrafts(void)
+ ?copyDrafts@MmsTestBed@@QAEXXZ @ 7 NONAME ; void MmsTestBed::copyDrafts(void)
+ ?HandleSessionEventL@MmsTestBed@@MAEXW4TMsvSessionEvent@MMsvSessionObserver@@PAX11@Z @ 8 NONAME ; void MmsTestBed::HandleSessionEventL(enum MMsvSessionObserver::TMsvSessionEvent, void *, void *, void *)
+ ??1MmsTestBed@@UAE@XZ @ 9 NONAME ; MmsTestBed::~MmsTestBed(void)
+ ?sendViaClient@MmsTestBed@@QAEXXZ @ 10 NONAME ; void MmsTestBed::sendViaClient(void)
+ ?scheduledSend@MmsTestBed@@QAEXJH@Z @ 11 NONAME ; void MmsTestBed::scheduledSend(long, int)
+ ?garbageCollection@MmsTestBed@@QAEXK@Z @ 12 NONAME ; void MmsTestBed::garbageCollection(unsigned long)
+ ??_EMmsTestBed@@UAE@I@Z @ 13 NONAME ; MmsTestBed::~MmsTestBed(unsigned int)
+ ?testFile@MmsTestBed@@AAEXAAV?$TBuf@$0BAA@@@HJ@Z @ 14 NONAME ; void MmsTestBed::testFile(class TBuf<256> &, int, long)
+ ?checkLogClient@MmsTestBed@@AAE_NXZ @ 15 NONAME ; bool MmsTestBed::checkLogClient(void)
+ ?sendDeliveryReport@MmsTestBed@@QAEXXZ @ 16 NONAME ; void MmsTestBed::sendDeliveryReport(void)
+ ?metaObject@MmsTestBed@@UBEPBUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const * MmsTestBed::metaObject(void) const
+ ?fetchForced@MmsTestBed@@QAEXH@Z @ 18 NONAME ; void MmsTestBed::fetchForced(int)
+ ?qt_metacall@MmsTestBed@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 19 NONAME ; int MmsTestBed::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?qt_metacast@MmsTestBed@@UAEPAXPBD@Z @ 20 NONAME ; void * MmsTestBed::qt_metacast(char const *)
+ ?fromMmscToInbox@MmsTestBed@@QAEXXZ @ 21 NONAME ; void MmsTestBed::fromMmscToInbox(void)
+ ?createEntry@MmsTestBed@@QAEXAAVTMsvEntry@@AAVCMsvEntry@@@Z @ 22 NONAME ; void MmsTestBed::createEntry(class TMsvEntry &, class CMsvEntry &)
+ ?entryMovedToSent@MmsTestBed@@IAEXJ@Z @ 23 NONAME ; void MmsTestBed::entryMovedToSent(long)
+ ?cancelSendScheduling@MmsTestBed@@QAEXXZ @ 24 NONAME ; void MmsTestBed::cancelSendScheduling(void)
+ ?tr@MmsTestBed@@SA?AVQString@@PBD0@Z @ 25 NONAME ; class QString MmsTestBed::tr(char const *, char const *)
+ ?reply@MmsTestBed@@QAEXXZ @ 26 NONAME ; void MmsTestBed::reply(void)
+ ?fromOutboxToMmsc@MmsTestBed@@QAEXXZ @ 27 NONAME ; void MmsTestBed::fromOutboxToMmsc(void)
+ ?findDefaultL@MmsTestBed@@AAEXXZ @ 28 NONAME ; void MmsTestBed::findDefaultL(void)
+ ?cleanupAndCreateNewService@MmsTestBed@@QAEXXZ @ 29 NONAME ; void MmsTestBed::cleanupAndCreateNewService(void)
+ ?restoreFactorySettings@MmsTestBed@@QAEXXZ @ 30 NONAME ; void MmsTestBed::restoreFactorySettings(void)
+ ?deleteEntry@MmsTestBed@@AAEXJAAVCMsvEntry@@@Z @ 31 NONAME ; void MmsTestBed::deleteEntry(long, class CMsvEntry &)
+ ?entryMovedToOutbox@MmsTestBed@@IAEXJ@Z @ 32 NONAME ; void MmsTestBed::entryMovedToOutbox(long)
+ ?cleanDrafts@MmsTestBed@@QAEXXZ @ 33 NONAME ; void MmsTestBed::cleanDrafts(void)
+ ?getEventType@MmsTestBed@@QAEXXZ @ 34 NONAME ; void MmsTestBed::getEventType(void)
+ ?addMMBoxDescriptions@MmsTestBed@@AAEXXZ @ 35 NONAME ; void MmsTestBed::addMMBoxDescriptions(void)
+ ?deleteNotifications@MmsTestBed@@QAEXXZ @ 36 NONAME ; void MmsTestBed::deleteNotifications(void)
+ ?deleteSendSchedule@MmsTestBed@@QAEXXZ @ 37 NONAME ; void MmsTestBed::deleteSendSchedule(void)
+ ?fetchForcedImmediate@MmsTestBed@@QAEXXZ @ 38 NONAME ; void MmsTestBed::fetchForcedImmediate(void)
+ ?sendFromFile@MmsTestBed@@QAEXXZ @ 39 NONAME ; void MmsTestBed::sendFromFile(void)
+ ?createMmsService@MmsTestBed@@AAEXXZ @ 40 NONAME ; void MmsTestBed::createMmsService(void)
+ ?replyToAll@MmsTestBed@@QAEXXZ @ 41 NONAME ; void MmsTestBed::replyToAll(void)
+ ?cancelFetchScheduling@MmsTestBed@@QAEXXZ @ 42 NONAME ; void MmsTestBed::cancelFetchScheduling(void)
+ ?cleanOutbox@MmsTestBed@@QAEXXZ @ 43 NONAME ; void MmsTestBed::cleanOutbox(void)
+ ?sendOneByOne@MmsTestBed@@QAEXXZ @ 44 NONAME ; void MmsTestBed::sendOneByOne(void)
+ ?forward@MmsTestBed@@QAEXXZ @ 45 NONAME ; void MmsTestBed::forward(void)
+ ?getLogEntries@MmsTestBed@@AAEHXZ @ 46 NONAME ; int MmsTestBed::getLogEntries(void)
+ ?entryCreatedInInbox@MmsTestBed@@IAEXJ@Z @ 47 NONAME ; void MmsTestBed::entryCreatedInInbox(long)
+ ?setConnectionLocal@MmsTestBed@@QAEX_N@Z @ 48 NONAME ; void MmsTestBed::setConnectionLocal(bool)
+ ?generateDeliveryReport@MmsTestBed@@QAEXPAVCMmsHeaders@@@Z @ 49 NONAME ; void MmsTestBed::generateDeliveryReport(class CMmsHeaders *)
+ ?setFetchingState@MmsTestBed@@QAEXW4TMmsReceivingMode@@@Z @ 50 NONAME ; void MmsTestBed::setFetchingState(enum TMmsReceivingMode)
+ ?setOnline@MmsTestBed@@QAEX_N@Z @ 51 NONAME ; void MmsTestBed::setOnline(bool)
+ ?tr@MmsTestBed@@SA?AVQString@@PBD0H@Z @ 52 NONAME ; class QString MmsTestBed::tr(char const *, char const *, int)
+ ?findMMSFolder@MmsTestBed@@AAEJXZ @ 53 NONAME ; long MmsTestBed::findMMSFolder(void)
+ ?deleteEventType@MmsTestBed@@QAEXXZ @ 54 NONAME ; void MmsTestBed::deleteEventType(void)
+ ?staticMetaObject@MmsTestBed@@2UQMetaObject@@B @ 55 NONAME ; struct QMetaObject const MmsTestBed::staticMetaObject
+ ?cleanInbox@MmsTestBed@@QAEXXZ @ 56 NONAME ; void MmsTestBed::cleanInbox(void)
+ ?doAFetchCycle@MmsTestBed@@QAEXXZ @ 57 NONAME ; void MmsTestBed::doAFetchCycle(void)
+ ?cleanLog@MmsTestBed@@QAEXXZ @ 58 NONAME ; void MmsTestBed::cleanLog(void)
+ ?getStaticMetaObject@MmsTestBed@@SAABUQMetaObject@@XZ @ 59 NONAME ; struct QMetaObject const & MmsTestBed::getStaticMetaObject(void)
+ ?messageVariation@MmsTestBed@@QAEXXZ @ 60 NONAME ; void MmsTestBed::messageVariation(void)
+ ?fromOutboxToMmscWithMemoryFailure@MmsTestBed@@QAEHXZ @ 61 NONAME ; int MmsTestBed::fromOutboxToMmscWithMemoryFailure(void)
+ ?cleanup@MmsTestBed@@AAEXXZ @ 62 NONAME ; void MmsTestBed::cleanup(void)
+ ?fromMmscToInboxWithMemoryFailure@MmsTestBed@@QAEHXZ @ 63 NONAME ; int MmsTestBed::fromMmscToInboxWithMemoryFailure(void)
+ ?deleteFetchSchedule@MmsTestBed@@QAEXXZ @ 64 NONAME ; void MmsTestBed::deleteFetchSchedule(void)
+ ?addEventType@MmsTestBed@@QAEXXZ @ 65 NONAME ; void MmsTestBed::addEventType(void)
+ ?sendNotifications@MmsTestBed@@QAEXXZ @ 66 NONAME ; void MmsTestBed::sendNotifications(void)
+ ?trUtf8@MmsTestBed@@SA?AVQString@@PBD0H@Z @ 67 NONAME ; class QString MmsTestBed::trUtf8(char const *, char const *, int)
+ ?scheduledFetch@MmsTestBed@@QAEXH@Z @ 68 NONAME ; void MmsTestBed::scheduledFetch(int)
+ ?cleanSent@MmsTestBed@@QAEXXZ @ 69 NONAME ; void MmsTestBed::cleanSent(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/eabi/mmstestbedu.def Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,72 @@
+EXPORTS
+ _ZN10MmsTestBed10cleanInboxEv @ 1 NONAME
+ _ZN10MmsTestBed10copyDraftsEv @ 2 NONAME
+ _ZN10MmsTestBed10replyToAllEv @ 3 NONAME
+ _ZN10MmsTestBed11cleanDraftsEv @ 4 NONAME
+ _ZN10MmsTestBed11cleanOutboxEv @ 5 NONAME
+ _ZN10MmsTestBed11createEntryER9TMsvEntryR9CMsvEntry @ 6 NONAME
+ _ZN10MmsTestBed11deleteEntryElR9CMsvEntry @ 7 NONAME
+ _ZN10MmsTestBed11fetchForcedEi @ 8 NONAME
+ _ZN10MmsTestBed11qt_metacallEN11QMetaObject4CallEiPPv @ 9 NONAME
+ _ZN10MmsTestBed11qt_metacastEPKc @ 10 NONAME
+ _ZN10MmsTestBed12addEventTypeEv @ 11 NONAME
+ _ZN10MmsTestBed12findDefaultLEv @ 12 NONAME
+ _ZN10MmsTestBed12getEventTypeEv @ 13 NONAME
+ _ZN10MmsTestBed12sendFromFileEv @ 14 NONAME
+ _ZN10MmsTestBed12sendOneByOneEv @ 15 NONAME
+ _ZN10MmsTestBed13doAFetchCycleEv @ 16 NONAME
+ _ZN10MmsTestBed13findMMSFolderEv @ 17 NONAME
+ _ZN10MmsTestBed13getLogEntriesEv @ 18 NONAME
+ _ZN10MmsTestBed13scheduledSendEli @ 19 NONAME
+ _ZN10MmsTestBed13sendViaClientEv @ 20 NONAME
+ _ZN10MmsTestBed14checkLogClientEv @ 21 NONAME
+ _ZN10MmsTestBed14scheduledFetchEi @ 22 NONAME
+ _ZN10MmsTestBed14sendReadReportEv @ 23 NONAME
+ _ZN10MmsTestBed15deleteEventTypeEv @ 24 NONAME
+ _ZN10MmsTestBed15fromMmscToInboxEv @ 25 NONAME
+ _ZN10MmsTestBed16createMmsServiceEv @ 26 NONAME
+ _ZN10MmsTestBed16entryMovedToSentEl @ 27 NONAME
+ _ZN10MmsTestBed16fromOutboxToMmscEv @ 28 NONAME
+ _ZN10MmsTestBed16messageVariationEv @ 29 NONAME
+ _ZN10MmsTestBed16setFetchingStateE17TMmsReceivingMode @ 30 NONAME
+ _ZN10MmsTestBed16staticMetaObjectE @ 31 NONAME DATA 16
+ _ZN10MmsTestBed17garbageCollectionEm @ 32 NONAME
+ _ZN10MmsTestBed17sendNotificationsEv @ 33 NONAME
+ _ZN10MmsTestBed18deleteSendScheduleEv @ 34 NONAME
+ _ZN10MmsTestBed18entryMovedToOutboxEl @ 35 NONAME
+ _ZN10MmsTestBed18sendDeliveryReportEv @ 36 NONAME
+ _ZN10MmsTestBed18setConnectionLocalEb @ 37 NONAME
+ _ZN10MmsTestBed19HandleSessionEventLEN19MMsvSessionObserver16TMsvSessionEventEPvS2_S2_ @ 38 NONAME
+ _ZN10MmsTestBed19deleteFetchScheduleEv @ 39 NONAME
+ _ZN10MmsTestBed19deleteNotificationsEv @ 40 NONAME
+ _ZN10MmsTestBed19entryCreatedInDraftEl @ 41 NONAME
+ _ZN10MmsTestBed19entryCreatedInInboxEl @ 42 NONAME
+ _ZN10MmsTestBed19getStaticMetaObjectEv @ 43 NONAME
+ _ZN10MmsTestBed20addMMBoxDescriptionsEv @ 44 NONAME
+ _ZN10MmsTestBed20cancelSendSchedulingEv @ 45 NONAME
+ _ZN10MmsTestBed20fetchForcedImmediateEv @ 46 NONAME
+ _ZN10MmsTestBed21cancelFetchSchedulingEv @ 47 NONAME
+ _ZN10MmsTestBed22generateDeliveryReportEP11CMmsHeaders @ 48 NONAME
+ _ZN10MmsTestBed22restoreFactorySettingsEv @ 49 NONAME
+ _ZN10MmsTestBed23encodeMessageFromDraftsEv @ 50 NONAME
+ _ZN10MmsTestBed26cleanupAndCreateNewServiceEv @ 51 NONAME
+ _ZN10MmsTestBed32fromMmscToInboxWithMemoryFailureEv @ 52 NONAME
+ _ZN10MmsTestBed33fromOutboxToMmscWithMemoryFailureEv @ 53 NONAME
+ _ZN10MmsTestBed5replyEv @ 54 NONAME
+ _ZN10MmsTestBed7cleanupEv @ 55 NONAME
+ _ZN10MmsTestBed7forwardEv @ 56 NONAME
+ _ZN10MmsTestBed8cleanAllEv @ 57 NONAME
+ _ZN10MmsTestBed8cleanLogEv @ 58 NONAME
+ _ZN10MmsTestBed8testFileER4TBufILi256EEil @ 59 NONAME
+ _ZN10MmsTestBed9cleanSentEv @ 60 NONAME
+ _ZN10MmsTestBed9setOnlineEb @ 61 NONAME
+ _ZN10MmsTestBedC1Ev @ 62 NONAME
+ _ZN10MmsTestBedC2Ev @ 63 NONAME
+ _ZN10MmsTestBedD0Ev @ 64 NONAME
+ _ZN10MmsTestBedD1Ev @ 65 NONAME
+ _ZN10MmsTestBedD2Ev @ 66 NONAME
+ _ZNK10MmsTestBed10metaObjectEv @ 67 NONAME
+ _ZTI10MmsTestBed @ 68 NONAME
+ _ZTV10MmsTestBed @ 69 NONAME
+ _ZThn8_N10MmsTestBed19HandleSessionEventLEN19MMsvSessionObserver16TMsvSessionEventEPvS2_S2_ @ 70 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/inc/mmsreadfile.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,471 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSREADFILE_H
+#define MMSREADFILE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <f32file.h>
+#include <msvstd.h>
+
+// forward references
+class CMmsAttaStructure;
+class CMmsHeaders;
+class CEikonEnv;
+class CMmsClientMtm;
+
+// Out-of-range value for any MMS header with assigned number
+// Used in coverage tests to get coverage for "default" branches
+// in "case" statements.
+const TInt KMmsTestIllegalValue = 255;
+
+//
+// TEST KEY WORDS
+// Extended to include all MMS headers to allow generation of arbitrary PDUs
+// Content type header cannot be separately defined,
+// it will always be "multipat/mixed" or "multipart/related"
+_LIT8( KTestEndOfFile, "EOF" );
+_LIT8( KTestNewMessage, "MESSAGE BEGIN" );
+//------------------------------------------------
+_LIT8( KTestMessageType, "MESSAGE-TYPE" ); //X-Mms-Message-Type
+_LIT8( KTestDate, "DATE" ); // Date
+_LIT8( KTestFrom, "FROM" ); // From
+_LIT8( KTestTo, "TO" ); // To
+_LIT8( KTestCc, "CC" ); // Cc
+_LIT8( KTestBcc, "BCC" ); // Bcc
+_LIT8( KTestSubject, "SUBJECT" ); // Subject
+_LIT8( KTestExpiryRel, "EXPIRY-REL" ); // X-Mms-Expiry, relative
+_LIT8( KTestExpiryAbs, "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
+_LIT8( KTestDeliveryTimeRel, "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
+_LIT8( KTestDeliveryTimeAbs, "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
+_LIT8( KTestPriority, "PRIORITY" ); // X-Mms-Priority
+_LIT8( KTestSenderVisibility, "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
+_LIT8( KTestDeliveryReport, "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
+_LIT8( KTestReadReply, "READ-REPLY" ); // X-Mms-Read-Report
+// ---------------------------------------------------
+_LIT8( KTestNewAttachment, "ATTACHMENT" );
+_LIT8( KTestAttachmentType, "ATTACHMENTTYPE" );
+_LIT8( KTestAttachmentName, "ATTACHMENTNAME" );
+_LIT8( KTestAttachmentContLoc, "ATTACHMENTCONTLOC" );
+_LIT8( KTestAttachmentCharset, "ATTACHMENTCHARSET" );
+_LIT8( KTestAttachmentCid, "ATTACHMENTCID" );
+_LIT8( KTestAttachmentRoot, "ATTACHMENTROOT" );
+// content-type and x-type parameters for attachments
+// should appear in name-value pairs.
+// Test program is not responsible for verifying illegal scripts
+_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
+_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
+_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
+_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
+// -----------------------------------------------------
+_LIT8( KTestMessageClass, "MESSAGE-CLASS" ); // X-Mms-Message-Class
+_LIT8( KTestDelivRepSendAllow, "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
+_LIT8( KTestAcceptAdvertis, "ACCEPT-ADVERTISEMENTS" );
+_LIT8( KTestRetryCount, "RETRY-COUNT" );
+_LIT8( KTestRetryInterval, "RETRY-INTERVAL" );
+// -------------------------------------------------
+_LIT8( KTestAlias, "ALIAS" );
+_LIT8( KTestFromAlias, "FROMALIAS" );
+_LIT8( KTestToAlias, "TOALIAS" );
+_LIT8( KTestCcAlias, "CCALIAS" );
+_LIT8( KTestBccAlias, "BCCALIAS" );
+// -------------------------------------------------
+// more Message headers to allow testing all possible PDUs and
+// MMS 1.1 headers
+_LIT8( KTestReplyCharging, "REPLY-CHARGING" ); // X-Mms-Reply-Charging
+_LIT8( KTestReplyChargAbs, "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
+_LIT8( KTestReplyChargRel, "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
+_LIT8( KTestReplyChargSize, "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
+_LIT8( KTestReplyChargID, "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
+_LIT8( KTestTID, "TID" );
+_LIT8( KTestContentLocation, "CONTLOC" ); // X-Mms-Content-Location
+// The following three must appear as triplets.
+// index must be first, address and date may appear in any order
+_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
+_LIT8( KTestPreviouslySentBy, "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
+_LIT8( KTestPreviouslySentDate, "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
+//---
+_LIT8( KTestMessageId, "MESSAGE-ID" ); // Message-ID
+_LIT8( KTestMessageSize, "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
+_LIT8( KTestVersion, "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
+_LIT8( KTestReadStatus, "READ-STATUS" ); // X-Mms-Read-Status
+_LIT8( KTestResponseStatus, "RESPONSE-STATUS" ); // X-Mms-Response-Status
+_LIT8( KTestResponseText, "RESPONSE-TEXT" ); // X-Mms-Response-Text
+_LIT8( KTestRetrieveStatus, "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
+_LIT8( KTestRetrieveText, "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
+_LIT8( KTestStatus, "STATUS" ); // X-Mms-Status
+// -------------------------------------------------
+// MMS 1.2 headers
+_LIT8( KTestAttribute, "ATTRIBUTE" ); // X-Mms-Attribute
+// The value should be one of the following:
+// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
+// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
+// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
+// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
+// PREV-SENT-DATE, ADDITIONAL-HEADERS
+_LIT8( KTestDistributionIndicator, "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
+_LIT8( KTestLimit, "LIMIT" ); // X-Mms-Limit
+_LIT8( KTestMessageQuota, "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
+_LIT8( KTestSizeQuota, "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
+_LIT8( KTestMessageTotal, "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
+_LIT8( KTestSizeTotal, "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
+_LIT8( KTestMessageCount, "MESSAGE-COUNT" ); // X-Mms-Message-Count
+_LIT8( KTestAddKeyword, "ADD-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestRemoveKeyword, "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestFilterKeyword, "FILTER-KEYWORD" ); // X-Mms-MM-FLags
+_LIT8( KTestMMState, "MESSAGE-STATE" ); // X-Mms-MM-State
+_LIT8( KTestQuota, "QUOTA" ); // X-Mms-Quotas
+_LIT8( KTestStart, "START" ); // X-Mms-Start
+_LIT8( KTestStore, "STORE" ); // X-Mms-Store
+_LIT8( KTestStored, "STORED" ); // X-Mms-Stored
+_LIT8( KTestStoreStatus, "STORE-STATUS" ); // X-Mms-Store-Status
+_LIT8( KTestStoreStatusText, "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
+_LIT8( KTestTotals, "TOTALS" ); // X-Mms-Totals
+// Delete confirmation header structure
+// This consists of index, content location, response status and response status text.
+// All three values are not always necessary for each index, but at least content-location
+// and response status should be present.
+// The index retains its value until a new index is encountered.
+_LIT8( KTestDeleteInfoIndex, "DELETESTATUSINDEX" ); // index for next delete info fields
+// This header must precede content-location, response-status and response-text fields
+// in a delete confirmation. Index retains its value until a new index is encountered.
+
+// Element descriptor header not implemented
+
+// Application id headers
+// These will officially be supported in MMS encapsulation version 1.3
+// Java has non-standard support even earlier
+
+_LIT8( KTestApplicId, "APPLIC-ID" ); // X-Mms-Applic-ID
+_LIT8( KTestReplyApplicId, "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
+_LIT8( KTestApplicInfo, "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
+
+// Since Encapsulation 1.3
+_LIT8( KTestContentClass, "CONTENT-CLASS" ); // X-Mms-Content-Class
+_LIT8( KTestDrmContent, "DRM-CONTENT" ); // X-Mms-DRM-Content
+_LIT8( KTestAdaptationAllowed, "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
+_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
+_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
+_LIT8( KTestReplaceId, "REPLACE-ID" ); // X-Mms-Replace-ID
+_LIT8( KTestStatusText, "STATUS-TEXT" ); // X-Mms-Status-Text
+_LIT8( KTestCancelId, "CANCEL-ID" ); // X-Mms-Cancel-ID
+_LIT8( KTestCancelStatus, "CANCEL-STATUS" ); // X-Mms-Cancel-Status
+
+// DATA TYPES
+#define aSet 1
+#define aReset 0
+#define PartCount 100
+#define MaxAttaCount 10
+#define DefaultBufLen 256
+#define MaxRecipients 5
+
+// status returned by ReadRow
+enum TTestReadStatus
+ {
+ ETestUnknown,
+ ETestNewMessage,
+ ETestNewAttachment,
+ ETestEof, // End of file
+ ETestMessageType,
+ ETestDate,
+ ETestFrom,
+ ETestTo,
+ ETestCc,
+ ETestBcc,
+ ETestAlias,
+ ETestFromAlias,
+ ETestToAlias,
+ ETestCcAlias,
+ ETestBccAlias,
+ ETestSubject,
+ ETestExpiryRel,
+ ETestExpiryAbs,
+ ETestDeliveryTimeRel,
+ ETestDeliveryTimeAbs,
+ ETestPriority,
+ ETestSenderVisibility,
+ ETestDeliveryReport,
+ ETestReadReply,
+ ETestAttachmentType,
+// ETestAttachmentName,
+ ETestAttachmentCharset,
+ ETestAttachmentCid,
+ ETestAttachmentRoot,
+ ETestSettings,
+ ETestMessageClass,
+ ETestDelivReportSendAllow,
+ ETestSingleMessageClass,
+ ETestReplyCharging,
+ ETestReplyChargAbs,
+ ETestReplyChargRel,
+ ETestReplyChargSize,
+ ETestReplyChargID,
+ ETestTID,
+ ETestContentLocation,
+ ETestPreviouslySentIndex,
+ ETestPreviouslySentBy,
+ ETestPreviouslySentDate,
+ ETestMessageId,
+ ETestMessageSize,
+ ETestVersion,
+ ETestReadStatus,
+ ETestResponseStatus,
+ ETestResponseText,
+ ETestRetrieveStatus,
+ ETestRetrieveText,
+ ETestStatus,
+ ETestAttribute,
+ ETestDistributionIndicator,
+ ETestLimit,
+ ETestMessageQuota,
+ ETestSizeQuota,
+ ETestMessageTotal,
+ ETestSizeTotal,
+ ETestMessageCount,
+ ETestAddKeyword,
+ ETestRemoveKeyword,
+ ETestFilterKeyword,
+ ETestMMState,
+ ETestQuota,
+ ETestStart,
+ ETestStore,
+ ETestStored,
+ ETestStoreStatus,
+ ETestStoreStatusText,
+ ETestTotals,
+ ETestDeleteInfoIndex,
+ ETestApplicId,
+ ETestReplyApplicId,
+ ETestApplicInfo,
+ ETestContentClass,
+ ETestDrmContent,
+ ETestAdaptationAllowed,
+ ETestRecommendedRetrievalMode,
+ ETestRecRetrievalModeText,
+ ETestReplaceId,
+ ETestStatusText,
+ ETestCancelId,
+ ETestCancelStatus,
+ ETestAttaRecommendedName,
+ ETestAttachmentContLoc,
+ ETestAttContTypeParamName,
+ ETestAttContTypeParamValue,
+ ETestAttXTypeParamName,
+ ETestAttXTypeParamValue
+
+ };
+
+// VALUE KEYWORDS
+_LIT( KPersonal, "Personal" );
+_LIT( KAdvertisement, "Advertisement" );
+_LIT( KInformational, "Informational" );
+_LIT( KAuto, "Auto" );
+_LIT( KLow, "Low" );
+_LIT( KNormal, "Normal" );
+_LIT( KHigh, "High" );
+_LIT( KHide, "Hide" );
+_LIT( KShow, "Show" );
+_LIT( KYes, "Yes" );
+_LIT( KNo, "No" );
+_LIT( KOn, "On" );
+_LIT( KOff, "Off" );
+_LIT( KDeferred, "Deferred" );
+_LIT( KExpired, "Expired" );
+_LIT( KRetrieved, "Retrieved" );
+_LIT( KRejected, "Rejected" );
+_LIT( KUnrecognized, "Unrecognized" );
+_LIT( KIndeterminate, "Indeterminate" );
+_LIT( KForwarded, "Forwarded" );
+_LIT( KUnreachable, "Unreachable" );
+_LIT( KDraft, "Draft");
+_LIT( KSent, "Sent" );
+_LIT( KNew, "New" );
+// X-Mms-Message-Type
+_LIT( KSendReq, "SendReq" );
+_LIT( KSendConf, "SendConf" );
+_LIT( KNotifInd, "NotifInd" );
+_LIT( KNotifResp, "NotifResp" );
+_LIT( KRetrConf, "RetrConf" );
+_LIT( KAckInd, "AckInd" );
+_LIT( KDelInd, "DelInd" );
+_LIT( KReadReqInd, "ReadReqInd" );
+_LIT( KReadOrigInd, "ReadOrigInd" );
+_LIT( KForwardRec, "ForwardReq" );
+_LIT( KForwardConf, "ForwardConf" );
+_LIT( KMBoxStoreReq, "MBoxStoreReq" );
+_LIT( KMBoxStoreConf, "MBoxStoreConf" );
+_LIT( KMBoxViewReq, "MBoxViewReq" );
+_LIT( KMBoxViewConf, "MBoxViewConf" );
+_LIT( KMBoxUploadReq, "MBoxUploadReq" );
+_LIT( KMBoxUploadConf, "MBoxUploadConf" );
+_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
+_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
+_LIT( KMBoxDescr, "MBoxDescr" );
+_LIT( KDeleteReq, "DeleteReq" );
+_LIT( KDeleteConf, "DeleteConf" );
+_LIT( KCancelReq, "CancelReq" );
+_LIT( KCancelResp, "CancelConf" );
+// X-Mms-Read-Status
+_LIT( KRead, "Read" );
+_LIT( KDelNotRead, "DeletedNotRead" );
+// X-Mms-Reply-Charging
+_LIT( KRequested, "Requested" );
+_LIT( KReqTextOnly, "ReqTextOnly" );
+_LIT( KAccepted, "Accepted" );
+_LIT( KAccTextOnly, "AccTextOnly" );
+// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
+_LIT( KCancelSuccessful, "CancelSuccess" );
+_LIT( KCancelCorrupted, "CancelCorrupted" );
+// X-Mms-Content-Class
+_LIT( KText, "Text" );
+_LIT( KImageBasic, "ImageBasic" );
+_LIT( KImageRich, "ImageRich" );
+_LIT( KVideoBasic, "VideoBasic" );
+_LIT( KVideoRich, "VideoRich" );
+_LIT( KMegaPixel, "MegaPixel" );
+_LIT( KContentBasic, "ContentBasic" );
+_LIT( KContentRich, "ContentRich" );
+// X-Mms-Recommended-Retrieval-Mode
+_LIT( KManual, "Manual" );
+
+//X-Mms-ResponseStatus
+// legacy values
+_LIT( KOk, "OK" );
+_LIT( KErrUnspecified, "Unspecified" );
+_LIT( KErrServiceDenied, "ServiceDenied" );
+_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
+_LIT( KErrAddressUnresolved, "AddressUnresolved" );
+_LIT( KErrMessageNotFound, "MessageNotFound" );
+_LIT( KErrNetworkProblem, "NetworkProblem" );
+_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
+_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
+// values since 1.1 (and 1.2)
+_LIT( KErrTransient, "TransientFailure" );
+_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
+_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
+_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
+_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
+_LIT( KErrPermanent, "PermanentFailure" );
+_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
+_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
+_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
+_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
+_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
+_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
+_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
+_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
+_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
+_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
+_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
+//X-Mms-RetrieveStatus (one extra value)
+_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
+//X-Mms-Store-Status (one extra value)
+_LIT( KErrMMBoxFull, "MMBoxFull" );
+
+_LIT8( KTestContent, "Content" ); // For attribute list only
+_LIT8( KTestAdditionalHeaders, "ADDITIONAL-HEADERS" ); // For attribute list only
+_LIT8( KTestDeliveryTime, "DELIVERY-TIME"); // for attribute list only
+_LIT8( KTestExpiry, "EXPIRY"); // for attribute list only
+_LIT8( KTestReplyCharg, "REPLY-CHARG-DEADLINE" ); // for attribute list only
+_LIT8( KTestContentType, "CONTENT-TYPE" ); // for attribute list only
+
+/**
+* CMmsReadFile
+*/
+NONSHARABLE_CLASS( CMmsReadFile ):public CBase
+ {
+ public: // Constructors and destructor
+
+ static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
+ virtual ~CMmsReadFile(); // Destructor
+
+ public: // New functions
+
+ TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
+ TTestReadStatus ReadRowL();
+ void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
+ TInt FindAlias(TPtrC alias);
+ void SetAttaStructure( TBool aOldAttaStructure = EFalse );
+
+ protected: // Functions from base classes
+
+ private:
+
+ CMmsReadFile(); // C++ default constructor.
+ // By default constructor is private.
+ void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
+ void Reset();
+
+ public: // data
+ TInt iMessageType;
+
+
+ private: // Data
+
+ RFs iFs;
+ RFileReadStream* iReader;
+ TBuf<DefaultBufLen> iValueBuffer;
+ CDesCArray* iAliasArray; // aliases
+ HBufC8* iByteBuffer;
+ TTime iDate;
+ CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
+ TInt iAttaCount;
+ TInt iAttaRoot;
+ TInt iAliasCount;
+ TInt iNextMessageType;
+ TParse iParse;
+ TFileName iFilename;
+
+ protected: // Data
+ private: // Data
+
+ // CArrayFixFlat <TestMessage>* iMessages;
+
+ public: // Friend classes
+ protected: // Friend classes
+ private: // Friend classes
+
+ };
+
+
+NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
+ {
+ public: // Constructors and destructor
+ static CMmsAttaStructure* NewL(); // Two-phased constructor.
+ virtual ~CMmsAttaStructure(); // Destructor
+ private:
+ CMmsAttaStructure(); // C++ default constructor.
+ // By default constructor is private.
+ void ConstructL();
+
+ public: // Data
+ HBufC8* iAtta;
+ HBufC8* iAttaName; // content location
+ HBufC8* iAttaType;
+ HBufC8* iAttaCid;
+ TInt iAttaCharset;
+ HBufC* iAttaRecommendedName; // recommended filename
+ CDesC8ArrayFlat* iContentTypeParams; // zero or more "parameter"
+ CDesC8ArrayFlat* iXTypeParams; // zero or more X-Type "parameters"
+
+ };
+
+
+#endif // MMSREADFILE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/inc/mmstestbed.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSTESTBED_H
+#define MMSTESTBED_H
+
+#ifdef BUILD_MMSTESTBED_DLL
+#define MMSTESTBED_EXPORT Q_DECL_EXPORT
+#else
+#define MMSTESTBED_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <QString>
+
+#include <msvids.h> //for consts like KMsvNullIndexEntryIdValue
+#include <MSVAPI.H>
+#include <MTCLREG.H>
+#include <mmsclient.h>
+//#include <mmsservercommon.h>
+
+class CTestUiTimer;
+class CMsvSession;
+class CMmsClientMtm;
+class CMmsSettings;
+class CMmsHeaders;
+class CLogEvent;
+class CLogViewEvent;
+class CLogFilter;
+class CLogClient;
+
+class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
+ {
+ Q_OBJECT
+
+public:
+ /**
+ *
+ */
+ MmsTestBed();
+ ~MmsTestBed();
+ void setConnectionLocal(bool value);
+ void fromOutboxToMmsc();
+ void fromMmscToInbox();
+ /**
+ * cleanup MMS service
+ */
+ void cleanupAndCreateNewService();
+ void deleteNotifications();
+ void restoreFactorySettings();
+ void setFetchingState( TMmsReceivingMode aState );
+ void sendFromFile();
+ void sendOneByOne();
+ void sendNotifications();
+ void copyDrafts();
+ void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
+ void messageVariation();
+ void cancelSendScheduling();
+ void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
+ void deleteSendSchedule();
+ void cancelFetchScheduling();
+ void fetchForced(TInt aDelay = 5);
+ void deleteFetchSchedule();
+ void doAFetchCycle();
+ void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
+ void cleanOutbox();
+ void cleanInbox();
+ void cleanSent();
+ void cleanDrafts();
+ void cleanAll();
+ void reply();
+ void replyToAll();
+ void forward();
+ void sendReadReport(); // send a read report
+ int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
+ int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
+ void sendViaClient();
+ void scheduledFetch(TInt aDelay = 5);
+ void fetchForcedImmediate();
+ void getEventType();
+ void addEventType();
+ void deleteEventType();
+ void cleanLog();
+ void setOnline(bool value);
+ void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
+ void sendDeliveryReport();
+
+signals:
+ void entryCreatedInDraft(long int id);
+ void entryMovedToOutbox(long int id);
+ void entryMovedToSent(long int id);
+ void entryCreatedInInbox(long int id);
+
+protected:
+ /**
+ * From MMsvSessionObserver
+ */
+ void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+ TAny* aArg2, TAny* aArg3);
+
+private:
+ void findDefaultL();
+ void createMmsService();
+ void cleanup();
+ void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
+ void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
+ void addMMBoxDescriptions();
+ void encodeMessageFromDrafts();
+ TMsvId findMMSFolder();
+ bool checkLogClient();
+ int getLogEntries();
+
+private:
+ //data
+ CTestUiTimer* iTimer;
+ CMsvOperationActiveSchedulerWait* iWait;
+ CMsvSession* iSession;
+ CClientMtmRegistry* iClientMtmRegistry;
+ CMmsClientMtm* iMmsClient;
+ CMmsSettings* iSettings;
+ CMmsHeaders* iMmsHeaders;
+ TMsvId iServiceId;
+ TMsvId iDefaultServiceId;
+ TMsvSessionEvent iEvent;
+ RFs iFs;
+ TFileName iFilename;
+ TFileName iCurrentFile;
+ TFileName iCurrentPath;
+ TParse iParse; // parse buffer as member to save stack space
+ CBufFlat* iEncodeBuffer;
+ CMsvEntrySelection* iMsvEntrySelection;
+ CLogEvent* iLogEvent;
+ CLogClient* iLogClient;
+ CLogViewEvent* iLogView;
+ CLogFilter* iLogFilter;
+ };
+
+#endif // MMSTESTBED_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/inc/mmstestbed.hrh Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <bldvariant.hrh>
+
+
+#ifndef MMSTESTBED_HRH
+#define MMSTESTBED_HRH
+
+enum
+{
+ EAppMainOk = 1,
+ EAppMainCancel,
+ //
+ EMenufrmCmdCascadeTest,
+ ECleanup,
+ ECleanOutbox,
+ ESaveSettings,
+ ELoadSettings,
+ ECleanInbox,
+ EShowIn,
+ EShowOut,
+ EOutToMMSC,
+ EMMSCToIn,
+ ESendScheduled,
+ EReceiveScheduled,
+ EShowSent,
+ ECleanSent,
+ EStartMyNotifier,
+ EGetEventType,
+ EAddEventType,
+ EDeleteEventType,
+ EViewLog,
+ ECleanLog,
+ EShowWapAccessPoints,
+ ESelectWapAccessPoint,
+ EShowConnectionMode,
+ EShowIAP,
+ EConnectToIAP,
+ EDeleteSendSchedule,
+ EDeleteReceiveSchedule,
+ EDeleteNotifications,
+ ERestoreFactorySettings,
+ ECreateFromFile,
+ EShowNotifications,
+ ESendDeliveryReport,
+ EShowDrafts,
+ ECleanDrafts,
+ ECleanAll,
+ EFetchingDeferred,
+ EFetchingOn,
+ ESendFromFile,
+ ESwitchToLocal,
+ ESwitchToGlobal,
+ EDecodeLoggingOn,
+ EDecodeLoggingOff,
+ EBinaryDumpOn,
+ EBinaryDumpOff,
+ ESendNotification,
+ ECreateToInbox,
+ ECreateToSentItems,
+ ESendFromDrafts,
+ EFindMMSFolder,
+ ESendOneByOne,
+ ECreateToDrafts,
+ ESendViaClient,
+ ESendMemFail,
+ EFetchMemFail,
+ EReceiveForced,
+ ECreateHeadersFromFile,
+ ESwitchToOffline,
+ ESwitchToOnline,
+ ECopyDrafts,
+ ECreateNotification,
+ EReply,
+ EReplyToAll,
+ EForward,
+ EFetchingManual,
+ EFirstBoot,
+ ENoFirstBoot,
+ EFindNetworkStatus,
+ ESendReadReport,
+ ECreateMMBoxViewConf,
+ EGetMMBoxView,
+ ECleanMMBox,
+ EShowMMBox
+};
+
+#define ETestLabel1 1
+#define ETestLabel2 2
+#define ETestLabel3 3
+#define ETestLabel4 4
+
+#define EServiceList 2
+
+
+enum TTestBedDlgCtrlIds
+ {
+ ETestEditField = 1
+ };
+
+enum TEditServiceControls
+ {
+ EFolderLabel = 1,
+ EEditUri
+// EEditServiceFolder,
+// ENameLabel,
+// EEditServiceName,
+// ENumberLabel,
+// EEditServiceNumber
+ };
+
+enum
+ {
+ EFsViewDialogId = 1
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/inc/mmsteststaticutils.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSTESTSTATICUTILS_H
+#define MMSTESTSTATICUTILS_H
+
+#include <e32std.h>
+#include <msvstd.h>
+#include <badesca.h>
+
+#include "mmsconst.h"
+
+class RFs;
+class CMsvSession;
+class CMmsEncode;
+class CMmsHeaders;
+
+#ifdef __WINS__
+_LIT( KRootPath, "c:\\" );
+#else
+// This is removable disk.
+// drive letter should not be hard coded, must be investigated further
+// We use c: for a while for the tests (to be cahnged later)
+_LIT( KRootPath, "c:\\" );
+//_LIT( KRootPath, "e:\\" );
+#endif
+
+// directory where mmbox descriptions are created
+_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
+// directory where created headers are dumped
+_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
+// content type of MMS PDUs
+_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
+
+_LIT( KWild, "*" );
+
+
+/**
+ * joined array structure
+ *
+ */
+NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
+ {
+public:
+ TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
+ TInt MdcaCount() const;
+ TPtrC16 MdcaPoint(TInt aIndex) const;
+private:
+ CDesCArray* const & iArray1;
+ CDesCArray* const & iArray2;
+ };
+
+/**
+ * static utility functions
+ *
+ */
+class TMmsTestUtils
+ {
+
+public:
+
+ /**
+ *
+ */
+ TMmsTestUtils();
+
+ /**
+ * read phone number for sending messages
+ *
+ * @param aFileName full path for filename
+ * @param aFs file system handle
+ * @return allocated pointer containing the name
+ * The caller must delete the pointer when no longer needed
+ */
+ static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
+
+ static void DecodeLoggingOnL();
+ static void DecodeLoggingOffL();
+ static void BinaryDumpOnL();
+ static void BinaryDumpOffL();
+
+ /**
+ * Clean all temporary directories used in local mode.
+ * Does not delete the directories, only the contents
+ *
+ * @param aFs file system handle
+ */
+ static void CleanDirectoryL( RFs& aFs );
+
+ /**
+ * Dump a binary message
+ *
+ * @param aBuffer buffer containing the binary message
+ * @param aFilename full path of the directory whenre the dump goes
+ * @param aParse reference to parser (to save stack space)
+ * @param aFs file system handle
+ */
+ static void Dump(
+ CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
+
+ /**
+ * Delete all MMS messages and notifications from a given folder
+ *
+ * @param aBoxId folder id
+ * @param aSession Messaging server session
+ */
+ static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
+
+ /**
+ * turn on logging messages sent to email addresses
+ */
+ static void EmailLoggingOnL();
+
+ /**
+ * turn off logging messages sent to email addresses
+ */
+ static void EmailLoggingOffL();
+
+ /**
+ * load list of children into selection and return count
+ *
+ * @param aBoxId folder id
+ * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
+ * caller is responsible of deleting the pointer afterwards.
+ * Pointer may be NULL at entry, and a new pointer will be allocated
+ * @param aSession messge server session
+ * @param aMessageType child MTM type, default is multimedia message
+ * @return number of entries in selection
+ */
+ static TInt CountChildrenL(
+ TMsvId aBoxId,
+ CMsvEntrySelection*& aMsvEntrySelection,
+ CMsvSession& aSession,
+ TUid aMessageType = KUidMsgTypeMultimedia);
+
+ /**
+ * Create a folder entry
+ *
+ * @param aSession messge server session
+ * @param aParentFolder the parent folder
+ * @param aFolderName name of the folder
+ * @param aFolderId will contain the if of the new folder if creation was successful
+ */
+ static void CreateFolderEntryL(
+ CMsvSession& aSession,
+ TMsvId aParentFolder,
+ const TDesC& aFolderName,
+ TMsvId& aFolderId );
+
+ /**
+ * Create an MMS notification from data in buffer
+ * @param aNotificationFolder mms notification folder (target folder)
+ * @param aServiceId id of MMS service
+ * @param aEncodeBuffer buffer that contains the data
+ * @param aSession message server session
+ * @return id of the created notification
+ */
+ static TMsvId CreateNotificationEntryL(
+ TMsvId aNotificationFolder,
+ TMsvId aServiceId,
+ CBufFlat* aEncodeBuffer,
+ CMsvSession& aSession );
+
+ /**
+ * Encode an MMS notification into buffer
+ * @param aUrl url of the notification for local messages a filepath
+ * @param aSize size of the message
+ * @param aMmsHeaders MMS headers structure for creating the notification
+ * @param aMmsEncoder reference to CMmsEncode class
+ * @param aEncodeBuffer flat buffer that will contain the encoded notification
+ */
+ static void FormNotification(
+ TDesC8& aUrl,
+ TInt aSize,
+ CMmsHeaders& aMmsHeaders,
+ CMmsEncode& aMmsEncoder,
+ CBufFlat* aEncodeBuffer );
+
+
+ static TBool IsDrive(const TDesC& aFileName);
+ static TBool IsDir(const TDesC& aFileName, RFs& aFs);
+ static TBool IsFile(const TDesC& aFileName, RFs& aFs);
+
+
+private:
+
+ };
+
+
+#endif // MMSTESTSTATICUTILS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/inc/mmstestuitimer.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef C_TESTUITIMER_H
+#define C_TESTUITIMER_H
+
+
+#include <e32base.h>
+
+#define KPeriod 10000 // period of timer
+
+/**
+ * timer for test programs
+ */
+NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
+ {
+public:
+
+ static CTestUiTimer* NewL();
+ virtual ~CTestUiTimer();
+
+ void RunL();
+ void DoCancel();
+ void ConstructL();
+ void IssueRequest();
+ void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
+
+private:
+ CTestUiTimer();
+
+public:
+ TTimeIntervalMicroSeconds32 period;
+
+private: // data
+ CActive* iObject;
+ };
+
+#endif // C_TESTUITIMER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/mmstestbed.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,97 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+QT += testlib
+QT -= gui
+
+TEMPLATE = lib
+
+CONFIG += hb
+#CONFIG += qtestlib
+CONFIG += symbian_test
+TARGET = mmstestbed
+
+INCLUDEPATH += .
+INCLUDEPATH += inc
+INCLUDEPATH += ../../../inc
+
+INCLUDEPATH += ../../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmsserver/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../inc
+INCLUDEPATH += ../../../../../../mmsengine/mmsengine/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmshttptransport/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsconninit/inc
+#INCLUDEPATH += ../../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsserver/inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_MMSTESTBED_DLL
+
+SOURCES += src/mmstestbed.cpp \
+ src/mmsteststaticutils.cpp \
+ src/mmsreadfile.cpp \
+ src/mmstestuitimer.cpp
+
+HEADERS += inc/mmstestbed.h \
+ inc/mmsteststaticutils.h \
+ inc/mmsreadfile.h \
+ inc/mmstestuitimer.h \
+ inc/mmstestbed.hrh
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+defBlock = \
+ "$${LITERAL_HASH}if defined(EABI)" \
+ "DEFFILE eabi/mmstestbedu.def" \
+ "$${LITERAL_HASH}else" \
+ "DEFFILE bwins/mmstestbedu.def" \
+ "$${LITERAL_HASH}endif"
+
+
+symbian {
+ TARGET.UID3 = 0xE5c588a1
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.EPOCSTACKSIZE = 0x8000
+ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+ TARGET.EPOCALLOWDLLDATA = 1
+ VENDORID = VID_DEFAULT
+ }
+
+# Build.inf rules
+BLD_INF_RULES.prj_exports += \
+ "$${LITERAL_HASH}include <platform_paths.hrh>"
+
+LIBS += -lmsgs \
+ -lmmsmessage \
+ -lmmsconninit \
+ -lmmscodec \
+ -lmmsserversettings \
+ -lcentralrepository \
+ -lapparc \
+ -lbafl \
+ -lefsrv \
+ -lesock \
+ -lestor \
+ -leuser \
+ -llogcli \
+ -llogwrap \
+ -lapgrfx \
+ -lapmime
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/src/mmsreadfile.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,1799 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <badesca.h>
+#include <e32def.h>
+#include <s32file.h>
+#include <msvids.h>
+#include <mtmdef.h>
+//#include <eikenv.h>
+#include <apgcli.h>
+#include <CMsvMimeHeaders.h>
+#include <AknNoteWrappers.h>
+
+#include <mmsservercommon.h>
+#include "mmsconst.h"
+#include "mmsclient.h"
+#include "mmsheaders.h"
+#include "mmsreadfile.h"
+#include "mmsmmboxviewheaders.h"
+#include "mmsmmboxmessageheaders.h"
+#include "mmsmmboxflags.h"
+#include "mmssettings.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KMmsGranularity = 8;
+_LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
+
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// ==================== LOCAL FUNCTIONS ====================
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsReadFile::CMmsReadFile()
+ {
+ // all member variables in a class derived from CBase
+ // are automatically set to 0.
+ }
+
+
+//
+void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
+ {
+ // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
+ iFs = aFs;
+ iReader = &aReadStream;
+ iByteBuffer = HBufC8::NewL( DefaultBufLen );
+ iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
+ iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
+ Reset();
+ }
+
+// Two-phased constructor.
+CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
+ {
+ CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
+ CleanupStack::PushL( self );
+ self->ConstructL( aFs, aReadStream );
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+// Destructor
+CMmsReadFile::~CMmsReadFile()
+ {
+ Reset(); // resets and destroys all array data
+ if (iAliasArray != NULL) iAliasArray->Reset();
+ delete iByteBuffer;
+ delete iAliasArray;
+ delete iAttaStructures;
+ }
+
+void CMmsReadFile::Reset()
+ {
+ // reset all arrays
+ if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
+ iAttaCount = 0;
+ iAttaRoot = 0;
+ }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CompleteTest
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
+{
+ Reset(); // new message
+
+ TUint32 val;
+ TUint limit = 1000000;
+ TUint sizeLimit = 1000 * 1024; //max message size 1000 kB!
+ TUint allLimit = 999999;
+ TInt error;
+ TRadix radix = EDecimal;
+ TLex16 lex;
+ TTestReadStatus readStatus = ETestUnknown;
+ CMmsAttaStructure* oneAtta = NULL;
+ TInt index;
+ TTime y1970( K1970 );
+ TTimeIntervalMicroSeconds interval;
+ TTime date;
+ TInt order = 0;
+ TInt16 shortInteger = 0;
+
+ //iso luuppi, joka kiertää ja lukee kunnes EOF tule vastaan
+ //Big Loop, which passes around and read until the EOF
+
+ iMessageType = iNextMessageType;
+ while(readStatus != ETestEof)
+ {
+ readStatus = ReadRowL();
+ if ( readStatus == ETestEof )
+ {
+ return(-1);
+ }
+ if ( readStatus == ETestUnknown )
+ {
+ // A line containing only comments, or an unknown tag
+ // As using the scripts to test settings is no longer supported,
+ // any old keywords used to test CMmsSettings class are ignored
+ continue;
+ }
+ if( readStatus == ETestNewMessage )
+ {
+ iNextMessageType = readStatus;
+ if(aMessageCounter++)
+ {
+ return(NULL);
+ }
+ else
+ {
+ iMessageType = iNextMessageType;
+ continue;
+ }
+ }
+ if ( iMessageType == ETestNewMessage)
+ {
+ switch(readStatus)
+ {
+ case ETestFrom:
+ aMmsHeaders.SetSenderL( iValueBuffer );
+ break;
+ case ETestFromAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
+ }
+ break;
+ case ETestTo:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
+ break;
+ case ETestToAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
+ }
+ break;
+ case ETestCc:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
+ break;
+ case ETestCcAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
+ }
+ break;
+ case ETestBcc:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
+ break;
+ case ETestBccAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
+ }
+ break;
+ case ETestSubject:
+ aMmsHeaders.SetSubjectL( iValueBuffer );
+ break;
+ case ETestExpiryRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetExpiryInterval( val );
+ }
+ break;
+ case ETestExpiryAbs:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ // expiry date in seconds from 1.1.1970.
+ aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
+ break;
+ case ETestDeliveryTimeRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetDeliveryTimeInterval( val );
+ }
+ break;
+ case ETestDeliveryTimeAbs:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
+ break;
+ case ETestDate:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetDate( (interval.Int64())/1000000 );
+ case ETestPriority:
+ val = 0;
+ if ((iValueBuffer.CompareF(KLow)) == 0)
+ {
+ val = EMmsPriorityLow;
+ }
+ else if ((iValueBuffer.CompareF(KNormal)) == 0)
+ {
+ val = EMmsPriorityNormal;
+ }
+ else if ((iValueBuffer.CompareF(KHigh)) == 0)
+ {
+ val = EMmsPriorityHigh;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessagePriority( val );
+ break;
+ case ETestSenderVisibility:
+ val = 0;
+ if ((iValueBuffer.CompareF(KHide)) == 0)
+ {
+ val = EMmsSenderVisibilityHide;
+ }
+ else if ((iValueBuffer.CompareF(KShow)) == 0)
+ {
+ val = EMmsSenderVisibilityShow;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetSenderVisibility( val );
+ break;
+ case ETestDeliveryReport:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDeliveryReport( val );
+ break;
+ case ETestDelivReportSendAllow:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReportAllowed( val );
+ break;
+
+ case ETestReadReply:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReadReply( val );
+ break;
+ case ETestNewAttachment:
+ oneAtta = CMmsAttaStructure::NewL();
+ iAttaStructures->AppendL(oneAtta);
+ oneAtta->iAtta->Des().Copy( iValueBuffer );
+ iAttaCount++;
+ break;
+ case ETestAttachmentType:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaType->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttachmentContLoc:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaName->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttaRecommendedName:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttachmentCharset:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaCharset = val;
+ }
+ }
+ break;
+ case ETestAttachmentCid:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaCid->Des().Copy(iValueBuffer);
+ }
+ break;
+ case ETestAttContTypeParamName:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttContTypeParamValue:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttXTypeParamName:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttXTypeParamValue:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttachmentRoot:
+ iAttaRoot = iAttaCount;
+ break;
+ case ETestAlias:
+ // all aliases are global even if they appear
+ // in the middle of a message
+ iAliasArray->AppendL( iValueBuffer );
+ iAliasCount++;
+ break;
+ case ETestMessageClass: // should be handled!
+ val = EMmsClassPersonal;
+ if ((iValueBuffer.CompareF(KPersonal)) == 0)
+ {
+ val = EMmsClassPersonal;
+ }
+ else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
+ {
+ val = EMmsClassAdvertisement;
+ }
+ else if ((iValueBuffer.CompareF(KInformational)) == 0)
+ {
+ val = EMmsClassInformational;
+ }
+ else if ((iValueBuffer.CompareF(KAuto)) == 0)
+ {
+ val = EMmsClassAuto;
+ }
+ else
+ {
+ val = (TMmsMessageClass)KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessageClass( val );
+ break;
+ case ETestReplyCharging:
+ val = 0;
+ if ((iValueBuffer.CompareF(KRequested)) == 0)
+ {
+ val = KMmsReplyChargingRequested;
+ }
+ else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
+ {
+ val = KMmsReplyChargingRequestedTextOnly;
+ }
+ else if ((iValueBuffer.CompareF(KAccepted)) == 0)
+ {
+ val = KMmsReplyChargingAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
+ {
+ val = KMmsReplyChargingAcceptedTextOnly;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReplyCharging( val );
+ break;
+ case ETestReplyChargAbs:
+ error = date.Set(iValueBuffer);
+ if ( error == KErrNone )
+ {
+ interval = date.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
+ }
+ break;
+ case ETestReplyChargRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetReplyChargingInterval( val );
+ }
+ break;
+ case ETestReplyChargSize:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,sizeLimit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetReplyChargingSize( val );
+ }
+ break;
+ case ETestReplyChargID:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
+ break;
+ case ETestTID:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetTidL( iByteBuffer->Des() );
+ break;
+ case ETestContentLocation:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
+ {
+ aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
+ }
+ else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
+ }
+ else
+ {
+ aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
+ }
+ break;
+ case ETestPreviouslySentIndex:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ order = val;
+ break;
+ case ETestPreviouslySentBy:
+ aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
+ break;
+ case ETestPreviouslySentDate:
+ error = date.Set(iValueBuffer);
+ if ( error == KErrNone )
+ {
+ interval = date.MicroSecondsFrom( y1970 );
+ aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
+ }
+ break;
+ case ETestMessageId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
+ break;
+ case ETestMessageSize:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,sizeLimit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetMessageSize( val );
+ }
+ break;
+ case ETestVersion:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,EHex,limit);
+ shortInteger = TInt16( val );
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetMmsVersion( shortInteger );
+ }
+ break;
+ case ETestReadStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KRead)) == 0)
+ {
+ val = KMmsReadStatusRead;
+ }
+ else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
+ {
+ val = KMmsReadStatusDeletedWithoutBeingRead;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReadStatus( val );
+ break;
+ case ETestResponseStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
+ {
+ val = KMmsErrorUnspecified;
+ }
+ else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
+ {
+ val = KMmsErrorServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
+ {
+ val = KMmsErrorMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
+ {
+ val = KMmsErrorNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
+ {
+ val = KMmsErrorNoContentAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
+ {
+ val = KMmsErrorUnsupportedMessage;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorTransientSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+ {
+ val = KMmsErrorTransientMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorPermanentMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorPermanentSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorPermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
+ {
+ val = KMmsErrorPermanentContentNotAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingForwardingDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingNotSupported;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
+ {
+ val = KMmsErrorTransientPartialSuccess;
+ }
+ else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
+ {
+ val = KMmsErrorPermanentAddressHidingNotSupported;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteStatusL( order, val );
+ }
+ else
+ {
+ aMmsHeaders.SetResponseStatus( val );
+ }
+ break;
+ case ETestResponseText:
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
+ }
+ else
+ {
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ }
+ break;
+ case ETestRetrieveStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+ {
+ val = KMmsErrorReceiveTransientMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorReceiveTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorReceivePermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
+ {
+ val = KMmsErrorReceivePermanentContentUnsupported;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetResponseStatus( val );
+ break;
+ case ETestRetrieveText:
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ break;
+ case ETestStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KDeferred)) == 0)
+ {
+ val = KMmsMessageStatusDeferred;
+ }
+ else if ((iValueBuffer.CompareF(KExpired)) == 0)
+ {
+ val = KMmsMessageStatusExpired;
+ }
+ else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+ {
+ val = KMmsMessageStatusRetrieved;
+ }
+ else if ((iValueBuffer.CompareF(KRejected)) == 0)
+ {
+ val = KMmsMessageStatusRejected;
+ }
+ else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
+ {
+ val = KMmsMessageStatusUnrecognized;
+ }
+ else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
+ {
+ val = KMmsMessageStatusIndeterminate;
+ }
+ else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+ {
+ val = KMmsMessageStatusForwarded;
+ }
+ else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
+ {
+ val = KMmsMessageStatusUnreachable;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetStatus( val );
+ break;
+ case ETestMessageType:
+ val = 0;
+ if ((iValueBuffer.CompareF(KSendReq)) == 0)
+ {
+ val = KMmsMessageTypeMSendReq;
+ }
+ else if ((iValueBuffer.CompareF(KSendConf)) == 0)
+ {
+ val = KMmsMessageTypeMSendConf;
+ }
+ else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
+ {
+ val = KMmsMessageTypeMNotificationInd;
+ }
+ else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
+ {
+ val = KMmsMessageTypeMNotifyRespInd;
+ }
+ else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
+ {
+ val = KMmsMessageTypeMRetrieveConf;
+ }
+ else if ((iValueBuffer.CompareF(KAckInd)) == 0)
+ {
+ val = KMmsMessageTypeAcknowledgeInd;
+ }
+ else if ((iValueBuffer.CompareF(KDelInd)) == 0)
+ {
+ val = KMmsMessageTypeDeliveryInd;
+ }
+ else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
+ {
+ val = KMmsMessageTypeReadRecInd;
+ }
+ else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
+ {
+ val = KMmsMessageTypeReadOrigInd;
+ }
+ else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
+ {
+ val = KMmsMessageTypeForwardReq;
+ }
+ else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
+ {
+ val = KMmsMessageTypeForwardConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
+ {
+ val = KMmsMessageTypeMboxStoreReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
+ {
+ val = KMmsMessageTypeMboxStoreConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
+ {
+ val = KMmsMessageTypeMboxViewReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
+ {
+ val = KMmsMessageTypeMboxViewConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
+ {
+ val = KMmsMessageTypeMBoxUploadReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
+ {
+ val = KMmsMessageTypeMBoxUploadConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDeleteReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDeleteConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDescr;
+ }
+ else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
+ {
+ val = KMmsMessageTypeDeleteReq;
+ }
+ else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
+ {
+ val = KMmsMessageTypeDeleteConf;
+ }
+ else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
+ {
+ val = KMmsMessageTypeCancelReq;
+ }
+ else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
+ {
+ val = KMmsMessageTypeCancelConf;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessageType( val );
+ break;
+ case ETestAttribute:
+ val = 0;
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
+ {
+ val = KMmsAssignedBcc;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
+ {
+ val = KMmsAssignedCc;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
+ {
+ val = KMmsAssignedContent;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
+ {
+ val = KMmsAssignedContentType;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
+ {
+ val = KMmsAssignedDate;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
+ {
+ val = KMmsAssignedDeliveryReport;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
+ {
+ val = KMmsAssignedDeliveryTime;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
+ {
+ val = KMmsAssignedExpiry;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
+ {
+ val = KMmsAssignedFrom;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
+ {
+ val = KMmsAssignedMessageClass;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
+ {
+ val = KMmsAssignedMessageId;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
+ {
+ val = KMmsAssignedMessageSize;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
+ {
+ val = KMmsAssignedPriority;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
+ {
+ val = KMmsAssignedReadReply;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
+ {
+ val = KMmsAssignedSubject;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
+ {
+ val = KMmsAssignedTo;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
+ {
+ val = KMmsAssignedReplyCharging;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
+ {
+ val = KMmsAssignedReplyChargingID;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
+ {
+ val = KMmsAssignedReplyChargingDeadline;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
+ {
+ val = KMmsAssignedReplyChargingSize;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
+ {
+ val = KMmsAssignedPreviouslySentBy;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
+ {
+ val = KMmsAssignedPreviouslySentDate;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
+ {
+ val = KMmsAssignedAdditionalHeaders;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
+ break;
+ case ETestDistributionIndicator:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDistributionIndicator( val );
+ break;
+ case ETestLimit:
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if( error == KErrNone )
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
+ }
+ break;
+ case ETestMessageQuota:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
+ }
+ break;
+ case ETestSizeQuota:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
+ }
+ break;
+ case ETestMessageTotal:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
+ }
+ break;
+ case ETestSizeTotal:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
+ }
+ break;
+ case ETestMessageCount:
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
+ }
+ break;
+ case ETestAddKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
+ break;
+ case ETestRemoveKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
+ break;
+ case ETestFilterKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
+ break;
+ case ETestMMState:
+ val = 0;
+ if ((iValueBuffer.CompareF(KDraft)) == 0)
+ {
+ val = KMmsDraft;
+ }
+ else if ((iValueBuffer.CompareF(KSent)) == 0)
+ {
+ val = KMmsSent;
+ }
+ else if ((iValueBuffer.CompareF(KNew)) == 0)
+ {
+ val = KMmsNew;
+ }
+ else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+ {
+ val = KMmsRetrieved;
+ }
+ else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+ {
+ val = KMmsForwarded;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
+ }
+ else
+ {
+ aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
+ }
+ break;
+ case ETestQuota:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
+ break;
+ case ETestStart:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
+ }
+ break;
+ case ETestStore:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
+ break;
+ case ETestStored:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
+ break;
+ case ETestStoreStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorStoreStatusTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorPermanentMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorStoreStatusPermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
+ {
+ val = KMmsErrorStoreStatusPermanentMmboxFull;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
+ break;
+ case ETestStoreStatusText:
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
+ break;
+ case ETestTotals:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
+ break;
+
+ case ETestDeleteInfoIndex:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ order = val;
+ break;
+
+ case ETestApplicId:
+ aMmsHeaders.SetApplicIdL( iValueBuffer );
+ break;
+ case ETestReplyApplicId:
+ aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
+ break;
+ case ETestApplicInfo:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
+ break;
+ case ETestContentClass:
+ val = 0;
+ if ((iValueBuffer.CompareF(KText)) == 0)
+ {
+ val = KMmsContentClassText;
+ }
+ else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
+ {
+ val = KMmsContentClassImageBasic;
+ }
+ else if ((iValueBuffer.CompareF(KImageRich)) == 0)
+ {
+ val = KMmsContentClassImageRich;
+ }
+ else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
+ {
+ val = KMmsContentClassVideoBasic;
+ }
+ else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
+ {
+ val = KMmsContentClassVideoRich;
+ }
+ else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
+ {
+ val = KMmsContentClassMegaPixel;
+ }
+ else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
+ {
+ val = KMmsContentClassContentBasic;
+ }
+ else if ((iValueBuffer.CompareF(KContentRich)) == 0)
+ {
+ val = KMmsContentClassContentRich;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetContentClass( val );
+ break;
+ case ETestDrmContent:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDrmContent( val );
+ break;
+ case ETestAdaptationAllowed:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetAdaptationAllowed( val );
+ break;
+ case ETestRecommendedRetrievalMode:
+ val = 0;
+ if ((iValueBuffer.CompareF(KManual)) == 0)
+ {
+ val = KMmsRecommendedRetrievalModeManual;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetRecommendedRetrievalMode( val );
+ break;
+ case ETestRecRetrievalModeText:
+ aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
+ break;
+ case ETestReplaceId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+ break;
+ case ETestStatusText:
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ break;
+ case ETestCancelId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+ break;
+ case ETestCancelStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
+ {
+ val = KMmsCancelRequestSuccessfullyReceived;
+ }
+ else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
+ {
+ val = KMmsCancelRequestCorrupted;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetCancelStatus( val );
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch(readStatus)
+ {
+ case ETestAlias:
+ iAliasArray->AppendL( iValueBuffer );
+ iAliasCount++;
+ break;
+
+ default:
+ break;
+ }
+
+ }
+ }
+ return(-1);
+}
+
+// ---------------------------------------------------------
+// CMmsReadFile()::ReadRowL
+// ---------------------------------------------------------
+//
+TTestReadStatus CMmsReadFile::ReadRowL()
+ {
+
+ TBuf8<DefaultBufLen> RowBuffer;
+ TBuf8<32> KeyBuffer;
+
+ // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
+ TChar delim( 10 );
+ iReader->ReadL( RowBuffer, delim);
+ TInt length = RowBuffer.Length();
+ if ( RowBuffer.Length() < 2 )
+ {
+ return ETestEof;
+ }
+ RowBuffer.Delete(length - 2,2);
+
+ // DROP POSSIBLE COMMENT OUT
+ TInt pos = RowBuffer.Locate( ';' );
+ if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
+
+ if ( RowBuffer.Length() == 0 )
+ {
+ // the line contained only comment
+ return ETestUnknown;
+ }
+
+ // First split the row (:)
+ pos = RowBuffer.Locate( ':' );
+ if (pos > 0)
+ {
+ TPtrC8 p = RowBuffer.Mid( pos+1 );
+ length = p.Length();
+ iValueBuffer.Zero();
+ for (TInt i=0; i < length; ++i)
+ {
+ iValueBuffer.Append(p[i]);
+ }
+ iValueBuffer.Trim();
+ TPtrC8 pp = RowBuffer.Left(pos);
+ KeyBuffer.CopyUC(pp);
+ KeyBuffer.Trim();
+ }
+ // TRY TO FIND CORRECT TAG
+ if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
+ if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
+ if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
+ if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
+ if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
+ if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
+ if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
+ if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
+ if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
+ if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
+ if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
+ if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
+ if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
+ if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
+ if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
+ if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
+ if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
+ if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
+ if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
+ if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
+ if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
+ if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
+ if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
+ if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
+ if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
+ if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
+ if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
+ if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
+ if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
+ if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
+ if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
+ if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
+ if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
+ if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
+ if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
+ if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
+ if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
+ if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
+ if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
+ if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
+ if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
+ if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
+ if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
+ if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
+ if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
+ if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
+ if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
+ if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
+ if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
+ if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
+ if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
+ if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
+ if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
+ if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
+ if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
+ if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
+ if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
+ if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
+ if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
+ if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
+ if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
+ if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
+ if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
+ if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
+ if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
+ if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
+ if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
+ if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
+ if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
+ if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
+ if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
+ if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
+ if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
+ if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
+ if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
+ if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
+ if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
+ if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
+ if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
+ if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
+ if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
+ if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
+ if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
+ return ETestUnknown;
+ }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CreateMessageL
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
+ {
+
+ // Reset inactivity timer to keem viewServer from crashing
+ User::ResetInactivityTime();
+
+ TInt i;
+ TInt error = KErrNone;
+ RFile attaFile;
+ _LIT8(KLeftAngle, "<");
+ _LIT8(KRightAngle, ">");
+ // we can't use "seconds from" as it only returns a
+ // 32 bit signed integer. If fails in 2038.
+ // "microseconds from" returns a 64 bit signed integer
+
+ CMsvStore* store = aMmsClient->Entry().EditStoreL();
+ CleanupStack::PushL(store);
+ aMmsHeaders->StoreL(*store);
+ store->CommitL();
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+
+ aMmsClient->LoadMessageL(); // read store is needed to do this
+
+ store = aMmsClient->Entry().EditStoreL();
+ CleanupStack::PushL(store);
+ CMsvAttachment* attaInfo = NULL;
+ TMsvAttachmentId attaId = 0;
+
+ for ( i=0; i < iAttaStructures->Count(); ++i)
+ {
+ attaId = KMsvNullIndexEntryId;
+ iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+
+ error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
+ User::LeaveIfError( error );
+
+ CleanupClosePushL(attaFile);
+
+ CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+ CleanupStack::PushL( mimeHeaders );
+ TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
+
+ TDataRecognitionResult result;
+ result.Reset(); // make sure that it is cleared
+
+ if(iAttaStructures->At(i)->iAttaCid->Length())
+ {
+ TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
+ if (attaCID.Find(KLeftAngle) == 0 &&
+ attaCID.Find(KRightAngle) == attaCID.Length()-1 )
+ {
+ // remove angle brackets from cid
+ attaCID = attaCID.Mid(1,attaCID.Length()-2);
+ }
+ mimeHeaders->SetContentIdL(attaCID);
+ }
+
+ if (iAttaStructures->At(i)->iAttaCharset)
+ {
+ mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
+ }
+
+ if (iAttaStructures->At(i)->iAttaName->Length())
+ {
+ iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
+ }
+ iParse.Set( iFilename, NULL, NULL );
+ iFilename.Copy( iParse.NameAndExt() );
+
+ mimeHeaders->SetContentLocationL( iFilename );
+
+ // if Mime type has not been set, use RapaRecognizer
+ if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
+ {
+ // TO BE IMPLEMENTED
+
+ RApaLsSession lsSession;
+
+ if ( lsSession.Connect() == KErrNone )
+ {
+ CleanupClosePushL( lsSession );
+
+ iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+ if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
+ {
+ // Check confidence level. Recognization must be at least
+ // "EProbable". We don't accept the result if it is "EPossible"
+ // or "EUnlikely" or "ENotRecognized"!
+
+ if ( result.iConfidence < CApaDataRecognizerType::EProbable )
+ {
+ result.Reset(); // clear buffer and try again with longer buffer
+ }
+
+ TPtrC8 mimeBuf8 = result.iDataType.Des8();
+
+ if ( mimeBuf8.Length() == 0 )
+ {
+ // Open file buffer and try again..
+
+ TInt bufSize = 0;
+ (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
+ if ( bufSize <= 0 )
+ {
+ bufSize = 30;
+ }
+ HBufC8* buf = HBufC8::NewLC( bufSize );
+ TPtr8 des = buf->Des();
+
+ RFile file;
+ TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
+ if ( err == KErrNone )
+ {
+ err = file.Read( des );
+ file.Close();
+ if ( err == KErrNone )
+ {
+ if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
+ {
+ mimeBuf8.Set( result.iDataType.Des8() );
+ }
+ }
+
+ }
+ CleanupStack::PopAndDestroy(); // buf
+ }
+ if ( mimeBuf8.Length() > 0 &&
+ result.iConfidence >= CApaDataRecognizerType::EProbable )
+ {
+ contentType.Set( result.iDataType.Des8() );
+ }
+ }
+ CleanupStack::PopAndDestroy(1); // lssession
+ }
+ }
+
+ if ( contentType.Length() > 0 )
+ {
+ TInt position = contentType.Find( KMmsSlash8 );
+ if ( position >= 0 )
+ {
+ mimeHeaders->SetContentTypeL( contentType.Left( position ) );
+ }
+ if ( position < contentType.Length() - 1 )
+ {
+ mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
+ }
+// CreateAttachment2L sets the content type to attaInfo
+// attaInfo->SetMimeTypeL( contentType );
+ }
+
+ if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
+ {
+ iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
+ iParse.Set( iFilename, NULL, NULL );
+ iFilename.Copy( iParse.NameAndExt() );
+ mimeHeaders->SetSuggestedFilenameL( iFilename );
+ }
+
+ TInt j = 0;
+ for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
+ {
+ mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
+ }
+ for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
+ {
+ mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
+ }
+
+ attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
+ // attaInfo does not go onto cleaunpstack because ownership will
+ // be transferred to attachment manager.
+
+ aMmsClient->CreateAttachment2L(
+ *store,
+ attaFile,
+ contentType,
+ *mimeHeaders,
+ attaInfo,
+ attaId);
+ attaInfo = NULL; // ownership transferred
+
+ CleanupStack::PopAndDestroy(); // mimeHeaders
+ CleanupStack::PopAndDestroy(); // attaFile.Close()
+
+ if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
+ {
+ aMmsClient->SetMessageRootL( attaId );
+ }
+ }
+
+ store->CommitL();
+ CleanupStack::PopAndDestroy(); // store
+
+ // This frees all memory and resets all values
+ Reset();
+ // Reset inactivity timer to keem viewServer from crashing
+ User::ResetInactivityTime();
+ }
+
+
+// ---------------------------------------------------------
+// CMmsReadFile()::FindAlias
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::FindAlias( TPtrC aAlias )
+ {
+ TBuf<DefaultBufLen> abuf;
+ for( TInt i=0; i < iAliasCount; ++i )
+ {
+ abuf.Copy( iAliasArray->MdcaPoint(i) );
+ abuf.SetLength( abuf.Locate('=') );
+ if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
+ }
+ return( -1 );
+ }
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsAttaStructure::CMmsAttaStructure()
+ {
+ iAtta = NULL;
+ iAttaType = NULL;
+ iAttaName = NULL;
+ iAttaCid = NULL;
+ iAttaRecommendedName = NULL;
+ }
+
+
+//
+void CMmsAttaStructure::ConstructL()
+ {
+ iAtta = HBufC8::NewL(DefaultBufLen);
+ iAttaType = HBufC8::NewL(DefaultBufLen);
+ iAttaName = HBufC8::NewL(DefaultBufLen);
+ iAttaCid = HBufC8::NewL(DefaultBufLen);
+ iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
+ iAttaCharset = 0;
+ iXTypeParams = new(ELeave) CDesC8ArrayFlat(4);
+ iContentTypeParams = new(ELeave) CDesC8ArrayFlat(4);
+
+ }
+
+// Two-phased constructor.
+CMmsAttaStructure* CMmsAttaStructure::NewL()
+ {
+ CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// Destructor
+CMmsAttaStructure::~CMmsAttaStructure()
+ {
+ delete iAtta;
+ delete iAttaName;
+ delete iAttaType;
+ delete iAttaCid;
+ delete iAttaRecommendedName;
+ if ( iContentTypeParams )
+ {
+ iContentTypeParams->Reset();
+ }
+ delete iContentTypeParams;
+ if ( iXTypeParams )
+ {
+ iXTypeParams->Reset();
+ }
+ delete iXTypeParams;
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/src/mmstestbed.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,2357 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <mtmdef.h>
+#include <CoreApplicationUIsSDKCRKeys.h>
+#include <mmsheaders.h>
+#include <mmscmds.h>
+#include <mmsencode.h>
+#include <mmscliententry.h>
+#include <logwrap.h>
+#include <logcli.h>
+#include <logview.h>
+#include "mmssettings.h" //use mmssettings.h instead of cmmssettings.h
+#include "mmstestbed.h"
+#include "mmsreadfile.h"
+#include "mmstestuitimer.h"
+#include "mmsteststaticutils.h"
+#include "mmstestbed.hrh"
+
+//constants
+_LIT( KMmsSender, "0601234567" );
+
+MmsTestBed::MmsTestBed()
+ {
+ //start the timer
+ iTimer = CTestUiTimer::NewL();
+ iTimer->Cancel();
+
+ iWait = CMsvOperationActiveSchedulerWait::NewLC();
+ // don't leave iWait on cleanup stack
+ CleanupStack::Pop();
+
+ //open msvsession
+ iSession = CMsvSession::OpenSyncL(*this);
+ //create client registry
+ iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
+ //create client mtm
+ iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
+ KUidMsgTypeMultimedia);
+
+ User::LeaveIfError( iFs.Connect() );
+ iFs.SetSessionPath( KRootPath );
+ iSettings = CMmsSettings::NewL();
+ iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
+ findDefaultL();
+ iServiceId = iDefaultServiceId;
+
+ //validate the settings
+ iSettings->ValidateSettings();
+
+ iLogEvent = CLogEvent::NewL();
+ iLogEvent->SetEventType(KLogMmsEventTypeUid);
+ iLogClient = NULL; // we test soon if this is available
+ iLogView = NULL; // needs log client
+ if ( checkLogClient() )
+ {
+ // first we generate a general view of all events
+ // we'll set the filter when we update the view
+ iLogView = CLogViewEvent::NewL( *iLogClient );
+ }
+ iLogFilter = CLogFilter::NewL();
+ // we try to filter MMS events
+ iLogFilter->SetEventType(KLogMmsEventTypeUid);
+ }
+
+MmsTestBed::~MmsTestBed()
+ {
+ delete iLogView;
+ delete iLogFilter;
+ delete iLogClient;
+ delete iLogEvent;
+ delete iSettings;
+ delete iMmsHeaders;
+ if(iTimer)
+ {
+ iTimer->Cancel();
+ delete iTimer;
+ }
+ //delete iMsvEntrySelection;
+ delete iMmsClient;
+ delete iClientMtmRegistry;
+ //delete iClientMtmRegistry;
+ delete iSession;
+ delete iWait;
+ }
+
+void MmsTestBed::setConnectionLocal(bool value)
+ {
+ //value = true for global off, local on
+ //value = false for global on, local off
+ iSettings->LoadSettingsL();
+ iSettings->SetLocalMode( value );
+ iSettings->SaveSettingsL();
+ }
+
+void MmsTestBed::fromOutboxToMmsc()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ // Get List of services
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
+ KUidMsgTypeMultimedia);
+ CleanupStack::PushL(selection);
+
+ // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
+ for (TInt i = 0; i < selection->Count(); ++i)
+ {
+ cEntry->SetEntryL(selection->At(i));
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetReadOnly(EFalse);
+ entry.SetSendingState(KMsvSendStateUnknown);
+ cEntry->ChangeL(entry);
+ }
+
+ selection->InsertL(0, iServiceId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack(parameters);
+
+ op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending)
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if (iWait->iStatus.Int() != KErrNone)
+ {
+ //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+
+void MmsTestBed::fromMmscToInbox()
+ {
+ CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+ CleanupStack::PushL(msvEntrySelection);
+
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ msvEntrySelection->InsertL(0, iServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack(parameters);
+
+ op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
+ paramPack, iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending)
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if (iWait->iStatus.Int() != KErrNone)
+ {
+ //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+ }
+
+void MmsTestBed::findDefaultL()
+ {
+ iSettings->LoadSettingsL();
+ iDefaultServiceId = iSettings->Service();
+ }
+
+void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+ TAny* aArg2, TAny* /*aArg3*/)
+ {
+ iEvent = aEvent;
+ if (aEvent == EMsvGeneralError)
+ {
+ return;
+ }
+ TMsvId parentId = KMsvNullIndexEntryId;
+ if (aArg2 != NULL)
+ {
+ parentId = *(TMsvId*) aArg2;
+ }
+
+ CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+ TMsvEntry tEntry;
+ TMsvId service;
+ TInt error = KErrNone;
+ error = iSession->GetEntry(selection->At(0), service, tEntry);
+
+ CMsvEntry* cEntry = NULL;
+ switch (aEvent)
+ {
+ case EMsvEntriesCreated:
+ {
+ if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+ {
+ // emit signal for new entry into INBOX
+ emit entryCreatedInInbox(tEntry.Id());
+ }
+ else if (parentId == KMsvDraftEntryIdValue)
+ {
+ // emit signal for new entry into Draft
+ emit entryCreatedInDraft(tEntry.Id());
+ }
+ else if (parentId == iServiceId)
+ {
+ // emit signal for new Entry into SERVICE
+ }
+ else
+ {
+ // do nothing
+ }
+ }
+ break;
+ case EMsvEntriesChanged:
+ {
+ TMsvId id;
+ CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+ if (selection == NULL)
+ {
+ // no selection, cannot handle
+ return;
+ }
+ id = selection->At(0);
+ //DEBUG Entry changed"));
+ if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+ {
+/*
+ cEntry = iSession->GetEntryL( parentId );
+ CleanupStack::PushL( cEntry );
+ TRAPD (error, cEntry->SetEntryL( id ));
+ if ( error != KErrNone )
+ {
+ CleanupStack::PopAndDestroy(); // cEntry
+ return;
+ }
+ TMsvEntry tEntry = cEntry->Entry();
+ if ( tEntry.Visible() )
+ {
+ // generate fake delivery report
+ CMsvStore* store = cEntry->ReadStoreL();
+ CleanupStack::PushL( store );
+ CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
+ CleanupStack::PushL( mmsHeaders );
+ mmsHeaders->RestoreL( *store );
+ iEncodeBuffer->ResizeL( 0 );
+ generateDeliveryReport( mmsHeaders );
+ CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+*/
+ }
+ }
+ break;
+ case EMsvEntriesDeleted:
+ {
+ //emit signal for entry deleted
+ }
+ break;
+ case EMsvEntriesMoved:
+ {
+ if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
+ {
+ // entry moved to outbox
+ emit entryMovedToOutbox(tEntry.Id());
+ }
+ else if (parentId == KMsvSentEntryIdValue)
+ {
+ // entry moved to sent folder
+ emit entryMovedToSent(tEntry.Id());
+ }
+ else
+ {
+ // do nothing
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+void MmsTestBed::createMmsService()
+ {
+ CMmsSettings * settings = CMmsSettings::NewL();
+ CleanupStack::PushL( settings );
+ settings->CreateNewServiceL( *iSession );
+ CleanupStack::PopAndDestroy(); // settings
+ return;
+ }
+
+void MmsTestBed::cleanup()
+ {
+ TMsvId entryToBeKilled;
+ // Get access to root index
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+
+ entryToBeKilled = iSettings->Service();
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ while (entryToBeKilled != KMsvNullIndexEntryId)
+ {
+ // delete child of root entry
+ deleteEntry(entryToBeKilled, *cEntry);
+ entryToBeKilled = iSettings->Service();
+ }
+
+ CleanupStack::PopAndDestroy(); // cEntry
+ // We deleted everything!
+ iDefaultServiceId = KMsvNullIndexEntryId;
+ iServiceId = KMsvNullIndexEntryId;
+ }
+
+void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
+ {
+ aClientEntry.DeleteL(aEntryId);
+ }
+
+void MmsTestBed::cleanupAndCreateNewService()
+ {
+ cleanup();
+ // all old service entries have been destroyed, create a new one
+ createMmsService();
+ }
+
+void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
+ {
+ // update settings in mmsclient
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+
+ RFileReadStream readStream;
+ readStream.PushL();
+// TMsvId id = KMsvNullIndexEntryId;
+ CBufFlat* encodeBuffer = NULL;
+ CMmsEncode* encoder = NULL;
+
+ // Open the file
+ TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
+ if (err != KErrNone) User::Leave( err );
+
+ TInt retCode = 0;
+ CMmsReadFile* readFile = NULL;
+ readFile = CMmsReadFile::NewL( iFs, readStream );
+ CleanupStack::PushL( readFile );
+
+ TInt messageCounter = 0;
+ CMsvEntry* cEntry = NULL;
+
+ while(!retCode)
+ {
+ // READ MESSAGE TO BUFFERS
+ iMmsHeaders->Reset(iSettings);
+ // put in some message type just for fun (testing...)
+ iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
+ retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
+ if(readFile->iMessageType == ETestNewMessage)
+ {
+ // CREATE MESSAGE ENTRY
+ switch ( aCommand )
+ {
+ case ECreateToInbox:
+ case ECreateNotification:
+ cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ break;
+ case ECreateToSentItems:
+ cEntry = iSession->GetEntryL(KMsvSentEntryId);
+ break;
+ case ECreateToDrafts:
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ break;
+ case ECreateHeadersFromFile:
+ // here we just encode headers, no message entry
+ // the entry is fake.
+ break;
+ case ECreateMMBoxViewConf:
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ // entry is not created for the description items
+ // they become attachments
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ }
+ break;
+ default:
+ cEntry = iSession->GetEntryL(aBox);
+ break;
+ }
+
+ // if we are just playing with headers we have no entry
+ if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
+ {
+ CleanupStack::PushL(cEntry);
+ iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+ // CREATE MESSAGE
+ iMmsClient->CreateMessageL(iServiceId);
+ }
+ else if ( aCommand == ECreateMMBoxViewConf )
+ {
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ CleanupStack::PushL(cEntry);
+ iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+ // CREATE MESSAGE
+ iMmsClient->CreateMessageL(iServiceId);
+ }
+ else
+ {
+ encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+ CleanupStack::PushL( encodeBuffer );
+ encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+
+ // encode headers to a binary file
+ encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+ iFilename = KMmsMMBoxDescriptionDirectory;
+ TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+ CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+ encodeBuffer = NULL;
+ encoder = NULL;
+ }
+ }
+ else
+ {
+ encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+ CleanupStack::PushL( encodeBuffer );
+ encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+
+ // encode headers to a binary file
+ encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+ iFilename = KMmsDumpDirectory;
+ TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+ CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+ encodeBuffer = NULL;
+ encoder = NULL;
+ }
+ }
+
+ if ( aCommand != ECreateHeadersFromFile &&
+ ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
+ {
+ if(readFile->iMessageType == ETestSettings)
+ {
+ TMsvId ServiceId = iMmsClient->DefaultServiceL();
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+ }
+
+ TMemoryInfoV1Buf memory;
+ UserHal::MemoryInfo( memory );
+ TInt available = memory().iFreeRamInBytes;
+// TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
+
+ TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
+
+ available = memory().iFreeRamInBytes;
+// TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
+
+ if(readFile->iMessageType == ETestNewMessage)
+ {
+ TMsvEntry tEntry = iMmsClient->Entry().Entry();
+ TMsvId id = tEntry.Id();
+ if ( err == KErrNone )
+ {
+ // SAVE MESSAGE
+ iMmsClient->SaveMessageL();
+
+ // If we are creating a MMBox View confirmation,
+ // we add all binary files from KMmsMMBoxDirectory
+ // as attachments.
+
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ addMMBoxDescriptions();
+ }
+
+ // reload the entry in case mms client put something into it
+ // MESSAGE MUST BE SET VISIBLE
+ tEntry = iMmsClient->Entry().Entry();
+ if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
+ {
+ tEntry.iMtmData1 |= KMmsMessageAdvertisement;
+ }
+ else if ( iMmsClient->MessageClass() == EMmsClassInformational )
+ {
+ tEntry.iMtmData1 |= KMmsMessageInformational;
+ }
+ tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
+
+ // Test: Set all as editor oriented - except notifications!
+ if ( aCommand == ECreateNotification )
+ {
+ tEntry.iMtm = KUidMsgMMSNotification;
+ }
+ else
+ {
+ tEntry.iMtmData1 |= KMmsMessageEditorOriented;
+ }
+ if ( aCommand == ECreateToInbox )
+ {
+ tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
+ tEntry.SetReadOnly( ETrue );
+ tEntry.SetNew( ETrue );
+ tEntry.SetUnread( ETrue );
+ }
+ else if ( aCommand == ECreateToSentItems )
+ {
+ tEntry.SetReadOnly( ETrue );
+ }
+ tEntry.SetVisible( ETrue );
+ tEntry.SetInPreparation( EFalse );
+ TTime now;
+ now.UniversalTime();
+ tEntry.iDate = now;
+ TMsvId entryId = tEntry.Id();
+ iMmsClient->Entry().ChangeL( tEntry );
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ // Encode to the directory that is used to fetch MMBox view
+ iFilename.Copy( KMmsMMBoxDirectory );
+ encodeMessageFromDrafts();
+ cEntry->SetEntryL( KMsvDraftEntryId );
+ cEntry->DeleteL( entryId );
+ }
+ }
+ else
+ {
+ //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
+ iSession->RemoveEntry(id);
+ err = KErrNone; // clear error
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ cEntry = NULL;
+ }
+ if(readFile->iMessageType == ETestSettings)
+ {
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); //readFile
+
+ readStream.Close();
+ readStream.Pop();
+
+ /*
+ iMmsClient->SwitchCurrentEntryL(id);
+ */
+ }
+
+void MmsTestBed::addMMBoxDescriptions()
+ {
+ // add the contents of KMmsMMBoxDescriptionDirectory as attachments
+ CDir* fileList = NULL;
+ TInt i = 0; // general counter
+ TInt error = KErrNone;
+ iCurrentPath = KMmsMMBoxDescriptionDirectory;
+
+ iFs.SetSessionPath(iCurrentPath);
+
+ TFindFile finder( iFs );
+ error = finder.FindWildByPath( KWild, NULL, fileList );
+ CleanupStack::PushL( fileList );
+ TInt fileCounter = 0;
+
+ if ( error == KErrNone )
+ {
+ fileCounter = fileList->Count();
+ }
+
+ TEntry entry;
+
+ if ( error == KErrNone )
+ {
+ for ( i = 0; i < fileCounter; ++i )
+ {
+ // Reset inactivity timer to keep viewServer from crashing
+ User::ResetInactivityTime();
+ entry = (*fileList)[i]; // name is entry.iName
+ iFilename.Copy( iCurrentPath );
+ iFilename.Append( entry.iName );
+ TPtrC ptr;
+ ptr.Set( iFilename );
+ iWait->iStatus = KErrNone;
+ iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
+
+ iWait->Start();
+ // The descriptions are cleared after being used
+ iFs.Delete( ptr);
+ }
+ }
+
+ iMmsClient->SaveMessageL(); // just in case somthing must be updated
+ CleanupStack::PopAndDestroy(); // fileList
+ fileList = NULL;
+ }
+
+void MmsTestBed::encodeMessageFromDrafts()
+ {
+ CMmsEncode* encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+ // encode a message iMmsClientPoints to
+ iMmsClient->LoadMessageL();
+ CMsvStore* store = iMmsClient->Entry().ReadStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->RestoreL( *store );
+ CleanupStack::PopAndDestroy(); // store
+ store = NULL;
+ iWait->iStatus = KErrNone;
+
+// caller sets the directory
+// iFilename = KMmsMessageDumpDirectory;
+
+ CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
+ CleanupStack::PushL( entryWrapper );
+ iEncodeBuffer->ResizeL(0);
+ encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
+ iWait->Start();
+ if ( iWait->iStatus == KErrNone )
+ {
+ TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
+ }
+ iEncodeBuffer->ResizeL(0);
+ CleanupStack::PopAndDestroy(); // entryWrapper
+ CleanupStack::PopAndDestroy(); // encoder
+ }
+
+void MmsTestBed::deleteNotifications()
+ {
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+
+ CMsvEntry* cEntry = NULL;
+ // delete all messages from the specified box
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+
+ if ( mmsFolderId != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL(mmsFolderId);
+
+ // show invisible entries
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL(msvEntrySelection);
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ if (msvEntrySelection->Count() > 0)
+ {
+ CMsvOperation* op = iSession->TransferCommandL(
+ *msvEntrySelection,
+ EMmsDeleteEntries,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ // These cannot be deleted unless we have the a server mtm
+ // corresponding to this mtm type.
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+ msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
+ CleanupStack::PushL(msvEntrySelection);
+
+ if (msvEntrySelection->Count() > 0)
+ {
+ CMsvOperation* op = iSession->TransferCommandL(
+ *msvEntrySelection,
+ EMmsDeleteEntries,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ }
+
+TMsvId MmsTestBed::findMMSFolder()
+ {
+ return iSettings->NotificationFolder();
+ }
+
+void MmsTestBed::restoreFactorySettings()
+ {
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+ // do not reset access point
+ TInt accessPoint = iSettings->AccessPoint( 0 );
+ iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
+ TInt count = iSettings->AccessPointCount();
+ TInt i = 0;
+ for ( i = count - 1; i >= 0; --i )
+ {
+ iSettings->DeleteAccessPointL( i );
+ }
+ // restore the original access point
+ if ( accessPoint > 0 )
+ {
+ // a negative access point is an error (most likely "KErrNotFound")
+ iSettings->AddAccessPointL( accessPoint, 0 );
+ }
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+
+void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
+ {
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+
+ iSettings->SetReceivingModeHome( aState );
+
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+
+void MmsTestBed::sendFromFile()
+ {
+ CMsvOperation * op = NULL;
+
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ CleanupStack::PushL( cEntry );
+
+ CMsvEntrySelection* selection = NULL;
+ selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy(); // cEntry
+ CleanupStack::PushL( selection );
+
+ TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
+ if ( error != KErrNone )
+ {
+ CleanupStack::PopAndDestroy(); // selection
+ delete op;
+ return;
+ }
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(2); // op, selection
+ }
+
+void MmsTestBed::sendOneByOne()
+ {
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ CleanupStack::PushL( cEntry );
+
+ CMsvEntrySelection* selection = NULL;
+ selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL( selection );
+
+ CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( shortSelection );
+
+ TInt i;
+
+ for ( i = 0; i < selection->Count(); ++i )
+ {
+ shortSelection->Reset();
+ shortSelection->AppendL( selection->At( i ) );
+
+ CMsvOperation * op = NULL;
+
+ TTime now;
+ now.UniversalTime();
+
+ TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
+ if ( error != KErrNone )
+ {
+ delete op;
+ CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+ return;
+ }
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+
+ }
+ CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+ }
+
+void MmsTestBed::sendNotifications()
+ {
+ // Only send one notification!!
+
+ TInt error = KErrNone;
+
+ if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
+ {
+ //Not a file
+ return;
+ }
+ TMsvId mmsFolder = findMMSFolder();
+
+ TEntry entry;
+
+
+ // now I think we have a filename
+ TEntry orgEntry;
+ TUint size = 0;
+ error = iFs.Entry( iCurrentFile, orgEntry );
+ size = orgEntry.iSize;
+
+ //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
+ if ( size == 0 )
+ {
+ //empty file
+ //TMmsLogger::Log(_L("- empty file"));
+ return;
+ }
+
+ if ( iEncodeBuffer == NULL )
+ {
+ iEncodeBuffer = CBufFlat::NewL( size );
+ }
+ else
+ {
+ iEncodeBuffer->ResizeL( 0 );
+ iEncodeBuffer->ResizeL( size );
+ }
+
+ RFile inFile;
+ error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
+ TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+ if ( error == KErrNone )
+ {
+ error = inFile.Read( ptr, size );
+ inFile.Close();
+ }
+ else
+ {
+ //Error
+ //TMmsLogger::Log(_L("- can't read file"));
+ return;
+ }
+
+ TUint8 byte;
+ TUint position = 0;
+ TUint32 uintvar = 0;
+
+ if ( size > 2 )
+ {
+ iEncodeBuffer->Read( 1, &byte, 1 );
+ if ( byte == 6 ) // PUSH PDU
+ {
+ // try to find out length of header
+ position = 2;
+ iEncodeBuffer->Read( position, &byte, 1);
+
+ while ( byte & 0x80 && position < size )
+ {
+ uintvar += ( byte & 0x7f );
+ uintvar <<= 7;
+ position++;
+ iEncodeBuffer->Read( position, &byte, 1 );
+ }
+
+ // add last byte without shift
+ uintvar += byte;
+ position++;
+ }
+ }
+
+ position += uintvar;
+
+ if ( position < size )
+ {
+ ptr = iEncodeBuffer->Ptr( position );
+ size = ptr.Length();
+ }
+
+ if ( size == 0 )
+ {
+ //no MMS stuff
+ //TMmsLogger::Log(_L("- no MMS stuff"));
+ return;
+ }
+
+ TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+
+ // Now we have streamed our data into this entry.
+ // Now we have an entry that says: local service, MMS MTM
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ if ( entryId != KMsvNullIndexEntryId )
+ {
+ selection->AppendL( entryId );
+ }
+ else
+ {
+ selection->AppendL( iDefaultServiceId );
+ }
+
+ TWatcherParameters parameters; // initialized to zero
+ parameters.iWatcherId = RThread().Id();
+ parameters.iDataPointer = &ptr;
+ TWatcherParametersBuf paramPack( parameters );
+
+ CMsvOperation * op = NULL;
+
+ op = iSession->TransferCommandL(
+ *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ User::After(1000000);
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::copyDrafts()
+ {
+ CMsvEntry* cEntry = NULL;
+// Copies contents of sent folder to drafts for retrying sending.
+
+ cEntry = iSession->GetEntryL(KMsvSentEntryId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages in drafts
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+
+ TMsvLocalOperationProgress progress;
+ cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
+
+ TInt i = 0;
+ for ( i = 0; i < selection->Count(); ++i )
+ {
+ cEntry->SetEntryL( selection->At( i ) );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetReadOnly( EFalse );
+ cEntry->ChangeL( entry );
+ }
+
+ CleanupStack::PopAndDestroy(2); // selection, cEntry
+ }
+
+void MmsTestBed::garbageCollection(TUint32 aReason)
+ {
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+
+ TMMSGarbageCollectionParameters parameters; // initialized to zero
+ parameters.iReasonFlags = aReason;
+ TMMSGarbageCollectionParametersBuf paramPack( parameters );
+ op = iSession->TransferCommandL(
+ *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::messageVariation()
+ {
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+
+ op = iSession->TransferCommandL(
+ *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::cancelSendScheduling()
+ {
+ CMsvEntry* cEntry = NULL;
+ setFetchingState( EMmsReceivingPostpone );
+ testFile( iCurrentFile );
+ scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
+ deleteSendSchedule();
+
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ if (iMsvEntrySelection != NULL)
+ {
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ }
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy();
+ }
+
+void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
+ {
+ CMsvEntry* cEntry = NULL;
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ cEntry = iSession->GetEntryL(aBoxId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+// selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledSend,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::deleteSendSchedule()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsDeleteSchedule,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::cancelFetchScheduling()
+ {
+ TMsvId mmsFolder = findMMSFolder();
+ CMsvEntry* cEntry = NULL;
+ setFetchingState( EMmsReceivingPostpone );
+ testFile( iCurrentFile );
+ fromOutboxToMmsc(); // immediate send (EMmsSend)
+
+ // Wait until notification has arrived - may take a while in global mode
+ TInt i = 0;
+ while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
+ && i < 2000 )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ i++;
+ if ( (i/100) * 100 == i )
+ {
+ //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+ }
+ CActiveScheduler::Start();
+ }
+ iTimer->Cancel();
+
+ fetchForced( 10000 ); // delay to allow cancelling
+ deleteFetchSchedule();
+
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(mmsFolder);
+ if (iMsvEntrySelection != NULL)
+ {
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ }
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
+ {
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledReceiveForced,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::deleteFetchSchedule()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+ cEntry = iSession->GetEntryL( mmsFolderId );
+ CleanupStack::PushL(cEntry);
+ // Get all notifications
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsDeleteSchedule,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::doAFetchCycle()
+ {
+ // Sends a message from iCurrentFile and lets it come back
+ TMsvId mmsFolder = findMMSFolder();
+ testFile( iCurrentFile );
+ fromOutboxToMmsc(); // immediate send (EMmsSend)
+ // fetching will start automatically
+
+ TInt i = 0;
+ while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
+ && i < 2000
+ && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ i++;
+ if ( (i/100) * 100 == i )
+ {
+ //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+ }
+ CActiveScheduler::Start();
+ }
+ iTimer->Cancel();
+ }
+
+bool MmsTestBed::checkLogClient()
+ {
+ if ( iLogClient == NULL )
+ {
+ TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
+ }
+ return ( iLogClient != NULL );
+ }
+
+int MmsTestBed::getLogEntries()
+ {
+ TInt count = 0;
+ if ( !iLogView )
+ {
+ return 0;
+ }
+
+ if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
+ {
+ // should complete with KErrNone
+ iWait->Start();
+ if ( iWait->iStatus.Int() == KErrNone )
+ {
+ count = iLogView->CountL();
+ }
+ }
+ return count;
+ }
+
+void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
+ {
+ CMsvOperation* opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
+ iWait->Start();
+ if (!opert->iStatus.Int()==KErrNone)
+ {
+ // what should we do? panic?
+ }
+
+ TPckgBuf<TMsvLocalOperationProgress> package;
+ package.Copy(opert->ProgressL());
+ *(TMsvId*)&aNewEntry = package().iId;
+
+ delete opert; opert=NULL;
+ }
+
+void MmsTestBed::cleanOutbox()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanInbox()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanSent()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanDrafts()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanAll()
+ {
+ cleanInbox();
+ cleanOutbox();
+ cleanSent();
+ cleanDrafts();
+ TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
+ deleteNotifications();
+ }
+
+void MmsTestBed::reply()
+ {
+ // The first message from inbox is replied to
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::replyToAll()
+ {
+ // The first message from inbox is replied to
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+ KMsvMessagePartRecipient;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::forward()
+ {
+ // The first message from inbox is forwarded
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+ KMsvMessagePartRecipient | KMsvMessagePartAttachments;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ iMmsClient->SwitchCurrentEntryL( newEntry );
+ // Add a sender: 0601234567
+ iMmsClient->LoadMessageL();
+ iMmsClient->SetSenderL( KMmsSender );
+ iMmsClient->SaveMessageL();
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::sendReadReport()
+ {
+ // TURN READ REPORTS ON (until available from menu)
+ iSettings->LoadSettingsL();
+ iSettings->SetReadReplyReportSendingAllowed( ETrue );
+ iSettings->SaveSettingsL();
+ iMmsClient->RestoreSettingsL();
+
+
+ // Read report is sent for the first message in inbox
+ CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+
+ if ( iMsvEntrySelection->Count() == 0 )
+ {
+ return;
+ }
+ TMsvId originalEntry = iMsvEntrySelection->At( 0 );
+
+ // new test using Client MTM
+ CMsvOperation * op = NULL;
+ op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy( op );
+ op = NULL;
+
+ // Try sending the read report to current entry
+
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy( op );
+ op = NULL;
+
+/*
+ cEntry->SetEntryL( originalEntry );
+ iMmsHeaders->Reset();
+ CMsvStore* store = cEntry->ReadStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->RestoreL( *store );
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+ HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
+ CleanupStack::PushL( messageId );
+ messageId->Des().Copy( iMmsHeaders->MessageId() );
+
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ iMmsClient->LoadMessageL();
+
+ iMmsHeaders->Reset();
+ iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
+ // Message id cannot be accessed via MMS Client MTM!
+
+ iMmsHeaders->SetMessageIdL( messageId->Des() );
+ CleanupStack::PopAndDestroy( messageId );
+
+ iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
+ // sender must be insert-address-token because we don't know our number
+ TTime now;
+ now.UniversalTime();
+
+ _LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
+
+ TTime y1970( K1970 );
+ TTimeIntervalMicroSeconds interval;
+ // we can't use "seconds from" as it only returns a
+ // 32 bit signed integer. If fails in 2038.
+ // "microseconds from" returns a 64 bit signed integer
+ interval = now.MicroSecondsFrom( y1970 );
+ // date in iMmsHeaders() in seconds from 1.1.1970.
+ iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
+ iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
+
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = FindMMSFolderL();
+
+ cEntry->SetEntryL( mmsFolderId );
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvMessageEntry;
+ entry.iMtm = KUidMsgTypeMultimedia;
+ entry.SetVisible( ETrue );
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ entry.iRelatedId = iDefaultServiceId;
+ entry.iMtmData1 = KMmsMessageReadRecInd;
+ cEntry->CreateL( entry );
+ TMsvId entryId = entry.Id();
+
+ cEntry->SetEntryL( entryId );
+
+ store = cEntry->EditStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->StoreL( *store );
+ store->CommitL();
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+
+ CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, entryId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy( op );
+ CleanupStack::PopAndDestroy( selection );
+*/
+ CleanupStack::PopAndDestroy( cEntry );
+ }
+
+int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
+ {
+ TInt error = KErrNone;
+ TInt messageCount = 0;
+ TInt failureCount = 0;
+ do {
+ CMsvEntry* cEntry = NULL;
+
+ // Get List of services
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ failureCount++;
+ // These are failures that fail in Message server.
+ if ( failureCount >= 63 && failureCount <= 64 )
+ {
+ failureCount = 65;
+ }
+ cEntry->SetEntryL( iServiceId );
+ TMsvEntry entry = cEntry->Entry();
+ entry.iMtmData3 &= 0x0000000FF;
+ entry.iMtmData3 |= failureCount << 8;
+ cEntry->ChangeL( entry );
+
+ selection->InsertL(0, iServiceId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
+
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ error = iWait->iStatus.Int();
+ if ( iWait->iStatus.Int() != KErrNoMemory )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // op
+ }
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // selection
+ CleanupStack::PopAndDestroy(); // cEntry
+ selection = NULL;
+ cEntry = NULL;
+ cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
+ CleanupStack::PushL(cEntry);
+ selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ messageCount = selection->Count();
+ delete selection;
+ selection = 0;
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ while ( error == KErrNoMemory || messageCount > 0 );
+ return failureCount;
+ }
+
+int MmsTestBed::fromMmscToInboxWithMemoryFailure()
+ {
+ TInt error = KErrNone;
+ TInt failureCount = 0;
+ TInt messageCount = 0;
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+
+ do {
+ // Inbox must be cleaned if failure makes message to be fetched more than once.
+ // should not happen, but this test is quite stressful, and perfect result
+ // cannot be guaranteed.
+ // What is expected:
+ // 1. Program does not crash
+ // 2. After sufficient number of retries the message is fetched and notification deleted.
+ TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+ CMsvEntry* cEntry = NULL;
+ CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+ CleanupStack::PushL(msvEntrySelection);
+
+ cEntry = iSession->GetEntryL(iServiceId);
+ CleanupStack::PushL(cEntry);
+
+ failureCount++;
+ // These are failures that fail in Message server.
+ if ( failureCount >= 63 && failureCount <= 64 )
+ {
+ failureCount = 65;
+ }
+ cEntry->SetEntryL( iServiceId );
+
+ TMsvEntry entry = cEntry->Entry();
+ entry.iMtmData3 &= 0x0000000FF;
+ entry.iMtmData3 |= failureCount << 8;
+ cEntry->ChangeL( entry );
+
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ msvEntrySelection->InsertL(0, iServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsReceiveForced,
+ *msvEntrySelection,
+ paramPack,
+ iWait->iStatus) );
+
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ error = iWait->iStatus.Int();
+ if ( iWait->iStatus.Int() != KErrNoMemory )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // msvEntrySelection
+ CleanupStack::PopAndDestroy(); // cEntry
+ msvEntrySelection = NULL;
+ cEntry = NULL;
+ cEntry = iSession->GetEntryL( mmsFolderId );
+ CleanupStack::PushL(cEntry);
+ msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ messageCount = msvEntrySelection->Count();
+ delete msvEntrySelection;
+ msvEntrySelection = 0;
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ while ( error == KErrNoMemory || messageCount > 0 );
+ if ( error != KErrNoMemory && error != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
+ }
+ return failureCount;
+ }
+
+void MmsTestBed::sendViaClient()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages in drafts
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+
+ CMsvOperation * op = NULL;
+ TTime now;
+ now.UniversalTime();
+ op = iMmsClient->SendL( *selection, iWait->iStatus, now );
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
+ {
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledReceive,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::fetchForcedImmediate()
+ {
+ TCommandParameters parameters;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsReceiveForced,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::getEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+
+ CLogEventType* eventType = CLogEventType::NewL();
+ CleanupStack::PushL( eventType );
+ eventType->SetUid(iLogEvent->EventType());
+ iLogClient->GetEventType( *eventType, iWait->iStatus );
+
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // eventType
+ }
+
+void MmsTestBed::addEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+
+ CLogEventType* eventType = CLogEventType::NewL();
+ CleanupStack::PushL( eventType );
+ eventType->SetUid(iLogEvent->EventType());
+ eventType->SetDescription(_L("Multimedia Message") );
+ eventType->SetLoggingEnabled( ETrue );
+
+// iWait->iStatus = KRequestPending;
+ iLogClient->AddEventType( *eventType, iWait->iStatus );
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // eventType
+ }
+
+void MmsTestBed::deleteEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+// iWait->iStatus = KRequestPending;
+ iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
+ iWait->Start();
+ }
+
+void MmsTestBed::cleanLog()
+ {
+ TInt count = 0;
+
+ count = getLogEntries();
+
+ TInt i;
+ for ( i = 0; i < count; ++i )
+ {
+ // when a view is created, it will be positioned on the first event
+// iWait->iStatus = KRequestPending;
+ iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
+ iWait->Start();
+
+ if ( iLogView->NextL( iWait->iStatus ) )
+ {
+ // should complete with KErrNone
+ iWait->Start();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ // could not get next event!
+ break;
+ }
+ }
+ else
+ {
+ break; // no more events!
+ }
+ }
+ }
+
+void MmsTestBed::setOnline(bool value)
+ {
+ //value = true for online mode
+ //value = false for offline mode
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
+ if( retval == KErrNone )
+ {
+ repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
+ delete repository;
+ }
+ }
+
+void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
+ {
+ iEncodeBuffer->ResizeL( 1024 );
+
+ TInt position = 0;
+
+ // encode message type
+ iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
+ position++;
+
+ // version
+ iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
+ position++;
+
+ TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
+ iEncodeBuffer->Write( position, &version, 1 );
+ position++;
+
+ // message id from the headers
+ // At least once MMSC did not send us the message id!
+ // if message id is missing, we cannot match the entry!
+ // This only a fake. Real delivery reports should always
+ // contain the message id.
+ if ( aMmsHeaders->MessageId().Length() > 0 )
+ {
+ iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
+ position += aMmsHeaders->MessageId().Length();
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+ }
+
+ // To is taken from the headers
+ iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
+ position++;
+
+ TPtrC recipient;
+ if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->ToRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->ToRecipients()[0] );
+ }
+ else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->CcRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->CcRecipients()[0] );
+ }
+ else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->BccRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->BccRecipients()[0] );
+ }
+ else
+ {
+ recipient.Set( _L("Jasso-Kissa@jii.fi") );
+ }
+
+ TMmsAddressType addressType = EMmsAddressTypeUnknown;
+
+ if ( recipient.Find( KMiuMau ) != KErrNotFound )
+ {
+ addressType = EMmsAddressTypeEmail;
+ }
+ else
+ {
+ addressType = EMmsAddressTypeMobile;
+ }
+
+ TUint8 character;
+ TInt i;
+ if ( addressType == EMmsAddressTypeEmail )
+ {
+ // email address - ASCII ONLY - THIS IS JUST A TEST!
+
+ for ( i = 0; i < recipient.Length(); ++i )
+ {
+ character = TUint8( recipient[i] & 0xff );
+ iEncodeBuffer->Write( position, &character, 1 );
+ position++;
+ }
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+
+ }
+ else
+ {
+ // must be a phone number
+ // We expect for now that the format is correct as is
+ // All legal characters present in a phone number are ASCII
+
+ TInt i;
+ for ( i = 0; i < recipient.Length(); ++i )
+ {
+ character = TUint8( recipient[i] & 0xff );
+ iEncodeBuffer->Write( position, &character, 1 );
+ position++;
+ }
+ iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
+ position += KMmsPlmnLength;
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+ }
+
+ // date
+ iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
+ position++;
+
+ TLocale locale;
+ locale.Refresh();
+ TInt64 UtcDate;
+ TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
+
+ TTime now;
+ now.UniversalTime();
+ UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
+
+ UtcDate -= universalTimeOffset.Int();
+
+ if ( locale.QueryHomeHasDaylightSavingOn() )
+ {
+ TTimeIntervalSeconds daylightSaving( 60 * 60 );
+ UtcDate -= daylightSaving.Int();
+ }
+
+ TUint8 len; // number of bytes we will need
+ len = 0;
+ TUint8 array[8];
+
+ TInt64 temp = UtcDate;
+
+ for (i = 7; i >= 0; --i)
+ {
+ array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
+ I64LSR( temp, 8 );
+ }
+
+ len = 8;
+ i = 0;
+ while( ( array[i]== 0 ) && ( i < 8 ) )
+ {
+ i++;
+ len--;
+ }
+
+ // a zero should be coded as short integer.
+ // However, if there is a valid reason to code a zero as a long integer,
+ // we allow it. The caller should know what he is doing.
+ if ( len == 0 )
+ {
+ len = 1;
+ }
+ // write short length
+ iEncodeBuffer->Write( position, &len, 1 );
+ position++;
+ // write as many bytes as were non-zero
+ iEncodeBuffer->Write( position, &(array[8 - len] ), len );
+ position+= len;
+ // status
+ iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
+ position++;
+ // DONE!!!
+ iEncodeBuffer->ResizeL( position );
+ return;
+ }
+
+void MmsTestBed::sendDeliveryReport()
+ {
+ if ( iEncodeBuffer->Size() == 0 )
+ {
+ //No delivery report
+ return;
+ }
+
+
+ TMsvId mmsFolder = findMMSFolder();
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+
+ TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+ TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+
+ // Now we have streamed our data into this entry.
+ // Now we have an entry that says: local service, MMS MTM
+
+ if ( entryId != KMsvNullIndexEntryId )
+ {
+ selection->AppendL( entryId );
+ }
+ else
+ {
+ selection->AppendL( iDefaultServiceId );
+ }
+
+ TWatcherParameters parameters; // initialized to zero
+ parameters.iWatcherId = RThread().Id();
+ parameters.iDataPointer = &ptr;
+ TWatcherParametersBuf paramPack( parameters );
+
+ CMsvOperation * op = NULL;
+
+// iWait->iStatus = KRequestPending;
+ op = iSession->TransferCommandL(
+ *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/src/mmsteststaticutils.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,528 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <f32file.h>
+#include <centralrepository.h>
+#include <apparc.h>
+#include <msvapi.h>
+#include <msvids.h>
+
+#include "mmsteststaticutils.h"
+#include "mmsconst.h"
+#include <MmsEnginePrivateCRKeys.h>
+#include "mmssettings.h"
+#include <mmsheaders.h>
+#include "mmsservercommon.h"
+#include <mmsencode.h>
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
+: iArray1(aArray1), iArray2(aArray2)
+ {
+ }
+
+TInt TMmsJoinedArrays::MdcaCount() const
+ {
+ TInt count=0;
+ if (iArray1)
+ count += iArray1->MdcaCount();
+ if (iArray2)
+ count += iArray2->MdcaCount();
+ return count;
+ }
+
+TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
+ {
+ if (iArray1)
+ {
+ if (aIndex < iArray1->MdcaCount())
+ return iArray1->MdcaPoint(aIndex);
+ else
+ aIndex -= iArray1->MdcaCount();
+ }
+ return iArray2->MdcaPoint(aIndex);
+ }
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsTestUtils::TMmsTestUtils()
+ {
+
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
+ {
+ RFile file;
+ TInt error = KErrNone;
+
+ TInt textBufferSize = 256;
+ HBufC* textBuffer = HBufC::NewL( textBufferSize );
+ TPtr textPtr = textBuffer->Des();
+ TFileText textFile;
+
+ error = file.Open( aFs, aFileName,
+ EFileRead|EFileShareReadersOnly );
+
+ if ( error == KErrNone )
+ {
+ textFile.Set( file );
+ error = textFile.Seek( ESeekStart );
+ }
+
+ if ( error == KErrNone )
+ {
+ error = textFile.Read( textPtr );
+ }
+
+ file.Close();
+
+ if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
+ {
+ textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
+ }
+
+ return textBuffer;
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOnL()
+ {
+ // CenRep for decodelogging
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 1;
+ repository->Set( KMmsEngineDecodeLog, temp );
+ delete repository;
+ }
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOffL()
+ {
+ // CenRep for decodelogging
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 0;
+ repository->Set( KMmsEngineDecodeLog, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOnL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 1;
+ repository->Set( KMmsEngineBinaryDump, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOffL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 0;
+ repository->Set( KMmsEngineBinaryDump, temp );
+ delete repository;
+ }
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
+ {
+ // Delete the files in the directory
+ CFileMan* fileMan = CFileMan::NewL( aFs );
+ CleanupStack::PushL( fileMan );
+ fileMan->RmDir( KMmsDefaultLocalModeDir );
+ fileMan->RmDir( KMmsMMBoxDirectory );
+ fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
+ CleanupStack::PopAndDestroy(); // fileManager
+ // we don't want to throw these away!
+ aFs.MkDirAll( KMmsDefaultLocalModeDir );
+ aFs.MkDirAll( KMmsMMBoxDirectory );
+ aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
+ {
+ TInt error = KErrNone;
+ aFs.MkDirAll( aFilename );
+ TUint att;
+ if ( aFs.Att( aFilename, att ) == KErrNone )
+ {
+ _LIT( KRelated, "dump.mms");
+ aParse.Set( aFilename, &KRelated, NULL );
+ aFilename = aParse.FullName();
+ error = CApaApplication::GenerateFileName( aFs, aFilename );
+ if ( error == KErrNone )
+ {
+ RFile file;
+ error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
+ // for message id generation
+ aParse.Set( aFilename, NULL, NULL );
+ if ( error == KErrNone )
+ {
+ // the data is supposed to be in the encode buffer
+ TPtr8 ptr = aBuffer.Ptr( 0 );
+ file.Write( ptr );
+ file.Flush();
+ }
+
+ // done - close files
+ file.Close();
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
+ {
+ CMsvEntry* cEntry = NULL;
+ // delete all messages from the specified box
+ cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(aBoxId);
+ // show invisible entries
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL(msvEntrySelection);
+
+ CMsvEntrySelection* selection = NULL;
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
+ CleanupStack::PushL( selection );
+ if ( selection->Count() > 0 )
+ {
+ msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
+ }
+ CleanupStack::PopAndDestroy(); // selection
+
+ int i;
+ for (i = 0; i < msvEntrySelection->Count(); ++i)
+ {
+ CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
+ CleanupStack::PushL( entry );
+ TMsvEntry tEntry = entry->Entry();
+ tEntry.SetReadOnly(EFalse);
+ entry->ChangeL(tEntry);
+ cEntry->DeleteL( msvEntrySelection->At(i) );
+ CleanupStack::PopAndDestroy( entry );
+ }
+
+ CleanupStack::PopAndDestroy(msvEntrySelection);
+ CleanupStack::PopAndDestroy(cEntry);
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOnL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+ if( retval == KErrNone )
+ {
+ TInt temp = 1;
+ repository->Set( KMmsEngineLogEmailRecipients, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOffL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+ if( retval == KErrNone )
+ {
+ TInt temp = 0;
+ repository->Set( KMmsEngineLogEmailRecipients, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
+ {
+ CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(aBoxId);
+ if (aMsvEntrySelection != NULL)
+ {
+ delete aMsvEntrySelection;
+ aMsvEntrySelection = NULL;
+ }
+ aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
+ CleanupStack::PopAndDestroy(); // cEntry
+ return aMsvEntrySelection->Count();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CreateFolderEntryL
+//
+// -----------------------------------------------------------------------------
+//
+void TMmsTestUtils::CreateFolderEntryL(
+ CMsvSession& aSession,
+ TMsvId aParentFolder,
+ const TDesC& aFolderName,
+ TMsvId& aFolderId )
+ {
+ aFolderId = KMsvNullIndexEntryId;
+ CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
+ CleanupStack::PushL( cEntry );
+
+ // Create a new folder.
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvFolderEntry;
+ entry.iMtm = KUidMsvLocalServiceMtm;
+ entry.iDetails.Set( aFolderName );
+ entry.SetVisible( EFalse );
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ cEntry->CreateL( entry );
+ aFolderId = entry.Id();
+ CleanupStack::PopAndDestroy( cEntry );
+
+ }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TMsvId TMmsTestUtils::CreateNotificationEntryL(
+ TMsvId aNotificationFolder,
+ TMsvId aServiceId,
+ CBufFlat* aEncodeBuffer,
+ CMsvSession& aSession )
+ {
+ TMsvId entryId = KMsvNullIndexEntryId;
+ if ( aNotificationFolder == KMsvNullIndexEntryId )
+ {
+ // no folder no entry
+ return entryId;
+ }
+
+ CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
+ CleanupStack::PushL(cEntry);
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvMessageEntry;
+ entry.iMtm = KUidMsgTypeMultimedia;
+ entry.SetVisible( ETrue );
+ // If we want to put data here, InPreparation must be set to true first
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ entry.iRelatedId = aServiceId;
+ entry.iMtmData2 = KMmsNotificationBinary;
+ cEntry->CreateL( entry );
+ entryId = entry.Id();
+
+ //
+ // Stream
+ // 1) length of the data as 32 bit integer
+ // 2) pushed message data
+ // into created entry's stream
+ //
+ cEntry->SetEntryL( entryId );
+ CMsvStore* store = cEntry->EditStoreL();
+ CleanupStack::PushL( store ); // ***
+ RMsvWriteStream outs;
+ outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
+ TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
+ outs.WriteUint32L( ptr.Length() );
+ outs.WriteL( ptr );
+ outs.CommitL();
+ outs.Close();
+ store->CommitL();
+
+ CleanupStack::PopAndDestroy( &outs ); // close outs
+ CleanupStack::PopAndDestroy( store );
+ CleanupStack::PopAndDestroy( cEntry );
+
+ return entryId;
+
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::FormNotification(
+ TDesC8& aUrl,
+ TInt aSize,
+ CMmsHeaders& aMmsHeaders,
+ CMmsEncode& aMmsEncoder,
+ CBufFlat* aEncodeBuffer )
+ {
+ // for test purposes aUrl will contain the filename.
+
+ // Reset sets the default encapsulation version
+ // The default version has been set from MmsSettings in NewL
+ aMmsHeaders.Reset();
+
+ // construct the notification into iMmsHeaders, and call encode
+
+ aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
+
+ TTime currentTime;
+ currentTime.UniversalTime();
+ currentTime.Int64();
+
+ TPtrC8 tid;
+ TBufC8<KMMSMAXTIDLENGTH> target;
+ TInt random = 0;
+
+ // we don't generate a true random TID: We generate the
+ // TID from the URL so that if we generate a notification
+ // twice from the same file, we get the same TID and the
+ // same URL. This way we can test the pruning function in
+ // server MTM
+
+ TInt i;
+ for ( i = 0; i < aUrl.Length(); ++i )
+ {
+ random += aUrl[ i ];
+ }
+
+ target.Des().Num( random );
+ tid.Set( target.Des() );
+ aMmsHeaders.SetTidL( tid );
+
+ aMmsHeaders.SetMessageClass( EMmsClassPersonal );
+ aMmsHeaders.SetMessageSize( aSize );
+ const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
+ aMmsHeaders.SetExpiryInterval( KTenHours );
+ aMmsHeaders.SetContentLocationL( aUrl );
+
+ aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
+
+ }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
+ {
+ //Is the name a file?
+ if (IsDrive(aFileName))
+ return EFalse;
+ return !(IsDir(aFileName, aFs));
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
+ {
+ //Is the name a directory?
+ TEntry entry;
+ TInt err = aFs.Entry(aFileName, entry);
+ if (err)
+ return EFalse;
+ else
+ return entry.IsDir();
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
+ {
+ //horrible little function to figure if the path is just a drive
+ TBool retVal = EFalse;
+ if (aFileName.Length()==3) //eg "c:\"
+ {
+ if ((aFileName[1] == ':') && (aFileName[2] == '\\'))
+ retVal=ETrue;
+ }
+ else if (aFileName.Length()==2) //eg "c:"
+ {
+ if (aFileName[1] == ':')
+ retVal=ETrue;
+ }
+ return retVal;
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/src/mmstestuitimer.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include "mmstestuitimer.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::CTestUiTimer(): CTimer( 5 )
+ {
+ period = KPeriod;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer* CTestUiTimer::NewL()
+ {
+ CTestUiTimer* self = new(ELeave) CTestUiTimer();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::~CTestUiTimer()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::IssueRequest()
+ {
+ // No operation to cancel if this function is called
+ iObject = NULL;
+ After(period);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
+ {
+ iObject = aObject;
+ TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
+ After( timeout );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::DoCancel()
+ {
+ CTimer::DoCancel();
+ if ( iObject )
+ {
+ iObject->Cancel();
+ iObject = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::RunL()
+ {
+ if ( iObject )
+ {
+ // If we timeout while holding an active object, we cancel it
+ iObject->Cancel();
+ iObject = NULL;
+ }
+ else
+ {
+ CActiveScheduler::Stop();
+ }
+ }
+
+// ======== GLOBAL FUNCTIONS ========
+
Binary file messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/data/SmileyFace.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/data/testmmsplugin.cfg Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,1 @@
+TestMmsPlugin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/data/testmmsplugin.pl Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,182 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+#!/usr/bin/perl -w
+use warnings;
+use strict;
+
+my $TOTALCASES = 0;
+my $TOTALPASSED = 0;
+my $TOTALRUN = 0;
+my $TOTALFAILED = 0;
+my $TOTALSKIPPED = 0;
+
+sub parse_line
+{
+ my $line = $_[0];
+ my @parts = split (" ", $line);
+ my $passed = $parts[1];
+ my $failed = $parts[3];
+ my $skipped = $parts[5];
+
+ my $total = $passed + $failed + $skipped;
+ my $passrate = $passed * 100 / $total;
+ my $passrateround = sprintf("%.0f",$passrate);
+ my $runrate = ($total - $skipped)*100/$total;
+ my $runrateround = sprintf("%.0f",$runrate);
+
+ $TOTALCASES += $total;
+ $TOTALPASSED += $passed;
+ $TOTALRUN += ($total - $skipped);
+ $TOTALFAILED += $failed;
+ $TOTALSKIPPED += $skipped;
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$passed\n";
+ printf MYFILE "</td>\n";
+
+ if($failed > 0)
+ {
+ printf MYFILE "<td style=\"font-weight:bold;color:red\">\n";
+ printf MYFILE "$failed\n";
+ printf MYFILE "</td>\n";
+ }
+ else
+ {
+ printf MYFILE "<td>\n";
+ printf MYFILE "$failed\n";
+ printf MYFILE "</td>\n";
+ }
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$skipped\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$total\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE ("$passrateround %%\n");
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$runrateround %%\n";
+ printf MYFILE "</td>\n";
+
+
+}
+
+sub parse_file
+ {
+ my $pattern = "Totals";
+ my $file = $_[0];
+ open (FILE,$file);
+
+ while (my $line= <FILE>)
+ {
+ chomp ($line);
+ if ($line =~ m/$pattern/)
+ {
+ parse_line $line;
+ }
+ }
+ close(FILE);
+ }
+
+
+sub generate_report
+ {
+ open (MYFILE, '>/epoc32/winscw/c/logs/messagingtestsuite/report.html');
+ printf MYFILE "<html>\n";
+ printf MYFILE "<body>\n";
+ printf MYFILE "<head>\n";
+ printf MYFILE "<title>MsgApp Test Suite Reports</title>";
+ printf MYFILE "</head>\n";
+ printf MYFILE "<h2 align = center>Messaging101 Test Suite Report</h2>\n";
+ printf MYFILE "<table border = 2 cellpadding = 10 align = center>\n";
+ printf MYFILE "<tr style = \" background-color:lavender \">\n";
+ printf MYFILE "<th>Module</th>\n";
+ printf MYFILE "<th style = color:green>Passed</th>\n";
+ printf MYFILE "<th style = color:red>Failed</th>\n";
+ printf MYFILE "<th style = color:chocolate>Skipped</th>\n";
+ printf MYFILE "<th>Total Cases</th>\n";
+ printf MYFILE "<th>Pass Rate</th>\n";
+ printf MYFILE "<th>Run Rate</th>\n";
+ printf MYFILE "</tr>\n";
+
+
+ my @files = </epoc32/winscw/c/logs/messagingtestsuite/*.txt>;
+ foreach my $file (@files)
+ {
+ my @splitedpath = split("/",$file);
+ my $filename = $splitedpath[-1];
+ my $length = length($filename);
+ my $name = substr($filename,11,$length-15);
+ printf MYFILE "<tr>\n";
+ printf MYFILE "<td>\n";
+ printf MYFILE "<a HREF=$filename style = text-decoration:none><b>$name</b></a>\n";
+ printf MYFILE "</td>\n";
+
+ parse_file $file;
+
+ printf MYFILE "</tr>\n";
+ }
+
+ printf MYFILE "<tr style= \"font-weight:bold; color:white; background-color:gray\">\n";
+ printf MYFILE "<td>\n";
+ printf MYFILE "<b>Overall</b>\n";
+ printf MYFILE "</td>\n";
+
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALPASSED\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALFAILED\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALSKIPPED\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALCASES\n";
+ printf MYFILE "</td>\n";
+
+ my $passrate = $TOTALPASSED*100/$TOTALCASES;
+ my $passrateround = sprintf("%.0f",$passrate);
+ printf MYFILE "<td>\n";
+ printf MYFILE "$passrateround%%\n";
+ printf MYFILE "</td>\n";
+
+ my $runrate = ($TOTALCASES - $TOTALSKIPPED)*100/$TOTALCASES;
+ my $runrateround = sprintf("%.0f",$runrate);
+ printf MYFILE "<td>\n";
+ printf MYFILE "$runrateround%%\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "</tr>\n";
+
+ printf MYFILE "</table>\n";
+ printf MYFILE "</body>\n";
+ printf MYFILE "</html>\n";
+
+ close (MYFILE);
+ }
+
+
+generate_report;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/inc/testmmsplugin.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: - Main test class for Msgnotification -indicator plugin,
+ * -notification dialog plugin
+ */
+
+#ifndef TEST_MMS_PLUGIN_H
+#define TEST_MMS_PLUGIN_H
+
+#ifdef BUILD_TEST_DLL
+#define TEST_EXPORT Q_DECL_EXPORT
+#else
+#define TEST_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <e32const.h>
+
+class UniEditorMmsPlugin;
+class ConvergedMessage;
+class MmsTestBed;
+class QSignalSpy;
+
+class TEST_EXPORT TestMmsPlugin: public QObject
+ {
+ Q_OBJECT
+
+private slots:
+
+ /**
+ * Called by framework,its called before the 1st test function is executed.
+ */
+
+ void initTestCase();
+
+ /**
+ * Called by framework,its called before each test function is executed.
+ */
+
+ void init();
+
+ /**
+ * Test Sending MMS
+ */
+
+ void testSendMMS();
+
+ /**
+ * Test receiving MMS
+ */
+
+ void testMmsReceived();
+
+ /**
+ * Called by framework,its called after each test function is executed.
+ */
+
+ void cleanup();
+
+ /**
+ * Called by framework,its called after the last test function is executed.
+ */
+
+ void cleanupTestCase();
+
+private:
+
+ QSignalSpy *spy_draft;
+ QSignalSpy *spy_outbox;
+ QSignalSpy *spy_sent;
+
+ UniEditorMmsPlugin* msgPlugin;
+ int mmsId;
+ MmsTestBed* mmstestbed;
+
+ };
+#endif //TEST_MMS_PLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/inc/testmmsplugin.ini Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,12 @@
+//this file is used to provide predefined set of input data.
+
+const char TEST_MSG_RECIEPIENT[] = "+919000";
+const char TEST_MSG_FROM2[] = "999";
+const char TEST_MSG_SUBJECT[] = "Message Subject";
+const char TEST_SERVICE_NAME_MMS[] = "messaging.mserver.testservice.MMS";
+const char TEST_SENDER[] = "+918888";
+const char TEST_ATTACHMENT[] = "c:\\sample.txt";
+const char TEST_ATTACHMENT4[] = "c:\\SmileyFace.gif";
+const char TEST_ATTACHMENT5[] = "c:\\sample.txt";
+const char TEST_CC[] = "DummyCCAddress";
+const char TEST_BCC[] = "DummyBCCAddress";
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/src/testmmsplugin.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,229 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: - Main test class for Msgnotification -indicator plugin,
+ * -notification dialog plugin
+ */
+
+#include "testmmsplugin.h"
+#include <QtTest/QtTest>
+#include "debugtraces.h"
+#include <QTimer>
+#include <QSignalSpy>
+#include "convergedmessage.h"
+#include "convergedmessageid.h"
+#include "unieditormmsplugin.h"
+#include "mmstestbed.h"
+#include "testmmsplugin.ini"
+#include <QSignalSpy>
+
+
+
+//factory method to create objects.
+QObject* getObject(QString className)
+{
+ if(className == "TestMmsPlugin" )
+ {
+ return new TestMmsPlugin;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+//main entry point
+int main(int argc, char *argv[])
+ {
+ int ret = -1;
+ QCoreApplication app(argc, argv);
+
+ //the configuration file.
+ QFile data("c:/testmmsplugin.cfg");
+ if (data.open(QFile::ReadOnly))
+ {
+ QTextStream in(&data);
+ while(!in.atEnd())
+ {
+ QString name = in.readLine();
+ QObject* tc = getObject(name);
+
+ if(tc)
+ {
+ ret = QTest::qExec(tc, argc, argv);
+ delete tc;
+ }
+ }
+ }
+ return ret;
+
+ }
+
+
+
+
+
+
+//---------------------------------------------------------------
+// TestMmsPlugin::initTestCase
+//---------------------------------------------------------------
+
+void TestMmsPlugin::initTestCase()
+{
+ qRegisterMetaType<long int> ("long int");
+ msgPlugin = new UniEditorMmsPlugin();
+ QVERIFY(msgPlugin != 0);
+ mmsId = -1;
+ mmstestbed = new MmsTestBed;
+ QVERIFY(mmstestbed != 0);
+ if(!mmstestbed)
+ {
+ QSKIP("Mmstestbed creation failed", SkipAll);
+ }
+
+ spy_draft = new QSignalSpy(mmstestbed,SIGNAL(entryCreatedInDraft(long int)));
+ spy_outbox = new QSignalSpy(mmstestbed,SIGNAL(entryMovedToOutbox(long int)));
+ spy_sent = new QSignalSpy(mmstestbed,SIGNAL(entryMovedToSent(long int)));
+
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::init
+//---------------------------------------------------------------
+
+void TestMmsPlugin::init()
+{
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testSendMMS
+//---------------------------------------------------------------
+
+void TestMmsPlugin::testSendMMS()
+{
+
+ qRegisterMetaType<long int> ("long int");
+ QString service = TEST_SERVICE_NAME_MMS;
+
+ QString subject = TEST_MSG_SUBJECT;
+ qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
+
+ QString sender(TEST_SENDER);
+ ConvergedMessageAddress address(sender);
+ ConvergedMessageAttachmentList attachmentList;
+
+ QString attachment2Path = TEST_ATTACHMENT4;
+ ConvergedMessageAttachment* attachment2 =
+ new ConvergedMessageAttachment(attachment2Path, ConvergedMessageAttachment::EAttachment);
+
+ QString attachmentPath = TEST_ATTACHMENT5;
+ ConvergedMessageAttachment* attachment =
+ new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
+
+ attachmentList.append(attachment);
+ attachmentList.append(attachment2);
+ ConvergedMessage msg;
+ msg.setMessageType(ConvergedMessage::Mms);
+ msg.setSubject(subject);
+ msg.setTimeStamp(timeStamp);
+ msg.addToRecipient(address);
+ msg.addAttachments(attachmentList);
+ msg.setPriority(ConvergedMessage::Normal);
+ //Adding alias
+ ConvergedMessageAddress address1;
+ address1.setAlias(QString(TEST_MSG_RECIEPIENT));
+ msg.addToRecipient(address1);
+
+ //Adding CC Address
+ QString ccAddress(TEST_CC);
+ ConvergedMessageAddress ccAdd(ccAddress);
+ msg.addCcRecipient(ccAdd);
+
+ //Adding BCC Address
+ QString bccAddress(TEST_BCC);
+ ConvergedMessageAddress bccAdd(bccAddress);
+ msg.addBccRecipient(bccAdd);
+
+ mmstestbed->cleanAll();
+ mmstestbed->setConnectionLocal(true);
+ long int id = msgPlugin->convertTo(&msg);
+
+ QVERIFY(id != 0);
+ msgPlugin->send(id);
+ QTest::qWait(5000);
+ long int idRec;
+
+ if( 1 == spy_draft->count())
+ {
+ void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
+ idRec = *reinterpret_cast< long int(*)>(temp);
+ QDEBUG_WRITE("passed: spy_draft.count");
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to create message in Draft");
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+ if( 1 == spy_outbox->count())
+ {
+ mmstestbed->fromOutboxToMmsc();
+ QDEBUG_WRITE("passed: spy_outbox.count");
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+
+ if( 1 == spy_sent->count())
+ {
+ void * temp = const_cast<void*>(spy_sent->at(0).at(0).data());
+ long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
+ QCOMPARE(sentmsgid, idRec);
+ mmstestbed->fromMmscToInbox();
+ QDEBUG_WRITE("passed: spy_sent.count");
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testMmsReceived
+//---------------------------------------------------------------
+void TestMmsPlugin::testMmsReceived()
+{
+ QTest::qWait(5000);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::cleanup
+//---------------------------------------------------------------
+void TestMmsPlugin::cleanup()
+{
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::cleanupTestCase
+//---------------------------------------------------------------
+void TestMmsPlugin::cleanupTestCase()
+{
+ delete msgPlugin;
+ delete mmstestbed;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/testmmsplugin.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,177 @@
+
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+QT += testlib
+QT -= gui
+
+CONFIG += hb
+CONFIG += symbian_test
+
+TEMPLATE = app
+TARGET = testmmsplugin
+
+INCLUDEPATH += inc
+INCLUDEPATH += ../../inc
+INCLUDEPATH += ../../../../../../../../inc
+INCLUDEPATH += ../../../../../../inc
+INCLUDEPATH += ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc
+INCLUDEPATH += ../../../../../msgutils/unidatautils/unidatamodel/inc
+INCLUDEPATH += ../../../../../msgutils/unieditorutils/editorgenutils/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/inc
+INCLUDEPATH += ../mmstestbed/inc
+INCLUDEPATH +=
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_TEST_DLL
+
+SOURCES += \
+ src/testmmsplugin.cpp \
+ ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp \
+ ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp
+
+
+# Input
+HEADERS += \
+ inc/testmmsplugin.h \
+ ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin.h \
+ ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h
+
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+symbian {
+ TARGET.UID3 = 0xE7232a7c
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.EPOCSTACKSIZE = 0x8000
+ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+ TARGET.EPOCALLOWDLLDATA = 1
+ VENDORID = VID_DEFAULT
+ BLD_INF_RULES.prj_exports += "data/testmmsplugin.cfg c:/testmmsplugin.cfg"
+ BLD_INF_RULES.prj_exports += "data/testmmsplugin.pl c:/testmmsplugin.pl"
+ BLD_INF_RULES.prj_exports += "data/SmileyFace.gif c:/SmileyFace.gif"
+ BLD_INF_RULES.prj_exports += "data/sample.txt c:/sample.txt"
+
+ }
+
+ LIBS += -leuser \
+ -lcsserverclientapi \
+ -lcsutils \
+ -lconvergedmessageutils \
+ -lMsgMedia \
+ -leikctl \
+ -leditorgenutils \
+ -lcone \
+ -leikcoctl \
+ -leikcore \
+ -leikdlg \
+ -lmsgs \
+ -letext \
+ -lmmsserversettings \
+ -lgsmu \
+ -lmmsgenutils \
+ -lefsrv \
+ -lestor \
+ -lsmcm \
+ -lCommonEngine \
+ -lbafl \
+ -lCdlEngine \
+ -lFeatMgr \
+ -lapmime \
+ -lapgrfx \
+ -lcharconv \
+ -lInetProtUtil \
+ -lsmildtd \
+ -lxmldom \
+ -lxmlparser \
+ -lcone \
+ -lQtCore \
+ -letel \
+ -lmmsmessage \
+ -lcommdb \
+ -lcommsdat \
+ -letelmm \
+ -lunidatamodelloader \
+ -lunidatamodel \
+ -lavkon \
+ -leikcoctl \
+ -leikctl \
+ -lform \
+ -luiklaf\
+ -lxqutils\
+ -lmmstestbed\
+ -lmsginit \
+ -lmsgs \
+ -letext \
+ -lsmcm \
+ -lmmsmessage \
+ -lmmsserversettings \
+ -lmmscli \
+ -lxqservice \
+ -lQtContacts \
+ -lQtVersit \
+ -lunidatamodelloader \
+ -lxqsettingsmanager \
+ -apgrfx.lib \
+ -lxqutils \
+ -lws32 \
+ -lapgrfx \
+ -lxqsystemtoneservice
+
+
+
+packageheader = "$${LITERAL_HASH}{\"QTestLibCVsClientServerTest\"},(0xE7232a7c),1,0,0,TYPE=SA"
+
+vendorinfo = \
+ "; Localised Vendor name" \
+ "%{\"Nokia\"}" \
+ "; Unique Vendor name" \
+ ":\"Nokia\""
+
+dependencyinfo = \
+ "; Default HW/platform dependencies" \
+ "[0x101F7961],0,0,0,{\"S60ProductID\"}" \
+ "[0x2001E61C],4,6,3,{"Qt"}
+
+default_deployment.pkg_prerules = packageheader \
+ vendorinfo \
+ dependencyinfo
+
+#Copy the dependent DLL
+symbian: {
+ addCfg.sources = ./data/testmmsplugin.cfg
+ addCfg.path = C:/
+ DEPLOYMENT += addCfg
+
+ addPl.sources = ./data/testmmsplugin.pl
+ addPl.path = C:/
+ DEPLOYMENT += addPl
+
+ addFiles.sources = mmstestbed.dll
+ addFiles.path = /sys/bin
+ DEPLOYMENT += addFiles
+
+ addP2.sources = ./data/SmileyFace.gif
+ addP2.path = C:/
+ DEPLOYMENT += addP2
+
+ addP3.sources = ./data/sample.txt
+ addP3.path = C:/
+ DEPLOYMENT += addP3
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/unittest_mmsplugin.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,28 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+CONFIG += symbian_test
+CONFIG += ordered
+
+#Sub .pro files
+SUBDIRS += mmstestbed/mmstestbed.pro
+SUBDIRS += testmmsgplugin/testmmsplugin.pro
+
+
+# Platforms
+SYMBIAN_PLATFORMS = DEFAULT
\ No newline at end of file
--- a/messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h Wed Aug 18 09:45:25 2010 +0300
@@ -21,7 +21,10 @@
#include <QObject>
#include <QVariant>
+#include <HbEffect>
+class QGraphicsItem;
+class QGraphicsPixmapItem;
class HbMainWindow;
class MsgUnifiedEditorView;
class UnifiedViewer;
@@ -123,6 +126,35 @@
*/
void handleBTMessage(int msgId);
+ /**
+ * Start a custom effect animation
+ * e.g. editor's send effect
+ * @param effectEvent, effect type for animation
+ */
+ void startAnimation(QString effectEvent);
+
+ /**
+ * Reset a custom effect animation
+ * e.g. editor's send effect
+ * @param effectEvent, animation effect type which needs to be reset
+ * @param item, QGraphicsItem on which the effect was run
+ */
+ void resetAnimation(QString effectEvent, QGraphicsItem* item);
+
+ /**
+ * Grab screenshot for animation purpose
+ * e.g. editor's send effect animation
+ * @return QGraphicsPixmapItem, item on which animation will run
+ */
+ QGraphicsPixmapItem *screenShot();
+
+ /**
+ * find and return animation file for an effect
+ * @param effectEvent, effect for which file definition needs to be found
+ * @return QString, animation definition file path
+ */
+ QString getAnimationFile(QString effectEvent);
+
private slots:
/**
* This slot is called on mainwindows back action.
@@ -146,7 +178,14 @@
* @param action selected action (yes or no)
*/
void onDialogSaveTone(HbAction* action);
-
+
+ /**
+ * Handle a custom effect animation complete signal
+ * e.g. editor's send effect complete
+ * @param status, status information of the effect that has finished
+ */
+ void onAnimationComplete(const HbEffect::EffectStatus &status);
+
private:
/**
* Main window pointer.
@@ -192,8 +231,7 @@
/**
* message Id
*/
- int mMessageId;
-
+ int mMessageId;
};
#endif /* MSGSERVICEVIEWMANAGER_H_ */
--- a/messagingapp/msgservices/msgserviceapp/msgserviceapp.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/msgserviceapp.pro Wed Aug 18 09:45:25 2010 +0300
@@ -64,4 +64,8 @@
BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
- ".\rom\msgserviceapp.iby CORE_APP_LAYER_IBY_EXPORT_PATH(msgserviceapp.iby)"
+ ".\rom\msgserviceapp.iby CORE_APP_LAYER_IBY_EXPORT_PATH(msgserviceapp.iby)" \
+ "resources/messagingsendservice.splashml /epoc32/data/z/resource/hb/splashml/messagingsendservice.splashml" \
+ "resources/messagingsendservice.docml /epoc32/data/z/resource/hb/splashml/messagingsendservice.docml" \
+ "resources/messagingviewservice.splashml /epoc32/data/z/resource/hb/splashml/messagingviewservice.splashml" \
+ "resources/messagingviewservice.docml /epoc32/data/z/resource/hb/splashml/messagingviewservice.docml"
--- a/messagingapp/msgservices/msgserviceapp/msgserviceapp.qrc Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/msgserviceapp.qrc Wed Aug 18 09:45:25 2010 +0300
@@ -1,5 +1,5 @@
<RCC>
- <qresource prefix="/translations">
- <file alias="messaging_en_GB">resources/messaging_en_GB</file>
+ <qresource prefix="/effects">
+ <file alias="sendeffect.fxml">resources/sendeffect.fxml</file>
</qresource>
</RCC>
Binary file messagingapp/msgservices/msgserviceapp/resources/messaging_en_GB has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/resources/messagingsendservice.docml Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="1.1">
+ <object name="viewextn" type="HbAction">
+ <icon iconName="qtg_mono_sort" name="icon"/>
+ </object>
+ <object name="newmsg" type="HbAction">
+ <icon iconName="qtg_mono_create_message" name="icon"/>
+ </object>
+ <object name="settings" type="HbAction">
+ <string locid="txt_messaging_opt_settings" name="text" value="Settings"/>
+ </object>
+ <widget name="view" type="HbView">
+ <widget name="content" role="HbView:widget" type="HbWidget">
+ <layout type="anchor"/>
+ </widget>
+ <widget name="viewToolbar" role="HbView:toolBar" type="HbToolBar"/>
+ <widget name="viewMenu" role="HbView:menu" type="HbMenu">
+ <ref object="settings" role="HbWidget:addAction"/>
+ </widget>
+ <string locid="txt_messaging_title_messaging" name="title" value="Messaging"/>
+ </widget>
+ <metadata activeUIState="Common ui state" display="NHD-3.2-inch_portrait" unit="un">
+ <uistate name="Common ui state" sections="#common"/>
+ </metadata>
+</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/resources/messagingsendservice.splashml Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,7 @@
+<hbsplash version="1">
+ <screenid>sendservice</screenid>
+ <docml>messagingsendservice.docml</docml>
+ <widget>view</widget>
+ <appuid>0x2002E6DA</appuid>
+ <tsappname>Messaging</tsappname>
+</hbsplash>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/resources/messagingviewservice.docml Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="1.1">
+ <object name="viewextn" type="HbAction">
+ <icon iconName="qtg_mono_sort" name="icon"/>
+ </object>
+ <object name="newmsg" type="HbAction">
+ <icon iconName="qtg_mono_create_message" name="icon"/>
+ </object>
+ <object name="settings" type="HbAction">
+ <string locid="txt_messaging_opt_settings" name="text" value="Settings"/>
+ </object>
+ <widget name="view" type="HbView">
+ <widget name="content" role="HbView:widget" type="HbWidget">
+ <layout type="anchor"/>
+ </widget>
+ <widget name="viewToolbar" role="HbView:toolBar" type="HbToolBar"/>
+ <string locid="txt_messaging_title_messaging" name="title" value="Messaging"/>
+ </widget>
+ <metadata activeUIState="Common ui state" display="NHD-3.2-inch_portrait" unit="un">
+ <uistate name="Common ui state" sections="#common"/>
+ </metadata>
+</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/resources/messagingviewservice.splashml Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,7 @@
+<hbsplash version="1">
+ <screenid>viewservice</screenid>
+ <docml>messagingviewservice.docml</docml>
+ <widget>view</widget>
+ <appuid>0x2002E6DA</appuid>
+ <tsappname>Messaging</tsappname>
+</hbsplash>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/resources/sendeffect.fxml Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,49 @@
+<layers>
+ <visual>
+ <param name="opacity" type="anim">
+ <duration>1.5</duration>
+ <keyframe at="0.0">1.0</keyframe>
+ <keyframe at="1.0">0.0</keyframe>
+ <style>linear</style>
+ </param>
+ <param name="rotation_angle" type="anim">
+ <style>outquad</style>
+ <duration>1.5</duration>
+ <keyframe at="0.0">0.0</keyframe>
+ <keyframe at="1.0">60.0</keyframe>
+ </param>
+ <param name="rotation_origin_x" ref="visual.width">0.5</param>
+ <param name="rotation_origin_y" ref="visual.height">0.5</param>
+ <param name="rotation_axis_x">1</param>
+ <param name="scale_x" type="anim">
+ <style>outquad</style>
+ <duration>1.5</duration>
+ <keyframe at="0.0">1.0</keyframe>
+ <keyframe at="1.0">0.5</keyframe>
+ </param>
+ <param name="scale_origin_x" ref="visual.width">0.5</param>
+ <param name="scale_origin_y" ref="visual.height">0.5</param>
+ <param name="scale_y" type="anim">
+ <style>outquad</style>
+ <duration>1.5</duration>
+ <keyframe at="0.0">1.0</keyframe>
+ <keyframe at="1.0">0.5</keyframe>
+ </param>
+ <param name="translation_y" type="anim">
+ <duration>1.5</duration>
+ <style>inoutquad</style>
+ <keyframe at="0.0">0.0</keyframe>
+ <keyframe at="1.0">-1.0</keyframe>
+ <start ref="visual.top">1.0</start>
+ <end ref="screen.bottom">1.0</end>
+ </param>
+ <param name="translation_x" type="anim">
+ <duration>1.5</duration>
+ <style>outquad</style>
+ <keyframe at="0.0">0.0</keyframe>
+ <keyframe at="1.0">1.0</keyframe>
+ <start ref="visual.left">1.0</start>
+ <end ref="screen.left">1.0</end>
+ </param>
+ </visual>
+</layers>
\ No newline at end of file
--- a/messagingapp/msgservices/msgserviceapp/rom/msgserviceapp.iby Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/rom/msgserviceapp.iby Wed Aug 18 09:45:25 2010 +0300
@@ -22,4 +22,10 @@
data=DATAZ_\resource\apps\msgserviceapp.rsc resource\apps\msgserviceapp.rsc
data=DATAZ_\private\10003a3f\import\apps\msgserviceapp_reg.rsc private\10003a3f\import\apps\msgserviceapp_reg.rsc
+<clip>
+ data=ZRESOURCE\hb\splashml\messagingsendservice.splashml RESOURCE_FILES_DIR\hb\splashml\messagingsendservice.splashml
+ data=ZRESOURCE\hb\splashml\messagingsendservice.docml RESOURCE_FILES_DIR\hb\splashml\messagingsendservice.docml
+ data=ZRESOURCE\hb\splashml\messagingviewservice.splashml RESOURCE_FILES_DIR\hb\splashml\messagingviewservice.splashml
+ data=ZRESOURCE\hb\splashml\messagingviewservice.docml RESOURCE_FILES_DIR\hb\splashml\messagingviewservice.docml
+</clip>
#endif
--- a/messagingapp/msgservices/msgserviceapp/src/main.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/src/main.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -21,6 +21,8 @@
#include <QFile>
#include <QPointer>
#include <QDateTime>
+#include <HbSplashScreen>
+#include <xqserviceutil.h>
#include "msgservicewindow.h"
#include "debugtraces.h"
@@ -29,6 +31,7 @@
#define LOC_TITLE hbTrId("txt_messaging_title_messaging")
const QString debugFileName("c:/msgservice_app.txt");
+const QString TRANSLATOR_FILE_PATH("z:/resource/qt/translations/");
#ifdef _DEBUG_TRACES_
void debugInit(QtMsgType type, const char *msg)
@@ -75,19 +78,29 @@
int main(int argc, char **argv)
{
+ // if else loop to launch the splash screen based on the service called.
+
+ QString serviceName = XQServiceUtil::interfaceName( argc, argv);
+
+ if( !serviceName.compare( QString( "com.nokia.symbian.IMessageSend") ) )
+ {
+ HbSplashScreen::setScreenId( "sendservice" );
+ }
+ else if ( !serviceName.compare( "com.nokia.symbian.IMessageView") )
+ {
+ HbSplashScreen::setScreenId( "viewservice" );
+ }
+
HbApplication app( argc, argv );
- //TODO: Uncomment the lines when actual
- //translation files are available in sdk and remove loading locally.
+ //installing translator.
QString locale = QLocale::system().name();
- QString path = "z:/resource/qt/translations/";
QTranslator translator;
- //QTranslator translator_comm;
- //translator.load(path + QString("messaging_") + locale);
- //translator_comm.load(path + QString("common_") + locale);
- translator.load( "messaging_en_GB", ":/translations" );
+ QTranslator translator_comm;
+ translator.load(TRANSLATOR_FILE_PATH + QString("messaging_") + locale);
+ translator_comm.load(TRANSLATOR_FILE_PATH + QString("common_") + locale);
app.installTranslator(&translator);
- //app.installTranslator(&translator_comm);
+ app.installTranslator(&translator_comm);
app.setApplicationName(LOC_TITLE);
--- a/messagingapp/msgservices/msgserviceapp/src/msgserviceviewmanager.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/src/msgserviceviewmanager.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -17,6 +17,7 @@
#include "msgserviceviewmanager.h"
+#include <QPixmap>
#include <HbMainWindow>
#include <HbAction>
#include <HbApplication>
@@ -35,6 +36,10 @@
#include "unidatamodelloader.h"
#include "unidatamodelplugininterface.h"
+// CONSTANTS
+static const char SEND_EFFECT[] = "sendeffect";
+static const char SEND_EFFECT_FILE[] = ":/effects/sendeffect.fxml";
+
// LOCALIZATION
#define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
#define LOC_DLG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone")
@@ -128,7 +133,8 @@
void MsgServiceViewManager::switchView(const QVariantList& data)
{
int viewId = data.at(0).toInt();
- switch (viewId) {
+ switch (viewId)
+ {
case MsgBaseView::UNIEDITOR:
{
// except first 2 parameters pass other parameters
@@ -148,9 +154,18 @@
}
default:
{
- HbApplication::quit();
+ // if send from editor is successful, then run effects
+ int previousView = data.at(1).toInt();
+ if(previousView == MsgBaseView::UNIEDITOR)
+ {
+ startAnimation(SEND_EFFECT);
+ }
+ else
+ {
+ HbApplication::quit();
+ }
}
- }
+ }
}
//----------------------------------------------------------------------------
@@ -161,6 +176,7 @@
const qint32 contactId,
const QString displayName)
{
+ Q_UNUSED(contactId);
ConvergedMessage message;
ConvergedMessageAddress address;
address.setAddress(phoneNumber);
@@ -557,3 +573,123 @@
HbApplication::quit();
}
+//-----------------------------------------------------------------------------
+//MsgServiceViewManager::startAnimation
+//@see header
+//-----------------------------------------------------------------------------
+void MsgServiceViewManager::startAnimation(QString effectEvent)
+ {
+ // take screen shot
+ QGraphicsPixmapItem *animationScreenShot = screenShot();
+ if (animationScreenShot)
+ {
+ // but don't show it yet.
+ animationScreenShot->hide();
+ animationScreenShot->setPos(0,0);
+ animationScreenShot->setZValue(0);
+
+ // hide items, so that background app's items are visible immediately
+ mMainWindow->currentView()->hideItems(Hb::AllItems);
+
+ // reset background & set the base transparent
+ mMainWindow->setBackgroundImageName(
+ mMainWindow->orientation(), QString("dummy_blank"));
+ QPalette p = mMainWindow->viewport()->palette();
+ p.setColor(QPalette::Base, Qt::transparent);
+ mMainWindow->viewport()->setPalette(p);
+
+ // add animating item directly to the scene
+ mMainWindow->scene()->addItem(animationScreenShot);
+
+ // hide other views
+ QList<HbView*> vws = mMainWindow->views();
+ while (!vws.isEmpty())
+ {
+ HbView* view = vws.takeLast();
+ view->hide();
+ }
+
+ // now show the animating item, and start animation on it
+ animationScreenShot->show();
+ QString effectFile = getAnimationFile(effectEvent);
+ HbEffect::add(animationScreenShot, effectFile, effectEvent);
+ HbEffect::start(animationScreenShot, effectEvent, this,
+ "onAnimationComplete");
+ }
+ }
+
+//-----------------------------------------------------------------------------
+//MsgServiceViewManager::resetAnimation
+//@see header
+//-----------------------------------------------------------------------------
+void MsgServiceViewManager::resetAnimation(
+ QString effectEvent,
+ QGraphicsItem* item)
+ {
+ if (item)
+ {
+ QString effectFile = getAnimationFile(effectEvent);
+ HbEffect::remove(item, effectFile, effectEvent);
+ mMainWindow->scene()->removeItem(item);
+ delete item;
+ item = NULL;
+ }
+ }
+
+//-----------------------------------------------------------------------------
+//MsgServiceViewManager::onAnimationComplete
+//@see header
+//-----------------------------------------------------------------------------
+void MsgServiceViewManager::onAnimationComplete(
+ const HbEffect::EffectStatus &status)
+ {
+ QGraphicsItem* item = status.item;
+ QString effectEvent = status.effectEvent;
+ resetAnimation(effectEvent, item);
+ HbApplication::quit();
+ }
+
+//-----------------------------------------------------------------------------
+//MsgServiceViewManager::screenShot
+//@see header
+//-----------------------------------------------------------------------------
+QGraphicsPixmapItem* MsgServiceViewManager::screenShot()
+ {
+ // set fullscreen and hide unwanted items
+ mMainWindow->currentView()->hideItems(Hb::ToolBarItem | Hb::DockWidgetItem | Hb::StatusBarItem);
+ mMainWindow->currentView()->setContentFullScreen(true);
+
+ // grab whole view into pixmap image
+ QPixmap screenCapture = QPixmap::grabWindow(mMainWindow->internalWinId());
+
+ // create an QGraphicsItem to do animation
+ QGraphicsPixmapItem *ret(NULL);
+
+ // for landscape, the screenshot must be rotated
+ if(mMainWindow->orientation() == Qt::Horizontal)
+ {
+ QMatrix mat;
+ mat.rotate(-90); // rotate 90 degrees counter-clockwise
+ ret = new QGraphicsPixmapItem(screenCapture.transformed(mat));
+ }
+ else
+ {
+ ret = new QGraphicsPixmapItem(screenCapture);
+ }
+ return ret;
+ }
+
+//-----------------------------------------------------------------------------
+//MsgServiceViewManager::getAnimationFile
+//@see header
+//-----------------------------------------------------------------------------
+QString MsgServiceViewManager::getAnimationFile(QString effectEvent)
+ {
+ QString animFile;
+ if(effectEvent == SEND_EFFECT)
+ {
+ animFile.append(SEND_EFFECT_FILE);
+ }
+
+ return animFile;
+ }
--- a/messagingapp/msgservices/msgserviceapp/src/msgservicewindow.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/src/msgservicewindow.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -34,14 +34,16 @@
// MsgServiceWindow::MsgServiceWindow
// @see header
// ----------------------------------------------------------------------------
-MsgServiceWindow::MsgServiceWindow():HbMainWindow(),mSendInterface(NULL),
+MsgServiceWindow::MsgServiceWindow():HbMainWindow(
+ NULL,Hb::WindowFlagTransparent),
+mSendInterface(NULL),
mViewInterface(NULL),
mShareUiInterface(NULL),
mStoreHandler(NULL),
mViewManager(NULL)
{
// create stote handler
- mStoreHandler = new MsgStoreHandler();
+ mStoreHandler = q_check_ptr(new MsgStoreHandler());
// create view manager
mViewManager = new MsgServiceViewManager(mStoreHandler,this);
--- a/messagingapp/msgservices/msgserviceapp/src/msgstorehandler.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/src/msgstorehandler.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -30,7 +30,7 @@
MsgStoreHandler::MsgStoreHandler():
iMsvSession(NULL)
{
- TRAP_IGNORE(InitL());
+ InitL();
}
//----------------------------------------------------------------------------
@@ -120,6 +120,21 @@
break;
case KSenduiMtmBioUidValue:
{
+ if (entry.iMtmData1 == KSenduiMtmBtUidValue)
+ {
+ msgType = ConvergedMessage::BT;
+
+ if (entry.iBioType == KMsgBioUidVCard.iUid)
+ {
+ msgSubType = ConvergedMessage::VCard;
+ }
+ else if (entry.iBioType == KMsgBioUidVCalendar.iUid)
+ {
+ msgSubType = ConvergedMessage::VCal;
+ }
+
+ break;
+ }
msgType = ConvergedMessage::BioMsg;
// based on the biotype uid set message type
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/tsrc/tsrc.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+CONFIG += ordered
+
+#Sub .pro files
+SUBDIRS += msgserviceapptest/msgserviceapptest.pro
+
+# Platforms
+SYMBIAN_PLATFORMS = DEFAULT
\ No newline at end of file
--- a/messagingapp/msgsettings/bwins/msginitu.def Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/bwins/msginitu.def Wed Aug 18 09:45:25 2010 +0300
@@ -1,5 +1,6 @@
EXPORTS
?NewL@CMsgSimOperation@@SAPAV1@AAVMSimOperationObserver@@@Z @ 1 NONAME ; class CMsgSimOperation * CMsgSimOperation::NewL(class MSimOperationObserver &)
- ??0MsgSimNumDetector@@QAE@XZ @ 2 NONAME ; MsgSimNumDetector::MsgSimNumDetector(void)
- ??1MsgSimNumDetector@@QAE@XZ @ 3 NONAME ; MsgSimNumDetector::~MsgSimNumDetector(void)
+ ??_EMsgSimNumDetector@@UAE@I@Z @ 2 NONAME ; MsgSimNumDetector::~MsgSimNumDetector(unsigned int)
+ ??0MsgSimNumDetector@@QAE@XZ @ 3 NONAME ; MsgSimNumDetector::MsgSimNumDetector(void)
+ ??1MsgSimNumDetector@@UAE@XZ @ 4 NONAME ; MsgSimNumDetector::~MsgSimNumDetector(void)
--- a/messagingapp/msgsettings/eabi/msginitu.def Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/eabi/msginitu.def Wed Aug 18 09:45:25 2010 +0300
@@ -2,6 +2,9 @@
_ZN16CMsgSimOperation4NewLER21MSimOperationObserver @ 1 NONAME
_ZN17MsgSimNumDetectorC1Ev @ 2 NONAME
_ZN17MsgSimNumDetectorC2Ev @ 3 NONAME
- _ZN17MsgSimNumDetectorD1Ev @ 4 NONAME
- _ZN17MsgSimNumDetectorD2Ev @ 5 NONAME
+ _ZN17MsgSimNumDetectorD0Ev @ 4 NONAME
+ _ZN17MsgSimNumDetectorD1Ev @ 5 NONAME
+ _ZN17MsgSimNumDetectorD2Ev @ 6 NONAME
+ _ZTI17MsgSimNumDetector @ 7 NONAME
+ _ZTV17MsgSimNumDetector @ 8 NONAME
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/inc/cmobilesignalstrengthhandler.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Signal strength handler implementation over telephony API
+*
+*/
+
+
+
+#ifndef MOBILESIGNALSTRENGTHHANDLER_H
+#define MOBILESIGNALSTRENGTHHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <etelmm.h>
+#include "msignalstrengthhandler.h"
+
+// FORWARD DECLARATIONS
+class MSignalStrengthObserver;
+
+// CLASS DECLARATION
+
+/**
+* Class implementing a signal strength handler over the telephony API
+*/
+
+class CMobileSignalStrengthHandler : public CActive, public MSignalStrengthHandler
+{
+ public:
+ /**
+ * Two-phased constructor.
+ */
+ static CMobileSignalStrengthHandler* NewL( );
+
+ /**
+ * Destructor.
+ */
+ ~CMobileSignalStrengthHandler();
+
+ private:
+ /**
+ * C++ default constructor.
+ */
+ CMobileSignalStrengthHandler();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ public: // from CActive
+ /**
+ * RunL
+ */
+ void RunL();
+
+ /**
+ * RunError
+ * @param aError the error returned
+ * @return error
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * DoCancel
+ */
+ void DoCancel();
+
+ public:
+ /**
+ * Returns ETrue if signal observing is supported, EFalse otherwise.
+ * @return ETrue if signal observing is supported, EFalse otherwise.
+ */
+ TBool ObservingSupported();
+
+ /**
+ * Returns ETrue if signal strength requests are supported, EFalse otherwise.
+ * @return ETrue if signal strength requests are supported, EFalse otherwise.
+ */
+ TBool RequestsSupported();
+
+ /**
+ * Sets the signal strength observer. May leave with KErrNotSupported
+ * if signal strength observing is not supported.
+ * @param aObserver Observer for signal strength. Ownership is not passed.
+ */
+ void SetSignalStrengthObserverL( MSignalStrengthObserver* aObserver );
+
+ /**
+ * Starts observing the signal strength. May leave with KErrNotSupported
+ * if signal strength observing is not supported.
+ */
+ void StartObservingL();
+
+ /**
+ * Stops the signal strength observing.
+ */
+ void StopObservingL();
+
+ /**
+ * Returns the current signal strength. May leave with KErrNotSupported
+ * if signal strength requests are not supported.
+ * @return The current signal strength.
+ */
+ TInt SignalStrengthL();
+
+ /**
+ * Returns the current bar value. May leave with KErrNotSupported
+ * if bar value requests are not supported.
+ * @return The current signal strength.
+ */
+ TInt BarValueL();
+
+ private: // New methods
+
+ /**
+ * Initializes server sessions.
+ */
+ void InitializeSessionsL();
+
+ /**
+ * Updates the current value of the signal strength.
+ */
+ void UpdateSignalStrengthL();
+
+ /**
+ * Notifiers observer about signal strength.
+ */
+ void NotifyObserver();
+
+ private:
+ /**
+ * Pointer to signal strength observer, may be NULL. Also not owned by the instance.
+ */
+ MSignalStrengthObserver* iObserver;
+
+ /**
+ * State variable for observation.
+ */
+ TBool iObserving;
+
+ /**
+ * Current value of the signal strength.
+ */
+ TInt32 iSignalStrength;
+
+ /**
+ * Network bars value.
+ */
+ TInt8 iBars;
+
+ /**
+ * Mobile phone.
+ */
+ RMobilePhone iMobilePhone;
+
+ /**
+ * Telephony server session.
+ */
+ RTelServer iTelServer;
+};
+
+
+#endif // MOBILESIGNALSTRENGTHHANDLER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/inc/coutboxobserver.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ * The purpose of this class is to observe if there are messages
+ * in the outbox.
+ *
+ */
+
+#ifndef OUTBOXOBSERVER_H
+#define OUTBOXOBSERVER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <msvapi.h> // for MMsvSessionObserver
+#include "msignalstrengthobserver.h"
+
+// FORWARD DECLARATIONS
+
+class CMsvSession;
+class COutboxSender;
+class MSignalStrengthHandler;
+
+// CLASS DECLARATION
+
+/**
+ * Observes if there are messages in the OutBox..
+ */
+class COutboxObserver: public CBase, public MMsvEntryObserver, public MSignalStrengthObserver
+{
+public:
+ // Constructors and destructor
+
+ /**
+ * A Two-phased constructor.
+ */
+ static COutboxObserver* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~COutboxObserver();
+
+private:
+ // From MSignalStrengthObserver
+
+ void SignalStrengthAndBarUpdatedL(TInt aNewSignalValue, TInt aNewBarValue);
+
+public:
+
+ void HandleMsvSessionReadyL(CMsvSession& aMsvSession);
+ void HandleMsvSessionClosedL();
+
+public:
+
+ /**
+ * The messaging server sends notifications of changes in the
+ * observed entry to COutboxObserver by calling this method.
+ */
+ void
+ HandleEntryEventL(TMsvEntryEvent aEvent, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/);
+
+public:
+ // New functions
+
+ /**
+ * Informs the networkstatus to Outbox Sender
+ */
+ void InformOutboxSenderL(const TInt& aNetworkBars);
+
+private:
+
+ /**
+ * A C++ constructor.
+ */
+ COutboxObserver();
+
+ /**
+ * By default Symbian OS constructor is private.
+ */
+ void ConstructL();
+
+ /**
+ * By default, prohibit copy constructor
+ */
+ COutboxObserver(const COutboxObserver&);
+
+ /**
+ * Prohibit assigment operator
+ */
+ COutboxObserver& operator=(const COutboxObserver&);
+
+ /**
+ * Creates the Msv Session and sets the outbox
+ * observer and outbox sender.
+ * @param aMsvSession The Msv session to use.
+ */
+ void StartSessionsL(CMsvSession& aMsvSession);
+
+ /**
+ * Delete session, outbox observer and outbox sender.
+ */
+ void EndSessions();
+
+private:
+ // In-box folder entry. Note that the entry is not owned by this class.
+ CMsvEntry* iOutboxFolder;
+ // Pointer to Outbox Sender.
+ COutboxSender* iOutboxSender;
+ // Signal strength handler. Owned.
+ MSignalStrengthHandler* iSignalStrengthHandler;
+};
+
+#endif // OUTBOXOBSERVER_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/inc/coutboxsender.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ * This class follows the offline status of the phone. When the mode is
+ * changed from online to offline, the sending operation is started. When
+ * the mode is changed from online to offline, the current sending
+ * operation is cancelled.
+ *
+ */
+
+#ifndef __OUTBOXSENDER_H__
+#define __OUTBOXSENDER_H__
+
+// INCLUDES
+#include <msvapi.h>
+#include <MuiuMsvSingleOpWatcher.h>
+#include <cenrepnotifyhandler.h>
+
+// FORWARD DECLARATIONS
+class CRepository;
+
+// CLASS DECLARATION
+/**
+ * COutboxSender
+ * Sends sms messages from the outbox when offline is changed back to online.
+ * It only tries to send message once. If sending fails due to other reasons
+ * than offline mode, then it is up to the user to go to outbox and send it.
+ * Note: At the moment only sms'es are sent. MMS messages are sent by mms mtm
+ * and emails are saved to outbox as 'During next connection' and those must
+ * not be sent.
+ */
+class COutboxSender: public CBase, public MMsvSingleOpWatcher, public MCenRepNotifyHandlerCallback
+{
+public:
+ // Constructors and destructor
+
+ /**
+ * A two-phased constructor.
+ */
+ static COutboxSender* NewL(CMsvSession& aMsvSession);
+
+ /**
+ * A destructor.
+ */
+ virtual ~COutboxSender();
+
+public:
+ // New functions
+
+ /**
+ * Starts the message sending operation for sms-messages.
+ */
+ void StartSendingL();
+
+ /**
+ * Cancels current message sending operation.
+ */
+ void CancelSending();
+
+ /**
+ * Checks if the sending operation is currently active.
+ */
+ TBool IsSending() const;
+
+ /**
+ * Confirms the network status and starts sending messages
+ */
+ void CheckAndStartSendingL(const TInt& aNetworkBars);
+
+public:
+ // Functions from base classes
+
+ /**
+ * From MMsvSingleOpWatcher. Deletes the sending operation.
+ */
+ virtual void OpCompleted(CMsvSingleOpWatcher& aOpWatcher, TInt aCompletionCode);
+
+ /**
+ * From MCentRepNotifyHandlerCallback.
+ */
+ void HandleNotifyInt(TUint32 aId, TInt aNewValue);
+
+ /**
+ * From MCentRepNotifyHandlerCallback.
+ */
+ void HandleNotifyError(TUint32 aId, TInt aError, CCenRepNotifyHandler* aHandler);
+
+ /**
+ * From MCentRepNotifyHandlerCallback.
+ */
+ void HandleNotifyGeneric(TUint32 aId);
+
+private:
+ /**
+ * A C++ Constructor
+ */
+ COutboxSender(CMsvSession& aMsvSession);
+
+ /**
+ * Creates the connection to shared data and
+ * begins listening the KGSNetworkConnectionAllowed-key.
+ */
+ void ConstructL();
+
+ /**
+ * Checks whether SMS sending is needed in boot-phase and
+ * launches the sending operation
+ */
+ void CheckBootPhaseL();
+
+private:
+ enum TCleanupFlags
+ {
+ EUserSettingsConnected = 0x01,
+ EUserSettingsNotifierSet = 0x02,
+ EOffllineSendingNeeded = 0x10
+ };
+
+private:
+ // Reference to Msv Session
+ CMsvSession& iMsvSession;
+ // Pointer to sending operation
+ CMsvSingleOpWatcher* iRunningOperation;
+ CCenRepNotifyHandler* iNotifyHandler;
+ CRepository* iSession;
+ // Flags to indicate status of Outbox Sender
+ TInt8 iFlags;
+ // Last known network coverage
+ TInt iNetworkBars;
+
+};
+
+#endif // __OUTBOXSENDER_H__
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/inc/coutboxsendoperation.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* When the phone mode is changed from offline to online mode, this class
+* sends the messages in outbox, that are in suspended or failed state
+* because of the offline mode. When phone is changed from online to
+* offline mode, the currently running sending operation will be
+* cancelled.
+*
+*/
+
+
+
+#ifndef __COUTBOXSENDOPERATION_H__
+#define __COUTBOXSENDOPERATION_H__
+
+// INCLUDES
+#include <msvapi.h>
+#include <MuiuMsvSingleOpWatcher.h>
+
+
+// FORWARD DECLARATIONS
+class CMsvEntrySelection;
+
+// CLASS DECLARATION
+
+/**
+* Sends messages from Outbox when user selects "Start" in Outbox.
+*/
+class COutboxSendOperation : public CMsvOperation
+ {
+ public:
+
+ /**
+ * A two-phased constructor.
+ */
+ static COutboxSendOperation* NewL(
+ CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus);
+
+ /**
+ * A destructor.
+ */
+ virtual ~COutboxSendOperation();
+
+ /**
+ * Returns the current operation.
+ */
+ virtual const TDesC8& ProgressL();
+
+ private:
+
+ /**
+ * A C++ constructor
+ */
+ COutboxSendOperation(
+ CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus);
+
+ /**
+ * Creates the sending operation session.
+ */
+ void ConstructL();
+
+ private: // Functions from base classes
+
+ /**
+ * Cancels sending operation.
+ */
+ void DoCancel();
+
+ /**
+ * Keeps the message sending operaion active until all
+ * messages are sent.
+ */
+ void RunL();
+
+ /**
+ * Handles the runtime error events
+ */
+ TInt RunError( TInt aError );
+
+ private: // New functions
+
+ /**
+ * Starts sending operation for next selection.
+ */
+ void StartSendingL();
+
+ /**
+ * Sets the selected messages to sending state.
+ */
+ void SendWaitingSMSMessages();
+
+ /**
+ * Sets the selected messages to sending state.
+ */
+ void SendWaitingSMSMessagesL();
+
+ /**
+ * Creates selection of spesified type of messages in outbox
+ */
+ void CreateSelectionL(
+ const TUid& aUidForSel,
+ const TMsvId& aServiceId,
+ CMsvEntrySelection*& aSelection );
+
+ /**
+ * Checks if MTM is available and creates selection
+ */
+ TBool CheckAndCreateSelectionL();
+
+ /**
+ * Completes operation and cancels notify
+ */
+ void CompleteObserver( TInt aStatus );
+
+ /**
+ * Deletes the selection
+ */
+ void RemoveSelection();
+
+ /**
+ * Checks if there is need to continue sending operation
+ */
+ TBool IsSendingNeeded( TUid& aMtm ) const;
+
+ /**
+ * Removes the sending flag
+ */
+ void RemoveSendingFlag( const TUid& aMtm );
+
+ /**
+ * Complete own request
+ */
+ void CompleteSelf( TInt aValue );
+
+
+ private: // Data
+ enum
+ {
+ ESupportsSmsSending = 0x01,
+ ESendSms = 0x10,
+ };
+
+ // Selection queue
+ CArrayPtrFlat<CMsvEntrySelection> iSelections;
+ // Services selection
+ CMsvEntrySelection iServices;
+ // Pointer to Msv Operation
+ CMsvOperation* iOperation;
+ // Entry pointer
+ CMsvEntry* iEntry;
+ // Supported message types
+ TUint iSupportedMsgs;
+ };
+
+
+#endif // __COUTBOXSENDOPERATION_H__
+
+// End of file
--- a/messagingapp/msgsettings/msginit/inc/msgsimnumberdetector.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/msginit/inc/msgsimnumberdetector.h Wed Aug 18 09:45:25 2010 +0300
@@ -36,7 +36,7 @@
* MsgSimOperation
*
*/
-class MSGINIT_DLL_EXPORT MsgSimNumDetector
+class MSGINIT_DLL_EXPORT MsgSimNumDetector :public QObject
{
public:
@@ -57,7 +57,7 @@
};
-class MsgSimNumDetectorPrivate : public MSimOperationObserver
+class MsgSimNumDetectorPrivate : public CBase, public MSimOperationObserver
{
public:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/inc/msignalstrengthhandler.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Interface for signal strength handler.
+*
+*/
+
+
+
+#ifndef MSIGNALSTRENGTHHANDLER_H
+#define MSIGNALSTRENGTHHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MSignalStrengthObserver;
+
+// CLASS DECLARATION
+
+/**
+* Interface for a class which handles changes
+* in phone signal strength.
+*/
+class MSignalStrengthHandler
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ virtual ~MSignalStrengthHandler() {};
+
+ public: // New functions
+
+ /**
+ * Returns ETrue if signal observing is supported, EFalse otherwise.
+ * @return ETrue if signal observing is supported, EFalse otherwise.
+ */
+ virtual TBool ObservingSupported() = 0;
+
+ /**
+ * Returns ETrue if signal strength requests are supported, EFalse otherwise.
+ * @return ETrue if signal strength requests are supported, EFalse otherwise.
+ */
+ virtual TBool RequestsSupported() = 0;
+
+ /**
+ * Sets the signal strength observer. May leave with KErrNotSupported
+ * if signal strength observing is not supported.
+ * @param aObserver Observer for signal strength. Ownership is not passed.
+ */
+ virtual void SetSignalStrengthObserverL( MSignalStrengthObserver* aObserver ) = 0;
+
+ /**
+ * Starts observing the signal strength. May leave with KErrNotSupported
+ * if signal strength observing is not supported.
+ */
+ virtual void StartObservingL() = 0;
+
+ /**
+ * Stops the signal strength observing.
+ */
+ virtual void StopObservingL() = 0;
+
+ /**
+ * Returns the current signal strength. May leave with KErrNotSupported
+ * if signal strength requests are not supported.
+ * @return The current signal strength.
+ */
+ virtual TInt SignalStrengthL() = 0;
+
+ /**
+ * Returns the current bar value. May leave with KErrNotSupported
+ * if bar value requests are not supported.
+ * @return The current signal strength.
+ */
+ virtual TInt BarValueL() = 0;
+
+ };
+
+#endif // MSIGNALSTRENGTHHANDLER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/inc/msignalstrengthobserver.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Observer for signal strength handler
+*
+*/
+
+
+
+#ifndef MSIGNALSTRENGTHOBSERVER_H
+#define MSIGNALSTRENGTHOBSERVER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CLASS DECLARATION
+
+/**
+* Interface for a class which observes if there are any changes
+* in phone signal strength.
+*/
+class MSignalStrengthObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ virtual ~MSignalStrengthObserver() {};
+
+ public: // New functions
+
+ /**
+ * Notifies about updates in signal bars and strength.
+ * @param aNewSignalValue New value for the signal strength.
+ * @param aNewBarValue New value for the signal bars.
+ */
+ virtual void SignalStrengthAndBarUpdatedL( TInt aNewSignalValue, TInt aNewBarValue ) = 0;
+ };
+
+#endif // MSIGNALSTRENGTHOBSERVER_H
+
+// End of File
--- a/messagingapp/msgsettings/msginit/inc/simscnumberdetector.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/msginit/inc/simscnumberdetector.h Wed Aug 18 09:45:25 2010 +0300
@@ -49,6 +49,7 @@
class CClientMtmRegistry;
class CStartUpMonitor;
class CRepository;
+class COutboxObserver;
/**
* Observer to indicate when SIM operation has been completed.
@@ -200,7 +201,7 @@
CStartUpMonitor* iStartupMonitor;
MSimOperationObserver& iObserver;
CRepository* iCenRepSession;
-
+ COutboxObserver* iOutBoxObserver;
};
--- a/messagingapp/msgsettings/msginit/msginit.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/msginit/msginit.pro Wed Aug 18 09:45:25 2010 +0300
@@ -59,14 +59,27 @@
HEADERS += inc/startupmonitor.h \
inc/simscnumberdetector.h \
- inc/msgsimnumberdetector.h
+ inc/msgsimnumberdetector.h \
+ inc/cmobilesignalstrengthhandler.h \
+ inc/coutboxobserver.h \
+ inc/coutboxsender.h \
+ inc/coutboxsendoperation.h \
+ inc/msignalstrengthhandler.h \
+ inc/msignalstrengthobserver.h
SOURCES += src/startupmonitor.cpp \
src/simscnumberdetector.cpp \
- src/msgsimnumberdetector.cpp
-
+ src/msgsimnumberdetector.cpp \
+ src/cmobilesignalstrengthhandler.cpp \
+ src/coutboxobserver.cpp \
+ src/coutboxsendoperation.cpp \
+ src/coutboxsender.cpp
+
LIBS += -lsmcm \
-lmsgs \
-lcentralrepository \
-lcenrepnotifhandler \
- -letelmm
+ -letelmm \
+ -letel \
+ -lmuiuutils
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/src/cmobilesignalstrengthhandler.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,297 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Mobile signal strength handler implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <mmtsy_names.h>
+#include "cmobilesignalstrengthhandler.h"
+#include "msignalstrengthobserver.h"
+#include "debugtraces.h"
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::NewL
+// -----------------------------------------------------------------
+CMobileSignalStrengthHandler* CMobileSignalStrengthHandler::NewL( )
+ {
+ CMobileSignalStrengthHandler* self = new (ELeave) CMobileSignalStrengthHandler();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::~CMobileSignalStrengthHandler
+// -----------------------------------------------------------------
+CMobileSignalStrengthHandler::~CMobileSignalStrengthHandler()
+ {
+ Cancel();
+ iMobilePhone.Close();
+ iTelServer.Close();
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::CMobileSignalStrengthHandler
+// -----------------------------------------------------------------
+CMobileSignalStrengthHandler::CMobileSignalStrengthHandler() :
+ CActive( EPriorityNormal )
+ {
+
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::ConstructL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::ConstructL()
+ {
+ QDEBUG_WRITE("CMobileSignalStrengthHandler::ConstructL - Enter ");
+ CActiveScheduler::Add( this );
+ InitializeSessionsL();
+ QDEBUG_WRITE("CMobileSignalStrengthHandler::ConstructL - Exit");
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::RunL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::RunL()
+ {
+ // if operation completed successfully
+ if( iStatus.Int() == KErrNone )
+ {
+ QDEBUG_WRITE_FORMAT("CMobileSignalStrengthHandler::RunL - Signal strength updated ",iSignalStrength );
+ NotifyObserver();
+ }
+
+ // if observing is still active reissue the notification request
+ if( iObserving )
+ {
+ QDEBUG_WRITE( "CMobileSignalStrengthHandler::RunL - NotifySignalStrengthChange" );
+ // reissue the request
+ iMobilePhone.NotifySignalStrengthChange( iStatus, iSignalStrength, iBars );
+ SetActive();
+ }
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::RunError
+// -----------------------------------------------------------------
+TInt CMobileSignalStrengthHandler::RunError( TInt /*aError*/)
+ {
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::DoCancel
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::DoCancel()
+ {
+ if( iObserving )
+ {
+ iMobilePhone.CancelAsyncRequest( EMobilePhoneNotifySignalStrengthChange );
+ }
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::ObservingSupported
+// -----------------------------------------------------------------
+TBool CMobileSignalStrengthHandler::ObservingSupported()
+ {
+ TUint32 caps;
+ iMobilePhone.GetSignalCaps( caps );
+ return ( caps & RMobilePhone::KCapsNotifySignalStrengthChange );
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::RequestsSupported
+// -----------------------------------------------------------------
+TBool CMobileSignalStrengthHandler::RequestsSupported()
+ {
+ TUint32 caps;
+ iMobilePhone.GetSignalCaps( caps );
+ return ( caps & RMobilePhone::KCapsGetSignalStrength );
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::SetSignalStrengthObserverL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::SetSignalStrengthObserverL(
+ MSignalStrengthObserver* aObserver )
+ {
+ // leave if observing is not supported
+ if( !ObservingSupported() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ iObserver = aObserver;
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::StartObservingL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::StartObservingL()
+ {
+ // leave if observing is not supported
+ if( !ObservingSupported() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ // update signal str
+ TRAPD( err, UpdateSignalStrengthL() );
+
+ // check operation
+ if( err != KErrNone )
+ {
+ QDEBUG_WRITE_FORMAT("CMobileSignalStrengthHandler::StartObservingL - Failed to initialize signal strength (err = )",err );
+ iSignalStrength = 0;
+ }
+ else
+ {
+ QDEBUG_WRITE_FORMAT("CMobileSignalStrengthHandler::StartObservingL - Signal strength initialized to ",iSignalStrength );
+ }
+
+ // update state
+ iObserving = ETrue;
+
+ // Notify current observer about signal strength
+ NotifyObserver();
+
+ // request for notification
+ iMobilePhone.NotifySignalStrengthChange( iStatus, iSignalStrength, iBars );
+ SetActive();
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::StopObservingL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::StopObservingL()
+ {
+ if( !iObserving )
+ {
+ User::Leave( KErrGeneral );
+ }
+
+ // cancel the request
+ Cancel();
+
+ // update state
+ iObserving = EFalse;
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::SignalStrengthL
+// -----------------------------------------------------------------
+TInt CMobileSignalStrengthHandler::SignalStrengthL()
+ {
+ // leave if requests are not supported
+ if( !RequestsSupported() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ // if we're not observing we have to update the value manually,
+ // otherwise value is up-to-date
+ if( !iObserving )
+ {
+ UpdateSignalStrengthL();
+ }
+
+ // return the current value
+ return iSignalStrength;
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::BarValueL
+// -----------------------------------------------------------------
+TInt CMobileSignalStrengthHandler::BarValueL()
+ {
+ // leave if requests are not supported
+ if( !RequestsSupported() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ if( !iObserving )
+ {
+ UpdateSignalStrengthL();
+ }
+
+ // return the current value
+ return iBars;
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::InitializeSessionsL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::InitializeSessionsL()
+ {
+ QDEBUG_WRITE("CMobileSignalStrengthHandler::InitializeSessionsL - Enter");
+
+ User::LeaveIfError( iTelServer.Connect() );
+
+ RTelServer::TPhoneInfo phoneInfo;
+ TInt numPhone;
+
+ // load tsy module and get number of phones
+ User::LeaveIfError( iTelServer.LoadPhoneModule( KMmTsyModuleName ) );
+ User::LeaveIfError( iTelServer.EnumeratePhones( numPhone) );
+
+ // find the correct phone
+ for (TInt i(0); i < numPhone; i++)
+ {
+ TName tsyName;
+ User::LeaveIfError( iTelServer.GetPhoneInfo( i, phoneInfo ) );
+ User::LeaveIfError( iTelServer.GetTsyName( i,tsyName ) );
+
+ if ( tsyName.CompareF( KMmTsyModuleName ) == 0)
+ {
+ break;
+ }
+ }
+ // open mobile phone session
+ User::LeaveIfError( iMobilePhone.Open( iTelServer, phoneInfo.iName ) );
+ QDEBUG_WRITE("CMobileSignalStrengthHandler::InitializeSessionsL - Exit");
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::UpdateSignalStrengthL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::UpdateSignalStrengthL()
+ {
+ // only update the value if requests are supported
+ if( RequestsSupported() )
+ {
+ TRequestStatus status;
+ iMobilePhone.GetSignalStrength( status, iSignalStrength, iBars );
+ User::WaitForRequest( status );
+ QDEBUG_WRITE_FORMAT("CMobileSignalStrengthHandler::UpdateSignalStrengthL - GetSignalStrength returned with", status.Int() );
+ User::LeaveIfError( status.Int() );
+ }
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::NotifyObserver
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::NotifyObserver()
+ {
+ // notify observer, if set
+ if( iObserver )
+ {
+ TRAP_IGNORE( iObserver->SignalStrengthAndBarUpdatedL( iSignalStrength, iBars ) );
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/src/coutboxobserver.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implements the class
+ *
+ */
+
+// INCLUDE FILES
+#include <e32def.h>
+#include <msvids.h> // Entry Ids
+#include <e32property.h>
+#include <PSVariables.h>
+#include "coutboxsender.h"
+#include "coutboxobserver.h"
+#include "cmobilesignalstrengthhandler.h"
+#include "debugtraces.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// COutboxObserver::COutboxObserver
+// ---------------------------------------------------------
+//
+COutboxObserver::COutboxObserver(){}
+
+// ---------------------------------------------------------
+// COutboxObserver::ConstructL
+// ---------------------------------------------------------
+//
+void COutboxObserver::ConstructL()
+{
+ QDEBUG_WRITE( "COutboxObserver::ConstructL Enter" );
+ // instantiate the signal strength handler
+ iSignalStrengthHandler = CMobileSignalStrengthHandler::NewL();
+
+ if (iSignalStrengthHandler->ObservingSupported())
+ {
+ iSignalStrengthHandler->SetSignalStrengthObserverL(this);
+ iSignalStrengthHandler->StartObservingL();
+ }
+ else
+ {
+ QDEBUG_WRITE( "COutboxObserver::ConstructL else part" );
+ }
+ QDEBUG_WRITE( "COutboxObserver::ConstructL Exit" );
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::NewL
+// ---------------------------------------------------------
+//
+COutboxObserver* COutboxObserver::NewL()
+{
+ // Create the instance of the outbox observer
+ COutboxObserver* self = new (ELeave) COutboxObserver();
+ // Push it to stack while executing the constructor
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::~COutboxObserver
+// ---------------------------------------------------------
+//
+COutboxObserver::~COutboxObserver()
+{
+ delete iSignalStrengthHandler;
+ EndSessions();
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::SignalStrengthUpdatedL
+// ---------------------------------------------------------
+//
+void COutboxObserver::SignalStrengthAndBarUpdatedL(TInt /*aNewSignalValue*/, TInt aNewBarValue)
+{
+ QDEBUG_WRITE_FORMAT( "COutboxObserver::SignalStrengthUpdatedL - Signal bars ", aNewBarValue );
+ // pass new bar value to outbox sender
+ InformOutboxSenderL(aNewBarValue);
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::InformOutboxSenderL
+// ---------------------------------------------------------
+//
+void COutboxObserver::InformOutboxSenderL(const TInt& aNetworkBars)
+{
+ if (iOutboxSender) {
+ QDEBUG_WRITE( "COutboxObserver::InformOutboxSenderL - Informing outbox sender." );
+
+ iOutboxSender->CheckAndStartSendingL(aNetworkBars);
+ }
+ else {
+ QDEBUG_WRITE( "COutboxObserver::InformOutboxSenderL - Outbox sender not initialized." );
+ }
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::StartSessionsL
+// ---------------------------------------------------------
+//
+void COutboxObserver::StartSessionsL(CMsvSession& aMsvSession)
+{
+ // Set outbox folder
+ iOutboxFolder = aMsvSession.GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ iOutboxFolder->AddObserverL(*this);
+
+ // Remove the Sender, if it exists
+ delete iOutboxSender;
+ iOutboxSender = NULL;
+
+ QDEBUG_WRITE("COutboxObserver::StartSessionsL - Initializing outbox sender.." );
+ iOutboxSender = COutboxSender::NewL(aMsvSession);
+
+ QDEBUG_WRITE( "COutboxObserver::StartSessionsL - Informing outbox sender of network status.." );
+
+ // get current signal bar value
+ TInt signalBars = 0;
+ TRAPD( err, signalBars = iSignalStrengthHandler->BarValueL() );
+
+ // check error
+ if (err == KErrNone)
+ {
+ QDEBUG_WRITE_FORMAT("COutboxObserver::StartSessionsL - Got signal bar value notifying..", signalBars );
+ iOutboxSender->CheckAndStartSendingL(signalBars);
+ }
+ else
+ {
+ QDEBUG_WRITE_FORMAT( "COutboxObserver::StartSessionsL - Failed to get signal bar value (err = )", err );
+ }
+
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::EndSessions
+// ---------------------------------------------------------
+//
+void COutboxObserver::EndSessions()
+{
+ // Delete Outbox sender
+ delete iOutboxSender;
+ iOutboxSender = NULL;
+
+ if (iOutboxFolder) {
+ // Delete outbox folder
+ iOutboxFolder->RemoveObserver(*this);
+ delete iOutboxFolder;
+ iOutboxFolder = NULL;
+ }
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::HandleMsvSessionReadyL
+// ---------------------------------------------------------
+//
+void COutboxObserver::HandleMsvSessionReadyL(CMsvSession& aMsvSession)
+{
+ StartSessionsL(aMsvSession);
+}
+// ---------------------------------------------------------
+// COutboxObserver::HandleMsvSessionClosedL
+// ---------------------------------------------------------
+//
+void COutboxObserver::HandleMsvSessionClosedL()
+{
+ EndSessions();
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::HandleEntryEventL
+// ---------------------------------------------------------
+//
+void COutboxObserver::HandleEntryEventL(TMsvEntryEvent /*aEvent*/, TAny* /*aArg1*/,
+ TAny* /*aArg2*/, TAny* /*aArg3*/)
+{
+
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/src/coutboxsender.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implements class
+ *
+ */
+
+// INCLUDE FILES
+
+#include <CoreApplicationUIsSDKCRKeys.h>
+#include <msvuids.h> // Entry Uids
+#include "coutboxsendoperation.h"
+#include "coutboxsender.h"
+#include "debugtraces.h"
+
+// CONSTANTS
+const TInt KListBar0(0);
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ----------------------------------------------------
+// COutboxSender::NewL
+// ----------------------------------------------------
+//
+COutboxSender* COutboxSender::NewL(CMsvSession& aMsvSession)
+{
+ COutboxSender* self = new (ELeave) COutboxSender(aMsvSession);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+// ----------------------------------------------------
+// COutboxSender::COutboxSender
+// ----------------------------------------------------
+//
+COutboxSender::COutboxSender(CMsvSession& aMsvSession) :
+ iMsvSession(aMsvSession)
+{
+}
+
+// ----------------------------------------------------
+// COutboxSender::~COutboxSender
+// ----------------------------------------------------
+//
+COutboxSender::~COutboxSender()
+{
+ // Stop and delete the sending operation
+ delete iRunningOperation;
+
+ // Check if notification is set
+ if (iFlags & EUserSettingsNotifierSet)
+ {
+ // Remove the notification from list
+ if (iNotifyHandler)
+ {
+ iNotifyHandler->StopListening();
+ delete iNotifyHandler;
+ }
+
+ delete iSession;
+ }
+
+}
+
+// ----------------------------------------------------
+// COutboxSender::ConstructL
+// ----------------------------------------------------
+//
+void COutboxSender::ConstructL()
+{
+ iNetworkBars = KListBar0;
+ iSession = CRepository::NewL(KCRUidCoreApplicationUIs);
+ iNotifyHandler = CCenRepNotifyHandler::NewL(*this, *iSession, CCenRepNotifyHandler::EIntKey,
+ KCoreAppUIsNetworkConnectionAllowed);
+ iNotifyHandler->StartListeningL();
+
+ // Turn flag on for possible error handling cases
+ iFlags |= EUserSettingsNotifierSet;
+
+ CheckBootPhaseL();
+}
+
+// ----------------------------------------------------
+// COutboxSender::StartSendingL
+// ----------------------------------------------------
+//
+void COutboxSender::StartSendingL()
+{
+ // Check if the sending is already in progress
+ if (!IsSending())
+ {
+ // Create instance of Single Operation Watcher
+ CMsvSingleOpWatcher* singleOpWatcher = CMsvSingleOpWatcher::NewL(*this);
+
+ // Push to cleanup stack while creating sending operation
+ CleanupStack::PushL(singleOpWatcher);
+ CMsvOperation* op = COutboxSendOperation::NewL(iMsvSession, singleOpWatcher->iStatus);
+ CleanupStack::Pop(singleOpWatcher);
+
+ // Set operation
+ singleOpWatcher->SetOperation(op); // takes immediately ownership
+ iRunningOperation = singleOpWatcher;
+ }
+}
+
+// ----------------------------------------------------
+// COutboxSender::CancelSending
+// ----------------------------------------------------
+//
+void COutboxSender::CancelSending()
+{
+ // Remove the running operation
+ delete iRunningOperation;
+ iRunningOperation = NULL;
+}
+
+// ----------------------------------------------------
+// COutboxSender::IsSending
+// ----------------------------------------------------
+//
+TBool COutboxSender::IsSending() const
+{
+ return (iRunningOperation != NULL);
+}
+
+// ----------------------------------------------------
+// COutboxSender::OpCompleted
+// ----------------------------------------------------
+//
+void COutboxSender::OpCompleted(CMsvSingleOpWatcher& /*aOpWatcher*/, TInt /*aCompletionCode*/)
+{
+ delete iRunningOperation;
+ iRunningOperation = NULL;
+}
+
+// ----------------------------------------------------
+// COutboxSender::HandleNotifyInt
+// ----------------------------------------------------
+//
+void COutboxSender::HandleNotifyInt(const TUint32 aID, const TInt aNewValue)
+{
+ QDEBUG_WRITE(("COutboxSender::HandleNotifyInt"));
+ // Check if key is for offline-connecton
+ if (aID == KCoreAppUIsNetworkConnectionAllowed)
+ {
+ QDEBUG_WRITE(("COutboxSender::HandleNotifyInt KCoreAppUIsNetworkConnectionAllowed"));
+ // Check if connection is established
+ if (aNewValue == ECoreAppUIsNetworkConnectionAllowed)
+ {
+ QDEBUG_WRITE(("COutboxSender::HandleNotifyInt ECoreAppUIsNetworkConnectionAllowed 1"));
+ // Phone switched on again!
+ iFlags |= EOffllineSendingNeeded;
+
+ QDEBUG_WRITE_FORMAT(("COutboxSender::HandleNotifyInt iNetworkBars = %d"), iNetworkBars );
+ if (iNetworkBars > KListBar0)
+ {
+ QDEBUG_WRITE_FORMAT(("COutboxSender::HandleNotifyInt sending now, iNetworkBars = %d"), iNetworkBars );
+ TRAP_IGNORE( StartSendingL() );
+ }
+ }
+ else
+ {
+ QDEBUG_WRITE("COutboxSender::HandleNotifyInt ECoreAppUIsNetworkConnectionAllowed 0");
+ // Clear flag
+ iFlags &= ~EOffllineSendingNeeded;
+ // Stop sending
+ CancelSending();
+ // Set the coverage to 0 in case it didn't come from network in time
+ iNetworkBars = KListBar0;
+ }
+ }
+}
+
+// ----------------------------------------------------
+// COutboxSender::HandleNotifyGeneric
+// ----------------------------------------------------
+//
+void COutboxSender::HandleNotifyGeneric(const TUint32 /*aID*/)
+{
+ //NO OPERATION
+}
+
+// ----------------------------------------------------
+// COutboxSender::HandleNotifyError
+// ----------------------------------------------------
+//
+void COutboxSender::HandleNotifyError(const TUint32 /*aID*/, const TInt /*aError*/,
+ CCenRepNotifyHandler* /*aHandler*/)
+{
+ //NO OPERATION
+}
+
+// ----------------------------------------------------
+// COutboxSender::CheckAndStartSendingL
+// ----------------------------------------------------
+//
+void COutboxSender::CheckAndStartSendingL(const TInt& aNetworkBars)
+{
+ QDEBUG_WRITE_FORMAT("COutboxSender::CheckAndStartSendingL aNetworkBars = ", aNetworkBars );
+ iNetworkBars = aNetworkBars;
+ // Check if sending is needed and network is available
+ if (aNetworkBars > KListBar0)
+ {
+ QDEBUG_WRITE_FORMAT("COutboxSender::CheckAndStartSendingL sending now, iNetworkBars ", iNetworkBars );
+ // Start sending
+ StartSendingL();
+ }
+ else
+ {
+ QDEBUG_WRITE_FORMAT("COutboxSender::CheckAndStartSendingL not sending, iNetworkBars = ", iNetworkBars );
+ }
+}
+
+// ----------------------------------------------------
+// COutboxSender::CheckBootPhaseL
+// ----------------------------------------------------
+//
+void COutboxSender::CheckBootPhaseL()
+{
+ TInt connection;
+
+ TInt err = iSession->Get(KCoreAppUIsNetworkConnectionAllowed, connection);
+
+ if (err == KErrNone)
+ {
+ // Check if connection is established
+ if (connection)
+ {
+ QDEBUG_WRITE("COutboxSender::CheckBootPhaseL KGSNetworkConnectionAllowed 1");
+ // Phone switched on again!
+ iFlags |= EOffllineSendingNeeded;
+
+ if (iNetworkBars > KListBar0)
+ {
+ QDEBUG_WRITE_FORMAT("COutboxSender::CheckBootPhaseL sending now, iNetworkBars = ", iNetworkBars );
+ StartSendingL();
+ }
+ }
+ }
+ else
+ {
+ QDEBUG_WRITE("COutboxSender::CheckBootPhaseL Cannot access shared data");
+ }
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/src/coutboxsendoperation.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,409 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implements class
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "coutboxsendoperation.h" // header
+
+#include <SendUiConsts.h> // MTM Uids
+#include <msvids.h> // Entry Ids
+#include <gsmerror.h> // SMS sending failure error codes
+#include <smutset.h>
+#include "debugtraces.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// Two-phased constructor.
+COutboxSendOperation* COutboxSendOperation::NewL(
+ CMsvSession& aMsvSession,
+ TRequestStatus& aObserverRequestStatus )
+ {
+ // Create the instance of sending operation
+ COutboxSendOperation* self =
+ new (ELeave) COutboxSendOperation(
+ aMsvSession, aObserverRequestStatus );
+
+ // Push self into cleanup stack during construction
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ // Return the object
+ return self;
+ }
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+//
+COutboxSendOperation::COutboxSendOperation(
+ CMsvSession& aMsvSession,
+ TRequestStatus& aObserverRequestStatus )
+ :
+ CMsvOperation( aMsvSession, CActive::EPriorityStandard, aObserverRequestStatus ),
+ iSelections( 4 ),
+ iServices(),
+ iSupportedMsgs( COutboxSendOperation::ESupportsSmsSending )
+ {
+ // Start scheduler
+ CActiveScheduler::Add(this);
+ }
+
+//destructor
+COutboxSendOperation::~COutboxSendOperation()
+ {
+ // Cancel sending
+ Cancel();
+
+ // Delete sending operation
+ delete iOperation;
+ iOperation = NULL;
+
+ // Delete entry
+ delete iEntry;
+ iEntry = NULL;
+
+ // Remove services from queue and destroy message selections
+ iServices.Reset();
+ iSelections.ResetAndDestroy();
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::ConstructL
+// ----------------------------------------------------
+//
+void COutboxSendOperation::ConstructL()
+ {
+ // Get rootindex entry
+ iEntry = iMsvSession.GetEntryL( KMsvRootIndexEntryId );
+ iEntry->SetSortTypeL(
+ TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+
+ // Set sending flags
+ iSupportedMsgs |= ESendSms;
+
+ // Start sending
+ StartSendingL();
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::RunL
+// ----------------------------------------------------
+//
+void COutboxSendOperation::RunL()
+ {
+ QDEBUG_WRITE("COutboxSendOperation::RunL");
+ User::LeaveIfError( iStatus.Int() );
+
+ // Check and start sending, if needed
+ TUid sendMtm;
+
+ // Check if messages needs to be sent
+ if( IsSendingNeeded( sendMtm ) )
+ {
+ StartSendingL();
+ }
+ // Nothing to send, complete operation
+ else
+ {
+ CompleteObserver( iStatus.Int() );
+ }
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::RunError
+// ----------------------------------------------------
+//
+TInt COutboxSendOperation::RunError( TInt aError )
+ {
+ CompleteObserver( aError );
+ return aError;
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::DoCancel
+// ----------------------------------------------------
+//
+void COutboxSendOperation::DoCancel()
+ {
+ // Check if sending operation is running
+ if( iOperation )
+ {
+ // Cancel it
+ iOperation->Cancel();
+ }
+
+ // Complete operation with current status
+ CompleteObserver( iStatus.Int() );
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::ProgressL
+// ----------------------------------------------------
+//
+const TDesC8& COutboxSendOperation::ProgressL()
+ {
+ // Check if operation exists
+ if( iOperation )
+ {
+ // Return the operation
+ return iOperation->ProgressL();
+ }
+
+ // If no operation, return blank information
+ return KNullDesC8();
+ }
+
+// ---------------------------------------------------------
+// COutboxSendOperation::CompleteOperation
+// ---------------------------------------------------------
+//
+void COutboxSendOperation::CompleteObserver( TInt aStatus )
+ {
+ // Get the observer status
+ TRequestStatus* status = &iObserverRequestStatus;
+ User::RequestComplete( status, aStatus );
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::StartSendingL
+// ----------------------------------------------------
+//
+void COutboxSendOperation::StartSendingL()
+ {
+ // Remove any sending operation that currently may be running
+ delete iOperation;
+ iOperation = NULL;
+
+
+ // Check if there was errors with creating selection
+ if ( CheckAndCreateSelectionL() )
+ {
+ // Create new operation and trap any errors
+ SendWaitingSMSMessages();
+ RemoveSelection();
+ }
+ else
+ {
+ CompleteSelf( KErrNone );
+ }
+ }
+
+ // if error, then complete this pass with the error code
+void COutboxSendOperation::SendWaitingSMSMessages()
+ {
+ TRAPD( err, SendWaitingSMSMessagesL() );
+ if ( err != KErrNone )
+ {
+ ASSERT( !IsActive() );
+ CompleteSelf( err );
+ }
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::SendWaitingSMSMessagesL
+// ----------------------------------------------------
+//
+void COutboxSendOperation::SendWaitingSMSMessagesL()
+ {
+ // Get first selection from queue
+ CMsvEntrySelection& selection = ( *iSelections[0] );
+
+ // Get count of messages in queue
+ TInt count = selection.Count();
+
+ // Go through all messages
+ while( count-- )
+ {
+ // Select message
+ iEntry->SetEntryL( selection[count] );
+ TMsvEntry entry( iEntry->Entry() );
+
+ // Check if the message is tried to send when in offline
+ if( ( entry.SendingState() == KMsvSendStateSuspended ||
+ entry.SendingState() == KMsvSendStateFailed) &&
+ ( entry.iError == KErrGsmOfflineOpNotAllowed ||
+ entry.iError == KErrGsmOfflineSimOpNotAllowed) )
+ {
+ // Set message to wait sending
+ entry.SetSendingState( KMsvSendStateWaiting );
+ iEntry->ChangeL( entry );
+ }
+ else
+ {
+ selection.Delete( count );
+ }
+ }
+ selection.Compress();
+
+ // Set entry to outbox
+ iMtm = iEntry->Entry().iMtm;
+ iEntry->SetEntryL( KMsvGlobalOutBoxIndexEntryId );
+ if ( selection.Count() )
+ {
+ iOperation = iEntry->CopyL( selection, iServices[0], iStatus );
+ SetActive();
+ }
+ else
+ {
+ // Nothing to send, but we must complete the observer via our RunL callback
+ CompleteSelf( KErrNone );
+ }
+ }
+
+
+// ----------------------------------------------------
+// COutboxSendOperation::RemoveSelection
+// ----------------------------------------------------
+//
+void COutboxSendOperation::RemoveSelection()
+ {
+ // Clear the the current selection.
+ iServices.Delete(0);
+
+ // Delete selection object and index
+ delete iSelections[0];
+ iSelections.Delete(0);
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::CreateSelectionL
+// ----------------------------------------------------
+//
+void COutboxSendOperation::CreateSelectionL(
+ const TUid &aUidForSel,
+ const TMsvId& aServiceId,
+ CMsvEntrySelection*& aSelection )
+ {
+ // Set entry to outbox and get messages from outbox
+ iEntry->SetEntryL( KMsvGlobalOutBoxIndexEntryId );
+ aSelection = iEntry->ChildrenWithMtmL( *&aUidForSel );
+
+ // Check if there is anything to put into array
+ if( aSelection->Count() )
+ {
+ // Put selection to queue
+ CleanupStack::PushL( aSelection );
+ iSelections.AppendL( aSelection );
+ CleanupStack::Pop( aSelection );
+
+ // Put service to queue
+ iServices.AppendL( aServiceId );
+ }
+ else
+ {
+ // Remove selection
+ delete aSelection;
+ aSelection = NULL;
+ }
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::CheckAndCreateSelectionL
+// ----------------------------------------------------
+//
+TBool COutboxSendOperation::CheckAndCreateSelectionL()
+ {
+ // Get root index
+ iEntry->SetEntryL( KMsvRootIndexEntryId );
+
+ // MTM, for which the selection is collected
+ TUid sendMtm;
+
+ // Selection of messages for sending
+ CMsvEntrySelection* smsSelection = NULL;
+
+ // While MTM's available for sending
+ while( smsSelection == NULL && IsSendingNeeded( sendMtm ) )
+ {
+ // Find default SMS service
+ TMsvId serviceId =0;
+ TSmsUtilities::ServiceIdL(*iEntry, serviceId);
+ QDEBUG_WRITE_FORMAT("COutboxSendOperation::CheckAndCreateSelectionL ",serviceId );
+ // Check if the service ID is found
+ if( serviceId != KMsvNullIndexEntryId )
+ {
+ // Create selection of messages of specified MTM
+ CreateSelectionL( sendMtm, serviceId, smsSelection );
+ }
+ // Selection has been created, remove the flag
+ RemoveSendingFlag( *&sendMtm );
+ }
+
+ const TBool selectionAvailable = ( smsSelection != NULL );
+ return selectionAvailable;
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::RemoveSendingFlag
+// ----------------------------------------------------
+//
+void COutboxSendOperation::RemoveSendingFlag( const TUid& aMtm )
+ {
+ // Decide actions by mtm
+ switch( aMtm.iUid )
+ {
+ // SMS-messages
+ case KSenduiMtmSmsUidValue:
+ iSupportedMsgs &= ~ESendSms;
+ break;
+ default:
+ break;
+ }
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::IsSendingNeeded
+// ----------------------------------------------------
+//
+TBool COutboxSendOperation::IsSendingNeeded(
+ TUid& aMtm ) const
+ {
+ // Set starting condition
+ TBool needSending = EFalse;
+
+ // Check if sms-sending is supported and messages need to be sent
+ if( iSupportedMsgs & ESupportsSmsSending &&
+ iSupportedMsgs & ESendSms )
+ {
+ aMtm = KSenduiMtmSmsUid;
+ needSending = ETrue;
+ }
+ // Otherwise nothing needs to be done
+ else
+ {
+ aMtm.iUid = 0;
+ needSending = EFalse;
+ }
+
+ // Return the result
+ return needSending;
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::CompleteSelf
+// ----------------------------------------------------
+//
+void COutboxSendOperation::CompleteSelf( TInt aValue )
+ {
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, aValue );
+ SetActive();
+ }
+
+// End of file
--- a/messagingapp/msgsettings/msginit/src/msgsimnumberdetector.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/msginit/src/msgsimnumberdetector.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -29,7 +29,7 @@
MsgSimNumDetector::MsgSimNumDetector()
{
QDEBUG_WRITE("MsgSimNumDetector::MsgSimNumDetector : Enter")
- d_ptr = new MsgSimNumDetectorPrivate();
+ d_ptr = q_check_ptr(new MsgSimNumDetectorPrivate());
QDEBUG_WRITE("MsgSimNumDetector::MsgSimNumDetector : Exit")
}
@@ -51,7 +51,7 @@
{
QDEBUG_WRITE("MsgSimNumDetectorPrivate::MsgSimNumDetectorPrivate : Enter")
- TRAP_IGNORE(initL());
+ initL();
QDEBUG_WRITE("MsgSimNumDetectorPrivate::MsgSimNumDetectorPrivate : Exit")
--- a/messagingapp/msgsettings/msginit/src/simscnumberdetector.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/msginit/src/simscnumberdetector.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -28,6 +28,7 @@
#include <startupdomainpskeys.h>
#include <rcustomerserviceprofilecache.h>
+#include "coutboxobserver.h"
#include "simscnumberdetector.h"
#include "startupmonitor.h"
@@ -67,6 +68,9 @@
// initialise
iMsvSession = CMsvSession::OpenSyncL(*this);
+
+ // Observes the OUTBOX for any offline messages...
+ iOutBoxObserver = COutboxObserver::NewL();
// Create the SMS Service
TMsvId serviceId = CreateSmsServiceL();
@@ -80,6 +84,9 @@
// Start the System state monitor
iStartupMonitor = CStartUpMonitor::NewL(this);
+
+ // Start the Auto-send AO, to handle offline SMS messages
+ iOutBoxObserver->HandleMsvSessionReadyL(*iMsvSession);
QDEBUG_WRITE("CMsgSimOperation::ConstructL exit")
}
@@ -297,6 +304,10 @@
delete iSimOperation;
delete iSmsClientMtm;
delete iClientRegistry;
+
+ delete iOutBoxObserver;
+ iOutBoxObserver = NULL;
+
delete iMsvSession;
delete iStartupMonitor;
iStartupMonitor = NULL;
@@ -487,7 +498,11 @@
delete iClientRegistry;
iClientRegistry = NULL;
-
+
+ iOutBoxObserver->HandleMsvSessionClosedL();
+ delete iOutBoxObserver;
+ iOutBoxObserver = NULL;
+
delete iMsvSession;
iMsvSession = NULL;
--- a/messagingapp/msgsettings/msgsettings.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/msgsettings.pro Wed Aug 18 09:45:25 2010 +0300
@@ -21,3 +21,4 @@
SUBDIRS += settingsview/settingsview.pro
SUBDIRS += msginit/msginit.pro
+SUBDIRS += settingsserviceapp/settingsserviceapp.pro
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/inc/settingsserviceinterface.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Interface for launching settings view as
+ * Qthighway service
+ *
+ */
+
+#ifndef __SETTINGS_VIEW_INTERFACE_H__
+#define __SETTINGS_VIEW_INTERFACE_H__
+
+#include <QObject>
+#include <xqserviceprovider.h>
+
+class HbMainWindow;
+class HbAction;
+
+class SettingsViewInterface : public XQServiceProvider
+ {
+ Q_OBJECT
+
+public:
+ /**
+ * Constructor
+ */
+ SettingsViewInterface(HbMainWindow *mainWindow,QObject* parent=0);
+
+ /**
+ * Destructor
+ */
+ ~SettingsViewInterface();
+
+public slots:
+ /**
+ * Function which launches the settings view
+ * @param view, holds MsgSettingsView::SettingsView enum
+ */
+ void launchSettings(int view);
+
+private:
+ /**
+ * Main Window instance
+ * Not owned
+ */
+ HbMainWindow *mMainWindow;
+
+ HbAction* mBackAction;
+
+ };
+
+#endif /* __SETTINGS_VIEW_INTERFACE_H__ */
Binary file messagingapp/msgsettings/settingsserviceapp/resources/messaging_en_GB has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/rom/settingsserviceapp.iby Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef __SETTINGS_SERVICEAPP_IBY__
+#define __SETTINGS_SERVICEAPP_IBY__
+
+file=ABI_DIR\UREL\settingsserviceapp.exe SHARED_LIB_DIR\settingsserviceapp.exe
+data=DATAZ_\resource\apps\settingsserviceapp.rsc resource\apps\settingsserviceapp.rsc
+data=DATAZ_\private\10003a3f\import\apps\settingsserviceapp_reg.rsc private\10003a3f\import\apps\settingsserviceapp_reg.rsc
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/service_conf.xml Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<service>
+ <name>messagesettings</name>
+ <filepath>No path</filepath>
+ <description>Messaging services</description>
+ <interface>
+ <name>com.nokia.symbian.IMessageSettings</name>
+ <version>1.0</version>
+ <description>Message Settings Interface</description>
+ </interface>
+</service>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/settingsserviceapp.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,50 @@
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# Contributors:
+# Description:
+
+TEMPLATE = app
+TARGET = settingsserviceapp
+
+CONFIG += hb service
+
+DEPENDPATH += . inc src
+SERVICE.FILE = service_conf.xml
+SERVICE.OPTIONS = embeddable
+SERVICE.OPTIONS += hidden
+
+INCLUDEPATH += inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../../msgui/inc
+INCLUDEPATH += ../settingsview/inc
+
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+# Input
+HEADERS += inc/settingsserviceinterface.h
+
+SOURCES += src/main.cpp \
+ src/settingsserviceinterface.cpp
+
+# Capability
+TARGET.CAPABILITY = ALL -TCB
+TARGET.UID3 = 0x2001FE6A
+
+RESOURCES += settingsserviceapp.qrc
+
+TRANSLATIONS = messaging.ts
+
+
+LIBS += -lxqservice \
+ -lxqserviceutil \
+ -lsettingsview
+
+
+BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
+ ".\rom\settingsserviceapp.iby CORE_APP_LAYER_IBY_EXPORT_PATH(settingsserviceapp.iby)"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/settingsserviceapp.qrc Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/translations">
+ <file alias="messaging_en_GB">resources/messaging_en_GB</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/src/main.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Messaging service application startup main().
+*
+*/
+
+#include <hbapplication.h>
+#include <hbmainwindow.h>
+#include <QTranslator>
+#include <QLocale>
+#include <QFile>
+#include <QPointer>
+#include <QDateTime>
+
+#include "settingsserviceinterface.h"
+#include "debugtraces.h"
+
+//Localised constants
+#define LOC_TITLE hbTrId("txt_messaging_title_messaging")
+
+const QString debugFileName("c:/settingsservice_app.txt");
+
+#ifdef _DEBUG_TRACES_
+void debugInit(QtMsgType type, const char *msg)
+{
+
+ QFile ofile(debugFileName);
+ if (!ofile.open(QIODevice::Append | QIODevice::Text))
+ {
+ qFatal("error opening results file");
+ return;
+ }
+ QDateTime dt = QDateTime::currentDateTime();
+
+ QTextStream out(&ofile);
+ switch (type)
+ {
+ case QtDebugMsg:
+ out << " DEBUG:";
+ out << msg;
+ break;
+ case QtWarningMsg:
+ out << " WARN:";
+ out << msg;
+ break;
+ case QtCriticalMsg:
+ out << "\n ";
+ out << dt.toString("dd/MM/yyyy hh:mm:ss.zzz:ap");
+ out << " CRITICAL:";
+ out << msg;
+ break;
+ case QtFatalMsg:
+ out << " FATAL:";
+ out << msg;
+ abort();
+ break;
+ default:
+ out << " No Log Selection Type:";
+ out << msg;
+ break;
+
+ }
+}
+#endif
+
+int main(int argc, char **argv)
+{
+ HbApplication app( argc, argv );
+
+ //TODO: Uncomment the lines when actual translation files are available in sdk and remove loading locally.
+ QString locale = QLocale::system().name();
+ QString path = "z:/resource/qt/translations/";
+ QTranslator translator;
+ QTranslator translator_comm;
+ translator.load(path + QString("messaging_") + locale);
+ translator_comm.load(path + QString("common_") + locale);
+ app.installTranslator(&translator);
+ app.installTranslator(&translator_comm);
+
+ app.setApplicationName(LOC_TITLE);
+
+#ifdef _DEBUG_TRACES_
+ //Debug Logs
+ QFile ofile;
+ if (ofile.exists(debugFileName))
+ {
+ ofile.remove(debugFileName);
+ }
+ qInstallMsgHandler(debugInit);
+#endif
+
+
+ HbMainWindow *window = new HbMainWindow();
+
+ SettingsViewInterface *settingsViewInterface = new SettingsViewInterface(window);
+ window->show();
+
+ int rv = app.exec();
+ delete window;
+ delete settingsViewInterface;
+ return rv;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/src/settingsserviceinterface.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Interface for launching settings view as
+ * Qthighway service
+ *
+ */
+
+#include "settingsserviceinterface.h"
+#include <hbmainwindow.h>
+#include <hbaction.h>
+#include <hbapplication.h>
+
+#include "msgsettingsview.h"
+#include "debugtraces.h"
+
+//----------------------------------------------------------------------------
+// SettingsViewInterface::SettingsViewInterface
+// @see header
+//----------------------------------------------------------------------------
+SettingsViewInterface::SettingsViewInterface(HbMainWindow *mainWindow,QObject* parent)
+:XQServiceProvider(QLatin1String("messagesettings.com.nokia.symbian.IMessageSettings"),parent),
+mMainWindow(mainWindow)
+ {
+ publishAll();
+
+ //creating back action.
+ mBackAction = new HbAction(Hb::BackNaviAction, this);
+ connect(mBackAction, SIGNAL(triggered()), qApp, SLOT(quit()));
+
+ }
+
+//----------------------------------------------------------------------------
+// SettingsViewInterface::~SettingsViewInterface
+// @see header
+//----------------------------------------------------------------------------
+SettingsViewInterface::~SettingsViewInterface()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// SettingsViewInterface::launchSettings
+// @see header
+//----------------------------------------------------------------------------
+void SettingsViewInterface::launchSettings(int view)
+ {
+ QDEBUG_WRITE("Entered launchSettings")
+ MsgSettingsView* settingsView = new MsgSettingsView((MsgSettingsView::SettingsView)view);
+ settingsView->setNavigationAction(mBackAction);
+ mMainWindow->addView(settingsView);
+
+ if(view != MsgSettingsView::SMSView)
+ {
+ mMainWindow->setCurrentView(settingsView);
+ }
+ }
+
+//EOF
+
--- a/messagingapp/msgsettings/settingsview/inc/mmssettingprivate.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/inc/mmssettingprivate.h Wed Aug 18 09:45:25 2010 +0300
@@ -28,7 +28,7 @@
* The settings will be stored in the central repository.
*/
-class MmsSettingsPrivate
+class MmsSettingsPrivate : public CBase
{
public:
@@ -42,19 +42,19 @@
*/
~MmsSettingsPrivate();
- void setMMSRetrieval(MsgSettingEngine::MmsRetrieval aRetrieval);
+ void setMMSRetrievalL(MsgSettingEngine::MmsRetrieval aRetrieval);
- void setAnonymousMessages(TBool aAnonymous);
+ void setAnonymousMessagesL(TBool aAnonymous);
- void setReceiveMMSAdverts(TBool aReceiveAdvert);
+ void setReceiveMMSAdvertsL(TBool aReceiveAdvert);
- void advanceMmsSettings(MsgSettingEngine::MmsRetrieval& aRetrieval,
+ void advanceMmsSettingsL(MsgSettingEngine::MmsRetrieval& aRetrieval,
TBool& aAnonymousStatus, TBool& aMmsAdvertsStatus);
- void getAllAccessPoints(RPointerArray<HBufC>& aAccessPoints,
+ void getAllAccessPointsL(RPointerArray<HBufC>& aAccessPoints,
TInt& aDefaultIndex);
- void setMMSAccesspoint(TInt& aDefaultIndex);
+ void setMMSAccesspointL(TInt& aDefaultIndex);
private:
--- a/messagingapp/msgsettings/settingsview/inc/msgsettingengine.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/inc/msgsettingengine.h Wed Aug 18 09:45:25 2010 +0300
@@ -62,13 +62,6 @@
~MsgSettingEngine();
/**
- * for basic message settings
- * set the status of service messages
- * @param serviceMessages bool true or false
- */
- void setReceiveSerivceMessages(bool serviceMessages);
-
- /**
* set the character encoding
* @param encoding specifying encoding type
*/
@@ -77,11 +70,9 @@
/**
* returns settings delivery report status
* and character encoding
- * @param receiveServiceMessages for getting status service messages
* @param encoding for char encoding
*/
- void settingsServiceMessagesAndCharEncoding(
- bool& receiveServiceMessages,
+ void settingsCharEncoding(
MsgSettingEngine::CharacterEncoding& encoding);
/**
--- a/messagingapp/msgsettings/settingsview/inc/msgsettingsform.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/inc/msgsettingsform.h Wed Aug 18 09:45:25 2010 +0300
@@ -34,7 +34,6 @@
QGraphicsItem *parent = 0);
~MsgSettingsForm();
void refreshViewForm();
- void expandSMSSettings();
signals:
void newSMSCCenterClicked(int);
@@ -44,9 +43,9 @@
void addMMSGroupItem(HbDataFormModelItem* parent);
void addSmsMCGroupItem(HbDataFormModelItem* parent);
void updateSmsMCGroupItem(HbDataFormModelItem* parent);
+ void expandGroup(HbDataFormModelItem* group,bool expand);
private slots:
- void onPressedServiceMessages();
void onPressedCustomButton();
void changeCharEncoding(int index);
void changeAccessPoint(int index);
--- a/messagingapp/msgsettings/settingsview/inc/msgsettingsview.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/inc/msgsettingsview.h Wed Aug 18 09:45:25 2010 +0300
@@ -60,6 +60,10 @@
//Settings Form
MsgSettingsForm* mSettingsForm;
+ //main window.
HbMainWindow* mMainWindow;
+
+ //current settings view.
+ SettingsView mCurrentView;
};
#endif // MSGSETTINGSVIEW_H
--- a/messagingapp/msgsettings/settingsview/inc/smssettingsprivate.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/inc/smssettingsprivate.h Wed Aug 18 09:45:25 2010 +0300
@@ -37,25 +37,17 @@
~SmsSettingsPrivate();
/**
- * sets the status of service messages
- * @param serviceMessages status true or false
- */
- void setReceiveSerivceMessages(TBool serviceMessages);
-
- /**
* set the character encoding
* @param status true or false
*/
- void setCharacterEncoding(TBool status);
+ void setCharacterEncodingL(TBool status);
/**
* get the status of deliver report and
* character encoding
- * @param report status of delivery report
* @param statusEncoding charcter encoding
*/
- void settingsServiceMessagesAndCharEncoding(TBool& report,
- TBool& statusEncoding);
+ void settingsCharEncodingL(TBool& statusEncoding);
/**
* get all the sms service names and
@@ -63,14 +55,14 @@
* @param accessPoints array of access names
* @param defaultIndex, default set index
*/
- void getAllSMSMessageCenter(RPointerArray<HBufC>& accessPoints,
+ void getAllSMSMessageCenterL(RPointerArray<HBufC>& accessPoints,
int &defaultIndex);
/**
* set the default index
* @param index default index
*/
- void setSMSMessageCenter(int index);
+ void setSMSMessageCenterL(int index);
/**
* edit the sms service address
@@ -78,20 +70,20 @@
* @param name sms service name
* @param index value to modify
*/
- void editSMSServiceCentre(HBufC* address, HBufC* name, TInt index);
+ void editSMSServiceCentreL(HBufC* address, HBufC* name, TInt index);
/**
* add a new sms service address
* @param address service address number
* @param name service name
*/
- void addSmsMessageCenter(HBufC* address, HBufC* name);
+ void addSmsMessageCenterL(HBufC* address, HBufC* name);
/**
* delete sms service address
* @param aDeleteIndex refers to the index to delete
*/
- void deleteSmsMessageCenter(TInt aDeleteIndex);
+ void deleteSmsMessageCenterL(TInt aDeleteIndex);
/**
@@ -100,7 +92,7 @@
* @param centerNumber address of the service
* @param centerName name of the service
*/
- void smsCenterNameAndNumber(int index, HBufC** centerNumber,
+ void smsCenterNameAndNumberL(int index, HBufC** centerNumber,
HBufC** centerName);
private:
--- a/messagingapp/msgsettings/settingsview/src/mmssettingsprivate.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/mmssettingsprivate.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -127,7 +127,7 @@
CleanupStack::PopAndDestroy(3); // settings
}
-void MmsSettingsPrivate::setMMSRetrieval(MsgSettingEngine::MmsRetrieval aRetrieval)
+void MmsSettingsPrivate::setMMSRetrievalL(MsgSettingEngine::MmsRetrieval aRetrieval)
{
CEventHandler* pObserver = new (ELeave) CEventHandler();
CleanupStack::PushL(pObserver);
@@ -196,7 +196,7 @@
CleanupStack::PopAndDestroy(5);
}
-void MmsSettingsPrivate::setAnonymousMessages(TBool aAnonymous)
+void MmsSettingsPrivate::setAnonymousMessagesL(TBool aAnonymous)
{
CMmsAccount* mMmsAccount = CMmsAccount::NewL();
CleanupStack::PushL(mMmsAccount);
@@ -214,7 +214,7 @@
CleanupStack::PopAndDestroy(2);
}
-void MmsSettingsPrivate::setReceiveMMSAdverts(TBool aReceiveAdvert)
+void MmsSettingsPrivate::setReceiveMMSAdvertsL(TBool aReceiveAdvert)
{
CMmsAccount* mMmsAccount = CMmsAccount::NewL();
CleanupStack::PushL(mMmsAccount);
@@ -232,7 +232,7 @@
CleanupStack::PopAndDestroy(2);
}
-void MmsSettingsPrivate::advanceMmsSettings(
+void MmsSettingsPrivate::advanceMmsSettingsL(
MsgSettingEngine::MmsRetrieval& aRetrieval,
TBool& aAnonymousStatus,
TBool& aMmsAdvertsStatus)
@@ -286,7 +286,7 @@
// SmsSettings::iAPSelector
// @see header
//---------------------------------------------------------------
-void MmsSettingsPrivate::getAllAccessPoints(
+void MmsSettingsPrivate::getAllAccessPointsL(
RPointerArray<HBufC>& aAccessPoints,
TInt& aDefaultIndex)
{
@@ -368,7 +368,7 @@
// MmsSettingsPrivate::setMMSAccesspoint
// @see header
//---------------------------------------------------------------
-void MmsSettingsPrivate::setMMSAccesspoint(TInt& aDefaultIndex)
+void MmsSettingsPrivate::setMMSAccesspointL(TInt& aDefaultIndex)
{
#ifdef _DEBUG_TRACES_
qDebug() << "Enter MmsSettingsPrivate::setMMSAccesspoint: Index="
--- a/messagingapp/msgsettings/settingsview/src/msgsettingengine.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/msgsettingengine.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -32,8 +32,8 @@
#endif
- dptr_smsSettings = SmsSettingsPrivate::NewL();
- dptr_mmsSettings = MmsSettingsPrivate::NewL();
+ QT_TRAP_THROWING(dptr_smsSettings = SmsSettingsPrivate::NewL());
+ QT_TRAP_THROWING(dptr_mmsSettings = MmsSettingsPrivate::NewL());
#ifdef _DEBUG_TRACES_
qDebug() << "Exit MsgSettingEngine::MsgSettingEngine";
@@ -59,17 +59,6 @@
}
/**
- * for basic message settings
- * set the service messages status
- * @param serviceMessages bool true or false
- */
-void MsgSettingEngine::setReceiveSerivceMessages(bool serviceMessages)
-{
- dptr_smsSettings->setReceiveSerivceMessages(serviceMessages);
-
-}
-
-/**
* set the character encoding
* @param encoding specifying encoding type
*/
@@ -86,7 +75,7 @@
{
flag = ETrue;
}
- dptr_smsSettings->setCharacterEncoding(flag);
+ QT_TRAP_THROWING(dptr_smsSettings->setCharacterEncodingL(flag));
#ifdef _DEBUG_TRACES_
qDebug() << "MsgSettingEngine::setCharacterEncoding";
@@ -97,21 +86,16 @@
/**
* returns settings delivery report status
* and character encoding
- * @param receiveServiceMessages for getting receive service messages
* @param encoding for char encoding
*/
-void MsgSettingEngine::settingsServiceMessagesAndCharEncoding(
- bool& receiveServiceMessages,
+void MsgSettingEngine::settingsCharEncoding(
MsgSettingEngine::CharacterEncoding& encoding )
{
QDEBUG_WRITE("settingsServiceMessagesAndCharEncoding");
TBool encoding1;
- TBool receiveServiceMessages1;
-
- dptr_smsSettings->settingsServiceMessagesAndCharEncoding(
- receiveServiceMessages1,
- encoding1);
+
+ QT_TRAP_THROWING(dptr_smsSettings->settingsCharEncodingL(encoding1));
if (encoding1)
{
@@ -120,10 +104,6 @@
else
encoding = MsgSettingEngine::ReducedSupport;
- //TODO remove hardcoding later
- //receiveServiceMessages = (bool)receiveServiceMessages1;
- receiveServiceMessages = true;
-
return;
}
@@ -138,7 +118,7 @@
#endif
- dptr_mmsSettings->setMMSRetrieval(retrieval);
+ QT_TRAP_THROWING(dptr_mmsSettings->setMMSRetrievalL(retrieval));
#ifdef _DEBUG_TRACES_
qDebug() << "Exit setMMSRetrieval";
@@ -157,7 +137,7 @@
#endif
- dptr_mmsSettings->setAnonymousMessages(status);
+ QT_TRAP_THROWING (dptr_mmsSettings->setAnonymousMessagesL(status));
#ifdef _DEBUG_TRACES_
qDebug() << "Exit setAnonymousMessages";
@@ -176,7 +156,7 @@
#endif
- dptr_mmsSettings->setReceiveMMSAdverts(status);
+ QT_TRAP_THROWING(dptr_mmsSettings->setReceiveMMSAdvertsL(status));
#ifdef _DEBUG_TRACES_
qDebug() << "Exit setReceiveMMSAdverts";
@@ -202,9 +182,9 @@
TBool anonymous_Status;
TBool mmsAdverts_Status;
- dptr_mmsSettings->advanceMmsSettings(retrieval,
+ QT_TRAP_THROWING(dptr_mmsSettings->advanceMmsSettingsL(retrieval,
anonymous_Status,
- mmsAdverts_Status);
+ mmsAdverts_Status));
anonymousStatus = (bool) anonymous_Status;
mmsAdvertsStatus = (bool) mmsAdverts_Status;
@@ -232,7 +212,7 @@
RPointerArray<HBufC> accessPoints;
//= new(ELeave)RPointerArray<HBufC>();
- dptr_mmsSettings->getAllAccessPoints(accessPoints, defaultIndex);
+ QT_TRAP_THROWING( dptr_mmsSettings->getAllAccessPointsL(accessPoints, defaultIndex));
for (int i = 0; i < accessPoints.Count(); i++)
{
@@ -264,7 +244,7 @@
#endif
- dptr_mmsSettings->setMMSAccesspoint(index);
+ QT_TRAP_THROWING(dptr_mmsSettings->setMMSAccesspointL(index));
#ifdef _DEBUG_TRACES_
qDebug() << "Exit setMMSAccesspoint ";
@@ -287,7 +267,7 @@
RPointerArray<HBufC> accessPoints;
- dptr_smsSettings->getAllSMSMessageCenter(accessPoints, defaultIndex);
+ QT_TRAP_THROWING(dptr_smsSettings->getAllSMSMessageCenterL(accessPoints, defaultIndex));
for (int i = 0; i < accessPoints.Count(); i++)
{
@@ -319,7 +299,7 @@
#endif
- dptr_smsSettings->setSMSMessageCenter(index);
+ QT_TRAP_THROWING(dptr_smsSettings->setSMSMessageCenterL(index));
#ifdef _DEBUG_TRACES_
qDebug() << "Exit setSMSMessageCenter ";
@@ -344,7 +324,7 @@
HBufC* d_addr = XQConversions::qStringToS60Desc(centreNumber);
HBufC* d_name = XQConversions::qStringToS60Desc(centreName);
- dptr_smsSettings->editSMSServiceCentre(d_addr, d_name, index);
+ QT_TRAP_THROWING(dptr_smsSettings->editSMSServiceCentreL(d_addr, d_name, index));
delete d_addr;
delete d_name;
@@ -371,7 +351,7 @@
HBufC* d_addr = XQConversions::qStringToS60Desc(centreNumber);
HBufC* d_name = XQConversions::qStringToS60Desc(centreName);
- dptr_smsSettings->addSmsMessageCenter(d_addr, d_name);
+ QT_TRAP_THROWING(dptr_smsSettings->addSmsMessageCenterL(d_addr, d_name));
delete d_addr;
delete d_name;
@@ -387,7 +367,7 @@
*/
void MsgSettingEngine::deleteSmsMessageCenter(int deleteIndex)
{
- dptr_smsSettings->deleteSmsMessageCenter(deleteIndex);
+ QT_TRAP_THROWING( dptr_smsSettings->deleteSmsMessageCenterL(deleteIndex));
}
/**
@@ -407,7 +387,7 @@
HBufC* d_addr;
HBufC* d_name;
- dptr_smsSettings->smsCenterNameAndNumber(index, &d_addr, &d_name);
+ QT_TRAP_THROWING( dptr_smsSettings->smsCenterNameAndNumberL(index, &d_addr, &d_name));
centreNumber = XQConversions::s60DescToQString(d_addr->Des());
centreName = XQConversions::s60DescToQString(d_name->Des());
--- a/messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -27,7 +27,7 @@
//Localized constants
#define LOC_RECEIVING_SERVICE_MESSAGES hbTrId("txt_messaging_setlabel_receiving_service_messages")
-#define LOC_ON hbTrId("txt_messaging_setlabel_val_on")
+
#define LOC_OFF hbTrId("txt_messaging_setlabel_val_off")
#define LOC_REDUCED_SUPPORT hbTrId("txt_messaging_setlabel_val_reduced_support")
#define LOC_FULL_SUPPORT hbTrId("txt_messaging_setlabel_val_full_support")
@@ -83,11 +83,7 @@
MsgSettingEngine::CharacterEncoding charEncoding =
MsgSettingEngine::ReducedSupport;
- bool receiveServiceMessages = false;
-
- mSettingEngine->settingsServiceMessagesAndCharEncoding(
- receiveServiceMessages,
- charEncoding);
+ mSettingEngine->settingsCharEncoding(charEncoding);
// 1. Character encoding
HbDataFormModelItem *characterEncoding =
@@ -109,29 +105,7 @@
this,
SLOT(changeCharEncoding(int)));
- //2. receiving service messages
- QStringList serviceMessagesList;
- serviceMessagesList << LOC_OFF << LOC_ON;
-
- index = int (receiveServiceMessages);
- int otherIndex = (receiveServiceMessages + 1) % serviceMessagesList.count();
-
- HbDataFormModelItem *serviceMessagesItem =
- new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem,
- LOC_RECEIVING_SERVICE_MESSAGES,
- 0);
-
- serviceMessagesItem->setContentWidgetData("items", serviceMessagesList);
- serviceMessagesItem->setContentWidgetData("currentIndex", index);
-
- settingsModel->appendDataFormItem(serviceMessagesItem,
- settingsModel->invisibleRootItem());
- this->addConnection(serviceMessagesItem,
- SIGNAL(clicked()),
- this,
- SLOT(onPressedServiceMessages()));
-
- // 3. MMS Settings
+ // 2. MMS Settings
HbDataFormModelItem* mmsGroup =
new HbDataFormModelItem(HbDataFormModelItem::GroupItem,
LOC_MMS_SETTINGS,
@@ -157,15 +131,9 @@
if (settingsView == MsgSettingsView::MMSView)
{
//set MMS Settings as expanded
- QModelIndex index_mms = settingsModel->indexFromItem(mmsGroup);
- //TODO: dataform issue on expanding one group item
- //this->setExpanded(index_mms, true);
+ expandGroup(mmsGroup,true);
}
- else if(settingsView == MsgSettingsView::SMSView)
- {
- //expandSMSSettings();
- }
-
+
}
void MsgSettingsForm::refreshViewForm()
@@ -227,6 +195,7 @@
this,
SLOT(onPressedCustomButton()));
}
+
}
void MsgSettingsForm::addMMSGroupItem(HbDataFormModelItem* parent)
@@ -386,26 +355,6 @@
SLOT(onPressedCustomButton()));
}
-void MsgSettingsForm::onPressedServiceMessages()
-{
- HbPushButton *btn = qobject_cast<HbPushButton *> (sender());
-
- if (btn)
- {
- QString btnText = btn->text();
-
- //check if the button pressed was On or Off
- if (LOC_OFF == btnText)
- {
- mSettingEngine->setReceiveSerivceMessages(false);
- }
- else
- {
- mSettingEngine->setReceiveSerivceMessages(true);
- }
- }
-}
-
void MsgSettingsForm::changeCharEncoding(int index)
{
//set the character encoding
@@ -448,11 +397,11 @@
//check if the button pressed was Yes or NO
if (LOC_MMS_NO == btnText)
{
- mSettingEngine->setReceiveMMSAdverts(true);
+ mSettingEngine->setReceiveMMSAdverts(false);
}
else
{
- mSettingEngine->setReceiveMMSAdverts(false);
+ mSettingEngine->setReceiveMMSAdverts(true);
}
}
}
@@ -489,10 +438,13 @@
mSettingEngine->setSMSMessageCenter(index);
}
-void MsgSettingsForm::expandSMSSettings()
+void MsgSettingsForm::expandGroup(HbDataFormModelItem* group,bool expand)
{
- QModelIndex index_sms = settingsModel->indexFromItem(mSmsMCGroup);
+ QModelIndex index = settingsModel->indexFromItem(group);
- this->setExpanded(index_sms, true);
+ if(index.isValid())
+ {
+ this->setExpanded(index, expand);
+ }
}
//EOF
--- a/messagingapp/msgsettings/settingsview/src/msgsettingsview.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/msgsettingsview.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -17,6 +17,7 @@
#include <hbmainwindow.h>
#include <hbgroupbox.h>
#include <QGraphicsLinearLayout>
+#include <HbAction>
#include "msgsettingsview.h"
#include "msgsettingsform.h"
@@ -26,9 +27,11 @@
//LOCALAIZED CONSTANTS
#define LOC_MESSAGE_SETTINGS_HEADING hbTrId("txt_messaging_title_messaging_settings")
-MsgSettingsView::MsgSettingsView(SettingsView settingsView,
- QGraphicsItem *parent) :
- MsgBaseView(parent), mSMSCenterView(0), mSettingsForm(0)
+MsgSettingsView::MsgSettingsView(SettingsView settingsView,QGraphicsItem *parent):
+MsgBaseView(parent),
+mSMSCenterView(0),
+mSettingsForm(0),
+mCurrentView(settingsView)
{
mMainWindow = this->mainWindow();
@@ -47,11 +50,18 @@
SIGNAL(newSMSCCenterClicked(int)),
this,
SLOT(onNewSMSCCenterClicked(int)));
+
mainLayout->addItem(viewHeading);
mainLayout->addItem(mSettingsForm);
this->setLayout(mainLayout);
+
+ //sms settings need to be created so launch MsgSMSCenterView in edit mode.
+ if(settingsView == SMSView)
+ {
+ onNewSMSCCenterClicked(-1);
+ }
}
MsgSettingsView::~MsgSettingsView()
@@ -81,14 +91,28 @@
void MsgSettingsView::onSmsCenterEditViewClosed()
{
+
+ //sms center view was directly launched, no need to go back to settings view.
+ if(mCurrentView == SMSView)
+ {
+ this->navigationAction()->trigger();
+ return;
+ }
//remove the view
mMainWindow->removeView(mSMSCenterView);
-
- //refresh the form
- mSettingsForm->refreshViewForm();
-
- //add the current view on top
- mMainWindow->setCurrentView(this);
+
+ // This check is needed in case when smsc center view is
+ // launched directly
+ if(mMainWindow->views().count() > 0)
+ {
+ QCRITICAL_WRITE("MsgViewManager::onSmsCenterEditViewClosed count>0");
+
+ //refresh the form
+ mSettingsForm->refreshViewForm();
+
+ //add the current view on top
+ mMainWindow->setCurrentView(this);
+ }
}
//eof
--- a/messagingapp/msgsettings/settingsview/src/msgsmscentersettingsform.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/msgsmscentersettingsform.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -32,8 +32,9 @@
//Localized constants
#define LOC_SMS_CENTRE_NAME hbTrId("txt_messaging_setlabel_message_centre_name")
#define LOC_SMS_CENTRE_NUMBER hbTrId("txt_messaging_setlabel_message_centre_number")
-#define LOC_SMS_CENTRE_DELETE hbTrId("txt_messaging_button_delete_message_centre")
-#define LOC_MESSAGE_CENTER_SAVED hbTrId("txt_messaging_setlabel_message_centre_saved")
+#define LOC_SMS_CENTRE_DELETE_BUTTON hbTrId("txt_messaging_button_delete_message_centre")
+#define LOC_SMS_CENTRE_DELETE_DIALOG hbTrId("txt_messaging_dialog_delete_message_centre")
+#define LOC_MESSAGE_CENTER_SAVED hbTrId("txt_messaging_dpopinfo_message_centre_saved")
MsgSMSCenterSettingsForm::MsgSMSCenterSettingsForm(int view,
QGraphicsItem *parent) :
@@ -114,12 +115,9 @@
QString(""),
settingsmodel->invisibleRootItem());
- deleteMessageCentre->setContentWidgetData("text",
- LOC_SMS_CENTRE_DELETE);
- this->addConnection(deleteMessageCentre,
- SIGNAL(clicked()),
- this,
- SLOT(onPressedCustomButton()));
+ deleteMessageCentre->setContentWidgetData("text",LOC_SMS_CENTRE_DELETE_BUTTON);
+ this->addConnection(deleteMessageCentre,SIGNAL(clicked()),
+ this,SLOT(onPressedCustomButton()));
}
this->setModel(settingsmodel);
@@ -153,12 +151,11 @@
}
else
{
- mSettingEngine->editSmsMessageCenter(centerName,
- centerNumber,
- mView);
-
- HbNotificationDialog::launchDialog(LOC_MESSAGE_CENTER_SAVED);
+ mSettingEngine->editSmsMessageCenter(centerName, centerNumber, mView);
}
+
+ HbNotificationDialog::launchDialog(LOC_MESSAGE_CENTER_SAVED);
+
QDEBUG_WRITE("ex MsgSMSCenterSettingsForm::commitChanges");
}
@@ -189,7 +186,7 @@
void MsgSMSCenterSettingsForm::onPressedCustomButton()
{
- HbMessageBox::question(LOC_SMS_CENTRE_DELETE, this,
+ HbMessageBox::question(LOC_SMS_CENTRE_DELETE_DIALOG, this,
SLOT(onDialogDeleteMsgCentre(HbAction*)),
HbMessageBox::Delete | HbMessageBox::Cancel);
}
--- a/messagingapp/msgsettings/settingsview/src/smssettingsprivate.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/smssettingsprivate.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -62,22 +62,7 @@
//do nothing
}
-void SmsSettingsPrivate::setReceiveSerivceMessages(
- TBool serviceMessages)
-{
- CSmsAccount* smsAccount = CSmsAccount::NewLC();
- CSmsSettings* smsSettings = CSmsSettings::NewLC();
-
- smsAccount->LoadSettingsL(*smsSettings);
-
- //TODO set the receive message part
-
- smsAccount->SaveSettingsL(*smsSettings);
-
- CleanupStack::PopAndDestroy(2);
-}
-
-void SmsSettingsPrivate::setCharacterEncoding(TBool status)
+void SmsSettingsPrivate::setCharacterEncodingL(TBool status)
{
CSmsAccount* smsAccount = CSmsAccount::NewLC();
CSmsSettings* smsSettings = CSmsSettings::NewLC();
@@ -98,17 +83,13 @@
CleanupStack::PopAndDestroy(2);
}
-void SmsSettingsPrivate::settingsServiceMessagesAndCharEncoding(
- TBool& report,
- TBool& statusEncoding)
+void SmsSettingsPrivate::settingsCharEncodingL(TBool& statusEncoding)
{
CSmsAccount* smsAccount = CSmsAccount::NewLC();
CSmsSettings* smsSettings = CSmsSettings::NewLC();
smsAccount->LoadSettingsL(*smsSettings);
- //TODO: service messages read
-
TSmsDataCodingScheme::TSmsAlphabet charSet = smsSettings->CharacterSet();
statusEncoding = ETrue;
@@ -119,7 +100,7 @@
CleanupStack::PopAndDestroy(2);
}
-void SmsSettingsPrivate::getAllSMSMessageCenter(
+void SmsSettingsPrivate::getAllSMSMessageCenterL(
RPointerArray<HBufC>& accessPoints,
TInt &defaultIndex)
{
@@ -144,7 +125,7 @@
return;
}
-void SmsSettingsPrivate::setSMSMessageCenter(int index)
+void SmsSettingsPrivate::setSMSMessageCenterL(int index)
{
CSmsAccount* smsAccount = CSmsAccount::NewLC();
CSmsSettings* smsSettings = CSmsSettings::NewLC();
@@ -156,7 +137,7 @@
CleanupStack::PopAndDestroy(2);
}
-void SmsSettingsPrivate::editSMSServiceCentre(HBufC* address, HBufC* name,
+void SmsSettingsPrivate::editSMSServiceCentreL(HBufC* address, HBufC* name,
TInt index)
{
CSmsAccount* smsAccount = CSmsAccount::NewLC();
@@ -170,9 +151,7 @@
{
flag = true;
}
-
- //remove the service center
- //smsSettings->RemoveServiceCenter(index);
+
//add a new service center
smsSettings->AddServiceCenterL(name->Des(), address->Des());
@@ -182,20 +161,15 @@
smsSettings->ServiceCenterCount()- 1);
}
- smsAccount->SaveSettingsL(*smsSettings);
-
- smsAccount->LoadSettingsL(*smsSettings);
- if (flag == true)
- {
- smsSettings->RemoveServiceCenter(index);
- }
+ //remove the service center
+ smsSettings->RemoveServiceCenter(index);
- smsAccount->SaveSettingsL(*smsSettings);
+ smsAccount->SaveSettingsL(*smsSettings);
CleanupStack::PopAndDestroy(2);
}
-void SmsSettingsPrivate::addSmsMessageCenter(HBufC* address, HBufC* name)
+void SmsSettingsPrivate::addSmsMessageCenterL(HBufC* address, HBufC* name)
{
CSmsAccount* smsAccount = CSmsAccount::NewLC();
CSmsSettings* smsSettings = CSmsSettings::NewLC();
@@ -215,7 +189,7 @@
CleanupStack::PopAndDestroy(2);
}
-void SmsSettingsPrivate::deleteSmsMessageCenter(TInt aDeleteIndex)
+void SmsSettingsPrivate::deleteSmsMessageCenterL(TInt aDeleteIndex)
{
CSmsAccount* smsAccount = CSmsAccount::NewLC();
CSmsSettings* smsSettings = CSmsSettings::NewLC();
@@ -238,7 +212,7 @@
CleanupStack::PopAndDestroy(2);
}
-void SmsSettingsPrivate::smsCenterNameAndNumber(int index,
+void SmsSettingsPrivate::smsCenterNameAndNumberL(int index,
HBufC** centerNumber,
HBufC** centerName)
{
--- a/messagingapp/msgui/appengine/inc/conversationchangehandler.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/inc/conversationchangehandler.h Wed Aug 18 09:45:25 2010 +0300
@@ -82,10 +82,18 @@
*
* @param aConversationEntryList List of conversation entries
* returned by server.
+ * @param aTotalCount total number of conversation entries
*/
void ConversationsL(
- RPointerArray<CCsConversationEntry>& aConversationEntryList);
+ RPointerArray<CCsConversationEntry>& aConversationEntryList,
+ TInt& aTotalCount);
+
+ /**
+ * ResetValuesForNewConversation
+ * Resets the values of flags, and indexes for a new conversation
+ */
+ void ResetValuesForNewConversation();
public://MCsConversationChangeObserver
/**
@@ -134,7 +142,13 @@
* Handles Conversations received from server and updates into model
*/
void HandleConversationsL();
-
+
+ /**
+ * Fetch remaning conversations from Server Cache
+ * @param aCount - count of conversations added to entry list
+ */
+ void FetchRemainingConversations(TInt aCount);
+
private:
// Data
@@ -145,6 +159,7 @@
{
EInit = 500,
EInitialCache,
+ EFetchMoreConversations,
EListenToEvents
};
@@ -167,6 +182,11 @@
TInt mCurrentIndex;
/**
+ * Total count of conversation entries in the Conversation
+ * Own
+ */
+ TInt mTotalCount;
+ /**
* ConversationsModel Object
* Not Own.
*/
--- a/messagingapp/msgui/appengine/inc/conversationmsgstorehandler.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/inc/conversationmsgstorehandler.h Wed Aug 18 09:45:25 2010 +0300
@@ -32,7 +32,7 @@
class CMmsNotificationClientMtm;
-class ConversationMsgStoreHandler: public MMsvSessionObserver
+class ConversationMsgStoreHandler: public CBase, public MMsvSessionObserver
{
public:
@@ -147,9 +147,9 @@
/**
* Seeker method for getting mms notification estimated msg size
- * @return Formatted string of msg size
+ * @return formatted string for msg size in KB
*/
- QString NotificationMsgSizeL();
+ QString NotificationMsgSize();
/**
* Seeker method for getting mms notification class type
@@ -168,13 +168,9 @@
/**
* Seeker method getting expiry info of a notification msg
- * @param [OUT] expiryTime, notification's expiry time
- * @param [OUT] expiryTimeQString, formatted string of
- * notification's expiry time
+ * @return formatted string of notification's expiry time
*/
- void NotificationExpiryDate(
- TTime& expiryTime,
- QString& expiryTimeStr);
+ QString NotificationExpiryDate();
/**
* Download a specified message
@@ -223,6 +219,11 @@
* Checks if the MTM type supported
*/
TBool IsMtmSupported(long uid);
+
+ /**
+ * Get max receive size limit (for MMS) from settings
+ */
+ TInt MaxReceiveSizeLimitL();
private:
/**
--- a/messagingapp/msgui/appengine/inc/conversationsengine_p.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/inc/conversationsengine_p.h Wed Aug 18 09:45:25 2010 +0300
@@ -41,7 +41,7 @@
* @endcode
* @since S60 v10.1
*/
-class ConversationsEnginePrivate :public MCsResultsObserver
+class ConversationsEnginePrivate :public CBase, public MCsResultsObserver
{
public:
@@ -151,9 +151,15 @@
CCsClientConversation* getConversationFromConversationIdL(TInt aConversationId);
/**
- * Starts fetching remaing conversations
+ * Starts fetching rest of the conversations
*/
void fetchMoreConversations();
+
+ /**
+ * Starts fetching remaing conversations
+ * @param aCount - count of conversation entries
+ */
+ void fetchRemainingConversations(TInt& aCount);
/**
@@ -202,7 +208,8 @@
*/
void Conversations(
- RPointerArray<CCsConversationEntry>& aConversationEntryList);
+ RPointerArray<CCsConversationEntry>& aConversationEntryList,
+ TInt& totalCount);
private:
--- a/messagingapp/msgui/appengine/inc/conversationsmodel.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/inc/conversationsmodel.h Wed Aug 18 09:45:25 2010 +0300
@@ -172,6 +172,13 @@
* @return true/false
*/
bool validateMsgForForward(qint32 messageId);
+
+ /*
+ * Handle Vcard messages
+ * @param item, QStandardItem
+ * @param msgId
+ */
+ void handleVCard(QStandardItem& item, int msgId);
private:
--- a/messagingapp/msgui/appengine/src/conversationchangehandler.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationchangehandler.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -61,9 +61,10 @@
// ---------------------------------------------------------------------------
//
void ConversationsChangeHandler::ConversationsL(RPointerArray<
- CCsConversationEntry>& aConversationEntryList)
+ CCsConversationEntry>& aConversationEntryList, TInt& aTotalCount)
{
- mConversationEntryList.ResetAndDestroy();
+
+ mTotalCount = aTotalCount;
for (TInt i = 0; i < aConversationEntryList.Count(); ++i)
{
@@ -72,8 +73,6 @@
}
if (aConversationEntryList.Count() > 0)
{
- mFirstWindowCached = EFalse;
- mCurrentIndex = 0;
mCurrentState = EInitialCache;
IssueRequest();
}
@@ -84,6 +83,20 @@
mCurrentState = EListenToEvents;
}
}
+// ---------------------------------------------------------------------------
+// This is for resetting the values before initiating a request
+// for fetching entries for a new conversation
+// ---------------------------------------------------------------------------
+//
+void ConversationsChangeHandler::ResetValuesForNewConversation()
+{
+ mConvEnginePrivate->registerForConversationUpdatesL();
+ mCurrentIndex = 0;
+ mFirstWindowCached = EFalse;
+ mConversationEntryList.ResetAndDestroy();
+
+
+}
// ---------------------------------------------------------------------------
// Handling addition of new conversation entry from the server
@@ -147,6 +160,9 @@
case EInitialCache:
HandleConversationsL();
break;
+ case EFetchMoreConversations:
+ FetchRemainingConversations(mConversationEntryList.Count());
+ break;
}
}
@@ -202,6 +218,15 @@
return;
}
IssueRequest();
+ return;
+ }
+ //if more entries have to be fetched , issue a request,
+ // else listen for events.
+ if(mCurrentIndex < mTotalCount )
+ {
+ //fetch more
+ mCurrentState = EFetchMoreConversations;
+ IssueRequest();
}
else
{
@@ -211,12 +236,20 @@
mFirstWindowCached = ETrue;
}
mConversationEntryList.ResetAndDestroy();
- mConvEnginePrivate->registerForConversationUpdatesL();
mCurrentState = EListenToEvents;
}
}
// ---------------------------------------------------------------------------
+// Fetches remaining conversations from the server
+// ---------------------------------------------------------------------------
+//
+void ConversationsChangeHandler::FetchRemainingConversations(TInt aTotalCount)
+{
+ mConvEnginePrivate->fetchRemainingConversations(aTotalCount);
+
+}
+// ---------------------------------------------------------------------------
// Starts fetching remaining conversations
// ---------------------------------------------------------------------------
//
--- a/messagingapp/msgui/appengine/src/conversationmsgstorehandler.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationmsgstorehandler.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -15,6 +15,7 @@
*
*/
+#include <hbglobal.h>
#include <textresolver.h> // from CommonEngine
#include <mtclreg.h>
#include <mmsnotificationclient.h>
@@ -46,9 +47,16 @@
_LIT(KUnixEpoch, "19700000:000000.000000");
#define BYTES_TO_KBYTES_FACTOR 1024
-// TODO: read global setting of formats on the phone
-const QString DATE_FORMAT("dd/MM");
-const QString TIME_FORMAT("hh:mm");
+// LOCALIZATION
+#define LOC_MESSAGE_SIZE hbTrId("txt_messaging_list_size")
+#define LOC_CLASS_ADVERTISEMENT hbTrId("txt_messaging_list_advertisement")
+#define LOC_CLASS_INFORMATIONAL hbTrId("txt_messaging_list_informational")
+#define LOC_CLASS_PERSONAL hbTrId("txt_messaging_list_personal")
+#define LOC_MMS_RETRIEVAL_FAILED hbTrId("txt_messaging_dialog_mms_retrieval_failed")
+#define LOC_MMS_NOTIF_EXPIRED hbTrId("Message Expired !") //TODO: localization
+#define LOC_MMS_WAITING hbTrId("txt_wireframe_list_multimedia_message_waiting")
+#define LOC_MMS_RETRIEVING hbTrId("Retrieving message...") //TODO: localization
+#define LOC_MMS_EXPIRY_DATE hbTrId("txt_messaging_list_expiry_date")
// ================= MEMBER FUNCTIONS =======================
@@ -674,18 +682,14 @@
// ConversationMsgStoreHandler::NotificationMsgSizeL
// @see header
//---------------------------------------------------------------
-QString ConversationMsgStoreHandler::NotificationMsgSizeL()
+QString ConversationMsgStoreHandler::NotificationMsgSize()
{
// Size of message.
TInt size = iNotificationClient->MessageTransferSize( );
-
+
// read max receive size limit from settings
- CMmsSettings* settings = CMmsSettings::NewL();
- CleanupStack::PushL( settings );
- iNotificationClient->RestoreSettingsL();
- settings->CopyL( iNotificationClient->MmsSettings() );
- TInt maxSize = static_cast<TInt>(settings->MaximumReceiveSize() );
- CleanupStack::PopAndDestroy( settings );
+ TInt maxSize = 0;
+ TRAP_IGNORE(maxSize = MaxReceiveSizeLimitL());
// apply max size limit rule
if( maxSize > 0 )
@@ -696,16 +700,13 @@
}
}
- // Finally make the UI string
- int fileSize = size / BYTES_TO_KBYTES_FACTOR;
+ TInt fileSize = size / BYTES_TO_KBYTES_FACTOR;
if ( size % BYTES_TO_KBYTES_FACTOR )
{
fileSize++;
}
- // TODO: use localized string constants here
- QString sizeString = QString("%1").arg(fileSize);
- sizeString.append(" Kb");
- return sizeString;
+
+ return LOC_MESSAGE_SIZE.arg(fileSize);
}
//---------------------------------------------------------------
@@ -714,24 +715,23 @@
//---------------------------------------------------------------
QString ConversationMsgStoreHandler::NotificationClass()
{
- //TODO: use localized string
QString notificationClass;
TInt msgClass = iNotificationClient->MessageClass( );
switch( msgClass )
{
case EMmsClassPersonal:
{
- notificationClass = "Personal";
+ notificationClass = LOC_CLASS_PERSONAL;
break;
}
case EMmsClassAdvertisement:
{
- notificationClass = "Advertisement";
+ notificationClass = LOC_CLASS_ADVERTISEMENT;
break;
}
case EMmsClassInformational:
{
- notificationClass = "Informative";
+ notificationClass = LOC_CLASS_INFORMATIONAL;
break;
}
default:
@@ -750,7 +750,6 @@
int& status,
QString& statusStr)
{
- // TODO : use standard strings provided by Arul
// fetch mms notification status from store handler
// and map as per our UI requirements
TMsvEntry entry = iNotificationClient->Entry().Entry();
@@ -759,23 +758,23 @@
{
case ConvergedMessage::NotifFailed:
{
- statusStr = "Message retrieval failed !";
+ statusStr = LOC_MMS_RETRIEVAL_FAILED;
break;
}
case ConvergedMessage::NotifExpired:
{
- statusStr = "Message Expired !";
+ statusStr = LOC_MMS_NOTIF_EXPIRED;
break;
}
case ConvergedMessage::NotifReadyForFetching:
{
- statusStr = "Multimedia Message waiting...";
+ statusStr = LOC_MMS_WAITING;
break;
}
case ConvergedMessage::NotifWaiting:
case ConvergedMessage::NotifRetrieving:
{
- statusStr = "Retrieving message...";
+ statusStr = LOC_MMS_RETRIEVING;
break;
}
default:
@@ -790,10 +789,11 @@
// ConversationMsgStoreHandler::NotificationExpiryDate
// @see header
//---------------------------------------------------------------
-void ConversationMsgStoreHandler::NotificationExpiryDate(
- TTime& expiryTime,
- QString& expiryTimeStr)
+QString ConversationMsgStoreHandler::NotificationExpiryDate()
{
+ TTime expiryTime = 0;
+ QString expiryTimeStr;
+
// get expiry time from entry
expiryTime = iNotificationClient->ExpiryDate( );
TLocale locale;
@@ -808,14 +808,7 @@
TTime unixEpoch(KUnixEpoch);
TTimeIntervalSeconds seconds;
expiryTime.SecondsFrom(unixEpoch, seconds);
- QDateTime dateTime;
- dateTime.setTime_t(seconds.Int());
- if (dateTime.date() == QDateTime::currentDateTime().date()) {
- expiryTimeStr = dateTime.toString(TIME_FORMAT);
- }
- else {
- expiryTimeStr = dateTime.toString(DATE_FORMAT);
- }
+ return LOC_MMS_EXPIRY_DATE.arg(seconds.Int());
}
//-----------------------------------------------------------------------------
@@ -967,6 +960,22 @@
break;
case KSenduiMtmBioUidValue:
{
+ if (entry.iMtmData1 == KSenduiMtmBtUidValue)
+ {
+ msgType = ConvergedMessage::BT;
+
+ if (entry.iBioType == KMsgBioUidVCard.iUid)
+ {
+ msgSubType = ConvergedMessage::VCard;
+ }
+ else if (entry.iBioType == KMsgBioUidVCalendar.iUid)
+ {
+
+ msgSubType = ConvergedMessage::VCal;
+ }
+
+ break;
+ }
msgType = ConvergedMessage::BioMsg;
// based on the biotype uid set message type
@@ -997,6 +1006,10 @@
}
}
+//----------------------------------------------------------------------------
+// ConversationMsgStoreHandler::getMsgSubType
+// @see header
+//----------------------------------------------------------------------------
int ConversationMsgStoreHandler::getMsgSubType(int msgId)
{
int msgType = ConvergedMessage::None;
@@ -1010,4 +1023,19 @@
return msgSubType;
}
+//----------------------------------------------------------------------------
+// ConversationMsgStoreHandler::MaxReceiveSizeLimitL
+// @see header
+//----------------------------------------------------------------------------
+TInt ConversationMsgStoreHandler::MaxReceiveSizeLimitL()
+{
+ CMmsSettings* settings = CMmsSettings::NewL();
+ CleanupStack::PushL( settings );
+ iNotificationClient->RestoreSettingsL();
+ settings->CopyL( iNotificationClient->MmsSettings() );
+ TInt maxSize = static_cast<TInt>(settings->MaximumReceiveSize() );
+ CleanupStack::PopAndDestroy( settings );
+ return maxSize;
+}
+
// End of file
--- a/messagingapp/msgui/appengine/src/conversationsengine.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationsengine.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -47,14 +47,15 @@
ConversationsEngine::ConversationsEngine(QObject* parent):
QObject(parent), mDraftsModel(NULL)
{
- mConversationMsgStoreHandler = new ConversationMsgStoreHandler;
+ mConversationMsgStoreHandler = q_check_ptr(new ConversationMsgStoreHandler);
+
mConversationsSummaryModel = new ConversationsSummaryModel(this);
mConversationsModel = new ConversationsModel(mConversationMsgStoreHandler,
this);
- d_ptr = new ConversationsEnginePrivate(mConversationMsgStoreHandler,
+ d_ptr = q_check_ptr( new ConversationsEnginePrivate(mConversationMsgStoreHandler,
mConversationsSummaryModel,
- mConversationsModel);
+ mConversationsModel));
connect (mConversationsModel,
SIGNAL(conversationViewEmpty()),
@@ -170,6 +171,7 @@
{
int error;
TRAP(error, d_ptr->deleteAllDraftMessagesL());
+ qt_symbian_throwIfError(error);
}
//---------------------------------------------------------------
@@ -227,7 +229,9 @@
int error;
CCsClientConversation* clientConv = NULL;
TRAP(error, clientConv = d_ptr->getConversationFromConversationIdL(conversationId));
-
+
+ qt_symbian_throwIfError(error);
+
HBufC *name = clientConv->GetDisplayName();
if (name && name->Length())
{
@@ -329,7 +333,7 @@
int newConversationId)
{
//also register for subscription now
- d_ptr->registerAgainForConversationUpdatesL(newConversationId);
+ QT_TRAP_THROWING(d_ptr->registerAgainForConversationUpdatesL(newConversationId));
}
//---------------------------------------------------------------
--- a/messagingapp/msgui/appengine/src/conversationsengine_p.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationsengine_p.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -28,6 +28,12 @@
#include "conversationlistchangehandler.h"
#include "debugtraces.h"
+
+//CONSTANTS
+/**
+ *Max number of conversation that can be exchanged in IPC call
+ */
+const TInt KMaxConversationIPCLimit = 250;
//---------------------------------------------------------------
// ConversationsEnginePrivate::ConversationsEnginePrivate
// @see header
@@ -42,7 +48,7 @@
mConversationsSummaryModel(conversationsSummaryModel),
mConversationsModel(conversationsModel)
{
- TRAP_IGNORE(initL());
+ initL();
}
//---------------------------------------------------------------
@@ -128,8 +134,11 @@
CleanupStack::PushL(entry);
mClientConv->SetConversationEntryL(entry);
CleanupStack::PopAndDestroy(entry);
+ // Reset the values in change handler before initiating a request
+ mConvChangeHandler->ResetValuesForNewConversation();
+
//Get the conversations for new conversationId
- mServer->GetConversationsL(mClientConv);
+ mServer->GetConversationsL(mClientConv,0,KMaxConversationIPCLimit);
QCRITICAL_WRITE("ConversationsEnginePrivate::getConversationsL end.");
}
@@ -310,14 +319,15 @@
// @see header
//---------------------------------------------------------------
void ConversationsEnginePrivate::Conversations(
- RPointerArray<CCsConversationEntry>& aConversationEntryList)
+ RPointerArray<CCsConversationEntry>& aConversationEntryList,
+ TInt& aTotalCount)
{
int error;
if (mClientConv)
{
QCRITICAL_WRITE("ConversationsEnginePrivate::Conversations start.");
- TRAP(error,mConvChangeHandler->ConversationsL(aConversationEntryList));
+ TRAP(error,mConvChangeHandler->ConversationsL(aConversationEntryList,aTotalCount));
QCRITICAL_WRITE("ConversationsEnginePrivate::Conversations end.");
}
@@ -337,6 +347,21 @@
}
//---------------------------------------------------------------
+// ConversationsEngine::fetchRemainingConversations
+// @see header
+//---------------------------------------------------------------
+void ConversationsEnginePrivate::fetchRemainingConversations(TInt& aCount)
+ {
+ if ( mServer && mClientConv )
+ {
+
+ // Get conversations from server
+ mServer->GetConversationsL(mClientConv,
+ (aCount - 1),
+ KMaxConversationIPCLimit);
+ }
+ }
+//---------------------------------------------------------------
// ConversationsEnginePrivate::resendMessage()
// @see header
//---------------------------------------------------------------
--- a/messagingapp/msgui/appengine/src/conversationsengineutility.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationsengineutility.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -51,6 +51,8 @@
mMessageType = ConvergedMessage::BioMsg;
break;
case ECsBlueTooth:
+ case ECsBlueTooth_VCard:
+ case ECsBlueTooth_VCal:
mMessageType = ConvergedMessage::BT;
break;
case ECsMmsNotification:
@@ -110,6 +112,12 @@
case ECsBioMsg_VCal:
messageSubType = ConvergedMessage::VCal;
break;
+ case ECsBlueTooth_VCard:
+ messageSubType = ConvergedMessage::VCard;
+ break;
+ case ECsBlueTooth_VCal:
+ messageSubType = ConvergedMessage::VCal;
+ break;
case ECsAudio:
messageSubType = ConvergedMessage::Audio;
break;
--- a/messagingapp/msgui/appengine/src/conversationsmodel.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationsmodel.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -47,6 +47,9 @@
//selecet preview-icon query
_LIT(KSelectPreviewIconStmt,"SELECT message_id, preview_icon FROM conversation_messages WHERE message_id = :message_id ");
+//selecet vcard-path query
+_LIT(KSelectVCardStmt,"SELECT message_id, msg_processingstate, preview_path FROM conversation_messages WHERE message_id = :message_id ");
+
// preview-cache max cost (items)
const int CACHE_COST = 50;
//Preview thumbnail size
@@ -435,36 +438,46 @@
// use entry to populate model only when,
// entry is present in DB and its processing is over.
RBuf subjectBuffer;
- subjectBuffer.Create(sqlSelectStmt.ColumnSize(
- subjectIndex));
- sqlSelectStmt.ColumnText(subjectIndex, subjectBuffer);
-
- item.setData(XQConversions::s60DescToQString(
- subjectBuffer), Subject);
- subjectBuffer.Close();
-
+ if( subjectBuffer.Create(
+ sqlSelectStmt.ColumnSize(
+ subjectIndex)) == KErrNone)
+ {
+ sqlSelectStmt.ColumnText(subjectIndex, subjectBuffer);
+ item.setData(
+ XQConversions::s60DescToQString(
+ subjectBuffer), Subject);
+ subjectBuffer.Close();
+ }
+
RBuf bodyBuffer;
- bodyBuffer.Create(sqlSelectStmt.ColumnSize(bodyIndex));
- sqlSelectStmt.ColumnText(bodyIndex, bodyBuffer);
-
- item.setData(
- XQConversions::s60DescToQString(bodyBuffer),
- BodyText);
- bodyBuffer.Close();
+ if (bodyBuffer.Create(
+ sqlSelectStmt.ColumnSize(
+ bodyIndex)) == KErrNone)
+ {
+ sqlSelectStmt.ColumnText(bodyIndex, bodyBuffer);
+ item.setData(
+ XQConversions::s60DescToQString(
+ bodyBuffer), BodyText);
+ bodyBuffer.Close();
+ }
RBuf previewPathBuffer;
- previewPathBuffer.Create(sqlSelectStmt.ColumnSize(
- previewPathIndex));
- sqlSelectStmt.ColumnText(previewPathIndex,
- previewPathBuffer);
+ QString attachmentPath;
+ if (previewPathBuffer.Create(
+ sqlSelectStmt.ColumnSize(
+ previewPathIndex)) == KErrNone)
+ {
+ sqlSelectStmt.ColumnText(
+ previewPathIndex,
+ previewPathBuffer);
- //Rightnow set inside attachments
- QString attachmentPath(XQConversions::s60DescToQString(
- previewPathBuffer));
-
- item.setData(attachmentPath, Attachments);
- previewPathBuffer.Close();
-
+ //Rightnow set inside attachments
+ attachmentPath = XQConversions::s60DescToQString(
+ previewPathBuffer);
+ item.setData(attachmentPath, Attachments);
+ previewPathBuffer.Close();
+ }
+
int msgProperty = 0;
msgProperty = sqlSelectStmt.ColumnInt(msgpropertyIndex);
item.setData(msgProperty, MessageProperty);
@@ -555,7 +568,14 @@
{
QFile file(objectList[index]->path());
file.open(QIODevice::ReadOnly);
- textContent = file.readAll();
+ QByteArray textArray;
+ textArray = file.readAll();
+ char *data = new char[textArray.size()+1];
+ strcpy(data,textArray.data());
+ //This is needed since MMS text content
+ //is stored in UTF8 format
+ textContent = textContent.fromUtf8(data,strlen(data));
+ delete []data;
item.setData(textContent, BodyText);
isBodyTextSet = true;
file.close();
@@ -663,21 +683,6 @@
}
// fetch relevent info to show in CV
- // msg size
- QString estimatedMsgSizeStr = QString("%1").arg(0);
- estimatedMsgSizeStr.append(" Kb");
- TRAP_IGNORE(estimatedMsgSizeStr =
- mMsgStoreHandler->NotificationMsgSizeL());
-
- // msg class type
- QString classInfoStr = mMsgStoreHandler->NotificationClass();
-
- // notification expiry date
- //TODO: Need to do localization of digits used to show expiry time
- TTime expiryTime;
- QString expiryTimeStr;
- mMsgStoreHandler->NotificationExpiryDate(expiryTime, expiryTimeStr);
-
// notification state e.g. waiting, retrieving etc
QString statusStr;
int status;
@@ -685,19 +690,15 @@
// create data for bodytext role
QString dataText;
- dataText.append("Size: "); // TODO: use logical str name
- dataText.append(estimatedMsgSizeStr);
+ dataText.append(mMsgStoreHandler->NotificationMsgSize());
dataText.append(QChar::LineSeparator);
- dataText.append("Class: "); // TODO: use logical str name
- dataText.append(classInfoStr);
+ dataText.append(mMsgStoreHandler->NotificationClass());
dataText.append(QChar::LineSeparator);
- dataText.append("Expiry date: "); //TODO: use logical str name
- dataText.append(expiryTimeStr);
+ dataText.append(mMsgStoreHandler->NotificationExpiryDate());
if(!statusStr.isEmpty())
{
dataText.append(QChar::LineSeparator);
dataText.append(statusStr);
- dataText.append(QChar::LineSeparator); //Temp fix to be removed
}
// set fetched data to roles
@@ -718,40 +719,36 @@
//---------------------------------------------------------------
void ConversationsModel::handleBlueToothMessages(QStandardItem& item,
const CCsConversationEntry& entry)
-{
- //TODO, needs to be revisited again, once BT team provides the solution for
- //BT received as Biomsg issue.
- QString description = XQConversions::s60DescToQString(*(entry.Description()));
-
- if (description.contains(".vcf") || description.contains(".ics")) // "vCard"
{
- //message sub-type
- item.setData(ConvergedMessage::VCard, MessageSubType);
+ int msgSubType = ConversationsEngineUtility::messageSubType(
+ entry.GetType());
+
+ if (msgSubType == ConvergedMessage::VCard)
+ {
+ handleVCard(item, entry.EntryId());
+ }
+ else
+ {
+ QString description = XQConversions::s60DescToQString(
+ *(entry.Description()));
- //parse vcf file to get the details
- QString displayName = MsgContactHandler::getVCardDisplayName(
- description);
- item.setData(displayName, BodyText);
- }
- else
- {
- if (description.contains(".vcs")) // "vCalendar"
- {
+ if (msgSubType == ConvergedMessage::VCal) // "vCalendar"
+ {
//message sub-type
item.setData(ConvergedMessage::VCal, MessageSubType);
- }
+ }
else
- {
+ {
//message sub-type
item.setData(ConvergedMessage::None, MessageSubType);
- }
+ }
//for BT messages we show filenames for all other (except vcard) messages
//get filename and set as body
QFileInfo fileinfo(description);
QString filename = fileinfo.fileName();
item.setData(filename, BodyText);
+ }
}
-}
//---------------------------------------------------------------
// ConversationsModel::handleBioMessages
@@ -759,30 +756,16 @@
//---------------------------------------------------------------
void ConversationsModel::handleBioMessages(QStandardItem& item, const CCsConversationEntry& entry)
{
- iBioMsgPlugin->setMessageId(entry.EntryId());
int msgSubType = ConversationsEngineUtility::messageSubType(entry.GetType());
- if (ConvergedMessage::VCard == msgSubType) {
- if (iBioMsgPlugin->attachmentCount() > 0) {
- UniMessageInfoList attList = iBioMsgPlugin->attachmentList();
- QString attachmentPath = attList[0]->path();
-
- //get display-name and set as bodytext
- QString displayName =
- MsgContactHandler::getVCardDisplayName(
- attachmentPath);
- item.setData(displayName, BodyText);
- item.setData(attachmentPath, Attachments);
-
- // clear attachement list : its allocated at data model
- while (!attList.isEmpty()) {
- delete attList.takeFirst();
- }
+ if (ConvergedMessage::VCard == msgSubType)
+ {
+ handleVCard(item, entry.EntryId());
}
- }
else if (ConvergedMessage::VCal == msgSubType) {
//not supported
}
else if (ConvergedMessage::RingingTone == msgSubType) {
+ iBioMsgPlugin->setMessageId(entry.EntryId());
if (iBioMsgPlugin->attachmentCount() > 0) {
UniMessageInfoList attList = iBioMsgPlugin->attachmentList();
QString attachmentPath = attList[0]->path();
@@ -963,6 +946,116 @@
}
//---------------------------------------------------------------
+// ConversationsModel::handleVCard()
+// @see header
+//---------------------------------------------------------------
+void ConversationsModel::handleVCard(QStandardItem& item, int msgId)
+ {
+ //sql query to get vcard-path from DB
+ bool vCardParsed = false;
+
+ if (iSqlDbOpen)
+ {
+ RSqlStatement sqlSelectVcardStmt;
+ TInt err = sqlSelectVcardStmt.Prepare(iSqlDb, KSelectVCardStmt);
+
+ QCRITICAL_WRITE_FORMAT("Error from Prepare()", err)
+
+ if (err == KErrNone)
+ {
+ //msg_id
+ TInt msgIdIndex = sqlSelectVcardStmt.ParameterIndex(
+ _L(":message_id"));
+ sqlSelectVcardStmt.BindInt(msgIdIndex, msgId);
+ // state
+ TInt msgProcessingStateIndex = sqlSelectVcardStmt.ColumnIndex(
+ _L("msg_processingstate"));
+
+ // get vacrd-path from DB
+ err = sqlSelectVcardStmt.Next();
+ QCRITICAL_WRITE_FORMAT("Error from Next()", err)
+
+ if (err == KSqlAtRow)
+ {
+ int msgProcessingState = 0;
+ msgProcessingState = sqlSelectVcardStmt.ColumnInt(
+ msgProcessingStateIndex);
+ if (msgProcessingState == EPreviewMsgProcessed)
+ {
+ //path-index
+ TInt previewPathIndex = sqlSelectVcardStmt.ColumnIndex(
+ _L("preview_path"));
+
+ //Get vcard-path data from path-index
+ RSqlColumnReadStream stream;
+ err = stream.ColumnBinary(sqlSelectVcardStmt,
+ previewPathIndex);
+
+ QCRITICAL_WRITE_FORMAT("Error from ColumnBinary()", err)
+
+ if (err == KErrNone)
+ {
+ RBuf vCardPathBuffer;
+ if (vCardPathBuffer.Create(
+ sqlSelectVcardStmt.ColumnSize(
+ previewPathIndex)) == KErrNone)
+ {
+ sqlSelectVcardStmt.ColumnText(
+ previewPathIndex,
+ vCardPathBuffer);
+
+ //set inside attachments
+ QString attachmentPath(
+ XQConversions::s60DescToQString(
+ vCardPathBuffer));
+ item.setData(attachmentPath, Attachments);
+
+ //get display-name and set as bodytext
+ QString displayName =
+ MsgContactHandler::getVCardDisplayName(
+ attachmentPath);
+ item.setData(displayName, BodyText);
+
+ vCardPathBuffer.Close();
+ vCardParsed = true;
+
+ QCRITICAL_WRITE("vcard parsing complete.")
+ }
+ }
+ //close stream
+ stream.Close();
+ }
+ }
+ }
+ sqlSelectVcardStmt.Close();
+ }
+
+ // fallback, if not parsed in DB, parse from store
+ if (!vCardParsed)
+ {
+ iBioMsgPlugin->setMessageId(msgId);
+
+ if (iBioMsgPlugin->attachmentCount() > 0)
+ {
+ UniMessageInfoList attList = iBioMsgPlugin->attachmentList();
+ QString attachmentPath = attList[0]->path();
+
+ //get display-name and set as bodytext
+ QString displayName = MsgContactHandler::getVCardDisplayName(
+ attachmentPath);
+ item.setData(displayName, BodyText);
+ item.setData(attachmentPath, Attachments);
+
+ // clear attachement list : its allocated at data model
+ while (!attList.isEmpty())
+ {
+ delete attList.takeFirst();
+ }
+ }
+ }
+ }
+
+//---------------------------------------------------------------
// ConversationsModel::clearModel()
// @see header
//---------------------------------------------------------------
@@ -972,6 +1065,10 @@
previewIconCache.clear();
}
+//---------------------------------------------------------------
+// ConversationsModel::emitConversationViewEmpty()
+// @see header
+//---------------------------------------------------------------
void ConversationsModel:: emitConversationViewEmpty()
{
emit conversationViewEmpty();
--- a/messagingapp/msgui/appengine/src/conversationssummarymodel.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationssummarymodel.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -305,29 +305,44 @@
void ConversationsSummaryModel::handleBlueToothMessages(QStandardItem& item,
const CCsConversationEntry& entry)
{
- //TODO, needs to be revisited again, once BT team provides the solution for
- //BT received as Biomsg issue.
- QString description = XQConversions::s60DescToQString(*(entry.Description()));
-
- if (description.contains(".vcf") || description.contains(".ics")) // "vCard"
+ int msgSubType = ConversationsEngineUtility::messageSubType(entry.GetType());
+ if (msgSubType == ConvergedMessage::VCard)
{
- //message sub-type
- item.setData(ConvergedMessage::VCard, MessageSubType);
+ UniDataModelLoader* pluginLoader = new UniDataModelLoader;
+ UniDataModelPluginInterface* bioMsgPlugin = pluginLoader->getDataModelPlugin(
+ ConvergedMessage::BioMsg);
+ bioMsgPlugin->setMessageId(entry.EntryId());
+
+ if (bioMsgPlugin->attachmentCount() > 0)
+ {
+ UniMessageInfoList attList = bioMsgPlugin->attachmentList();
+ QString attachmentPath = attList[0]->path();
- //parse vcf file to get the details
- QString displayName = MsgContactHandler::getVCardDisplayName(
- description);
- item.setData(displayName, BodyText);
+ //get display-name and set as bodytext
+ QString displayName = MsgContactHandler::getVCardDisplayName(attachmentPath);
+ item.setData(displayName, BodyText);
+
+ // clear attachement list : its allocated at data model
+ while (!attList.isEmpty())
+ {
+ delete attList.takeFirst();
+ }
+
+ }
+ delete pluginLoader;
}
+
else
{
- if (description.contains(".vcs")) // "vCalendar"
+ QString description = XQConversions::s60DescToQString(*(entry.Description()));
+
+ if (msgSubType == ConvergedMessage::VCal) // "vCalendar"
{
//message sub-type
item.setData(ConvergedMessage::VCal, MessageSubType);
}
- else
- {
+ else
+ {
//message sub-type
item.setData(ConvergedMessage::None, MessageSubType);
}
--- a/messagingapp/msgui/appengine/src/draftsmodel.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/src/draftsmodel.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -24,14 +24,18 @@
#include <ccsconversationentry.h>
#include <msvstd.h>
#include <QDateTime>
+#include <HbExtendedLocale>
#include <hbicon.h>
#include <xqconversions.h>
//CONSTANTS
-const QString DATE_FORMAT("dd/MM"); //Date format.
-const QString TIME_FORMAT("hh:mm"); //Time format.
+// @see hbi18ndef.h
+static const char DATE_FORMAT[] = r_qtn_date_short_with_zero;
+static const char TIME_FORMAT[] = r_qtn_time_usual_with_zero;
//priority icons
const QString MSG_HIGH_PRIORITY_ICON("qtg_small_priority_high");
const QString MSG_LOW_PRIORITY_ICON("qtg_small_priority_low");
+// Localization
+#define LOC_NO_RECIPIENTS hbTrId("txt_messaging_list_no_recipients")
//---------------------------------------------------------------
// DraftsModel::DraftsModel
@@ -65,19 +69,19 @@
//timestamp conversion
QDateTime dateTime;
dateTime.setTime_t(item->data(TimeStamp).toUInt());
+
+ HbExtendedLocale locale = HbExtendedLocale::system();
QString dateString;
- if (dateTime.date() == QDateTime::currentDateTime().date())
- {
- dateString = dateTime.toString(TIME_FORMAT);
+ if (dateTime.date() == QDateTime::currentDateTime().date()) {
+ dateString = locale.format(dateTime.time(), TIME_FORMAT);
}
- else
- {
- dateString = dateTime.toString(DATE_FORMAT);
+ else {
+ dateString = locale.format(dateTime.date(), DATE_FORMAT);
}
//display name
QString contactName = item->data(DisplayName).toString();
if (contactName.isEmpty()) {
- contactName = tr("(no recipient)");
+ contactName = LOC_NO_RECIPIENTS;
}
//description
QString description = item->data(Subject).toString();
--- a/messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationnotifier.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationnotifier.h Wed Aug 18 09:45:25 2010 +0300
@@ -51,7 +51,7 @@
void RemoveCachingStatusNotifier();
- void SendListResultUpdate(RPointerArray<CCsConversationEntry>& aConversationEntryList);
+ void SendListResultUpdate(RPointerArray<CCsConversationEntry>& aConversationEntryList,TInt& aTotalCount);
void UpdateConversationEntryModify(CCsConversationEntry& aConversationEntry);
--- a/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testccsrequesthandler.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testccsrequesthandler.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -330,7 +330,9 @@
// convresation view.
// -----------------------------------------------------------------------------
EXPORT_C void CCSRequestHandler::GetConversationsL(
- CCsClientConversation* aClientConversation)
+ CCsClientConversation* aClientConversation,
+ TInt /*aKnownIndex*/,
+ TInt /*aPageSize*/)
{
// check if the aclientconversation is null then return
if ( !aClientConversation)
@@ -492,7 +494,9 @@
// -----------------------------------------------------------------------------
// CCSRequestHandler::GetMessagingHistoryL()
// -----------------------------------------------------------------------------
-EXPORT_C void CCSRequestHandler::GetMessagingHistoryL(TInt /*aContactId*/)
+EXPORT_C void CCSRequestHandler::GetMessagingHistoryL(TInt /*aContactId*/,
+ TInt /*aKnownIndex*/,
+ TInt /*aPageSize*/)
{
}
--- a/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationenginestub.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationenginestub.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -225,8 +225,9 @@
void TestConversationEngineStub::UpdateConversationList()
{
TInt error;
- TRAP(error, PrepareConversationListL(iConversationID, 5, iUnReadCount));
- iNotifier->SendListResultUpdate(iConversationEntryList);
+ TInt totalCount = 5;
+ TRAP(error, PrepareConversationListL(iConversationID, totalCount, iUnReadCount));
+ iNotifier->SendListResultUpdate(iConversationEntryList,totalCount);
}
void TestConversationEngineStub::UpdateConvEntry(TInt aConversationId)
--- a/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationnotifier.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationnotifier.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -79,12 +79,13 @@
void TestConversationNotifier
::SendListResultUpdate(RPointerArray<CCsConversationEntry>&
- aConversationEntryList)
+ aConversationEntryList,
+ TInt& aTotalCount)
{
// Pass the results to the observer
if ( iResultsObserver )
{
- iResultsObserver->Conversations(aConversationEntryList);
+ iResultsObserver->Conversations(aConversationEntryList,aTotalCount);
}
}
--- a/messagingapp/msgui/appengine/tsrc/testconversationengine/testconversationengine.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/testconversationengine.pro Wed Aug 18 09:45:25 2010 +0300
@@ -32,6 +32,7 @@
INCLUDEPATH += ../../../../msgappfw/client/inc
INCLUDEPATH += ../../../../smartmessaging/ringbc/inc
INCLUDEPATH += ../../../../msgutils/unieditorutils/editorgenutils/inc
+INCLUDEPATH += ../../../msguiutils/inc
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
@@ -100,4 +101,6 @@
-lestor \
-lFeatMgr \
-lfbscli \
- -lringbc
+ -lringbc \
+ -lmsguiutils \
+ -lcsserverclientapi
--- a/messagingapp/msgui/bwins/appengineu.def Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/bwins/appengineu.def Wed Aug 18 09:45:25 2010 +0300
@@ -1,45 +1,47 @@
EXPORTS
?fetchMoreConversations@ConversationsEngine@@QAEXXZ @ 1 NONAME ; void ConversationsEngine::fetchMoreConversations(void)
- ?disableRegisterationForCVEvents@ConversationsEngine@@QAEXXZ @ 2 NONAME ; void ConversationsEngine::disableRegisterationForCVEvents(void)
- ?getConversationIdFromAddress@ConversationsEngine@@QAE_JVQString@@@Z @ 3 NONAME ; long long ConversationsEngine::getConversationIdFromAddress(class QString)
- ?deleteAllDraftMessages@ConversationsEngine@@QAEXXZ @ 4 NONAME ; void ConversationsEngine::deleteAllDraftMessages(void)
- ?metaObject@ConversationsEngine@@UBEPBUQMetaObject@@XZ @ 5 NONAME ; struct QMetaObject const * ConversationsEngine::metaObject(void) const
- ??1ConversationsEngine@@UAE@XZ @ 6 NONAME ; ConversationsEngine::~ConversationsEngine(void)
- ?markAsReadAndGetType@ConversationsEngine@@QAEXHAAH0@Z @ 7 NONAME ; void ConversationsEngine::markAsReadAndGetType(int, int &, int &)
- ?deleteConversations@ConversationsEngine@@QAE_N_J@Z @ 8 NONAME ; bool ConversationsEngine::deleteConversations(long long)
- ?trUtf8@ConversationsEngine@@SA?AVQString@@PBD0@Z @ 9 NONAME ; class QString ConversationsEngine::trUtf8(char const *, char const *)
- ?qt_metacast@ConversationsEngine@@UAEPAXPBD@Z @ 10 NONAME ; void * ConversationsEngine::qt_metacast(char const *)
- ?emitConversationListModelPopulated@ConversationsEngine@@QAEXXZ @ 11 NONAME ; void ConversationsEngine::emitConversationListModelPopulated(void)
- ?getDraftsModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 12 NONAME ; class QStandardItemModel * ConversationsEngine::getDraftsModel(void)
- ?emitOpenConversationViewIdUpdate@ConversationsEngine@@QAEXH@Z @ 13 NONAME ; void ConversationsEngine::emitOpenConversationViewIdUpdate(int)
- ?trUtf8@ConversationsEngine@@SA?AVQString@@PBD0H@Z @ 14 NONAME ; class QString ConversationsEngine::trUtf8(char const *, char const *, int)
- ?tr@ConversationsEngine@@SA?AVQString@@PBD0H@Z @ 15 NONAME ; class QString ConversationsEngine::tr(char const *, char const *, int)
- ?conversationModelUpdated@ConversationsEngine@@IAEXXZ @ 16 NONAME ; void ConversationsEngine::conversationModelUpdated(void)
- ?getStaticMetaObject@ConversationsEngine@@SAABUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const & ConversationsEngine::getStaticMetaObject(void)
- ?downloadOperationSupported@ConversationsEngine@@QAE_NH@Z @ 18 NONAME ; bool ConversationsEngine::downloadOperationSupported(int)
- ?markMessagesRead@ConversationsEngine@@QAE_NAAV?$QList@H@@@Z @ 19 NONAME ; bool ConversationsEngine::markMessagesRead(class QList<int> &)
- ?conversationModelPopulated@ConversationsEngine@@IAEXXZ @ 20 NONAME ; void ConversationsEngine::conversationModelPopulated(void)
- ?downloadMessage@ConversationsEngine@@QAEHH@Z @ 21 NONAME ; int ConversationsEngine::downloadMessage(int)
- ?getConversationsModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 22 NONAME ; class QStandardItemModel * ConversationsEngine::getConversationsModel(void)
- ?markConversationRead@ConversationsEngine@@QAE_N_J@Z @ 23 NONAME ; bool ConversationsEngine::markConversationRead(long long)
- ?getCurrentConversationId@ConversationsEngine@@QAE_JXZ @ 24 NONAME ; long long ConversationsEngine::getCurrentConversationId(void)
- ??_EConversationsEngine@@UAE@I@Z @ 25 NONAME ; ConversationsEngine::~ConversationsEngine(unsigned int)
- ?getConversationsSummaryModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 26 NONAME ; class QStandardItemModel * ConversationsEngine::getConversationsSummaryModel(void)
- ?conversationListModelPopulated@ConversationsEngine@@IAEXXZ @ 27 NONAME ; void ConversationsEngine::conversationListModelPopulated(void)
- ??0ConversationsEngine@@AAE@PAVQObject@@@Z @ 28 NONAME ; ConversationsEngine::ConversationsEngine(class QObject *)
- ?getContactDetails@ConversationsEngine@@QAEX_JAAVQString@@1@Z @ 29 NONAME ; void ConversationsEngine::getContactDetails(long long, class QString &, class QString &)
- ?instance@ConversationsEngine@@SAPAV1@XZ @ 30 NONAME ; class ConversationsEngine * ConversationsEngine::instance(void)
- ?tr@ConversationsEngine@@SA?AVQString@@PBD0@Z @ 31 NONAME ; class QString ConversationsEngine::tr(char const *, char const *)
- ?resendMessage@ConversationsEngine@@QAE_NH@Z @ 32 NONAME ; bool ConversationsEngine::resendMessage(int)
- ?emitConversationModelUpdated@ConversationsEngine@@QAEXXZ @ 33 NONAME ; void ConversationsEngine::emitConversationModelUpdated(void)
- ?getConversations@ConversationsEngine@@QAE_N_J@Z @ 34 NONAME ; bool ConversationsEngine::getConversations(long long)
- ?clearConversations@ConversationsEngine@@QAE_NXZ @ 35 NONAME ; bool ConversationsEngine::clearConversations(void)
- ?getDBHandle@ConversationsEngine@@QAEAAVRSqlDatabase@@AAH@Z @ 36 NONAME ; class RSqlDatabase & ConversationsEngine::getDBHandle(int &)
- ?getMsgSubType@ConversationsEngine@@QAEHH@Z @ 37 NONAME ; int ConversationsEngine::getMsgSubType(int)
- ?getConversationIdFromContactId@ConversationsEngine@@QAE_JH@Z @ 38 NONAME ; long long ConversationsEngine::getConversationIdFromContactId(int)
- ?staticMetaObject@ConversationsEngine@@2UQMetaObject@@B @ 39 NONAME ; struct QMetaObject const ConversationsEngine::staticMetaObject
- ?deleteMessages@ConversationsEngine@@QAEXAAV?$QList@H@@@Z @ 40 NONAME ; void ConversationsEngine::deleteMessages(class QList<int> &)
- ?emitConversationModelPopulated@ConversationsEngine@@QAEXXZ @ 41 NONAME ; void ConversationsEngine::emitConversationModelPopulated(void)
- ?conversationViewEmpty@ConversationsEngine@@IAEXXZ @ 42 NONAME ; void ConversationsEngine::conversationViewEmpty(void)
- ?qt_metacall@ConversationsEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 43 NONAME ; int ConversationsEngine::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?emitConversationListModelEntryDeleted@ConversationsEngine@@QAEXH@Z @ 2 NONAME ; void ConversationsEngine::emitConversationListModelEntryDeleted(int)
+ ?disableRegisterationForCVEvents@ConversationsEngine@@QAEXXZ @ 3 NONAME ; void ConversationsEngine::disableRegisterationForCVEvents(void)
+ ?getConversationIdFromAddress@ConversationsEngine@@QAE_JVQString@@@Z @ 4 NONAME ; long long ConversationsEngine::getConversationIdFromAddress(class QString)
+ ?deleteAllDraftMessages@ConversationsEngine@@QAEXXZ @ 5 NONAME ; void ConversationsEngine::deleteAllDraftMessages(void)
+ ?metaObject@ConversationsEngine@@UBEPBUQMetaObject@@XZ @ 6 NONAME ; struct QMetaObject const * ConversationsEngine::metaObject(void) const
+ ??1ConversationsEngine@@UAE@XZ @ 7 NONAME ; ConversationsEngine::~ConversationsEngine(void)
+ ?markAsReadAndGetType@ConversationsEngine@@QAEXHAAH0@Z @ 8 NONAME ; void ConversationsEngine::markAsReadAndGetType(int, int &, int &)
+ ?deleteConversations@ConversationsEngine@@QAE_N_J@Z @ 9 NONAME ; bool ConversationsEngine::deleteConversations(long long)
+ ?trUtf8@ConversationsEngine@@SA?AVQString@@PBD0@Z @ 10 NONAME ; class QString ConversationsEngine::trUtf8(char const *, char const *)
+ ?qt_metacast@ConversationsEngine@@UAEPAXPBD@Z @ 11 NONAME ; void * ConversationsEngine::qt_metacast(char const *)
+ ?emitConversationListModelPopulated@ConversationsEngine@@QAEXXZ @ 12 NONAME ; void ConversationsEngine::emitConversationListModelPopulated(void)
+ ?getDraftsModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 13 NONAME ; class QStandardItemModel * ConversationsEngine::getDraftsModel(void)
+ ?emitOpenConversationViewIdUpdate@ConversationsEngine@@QAEXH@Z @ 14 NONAME ; void ConversationsEngine::emitOpenConversationViewIdUpdate(int)
+ ?trUtf8@ConversationsEngine@@SA?AVQString@@PBD0H@Z @ 15 NONAME ; class QString ConversationsEngine::trUtf8(char const *, char const *, int)
+ ?tr@ConversationsEngine@@SA?AVQString@@PBD0H@Z @ 16 NONAME ; class QString ConversationsEngine::tr(char const *, char const *, int)
+ ?conversationModelUpdated@ConversationsEngine@@IAEXXZ @ 17 NONAME ; void ConversationsEngine::conversationModelUpdated(void)
+ ?getStaticMetaObject@ConversationsEngine@@SAABUQMetaObject@@XZ @ 18 NONAME ; struct QMetaObject const & ConversationsEngine::getStaticMetaObject(void)
+ ?downloadOperationSupported@ConversationsEngine@@QAE_NH@Z @ 19 NONAME ; bool ConversationsEngine::downloadOperationSupported(int)
+ ?markMessagesRead@ConversationsEngine@@QAE_NAAV?$QList@H@@@Z @ 20 NONAME ; bool ConversationsEngine::markMessagesRead(class QList<int> &)
+ ?conversationModelPopulated@ConversationsEngine@@IAEXXZ @ 21 NONAME ; void ConversationsEngine::conversationModelPopulated(void)
+ ?downloadMessage@ConversationsEngine@@QAEHH@Z @ 22 NONAME ; int ConversationsEngine::downloadMessage(int)
+ ?getConversationsModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 23 NONAME ; class QStandardItemModel * ConversationsEngine::getConversationsModel(void)
+ ?markConversationRead@ConversationsEngine@@QAE_N_J@Z @ 24 NONAME ; bool ConversationsEngine::markConversationRead(long long)
+ ?getCurrentConversationId@ConversationsEngine@@QAE_JXZ @ 25 NONAME ; long long ConversationsEngine::getCurrentConversationId(void)
+ ??_EConversationsEngine@@UAE@I@Z @ 26 NONAME ; ConversationsEngine::~ConversationsEngine(unsigned int)
+ ?conversationListEntryDeleted@ConversationsEngine@@IAEXH@Z @ 27 NONAME ; void ConversationsEngine::conversationListEntryDeleted(int)
+ ?getConversationsSummaryModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 28 NONAME ; class QStandardItemModel * ConversationsEngine::getConversationsSummaryModel(void)
+ ?conversationListModelPopulated@ConversationsEngine@@IAEXXZ @ 29 NONAME ; void ConversationsEngine::conversationListModelPopulated(void)
+ ??0ConversationsEngine@@AAE@PAVQObject@@@Z @ 30 NONAME ; ConversationsEngine::ConversationsEngine(class QObject *)
+ ?instance@ConversationsEngine@@SAPAV1@XZ @ 31 NONAME ; class ConversationsEngine * ConversationsEngine::instance(void)
+ ?getContactDetails@ConversationsEngine@@QAEX_JAAVQString@@1@Z @ 32 NONAME ; void ConversationsEngine::getContactDetails(long long, class QString &, class QString &)
+ ?tr@ConversationsEngine@@SA?AVQString@@PBD0@Z @ 33 NONAME ; class QString ConversationsEngine::tr(char const *, char const *)
+ ?resendMessage@ConversationsEngine@@QAE_NH@Z @ 34 NONAME ; bool ConversationsEngine::resendMessage(int)
+ ?emitConversationModelUpdated@ConversationsEngine@@QAEXXZ @ 35 NONAME ; void ConversationsEngine::emitConversationModelUpdated(void)
+ ?getConversations@ConversationsEngine@@QAE_N_J@Z @ 36 NONAME ; bool ConversationsEngine::getConversations(long long)
+ ?clearConversations@ConversationsEngine@@QAE_NXZ @ 37 NONAME ; bool ConversationsEngine::clearConversations(void)
+ ?getDBHandle@ConversationsEngine@@QAEAAVRSqlDatabase@@AAH@Z @ 38 NONAME ; class RSqlDatabase & ConversationsEngine::getDBHandle(int &)
+ ?getMsgSubType@ConversationsEngine@@QAEHH@Z @ 39 NONAME ; int ConversationsEngine::getMsgSubType(int)
+ ?getConversationIdFromContactId@ConversationsEngine@@QAE_JH@Z @ 40 NONAME ; long long ConversationsEngine::getConversationIdFromContactId(int)
+ ?staticMetaObject@ConversationsEngine@@2UQMetaObject@@B @ 41 NONAME ; struct QMetaObject const ConversationsEngine::staticMetaObject
+ ?deleteMessages@ConversationsEngine@@QAEXAAV?$QList@H@@@Z @ 42 NONAME ; void ConversationsEngine::deleteMessages(class QList<int> &)
+ ?emitConversationModelPopulated@ConversationsEngine@@QAEXXZ @ 43 NONAME ; void ConversationsEngine::emitConversationModelPopulated(void)
+ ?conversationViewEmpty@ConversationsEngine@@IAEXXZ @ 44 NONAME ; void ConversationsEngine::conversationViewEmpty(void)
+ ?qt_metacall@ConversationsEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 45 NONAME ; int ConversationsEngine::qt_metacall(enum QMetaObject::Call, int, void * *)
--- a/messagingapp/msgui/bwins/unifiededitoru.def Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/bwins/unifiededitoru.def Wed Aug 18 09:45:25 2010 +0300
@@ -2,14 +2,14 @@
?fetchAudio@MsgUnifiedEditorView@@AAEXXZ @ 1 NONAME ; void MsgUnifiedEditorView::fetchAudio(void)
??0CUniImageProcessor@@QAE@PAVMUniImageProcessorCallback@@@Z @ 2 NONAME ; CUniImageProcessor::CUniImageProcessor(class MUniImageProcessorCallback *)
?changePriority@MsgUnifiedEditorView@@AAEXXZ @ 3 NONAME ; void MsgUnifiedEditorView::changePriority(void)
- ?forwardMessage@MsgUnifiedEditorView@@AAEXAAVConvergedMessageId@@W4MessageType@ConvergedMessage@@@Z @ 4 NONAME ; void MsgUnifiedEditorView::forwardMessage(class ConvergedMessageId &, enum ConvergedMessage::MessageType)
- ?updateOtherRecipientCount@MsgUnifiedEditorView@@AAEX_N@Z @ 5 NONAME ; void MsgUnifiedEditorView::updateOtherRecipientCount(bool)
- ?qt_metacall@MsgUnifiedEditorView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 6 NONAME ; int MsgUnifiedEditorView::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?fetchImages@MsgUnifiedEditorView@@AAEXXZ @ 7 NONAME ; void MsgUnifiedEditorView::fetchImages(void)
- ?packMessage@MsgUnifiedEditorView@@AAEXAAVConvergedMessage@@_N@Z @ 8 NONAME ; void MsgUnifiedEditorView::packMessage(class ConvergedMessage &, bool)
- ?handleViewExtnActivated@MsgUnifiedEditorView@@AAEXPAVHbListWidgetItem@@@Z @ 9 NONAME ; void MsgUnifiedEditorView::handleViewExtnActivated(class HbListWidgetItem *)
- ?addAttachment@MsgUnifiedEditorView@@AAEHABVQString@@@Z @ 10 NONAME ; int MsgUnifiedEditorView::addAttachment(class QString const &)
- ?doDelayedConstruction@MsgUnifiedEditorView@@AAEXXZ @ 11 NONAME ; void MsgUnifiedEditorView::doDelayedConstruction(void)
+ ?updateOtherRecipientCount@MsgUnifiedEditorView@@AAEX_N@Z @ 4 NONAME ; void MsgUnifiedEditorView::updateOtherRecipientCount(bool)
+ ?qt_metacall@MsgUnifiedEditorView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 5 NONAME ; int MsgUnifiedEditorView::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?fetchImages@MsgUnifiedEditorView@@AAEXXZ @ 6 NONAME ; void MsgUnifiedEditorView::fetchImages(void)
+ ?packMessage@MsgUnifiedEditorView@@AAEXAAVConvergedMessage@@_N@Z @ 7 NONAME ; void MsgUnifiedEditorView::packMessage(class ConvergedMessage &, bool)
+ ?handleViewExtnActivated@MsgUnifiedEditorView@@AAEXPAVHbListWidgetItem@@@Z @ 8 NONAME ; void MsgUnifiedEditorView::handleViewExtnActivated(class HbListWidgetItem *)
+ ?addAttachment@MsgUnifiedEditorView@@AAEHABVQString@@@Z @ 9 NONAME ; int MsgUnifiedEditorView::addAttachment(class QString const &)
+ ?doDelayedConstruction@MsgUnifiedEditorView@@AAEXXZ @ 10 NONAME ; void MsgUnifiedEditorView::doDelayedConstruction(void)
+ ?fetchMessageFromStore@MsgUnifiedEditorView@@AAEXAAVConvergedMessageId@@W4MessageType@ConvergedMessage@@H@Z @ 11 NONAME ; void MsgUnifiedEditorView::fetchMessageFromStore(class ConvergedMessageId &, enum ConvergedMessage::MessageType, int)
?onContentChanged@MsgUnifiedEditorView@@AAEXXZ @ 12 NONAME ; void MsgUnifiedEditorView::onContentChanged(void)
?staticMetaObject@MsgUnifiedEditorView@@2UQMetaObject@@B @ 13 NONAME ; struct QMetaObject const MsgUnifiedEditorView::staticMetaObject
?activateInputBlocker@MsgUnifiedEditorView@@AAEXXZ @ 14 NONAME ; void MsgUnifiedEditorView::activateInputBlocker(void)
--- a/messagingapp/msgui/bwins/unifiedvieweru.def Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/bwins/unifiedvieweru.def Wed Aug 18 09:45:25 2010 +0300
@@ -1,22 +1,26 @@
EXPORTS
?trUtf8@UnifiedViewer@@SA?AVQString@@PBD0@Z @ 1 NONAME ; class QString UnifiedViewer::trUtf8(char const *, char const *)
?populateContent@UnifiedViewer@@QAEXH_NH@Z @ 2 NONAME ; void UnifiedViewer::populateContent(int, bool, int)
- ?handleDeleteAction@UnifiedViewer@@QAEXXZ @ 3 NONAME ; void UnifiedViewer::handleDeleteAction(void)
- ?metaObject@UnifiedViewer@@UBEPBUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const * UnifiedViewer::metaObject(void) const
- ?sendMessage@UnifiedViewer@@AAEXABVQString@@0@Z @ 5 NONAME ; void UnifiedViewer::sendMessage(class QString const &, class QString const &)
- ?resizeEvent@UnifiedViewer@@MAEXPAVQGraphicsSceneResizeEvent@@@Z @ 6 NONAME ; void UnifiedViewer::resizeEvent(class QGraphicsSceneResizeEvent *)
- ?handleFwdAction@UnifiedViewer@@QAEXXZ @ 7 NONAME ; void UnifiedViewer::handleFwdAction(void)
- ?qt_metacast@UnifiedViewer@@UAEPAXPBD@Z @ 8 NONAME ; void * UnifiedViewer::qt_metacast(char const *)
- ?createToolBar@UnifiedViewer@@AAEXXZ @ 9 NONAME ; void UnifiedViewer::createToolBar(void)
- ??1UnifiedViewer@@UAE@XZ @ 10 NONAME ; UnifiedViewer::~UnifiedViewer(void)
- ?onDialogDeleteMsg@UnifiedViewer@@AAEXPAVHbAction@@@Z @ 11 NONAME ; void UnifiedViewer::onDialogDeleteMsg(class HbAction *)
- ??_EUnifiedViewer@@UAE@I@Z @ 12 NONAME ; UnifiedViewer::~UnifiedViewer(unsigned int)
- ?qt_metacall@UnifiedViewer@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13 NONAME ; int UnifiedViewer::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?tr@UnifiedViewer@@SA?AVQString@@PBD0@Z @ 14 NONAME ; class QString UnifiedViewer::tr(char const *, char const *)
- ?getStaticMetaObject@UnifiedViewer@@SAABUQMetaObject@@XZ @ 15 NONAME ; struct QMetaObject const & UnifiedViewer::getStaticMetaObject(void)
- ??0UnifiedViewer@@QAE@HHPAVQGraphicsItem@@@Z @ 16 NONAME ; UnifiedViewer::UnifiedViewer(int, int, class QGraphicsItem *)
- ?staticMetaObject@UnifiedViewer@@2UQMetaObject@@B @ 17 NONAME ; struct QMetaObject const UnifiedViewer::staticMetaObject
- ?trUtf8@UnifiedViewer@@SA?AVQString@@PBD0H@Z @ 18 NONAME ; class QString UnifiedViewer::trUtf8(char const *, char const *, int)
- ?clearContent@UnifiedViewer@@QAEXXZ @ 19 NONAME ; void UnifiedViewer::clearContent(void)
- ?tr@UnifiedViewer@@SA?AVQString@@PBD0H@Z @ 20 NONAME ; class QString UnifiedViewer::tr(char const *, char const *, int)
+ ?handleReplyAction@UnifiedViewer@@AAEXXZ @ 3 NONAME ; void UnifiedViewer::handleReplyAction(void)
+ ?handleDeleteAction@UnifiedViewer@@QAEXXZ @ 4 NONAME ; void UnifiedViewer::handleDeleteAction(void)
+ ?metaObject@UnifiedViewer@@UBEPBUQMetaObject@@XZ @ 5 NONAME ; struct QMetaObject const * UnifiedViewer::metaObject(void) const
+ ?sendMessage@UnifiedViewer@@AAEXABVQString@@0@Z @ 6 NONAME ; void UnifiedViewer::sendMessage(class QString const &, class QString const &)
+ ?resizeEvent@UnifiedViewer@@MAEXPAVQGraphicsSceneResizeEvent@@@Z @ 7 NONAME ; void UnifiedViewer::resizeEvent(class QGraphicsSceneResizeEvent *)
+ ??0UnifiedViewer@@QAE@HPAVQGraphicsItem@@@Z @ 8 NONAME ; UnifiedViewer::UnifiedViewer(int, class QGraphicsItem *)
+ ?isForwardOk@UnifiedViewer@@AAE_NXZ @ 9 NONAME ; bool UnifiedViewer::isForwardOk(void)
+ ?handleFwdAction@UnifiedViewer@@QAEXXZ @ 10 NONAME ; void UnifiedViewer::handleFwdAction(void)
+ ?qt_metacast@UnifiedViewer@@UAEPAXPBD@Z @ 11 NONAME ; void * UnifiedViewer::qt_metacast(char const *)
+ ?onDialogDeleteMsg@UnifiedViewer@@AAEXH@Z @ 12 NONAME ; void UnifiedViewer::onDialogDeleteMsg(int)
+ ?createToolBar@UnifiedViewer@@AAEXXZ @ 13 NONAME ; void UnifiedViewer::createToolBar(void)
+ ??1UnifiedViewer@@UAE@XZ @ 14 NONAME ; UnifiedViewer::~UnifiedViewer(void)
+ ??_EUnifiedViewer@@UAE@I@Z @ 15 NONAME ; UnifiedViewer::~UnifiedViewer(unsigned int)
+ ?qt_metacall@UnifiedViewer@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 16 NONAME ; int UnifiedViewer::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?tr@UnifiedViewer@@SA?AVQString@@PBD0@Z @ 17 NONAME ; class QString UnifiedViewer::tr(char const *, char const *)
+ ?getStaticMetaObject@UnifiedViewer@@SAABUQMetaObject@@XZ @ 18 NONAME ; struct QMetaObject const & UnifiedViewer::getStaticMetaObject(void)
+ ?staticMetaObject@UnifiedViewer@@2UQMetaObject@@B @ 19 NONAME ; struct QMetaObject const UnifiedViewer::staticMetaObject
+ ?handleReplyAllAction@UnifiedViewer@@AAEXXZ @ 20 NONAME ; void UnifiedViewer::handleReplyAllAction(void)
+ ?trUtf8@UnifiedViewer@@SA?AVQString@@PBD0H@Z @ 21 NONAME ; class QString UnifiedViewer::trUtf8(char const *, char const *, int)
+ ?clearContent@UnifiedViewer@@QAEXXZ @ 22 NONAME ; void UnifiedViewer::clearContent(void)
+ ?launchEditor@UnifiedViewer@@AAEXW4UniEditorOperation@MsgBaseView@@@Z @ 23 NONAME ; void UnifiedViewer::launchEditor(enum MsgBaseView::UniEditorOperation)
+ ?tr@UnifiedViewer@@SA?AVQString@@PBD0H@Z @ 24 NONAME ; class QString UnifiedViewer::tr(char const *, char const *, int)
--- a/messagingapp/msgui/conversationview/conversationview.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/conversationview.pro Wed Aug 18 09:45:25 2010 +0300
@@ -104,5 +104,6 @@
-lthumbnailmanagerqt \
-lxqsettingsmanager \
-lxqutils \
- -lmsgaudiofetcher
+ -lmsgaudiofetcher \
+ -lmsgs
--- a/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h Wed Aug 18 09:45:25 2010 +0300
@@ -169,11 +169,6 @@
* Slot hit when the thumbnail is ready.
*/
void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error);
-
- /**
- * Ignore gesture events.
- */
- void ignoreSignals(bool yes);
/**
* Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
@@ -184,11 +179,6 @@
private:
/**
- * Bool variable on which gesture events are accepted/ignored.
- */
- bool mIgnoreEvents;
-
- /**
* Contact Number for the conversation
*/
QString mContactNumber;
--- a/messagingapp/msgui/conversationview/inc/msgconversationview.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgconversationview.h Wed Aug 18 09:45:25 2010 +0300
@@ -325,6 +325,18 @@
*/
void handleSmsCharLimitReached();
+ /**
+ * Hanldes saving of vcard.
+ */
+ void saveVCard();
+
+ /**
+ * Tells is mms is shared among conversations.
+ * @param messageId, message id.
+ * @return true is shared among conversations.
+ */
+ bool isSharedMessage(qint32 messageId);
+
signals:
/**
* Signal emitted to inform close the conversation view.
@@ -386,6 +398,16 @@
* @param msgId message id
*/
void handleProvisoningMsg(int msgId);
+
+ /**
+ * Handles short tap for vcard.
+ */
+ void handleShortTap();
+
+ /**
+ * helper method to show long/short tap context menu.
+ */
+ void showContextMenu(HbAbstractViewItem* viewItem,const QPointF& point, int placement);
private:
@@ -432,11 +454,6 @@
QModelIndex mVisibleIndex;
/**
- * Flag to check it vkb is open.
- */
- bool mVkbopened;
-
- /**
* Flag is set when model is populated.
* @see signal conversationModelPopulated()
*/
--- a/messagingapp/msgui/conversationview/inc/msgeditorwidget.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgeditorwidget.h Wed Aug 18 09:45:25 2010 +0300
@@ -165,10 +165,10 @@
*/
void init();
- /**
- * To update back ground.
- */
- void updateButtonBackground(const QString& bg);
+ /**
+ * To update back ground.
+ */
+ void updateButtonBackgroundAndColor(const QString& bg,const QString& iconColor);
private:
--- a/messagingapp/msgui/conversationview/inc/msgviewdefines.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgviewdefines.h Wed Aug 18 09:45:25 2010 +0300
@@ -21,6 +21,5 @@
const qreal CONTENT_MARGIN = 0.0; // Content margin for layout.
const qreal CONTENT_SPACING = 0.0; // Spacing for layout.
const qreal Z_VALUE = 3.0; // Z value for layout.
-const QString DATE_FORMAT("dd/MM"); // Date format.
-const QString TIME_FORMAT("hh:mm"); // Time format.
+
#endif // MSG_VIEW_DEFINES_H
--- a/messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.css Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.css Wed Aug 18 09:45:25 2010 +0300
@@ -44,9 +44,8 @@
MsgConversationWidget::bodyText
{
left:-var(hb-param-margin-gene-left);
- top:-var(hb-param-margin-gene-top);
+ top:-var(hb-param-margin-gene-middle-vertical);
right:1.0un;
- bottom:var(hb-param-margin-gene-middle-vertical);
text-height:var(hb-param-text-height-secondary);
font-variant:primary;
text-line-count-min:1;
@@ -68,13 +67,22 @@
left:-var(hb-param-margin-gene-middle-horizontal);
}
+
+MsgConversationWidget::headerItem
+{
+ top:-var(hb-param-margin-gene-top);
+ left:-var(hb-param-margin-gene-left);
+}
+
+MsgConversationWidget::headerItem:landscape
+{
+ left:-var(hb-param-margin-gene-middle-horizontal);
+}
+
/********************************** SUBJECT ***********************************/
MsgConversationWidget::subject
{
- left:-var(hb-param-margin-gene-left);
- top:-var(hb-param-margin-gene-top);
- bottom:var(hb-param-margin-gene-middle-vertical);
right:var(hb-param-margin-gene-middle-horizontal);
text-align:left;
text-height:var(hb-param-text-height-primary);
@@ -83,22 +91,6 @@
text-line-count-max:1;
}
-MsgConversationWidget[isMMS="false"]::subject
-{
- text-line-count-max:30;
- text-height:var(hb-param-text-height-secondary);
-}
-
-MsgConversationWidget[hasImage="true"]::subject:landscape
-{
- left:-var(hb-param-margin-gene-middle-horizontal);
-}
-
-MsgConversationWidget[hasImage="false"][hasAudio="true"]::subject:landscape
-{
- left:-var(hb-param-margin-gene-middle-horizontal);
-}
-
/******************************* ATTACHMENT ICON ******************************/
@@ -129,10 +121,18 @@
MsgConversationWidget::preview
{
left:-var(hb-param-margin-gene-left);
+ top:-var(hb-param-margin-gene-middle-vertical);
size-policy:fixed fixed;
aspect-ratio:ignore;
}
+MsgConversationWidget[hasImage="false"][hasAudio="true"]::preview
+{
+ zvalue:1;
+ pref-width:var(hb-param-graphic-size-primary-small);
+ pref-height:var(hb-param-graphic-size-primary-small);
+}
+
MsgConversationWidget::preview:landscape
{
left:-var(hb-param-margin-gene-left);
@@ -149,6 +149,7 @@
left:-var(hb-param-margin-gene-left);
right:1.0un;
bottom:var(hb-param-margin-gene-bottom);
+ top:-var(hb-param-margin-gene-middle-vertical);
text-align:left;
text-height:var(hb-param-text-height-tiny);
font-variant:primary;
@@ -172,6 +173,7 @@
{
zvalue:1;
left:-var(hb-param-margin-gene-middle-horizontal);
+ top:-var(hb-param-margin-gene-middle-vertical);
aspect-ratio:ignore;
size-policy:fixed fixed;
pref-width:var(hb-param-graphic-size-primary-small);
--- a/messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.widgetml Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.widgetml Wed Aug 18 09:45:25 2010 +0300
@@ -2,20 +2,29 @@
<layout name="layout-msg-portrait" type="mesh">
- <meshitem src="subject" srcEdge="TOP" dst="" dstEdge="TOP" />
- <meshitem src="subject" srcEdge="LEFT" dst="" dstEdge="LEFT" />
- <meshitem src="subject" srcEdge="RIGHT" dst="priority" dstEdge="LEFT" spacer="rightSpacer" />
+ <meshitem src="subject" srcEdge="TOP" dst="headerItem" dstEdge="TOP" />
+ <meshitem src="subject" srcEdge="LEFT" dst="headerItem" dstEdge="LEFT" />
+ <meshitem src="subject" srcEdge="RIGHT" dst="priority" dstEdge="LEFT"/>
+ <meshitem src="subject" srcEdge="BOTTOM" dst="headerItem" dstEdge="BOTTOM"/>
<meshitem src="priority" srcEdge="RIGHT" dst="attachment" dstEdge="LEFT" />
- <meshitem src="priority" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
+ <meshitem src="priority" srcEdge="CENTERV" dst="headerItem" dstEdge="CENTERV" />
+ <meshitem src="priority" srcEdge="TOP" dst="headerItem" dstEdge="TOP" spacer="topSpacer" />
+ <meshitem src="priority" srcEdge="BOTTOM" dst="headerItem" dstEdge="BOTTOM" spacer="bottomSpacer" />
+
+ <meshitem src="attachment" srcEdge="RIGHT" dst="headerItem" dstEdge="RIGHT" />
+ <meshitem src="attachment" srcEdge="CENTERV" dst="headerItem" dstEdge="CENTERV" />
+ <meshitem src="attachment" srcEdge="TOP" dst="headerItem" dstEdge="TOP" spacer="topSpacer"/>
+ <meshitem src="attachment" srcEdge="BOTTOM" dst="headerItem" dstEdge="BOTTOM" spacer="bottomSpacer" />
+
+ <meshitem src="headerItem" srcEdge="TOP" dst="" dstEdge="TOP" />
+ <meshitem src="headerItem" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+ <meshitem src="headerItem" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
- <meshitem src="attachment" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
- <meshitem src="attachment" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
-
- <meshitem src="preview" srcEdge="TOP" dst="subject" dstEdge="BOTTOM" />
+ <meshitem src="preview" srcEdge="TOP" dst="headerItem" dstEdge="BOTTOM" />
<meshitem src="preview" srcEdge="LEFT" dst="" dstEdge="LEFT" />
- <meshitem src="bodyText" srcEdge="TOP" dst="preview" dstEdge="BOTTOM" />
+ <meshitem src="bodyText" srcEdge="TOP" dst="preview" dstEdge="BOTTOM" />
<meshitem src="bodyText" srcEdge="LEFT" dst="" dstEdge="LEFT" />
<meshitem src="bodyText" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
@@ -33,7 +42,7 @@
<meshitem src="bubble" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
<meshitem src="bubble" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
- <meshitem src="playIcon" srcEdge="TOP" dst="subject" dstEdge="BOTTOM"/>
+ <meshitem src="playIcon" srcEdge="TOP" dst="headerItem" dstEdge="BOTTOM"/>
<meshitem src="playIcon" srcEdge="LEFT" dst="preview" dstEdge="RIGHT" />
</layout>
@@ -42,25 +51,39 @@
<meshitem src="preview" srcEdge="TOP" dst="" dstEdge="TOP" />
<meshitem src="preview" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+ <meshitem src="preview" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" spacer="bottomSpacer"/>
+
+ <meshitem src="playIcon" srcEdge="TOP" dst="" dstEdge="TOP" />
+ <meshitem src="playIcon" srcEdge="LEFT" dst="preview" dstEdge="RIGHT" />
+ <meshitem src="playIcon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" spacer="bottomSpacer"/>
- <meshitem src="subject" srcEdge="TOP" dst="" dstEdge="TOP" />
- <meshitem src="subject" srcEdge="LEFT" dst="playIcon" dstEdge="RIGHT" />
- <meshitem src="subject" srcEdge="RIGHT" dst="priority" dstEdge="LEFT" />
+ <meshitem src="subject" srcEdge="TOP" dst="headerItem" dstEdge="TOP" />
+ <meshitem src="subject" srcEdge="LEFT" dst="headerItem" dstEdge="LEFT" />
+ <meshitem src="subject" srcEdge="RIGHT" dst="priority" dstEdge="LEFT"/>
+ <meshitem src="subject" srcEdge="BOTTOM" dst="headerItem" dstEdge="BOTTOM"/>
<meshitem src="priority" srcEdge="RIGHT" dst="attachment" dstEdge="LEFT" />
- <meshitem src="priority" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
+ <meshitem src="priority" srcEdge="CENTERV" dst="headerItem" dstEdge="CENTERV" />
+ <meshitem src="priority" srcEdge="TOP" dst="headerItem" dstEdge="TOP" spacer="topSpacer" />
+ <meshitem src="priority" srcEdge="BOTTOM" dst="headerItem" dstEdge="BOTTOM" spacer="bottomSpacer" />
+
+ <meshitem src="attachment" srcEdge="RIGHT" dst="headerItem" dstEdge="RIGHT" />
+ <meshitem src="attachment" srcEdge="CENTERV" dst="headerItem" dstEdge="CENTERV" />
+ <meshitem src="attachment" srcEdge="TOP" dst="headerItem" dstEdge="TOP" spacer="topSpacer" />
+ <meshitem src="attachment" srcEdge="BOTTOM" dst="headerItem" dstEdge="BOTTOM" spacer="bottomSpacer" />
+
+ <meshitem src="headerItem" srcEdge="TOP" dst="" dstEdge="TOP" />
+ <meshitem src="headerItem" srcEdge="LEFT" dst="playIcon" dstEdge="RIGHT" />
+ <meshitem src="headerItem" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
- <meshitem src="attachment" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
- <meshitem src="attachment" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
-
- <meshitem src="bodyText" srcEdge="TOP" dst="subject" dstEdge="BOTTOM" />
+ <meshitem src="bodyText" srcEdge="TOP" dst="headerItem" dstEdge="BOTTOM" />
<meshitem src="bodyText" srcEdge="LEFT" dst="playIcon" dstEdge="RIGHT" />
<meshitem src="bodyText" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
- <meshitem src="timeStamp" srcEdge="TOP" dst="bodyText" dstEdge="BOTTOM" />
+ <meshitem src="timeStamp" srcEdge="TOP" dst="bodyText" dstEdge="BOTTOM" spacer="topSpacer" />
<meshitem src="timeStamp" srcEdge="LEFT" dst="playIcon" dstEdge="RIGHT" />
<meshitem src="timeStamp" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
- <meshitem src="timeStamp" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
+ <meshitem src="timeStamp" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
<meshitem src="newItemIcon" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
<meshitem src="newItemIcon" srcEdge="TOP" dst="" dstEdge="TOP"/>
@@ -71,9 +94,6 @@
<meshitem src="bubble" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
<meshitem src="bubble" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
- <meshitem src="playIcon" srcEdge="TOP" dst="" dstEdge="TOP" />
- <meshitem src="playIcon" srcEdge="LEFT" dst="preview" dstEdge="RIGHT" />
-
</layout>
</hbwidget>
--- a/messagingapp/msgui/conversationview/resources/layouts/msgeditorwidget.css Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgeditorwidget.css Wed Aug 18 09:45:25 2010 +0300
@@ -23,8 +23,15 @@
MsgEditorWidget::charCounter
{
- size-policy:fixed fixed;
- pref-height:-1;
- pref-width:-1;
- text-height:var(hb-param-text-height-tiny);
+ text-height:var(hb-param-text-height-tiny);
+ text-align:centre;
+ text-line-count-min: 1;
+ text-line-count-max: 1;
}
+
+MsgEditorWidget::charCounterFrame
+{
+ size-policy: fixed, fixed ;
+ pref-height: expr(var(hb-param-text-height-tiny)+2*var(hb-param-margin-gene-middle-vertical));
+ pref-width: expr(var(hb-param-text-height-tiny)*3 + 2*var(hb-param-margin-gene-middle-horizontal));
+}
--- a/messagingapp/msgui/conversationview/resources/layouts/msgeditorwidget.widgetml Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgeditorwidget.widgetml Wed Aug 18 09:45:25 2010 +0300
@@ -9,13 +9,11 @@
<meshitem src="sendButton" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
<meshitem src="sendButton" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
- <meshitem src="charCounter" srcEdge="TOP" dst="msgEditor" dstEdge="TOP" />
- <meshitem src="charCounter" srcEdge="RIGHT" dst="msgEditor" dstEdge="RIGHT" />
+ <meshitem src="charCounter" srcEdge="CENTERH" dst="charCounterFrame" dstEdge="CENTERH" />
+ <meshitem src="charCounter" srcEdge="CENTERV" dst="charCounterFrame" dstEdge="CENTERV" />
- <meshitem src="charCounterFrame" srcEdge="LEFT" dst="charCounter" dstEdge="LEFT" />
- <meshitem src="charCounterFrame" srcEdge="TOP" dst="charCounter" dstEdge="TOP" />
- <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="charCounter" dstEdge="RIGHT" />
- <meshitem src="charCounterFrame" srcEdge="BOTTOM" dst="charCounter" dstEdge="BOTTOM" />
+ <meshitem src="charCounterFrame" srcEdge="TOP" dst="msgEditor" dstEdge="TOP" />
+ <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="msgEditor" dstEdge="RIGHT" />
</layout>
</hbwidget>
\ No newline at end of file
--- a/messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -62,7 +62,7 @@
// @see header
//---------------------------------------------------------------
MsgContactCardWidget::MsgContactCardWidget(QGraphicsItem *parent) :
- HbWidget(parent), mIgnoreEvents(false), mAvatarIconItem(NULL), mPresenceIconItem(NULL),
+ HbWidget(parent), mAvatarIconItem(NULL), mPresenceIconItem(NULL),
mAddressTextItem(NULL), mThumbnailManager(NULL)
{
init();
@@ -144,15 +144,17 @@
QStandardItemModel* msgModel = ConversationsEngine::instance()->getConversationsModel();
const int rowCnt = msgModel->rowCount();
QModelIndex index = msgModel->index(rowCnt-1, 0);
- ConvergedMessageAddress* address = new ConvergedMessageAddress(
- index.data(ConversationAddress).toString());
+ QString addr = index.data(ConversationAddress).toString();
+ ConvergedMessageAddress* address = new ConvergedMessageAddress(addr);
+ // resolve contact
QString displayname;
- QString addr;
- ConversationsEngine::instance()->getContactDetails(
- ConversationsEngine::instance()->getCurrentConversationId(),
- displayname,
- addr);
- address->setAlias(displayname);
+ int count;
+ int retval = MsgContactHandler::resolveContactDisplayName(
+ addr, displayname, count);
+ if(retval != -1)
+ {
+ address->setAlias(displayname);
+ }
addresses.append(address);
return addresses;
}
@@ -293,11 +295,6 @@
//---------------------------------------------------------------
void MsgContactCardWidget::handleLongTap(const QPointF &position)
{
- // Check if events need to be ignored/accepted
- if (mIgnoreEvents) {
- return;
- }
-
if (KBluetoothMsgsConversationId != ConversationsEngine::instance()->getCurrentConversationId()) {
HbMenu* contextMenu = new HbMenu();
contextMenu->setDismissPolicy(HbPopup::TapAnywhere);
@@ -326,11 +323,6 @@
{
this->ungrabGesture(Qt::TapGesture);
- // Check if events need to be ignored/accepted
- if (mIgnoreEvents) {
- return;
- }
-
int contactId = resolveContactId(mContactNumber);
if(contactId > 0)
{
@@ -454,7 +446,18 @@
if (!avatarDetails.isEmpty()) {
mThumbnailManager->getThumbnail(avatarDetails.at(0).imageUrl().toString());
}
+ else {
+ //Set default avatar since avtar is deleted
+ setAvatar(HbIcon(DEFAULT_AVATAR_ICON));
+ }
}
+ else {
+ //case for deletion from contact card widget
+ //set the default number as address
+ setAddress(mContactNumber);
+ //Set default avatar since contact is deleted
+ setAvatar(HbIcon(DEFAULT_AVATAR_ICON));
+ }
// Get the new conversation id.
qint64 convId = ConversationsEngine::instance()->getConversationIdFromAddress(
@@ -515,15 +518,6 @@
}
//---------------------------------------------------------------
-// MsgContactCardWidget::ignoreSignals
-// @see header
-//---------------------------------------------------------------
-void MsgContactCardWidget::ignoreSignals(bool yes)
-{
- mIgnoreEvents = yes;
-}
-
-//---------------------------------------------------------------
// MsgContactCardWidget::regrabGesture
// @see header file
//---------------------------------------------------------------
--- a/messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -20,7 +20,7 @@
// SYSTEM INCLUDES
#include <QGraphicsLinearLayout>
#include <HbMainWindow>
-#include <HbNotificationDialog>
+#include <HbDeviceNotificationDialog>
#include <xqaiwrequest.h>
#include <xqappmgr.h>
@@ -123,7 +123,6 @@
SIGNAL(switchView(const QVariantList&)));
connect(mConversationView, SIGNAL(vkbOpened(bool)), this, SLOT(hideChrome(bool)));
- connect(mConversationView, SIGNAL(vkbOpened(bool)), mContactCard, SLOT(ignoreSignals(bool)));
this->setMenu(mConversationView->menu());
@@ -162,13 +161,12 @@
int MsgConversationBaseView::saveContentToDrafts()
{
int msgId = INVALID_MSGID;
- bool result = false;
if (mConversationId >= 0) {
msgId = mConversationView->saveContentToDrafts();
}
if (msgId != INVALID_MSGID) {
- HbNotificationDialog::launchDialog(LOC_SAVED_TO_DRAFTS);
+ HbDeviceNotificationDialog::notification("", LOC_SAVED_TO_DRAFTS);
}
return msgId;
}
@@ -268,6 +266,9 @@
mContactCard->show();
}
}
+
+ //forcing relayouting
+ mMainLayout->activate();
}
//---------------------------------------------------------------
--- a/messagingapp/msgui/conversationview/src/msgconversationview.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgconversationview.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -58,6 +58,8 @@
#include "mmsconformancecheck.h"
#include "msgsettingsview.h"
#include "msgaudiofetcherview.h"
+#include "unieditorpluginloader.h"
+#include "unieditorplugininterface.h"
//Item specific menu.
@@ -69,6 +71,7 @@
#define LOC_COMMON_SAVE hbTrId("txt_common_menu_save")
#define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
+#define LOC_DELETE_SHARED_MESSAGE hbTrId("txt_messaging_dialog_same_message_exists_in_multip")
#define LOC_SAVE_TO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts")
//main menu
@@ -80,8 +83,9 @@
#define LOC_ADD_SUBJECT hbTrId("txt_messaging_opt_add_subject")
#define LOC_MSG_SEND_FAILED hbTrId("txt_messaging_dialog_message_sending_failed")
-#define LOC_DIALOG_SMS_SETTINGS_INCOMPLETE hbTrId("txt_messaging_dialog_sms_settings_incomplete")
+#define LOC_DIALOG_SMS_SETTINGS_INCOMPLETE hbTrId("txt_messaging_dialog_sms_message_centre_does_not_e")
#define LOC_DIALOG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone")
+#define LOC_MMS_RETRIEVAL_FAILED hbTrId("txt_messaging_dialog_mms_retrieval_failed")
const int INVALID_MSGID = -1;
@@ -103,7 +107,6 @@
mSendUtil(NULL),
mVkbHost(NULL),
mVisibleIndex(),
- mVkbopened(false),
mModelPopulated(false),
mViewReady(false)
{
@@ -274,48 +277,23 @@
// MsgConversationView::longPressed
// @see header file
//---------------------------------------------------------------
-void MsgConversationView::longPressed(HbAbstractViewItem* viewItem,
- const QPointF& point)
-{
- MsgConversationViewItem* item = qgraphicsitem_cast<
- MsgConversationViewItem *> (viewItem);
-
- // Show the item-specific menu
- if (this->isVisible())
- {
- //If message is in Sending state or is Scheduled to be sent later,
- //do not allow any operations on the message
- int sendingState = item->modelIndex().data(SendingState).toInt();
- if(sendingState == ConvergedMessage::Scheduled ||
- sendingState == ConvergedMessage::Sending ||
- sendingState == ConvergedMessage::Waiting)
- {
- return;
- }
- // Create new menu
- HbMenu* contextMenu = new HbMenu();
- contextMenu->setAttribute(Qt::WA_DeleteOnClose);
- contextMenu->setPreferredPos(point);
- setContextMenu(item, contextMenu, sendingState);
- contextMenu->show();
-
- }
-
+void MsgConversationView::longPressed(HbAbstractViewItem* viewItem, const QPointF& point)
+{
+ showContextMenu(viewItem,point,HbPopup::TopLeftCorner);
}
//---------------------------------------------------------------
// MsgConversationView::setContextMenu
// @see header
//---------------------------------------------------------------
-
void MsgConversationView::setContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState)
{
addOpenItemToContextMenu(item , contextMenu,sendingState);
addResendItemToContextMenu(item, contextMenu, sendingState);
addForwardItemToContextMenu(item, contextMenu, sendingState);
addDownloadItemToContextMenu(item, contextMenu);
+ addSaveItemToContextMenu(item , contextMenu,sendingState);
addDeleteItemToContextMenu(item, contextMenu, sendingState);
- addSaveItemToContextMenu(item , contextMenu,sendingState);
}
@@ -358,10 +336,11 @@
(direction == ConvergedMessage::Incoming))
{
HbAction *contextItem = contextMenu->addAction(LOC_SAVE_TO_CONTACTS);
- connect(contextItem, SIGNAL(triggered()),this, SLOT(openItem()));
+ connect(contextItem, SIGNAL(triggered()),this, SLOT(saveVCard()));
return;
}
- if( (sendingState == ConvergedMessage::SentState ) ||
+ if( (sendingState == ConvergedMessage::SentState &&
+ messageSubType != ConvergedMessage::VCard) ||
(direction == ConvergedMessage::Incoming))
{
HbAction *contextItem = contextMenu->addAction(LOC_COMMON_OPEN);
@@ -379,10 +358,13 @@
{
Q_UNUSED(item)
int direction = item->modelIndex().data(Direction).toInt();
+ int messageSubType = item->modelIndex().data(MessageSubType).toInt();
- if( (direction == ConvergedMessage::Outgoing)&&
+
+ if( ((direction == ConvergedMessage::Outgoing) &&
+ (messageSubType != ConvergedMessage::VCard))&&
((sendingState == ConvergedMessage::Resend ) ||
- (sendingState == ConvergedMessage::Suspended )||
+
(sendingState == ConvergedMessage::Failed )))
{
HbAction *contextItem = contextMenu->addAction(LOC_COMMON_SEND);
@@ -420,6 +402,7 @@
if( ((sendingState == ConvergedMessage::SentState) ||
(sendingState == ConvergedMessage::Resend) ||
(sendingState == ConvergedMessage::Failed) ||
+ (sendingState == ConvergedMessage::Suspended )||
(direction == ConvergedMessage::Incoming) ) &&
canForwardMessage)
{
@@ -639,16 +622,11 @@
//---------------------------------------------------------------
void MsgConversationView::contactsFetched(const QVariant& value)
{
- CntServicesContactList contactList =
- qVariantValue<CntServicesContactList>(value);
- int count = contactList.count();
- if(count > 0)
- {
- QVariantList params;
- params << MsgBaseView::ADD_RECIPIENTS;
- params << value;
- launchUniEditor(params);
- }
+ //switch to editor.
+ QVariantList params;
+ params << MsgBaseView::ADD_RECIPIENTS;
+ params << value;
+ launchUniEditor(params);
}
//---------------------------------------------------------------
@@ -722,7 +700,7 @@
qint32 messageId = index.data(ConvergedMsgId).toLongLong();
if(!(ConversationsEngine::instance()->resendMessage(messageId)))
{
- HbMessageBox::warning(LOC_MSG_SEND_FAILED);
+ HbMessageBox::warning(LOC_MSG_SEND_FAILED, 0, 0, HbMessageBox::Ok);
}
}
@@ -737,10 +715,10 @@
QModelIndex index = mConversationList->currentIndex();
if(index.isValid())
{
- qint32 messageId = index.data(ConvergedMsgId).toLongLong();
+ qint32 messageId = index.data(ConvergedMsgId).toLongLong();
if(ConversationsEngine::instance()->downloadMessage(messageId)!=KErrNone)
{
- HbMessageBox::warning("Message Retrieval Failed!"); //TODO: use logical str name
+ HbMessageBox::warning(LOC_MMS_RETRIEVAL_FAILED, 0, 0, HbMessageBox::Ok);
}
}
@@ -751,8 +729,29 @@
// Deletes the message
//---------------------------------------------------------------
void MsgConversationView::deleteItem()
+{
+ QString str = LOC_DELETE_MESSAGE;
+
+ QModelIndex index = mConversationList->currentIndex();
+ if(index.isValid())
{
- HbMessageBox::question(LOC_DELETE_MESSAGE,this,SLOT(onDialogdeleteMsg(HbAction*)),
+ int messageType = index.data(MessageType).toInt();
+ int direction = index.data(Direction).toInt();
+
+ if ( direction == ConvergedMessage::Outgoing &&
+ messageType == ConvergedMessage::Mms )
+ {
+ qint32 messageId = index.data(ConvergedMsgId).toLongLong();
+
+ if(isSharedMessage(messageId))
+ {
+ str = LOC_DELETE_SHARED_MESSAGE;
+ }
+ }
+ }
+
+
+ HbMessageBox::question(str,this,SLOT(onDialogdeleteMsg(HbAction*)),
HbMessageBox::Delete | HbMessageBox::Cancel);
}
@@ -887,7 +886,7 @@
void MsgConversationView::openItem(const QModelIndex & index)
{
// Return if invalid index.
- if (!index.isValid() || mVkbopened)
+ if (!index.isValid())
{
return;
}
@@ -920,20 +919,7 @@
}
else if(ConvergedMessage::VCard == messageSubType)
{
- QString filepath = index.data(Attachments).toStringList().at(0);
- bool result = MsgContactsUtil::launchVCardViewer(filepath);
- if(result)
- {
-
- int messageId = index.data(ConvergedMsgId).toInt();
- QList<int> msgIdList;
- if(index.data(UnReadStatus).toInt())
- {
- msgIdList.clear();
- msgIdList << messageId;
- ConversationsEngine::instance()->markMessagesRead(msgIdList);
- }
- }
+ handleShortTap();
return;
}
else if(ConvergedMessage::VCal == messageSubType)
@@ -955,7 +941,7 @@
}
else if(ConvergedMessage::MmsNotification == messageType)
{
- qint32 messageId = index.data(ConvergedMsgId).toLongLong();
+ qint32 messageId = index.data(ConvergedMsgId).toLongLong();
if(!ConversationsEngine::instance()->downloadOperationSupported(messageId))
{
int notificationState = index.data(NotificationStatus).toInt();
@@ -987,6 +973,15 @@
int location = index.data(MessageLocation).toInt();
int sendingState = index.data(SendingState).toInt();
+ // For suspended message both short tap and long tap needs to show the same
+ // context menu.....
+ if(direction == ConvergedMessage::Outgoing
+ &&sendingState == ConvergedMessage::Suspended )
+ {
+ handleShortTap();
+ return;
+ }
+
//If message is in any other state other than 'Sent'
//do not open the message
if(direction == ConvergedMessage::Outgoing
@@ -1009,14 +1004,7 @@
msgIdList << messageId;
ConversationsEngine::instance()->markMessagesRead(msgIdList);
}
-
- qint32 messageProperty = index.data(MessageProperty).toInt();
- bool canForwardMessage = true;
- if (messageType == ConvergedMessage::Mms){
- canForwardMessage = (messageProperty & EPreviewForward)? true:false;
- }
-
//switch view
QVariantList param;
param << MsgBaseView::UNIVIEWER; // target view
@@ -1025,14 +1013,6 @@
param << contactId;
param << messageId;
param << mMessageModel->rowCount();
- if (canForwardMessage == true)
- {
- param << 1;
- }
- else
- {
- param << 0;
- }
emit switchView(param);
}
@@ -1194,9 +1174,9 @@
//---------------------------------------------------------------
void MsgConversationView::vkbOpened()
{
- mVkbopened = true;
+ emit vkbOpened(true);
- emit vkbOpened(true);
+ scrollToBottom();
QRectF appRect = mVkbHost->applicationArea();
qreal spacing = 0.0;
@@ -1208,10 +1188,10 @@
}
this->setMaximumHeight(appRect.height()- cardHeight - spacing);
+ mConversationList->adjustSize();
disconnect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened()));
-
- scrollToBottom();
+
}
//---------------------------------------------------------------
@@ -1220,14 +1200,14 @@
//---------------------------------------------------------------
void MsgConversationView::vkbClosed()
{
- mVkbopened = false;
-
emit vkbOpened(false);
+ scrollToBottom();
+
this->setMaximumHeight(-1);
+ mConversationList->adjustSize();
+
connect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened()));
-
- scrollToBottom();
}
//---------------------------------------------------------------
@@ -1346,6 +1326,17 @@
if (action == dlg->actions().at(0)) {
downloadMessage();
}
+
+ //if message unread, mark as read now
+ QModelIndex index = mConversationList->currentIndex();
+ qint32 messageId = index.data(ConvergedMsgId).toLongLong();
+ QList<int> msgIdList;
+ if(index.data(UnReadStatus).toInt())
+ {
+ msgIdList.clear();
+ msgIdList << messageId;
+ ConversationsEngine::instance()->markMessagesRead(msgIdList);
+ }
}
//---------------------------------------------------------------
@@ -1402,4 +1393,99 @@
fetchMoreConversations();
}
+
+//---------------------------------------------------------------
+// MsgConversationView::handleShortTap
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationView::handleShortTap()
+{
+ HbAbstractViewItem* item = mConversationList->currentViewItem();
+ QRectF rc = item->rect();
+ QPointF p = item->mapToScene(rc.center());
+
+ showContextMenu(item,p,HbPopup::TopEdgeCenter);
+}
+
+//---------------------------------------------------------------
+// MsgConversationView::handleShortTap
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationView::showContextMenu(HbAbstractViewItem* viewItem,const QPointF& point, int placement)
+{
+ MsgConversationViewItem* item = qgraphicsitem_cast<MsgConversationViewItem *>(viewItem);
+
+ // Show the item-specific menu
+ if (this->isVisible())
+ {
+ //If message is in Sending state or is Scheduled to be sent later,
+ //do not allow any operations on the message
+ int sendingState = item->modelIndex().data(SendingState).toInt();
+
+ if(sendingState == ConvergedMessage::Scheduled ||
+ sendingState == ConvergedMessage::Sending ||
+ sendingState == ConvergedMessage::Waiting)
+ {
+ return;
+ }
+ // Create new menu
+ HbMenu* contextMenu = new HbMenu();
+ contextMenu->setAttribute(Qt::WA_DeleteOnClose);
+ contextMenu->setPreferredPos(point,HbPopup::Placement(placement));
+ setContextMenu(item, contextMenu, sendingState);
+ contextMenu->show();
+ }
+}
+
+//---------------------------------------------------------------
+// MsgConversationView::saveVCard
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationView::saveVCard()
+{
+ QModelIndex index = mConversationList->currentIndex();
+
+ QString filepath = index.data(Attachments).toStringList().at(0);
+ bool result = MsgContactsUtil::launchVCardViewer(filepath);
+ if(result)
+ {
+ int messageId = index.data(ConvergedMsgId).toInt();
+ QList<int> msgIdList;
+ if(index.data(UnReadStatus).toInt())
+ {
+ msgIdList.clear();
+ msgIdList << messageId;
+ ConversationsEngine::instance()->markMessagesRead(msgIdList);
+ }
+ }
+}
+
+//---------------------------------------------------------------
+// MsgConversationView::isSharedMessage
+// @see header file
+//---------------------------------------------------------------
+bool MsgConversationView::isSharedMessage(qint32 messageId)
+{
+ bool shared = false;
+
+ UniDataModelLoader* pluginLoader = new UniDataModelLoader();
+
+ UniDataModelPluginInterface* pluginInterface =
+ pluginLoader->getDataModelPlugin(ConvergedMessage::Mms);
+
+ CMsvSession* session = pluginInterface->session();
+
+ TMsvEntry entry;
+ TMsvId service;
+ session->GetEntry(messageId, service, entry);
+
+ if(entry.MultipleRecipients())
+ {
+ shared = true;
+ }
+ delete pluginLoader;
+
+ return shared;
+}
+
// EOF
--- a/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -22,10 +22,12 @@
#include "debugtraces.h"
#include <QDir>
#include <QChar>
+#include <QStringBuilder>
#include <HbTextItem>
#include <HbIconItem>
#include <HbIconAnimationManager>
#include <HbIconAnimator>
+#include <HbExtendedLocale>
#include <ccsdefs.h>
#include <HbInstance>
@@ -37,21 +39,25 @@
#include "conversationsenginedefines.h"
// LOCAL CONSTANTS
-const QString MSG_OUTBOX_ICON("qtg_small_outbox");
-const QString MSG_FAIL_ICON("qtg_small_fail");
-const QString ANIMATION_FILE(":/qtg_anim_loading.axml");
-const QString ANIMATION_ICON_NAME("qtg_anim_loading");
-const QString VCARD_ICON("qtg_large_mycard");
-const QString IMAGE_ICON("qtg_small_image");
-const QString CORRUPTED_ICON("qtg_small_corrupted");
-const QString MSG_VIDEO_ICON("qtg_small_video");
+static const char MSG_OUTBOX_ICON[] = "qtg_small_outbox";
+static const char MSG_FAIL_ICON[] = "qtg_small_fail";
+static const char ANIMATION_FILE[] = ":/qtg_anim_loading.axml";
+static const char ANIMATION_ICON_NAME[] = "qtg_anim_loading";
+static const char VCARD_ICON[] = "qtg_large_mycard";
+static const char IMAGE_ICON[] = "qtg_small_image";
+static const char CORRUPTED_ICON[] = "qtg_small_corrupted";
+static const char MSG_VIDEO_ICON[] = "qtg_small_video";
+
+// @see hbi18ndef.h
+static const char DATE_FORMAT[] = r_qtn_date_short_with_zero;
+static const char TIME_FORMAT[] = r_qtn_time_usual_with_zero;
// LOCALIZATION
#define LOC_RINGING_TONE hbTrId("txt_messaging_dpopinfo_ringing_tone")
#define LOC_BUSINESS_CARD hbTrId("txt_messaging_list_business_card")
#define LOC_CALENDAR_EVENT hbTrId("txt_messaging_list_calendar_event")
#define LOC_UNSUPPORTED_MSG_TYPE hbTrId("txt_messaging_list_listview_unsupported_message_type")
-#define LOC_RESEND_AT hbTrId("Resend at ")
+#define LOC_RESEND_AT hbTrId("txt_messaging_list_resend_at_time")
//---------------------------------------------------------------
// MsgConversationViewItem::MsgConversationViewItem
@@ -171,17 +177,17 @@
dateTime.setTime_t(index.data(TimeStamp).toUInt());
QString resendStateNote((index.data(SendingState).toInt()
== ConvergedMessage::Resend) ? LOC_RESEND_AT : "");
- if (dateTime.date() == QDateTime::currentDateTime().date())
- {
+
+ HbExtendedLocale locale = HbExtendedLocale::system();
+ QString date = locale.format(dateTime.date(), DATE_FORMAT);
+ QString time = locale.format(dateTime.time(), TIME_FORMAT);
- mConversation->setTimeStamp(resendStateNote + dateTime.toString(
- TIME_FORMAT));
- }
- else
- {
- mConversation->setTimeStamp(resendStateNote + dateTime.toString(
- DATE_FORMAT));
- }
+ if (dateTime.date() == QDateTime::currentDateTime().date()) {
+ mConversation->setTimeStamp(resendStateNote % time);
+ }
+ else {
+ mConversation->setTimeStamp(resendStateNote % date);
+ }
if (messageSubType == ConvergedMessage::VCal)
{
@@ -192,7 +198,7 @@
QString bodyText = index.data(BodyText).toString();
bodyText.replace(QChar::ParagraphSeparator, QChar::LineSeparator);
bodyText.replace('\r', QChar::LineSeparator);
- mConversation->setSubject(bodyText);
+ mConversation->setBodyText(bodyText);
}
//repolish
@@ -256,17 +262,17 @@
dateTime.setTime_t(index.data(TimeStamp).toUInt());
QString resendStateNote((index.data(SendingState).toInt()
== ConvergedMessage::Resend) ? LOC_RESEND_AT : "");
- if (dateTime.date() == QDateTime::currentDateTime().date())
- {
+
+ HbExtendedLocale locale = HbExtendedLocale::system();
+ QString date = locale.format(dateTime.date(), DATE_FORMAT);
+ QString time = locale.format(dateTime.time(), TIME_FORMAT);
- mConversation->setTimeStamp(resendStateNote + dateTime.toString(
- TIME_FORMAT));
- }
- else
- {
- mConversation->setTimeStamp(resendStateNote + dateTime.toString(
- DATE_FORMAT));
- }
+ if (dateTime.date() == QDateTime::currentDateTime().date()) {
+ mConversation->setTimeStamp(resendStateNote % time);
+ }
+ else {
+ mConversation->setTimeStamp(resendStateNote % date);
+ }
if (messageType == ConvergedMessage::Mms)
{
@@ -457,43 +463,31 @@
void MsgConversationViewItem::setMessageStateIcon(int messageState)
{
HbIconAnimator& iconAnimator = mOutgoingMsgStateIconItem->animator();
- HbIconAnimationManager* iconAnimationManager =
- HbIconAnimationManager::global();
+
switch (messageState)
{
case ConvergedMessage::Waiting:
case ConvergedMessage::Scheduled:
case ConvergedMessage::Sending:
{
- bool defined = iconAnimationManager->addDefinitionFile(
- ANIMATION_FILE);
- HbIcon animIcon;
- animIcon.setIconName(ANIMATION_ICON_NAME);
- QSizeF size = mOutgoingMsgStateIconItem->size();
- mOutgoingMsgStateIconItem->setIcon(animIcon);
+ HbIconAnimationManager::global()->addDefinitionFile(ANIMATION_FILE);
+ mOutgoingMsgStateIconItem->setIconName(ANIMATION_ICON_NAME);
mOutgoingMsgStateIconItem->setVisible(true);
iconAnimator.startAnimation();
break;
}
case ConvergedMessage::Suspended:
- {
- iconAnimator.stopAnimation();
- mOutgoingMsgStateIconItem->setIcon(MSG_OUTBOX_ICON);
- mOutgoingMsgStateIconItem->setVisible(true);
- break;
-
- }
case ConvergedMessage::Resend:
{
iconAnimator.stopAnimation();
- mOutgoingMsgStateIconItem->setIcon(MSG_OUTBOX_ICON);
+ mOutgoingMsgStateIconItem->setIconName(MSG_OUTBOX_ICON);
mOutgoingMsgStateIconItem->setVisible(true);
break;
}
case ConvergedMessage::Failed:
{
iconAnimator.stopAnimation();
- mOutgoingMsgStateIconItem->setIcon(MSG_FAIL_ICON);
+ mOutgoingMsgStateIconItem->setIconName(MSG_FAIL_ICON);
mOutgoingMsgStateIconItem->setVisible(true);
break;
}
@@ -581,6 +575,7 @@
//---------------------------------------------------------------
void MsgConversationViewItem::orientationchanged(Qt::Orientation orientation)
{
+ Q_UNUSED(orientation)
QDEBUG_WRITE("MsgConversationViewItem:orientationchanged start.")
repolish();
--- a/messagingapp/msgui/conversationview/src/msgconversationwidget.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgconversationwidget.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -33,7 +33,6 @@
#include <QCoreApplication>
#include <HbEvent>
#include <HbMainWindow>
-#include <HbInstance>
#include "debugtraces.h"
@@ -41,20 +40,22 @@
#include "conversationsengine.h"
// Icons
-const QString MSG_HIGH_PRIORITY_ICON("qtg_small_priority_high");
-const QString MSG_LOW_PRIORITY_ICON("qtg_small_priority_low");
-const QString MSG_ATTACH_ICON("qtg_small_attachment");
-const QString MSG_AUDIO_PLAY_ICON("qtg_small_sound");
-
+static const char MSG_HIGH_PRIORITY_ICON[] = "qtg_small_priority_high";
+static const char MSG_LOW_PRIORITY_ICON[] = "qtg_small_priority_low";
+static const char MSG_ATTACH_ICON[] = "qtg_small_attachment";
+static const char MSG_AUDIO_PLAY_ICON[] = "qtg_small_sound";
// Frames
-const QString CV_RECEIVED_NORMAL_FR("qtg_fr_convlist_received_normal");
-const QString CV_RECEIVED_PRESSED_FR("qtg_fr_convlist_received_pressed");
-const QString CV_RECEIVED_HIGHLIGHT_FR("qtg_fr_convlist_received_highlight");
-const QString CV_SENT_NORMAL_FR("qtg_fr_convlist_sent_normal");
-const QString CV_SENT_PRESSED_FR("qtg_fr_convlist_sent_pressed");
-const QString CV_SENT_HIGHLIGHT_FR("qtg_fr_convlist_sent_highlight");
-const QString NEW_ITEM_FRAME("qtg_fr_list_new_item");
+static const char CV_RECEIVED_NORMAL_FR[] = "qtg_fr_convlist_received_normal";
+static const char CV_RECEIVED_PRESSED_FR[] = "qtg_fr_convlist_received_pressed";
+static const char CV_RECEIVED_HIGHLIGHT_FR[] = "qtg_fr_convlist_received_highlight";
+static const char CV_SENT_NORMAL_FR[] = "qtg_fr_convlist_sent_normal";
+static const char CV_SENT_PRESSED_FR[] = "qtg_fr_convlist_sent_pressed";
+static const char CV_SENT_HIGHLIGHT_FR[] = "qtg_fr_convlist_sent_highlight";
+static const char NEW_ITEM_FRAME[] = "qtg_fr_list_new_item";
+
+//Localization
+#define LOC_MULTIMEDIA_MESSAGE hbTrId("txt_messaging_list_bubble_multimedia_message")
//---------------------------------------------------------------
// MsgConversationWidget::MsgConversationWidget
@@ -115,24 +116,34 @@
mNewFrameItem = new HbFrameItem(this);
mNewFrameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
HbStyle::setItemName(mNewFrameItem, "newItemIcon");
+
mSubjectTextItem = new HbTextItem(this);
- mSubjectTextItem->setTextWrapping(Hb::TextWordWrap);
+ mSubjectTextItem->setTextWrapping(Hb::TextNoWrap);
HbStyle::setItemName(mSubjectTextItem, "subject");
+
mBodyTextItem = new HbTextItem(this);
mBodyTextItem->setTextWrapping(Hb::TextWordWrap);
HbStyle::setItemName(mBodyTextItem, "bodyText");
+
mPreviewIconItem = new HbIconItem(this);
HbStyle::setItemName(mPreviewIconItem, "preview");
+
mPriorityIconItem = new HbIconItem(this);
HbStyle::setItemName(mPriorityIconItem, "priority");
+
mAttachmentIconItem = new HbIconItem(this);
HbStyle::setItemName(mAttachmentIconItem, "attachment");
+
mPlayIconItem = new HbIconItem(this);
HbStyle::setItemName(mPlayIconItem, "playIcon");
+
mTimeStampTextItem = new HbTextItem(this);
HbStyle::setItemName(mTimeStampTextItem, "timeStamp");
-
- HbMainWindow *mainWindow = hbInstance->allMainWindows()[0];
+
+ HbWidget* headerContainer = new HbWidget(this);
+ HbStyle::setItemName(headerContainer, "headerItem");
+
+ HbMainWindow *mainWindow = this->mainWindow();
connect(mainWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
SLOT(orientationchanged(Qt::Orientation)),Qt::UniqueConnection);
polishEvent();
@@ -144,8 +155,13 @@
//---------------------------------------------------------------
void MsgConversationWidget::setSubject(const QString &subject)
{
+ QString sub = subject;
+ if(subject.trimmed().isEmpty())
+ {
+ sub = LOC_MULTIMEDIA_MESSAGE;
+ }
HbStyle::setItemName(mSubjectTextItem, "subject");
- mSubjectTextItem->setText(subject);
+ mSubjectTextItem->setText(sub);
mSubjectTextItem->show();
}
@@ -155,6 +171,10 @@
//---------------------------------------------------------------
void MsgConversationWidget::setBodyText(const QString &body)
{
+ if(body.isEmpty())
+ {
+ return;
+ }
HbStyle::setItemName(mBodyTextItem, "bodyText");
mBodyTextItem->setText(body);
@@ -284,20 +304,8 @@
if (!hasImage())
{
HbStyle::setItemName(mPreviewIconItem, "preview");
- if(iconPath.isEmpty())
- {
- qreal iconSize = 0;
- style()->parameter("hb-param-graphic-size-primary-small",iconSize);
- HbIcon icon(MSG_AUDIO_PLAY_ICON);
- icon.setHeight(iconSize);
- icon.setWidth(iconSize);
- mPreviewIconItem->setIcon(icon);
- }
- else
- {
- mPreviewIconItem->setIconName(iconPath);
- }
- mPreviewIconItem->show();
+ mPreviewIconItem->setIconName(iconPath.isEmpty() ? MSG_AUDIO_PLAY_ICON : iconPath);
+ mPreviewIconItem->show();
}
else
{
@@ -660,6 +668,7 @@
//---------------------------------------------------------------
void MsgConversationWidget::orientationchanged(Qt::Orientation orientation)
{
+ Q_UNUSED(orientation)
QDEBUG_WRITE("MsgConversationWidget:orientationchanged start.")
repolish();
--- a/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -28,6 +28,8 @@
#include <csmsaccount.h>
#include <smutset.h>
#include <hbmessagebox.h>
+#include <hbcolorscheme.h>
+#include <QColor>
#include <QTimer>
#include "unieditorpluginloader.h"
#include "unieditorplugininterface.h"
@@ -39,11 +41,16 @@
const QString SEND_ICON("qtg_mono_send");
const QString BACKGROUND("qtg_fr_input_v_bg");
-const QString BACKGROUND_FRAME("qtg_fr_btn_normal");
+const QString BACKGROUND_FRAME("qtg_fr_messaging_char_count");
+const QString CHAR_COUNTER_COLOR("qtc_messaging_char_count");
-const QString SEND_BUTTON_NORMAL("qtg_fr_input_btn_function_normal");
-const QString SEND_BUTTON_PRESSED("qtg_fr_input_btn_function_pressed");
-const QString SEND_BUTTON_DISABLED("qtg_fr_input_btn_function_disabled");
+const QString SEND_BUTTON_NORMAL("qtg_fr_btn_green_normal");
+const QString SEND_BUTTON_PRESSED("qtg_fr_btn_green_pressed");
+const QString SEND_BUTTON_DISABLED("qtg_fr_btn_disabled");
+
+const QString SEND_BUTTON_NORMAL_COLOR("qtc_callhandling_answer_normal");
+const QString SEND_BUTTON_PRESSED_COLOR("qtc_callhandling_answer_pressed");
+const QString SEND_BUTTON_DISABLED_COLOR("qtc_button_disabled");
#define LOC_SMS_CHAR_LIMIT_REACHED hbTrId("txt_messaging_dialog_sms_character_count_exceeded")
#define LOC_HINT_TEXT hbTrId("txt_messaging_formlabel_enter_message_here")
@@ -90,25 +97,28 @@
HbFrameItem* backGround = new HbFrameItem(this);
backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
mSendButton->setBackgroundItem(backGround);
- updateButtonBackground(SEND_BUTTON_DISABLED);
+ updateButtonBackgroundAndColor(SEND_BUTTON_DISABLED,SEND_BUTTON_DISABLED_COLOR);
mSendButton->setIcon(HbIcon(SEND_ICON));
mCharCounter = new HbTextItem(this);
HbStyle::setItemName(mCharCounter, "charCounter");
mCharCounter->setZValue(1.5);
+ QColor color = HbColorScheme::color(CHAR_COUNTER_COLOR);
+ mCharCounter->setTextColor(color);
+
mBackgroundItem = new HbFrameItem(this);
HbStyle::setItemName(mBackgroundItem, "charCounterFrame");
- mBackgroundItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
+ mBackgroundItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
mBackgroundItem->frameDrawer().setFillWholeRect(true);
mBackgroundItem->frameDrawer().setFrameGraphicsName(
BACKGROUND_FRAME);
//Create editor utils object
- mEditorUtils = new UniEditorGenUtils();
-
+ mEditorUtils = q_check_ptr(new UniEditorGenUtils());
+
FOCUSITEM = mSendButton;
@@ -175,7 +185,7 @@
{
mSendButton->setFocusProxy(mMsgEditor);
mSendButton->setEnabled(true);
- updateButtonBackground(SEND_BUTTON_NORMAL);
+ updateButtonBackgroundAndColor(SEND_BUTTON_NORMAL,SEND_BUTTON_NORMAL_COLOR);
}
}
else
@@ -184,7 +194,7 @@
{
mSendButton->setFocusProxy(0);
mSendButton->setEnabled(false);
- updateButtonBackground(SEND_BUTTON_DISABLED);
+ updateButtonBackgroundAndColor(SEND_BUTTON_DISABLED,SEND_BUTTON_DISABLED_COLOR);
}
}
@@ -279,16 +289,22 @@
}
//---------------------------------------------------------------
-// MsgEditor::updateButtonBackground
+// MsgEditor::updateButtonBackgroundAndColor
// @see header
//---------------------------------------------------------------
-void MsgEditorWidget::updateButtonBackground(const QString& bg)
+void MsgEditorWidget::updateButtonBackgroundAndColor(const QString& bg,const QString& iconColor)
{
HbFrameItem* drawer = static_cast<HbFrameItem*>(mSendButton->backgroundItem());
if(drawer)
{
drawer->frameDrawer().setFrameGraphicsName(bg);
}
+ QColor color = HbColorScheme::color(iconColor);
+
+ if(color.isValid())
+ {
+ mSendButton->icon().setColor(color);
+ }
}
@@ -298,7 +314,7 @@
//---------------------------------------------------------------
void MsgEditorWidget::onPressed()
{
- updateButtonBackground(SEND_BUTTON_PRESSED);
+ updateButtonBackgroundAndColor(SEND_BUTTON_PRESSED,SEND_BUTTON_PRESSED_COLOR);
}
//---------------------------------------------------------------
@@ -307,7 +323,7 @@
//---------------------------------------------------------------
void MsgEditorWidget::onReleased()
{
- updateButtonBackground(SEND_BUTTON_NORMAL);
+ updateButtonBackgroundAndColor(SEND_BUTTON_NORMAL,SEND_BUTTON_NORMAL_COLOR);
}
//---------------------------------------------------------------
@@ -325,21 +341,21 @@
mPluginInterface =
mPluginLoader->getUniEditorPlugin(ConvergedMessage::Sms);
- CSmsSettings* settings = CSmsSettings::NewLC();
- CSmsAccount* account = CSmsAccount::NewLC();
- account->LoadSettingsL( *settings );
+ QT_TRAP_THROWING( CSmsSettings* settings = CSmsSettings::NewLC();
+ CSmsAccount* account = CSmsAccount::NewLC();
+ account->LoadSettingsL( *settings );
- if( settings->CharacterSet() == TSmsDataCodingScheme::ESmsAlphabetUCS2)
- {
- mCharSupportType = TUniSendingSettings::EUniCharSupportFull;
- }
- else
- {
- mCharSupportType = TUniSendingSettings::EUniCharSupportReduced;
- }
+ if( settings->CharacterSet() == TSmsDataCodingScheme::ESmsAlphabetUCS2)
+ {
+ mCharSupportType = TUniSendingSettings::EUniCharSupportFull;
+ }
+ else
+ {
+ mCharSupportType = TUniSendingSettings::EUniCharSupportReduced;
+ }
- CleanupStack::PopAndDestroy( account );
- CleanupStack::PopAndDestroy( settings );
+ CleanupStack::PopAndDestroy( account );
+ CleanupStack::PopAndDestroy( settings ));
//Set the mPrevBuffer to NULL initially
mPrevBuffer = QString();
@@ -357,6 +373,7 @@
MsgEditor::MsgEditor(QGraphicsItem *parent)
:HbLineEdit(parent)
{
+ this->setFontSpec(HbFontSpec(HbFontSpec::Secondary));
this->setPlaceholderText(LOC_HINT_TEXT);
}
--- a/messagingapp/msgui/eabi/appengineu.def Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/eabi/appengineu.def Wed Aug 18 09:45:25 2010 +0300
@@ -16,32 +16,32 @@
_ZN19ConversationsEngine19getStaticMetaObjectEv @ 15 NONAME
_ZN19ConversationsEngine20markAsReadAndGetTypeEiRiS0_ @ 16 NONAME
_ZN19ConversationsEngine20markConversationReadEx @ 17 NONAME
- _ZN19ConversationsEngine21getConversationsModelEv @ 18 NONAME
- _ZN19ConversationsEngine22deleteAllDraftMessagesEv @ 19 NONAME
- _ZN19ConversationsEngine22fetchMoreConversationsEv @ 20 NONAME
- _ZN19ConversationsEngine24conversationModelUpdatedEv @ 21 NONAME
- _ZN19ConversationsEngine24getCurrentConversationIdEv @ 22 NONAME
- _ZN19ConversationsEngine26conversationModelPopulatedEv @ 23 NONAME
- _ZN19ConversationsEngine26downloadOperationSupportedEi @ 24 NONAME
- _ZN19ConversationsEngine28emitConversationModelUpdatedEv @ 25 NONAME
- _ZN19ConversationsEngine28getConversationIdFromAddressE7QString @ 26 NONAME
- _ZN19ConversationsEngine28getConversationsSummaryModelEv @ 27 NONAME
- _ZN19ConversationsEngine30conversationListModelPopulatedEv @ 28 NONAME
- _ZN19ConversationsEngine30emitConversationModelPopulatedEv @ 29 NONAME
- _ZN19ConversationsEngine30getConversationIdFromContactIdEi @ 30 NONAME
- _ZN19ConversationsEngine34emitConversationListModelPopulatedEv @ 31 NONAME
- _ZN19ConversationsEngine8instanceEv @ 32 NONAME
- _ZN19ConversationsEngineC1EP7QObject @ 33 NONAME
- _ZN19ConversationsEngineC2EP7QObject @ 34 NONAME
- _ZN19ConversationsEngineD0Ev @ 35 NONAME
- _ZN19ConversationsEngineD1Ev @ 36 NONAME
- _ZN19ConversationsEngineD2Ev @ 37 NONAME
- _ZNK19ConversationsEngine10metaObjectEv @ 38 NONAME
- _ZTI19ConversationsEngine @ 39 NONAME
- _ZTV19ConversationsEngine @ 40 NONAME
- _ZN19ConversationsEngine28conversationListEntryDeletedEi @ 41 NONAME
- _ZN19ConversationsEngine37emitConversationListModelEntryDeletedEi @ 42 NONAME
- _ZN19ConversationsEngine21conversationViewEmptyEv @ 43 NONAME
- _ZN19ConversationsEngine31disableRegisterationForCVEventsEv @ 44 NONAME
- _ZN19ConversationsEngine32emitOpenConversationViewIdUpdateEi @ 45 NONAME
+ _ZN19ConversationsEngine21conversationViewEmptyEv @ 18 NONAME
+ _ZN19ConversationsEngine21getConversationsModelEv @ 19 NONAME
+ _ZN19ConversationsEngine22deleteAllDraftMessagesEv @ 20 NONAME
+ _ZN19ConversationsEngine22fetchMoreConversationsEv @ 21 NONAME
+ _ZN19ConversationsEngine24conversationModelUpdatedEv @ 22 NONAME
+ _ZN19ConversationsEngine24getCurrentConversationIdEv @ 23 NONAME
+ _ZN19ConversationsEngine26conversationModelPopulatedEv @ 24 NONAME
+ _ZN19ConversationsEngine26downloadOperationSupportedEi @ 25 NONAME
+ _ZN19ConversationsEngine28conversationListEntryDeletedEi @ 26 NONAME
+ _ZN19ConversationsEngine28emitConversationModelUpdatedEv @ 27 NONAME
+ _ZN19ConversationsEngine28getConversationIdFromAddressE7QString @ 28 NONAME
+ _ZN19ConversationsEngine28getConversationsSummaryModelEv @ 29 NONAME
+ _ZN19ConversationsEngine30conversationListModelPopulatedEv @ 30 NONAME
+ _ZN19ConversationsEngine30emitConversationModelPopulatedEv @ 31 NONAME
+ _ZN19ConversationsEngine30getConversationIdFromContactIdEi @ 32 NONAME
+ _ZN19ConversationsEngine31disableRegisterationForCVEventsEv @ 33 NONAME
+ _ZN19ConversationsEngine32emitOpenConversationViewIdUpdateEi @ 34 NONAME
+ _ZN19ConversationsEngine34emitConversationListModelPopulatedEv @ 35 NONAME
+ _ZN19ConversationsEngine37emitConversationListModelEntryDeletedEi @ 36 NONAME
+ _ZN19ConversationsEngine8instanceEv @ 37 NONAME
+ _ZN19ConversationsEngineC1EP7QObject @ 38 NONAME
+ _ZN19ConversationsEngineC2EP7QObject @ 39 NONAME
+ _ZN19ConversationsEngineD0Ev @ 40 NONAME
+ _ZN19ConversationsEngineD1Ev @ 41 NONAME
+ _ZN19ConversationsEngineD2Ev @ 42 NONAME
+ _ZNK19ConversationsEngine10metaObjectEv @ 43 NONAME
+ _ZTI19ConversationsEngine @ 44 NONAME
+ _ZTV19ConversationsEngine @ 45 NONAME
--- a/messagingapp/msgui/eabi/unifiededitoru.def Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/eabi/unifiededitoru.def Wed Aug 18 09:45:25 2010 +0300
@@ -22,25 +22,25 @@
_ZN20MsgUnifiedEditorView13imagesFetchedERK8QVariant @ 21 NONAME
_ZN20MsgUnifiedEditorView14addAttachmentsE11QStringList @ 22 NONAME
_ZN20MsgUnifiedEditorView14changePriorityEv @ 23 NONAME
- _ZN20MsgUnifiedEditorView14forwardMessageER18ConvergedMessageIdN16ConvergedMessage11MessageTypeE @ 24 NONAME
- _ZN20MsgUnifiedEditorView15contactsFetchedERK8QVariant @ 25 NONAME
- _ZN20MsgUnifiedEditorView15formatAddressesER5QListIP23ConvergedMessageAddressE @ 26 NONAME
- _ZN20MsgUnifiedEditorView15populateContentERK5QListI8QVariantE @ 27 NONAME
- _ZN20MsgUnifiedEditorView16createTempFolderEv @ 28 NONAME
- _ZN20MsgUnifiedEditorView16enableSendButtonEb @ 29 NONAME
- _ZN20MsgUnifiedEditorView16generateFileNameER7QString @ 30 NONAME
- _ZN20MsgUnifiedEditorView16onContentChangedEv @ 31 NONAME
- _ZN20MsgUnifiedEditorView16removeTempFolderEv @ 32 NONAME
- _ZN20MsgUnifiedEditorView16staticMetaObjectE @ 33 NONAME DATA 16
- _ZN20MsgUnifiedEditorView17onDialogDeleteMsgEP8HbAction @ 34 NONAME
- _ZN20MsgUnifiedEditorView17openDraftsMessageERK5QListI8QVariantE @ 35 NONAME
- _ZN20MsgUnifiedEditorView19getStaticMetaObjectEv @ 36 NONAME
- _ZN20MsgUnifiedEditorView19onDialogMmsSettingsEP8HbAction @ 37 NONAME
- _ZN20MsgUnifiedEditorView19onDialogSmsSettingsEP8HbAction @ 38 NONAME
- _ZN20MsgUnifiedEditorView19saveContentToDraftsEv @ 39 NONAME
- _ZN20MsgUnifiedEditorView19serviceRequestErrorEiRK7QString @ 40 NONAME
- _ZN20MsgUnifiedEditorView20activateInputBlockerEv @ 41 NONAME
- _ZN20MsgUnifiedEditorView21doDelayedConstructionEv @ 42 NONAME
+ _ZN20MsgUnifiedEditorView15contactsFetchedERK8QVariant @ 24 NONAME
+ _ZN20MsgUnifiedEditorView15formatAddressesER5QListIP23ConvergedMessageAddressE @ 25 NONAME
+ _ZN20MsgUnifiedEditorView15populateContentERK5QListI8QVariantE @ 26 NONAME
+ _ZN20MsgUnifiedEditorView16createTempFolderEv @ 27 NONAME
+ _ZN20MsgUnifiedEditorView16enableSendButtonEb @ 28 NONAME
+ _ZN20MsgUnifiedEditorView16generateFileNameER7QString @ 29 NONAME
+ _ZN20MsgUnifiedEditorView16onContentChangedEv @ 30 NONAME
+ _ZN20MsgUnifiedEditorView16removeTempFolderEv @ 31 NONAME
+ _ZN20MsgUnifiedEditorView16staticMetaObjectE @ 32 NONAME DATA 16
+ _ZN20MsgUnifiedEditorView17onDialogDeleteMsgEP8HbAction @ 33 NONAME
+ _ZN20MsgUnifiedEditorView17openDraftsMessageERK5QListI8QVariantE @ 34 NONAME
+ _ZN20MsgUnifiedEditorView19getStaticMetaObjectEv @ 35 NONAME
+ _ZN20MsgUnifiedEditorView19onDialogMmsSettingsEP8HbAction @ 36 NONAME
+ _ZN20MsgUnifiedEditorView19onDialogSmsSettingsEP8HbAction @ 37 NONAME
+ _ZN20MsgUnifiedEditorView19saveContentToDraftsEv @ 38 NONAME
+ _ZN20MsgUnifiedEditorView19serviceRequestErrorEiRK7QString @ 39 NONAME
+ _ZN20MsgUnifiedEditorView20activateInputBlockerEv @ 40 NONAME
+ _ZN20MsgUnifiedEditorView21doDelayedConstructionEv @ 41 NONAME
+ _ZN20MsgUnifiedEditorView21fetchMessageFromStoreER18ConvergedMessageIdN16ConvergedMessage11MessageTypeEi @ 42 NONAME
_ZN20MsgUnifiedEditorView22deactivateInputBlockerEv @ 43 NONAME
_ZN20MsgUnifiedEditorView22setAttachOptionEnabledENS_16TBE_AttachOptionEb @ 44 NONAME
_ZN20MsgUnifiedEditorView23handleViewExtnActivatedEP16HbListWidgetItem @ 45 NONAME
--- a/messagingapp/msgui/eabi/unifiedvieweru.def Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/eabi/unifiedvieweru.def Wed Aug 18 09:45:25 2010 +0300
@@ -1,26 +1,30 @@
EXPORTS
- _ZN13UnifiedViewer11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME
- _ZN13UnifiedViewer11qt_metacastEPKc @ 2 NONAME
- _ZN13UnifiedViewer11resizeEventEP25QGraphicsSceneResizeEvent @ 3 NONAME
- _ZN13UnifiedViewer11sendMessageERK7QStringS2_ @ 4 NONAME
- _ZN13UnifiedViewer12clearContentEv @ 5 NONAME
- _ZN13UnifiedViewer13createToolBarEv @ 6 NONAME
- _ZN13UnifiedViewer15handleFwdActionEv @ 7 NONAME
- _ZN13UnifiedViewer15populateContentEibi @ 8 NONAME
- _ZN13UnifiedViewer16staticMetaObjectE @ 9 NONAME DATA 16
- _ZN13UnifiedViewer17onDialogDeleteMsgEP8HbAction @ 10 NONAME
- _ZN13UnifiedViewer18handleDeleteActionEv @ 11 NONAME
- _ZN13UnifiedViewer19getStaticMetaObjectEv @ 12 NONAME
- _ZN13UnifiedViewerC1EiiP13QGraphicsItem @ 13 NONAME
- _ZN13UnifiedViewerC2EiiP13QGraphicsItem @ 14 NONAME
- _ZN13UnifiedViewerD0Ev @ 15 NONAME
- _ZN13UnifiedViewerD1Ev @ 16 NONAME
- _ZN13UnifiedViewerD2Ev @ 17 NONAME
- _ZNK13UnifiedViewer10metaObjectEv @ 18 NONAME
- _ZTI13UnifiedViewer @ 19 NONAME
- _ZTV13UnifiedViewer @ 20 NONAME
- _ZThn16_N13UnifiedViewerD0Ev @ 21 NONAME
- _ZThn16_N13UnifiedViewerD1Ev @ 22 NONAME
- _ZThn8_N13UnifiedViewerD0Ev @ 23 NONAME
- _ZThn8_N13UnifiedViewerD1Ev @ 24 NONAME
+ _ZN13UnifiedViewer11isForwardOkEv @ 1 NONAME
+ _ZN13UnifiedViewer11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME
+ _ZN13UnifiedViewer11qt_metacastEPKc @ 3 NONAME
+ _ZN13UnifiedViewer11resizeEventEP25QGraphicsSceneResizeEvent @ 4 NONAME
+ _ZN13UnifiedViewer11sendMessageERK7QStringS2_ @ 5 NONAME
+ _ZN13UnifiedViewer12clearContentEv @ 6 NONAME
+ _ZN13UnifiedViewer12launchEditorEN11MsgBaseView18UniEditorOperationE @ 7 NONAME
+ _ZN13UnifiedViewer13createToolBarEv @ 8 NONAME
+ _ZN13UnifiedViewer15handleFwdActionEv @ 9 NONAME
+ _ZN13UnifiedViewer15populateContentEibi @ 10 NONAME
+ _ZN13UnifiedViewer16staticMetaObjectE @ 11 NONAME DATA 16
+ _ZN13UnifiedViewer17handleReplyActionEv @ 12 NONAME
+ _ZN13UnifiedViewer17onDialogDeleteMsgEi @ 13 NONAME
+ _ZN13UnifiedViewer18handleDeleteActionEv @ 14 NONAME
+ _ZN13UnifiedViewer19getStaticMetaObjectEv @ 15 NONAME
+ _ZN13UnifiedViewer20handleReplyAllActionEv @ 16 NONAME
+ _ZN13UnifiedViewerC1EiP13QGraphicsItem @ 17 NONAME
+ _ZN13UnifiedViewerC2EiP13QGraphicsItem @ 18 NONAME
+ _ZN13UnifiedViewerD0Ev @ 19 NONAME
+ _ZN13UnifiedViewerD1Ev @ 20 NONAME
+ _ZN13UnifiedViewerD2Ev @ 21 NONAME
+ _ZNK13UnifiedViewer10metaObjectEv @ 22 NONAME
+ _ZTI13UnifiedViewer @ 23 NONAME
+ _ZTV13UnifiedViewer @ 24 NONAME
+ _ZThn16_N13UnifiedViewerD0Ev @ 25 NONAME
+ _ZThn16_N13UnifiedViewerD1Ev @ 26 NONAME
+ _ZThn8_N13UnifiedViewerD0Ev @ 27 NONAME
+ _ZThn8_N13UnifiedViewerD1Ev @ 28 NONAME
--- a/messagingapp/msgui/inc/msgbaseview.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/inc/msgbaseview.h Wed Aug 18 09:45:25 2010 +0300
@@ -54,14 +54,16 @@
*/
enum UniEditorOperation
{
- ADD_PHOTO = 0x01,
- ADD_AUDIO = 0x02,
- ADD_VIDEO = 0x04,
- ADD_VCARD = 0x08,
- ADD_OTHERS = 0x10,
- ADD_RECIPIENTS = 0x20,
- ADD_SUBJECT = 0x40,
- FORWARD_MSG = 0x80
+ ADD_PHOTO = 0x001,
+ ADD_AUDIO = 0x002,
+ ADD_VIDEO = 0x004,
+ ADD_VCARD = 0x008,
+ ADD_OTHERS = 0x010,
+ ADD_RECIPIENTS = 0x020,
+ ADD_SUBJECT = 0x040,
+ FORWARD_MSG = 0x080,
+ REPLY_MSG = 0x100,
+ REPLY_ALL_MSG = 0x200
};
signals:
--- a/messagingapp/msgui/msgapp/inc/msgcommondefines.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgapp/inc/msgcommondefines.h Wed Aug 18 09:45:25 2010 +0300
@@ -32,9 +32,6 @@
const qreal TIMESTAMP_WIDTH = 45.0; //Width for timestamp.
const qreal UNREADCOUNT_WIDTH = 40.0; //Width for unread count.
-const QString DATE_FORMAT("dd/MM"); //Date format.
-const QString TIME_FORMAT("hh:mm"); //Time format.
-
const QColor SEPARATOR_COLOR(0, 0, 0, 51); //separator color.
#endif /* MSGCOMMONDEFINES_H_ */
--- a/messagingapp/msgui/msgapp/inc/msglistviewitem.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgapp/inc/msglistviewitem.h Wed Aug 18 09:45:25 2010 +0300
@@ -34,7 +34,7 @@
class MsgListViewItem : public HbListViewItem
{
Q_OBJECT
- Q_PROPERTY(bool unReadMsg READ hasUnReadMsg WRITE setHasUnReadMsg)
+ Q_PROPERTY(bool unReadMsg READ hasUnReadMsg WRITE setHasUnReadMsg)
public:
/**
@@ -71,7 +71,15 @@
* Returns the value of mUnReadMsg
* @return bool
*/
- bool hasUnReadMsg();
+ bool hasUnReadMsg();
+
+private slots:
+
+ /*
+ * Handler for orientation changed
+ * @param orientation Qt::Orientation
+ */
+ void orientationchanged(Qt::Orientation orientation);
private:
@@ -91,6 +99,16 @@
* Sets the preview text and timestamp.
*/
void setTimestampAndPreviewText();
+
+ /*
+ * set Unread Count and frame
+ */
+ void setUnreadCountStatus();
+
+ /*
+ * set common indicator (icon/unread count)
+ */
+ void setCommonIndicator(const QString& string);
private:
/**
@@ -130,7 +148,7 @@
/**
* To display the presence indication
*/
- HbIconItem* mPresenceIndicatorItem;
+ HbIconItem* mMsgCommonIndicatorItem;
};
--- a/messagingapp/msgui/msgapp/inc/msgviewmanager.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgapp/inc/msgviewmanager.h Wed Aug 18 09:45:25 2010 +0300
@@ -261,6 +261,7 @@
int mMessageId;
QVariantList mEditorData;
+ QVariantList mViewerData;
};
#endif /* MSGVIEWMANAGER_H_ */
--- a/messagingapp/msgui/msgapp/resources/xml/msglistviewitem.css Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgapp/resources/xml/msglistviewitem.css Wed Aug 18 09:45:25 2010 +0300
@@ -69,16 +69,6 @@
text-line-count-max:2;
}
-MsgListViewItem::unreadCount[layoutName="custom"]:portrait {
- right:var(hb-param-margin-gene-middle-horizontal);
- size-policy-horizontal: fixed;
- text-align: right;
- font-variant: primary;
- text-height: var(hb-param-text-height-primary);
- text-line-count-min:1;
- text-line-count-max:1;
-}
-
MsgListViewItem[unReadMsg="true"]::timeLabel[layoutName="custom"]:portrait {
right:var(hb-param-margin-gene-right);
bottom:var(hb-param-margin-gene-bottom);
@@ -103,8 +93,18 @@
text-line-count-max:1;
}
-MsgListViewItem::presenceIndicator[layoutName="custom"]:portrait {
- right: var(hb-param-margin-gene-right);
+MsgListViewItem::unreadCount[layoutName="custom"]:portrait {
+ right:var(hb-param-margin-gene-right);
+ size-policy-horizontal: fixed;
+ min-width: 5un;
+ text-align: right;
+ font-variant: primary;
+ text-height: var(hb-param-text-height-primary);
+ text-line-count-min:1;
+ text-line-count-max:1;
+}
+
+MsgListViewItem::msgCommonIndicator[layoutName="custom"]:portrait {
size-policy-horizontal: fixed;
size-policy-vertical: fixed;
pref-width: var(hb-param-graphic-size-secondary);
@@ -112,7 +112,9 @@
aspect-ratio: ignore;
}
+
/*Landscape mode*/
+
MsgListViewItem::newMsgIndicator[layoutName="custom"]:landscape {
left:-var(hb-param-margin-view-left);
size-policy-horizontal: fixed;
@@ -167,6 +169,7 @@
MsgListViewItem::unreadCount[layoutName="custom"]:landscape {
right:var(hb-param-margin-gene-middle-horizontal);
size-policy-horizontal: fixed;
+ min-width: 5un;
text-align: right;
font-variant: primary;
text-height: var(hb-param-text-height-primary);
@@ -174,8 +177,7 @@
text-line-count-max:1;
}
-MsgListViewItem::presenceIndicator[layoutName="custom"]:landscape {
- right: var(hb-param-margin-gene-middle-horizontal);
+MsgListViewItem::msgCommonIndicator[layoutName="custom"]:landscape {
size-policy-horizontal: fixed;
size-policy-vertical: fixed;
pref-width: var(hb-param-graphic-size-secondary);
--- a/messagingapp/msgui/msgapp/resources/xml/msglistviewitem.widgetml Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgapp/resources/xml/msglistviewitem.widgetml Wed Aug 18 09:45:25 2010 +0300
@@ -13,12 +13,11 @@
<meshitem src="previewLabel" srcEdge="LEFT" dst="newMsgIndicator" dstEdge="RIGHT" />
<meshitem src="previewLabel" srcEdge="RIGHT" dst="timeLabel" dstEdge="LEFT" />
- <meshitem src="unreadCount" srcEdge="TOP" dst="addressLabel" dstEdge="TOP" />
- <meshitem src="unreadCount" srcEdge="RIGHT" dst="presenceIndicator" dstEdge="LEFT" />
- <meshitem src="unreadCount" srcEdge="BOTTOM" dst="addressLabel" dstEdge="BOTTOM" />
-
- <meshitem src="presenceIndicator" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
- <meshitem src="presenceIndicator" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+ <meshitem src="unreadCount" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
+ <meshitem src="unreadCount" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+
+ <meshitem src="msgCommonIndicator" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
+ <meshitem src="msgCommonIndicator" srcEdge="RIGHT" dst="unreadCount" dstEdge="RIGHT" />
<meshitem src="timeLabel" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
<meshitem src="timeLabel" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
@@ -32,12 +31,12 @@
<meshitem src="addressLabel" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
<meshitem src="addressLabel" srcEdge="RIGHT" dst="unreadCount" dstEdge="LEFT" />
- <meshitem src="unreadCount" srcEdge="RIGHT" dst="presenceIndicator" dstEdge="LEFT" />
+ <meshitem src="unreadCount" srcEdge="RIGHT" dst="" dstEdge="CENTERH" />
<meshitem src="unreadCount" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
- <meshitem src="presenceIndicator" srcEdge="RIGHT" dst="" dstEdge="CENTERH" />
- <meshitem src="presenceIndicator" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
-
+ <meshitem src="msgCommonIndicator" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
+ <meshitem src="msgCommonIndicator" srcEdge="RIGHT" dst="unreadCount" dstEdge="RIGHT" />
+
<meshitem src="previewLabel" srcEdge="LEFT" dst="" dstEdge="CENTERH" />
<meshitem src="previewLabel" srcEdge="RIGHT" dst="timeLabel" dstEdge="LEFT" />
<meshitem src="previewLabel" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
--- a/messagingapp/msgui/msgapp/resources/xml/msglistviewitem_color.css Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgapp/resources/xml/msglistviewitem_color.css Wed Aug 18 09:45:25 2010 +0300
@@ -47,7 +47,7 @@
color: var(qtc_list_item_pressed);
}
-MsgListViewItem::presenceIndicator {
+MsgListViewItem::msgCommonIndicator {
color: var(qtc_list_item_title_normal);
}
--- a/messagingapp/msgui/msgapp/src/draftslistview.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/draftslistview.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -65,7 +65,7 @@
// Confirmation note
#define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
-#define LOC_DELETE_ALL_DRAFTS hbTrId("txt_messaging_dialog_delate_all_drafts")
+#define LOC_DELETE_ALL_DRAFTS hbTrId("txt_messaging_dialog_delete_all_drafts")
//---------------------------------------------------------------
// DraftsListView::DraftsListView
--- a/messagingapp/msgui/msgapp/src/main.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/main.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -110,7 +110,7 @@
app.setApplicationName(LOC_TITLE);
- #ifdef _DEBUG_TRACES_
+#ifdef _DEBUG_TRACES_
//Debug Logs
QFile ofile;
if (ofile.exists(debugFileName))
--- a/messagingapp/msgui/msgapp/src/msglistview.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/msglistview.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -66,7 +66,6 @@
#define LOC_SETTINGS hbTrId("txt_messaging_opt_settings")
#define LOC_TB_VIEW_EXTN hbTrId("txt_messaging_button_view")
-#define LOC_TB_NEW_MESSAGE hbTrId("txt_messaging_button_new_message")
#define LOC_TB_EXTN_DRAFTS hbTrId("txt_messaging_button_drafts")
#define LOC_TB_EXTN_CONVERSATIONS hbTrId("txt_messaging_button_conversations")
--- a/messagingapp/msgui/msgapp/src/msglistviewitem.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/msglistviewitem.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -26,7 +26,10 @@
#include <HbFrameItem>
#include <HbIconItem>
#include <QCoreApplication>
+#include <QStringBuilder>
#include <HbEvent>
+#include <HbInstance>
+#include <HbExtendedLocale>
#include "msgcommondefines.h"
#include "conversationsengine.h"
@@ -38,17 +41,22 @@
#define LOC_RINGING_TONE hbTrId("txt_messaging_dpopinfo_ringing_tone")
#define LOC_MSG_SEND_FAILED hbTrId("txt_messaging_list_message_sending_failed")
#define LOC_MSG_OUTGOING hbTrId("txt_messaging_list_outgoing_message")
-#define LOC_MSG_RESEND_AT hbTrId("Resend at ")
+#define LOC_MSG_RESEND_AT hbTrId("txt_messaging_list_listview_resend_at_time")
#define LOC_BUSINESS_CARD hbTrId("txt_messaging_list_business_card")
#define LOC_CALENDAR_EVENT hbTrId("txt_messaging_list_calendar_event")
#define LOC_UNSUPPORTED_MSG_TYPE hbTrId("txt_messaging_list_unsupported_message_type")
#define LOC_RECEIVED_FILES hbTrId("txt_messaging_list_received_files")
+#define LOC_MULTIMEDIA_MSG hbTrId("txt_messaging_list_multimedia_message")
const QString NEW_ITEM_FRAME("qtg_fr_list_new_item");
const QString BT_ICON("qtg_large_bluetooth");
const QString MSG_OUTGOING_ICON("qtg_mono_outbox");
const QString MSG_FAILED_ICON("qtg_mono_failed");
+// @see hbi18ndef.h
+static const char DATE_FORMAT[] = r_qtn_date_short_with_zero;
+static const char TIME_FORMAT[] = r_qtn_time_usual_with_zero;
+
//---------------------------------------------------------------
// MsgListViewItem::MsgListViewItem
// Constructor
@@ -61,7 +69,7 @@
mTimestampItem(NULL),
mPreviewLabelItem(NULL),
mUnreadCountItem(NULL),
- mPresenceIndicatorItem(NULL)
+ mMsgCommonIndicatorItem(NULL)
{
}
@@ -99,35 +107,6 @@
}
mAddressLabelItem->setText(contactName);
- // Unread message count
- int unreadCount = modelIndex().data(UnreadCount).toInt();
-
- if (unreadCount > 0)
- {
- QString unRead(tr("(%n)", "", unreadCount));
- mUnreadCountItem->setText(unRead);
- if(!mUnReadMsg)
- {
- mUnReadMsg = true;
- mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(NEW_ITEM_FRAME);
- repolish();
- // Needed for colour group changes to be visible
- QCoreApplication::postEvent(this, new HbEvent(HbEvent::ThemeChanged));
- }
- }
- else
- {
- mUnreadCountItem->setText(QString());
- if(mUnReadMsg)
- {
- mUnReadMsg = false;
- mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(QString());
- repolish();
- // Needed for colour group changes to be visible
- QCoreApplication::postEvent(this, new HbEvent(HbEvent::ThemeChanged));
- }
- }
-
HbListViewItem::updateChildItems();
}
@@ -151,8 +130,8 @@
HbStyle::setItemName(mPreviewLabelItem, "previewLabel");
}
if (!mUnreadCountItem) {
- mUnreadCountItem = new HbTextItem(this);
- HbStyle::setItemName(mUnreadCountItem, "unreadCount");
+ mUnreadCountItem = new HbTextItem(this);
+ HbStyle::setItemName(mUnreadCountItem, "unreadCount");
}
if (!mNewMsgIndicatorItem) {
mNewMsgIndicatorItem = new HbFrameItem(this);
@@ -160,11 +139,19 @@
mNewMsgIndicatorItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
}
- if (!mPresenceIndicatorItem) {
- mPresenceIndicatorItem = new HbIconItem(this);
- HbStyle::setItemName(mPresenceIndicatorItem, "presenceIndicator");
+ if (!mMsgCommonIndicatorItem) {
+ mMsgCommonIndicatorItem = new HbIconItem(this);
+ HbStyle::setItemName(mMsgCommonIndicatorItem, "msgCommonIndicator");
}
+ mUnreadCountItem->hide();
+ mMsgCommonIndicatorItem->hide();
+
+ HbMainWindow *mainWindow = hbInstance->allMainWindows()[0];
+
+ connect(mainWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
+ SLOT(orientationchanged(Qt::Orientation)), Qt::UniqueConnection);
}
+
//---------------------------------------------------------------
// MsgListViewItem::defaultPreviewText
// @see header
@@ -193,8 +180,6 @@
else {
previewText = LOC_UNSUPPORTED_MSG_TYPE;
}
-
- mPresenceIndicatorItem->setVisible(false);
}
else if (msgType == ConvergedMessage::BT) {
@@ -206,14 +191,15 @@
else {
previewText = bodyText;
}
-
- mPresenceIndicatorItem->setIconName(BT_ICON);
- mPresenceIndicatorItem->setVisible(true);
+
+ setCommonIndicator(BT_ICON);
}
else {
// All message types except BIO & BT.
previewText = modelIndex().data(BodyText).toString();
- mPresenceIndicatorItem->setVisible(false);
+ if (previewText.isEmpty() && ConvergedMessage::Mms == msgType) {
+ previewText = LOC_MULTIMEDIA_MSG;
+ }
}
return previewText;
}
@@ -228,12 +214,14 @@
// Get timestamp
QDateTime dateTime;
dateTime.setTime_t(modelIndex().data(TimeStamp).toUInt());
- QString dateString;
+
+ HbExtendedLocale locale = HbExtendedLocale::system();
+ QString dateTimeString;
if (dateTime.date() == QDateTime::currentDateTime().date()) {
- dateString = MsgUtils::dateTimeToString(dateTime, TIME_FORMAT);
+ dateTimeString = locale.format(dateTime.time(), TIME_FORMAT);
}
else {
- dateString = MsgUtils::dateTimeToString(dateTime, DATE_FORMAT);
+ dateTimeString = locale.format(dateTime.date(), DATE_FORMAT);
}
// Set preview text & time based on direction
@@ -243,17 +231,22 @@
int msgDirection = modelIndex().data(Direction).toInt();
QString previewText;
if (ConvergedMessage::Incoming == msgDirection) {
- previewText = defaultPreviewText(msgType, msgSubType);
+ if( ConvergedMessage::BT != msgType)
+ {
+ setUnreadCountStatus();
+ }
+ previewText = defaultPreviewText(msgType, msgSubType);
}
else if (msgDirection == ConvergedMessage::Outgoing) {
-
+
+ setUnreadCountStatus();
+
switch (sendState) {
case ConvergedMessage::Resend:
{
- previewText = LOC_MSG_RESEND_AT + dateString;
- dateString = QString();
- mPresenceIndicatorItem->setIconName(MSG_OUTGOING_ICON);
- mPresenceIndicatorItem->setVisible(true);
+ previewText = LOC_MSG_RESEND_AT + dateTimeString;
+ dateTimeString = QString();
+ setCommonIndicator(MSG_OUTGOING_ICON);
break;
}
case ConvergedMessage::Sending:
@@ -261,21 +254,24 @@
case ConvergedMessage::Scheduled:
case ConvergedMessage::Waiting:
{
- previewText = QString(LOC_MSG_OUTGOING);
- mPresenceIndicatorItem->setIconName(MSG_OUTGOING_ICON);
- mPresenceIndicatorItem->setVisible(true);
+ previewText = QString(LOC_MSG_OUTGOING);
+ setCommonIndicator(MSG_OUTGOING_ICON);
break;
}
case ConvergedMessage::Failed:
{
previewText = QString(LOC_MSG_SEND_FAILED);
- mPresenceIndicatorItem->setIconName(MSG_FAILED_ICON);
- mPresenceIndicatorItem->setVisible(true);
+ setCommonIndicator(MSG_FAILED_ICON);
break;
}
default:
{
- // Successful case
+ // Successful case
+ if( ConvergedMessage::BT != msgType)
+ {
+ setUnreadCountStatus();
+ }
+
previewText = defaultPreviewText(msgType, msgSubType);
break;
}
@@ -284,7 +280,7 @@
previewText.replace(QChar::ParagraphSeparator, QChar::LineSeparator);
previewText.replace('\r', QChar::LineSeparator);
mPreviewLabelItem->setText(previewText);
- mTimestampItem->setText(dateString);
+ mTimestampItem->setText(dateTimeString);
}
//---------------------------------------------------------------
@@ -317,4 +313,68 @@
return mUnReadMsg;
}
+//---------------------------------------------------------------
+// MsgListViewItem::setUnreadCountStatus
+// @see header file
+//---------------------------------------------------------------
+void MsgListViewItem::setUnreadCountStatus()
+ {
+ // Unread message count
+ int unreadCount = modelIndex().data(UnreadCount).toInt();
+
+ if (unreadCount > 0)
+ {
+ QString unRead(tr("(%n)", "", unreadCount));
+
+ mMsgCommonIndicatorItem->hide();
+ mUnreadCountItem->setText(unRead);
+ mUnreadCountItem->show();
+
+ if (!mUnReadMsg)
+ {
+ mUnReadMsg = true;
+ mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(
+ NEW_ITEM_FRAME);
+ repolish();
+ // Needed for colour group changes to be visible
+ QCoreApplication::postEvent(this, new HbEvent(
+ HbEvent::ThemeChanged));
+ }
+ }
+ else
+ {
+ if (mUnReadMsg)
+ {
+ mUnReadMsg = false;
+ mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(
+ QString());
+ repolish();
+ // Needed for colour group changes to be visible
+ QCoreApplication::postEvent(this, new HbEvent(
+ HbEvent::ThemeChanged));
+ }
+ }
+ }
+
+//---------------------------------------------------------------
+// MsgListViewItem::setCommonIndicator
+// @see header file
+//---------------------------------------------------------------
+void MsgListViewItem::setCommonIndicator(const QString& string)
+ {
+ mUnreadCountItem->hide();
+ mMsgCommonIndicatorItem->setIconName(string);
+ mMsgCommonIndicatorItem->show();
+ }
+
+//---------------------------------------------------------------
+// MsgListViewItem::orientationchanged
+// @see header file
+//---------------------------------------------------------------
+void MsgListViewItem::orientationchanged(Qt::Orientation orientation)
+{
+ Q_UNUSED(orientation)
+ repolish();
+}
+
//EOF
--- a/messagingapp/msgui/msgapp/src/msgviewmanager.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/msgviewmanager.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -179,10 +179,29 @@
completeServiceRequest();
}
else {
- //switch to clv.
+ //switch to previous view.
QVariantList param;
- param << MsgBaseView::CLV;
+ param << mPreviousView;
param << MsgBaseView::UNIEDITOR;
+
+ if(mPreviousView == MsgBaseView::CV) {
+ param << mConversationId;
+ }
+ else if(mPreviousView == MsgBaseView::UNIVIEWER){
+ qint32 contactId = mViewerData.at(0).toLongLong();
+ qint32 messageId = mViewerData.at(1).toInt();
+ int msgCount = mViewerData.at(2).toInt();
+
+ param << contactId;
+ param << messageId;
+ param << msgCount;
+ }
+ else if(mPreviousView == MsgBaseView::UNIEDITOR){
+ //TODO: Remove error handling once Audio fetcher
+ //becomes dialog
+ param[0] = MsgBaseView::CLV;
+ }
+
switchView(param);
}
@@ -256,16 +275,15 @@
}
case MsgBaseView::CLV:
{
- switchToClv(data);
- break;
- }
+ switchToClv(data);
+ break;
+ }
- case MsgBaseView::CV:
- {
-
- switchToCv(data);
- break;
- }
+ case MsgBaseView::CV:
+ {
+ switchToCv(data);
+ break;
+ }
case MsgBaseView::DLV:
{
@@ -507,7 +525,7 @@
mConversationId = -1;
return;
}
-
+
//delete UniEditor
if (mUniEditor)
{
@@ -540,11 +558,13 @@
mMainWindow->addView(mListView);
}
- mMainWindow->setCurrentView(mListView);
+ mMainWindow->setCurrentView(mListView,true,Hb::ViewSwitchSequential);
}
void MsgViewManager::switchToCv(const QVariantList& data)
{
+ QCRITICAL_WRITE("MsgViewManager::switchToCv start.");
+
//switch to CV.
mCurrentView = MsgBaseView::CV;
mPreviousView = data.at(1).toInt();
@@ -565,6 +585,10 @@
//delete UniEditor
if (mUniEditor)
{
+ // Save to drafts if CV is launched via service
+ if (mPreviousView == MsgBaseView::SERVICE) {
+ mUniEditor->saveContentToDrafts();
+ }
appendViewToBeDeleted(mUniEditor);
mUniEditor = NULL;
}
@@ -605,7 +629,7 @@
// this case comes when a message is deleted from
// Unified viewer set curent view as conversation view
// and return
- mMainWindow->setCurrentView(mConversationView);
+ mMainWindow->setCurrentView(mConversationView,true,Hb::ViewSwitchSequential);
// publish already opened conversation's id
mConversationView->setPSCVId(true);
@@ -633,11 +657,20 @@
}
mConversationView->openConversation(conversationId);
- mMainWindow->setCurrentView(mConversationView);
+ mMainWindow->setCurrentView(mConversationView,true,Hb::ViewSwitchSequential);
+
+ QCRITICAL_WRITE("MsgViewManager::switchToCv end.");
}
void MsgViewManager::switchToDlv(const QVariantList& data)
{
+ //delete UniEditor
+ if (mUniEditor)
+ {
+ appendViewToBeDeleted(mUniEditor);
+ mUniEditor = NULL;
+ }
+
//switch to DLV.
mCurrentView = MsgBaseView::DLV;
mPreviousView = data.at(1).toInt();
@@ -650,11 +683,13 @@
mMainWindow->addView(mDraftsListView);
}
- mMainWindow->setCurrentView(mDraftsListView);
+ mMainWindow->setCurrentView(mDraftsListView,true,Hb::ViewSwitchSequential);
}
void MsgViewManager::switchToUniEditor(const QVariantList& data)
{
+ QCRITICAL_WRITE("MsgViewManager::switchToUniEditor start.");
+
/**
* Editor is tried to open again before exiting the previously
* opened editor. Multi taping in DLV or Forward.
@@ -722,7 +757,9 @@
}
}
- mMainWindow->setCurrentView(mUniEditor);
+ mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential);
+
+ QCRITICAL_WRITE("MsgViewManager::switchToUniEditor end.");
}
void MsgViewManager::switchToUniViewer(const QVariantList& data)
@@ -735,6 +772,15 @@
return;
}
+ if (mUniEditor)
+ {
+ appendViewToBeDeleted(mUniEditor);
+ mUniEditor = NULL;
+ }
+
+ //Clear the old viewer data
+ mViewerData.clear();
+
mCurrentView = MsgBaseView::UNIVIEWER;
mPreviousView = data.at(1).toInt();
@@ -743,10 +789,14 @@
qint32 contactId = data.at(2).toLongLong();
qint32 messageId = data.at(3).toInt();
int msgCount = data.at(4).toInt();
- int canForwardMessage = data.at(5).toInt();
+ //Save the viewer data to be used when u come back from Editor
+ mViewerData << contactId;
+ mViewerData << messageId;
+ mViewerData << msgCount;
+
if (!mUniViewer) {
- mUniViewer = new UnifiedViewer(messageId, canForwardMessage);
+ mUniViewer = new UnifiedViewer(messageId);
mUniViewer->setNavigationAction(mBackAction);
mMainWindow->addView(mUniViewer);
connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this,
@@ -760,30 +810,50 @@
mConversationView->setPSCVId(false);
}
- mMainWindow->setCurrentView(mUniViewer);
+ mMainWindow->setCurrentView(mUniViewer,true,Hb::ViewSwitchSequential);
}
void MsgViewManager::switchToMsgSettings(const QVariantList& data)
{
- mCurrentView = MsgBaseView::MSGSETTINGS;
- mPreviousView = data.at(1).toInt();
-
- if (!mSettingsView) {
+ int previousView = data.at(1).toInt();
+
+ MsgSettingsView::SettingsView view = MsgSettingsView::DefaultView;
+ if (previousView == MsgBaseView::UNIEDITOR || previousView
+ == MsgBaseView::CV)
+ {
+ view = (MsgSettingsView::SettingsView)data.at(2).toInt();
+ }
- MsgSettingsView::SettingsView view = MsgSettingsView::DefaultView;
- if (mPreviousView == MsgBaseView::UNIEDITOR || mPreviousView
- == MsgBaseView::CV)
- {
- view = (MsgSettingsView::SettingsView)data.at(2).toInt();
- }
+ //launch settings service
+ QList<QVariant> args;
+ QString serviceName("messagesettings");
+ QString interfaceName("com.nokia.symbian.IMessageSettings");
+ QString operation("launchSettings(int)");
+ XQAiwRequest* request;
+ XQApplicationManager appManager;
+ request = appManager.create(serviceName, interfaceName, operation, true); //embedded
+ if ( request == NULL )
+ {
+ return;
+ }
+
+ args << view;
- mSettingsView = new MsgSettingsView(view);
- mSettingsView->setNavigationAction(mBackAction);
- mMainWindow->addView(mSettingsView);
- mMainWindow->setCurrentView(mSettingsView);
- }
- if(mPreviousView==MsgBaseView::CV && mConversationView){
+ request->setArguments(args);
+
+ if(previousView==MsgBaseView::CV && mConversationView){
mConversationView->setPSCVId(false);
}
+
+ if(!request->send())
+ {
+ QDEBUG_WRITE("launchSettings failed")
+ }
+ delete request;
+
+
+ if(previousView==MsgBaseView::CV && mConversationView){
+ mConversationView->setPSCVId(true);
+ }
}
void MsgViewManager::handleDefault(const QVariantList& data)
@@ -804,28 +874,28 @@
case MsgBaseView::CLV:
{
if (mListView)
- mMainWindow->setCurrentView(mListView);
+ mMainWindow->setCurrentView(mListView,true,Hb::ViewSwitchSequential);
break;
}
case MsgBaseView::CV:
{
if (mConversationView)
- mMainWindow->setCurrentView(mConversationView);
+ mMainWindow->setCurrentView(mConversationView,true,Hb::ViewSwitchSequential);
break;
}
case MsgBaseView::DLV:
{
if (mDraftsListView)
- mMainWindow->setCurrentView(mDraftsListView);
+ mMainWindow->setCurrentView(mDraftsListView,true,Hb::ViewSwitchSequential);
break;
}
case MsgBaseView::UNIEDITOR:
{
if (mServiceRequest) {
- mMainWindow->setCurrentView(mUniEditor);
+ mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential);
}
else {
- mMainWindow->setCurrentView(mUniEditor);
+ mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential);
}
break;
}
@@ -894,7 +964,7 @@
}
mUniViewer->populateContent(msgId, true, -1);
- mMainWindow->setCurrentView(mUniViewer);
+ mMainWindow->setCurrentView(mUniViewer,true,Hb::ViewSwitchSequential);
}
// ----------------------------------------------------------------------------
@@ -966,9 +1036,11 @@
// ----------------------------------------------------------------------------
void MsgViewManager::populateUniEditorAfterViewReady(const QVariantList& editorData)
{
+ QCRITICAL_WRITE("MsgViewManager::populateUniEditorAfterViewReady start.");
//Save the editor data and use it in ViewReady handler
mEditorData = editorData;
connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(populateUniEditorView()));
+ QCRITICAL_WRITE("MsgViewManager::populateUniEditorAfterViewReady end.");
}
// ----------------------------------------------------------------------------
@@ -977,6 +1049,7 @@
// ----------------------------------------------------------------------------
void MsgViewManager::populateUniEditorView()
{
+ QCRITICAL_WRITE("MsgViewManager::populateUniEditorView start.");
if (mUniEditor)
{
mUniEditor->openDraftsMessage(mEditorData);
@@ -985,6 +1058,7 @@
disconnect(mMainWindow, SIGNAL(viewReady()), this,
SLOT(populateUniEditorView()));
+ QCRITICAL_WRITE("MsgViewManager::populateUniEditorView end.");
}
// ----------------------------------------------------------------------------
@@ -1076,7 +1150,7 @@
}
mMainWindow->addView(mAudioFetcherView);
- mMainWindow->setCurrentView(mAudioFetcherView);
+ mMainWindow->setCurrentView(mAudioFetcherView,true,Hb::ViewSwitchSequential);
}
// ----------------------------------------------------------------------------
@@ -1135,7 +1209,8 @@
// set the current view
mCurrentView = MsgBaseView::UNIEDITOR;
- mMainWindow->setCurrentView(mUniEditor);
+ mPreviousView =MsgBaseView::CLV;
+ mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential);
}
// ----------------------------------------------------------------------------
--- a/messagingapp/msgui/msgaudiofetcher/inc/msgaudioselectionengine.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgaudiofetcher/inc/msgaudioselectionengine.h Wed Aug 18 09:45:25 2010 +0300
@@ -27,7 +27,6 @@
#include <mdccommon.h>
#include <mdeitem.h>
#include <mdeobject.h>
-#include <e32base.h>
#include <QObject>
#include <QStringList>
@@ -36,8 +35,7 @@
/**
* This class is used for quering tones from mde.
*/
-class MsgAudioSelectionEngine : public QObject,
- public CBase,
+class MsgAudioSelectionEngine : public QObject,
public MMdESessionObserver,
public MMdEQueryObserver,
public MMdEObjectObserver,
--- a/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherview.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherview.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -25,6 +25,8 @@
#include "msgaudiofetcherwidget.h"
#include "convergedmessage.h"
+#define LOC_SELECT_SOUND hbTrId("txt_messaging_title_select_a_sound")
+
MsgAudioFetcherView::MsgAudioFetcherView(const QVariantList& data) :
message(NULL)
{
@@ -70,7 +72,7 @@
mToolBarRightAction = new HbAction(this);
mToolBarRightAction->setObjectName("rightAction");
//TODO: need localized string
- mToolBarRightAction->setText(hbTrId("Select"));
+ mToolBarRightAction->setText(LOC_SELECT_SOUND);
mToolBarRightAction->setEnabled(false);
toolBar()->addAction(mToolBarRightAction);
--- a/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherwidget.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherwidget.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -33,7 +33,7 @@
MsgAudioFetcherWidget::MsgAudioFetcherWidget()
- : HbWidget(this),
+ : HbWidget(NULL),
mLabel(0),
mListView(0),
mLayout(0),
--- a/messagingapp/msgui/msgaudiofetcher/src/msgaudioselectionengine.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudioselectionengine.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -29,7 +29,7 @@
// CONSTANTS
_LIT( KAmrMime, "audio/amr" );
-MsgAudioSelectionEngine::MsgAudioSelectionEngine()
+MsgAudioSelectionEngine::MsgAudioSelectionEngine():iQuery(NULL)
{
}
@@ -43,7 +43,7 @@
void MsgAudioSelectionEngine::CreateMetaDataSession()
{
- TRAP_IGNORE(iSession = CMdESession::NewL(*this));
+ QT_TRAP_THROWING(iSession = CMdESession::NewL(*this));
}
@@ -100,7 +100,7 @@
if (iSessionOpen)
{
TUint32 notificationType = ENotifyAdd | ENotifyModify | ENotifyRemove;
- User::LeaveIfNull(iSession);
+ q_check_ptr(iSession);
CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL();
iSession->AddObjectObserverL(*this, 0, notificationType, &defNS);
iSession->AddObjectPresentObserverL(*this);
@@ -201,13 +201,13 @@
{
if (!iSession || !iSessionOpen)
{
- User::Leave(KErrDisconnected);
+ qt_symbian_throwIfError (KErrDisconnected);
}
}
CMdEPropertyDef& MsgAudioSelectionEngine::PropertyDefL(TInt aAttr)
{
- User::LeaveIfNull(iSession);
+ q_check_ptr(iSession);
return PropertyDefL(iSession, aAttr);
}
@@ -253,7 +253,7 @@
}
else
{
- User::Leave(KErrNotSupported);
+ qt_symbian_throwIfError(KErrNotSupported);
}
return objectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty);
--- a/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -90,7 +90,10 @@
HBufC* filePath = XQConversions::qStringToS60Desc(file);
if (filePath)
{
- CleanupStack::PushL(filePath);
+ TMsgMediaType mediaType = EMsgMediaUnknown;
+ TUint32 mediaProtection = EFileProtNoProtection;
+
+ QT_TRAP_THROWING(CleanupStack::PushL(filePath);
CMmsConformance* mmsConformance = CMmsConformance::NewL();
mmsConformance->CheckCharacterSet(EFalse);
@@ -111,8 +114,17 @@
TMmsConformance conformance = mmsConformance->MediaConformance(*info);
iConfStatus = conformance.iConfStatus;
- CleanupStack::PopAndDestroy(4);
+ mediaType = info->MediaType();
+ mediaProtection = info->Protection();
+ delete info;
+
+ CleanupStack::PopAndDestroy(4));
+ // TODO: Remove this check once Video support is provided in UniEditor.
+ if (mediaType == EMsgMediaVideo)
+ {
+ return EInsertNotSupported;
+ }
// In "free" mode user can insert images that are larger by dimensions than allowed by conformance
if (iCreationMode != EMmsCreationModeRestricted)
@@ -125,8 +137,8 @@
// If user answers yes to Guided mode confirmation query he/she moves to free mode
if ( (iConfStatus & i) && ! (iConfStatus & j))
{
- if (iCreationMode == EMmsCreationModeFree || info->Protection()
- & EFileProtSuperDistributable)
+ if (iCreationMode == EMmsCreationModeFree ||
+ mediaProtection & EFileProtSuperDistributable)
{
// SuperDistribution not checked here
// Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
@@ -156,7 +168,7 @@
if(showNote)
{
// For protected objects.
- if (EFileProtNoProtection != info->Protection())
+ if (EFileProtNoProtection != mediaProtection)
{
showPopup(INSERT_PROTECTED_ERROR);
}
@@ -165,13 +177,11 @@
showPopup(INSERT_ERROR);
}
}
-
return EInsertNotSupported;
- }
- delete info;
+ }
}
QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert end");
- return EInsertSuccess;
+ return EInsertSuccess;
}
// ---------------------------------------------------------
@@ -267,10 +277,6 @@
//
void MmsConformanceCheck::showPopup(const QString& text)
{
- HbNotificationDialog* dlg = new HbNotificationDialog();
- dlg->setFocusPolicy(Qt::NoFocus);
- dlg->setAttribute(Qt::WA_DeleteOnClose, true);
- dlg->setText(text);
- dlg->show();
+ HbMessageBox::information(text, 0, 0, HbMessageBox::Ok);
}
--- a/messagingapp/msgui/msguiutils/src/msgmediautil.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msguiutils/src/msgmediautil.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -16,9 +16,14 @@
*/
#include <MsgMediaResolver.h>
#include <xqconversions.h>
+#include <HbExtendedLocale>
+#include <QTime>
#include "msgmediautil.h"
+// @see hbi18ndef.h
+static const char TIME_FORMAT[] = r_qtn_time_durat_min_sec_with_zero;
+
//---------------------------------------------------------------
// MsgMediaUtil::MsgMediaUtil
// Constructor
@@ -43,32 +48,21 @@
//---------------------------------------------------------------
QString MsgMediaUtil::mediaDuration(const QString& mediaFile)
{
- QString formattedDuration(" ");
+ QString formattedDuration;
HBufC *name = XQConversions::qStringToS60Desc(mediaFile);
TInt duration = 0;
TRAPD(error, duration = mediaDurationL(*name));
delete name;
- if ( error )
+ if ( error || duration <= 0)
return formattedDuration;
-
- int sec_duration = duration / 1000;
- int hour_component = sec_duration / (60*60);
- int min_component = (sec_duration - (hour_component*60*60))/60;
- int sec_component = (sec_duration - (hour_component*60*60) - (min_component*60));
-
- if( hour_component > 0)
- {
- formattedDuration = QString("%1:%2:%3").arg(hour_component, 2, 10, QChar('0')).
- arg(min_component, 2, 10, QChar('0')).arg(sec_component, 2, 10, QChar('0'));
- }
- else
- {
- formattedDuration = QString("%1:%2").arg(min_component, 2, 10, QChar('0')).
- arg(sec_component, 2, 10, QChar('0'));
- }
+ // Media duration in milliseconds.
+ QTime mediaDuration(0, 0);
+ mediaDuration = mediaDuration.addMSecs(duration);
+ HbExtendedLocale locale = HbExtendedLocale::system();
+ formattedDuration = locale.format(mediaDuration, TIME_FORMAT);
return formattedDuration;
}
--- a/messagingapp/msgui/msguiutils/src/msgsendutil.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/msguiutils/src/msgsendutil.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -33,7 +33,7 @@
{
// Load Plugins for send
mPluginLoader = new UniEditorPluginLoader(this);
- mUniEditorGenUtils = new UniEditorGenUtils();
+ mUniEditorGenUtils = q_check_ptr(new UniEditorGenUtils());
}
//---------------------------------------------------------------
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditoraudiowidget.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditoraudiowidget.h Wed Aug 18 09:45:25 2010 +0300
@@ -50,6 +50,12 @@
*/
void populate(const QString &filePath);
+ /**
+ * Overloaded from base class.
+ * @see HbPushButton
+ */
+ void setStretched(bool stretched = true);
+
signals:
/**
@@ -110,6 +116,11 @@
* Media file path.
*/
QString mMediaPath;
+
+ /**
+ * True if valid media duration else false.
+ */
+ bool mValidMediaDuration;
};
#endif //MSG_UNIFIED_EDITOR_AUDIO_WIDGET_H
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h Wed Aug 18 09:45:25 2010 +0300
@@ -79,6 +79,11 @@
* Disables char counter
*/
void disableCharCounter();
+
+ /*
+ * Enables char counter
+ */
+ void enableCharCounter();
/**
* To set focus on editable field.
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditorview.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorview.h Wed Aug 18 09:45:25 2010 +0300
@@ -112,10 +112,15 @@
const ConvergedMessage& messageDetails, bool draftMessage = false);
/**
- * Populate the editor with the forwarded message's content
+ * Populate the editor with the message's content
+ * for various cases like forward, reply, replyAll
+ * @param messageId, unique id of message in store
+ * @param messageType, sms or mms
+ * @param editorOperation, forward or reply or replyAll etc
*/
- void forwardMessage(ConvergedMessageId& messageId,
- ConvergedMessage::MessageType messageType );
+ void fetchMessageFromStore(ConvergedMessageId& messageId,
+ ConvergedMessage::MessageType messageType,
+ int editorOperation);
/**
* Create VCards for all the contacts available in the list
@@ -322,6 +327,16 @@
* @param true/false to enable/disable.
*/
void enableSendButton(bool enable);
+
+ /**
+ * This slot is triggered when vkb is about to be opened.
+ */
+ void vkbAboutToOpen();
+
+ /**
+ * This slot is triggered when vkb is about to be closed.
+ */
+ void vkbAboutToClose();
private:
HbAction* mSubjectAction;
@@ -342,7 +357,8 @@
ConvergedMessageId mOpenedMessageId;
ConvergedMessage::MessageType mmOpenedMessageType;
bool mCanSaveToDrafts;
-
+ HbAction *mAttachAction;
+
/**
* TBE's content widget
*/
--- a/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorbody.css Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorbody.css Wed Aug 18 09:45:25 2010 +0300
@@ -87,10 +87,18 @@
}
/*************************** Character Counter ******************************/
+
MsgUnifiedEditorBody::charCounter
{
- size-policy:fixed fixed;
- pref-height:-1;
- pref-width:-1;
- text-height:var(hb-param-text-height-tiny);
+ text-height:var(hb-param-text-height-tiny);
+ text-align:centre;
+ text-line-count-min: 1;
+ text-line-count-max: 1;
}
+
+MsgUnifiedEditorBody::charCounterFrame
+{
+ size-policy: fixed, fixed ;
+ pref-height: expr(var(hb-param-text-height-tiny)+2*var(hb-param-margin-gene-middle-vertical));
+ pref-width: expr(var(hb-param-text-height-tiny)*3 + 2*var(hb-param-margin-gene-middle-horizontal));
+}
--- a/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorbody.widgetml Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorbody.widgetml Wed Aug 18 09:45:25 2010 +0300
@@ -14,14 +14,12 @@
<meshitem src="textEdit" srcEdge="LEFT" dst="" dstEdge="LEFT" />
<meshitem src="textEdit" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
<meshitem src="textEdit" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
- <meshitem src="charCounter" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
- <meshitem src="charCounter" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
+
+ <meshitem src="charCounter" srcEdge="CENTERH" dst="charCounterFrame" dstEdge="CENTERH" />
+ <meshitem src="charCounter" srcEdge="CENTERV" dst="charCounterFrame" dstEdge="CENTERV" />
- <meshitem src="charCounterFrame" srcEdge="LEFT" dst="charCounter" dstEdge="LEFT" />
- <meshitem src="charCounterFrame" srcEdge="TOP" dst="charCounter" dstEdge="TOP" />
- <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="charCounter" dstEdge="RIGHT" />
- <meshitem src="charCounterFrame" srcEdge="BOTTOM" dst="charCounter" dstEdge="BOTTOM" />
+ <meshitem src="charCounterFrame" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
+ <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
</layout>
@@ -36,13 +34,11 @@
<meshitem src="textEdit" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
<meshitem src="textEdit" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
- <meshitem src="charCounter" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
- <meshitem src="charCounter" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
+ <meshitem src="charCounter" srcEdge="CENTERH" dst="charCounterFrame" dstEdge="CENTERH" />
+ <meshitem src="charCounter" srcEdge="CENTERV" dst="charCounterFrame" dstEdge="CENTERV" />
- <meshitem src="charCounterFrame" srcEdge="LEFT" dst="charCounter" dstEdge="LEFT" />
- <meshitem src="charCounterFrame" srcEdge="TOP" dst="charCounter" dstEdge="TOP" />
- <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="charCounter" dstEdge="RIGHT" />
- <meshitem src="charCounterFrame" srcEdge="BOTTOM" dst="charCounter" dstEdge="BOTTOM" />
+ <meshitem src="charCounterFrame" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
+ <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
</layout>
@@ -61,13 +57,11 @@
<meshitem src="pixmap" srcEdge="LEFT" dst="" dstEdge="LEFT" />
<meshitem src="pixmap" srcEdge="RIGHT" dst="textEdit" dstEdge="LEFT" />
- <meshitem src="charCounter" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
- <meshitem src="charCounter" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
+ <meshitem src="charCounter" srcEdge="CENTERH" dst="charCounterFrame" dstEdge="CENTERH" />
+ <meshitem src="charCounter" srcEdge="CENTERV" dst="charCounterFrame" dstEdge="CENTERV" />
- <meshitem src="charCounterFrame" srcEdge="LEFT" dst="charCounter" dstEdge="LEFT" />
- <meshitem src="charCounterFrame" srcEdge="TOP" dst="charCounter" dstEdge="TOP" />
- <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="charCounter" dstEdge="RIGHT" />
- <meshitem src="charCounterFrame" srcEdge="BOTTOM" dst="charCounter" dstEdge="BOTTOM" />
+ <meshitem src="charCounterFrame" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
+ <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
</layout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorview.css Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,8 @@
+HbGroupBox#groupBox>HbGroupBoxContentWidget::content
+{
+ top:-var(hb-param-margin-gene-middle-vertical);
+ left:0.0un;
+ bottom:0.0un;
+ right:0.0un;
+
+}
\ No newline at end of file
--- a/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -29,6 +29,7 @@
#include <HbNotificationDialog>
#include <commonphoneparser.h> // Common phone number validity checker
#include <xqconversions.h>
+#include <HbEditorInterface>
// USER INCLUDES
#include "debugtraces.h"
@@ -79,6 +80,10 @@
this, SLOT(onContentsChanged(const QString&)));
mAddressEdit->setInputMethodHints(Qt::ImhPreferNumbers);
+
+ //To allow only latin char(s) in address fields.
+ HbEditorInterface editorInterface(mAddressEdit);
+ editorInterface.setInputConstraints(HbEditorConstraintLatinAlphabetOnly);
}
MsgUnifiedEditorAddress::~MsgUnifiedEditorAddress()
@@ -270,7 +275,7 @@
// append line seperator
invalidStr.append("<br>");
invalidStr.append(invalidContacts);
- HbMessageBox::information(invalidStr);
+ HbMessageBox::information(invalidStr, 0, 0, HbMessageBox::Ok);
}
// addition operation complete, reset flags
@@ -307,8 +312,7 @@
--mExceedsMaxMmsRecipientsBy;
if(!mExceedsMaxMmsRecipientsBy)
{
- HbNotificationDialog::launchDialog(
- LOC_MMS_RECIPIENT_LIMIT_REACHED);
+ HbMessageBox::information(LOC_MMS_RECIPIENT_LIMIT_REACHED, 0, 0, HbMessageBox::Ok);
}
resetToPrevious();
}
@@ -318,8 +322,7 @@
emit contentChanged();
if(MsgUnifiedEditorMonitor::msgAddressCount() > MsgUnifiedEditorMonitor::maxMmsRecipients())
{
- HbNotificationDialog::launchDialog(
- LOC_MMS_RECIPIENT_LIMIT_REACHED);
+ HbMessageBox::information(LOC_MMS_RECIPIENT_LIMIT_REACHED, 0, 0, HbMessageBox::Ok);
resetToPrevious();
// reset monitor data
emit contentChanged();
@@ -515,7 +518,7 @@
// ----------------------------------------------------------------------------
bool MsgUnifiedEditorAddress::validateContacts()
{
- UniEditorGenUtils* genUtils = new UniEditorGenUtils;
+ UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
// sync-up map to account for user-actions on address-field
syncDeletionsToMap();
@@ -566,7 +569,7 @@
CommonPhoneParser::ESMSNumber );
// 2. if number validity fails, then perform email addr validation
- UniEditorGenUtils* genUtils = new UniEditorGenUtils;
+ UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
if(!isValid)
{ // additional check for MMS only
isValid = genUtils->IsValidEmailAddress(
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorattachment.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorattachment.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -78,7 +78,10 @@
int at_size = 0;
TMsgMediaType mediaType = EMsgMediaUnknown;
- UniEditorGenUtils* genUtils = new UniEditorGenUtils;
+
+
+ UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
+
TRAP_IGNORE(genUtils->getFileInfoL(mPath,at_size,
mMimeType,mediaType));
TRAP_IGNORE(mMaxSmsSize = genUtils->MaxSmsMsgSizeL());
--- a/messagingapp/msgui/unifiededitor/src/msgunieditoraudiowidget.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditoraudiowidget.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -37,8 +37,7 @@
// @see header file
//----------------------------------------------------------------------------
MsgUniFiedEditorAudioWidget::MsgUniFiedEditorAudioWidget(QGraphicsItem *parent) :
-HbPushButton(parent),
-mEditorUtils(0)
+HbPushButton(parent), mEditorUtils(0), mValidMediaDuration(true)
{
connect(this, SIGNAL(clicked()), this, SLOT(handleShortTap()));
connect(this, SIGNAL(longPress(QPointF)), this, SLOT(handleLongTap(QPointF)));
@@ -64,11 +63,32 @@
QFileInfo fileInfo(mMediaPath);
this->setText(fileInfo.baseName());
MsgMediaUtil mediaUtil;
- this->setAdditionalText(mediaUtil.mediaDuration(mMediaPath));
+ QString mediaDuration(mediaUtil.mediaDuration(mMediaPath));
+ if (mediaDuration.isEmpty()) {
+ mValidMediaDuration = false;
+ }
+ else {
+ mValidMediaDuration = true;
+ this->setAdditionalText(mediaDuration);
+ }
this->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft);
}
//----------------------------------------------------------------------------
+// MsgUniFiedEditorAudioWidget::setStretched
+// @see header file
+//----------------------------------------------------------------------------
+void MsgUniFiedEditorAudioWidget::setStretched(bool stretched)
+{
+ if (mValidMediaDuration) {
+ HbPushButton::setStretched(stretched);
+ }
+ else {
+ HbPushButton::setStretched(true);
+ }
+}
+
+//----------------------------------------------------------------------------
// MsgUniFiedEditorAudioWidget::handleShortTap
// @see header file
//----------------------------------------------------------------------------
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -41,6 +41,9 @@
#include <xqsharablefile.h>
#include <xqappmgr.h>
#include <xqconversions.h>
+#include <hbmessagebox.h>
+#include <hbcolorscheme.h>
+#include <QColor>
// USER INCLUDES
#include "msgunieditorbody.h"
#include "UniEditorGenUtils.h"
@@ -56,7 +59,8 @@
#include "msgunieditoraudiowidget.h"
// Constants
-const QString BACKGROUND_FRAME("qtg_fr_btn_normal");
+const QString BACKGROUND_FRAME("qtg_fr_messaging_char_count");
+const QString CHAR_COUNTER_COLOR("qtc_messaging_char_count");
const int KShowCounterLimit = 10;
const int BYTES_TO_KBYTES_FACTOR = 1024;
@@ -67,6 +71,7 @@
#define LOC_UNABLE_TO_ATTACH_ITEM hbTrId("txt_messaging_dpopinfo_unable_to_attach_item_avai")
#define LOC_PROCESSING hbTrId("txt_messaging_formlabel_loading")
#define LOC_HINT_TEXT hbTrId("txt_messaging_formlabel_enter_message_here")
+#define LOC_ATTACHED_PHOTO_SIZE hbTrId("txt_messaging_dpopinfo_attached_photo_size_is_l1")
const QString ANIMATION_ICON("qtg_anim_loading");
const QString ANIMATION_FILE(":/qtg_anim_loading.axml");
@@ -83,12 +88,8 @@
/BYTES_TO_KBYTES_FACTOR;
QString displayStr = QString(LOC_UNABLE_TO_ATTACH_ITEM)
.arg(availableSize);
- HbNotificationDialog* dlg = new HbNotificationDialog();
- dlg->setFocusPolicy(Qt::NoFocus);
- dlg->setDismissPolicy(HbPopup::TapAnywhere);
- dlg->setAttribute(Qt::WA_DeleteOnClose, true);
- dlg->setText(displayStr);
- dlg->show();
+
+ HbMessageBox::information(displayStr, 0, 0, HbMessageBox::Ok);
}
@@ -111,6 +112,7 @@
{
mTextEdit = new HbTextEdit(this);
mTextEdit->setPlaceholderText(LOC_HINT_TEXT);
+ mTextEdit->setFontSpec(HbFontSpec(HbFontSpec::Secondary));
HbStyle::setItemName(mTextEdit,"textEdit");
connect(mTextEdit, SIGNAL(contentsChanged()), this, SLOT(onTextChanged()));
@@ -119,16 +121,17 @@
mCharCounter = new HbTextItem(this);
HbStyle::setItemName(mCharCounter, "charCounter");
mCharCounter->setZValue(1.5);
- mCharCounter->setText("160(1)");
-
+
+ QColor color = HbColorScheme::color(CHAR_COUNTER_COLOR);
+ mCharCounter->setTextColor(color);
+
mBackgroundItem = new HbFrameItem(this);
HbStyle::setItemName(mBackgroundItem, "charCounterFrame");
- mBackgroundItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
+ mBackgroundItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
mBackgroundItem->frameDrawer().setFillWholeRect(true);
- mBackgroundItem->frameDrawer().setFrameGraphicsName(
- BACKGROUND_FRAME);
+ mBackgroundItem->frameDrawer().setFrameGraphicsName(BACKGROUND_FRAME);
mPluginLoader = new UniEditorPluginLoader(this);
@@ -544,11 +547,13 @@
if( mImageSize || mTextEdit->toPlainText().size() ||
mAudioSize || mVideoSize )
{
- UniEditorGenUtils* uniEditorGenUtils = new UniEditorGenUtils;
+
+ UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
+
bodysize += mImageSize + mAudioSize + mVideoSize +
- uniEditorGenUtils->UTF8Size(mTextEdit->toPlainText()) +
+ genUtils->UTF8Size(mTextEdit->toPlainText()) +
KEstimatedMimeHeaderSize + KEstimatedMmsSmilHeaderSize;
- delete uniEditorGenUtils;
+ delete genUtils;
}
return bodysize;
}
@@ -578,7 +583,7 @@
if(futureSize > MsgUnifiedEditorMonitor::maxMmsSize())
{
mTextEdit->setPlainText(mPrevBuffer);
- HbNotificationDialog::launchDialog(LOC_UNABLE_TO_ADD_CONTENT);
+ HbMessageBox::information(LOC_UNABLE_TO_ADD_CONTENT, 0, 0, HbMessageBox::Ok);
mTextEdit->setCursorPosition(mPrevBuffer.length());
return;
}
@@ -645,6 +650,10 @@
aFileName.Length() > 0)
{
mImageFile = XQConversions::s60DescToQString(aFileName);
+
+ QSize modifiedSize(QImageReader(mImageFile).size());
+ QString information = LOC_ATTACHED_PHOTO_SIZE.arg(modifiedSize.width()).arg(modifiedSize.height());
+ HbNotificationDialog::launchDialog(information);
}
else
{
@@ -674,6 +683,7 @@
mProcessingWidget->setLayout(processingLayout);
HbTextItem* processingText = new HbTextItem(LOC_PROCESSING,mProcessingWidget);
+ processingText->setFontSpec(HbFontSpec(HbFontSpec::Secondary));
processingText->setAlignment(Qt::AlignCenter);
processingLayout->addItem(processingText);
@@ -719,6 +729,45 @@
mBackgroundItem->setVisible(false);
}
+// ---------------------------------------------------------
+// MsgUnifiedEditorBody::enableCharCounter
+// ---------------------------------------------------------
+//
+void MsgUnifiedEditorBody::enableCharCounter()
+ {
+ mPluginInterface->setEncodingSettings(EFalse, ESmsEncodingNone,
+ mCharSupportType);
+
+ TInt numOfRemainingChars;
+ TInt numOfPDUs;
+ TBool unicodeMode;
+ TSmsEncoding alternativeEncodingType;
+ QString string = mTextEdit->toPlainText();
+ mPluginInterface->getNumPDUs(string,
+ numOfRemainingChars, numOfPDUs, unicodeMode,
+ alternativeEncodingType);
+
+ //Save the unicode value returned
+ mUnicode = unicodeMode;
+
+ //Set char counter value
+ QString display = QString("%1(%2)").arg(numOfRemainingChars).arg(
+ numOfPDUs);
+ mCharCounter->setText(display);
+
+ if (numOfPDUs > 1 || numOfRemainingChars <= KShowCounterLimit)
+ {
+ mCharCounter->setVisible(true);
+ mBackgroundItem->setVisible(true);
+ }
+ else
+ {
+ mCharCounter->setVisible(false);
+ mBackgroundItem->setVisible(false);
+ }
+
+ }
+
//---------------------------------------------------------------
// MsgUnifiedEditorBody :: setFocus
// @see header file
--- a/messagingapp/msgui/unifiededitor/src/msgunieditormonitor.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditormonitor.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -52,9 +52,9 @@
MsgUnifiedEditorMonitor::MsgUnifiedEditorMonitor(QObject* parent) :
QObject(parent),
mSkipNote(false)
-{
- init();
- mUniEditorGenUtils = new UniEditorGenUtils;
+{
+ mUniEditorGenUtils = q_check_ptr( new UniEditorGenUtils);
+ init();
}
//---------------------------------------------------------------
@@ -78,18 +78,14 @@
mSubjectSize = 0;
mMsgCurrAddressCount = 0;
- UniEditorGenUtils* uniEditorGenUtils = new UniEditorGenUtils;
-
mMaxMmsSize = KDefaultMaxSize;
- TRAP_IGNORE(mMaxMmsSize = uniEditorGenUtils->MaxMmsMsgSizeL());
+ TRAP_IGNORE(mMaxMmsSize = mUniEditorGenUtils->MaxMmsMsgSizeL());
mMaxSmsRecipients = KDefaultSmsRecipients;
- TRAP_IGNORE(mMaxSmsRecipients = uniEditorGenUtils->MaxSmsRecipientsL());
+ TRAP_IGNORE(mMaxSmsRecipients = mUniEditorGenUtils->MaxSmsRecipientsL());
mMaxMmsRecipients = KDefaultMmsRecipients;
- TRAP_IGNORE(mMaxMmsRecipients = uniEditorGenUtils->MaxMmsRecipientsL());
-
- delete uniEditorGenUtils;
+ TRAP_IGNORE(mMaxMmsRecipients = mUniEditorGenUtils->MaxMmsRecipientsL());
}
//---------------------------------------------------------------
@@ -151,6 +147,11 @@
view()->mBody->disableCharCounter();
view()->addSubject();
}
+ else
+ {
+ //Enable char counter
+ view()->mBody->enableCharCounter();
+ }
// check if sent by body widget
MsgUnifiedEditorBody* body = NULL;
@@ -206,7 +207,7 @@
dlg->setFocusPolicy(Qt::NoFocus);
dlg->setDismissPolicy(HbPopup::TapAnywhere);
dlg->setAttribute(Qt::WA_DeleteOnClose, true);
- dlg->setText(text);
+ dlg->setTitle(text);
dlg->show();
}
// reset skip note flag
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorsubject.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorsubject.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -19,6 +19,7 @@
#include "debugtraces.h"
#include <HbIconItem>
#include <HbNotificationDialog>
+#include <hbmessagebox.h>
// USER INCLUDES
#include "msgunieditorsubject.h"
@@ -50,7 +51,7 @@
mSubjectEdit->setMinRows(1);
mSubjectEdit->setMaxRows(10);
- mGenUtils = new UniEditorGenUtils();
+ mGenUtils = q_check_ptr(new UniEditorGenUtils());
connect(mSubjectEdit, SIGNAL(contentsChanged(const QString&)),
this, SLOT(onContentsChanged(const QString&)));
@@ -125,7 +126,7 @@
mSubjectEdit->setText(mPrevBuffer);
connect(mSubjectEdit, SIGNAL(contentsChanged(const QString&)),
this, SLOT(onContentsChanged(const QString&)));
- HbNotificationDialog::launchDialog(LOC_UNABLE_TO_ADD_CONTENT);
+ HbMessageBox::information(LOC_UNABLE_TO_ADD_CONTENT, 0, 0, HbMessageBox::Ok);
return;
}
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -35,6 +35,7 @@
#include <HbListViewItem>
#include <HbListWidgetItem>
#include <HbNotificationDialog>
+#include <HbDeviceNotificationDialog>
#include <HbMessageBox>
#include <HbAbstractVkbHost>
#include <HbMainWindow>
@@ -87,9 +88,9 @@
#define LOC_BCC hbTrId("txt_messaging_formlabel_bcc")
//attach options
-#define LOC_PHOTO hbTrId("txt_messaging_button_photo")
-#define LOC_SOUND hbTrId("txt_messaging_button_sound")
-#define LOC_BUSINESS_CARD hbTrId("txt_messaging_button_business_card")
+#define LOC_PHOTO hbTrId("txt_messaging_opt_attach_sub_photo")
+#define LOC_SOUND hbTrId("txt_messaging_opt_attach_sub_sound")
+#define LOC_BUSINESS_CARD hbTrId("txt_messaging_opt_sub_business_card")
//options menu.
#define LOC_ADD_SUBJECT hbTrId("txt_messaging_opt_add_subject")
@@ -103,7 +104,7 @@
#define LOC_LOW hbTrId("txt_messaging_opt_attach_sub_low")
//group box
-#define LOC_OTHER_RECIPIENTS(n) hbTrId("txt_messaging_group_title_ln_other_recipients",n)
+#define LOC_OTHER_RECIPIENTS(n) hbTrId("txt_messaging_title_ln_other_recipients",n)
#define LOC_OTHER_RECIPIENTS_EXPAND hbTrId("txt_messaging_title_other_recipients")
//saved to draft note
@@ -302,13 +303,14 @@
mCanSaveToDrafts = false;
}
-void MsgUnifiedEditorView::forwardMessage(ConvergedMessageId& messageId,
- ConvergedMessage::MessageType messageType )
+void MsgUnifiedEditorView::fetchMessageFromStore(
+ ConvergedMessageId& messageId,
+ ConvergedMessage::MessageType messageType,
+ int editorOperation)
{
if(!mPluginLoader)
{
mPluginLoader = new UniEditorPluginLoader(this);
-
}
UniEditorPluginInterface* pluginInterface = NULL;
if( messageType == ConvergedMessage::Mms )
@@ -325,8 +327,7 @@
//Fetch the converged message from the msgId
ConvergedMessage* msg;
msg = pluginInterface->convertFrom(messageId.getId(),
- UniEditorPluginInterface::Forward);
-
+ (UniEditorPluginInterface::EditorOperation)editorOperation);
if( msg != NULL )
{
//Populate the content inside editor
@@ -367,7 +368,23 @@
break;
case MsgBaseView::FORWARD_MSG:
{
- forwardMessage(*messageDetails->id(), messageDetails->messageType());
+ fetchMessageFromStore(*messageDetails->id(),
+ messageDetails->messageType(),
+ UniEditorPluginInterface::Forward);
+ }
+ break;
+ case MsgBaseView::REPLY_MSG:
+ {
+ fetchMessageFromStore(*messageDetails->id(),
+ messageDetails->messageType(),
+ UniEditorPluginInterface::Reply);
+ }
+ break;
+ case MsgBaseView::REPLY_ALL_MSG:
+ {
+ fetchMessageFromStore(*messageDetails->id(),
+ messageDetails->messageType(),
+ UniEditorPluginInterface::ReplyAll);
}
break;
default:
@@ -418,7 +435,10 @@
QString mimeType;
TMsgMediaType mediaType = EMsgMediaUnknown;
QString filePath = messageDetails->attachments().at(i)->filePath();
- UniEditorGenUtils* genUtils = new UniEditorGenUtils;
+
+
+ UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
+
TRAP_IGNORE(genUtils->getFileInfoL(filePath,imageSize,
mimeType,mediaType));
delete genUtils;
@@ -496,8 +516,8 @@
ConvergedMessageAttachmentList attachmentList =
messageDetails.attachments();
int attachmentCount = attachmentList.count();
-
- UniEditorGenUtils* genUtils = new UniEditorGenUtils;
+
+ UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
QStringList pendingAttList;
for( int i=0; i < attachmentCount; i++ )
@@ -554,8 +574,8 @@
//tool bar extension for attach action.
HbToolBarExtension* attachExtension = new HbToolBarExtension();
- HbAction *attachAction = toolBar->addExtension(attachExtension);
- attachAction->setIcon(HbIcon(ATTACH_ICON));
+ mAttachAction = toolBar->addExtension(attachExtension);
+ mAttachAction->setIcon(HbIcon(ATTACH_ICON));
mTBExtnContentWidget = new HbListWidget();
mTBExtnContentWidget->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
@@ -652,8 +672,8 @@
ccBccLayout->addItem(mCcField);
ccBccLayout->addItem(mBccField);
- HbGroupBox* groupBox = new HbGroupBox(0);
- groupBox->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Preferred);
+ HbGroupBox* groupBox = new HbGroupBox(0);
+ groupBox->setObjectName("groupBox");
groupBox->setContentWidget(groupWidget);
groupBox->setHeading(LOC_OTHER_RECIPIENTS_EXPAND);
@@ -1166,7 +1186,7 @@
if(res)
{
- HbNotificationDialog::launchDialog(LOC_SAVED_TO_DRAFTS);
+ HbDeviceNotificationDialog::notification("", LOC_SAVED_TO_DRAFTS);
}
return msgId;
}
@@ -1508,6 +1528,29 @@
}
//---------------------------------------------------------------
+// MsgUnifiedEditorView::vkbAboutToOpen
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::vkbAboutToOpen()
+{
+ //This is done to avoid user action on attachment
+ //toolbar button when vkb is opening
+ mAttachAction->setDisabled(true);
+ disconnect(mVkbHost,SIGNAL(aboutToOpen()),
+ this,SLOT(vkbAboutToOpen()));
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::vkbAboutToClose
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::vkbAboutToClose()
+{
+ mAttachAction->setDisabled(false);
+ connect(mVkbHost,SIGNAL(aboutToOpen()),
+ this,SLOT(vkbAboutToOpen()));
+}
+//---------------------------------------------------------------
// MsgUnifiedEditorView::hideChrome
//
//---------------------------------------------------------------
@@ -1538,6 +1581,8 @@
mVkbHost = new HbAbstractVkbHost(this);
connect(mVkbHost, SIGNAL(keypadOpened()), this, SLOT(vkbOpened()));
connect(mVkbHost, SIGNAL(keypadClosed()), this, SLOT(vkbClosed()));
+ connect(mVkbHost,SIGNAL(aboutToOpen()),this,SLOT(vkbAboutToOpen()));
+ connect(mVkbHost,SIGNAL(aboutToClose()),this,SLOT(vkbAboutToClose()));
disconnect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));
--- a/messagingapp/msgui/unifiededitor/unifiededitor.qrc Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/unifiededitor.qrc Wed Aug 18 09:45:25 2010 +0300
@@ -12,5 +12,6 @@
<file alias="msgunifiededitorsubject.css">resources/layouts/msgunifiededitorsubject.css</file>
<file alias="msgunifiededitorsubject.widgetml">resources/layouts/msgunifiededitorsubject.widgetml</file>
<file alias="msgunifiededitorattachment_color.css">resources/layouts/msgunifiededitorattachment_color.css</file>
+ <file alias="msgunifiededitorview.css">resources/layouts/msgunifiededitorview.css</file>
</qresource>
</RCC>
--- a/messagingapp/msgui/unifiedviewer/inc/unifiedviewer.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/unifiedviewer.h Wed Aug 18 09:45:25 2010 +0300
@@ -24,6 +24,7 @@
#define UNI_VIEWER_DLL Q_DECL_IMPORT
#endif
+#include <sqldb.h>
#include "msgbaseview.h"
#include "convergedmessage.h"
@@ -46,8 +47,7 @@
/**
* Constructor
*/
- UnifiedViewer(const qint32 messageId,
- int canForwardMessage = 0,
+ UnifiedViewer(const qint32 messageId,
QGraphicsItem *parent = 0);
/**
@@ -69,13 +69,23 @@
void resizeEvent(QGraphicsSceneResizeEvent * event);
private:
+ /**
+ * Check if this message can be forwarded
+ * @return true, if possible to forward
+ */
+ bool isForwardOk();
/**
* Creates tool bar actions
* @see HbView
*/
void createToolBar();
-
+
+ /**
+ * Launch Editor for forward, reply, replyall actions
+ * @param operation, Editor operation e.g. forward, reply etc
+ */
+ void launchEditor(MsgBaseView::UniEditorOperation operation);
public slots:
@@ -91,7 +101,7 @@
* Handle delete
*/
void handleDeleteAction();
-
+
private slots:
/**
* This slot is called when sendMessage signal is emitted for a highlighted
@@ -101,10 +111,20 @@
/**
* This slot is called when delete message dialog is launched.
- * @param action selected action (yes or no).
+ * @param val selected action value.
+ */
+ void onDialogDeleteMsg(int val);
+
+ /**
+ * Handle reply
*/
- void onDialogDeleteMsg(HbAction* action);
+ void handleReplyAction();
+ /**
+ * Handle reply-all
+ */
+ void handleReplyAllAction();
+
private:
/**
@@ -139,11 +159,6 @@
* Message count
*/
int mMsgCount;
-
- /**
- * Forward status of message
- */
- bool mForwardMessage;
};
#endif
--- a/messagingapp/msgui/unifiedviewer/inc/univieweraddresswidget.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univieweraddresswidget.h Wed Aug 18 09:45:25 2010 +0300
@@ -75,8 +75,9 @@
/**
* short tap handler.
* @param anchor anchor at cursor position.
+ * @param pos tap position.
*/
- void shortTapAction(QString anchor);
+ void shortTapAction(QString anchor,const QPointF& pos);
/** Helper method to get contact id against phone number or e-mail id.
* @param value phone number or email id.
@@ -87,6 +88,12 @@
const QString& fieldName,
const QString& fieldType);
+ /**
+ * Helper method to populate menu items.
+ * @param contextMenu menu to be populated.
+ * @param data, highlighted number.
+ */
+ void populateMenu(HbMenu* contextMenu, const QString& data);
private slots:
--- a/messagingapp/msgui/unifiedviewer/inc/univieweraudiowidget.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univieweraudiowidget.h Wed Aug 18 09:45:25 2010 +0300
@@ -50,6 +50,12 @@
*/
void populate(UniMessageInfo *info);
+ /**
+ * Overloaded from base class.
+ * @see HbPushButton
+ */
+ void setStretched(bool stretched = true);
+
signals:
/**
@@ -110,6 +116,11 @@
* Mime type of media.
*/
QString mMimeType;
+
+ /**
+ * True if valid media duration else false.
+ */
+ bool mValidMediaDuration;
};
#endif //UNI_VIEWER_AUDIO_WIDGET_H
--- a/messagingapp/msgui/unifiedviewer/inc/univiewerbodywidget.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewerbodywidget.h Wed Aug 18 09:45:25 2010 +0300
@@ -26,6 +26,7 @@
class UniViewerPixmapWidget;
class UniViewerAudioWidget;
class HbTextItem;
+class HbIconItem;
/**
* @class UniViewerBodyWidget
@@ -50,38 +51,6 @@
*/
~UniViewerBodyWidget();
-public slots:
-
- /**
- * Called to insert image content in viewer.
- * @param info Object information.
- */
- void setPixmap(UniMessageInfo *info);
-
- /**
- * Called to insert audio content in viewer.
- * @param info Object information.
- */
- void setAudio(UniMessageInfo *info);
-
- /**
- * Called to insert video content in viewer.
- * @param info Object information.
- */
- void setVideo(UniMessageInfo *info);
-
- /**
- * Called to insert text content in viewer.
- * @param text Body text to be set.
- */
- void setText(QString text);
-
- /**
- * Sets the slide counter.
- * @param slideCounter Slide counter string to be set.
- */
- void setSlideCounter(QString &slideCounter);
-
/**
* Specify if this slide has text
* @param bool
@@ -118,6 +87,21 @@
*/
void clearContent();
+signals:
+
+ /**
+ * this signal is emitted when sendMessage is emitted from UniViewerTextItem.
+ */
+ void sendMessage(const QString& phoneNumber);
+
+public slots:
+
+ /**
+ * Called to insert text content in viewer.
+ * @param text Body text to be set.
+ */
+ void setText(QString text);
+
protected:
/**
@@ -126,13 +110,49 @@
*/
QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
-signals:
+private:
+
+ /**
+ * Called to insert image content in viewer.
+ * @param info Object information.
+ */
+ void setPixmap(UniMessageInfo *info);
+
+ /**
+ * Called to insert audio content in viewer.
+ * @param info Object information.
+ */
+ void setAudio(UniMessageInfo *info);
+
/**
- * this signal is emitted when sendMessage is emitted from UniViewerTextItem.
+ * Called to insert video content in viewer.
+ * @param info Object information.
+ */
+ void setVideo(UniMessageInfo *info);
+
+ /**
+ * Sets the slide counter.
+ * @param slideCounter Slide counter string to be set.
*/
- void sendMessage(const QString& phoneNumber);
+ void setSlideCounter(QString &slideCounter);
+
+ /**
+ * Sets overlay icon on top of pixmap widget.
+ * @param iconName Overlay icon name to be set.
+ */
+ void setOverlayIcon(const QString &iconName);
+
+private slots:
+
+ /**
+ * Handles the cases related to video thumbnail generation success/failure.
+ * @param result true if thumbnail was found else false.
+ * @param info UniMessageInfo of the media object.
+ */
+ void onThumbnailFound(bool result, UniMessageInfo *info);
private:
+
/**
* Info if slide has text.
* true if slide has text else false.
@@ -164,6 +184,11 @@
* Media widget for embedded audio content.
*/
UniViewerAudioWidget *mAudioItem;
+
+ /**
+ * Overlay icon on top of pixmap widget.
+ */
+ HbIconItem *mOverlayItem;
};
#endif //UNIVIEWER_BODY_WIDGET_H
--- a/messagingapp/msgui/unifiedviewer/inc/univiewerfeeder_p.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewerfeeder_p.h Wed Aug 18 09:45:25 2010 +0300
@@ -188,11 +188,6 @@
private:
/**
- * Fetches message details from the store.
- */
- void fetchDetailsL();
-
- /**
* initialise the symbian constructions.
*/
void initL(qint32 msgId);
--- a/messagingapp/msgui/unifiedviewer/inc/univiewerpixmapwidget.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewerpixmapwidget.h Wed Aug 18 09:45:25 2010 +0300
@@ -25,7 +25,6 @@
class UniMessageInfo;
class ThumbnailManager;
-
/**
* This widget displays the pixmap content in viewer.
*/
@@ -65,6 +64,13 @@
*/
void longTap(const QPointF &position);
+ /**
+ * Signal emitted indicating if thumbnail was found or not
+ * @param result true if thumbnail was found else false.
+ * @param info UniMessageInfo of the media object.
+ */
+ void thumbnailFound(bool result, UniMessageInfo *info);
+
protected:
/**
@@ -77,12 +83,12 @@
private slots:
/**
- *
+ * Handles opening of media.
*/
void handleOpen();
/**
- *
+ * Handles saving of media.
*/
void handleSave();
@@ -95,7 +101,7 @@
/**
* Slot hit when the thumbnail is ready.
*/
- void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error);
+ void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error);
private:
@@ -115,9 +121,21 @@
*/
void handleLongTap(const QPointF &position);
+ /**
+ * Calculates the thumbnail size.
+ * @return Thumbnail size
+ */
+ QSize getThumbnailSize();
+
private:
/**
+ * UniMessageInfo object.
+ * Own.
+ */
+ UniMessageInfo *mInfo;
+
+ /**
* UniViewerUtils object.
* Own
*/
@@ -127,7 +145,7 @@
* ThumbnailManager
* Own.
*/
- ThumbnailManager *mThumbnailManager;
+ ThumbnailManager *mThumbnailManager;
/**
* Mime Type of pixmap.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiedviewer/resources/layouts/univieweraddresswidget.css Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,7 @@
+UniViewerAddressWidget::text
+{
+ left: var(hb-param-margin-gene-middle-horizontal);
+ right: -var(hb-param-margin-gene-middle-horizontal);
+ top: 0.0un;
+ bottom: 0.0un;
+}
\ No newline at end of file
--- a/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerbodywidget.css Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerbodywidget.css Wed Aug 18 09:45:25 2010 +0300
@@ -1,3 +1,11 @@
+
+HbTextEdit#textItem::text
+{
+ left: var(hb-param-margin-gene-middle-horizontal);
+ right: -var(hb-param-margin-gene-middle-horizontal);
+ top: 0.0un;
+ bottom: 0.0un;
+}
UniViewerBodyWidget[hasText="true"]:portrait
{
@@ -63,6 +71,15 @@
right:1un;
}
+UniViewerBodyWidget::overlayItem
+{
+ zvalue:1;
+ size-policy-vertical:fixed;
+ size-policy-horizontal:fixed;
+ pref-width:var(hb-param-graphic-size-primary-large);
+ pref-height:var(hb-param-graphic-size-primary-large);
+}
+
UniViewerBodyWidget[hasText="false"]::pixmap:landscape
{
top:-var(hb-param-margin-gene-middle-vertical);
--- a/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerbodywidget.widgetml Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerbodywidget.widgetml Wed Aug 18 09:45:25 2010 +0300
@@ -12,6 +12,9 @@
<meshitem src="pixmap" srcEdge="LEFT" dst="" dstEdge="LEFT" spacer="leftSpacer" />
<meshitem src="pixmap" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacer="rightSpacer" />
+ <meshitem src="overlayItem" srcEdge="CENTERH" dst="pixmap" dstEdge="CENTERH" />
+ <meshitem src="overlayItem" srcEdge="CENTERV" dst="pixmap" dstEdge="CENTERV" />
+
<meshitem src="textItem" srcEdge="TOP" dst="pixmap" dstEdge="BOTTOM" />
<meshitem src="textItem" srcEdge="LEFT" dst="" dstEdge="LEFT" />
<meshitem src="textItem" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
@@ -31,6 +34,9 @@
<meshitem src="pixmap" srcEdge="LEFT" dst="" dstEdge="LEFT" spacer="leftSpacer" />
<meshitem src="pixmap" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacer="rightSpacer" />
<meshitem src="pixmap" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" spacer="bottomSpacer" />
+
+ <meshitem src="overlayItem" srcEdge="CENTERH" dst="pixmap" dstEdge="CENTERH" />
+ <meshitem src="overlayItem" srcEdge="CENTERV" dst="pixmap" dstEdge="CENTERV" />
</layout>
<layout name="layout-landscape" type="mesh">
@@ -46,6 +52,8 @@
<meshitem src="pixmap" srcEdge="LEFT" dst="" dstEdge="LEFT" spacer="leftSpacer" />
<meshitem src="pixmap" srcEdge="RIGHT" dst="" dstEdge="CENTERH" spacer="rightSpacer" />
+ <meshitem src="overlayItem" srcEdge="CENTERH" dst="pixmap" dstEdge="CENTERH" />
+ <meshitem src="overlayItem" srcEdge="CENTERV" dst="pixmap" dstEdge="CENTERV" />
<meshitem src="textItem" srcEdge="LEFT" dst="" dstEdge="CENTERH" />
<meshitem src="textItem" srcEdge="TOP" dst="audioItem" dstEdge="BOTTOM" />
@@ -81,5 +89,8 @@
<meshitem src="pixmap" srcEdge="LEFT" dst="" dstEdge="LEFT" spacer="leftSpacer" />
<meshitem src="pixmap" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacer="rightSpacer" />
<meshitem src="pixmap" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" spacer="bottomSpacer" />
+
+ <meshitem src="overlayItem" srcEdge="CENTERH" dst="pixmap" dstEdge="CENTERH" />
+ <meshitem src="overlayItem" srcEdge="CENTERV" dst="pixmap" dstEdge="CENTERV" />
</layout>
</hbwidget>
\ No newline at end of file
--- a/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -26,6 +26,7 @@
#include <HbStyleLoader>
#include <centralrepository.h>
#include <MmsEngineDomainCRKeys.h>
+#include <ccsdefs.h>
// USER INCLUDES
#include "uniscrollarea.h"
@@ -38,6 +39,7 @@
#include "conversationsengine.h"
#include "debugtraces.h"
#include "nativemessageconsts.h"
+#include "mmsconformancecheck.h"
// LOCAL CONSTANTS
const QString REPLY_ICON("qtg_mono_reply");
@@ -46,17 +48,23 @@
const QString SEND_ICON("qtg_mono_send");
const QString DELETE_ICON("qtg_mono_delete");
+//DB-file
+_LIT(KDbFileName, "c:[2002A542]conversations.db");
+// query to see if msg is forwardable
+_LIT(KSelectMsgPropertyStmt, " SELECT message_id, msg_property FROM conversation_messages WHERE message_id=:message_id ");
+
+
//LOCALIZED CONSTANTS
#define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
+#define LOC_DELETE_SHARED_MESSAGE hbTrId("txt_messaging_dialog_same_message_exists_in_multip")
//----------------------------------------------------------------------------
// UnifiedViewer::UnifiedViewer
// constructor
//----------------------------------------------------------------------------
-UnifiedViewer::UnifiedViewer(const qint32 messageId,
- int canForwardMessage,
+UnifiedViewer::UnifiedViewer(const qint32 messageId,
QGraphicsItem *parent) :
- MsgBaseView(parent), mForwardMessage(false)
+ MsgBaseView(parent)
{
QDEBUG_WRITE("UnifiedViewer contruction start");
@@ -68,8 +76,6 @@
mMessageId = messageId;
mViewFeeder = new UniViewerFeeder(mMessageId, this);
- if (canForwardMessage > 0) mForwardMessage = true;
-
mScrollArea = new UniScrollArea(this);
this->setWidget(mScrollArea);
@@ -114,15 +120,19 @@
}
else
{
- toolbar->addAction(HbIcon(REPLY_ICON), "");
+ // do not show reply option for multi recipient outgoing message
+ if(!(!mViewFeeder->isIncoming() && mViewFeeder->recipientCount()>1))
+ {
+ toolbar->addAction(HbIcon(REPLY_ICON), "", this, SLOT(handleReplyAction()));
+ }
if (mViewFeeder->recipientCount() > 1)
{
- toolbar->addAction(HbIcon(REPLY_ALL_ICON), "");
+ toolbar->addAction(HbIcon(REPLY_ALL_ICON), "", this, SLOT(handleReplyAllAction()));
}
}
- if (mForwardMessage)
+ if (isForwardOk())
{
toolbar->addAction(HbIcon(FORWARD_ICON), "", this, SLOT(handleFwdAction()));
}
@@ -183,7 +193,7 @@
//Creation of toolbar now depends on content
createToolBar();
-
+
QDEBUG_WRITE("UnifiedViewer populateContent END");
}
@@ -193,31 +203,25 @@
//---------------------------------------------------------------
void UnifiedViewer::handleFwdAction()
{
- ConvergedMessage message;
- ConvergedMessageId id(mMessageId);
- message.setMessageId(id);
- if(mViewFeeder->msgType() == KSenduiMtmMmsUidValue)
- {
- message.setMessageType(ConvergedMessage::Mms);
- }
- else
- {
- message.setMessageType(ConvergedMessage::Sms);
- }
+ launchEditor(MsgBaseView::FORWARD_MSG);
+}
- QByteArray dataArray;
- QDataStream messageStream
- (&dataArray, QIODevice::WriteOnly | QIODevice::Append);
- message.serialize(messageStream);
+//---------------------------------------------------------------
+// UnifiedViewer::handleReplyAction
+// @see header file
+//---------------------------------------------------------------
+void UnifiedViewer::handleReplyAction()
+{
+ launchEditor(MsgBaseView::REPLY_MSG);
+}
- QVariantList params;
- params << MsgBaseView::UNIEDITOR; // target view
- params << MsgBaseView::UNIVIEWER; // source view
-
- params << dataArray;
- params << MsgBaseView::FORWARD_MSG;
-
- emit switchView(params);
+//---------------------------------------------------------------
+// UnifiedViewer::handleReplyAllAction
+// @see header file
+//---------------------------------------------------------------
+void UnifiedViewer::handleReplyAllAction()
+{
+ launchEditor(MsgBaseView::REPLY_ALL_MSG);
}
//---------------------------------------------------------------
@@ -236,8 +240,18 @@
//---------------------------------------------------------------
void UnifiedViewer::handleDeleteAction()
{
- HbMessageBox::question(LOC_DELETE_MESSAGE,this,
- SLOT(onDialogDeleteMsg(HbAction*)),
+ QString txt = LOC_DELETE_MESSAGE;
+
+ //if mms and out going. check for sharing
+ if((mViewFeeder->msgType() == KSenduiMtmMmsUidValue) && (!mViewFeeder->isIncoming()))
+ {
+ if(mViewFeeder->recipientCount() > 1 )
+ {
+ txt = LOC_DELETE_SHARED_MESSAGE;
+ }
+ }
+
+ HbMessageBox::question(txt,this,SLOT(onDialogDeleteMsg(int)),
HbMessageBox::Delete | HbMessageBox::Cancel);
}
@@ -272,10 +286,9 @@
// UnifiedViewer::onDialogDeleteMsg
// @see header file
//---------------------------------------------------------------
-void UnifiedViewer::onDialogDeleteMsg(HbAction* action)
+void UnifiedViewer::onDialogDeleteMsg(int val)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
- if (action == dlg->actions().at(0)) {
+ if (val == HbMessageBox::Delete) {
QList<int> msgIdList;
msgIdList << mMessageId;
@@ -297,4 +310,81 @@
}
}
+//---------------------------------------------------------------
+// UnifiedViewer::launchEditor
+// @see header file
+//---------------------------------------------------------------
+void UnifiedViewer::launchEditor(
+ MsgBaseView::UniEditorOperation operation)
+{
+ ConvergedMessage message;
+ ConvergedMessageId id(mMessageId);
+ message.setMessageId(id);
+ if(mViewFeeder->msgType() == KSenduiMtmMmsUidValue)
+ {
+ message.setMessageType(ConvergedMessage::Mms);
+ }
+ else
+ {
+ message.setMessageType(ConvergedMessage::Sms);
+ }
+
+ QByteArray dataArray;
+ QDataStream messageStream
+ (&dataArray, QIODevice::WriteOnly | QIODevice::Append);
+ message.serialize(messageStream);
+
+ QVariantList params;
+ params << MsgBaseView::UNIEDITOR; // target view
+ params << MsgBaseView::UNIVIEWER; // source view
+
+ params << dataArray;
+ params << operation;
+
+ emit switchView(params);
+}
+
+//---------------------------------------------------------------
+// UnifiedViewer::isForwardOk
+// @see header file
+//---------------------------------------------------------------
+bool UnifiedViewer::isForwardOk()
+{
+ bool canForwardMsg = true;
+ if(mViewFeeder->msgType() == KSenduiMtmMmsUidValue)
+ {
+ // open DB
+ RSqlDatabase sqlDb;
+ TInt error = sqlDb.Open(KDbFileName);
+ if(error == KErrNone)
+ {
+ RSqlStatement sqlSelectStmt;
+ CleanupClosePushL(sqlSelectStmt);
+ sqlSelectStmt.PrepareL(sqlDb,KSelectMsgPropertyStmt);
+ TInt msgIdIndex = sqlSelectStmt.ParameterIndex(_L(":message_id"));
+ sqlSelectStmt.BindInt(msgIdIndex, mMessageId);
+ // read the flag
+ TInt msgPropertyIndex =
+ sqlSelectStmt.ColumnIndex(_L("msg_property"));
+ TInt retValue = 0;
+ if (sqlSelectStmt.Next() == KSqlAtRow)
+ {
+ retValue = static_cast<TInt>
+ (sqlSelectStmt.ColumnInt(msgPropertyIndex));
+ }
+ CleanupStack::PopAndDestroy(&sqlSelectStmt);
+ sqlDb.Close();
+ canForwardMsg = (retValue & EPreviewForward)? true:false;
+ }
+ else
+ {
+ // fall-back plan
+ MmsConformanceCheck* mmsConformanceCheck = new MmsConformanceCheck;
+ canForwardMsg = mmsConformanceCheck->validateMsgForForward(mMessageId);
+ delete mmsConformanceCheck;
+ }
+ }
+ return canForwardMsg;
+}
+
// EOF
--- a/messagingapp/msgui/unifiedviewer/src/univieweraddresswidget.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univieweraddresswidget.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -43,7 +43,7 @@
const QString SPACE(" ");
//localization
-#define LOC_OPEN_CONTACT_INFO hbTrId("txt_messaging_menu_open_contact_info")
+#define LOC_CONTACT_INFO hbTrId("txt_messaging_menu_contact_info")
#define LOC_CALL hbTrId("txt_common_menu_call_verb")
#define LOC_SEND_MESSAGE hbTrId("txt_common_menu_send_message")
#define LOC_SAVE_TO_CONTACTS hbTrId("txt_common_menu_save_to_contacts")
@@ -123,7 +123,7 @@
//do short tap action.
if (!anchor.isEmpty() && !this->textCursor().hasSelection())
{
- shortTapAction(anchor);
+ shortTapAction(anchor,tap->scenePosition());
}
}
break;
@@ -349,34 +349,73 @@
if(!anchor.isEmpty() && !this->textCursor().hasSelection())
{
-
- HbAction* action = NULL;
+ populateMenu(contextMenu,anchor);
+ }
+}
- action = contextMenu->addAction(LOC_OPEN_CONTACT_INFO, this, SLOT(openContactInfo()));
- action->setData(anchor);
-
- action = contextMenu->addAction(LOC_CALL, this, SLOT(call()));
- action->setData(anchor);
+void UniViewerAddressWidget::populateMenu(HbMenu* contextMenu,const QString& data)
+{
+ HbAction* action = NULL;
- action = contextMenu->addAction(LOC_SEND_MESSAGE, this, SLOT(sendMessage()));
- action->setData(anchor);
-
+ int contactId = MsgContactHandler::resolveContactDisplayName(
+ data,
+ QContactPhoneNumber::DefinitionName,
+ QContactPhoneNumber::FieldNumber);
+
+ if(contactId > 0)
+ {
+ action = contextMenu->addAction(LOC_CONTACT_INFO, this, SLOT(openContactInfo()));
+ action->setData(data);
+ }
+ else
+ {
action = contextMenu->addAction(LOC_SAVE_TO_CONTACTS, this, SLOT(saveToContacts()));
- action->setData(anchor);
-
- action = contextMenu->addAction(LOC_COPY, this, SLOT(copyToClipboard()));
- action->setData(anchor);
-
+ action->setData(data);
}
- connect(contextMenu,SIGNAL(aboutToClose()),this,SLOT(menuClosed()));
+ action = contextMenu->addAction(LOC_CALL, this, SLOT(call()));
+ action->setData(data);
+
+ action = contextMenu->addAction(LOC_SEND_MESSAGE, this, SLOT(sendMessage()));
+ action->setData(data);
+
+ action = contextMenu->addAction(LOC_COPY, this, SLOT(copyToClipboard()));
+ action->setData(data);
+
+ connect(contextMenu,SIGNAL(aboutToClose()),this,SLOT(menuClosed()));
}
-void UniViewerAddressWidget::shortTapAction(QString anchor)
+void UniViewerAddressWidget::shortTapAction(QString anchor,const QPointF& pos)
{
HbAction action;
action.setData(anchor);
- connect(&action,SIGNAL(triggered()),this,SLOT(openContactInfo()));
+
+
+ int contactId = MsgContactHandler::resolveContactDisplayName(
+ anchor,
+ QContactPhoneNumber::DefinitionName,
+ QContactPhoneNumber::FieldNumber);
+
+ if(contactId > 0 )
+ {
+ //if resolved conatct open contact card
+ connect(&action,SIGNAL(triggered()),this,SLOT(openContactInfo()));
+ }
+ else
+ {
+ //unresolved contact show popup.
+ highlightText(true);
+
+ HbMenu* contextMenu = new HbMenu();
+ contextMenu->setDismissPolicy(HbPopup::TapAnywhere);
+ contextMenu->setAttribute(Qt::WA_DeleteOnClose, true);
+ contextMenu->setPreferredPos(pos);
+
+ populateMenu(contextMenu,anchor);
+
+ contextMenu->show();
+ }
+
action.trigger();
}
@@ -509,7 +548,7 @@
void UniViewerAddressWidget::saveToContacts()
{
- //handler for save to contacts.
+ openContactInfo();
}
void UniViewerAddressWidget::sendMessage()
--- a/messagingapp/msgui/unifiedviewer/src/univieweraudiowidget.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univieweraudiowidget.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -30,15 +30,17 @@
#define LOC_OPEN hbTrId("txt_common_menu_open")
#define LOC_SAVE hbTrId("txt_common_menu_save")
-const QString AUDIO_ICON("qtg_mono_audio");
-const QString CORRUPTED_AUDIO_ICON("qtg_mono_corrupted");
+static const char VIDEO_MIMETYPE[] = "video";
+static const char AUDIO_ICON[] = "qtg_mono_audio";
+static const char VIDEO_ICON[] = "qtg_mono_video";
+static const char CORRUPTED_AUDIO_ICON[] = "qtg_mono_corrupted";
//----------------------------------------------------------------------------
// UniViewerAudioWidget::UniViewerAudioWidget
// @see header file
//----------------------------------------------------------------------------
UniViewerAudioWidget::UniViewerAudioWidget(QGraphicsItem *parent) :
- HbPushButton(parent), mViewerUtils(0)
+ HbPushButton(parent), mViewerUtils(0), mValidMediaDuration(true)
{
connect(this, SIGNAL(clicked()), this, SLOT(handleShortTap()));
connect(this, SIGNAL(longPress(QPointF)), this, SLOT(handleLongTap(QPointF)));
@@ -62,14 +64,25 @@
mMediaPath = info->path();
HbIcon audioIcon;
+
if (info->isProtected()) {
- audioIcon.setIconName(AUDIO_ICON);
+ if (mMimeType.contains(VIDEO_MIMETYPE)) {
+ audioIcon.setIconName(VIDEO_ICON);
+ }
+ else {
+ audioIcon.setIconName(AUDIO_ICON);
+ }
}
else if (info->isCorrupted()) {
audioIcon.setIconName(CORRUPTED_AUDIO_ICON);
}
else {
- audioIcon.setIconName(AUDIO_ICON);
+ if (mMimeType.contains(VIDEO_MIMETYPE)) {
+ audioIcon.setIconName(VIDEO_ICON);
+ }
+ else {
+ audioIcon.setIconName(AUDIO_ICON);
+ }
}
this->setIcon(audioIcon);
@@ -77,7 +90,28 @@
this->setText(fileInfo.baseName());
this->setTextAlignment(Qt::AlignLeft);
MsgMediaUtil mediaUtil;
- this->setAdditionalText(mediaUtil.mediaDuration(mMediaPath));
+ QString mediaDuration(mediaUtil.mediaDuration(mMediaPath));
+ if (mediaDuration.isEmpty()) {
+ mValidMediaDuration = false;
+ }
+ else {
+ mValidMediaDuration = true;
+ this->setAdditionalText(mediaDuration);
+ }
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAudioWidget::setStretched
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAudioWidget::setStretched(bool stretched)
+{
+ if (mValidMediaDuration) {
+ HbPushButton::setStretched(stretched);
+ }
+ else {
+ HbPushButton::setStretched(true);
+ }
}
//----------------------------------------------------------------------------
--- a/messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -21,6 +21,7 @@
#include <QFile>
#include <HbTextItem>
#include <HbMainWindow>
+#include <HbIconItem>
// USER INCLUDES
#include "univiewertextitem.h"
@@ -33,13 +34,15 @@
const QString VIDEO_MIMETYPE("video");
const QString TEXT_MIMETYPE("text");
+static const char VIDEO_ICON[] = "qtg_large_video_player";
+
//---------------------------------------------------------------
//UniViewerBodyWidget::UniViewerBodyWidget
// @see header file
//---------------------------------------------------------------
UniViewerBodyWidget::UniViewerBodyWidget(QGraphicsItem *parent) :
HbWidget(parent), mHasText(false), mHasPixmap(false), mTextItem(0), mSlideCounter(0),
- mPixmapItem(0), mAudioItem(0)
+ mPixmapItem(0), mAudioItem(0), mOverlayItem(0)
{
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
}
@@ -53,95 +56,6 @@
}
//---------------------------------------------------------------
-//UniViewerBodyWidget::setImage
-// @see header file
-//---------------------------------------------------------------
-void UniViewerBodyWidget::setPixmap(UniMessageInfo *info)
-{
- setHasPixmap(true);
- //create image item instance
- if (!mPixmapItem) {
- mPixmapItem = new UniViewerPixmapWidget(this);
- HbStyle::setItemName(mPixmapItem, "pixmap");
- }
- mPixmapItem->hide();
- mPixmapItem->populate(info);
-
- this->repolish();
-}
-
-//---------------------------------------------------------------
-//UniViewerBodyWidget::setAudio
-// @see header file
-//---------------------------------------------------------------
-void UniViewerBodyWidget::setAudio(UniMessageInfo *info)
-{
- if (!mAudioItem) {
- mAudioItem = new UniViewerAudioWidget(this);
- HbStyle::setItemName(mAudioItem, "audioItem");
- }
- mAudioItem->hide();
- mAudioItem->populate(info);
-
- this->repolish();
-}
-
-//---------------------------------------------------------------
-//UniViewerBodyWidget::setVideo
-// @see header file
-//---------------------------------------------------------------
-void UniViewerBodyWidget::setVideo(UniMessageInfo *info)
-{
- setHasPixmap(true);
- //create image item instance
- if (!mPixmapItem) {
- mPixmapItem = new UniViewerPixmapWidget(this);
- HbStyle::setItemName(mPixmapItem, "pixmap");
- }
- mPixmapItem->hide();
- mPixmapItem->populate(info);
-
- this->repolish();
-}
-
-//---------------------------------------------------------------
-//UniViewerBodyWidget::setText
-// @see header file
-//---------------------------------------------------------------
-void UniViewerBodyWidget::setText(QString text)
-{
- setHasText(true);
-
- if (!mTextItem) {
- mTextItem = new UniViewerTextItem(this);
- HbStyle::setItemName(mTextItem, "textItem");
- connect(mTextItem, SIGNAL(sendMessage(const QString&)), this,
- SIGNAL(sendMessage(const QString&)));
- }
- mTextItem->hide();
- text.replace(QChar::ParagraphSeparator, QChar::LineSeparator);
- text.replace('\r', QChar::LineSeparator);
- mTextItem->setText(text);
- this->repolish();
-}
-
-//---------------------------------------------------------------
-// UniViewerBodyWidget::setSlideCounter
-// @see header file
-//---------------------------------------------------------------
-void UniViewerBodyWidget::setSlideCounter(QString &slideCounter)
-{
- if (!mSlideCounter) {
- mSlideCounter = new HbTextItem(this);
- HbStyle::setItemName(mSlideCounter, "slideCounter");
- }
-
- mSlideCounter->hide();
- mSlideCounter->setText(slideCounter);
- this->repolish();
-}
-
-//---------------------------------------------------------------
// UniViewerBodyWidget::setHasText
// @see header file
//---------------------------------------------------------------
@@ -195,7 +109,16 @@
if (mimeType.contains(TEXT_MIMETYPE)) {
QFile file(info->path());
if (file.open(QIODevice::ReadOnly)) {
- QString textContent(file.readAll());
+ QString textContent;
+ QByteArray textArray;
+ textArray = file.readAll();
+ char *data = new char[textArray.size()+1];
+ strcpy(data,textArray.data());
+ //This is needed since MMS text content
+ //is stored in UTF8 format
+ textContent = textContent.fromUtf8(data,strlen(data));
+ file.close();
+ delete []data;
setText(textContent);
}
}
@@ -214,7 +137,7 @@
}
//---------------------------------------------------------------
-//UniViewerBodyWidget :: clearContent
+// UniViewerBodyWidget :: clearContent
// @see header file
//---------------------------------------------------------------
void UniViewerBodyWidget::clearContent()
@@ -238,12 +161,41 @@
mTextItem = NULL;
}
+ if (mOverlayItem) {
+ mOverlayItem->setParent(NULL);
+ delete mOverlayItem;
+ mOverlayItem = NULL;
+ }
+
setHasText(false);
setHasPixmap(false);
repolish();
}
//---------------------------------------------------------------
+// UniViewerBodyWidget::setText
+// @see header file
+//---------------------------------------------------------------
+void UniViewerBodyWidget::setText(QString text)
+{
+ setHasText(true);
+
+ if (!mTextItem) {
+ mTextItem = new UniViewerTextItem(this);
+ mTextItem->setObjectName("textItem");
+ HbStyle::setItemName(mTextItem, "textItem");
+ connect(mTextItem, SIGNAL(sendMessage(const QString&)), this,
+ SIGNAL(sendMessage(const QString&)));
+ }
+ mTextItem->hide();
+ text.replace(QChar::ParagraphSeparator, QChar::LineSeparator);
+ text.replace('\r', QChar::LineSeparator);
+ mTextItem->setText(text);
+
+ this->repolish();
+}
+
+//---------------------------------------------------------------
//UniViewerBodyWidget::sizeHint
// @see header file
//---------------------------------------------------------------
@@ -360,6 +312,10 @@
mPixmapItem->show();
}
+ if (mOverlayItem) {
+ mOverlayItem->show();
+ }
+
// Calculate the size hint to be returned.
szHint.setHeight(0);
@@ -389,4 +345,115 @@
return szHint;
}
+//---------------------------------------------------------------
+//UniViewerBodyWidget::setPixmap
+// @see header file
+//---------------------------------------------------------------
+void UniViewerBodyWidget::setPixmap(UniMessageInfo *info)
+{
+ setHasPixmap(true);
+ //create image item instance
+ if (!mPixmapItem) {
+ mPixmapItem = new UniViewerPixmapWidget(this);
+ HbStyle::setItemName(mPixmapItem, "pixmap");
+ }
+ mPixmapItem->hide();
+ mPixmapItem->populate(info);
+
+ this->repolish();
+}
+
+//---------------------------------------------------------------
+//UniViewerBodyWidget::setAudio
+// @see header file
+//---------------------------------------------------------------
+void UniViewerBodyWidget::setAudio(UniMessageInfo *info)
+{
+ if (!mAudioItem) {
+ mAudioItem = new UniViewerAudioWidget(this);
+ HbStyle::setItemName(mAudioItem, "audioItem");
+ }
+ mAudioItem->hide();
+ mAudioItem->populate(info);
+
+ this->repolish();
+}
+
+//---------------------------------------------------------------
+//UniViewerBodyWidget::setVideo
+// @see header file
+//---------------------------------------------------------------
+void UniViewerBodyWidget::setVideo(UniMessageInfo *info)
+{
+ setHasPixmap(true);
+ //create image item instance
+ if (!mPixmapItem) {
+ mPixmapItem = new UniViewerPixmapWidget(this);
+ HbStyle::setItemName(mPixmapItem, "pixmap");
+ connect(mPixmapItem, SIGNAL(thumbnailFound(bool, UniMessageInfo*)), this,
+ SLOT(onThumbnailFound(bool, UniMessageInfo*)));
+ }
+ mPixmapItem->hide();
+ mPixmapItem->populate(info);
+
+ this->repolish();
+}
+
+//---------------------------------------------------------------
+// UniViewerBodyWidget::setSlideCounter
+// @see header file
+//---------------------------------------------------------------
+void UniViewerBodyWidget::setSlideCounter(QString &slideCounter)
+{
+ if (!mSlideCounter) {
+ mSlideCounter = new HbTextItem(this);
+ HbStyle::setItemName(mSlideCounter, "slideCounter");
+ }
+
+ mSlideCounter->hide();
+ mSlideCounter->setText(slideCounter);
+
+ this->repolish();
+}
+
+//---------------------------------------------------------------
+// UniViewerBodyWidget::setOverlayIcon
+// @see header file
+//---------------------------------------------------------------
+void UniViewerBodyWidget::setOverlayIcon(const QString &iconName)
+{
+ if (!mOverlayItem) {
+ mOverlayItem = new HbIconItem(this);
+ HbStyle::setItemName(mOverlayItem, "overlayItem");
+ }
+
+ mOverlayItem->hide();
+ mOverlayItem->setIconName(iconName);
+
+ this->repolish();
+}
+
+//---------------------------------------------------------------
+// UniViewerBodyWidget::onThumbnailFound
+// @see header file
+//---------------------------------------------------------------
+void UniViewerBodyWidget::onThumbnailFound(bool result, UniMessageInfo *info)
+{
+ if (result) {
+ // Thumbnail generation success
+ setOverlayIcon(VIDEO_ICON);
+ }
+ else {
+ // Show video content in audio widget.
+ setAudio(info);
+
+ // Remove the pixmap widget.
+ setHasPixmap(false);
+ if (mPixmapItem) {
+ HbStyle::setItemName(mPixmapItem, "");
+ mPixmapItem->hide();
+ }
+ }
+}
+
// EOF
--- a/messagingapp/msgui/unifiedviewer/src/univiewerdetailswidget.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerdetailswidget.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -20,7 +20,9 @@
// SYSTEM INCLUDES
#include <HbTextItem>
#include <HbIconItem>
+#include <HbExtendedLocale>
#include <QDateTime>
+#include <QStringBuilder>
// USER INCLUDES
#include "convergedmessage.h"
@@ -29,9 +31,9 @@
// LOCALIZATION
#define LOC_MESSAGE_RESEND hbTrId("txt_common_menu_resend_message")
-// LOCAL CONSTANTS
-const QString DATE_TIME_FORMAT("dd/MM/yy hh:mm ap"); //Date format.
-const QString TIME_FORMAT("hh:mm ap");
+// @see hbi18ndef.h
+static const char DATE_FORMAT[] = r_qtn_date_usual_with_zero;
+static const char TIME_FORMAT[] = r_qtn_time_usual_with_zero;
const QString MSG_HIGH_PRIORITY_ICON("qtg_small_priority_high");
const QString MSG_LOW_PRIORITY_ICON("qtg_small_priority_low");
@@ -78,12 +80,15 @@
//---------------------------------------------------------------
void UniViewerDetailsWidget::setTimeStamp(const QDateTime &aTimeStamp, const int &aSendingState)
{
+ HbExtendedLocale locale = HbExtendedLocale::system();
+ QString date = locale.format(aTimeStamp.date(), DATE_FORMAT);
+ QString time = locale.format(aTimeStamp.time(), TIME_FORMAT);
if (aSendingState == ConvergedMessage::Resend) {
- mTime->setText(LOC_MESSAGE_RESEND + aTimeStamp.toString(TIME_FORMAT));
+ mTime->setText(LOC_MESSAGE_RESEND % time);
}
else {
- mTime->setText(aTimeStamp.toString(DATE_TIME_FORMAT));
+ mTime->setText(date % QChar(' ') % time);
}
}
--- a/messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -74,15 +74,6 @@
}
// ---------------------------------------------------------------------------
-// UniViewerFeederPrivate::fetchDetails
-// Fetches message details from the store
-// ---------------------------------------------------------------------------
-void UniViewerFeederPrivate::fetchDetails()
-{
- TRAP_IGNORE(fetchDetailsL());
-}
-
-// ---------------------------------------------------------------------------
// UniViewerFeederPrivate::msgType
// Returns the message type.
// ---------------------------------------------------------------------------
@@ -153,7 +144,7 @@
// UniViewerFeederPrivate::fetchDetailsL
// Fetches message details from the store.
// ---------------------------------------------------------------------------
-void UniViewerFeederPrivate::fetchDetailsL()
+void UniViewerFeederPrivate::fetchDetails()
{
QDEBUG_WRITE("UniViewerFeederPrivate fetchDetailsL : SMS start");
if (msgType() == KSenduiMtmSmsUidValue || (msgType() == KSenduiMtmBioUidValue
--- a/messagingapp/msgui/unifiedviewer/src/univiewerheadercontainer.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerheadercontainer.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -31,7 +31,7 @@
#include "nativemessageconsts.h"
// LOCALIZATION
-#define LOC_SEND_FAILED hbTrId("txt_messaging_formlabel_sending_failed")
+#define LOC_SEND_FAILED hbTrId("txt_messaging_list_message_sending_failed")
// LOCAL CONSTANTS
const QString ADDR_LIST_SEPARATOR(", ");
--- a/messagingapp/msgui/unifiedviewer/src/univiewerpixmapwidget.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerpixmapwidget.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -34,68 +34,78 @@
#define LOC_OPEN hbTrId("txt_common_menu_open")
#define LOC_SAVE hbTrId("txt_common_menu_save")
-const QString PIXMAP_ICON("qtg_small_image");
-const QString CORRUPTED_PIXMAP_ICON("qtg_large_corrupted");
-const QString VIDEO_MIMETYPE("video");
-const QString MSG_VIDEO_ICON("qtg_small_video");
+static const char PIXMAP_ICON[] = "qtg_small_image";
+static const char CORRUPTED_PIXMAP_ICON[] = "qtg_large_corrupted";
+static const char VIDEO_MIMETYPE[] = "video";
+
+static const int WIDTH_RATIO = 4;
+static const int HEIGHT_RATIO = 3;
//---------------------------------------------------------------
// UniViewerPixmapWidget::UniViewerPixmapWidget
// @see header file
//---------------------------------------------------------------
UniViewerPixmapWidget::UniViewerPixmapWidget(QGraphicsItem *parent) :
- HbIconItem(parent), mViewerUtils(0), mThumbnailManager(0)
+ HbIconItem(parent), mInfo(0), mViewerUtils(0), mThumbnailManager(0)
{
this->grabGesture(Qt::TapGesture);
init();
}
//---------------------------------------------------------------
-// UniViewerPixmapWidget::init
-// @see header file
-//---------------------------------------------------------------
-void UniViewerPixmapWidget::init()
-{
- mThumbnailManager = new ThumbnailManager(this);
- mThumbnailManager->setMode(ThumbnailManager::Default);
- mThumbnailManager->setQualityPreference(ThumbnailManager::OptimizeForQuality);
- mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailLarge);
-
- connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int)), this,
- SLOT(thumbnailReady(QPixmap, void*, int, int)));
-
-}
-
-//---------------------------------------------------------------
// UniViewerPixmapWidget::~UniViewerPixmapWidget
// @see header file
//---------------------------------------------------------------
UniViewerPixmapWidget::~UniViewerPixmapWidget()
{
+ if (mInfo) {
+ delete mInfo;
+ mInfo = NULL;
+ }
}
//---------------------------------------------------------------
-// UniViewerPixmapWidget::setPixmap
+// UniViewerPixmapWidget::populate
// @see header file
//---------------------------------------------------------------
void UniViewerPixmapWidget::populate(UniMessageInfo *info)
{
mMimeType = info->mimetype();
mPixmapPath = info->path();
+
+ /**
+ * Create a copy of info for video content.
+ * mInfo will be deleted in the destructor.
+ */
if (mMimeType.contains(VIDEO_MIMETYPE)) {
- this->setIcon(MSG_VIDEO_ICON);
- mThumbnailManager->getThumbnail(mPixmapPath);
- this->ungrabGesture(Qt::TapGesture);
+ mInfo = new UniMessageInfo(*info);
}
- else if (info->isProtected()) {
- this->setIconName(PIXMAP_ICON);
+
+ if (info->isProtected()) {
+ if (mMimeType.contains(VIDEO_MIMETYPE)) {
+ emit thumbnailFound(false, mInfo);
+ }
+ else {
+ this->setIconName(PIXMAP_ICON);
+ }
}
else if (info->isCorrupted()) {
- this->setIconName(CORRUPTED_PIXMAP_ICON);
+ if (mMimeType.contains(VIDEO_MIMETYPE)) {
+ emit thumbnailFound(false, mInfo);
+ }
+ else {
+ this->setIconName(CORRUPTED_PIXMAP_ICON);
+ }
}
else {
- QPixmap pixmap(mPixmapPath);
- this->setIcon(HbIcon(pixmap));
+ if (mMimeType.contains(VIDEO_MIMETYPE)) {
+ mThumbnailManager->getThumbnail(mPixmapPath);
+ this->ungrabGesture(Qt::TapGesture);
+ }
+ else {
+ QPixmap pixmap(mPixmapPath);
+ this->setIcon(HbIcon(pixmap));
+ }
}
}
@@ -168,6 +178,49 @@
{
}
+//---------------------------------------------------------------
+// UniViewerPixmapWidget::regrabGesture
+// @see header file
+//---------------------------------------------------------------
+void UniViewerPixmapWidget::regrabGesture()
+{
+ this->grabGesture(Qt::TapGesture);
+}
+
+//---------------------------------------------------------------
+// UniViewerPixmapWidget::thumbnailReady
+// @see header
+//---------------------------------------------------------------
+void UniViewerPixmapWidget::thumbnailReady(const QPixmap& pixmap, void *data, int id, int error)
+{
+ Q_UNUSED(data)
+ Q_UNUSED(id)
+ this->grabGesture(Qt::TapGesture);
+ if (error) {
+ emit thumbnailFound(false, mInfo);
+ }
+ else {
+ this->setIcon(HbIcon(pixmap));
+ this->hide();
+ emit thumbnailFound(true, NULL);
+ }
+}
+
+//---------------------------------------------------------------
+// UniViewerPixmapWidget::init
+// @see header file
+//---------------------------------------------------------------
+void UniViewerPixmapWidget::init()
+{
+ mThumbnailManager = new ThumbnailManager(this);
+ mThumbnailManager->setMode(ThumbnailManager::CropToAspectRatio);
+ mThumbnailManager->setQualityPreference(ThumbnailManager::OptimizeForQuality);
+ mThumbnailManager->setThumbnailSize(getThumbnailSize());
+
+ connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int)), this,
+ SLOT(thumbnailReady(QPixmap, void*, int, int)));
+}
+
//----------------------------------------------------------------------------
// UniViewerPixmapWidget::handleShortTap
// @see header file
@@ -197,27 +250,23 @@
}
//---------------------------------------------------------------
-// UniViewerPixmapWidget::regrabGesture
+// UniViewerPixmapWidget::getThumbnailSize
// @see header file
//---------------------------------------------------------------
-void UniViewerPixmapWidget::regrabGesture()
+QSize UniViewerPixmapWidget::getThumbnailSize()
{
- this->grabGesture(Qt::TapGesture);
+ QSize thumbnailSize(1, 1);
+ HbWidget *parent = qobject_cast<HbWidget *>(this->parentWidget());
+
+ if (parent) {
+ qreal thumbnailWidth = 0.0;
+ qreal thumbnailHeight = 0.0;
+ parent->style()->parameter("hb-param-screen-short-edge", thumbnailWidth);
+ thumbnailHeight = (thumbnailWidth * HEIGHT_RATIO) / WIDTH_RATIO;
+ thumbnailSize.setHeight(qRound(thumbnailHeight));
+ thumbnailSize.setWidth(qRound(thumbnailWidth));
+ }
+ return thumbnailSize;
}
-//---------------------------------------------------------------
-// UniViewerPixmapWidget::thumbnailReady
-// @see header
-//---------------------------------------------------------------
-void UniViewerPixmapWidget::thumbnailReady(const QPixmap& pixmap, void *data, int id, int error)
-{
- Q_UNUSED(data)
- Q_UNUSED(id)
- this->grabGesture(Qt::TapGesture);
- if (!error) {
- this->setIcon(HbIcon(pixmap));
- this->hide();
- this->updateGeometry();
- }
-}
// EOF
--- a/messagingapp/msgui/unifiedviewer/src/univiewertextitem.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewertextitem.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -38,16 +38,17 @@
//consts
//regexp
-const QString NUMBER_PATTERN("(\\(?(\\+|\\d))((?:\\d)((?:[\\s-/.\\)\\(])*(?:(\\d+|\\))))*(?:\\d?|\\)))|((\\*#)(?:\\d+(\\*|#)(?:\\d+#)?))");
+const QString NUMBER_PATTERN("(\\(?(\\+|\\d))((?:\\d)((?:[\\s-/.\\)\\(])*(?:(\\d+|\\))))*(?:\\d?[^\\D]|\\)))|((\\*#)(?:\\d+(\\*|#)(?:\\d+#)?))");
const QString EMAIL_PATTERN("[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?");
-const QString URL_PATTERN("(((ht|f|rt)(tp|sp)(s?)\\:\\/\\/)|(www|wap)(?:\\.))(([-\\w]*[0-9a-zA-Z])+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\?\\,\'\\/\\\\+&%\\$#_=~]*)(\\.)([-\\w]*[0-9a-zA-Z])+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\?\\,\'\\/\\\\+&%\\$#_=~]*))+[a-zA-Z0-9/]");
+const QString URL_PATTERN("(((ht|f|rt)(tp|sp)(s?)\\:\\/\\/)|(www|wap)(?:\\.))(([-\\w]*[0-9a-zA-Z])+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\?\'\\/\\\\+&%\\$#_=~]*)(\\.)([-\\w]*[0-9a-zA-Z])+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\?\'\\/\\\\+&%\\$#_=~]*))+[a-zA-Z0-9/]");
//rules
-const QString NUMBER_RULE("NUMBER_RULE");
-const QString EMAIL_RULE("EMAIL_RULE");
-const QString URL_RULE("URL_RULE");
+const QString URL_RULE("0_URL_RULE");
+const QString EMAIL_RULE("1_EMAIL_RULE");
+const QString NUMBER_RULE("2_NUMBER_RULE");
+
//localization
#define LOC_CONTACT_INFO hbTrId("txt_messaging_menu_contact_info")
@@ -123,26 +124,33 @@
while(cursor.hasSelection())
{
- // Insert anchor in the document
- QTextCharFormat f;
- f.setFontUnderline(true);
- f.setForeground(palette().link());
-
- //prepending rule name to identiy different fragment to which
- //catagory it belongs to.
- QString txt = cursor.selectedText().prepend(ruleName);
+ int p = cursor.position();
+ QString anchor = this->anchorAt(p-1);
+
+ //not identified yet.
+ if(anchor.isEmpty())
+ {
+ // Insert anchor in the document
+ QTextCharFormat f;
+ f.setFontUnderline(true);
+ f.setForeground(palette().link());
- if(ruleName == NUMBER_RULE)
- {
- //removing special char(s) from phone numbers.
- QRegExp numberCharExp("[\\s-/.\\(\\)]");
- txt = txt.remove(numberCharExp);
+ //prepending rule name to identiy different fragment to which
+ //catagory it belongs to.
+ QString txt = cursor.selectedText().prepend(ruleName);
+
+ if(ruleName == NUMBER_RULE)
+ {
+ //removing special char(s) from phone numbers.
+ QRegExp numberCharExp("[\\s-/.\\(\\)]");
+ txt = txt.remove(numberCharExp);
+ }
+
+ f.setAnchorHref(txt);
+ f.setAnchor(true);
+ cursor.mergeCharFormat(f);
}
- f.setAnchorHref(txt);
- f.setAnchor(true);
- cursor.mergeCharFormat(f);
-
// Find next
cursor = this->document()->find(ruleExp, cursor);
}
--- a/messagingapp/msgui/unifiedviewer/src/univiewerutils.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerutils.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -57,13 +57,12 @@
//---------------------------------------------------------------
void UniViewerUtils::launchContentViewer(const QString &mimeType, const QString &filePath)
{
- if (mimeType.contains(IMAGE_MIMETYPE) || mimeType.contains(AUDIO_MIMETYPE) ||
- mimeType.contains(VIDEO_MIMETYPE)) {
+ if (mimeType.contains(VCARD_MIMETYPE, Qt::CaseInsensitive)) {
+ MsgContactsUtil::launchVCardViewer(filePath);
+ }
+ else {
launchViaSharableFile(filePath);
}
- else if (mimeType.contains(VCARD_MIMETYPE, Qt::CaseInsensitive)) {
- MsgContactsUtil::launchVCardViewer(filePath);
- }
}
//---------------------------------------------------------------
--- a/messagingapp/msgui/unifiedviewer/unifiedviewer.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/unifiedviewer.pro Wed Aug 18 09:45:25 2010 +0300
@@ -106,4 +106,5 @@
-lmsguiutils \
-lcentralrepository \
-lthumbnailmanagerqt \
- -lxqserviceutil
+ -lxqserviceutil \
+ -lsqldb
--- a/messagingapp/msgui/unifiedviewer/unifiedviewer.qrc Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/unifiedviewer.qrc Wed Aug 18 09:45:25 2010 +0300
@@ -9,5 +9,6 @@
<file alias="univiewerattachmentwidget.css">resources/layouts/univiewerattachmentwidget.css</file>
<file alias="univiewerattachmentwidget_color.css">resources/layouts/univiewerattachmentwidget_color.css</file>
<file alias="univiewerattachmentwidget.widgetml">resources/layouts/univiewerattachmentwidget.widgetml</file>
+ <file alias="univieweraddresswidget.css">resources/layouts/univieweraddresswidget.css</file>
</qresource>
</RCC>
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmsreadfile.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,471 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSREADFILE_H
-#define MMSREADFILE_H
-
-// INCLUDES
-#include <e32base.h>
-#include <badesca.h>
-#include <f32file.h>
-#include <msvstd.h>
-
-// forward references
-class CMmsAttaStructure;
-class CMmsHeaders;
-class CEikonEnv;
-class CMmsClientMtm;
-
-// Out-of-range value for any MMS header with assigned number
-// Used in coverage tests to get coverage for "default" branches
-// in "case" statements.
-const TInt KMmsTestIllegalValue = 255;
-
-//
-// TEST KEY WORDS
-// Extended to include all MMS headers to allow generation of arbitrary PDUs
-// Content type header cannot be separately defined,
-// it will always be "multipat/mixed" or "multipart/related"
-_LIT8( KTestEndOfFile, "EOF" );
-_LIT8( KTestNewMessage, "MESSAGE BEGIN" );
-//------------------------------------------------
-_LIT8( KTestMessageType, "MESSAGE-TYPE" ); //X-Mms-Message-Type
-_LIT8( KTestDate, "DATE" ); // Date
-_LIT8( KTestFrom, "FROM" ); // From
-_LIT8( KTestTo, "TO" ); // To
-_LIT8( KTestCc, "CC" ); // Cc
-_LIT8( KTestBcc, "BCC" ); // Bcc
-_LIT8( KTestSubject, "SUBJECT" ); // Subject
-_LIT8( KTestExpiryRel, "EXPIRY-REL" ); // X-Mms-Expiry, relative
-_LIT8( KTestExpiryAbs, "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
-_LIT8( KTestDeliveryTimeRel, "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
-_LIT8( KTestDeliveryTimeAbs, "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
-_LIT8( KTestPriority, "PRIORITY" ); // X-Mms-Priority
-_LIT8( KTestSenderVisibility, "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
-_LIT8( KTestDeliveryReport, "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
-_LIT8( KTestReadReply, "READ-REPLY" ); // X-Mms-Read-Report
-// ---------------------------------------------------
-_LIT8( KTestNewAttachment, "ATTACHMENT" );
-_LIT8( KTestAttachmentType, "ATTACHMENTTYPE" );
-_LIT8( KTestAttachmentName, "ATTACHMENTNAME" );
-_LIT8( KTestAttachmentContLoc, "ATTACHMENTCONTLOC" );
-_LIT8( KTestAttachmentCharset, "ATTACHMENTCHARSET" );
-_LIT8( KTestAttachmentCid, "ATTACHMENTCID" );
-_LIT8( KTestAttachmentRoot, "ATTACHMENTROOT" );
-// content-type and x-type parameters for attachments
-// should appear in name-value pairs.
-// Test program is not responsible for verifying illegal scripts
-_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
-_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
-_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
-_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
-// -----------------------------------------------------
-_LIT8( KTestMessageClass, "MESSAGE-CLASS" ); // X-Mms-Message-Class
-_LIT8( KTestDelivRepSendAllow, "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
-_LIT8( KTestAcceptAdvertis, "ACCEPT-ADVERTISEMENTS" );
-_LIT8( KTestRetryCount, "RETRY-COUNT" );
-_LIT8( KTestRetryInterval, "RETRY-INTERVAL" );
-// -------------------------------------------------
-_LIT8( KTestAlias, "ALIAS" );
-_LIT8( KTestFromAlias, "FROMALIAS" );
-_LIT8( KTestToAlias, "TOALIAS" );
-_LIT8( KTestCcAlias, "CCALIAS" );
-_LIT8( KTestBccAlias, "BCCALIAS" );
-// -------------------------------------------------
-// more Message headers to allow testing all possible PDUs and
-// MMS 1.1 headers
-_LIT8( KTestReplyCharging, "REPLY-CHARGING" ); // X-Mms-Reply-Charging
-_LIT8( KTestReplyChargAbs, "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
-_LIT8( KTestReplyChargRel, "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
-_LIT8( KTestReplyChargSize, "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
-_LIT8( KTestReplyChargID, "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
-_LIT8( KTestTID, "TID" );
-_LIT8( KTestContentLocation, "CONTLOC" ); // X-Mms-Content-Location
-// The following three must appear as triplets.
-// index must be first, address and date may appear in any order
-_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
-_LIT8( KTestPreviouslySentBy, "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
-_LIT8( KTestPreviouslySentDate, "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
-//---
-_LIT8( KTestMessageId, "MESSAGE-ID" ); // Message-ID
-_LIT8( KTestMessageSize, "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
-_LIT8( KTestVersion, "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
-_LIT8( KTestReadStatus, "READ-STATUS" ); // X-Mms-Read-Status
-_LIT8( KTestResponseStatus, "RESPONSE-STATUS" ); // X-Mms-Response-Status
-_LIT8( KTestResponseText, "RESPONSE-TEXT" ); // X-Mms-Response-Text
-_LIT8( KTestRetrieveStatus, "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
-_LIT8( KTestRetrieveText, "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
-_LIT8( KTestStatus, "STATUS" ); // X-Mms-Status
-// -------------------------------------------------
-// MMS 1.2 headers
-_LIT8( KTestAttribute, "ATTRIBUTE" ); // X-Mms-Attribute
-// The value should be one of the following:
-// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
-// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
-// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
-// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
-// PREV-SENT-DATE, ADDITIONAL-HEADERS
-_LIT8( KTestDistributionIndicator, "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
-_LIT8( KTestLimit, "LIMIT" ); // X-Mms-Limit
-_LIT8( KTestMessageQuota, "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
-_LIT8( KTestSizeQuota, "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
-_LIT8( KTestMessageTotal, "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
-_LIT8( KTestSizeTotal, "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
-_LIT8( KTestMessageCount, "MESSAGE-COUNT" ); // X-Mms-Message-Count
-_LIT8( KTestAddKeyword, "ADD-KEYWORD" ); // X-Mms-MM-Flags
-_LIT8( KTestRemoveKeyword, "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
-_LIT8( KTestFilterKeyword, "FILTER-KEYWORD" ); // X-Mms-MM-FLags
-_LIT8( KTestMMState, "MESSAGE-STATE" ); // X-Mms-MM-State
-_LIT8( KTestQuota, "QUOTA" ); // X-Mms-Quotas
-_LIT8( KTestStart, "START" ); // X-Mms-Start
-_LIT8( KTestStore, "STORE" ); // X-Mms-Store
-_LIT8( KTestStored, "STORED" ); // X-Mms-Stored
-_LIT8( KTestStoreStatus, "STORE-STATUS" ); // X-Mms-Store-Status
-_LIT8( KTestStoreStatusText, "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
-_LIT8( KTestTotals, "TOTALS" ); // X-Mms-Totals
-// Delete confirmation header structure
-// This consists of index, content location, response status and response status text.
-// All three values are not always necessary for each index, but at least content-location
-// and response status should be present.
-// The index retains its value until a new index is encountered.
-_LIT8( KTestDeleteInfoIndex, "DELETESTATUSINDEX" ); // index for next delete info fields
-// This header must precede content-location, response-status and response-text fields
-// in a delete confirmation. Index retains its value until a new index is encountered.
-
-// Element descriptor header not implemented
-
-// Application id headers
-// These will officially be supported in MMS encapsulation version 1.3
-// Java has non-standard support even earlier
-
-_LIT8( KTestApplicId, "APPLIC-ID" ); // X-Mms-Applic-ID
-_LIT8( KTestReplyApplicId, "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
-_LIT8( KTestApplicInfo, "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
-
-// Since Encapsulation 1.3
-_LIT8( KTestContentClass, "CONTENT-CLASS" ); // X-Mms-Content-Class
-_LIT8( KTestDrmContent, "DRM-CONTENT" ); // X-Mms-DRM-Content
-_LIT8( KTestAdaptationAllowed, "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
-_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
-_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
-_LIT8( KTestReplaceId, "REPLACE-ID" ); // X-Mms-Replace-ID
-_LIT8( KTestStatusText, "STATUS-TEXT" ); // X-Mms-Status-Text
-_LIT8( KTestCancelId, "CANCEL-ID" ); // X-Mms-Cancel-ID
-_LIT8( KTestCancelStatus, "CANCEL-STATUS" ); // X-Mms-Cancel-Status
-
-// DATA TYPES
-#define aSet 1
-#define aReset 0
-#define PartCount 100
-#define MaxAttaCount 10
-#define DefaultBufLen 256
-#define MaxRecipients 5
-
-// status returned by ReadRow
-enum TTestReadStatus
- {
- ETestUnknown,
- ETestNewMessage,
- ETestNewAttachment,
- ETestEof, // End of file
- ETestMessageType,
- ETestDate,
- ETestFrom,
- ETestTo,
- ETestCc,
- ETestBcc,
- ETestAlias,
- ETestFromAlias,
- ETestToAlias,
- ETestCcAlias,
- ETestBccAlias,
- ETestSubject,
- ETestExpiryRel,
- ETestExpiryAbs,
- ETestDeliveryTimeRel,
- ETestDeliveryTimeAbs,
- ETestPriority,
- ETestSenderVisibility,
- ETestDeliveryReport,
- ETestReadReply,
- ETestAttachmentType,
-// ETestAttachmentName,
- ETestAttachmentCharset,
- ETestAttachmentCid,
- ETestAttachmentRoot,
- ETestSettings,
- ETestMessageClass,
- ETestDelivReportSendAllow,
- ETestSingleMessageClass,
- ETestReplyCharging,
- ETestReplyChargAbs,
- ETestReplyChargRel,
- ETestReplyChargSize,
- ETestReplyChargID,
- ETestTID,
- ETestContentLocation,
- ETestPreviouslySentIndex,
- ETestPreviouslySentBy,
- ETestPreviouslySentDate,
- ETestMessageId,
- ETestMessageSize,
- ETestVersion,
- ETestReadStatus,
- ETestResponseStatus,
- ETestResponseText,
- ETestRetrieveStatus,
- ETestRetrieveText,
- ETestStatus,
- ETestAttribute,
- ETestDistributionIndicator,
- ETestLimit,
- ETestMessageQuota,
- ETestSizeQuota,
- ETestMessageTotal,
- ETestSizeTotal,
- ETestMessageCount,
- ETestAddKeyword,
- ETestRemoveKeyword,
- ETestFilterKeyword,
- ETestMMState,
- ETestQuota,
- ETestStart,
- ETestStore,
- ETestStored,
- ETestStoreStatus,
- ETestStoreStatusText,
- ETestTotals,
- ETestDeleteInfoIndex,
- ETestApplicId,
- ETestReplyApplicId,
- ETestApplicInfo,
- ETestContentClass,
- ETestDrmContent,
- ETestAdaptationAllowed,
- ETestRecommendedRetrievalMode,
- ETestRecRetrievalModeText,
- ETestReplaceId,
- ETestStatusText,
- ETestCancelId,
- ETestCancelStatus,
- ETestAttaRecommendedName,
- ETestAttachmentContLoc,
- ETestAttContTypeParamName,
- ETestAttContTypeParamValue,
- ETestAttXTypeParamName,
- ETestAttXTypeParamValue
-
- };
-
-// VALUE KEYWORDS
-_LIT( KPersonal, "Personal" );
-_LIT( KAdvertisement, "Advertisement" );
-_LIT( KInformational, "Informational" );
-_LIT( KAuto, "Auto" );
-_LIT( KLow, "Low" );
-_LIT( KNormal, "Normal" );
-_LIT( KHigh, "High" );
-_LIT( KHide, "Hide" );
-_LIT( KShow, "Show" );
-_LIT( KYes, "Yes" );
-_LIT( KNo, "No" );
-_LIT( KOn, "On" );
-_LIT( KOff, "Off" );
-_LIT( KDeferred, "Deferred" );
-_LIT( KExpired, "Expired" );
-_LIT( KRetrieved, "Retrieved" );
-_LIT( KRejected, "Rejected" );
-_LIT( KUnrecognized, "Unrecognized" );
-_LIT( KIndeterminate, "Indeterminate" );
-_LIT( KForwarded, "Forwarded" );
-_LIT( KUnreachable, "Unreachable" );
-_LIT( KDraft, "Draft");
-_LIT( KSent, "Sent" );
-_LIT( KNew, "New" );
-// X-Mms-Message-Type
-_LIT( KSendReq, "SendReq" );
-_LIT( KSendConf, "SendConf" );
-_LIT( KNotifInd, "NotifInd" );
-_LIT( KNotifResp, "NotifResp" );
-_LIT( KRetrConf, "RetrConf" );
-_LIT( KAckInd, "AckInd" );
-_LIT( KDelInd, "DelInd" );
-_LIT( KReadReqInd, "ReadReqInd" );
-_LIT( KReadOrigInd, "ReadOrigInd" );
-_LIT( KForwardRec, "ForwardReq" );
-_LIT( KForwardConf, "ForwardConf" );
-_LIT( KMBoxStoreReq, "MBoxStoreReq" );
-_LIT( KMBoxStoreConf, "MBoxStoreConf" );
-_LIT( KMBoxViewReq, "MBoxViewReq" );
-_LIT( KMBoxViewConf, "MBoxViewConf" );
-_LIT( KMBoxUploadReq, "MBoxUploadReq" );
-_LIT( KMBoxUploadConf, "MBoxUploadConf" );
-_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
-_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
-_LIT( KMBoxDescr, "MBoxDescr" );
-_LIT( KDeleteReq, "DeleteReq" );
-_LIT( KDeleteConf, "DeleteConf" );
-_LIT( KCancelReq, "CancelReq" );
-_LIT( KCancelResp, "CancelConf" );
-// X-Mms-Read-Status
-_LIT( KRead, "Read" );
-_LIT( KDelNotRead, "DeletedNotRead" );
-// X-Mms-Reply-Charging
-_LIT( KRequested, "Requested" );
-_LIT( KReqTextOnly, "ReqTextOnly" );
-_LIT( KAccepted, "Accepted" );
-_LIT( KAccTextOnly, "AccTextOnly" );
-// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
-_LIT( KCancelSuccessful, "CancelSuccess" );
-_LIT( KCancelCorrupted, "CancelCorrupted" );
-// X-Mms-Content-Class
-_LIT( KText, "Text" );
-_LIT( KImageBasic, "ImageBasic" );
-_LIT( KImageRich, "ImageRich" );
-_LIT( KVideoBasic, "VideoBasic" );
-_LIT( KVideoRich, "VideoRich" );
-_LIT( KMegaPixel, "MegaPixel" );
-_LIT( KContentBasic, "ContentBasic" );
-_LIT( KContentRich, "ContentRich" );
-// X-Mms-Recommended-Retrieval-Mode
-_LIT( KManual, "Manual" );
-
-//X-Mms-ResponseStatus
-// legacy values
-_LIT( KOk, "OK" );
-_LIT( KErrUnspecified, "Unspecified" );
-_LIT( KErrServiceDenied, "ServiceDenied" );
-_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
-_LIT( KErrAddressUnresolved, "AddressUnresolved" );
-_LIT( KErrMessageNotFound, "MessageNotFound" );
-_LIT( KErrNetworkProblem, "NetworkProblem" );
-_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
-_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
-// values since 1.1 (and 1.2)
-_LIT( KErrTransient, "TransientFailure" );
-_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
-_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
-_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
-_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
-_LIT( KErrPermanent, "PermanentFailure" );
-_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
-_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
-_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
-_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
-_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
-_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
-_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
-_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
-_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
-_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
-_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
-//X-Mms-RetrieveStatus (one extra value)
-_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
-//X-Mms-Store-Status (one extra value)
-_LIT( KErrMMBoxFull, "MMBoxFull" );
-
-_LIT8( KTestContent, "Content" ); // For attribute list only
-_LIT8( KTestAdditionalHeaders, "ADDITIONAL-HEADERS" ); // For attribute list only
-_LIT8( KTestDeliveryTime, "DELIVERY-TIME"); // for attribute list only
-_LIT8( KTestExpiry, "EXPIRY"); // for attribute list only
-_LIT8( KTestReplyCharg, "REPLY-CHARG-DEADLINE" ); // for attribute list only
-_LIT8( KTestContentType, "CONTENT-TYPE" ); // for attribute list only
-
-/**
-* CMmsReadFile
-*/
-NONSHARABLE_CLASS( CMmsReadFile ):public CBase
- {
- public: // Constructors and destructor
-
- static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
- virtual ~CMmsReadFile(); // Destructor
-
- public: // New functions
-
- TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
- TTestReadStatus ReadRowL();
- void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
- TInt FindAlias(TPtrC alias);
- void SetAttaStructure( TBool aOldAttaStructure = EFalse );
-
- protected: // Functions from base classes
-
- private:
-
- CMmsReadFile(); // C++ default constructor.
- // By default constructor is private.
- void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
- void Reset();
-
- public: // data
- TInt iMessageType;
-
-
- private: // Data
-
- RFs iFs;
- RFileReadStream* iReader;
- TBuf<DefaultBufLen> iValueBuffer;
- CDesCArray* iAliasArray; // aliases
- HBufC8* iByteBuffer;
- TTime iDate;
- CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
- TInt iAttaCount;
- TInt iAttaRoot;
- TInt iAliasCount;
- TInt iNextMessageType;
- TParse iParse;
- TFileName iFilename;
-
- protected: // Data
- private: // Data
-
- // CArrayFixFlat <TestMessage>* iMessages;
-
- public: // Friend classes
- protected: // Friend classes
- private: // Friend classes
-
- };
-
-
-NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
- {
- public: // Constructors and destructor
- static CMmsAttaStructure* NewL(); // Two-phased constructor.
- virtual ~CMmsAttaStructure(); // Destructor
- private:
- CMmsAttaStructure(); // C++ default constructor.
- // By default constructor is private.
- void ConstructL();
-
- public: // Data
- HBufC8* iAtta;
- HBufC8* iAttaName; // content location
- HBufC8* iAttaType;
- HBufC8* iAttaCid;
- TInt iAttaCharset;
- HBufC* iAttaRecommendedName; // recommended filename
- CDesC8ArrayFlat* iContentTypeParams; // zero or more "parameter"
- CDesC8ArrayFlat* iXTypeParams; // zero or more X-Type "parameters"
-
- };
-
-
-#endif // MMSREADFILE_H
-
-// End of File
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmstestbed.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSTESTBED_H
-#define MMSTESTBED_H
-
-#ifdef BUILD_MMSTESTBED_DLL
-#define MMSTESTBED_EXPORT Q_DECL_EXPORT
-#else
-#define MMSTESTBED_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <QString>
-
-#include <msvids.h> //for consts like KMsvNullIndexEntryIdValue
-#include <MSVAPI.H>
-#include <MTCLREG.H>
-#include <mmsclient.h>
-//#include <mmsservercommon.h>
-
-class CTestUiTimer;
-class CMsvSession;
-class CMmsClientMtm;
-class CMmsSettings;
-class CMmsHeaders;
-class CLogEvent;
-class CLogViewEvent;
-class CLogFilter;
-class CLogClient;
-
-class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
- {
- Q_OBJECT
-
-public:
- /**
- *
- */
- MmsTestBed();
- ~MmsTestBed();
- void setConnectionLocal(bool value);
- void fromOutboxToMmsc();
- void fromMmscToInbox();
- /**
- * cleanup MMS service
- */
- void cleanupAndCreateNewService();
- void deleteNotifications();
- void restoreFactorySettings();
- void setFetchingState( TMmsReceivingMode aState );
- void sendFromFile();
- void sendOneByOne();
- void sendNotifications();
- void copyDrafts();
- void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
- void messageVariation();
- void cancelSendScheduling();
- void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
- void deleteSendSchedule();
- void cancelFetchScheduling();
- void fetchForced(TInt aDelay = 5);
- void deleteFetchSchedule();
- void doAFetchCycle();
- void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
- void cleanOutbox();
- void cleanInbox();
- void cleanSent();
- void cleanDrafts();
- void cleanAll();
- void reply();
- void replyToAll();
- void forward();
- void sendReadReport(); // send a read report
- int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
- int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
- void sendViaClient();
- void scheduledFetch(TInt aDelay = 5);
- void fetchForcedImmediate();
- void getEventType();
- void addEventType();
- void deleteEventType();
- void cleanLog();
- void setOnline(bool value);
- void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
- void sendDeliveryReport();
-
-signals:
- void entryCreatedInDraft(long int id);
- void entryMovedToOutbox(long int id);
- void entryMovedToSent(long int id);
- void entryCreatedInInbox(long int id);
-
-protected:
- /**
- * From MMsvSessionObserver
- */
- void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
- TAny* aArg2, TAny* aArg3);
-
-private:
- void findDefaultL();
- void createMmsService();
- void cleanup();
- void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
- void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
- void addMMBoxDescriptions();
- void encodeMessageFromDrafts();
- TMsvId findMMSFolder();
- bool checkLogClient();
- int getLogEntries();
-
-private:
- //data
- CTestUiTimer* iTimer;
- CMsvOperationActiveSchedulerWait* iWait;
- CMsvSession* iSession;
- CClientMtmRegistry* iClientMtmRegistry;
- CMmsClientMtm* iMmsClient;
- CMmsSettings* iSettings;
- CMmsHeaders* iMmsHeaders;
- TMsvId iServiceId;
- TMsvId iDefaultServiceId;
- TMsvSessionEvent iEvent;
- RFs iFs;
- TFileName iFilename;
- TFileName iCurrentFile;
- TFileName iCurrentPath;
- TParse iParse; // parse buffer as member to save stack space
- CBufFlat* iEncodeBuffer;
- CMsvEntrySelection* iMsvEntrySelection;
- CLogEvent* iLogEvent;
- CLogClient* iLogClient;
- CLogViewEvent* iLogView;
- CLogFilter* iLogFilter;
- };
-
-#endif // MMSTESTBED_H
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmstestbed.hrh Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <bldvariant.hrh>
-
-
-#ifndef MMSTESTBED_HRH
-#define MMSTESTBED_HRH
-
-enum
-{
- EAppMainOk = 1,
- EAppMainCancel,
- //
- EMenufrmCmdCascadeTest,
- ECleanup,
- ECleanOutbox,
- ESaveSettings,
- ELoadSettings,
- ECleanInbox,
- EShowIn,
- EShowOut,
- EOutToMMSC,
- EMMSCToIn,
- ESendScheduled,
- EReceiveScheduled,
- EShowSent,
- ECleanSent,
- EStartMyNotifier,
- EGetEventType,
- EAddEventType,
- EDeleteEventType,
- EViewLog,
- ECleanLog,
- EShowWapAccessPoints,
- ESelectWapAccessPoint,
- EShowConnectionMode,
- EShowIAP,
- EConnectToIAP,
- EDeleteSendSchedule,
- EDeleteReceiveSchedule,
- EDeleteNotifications,
- ERestoreFactorySettings,
- ECreateFromFile,
- EShowNotifications,
- ESendDeliveryReport,
- EShowDrafts,
- ECleanDrafts,
- ECleanAll,
- EFetchingDeferred,
- EFetchingOn,
- ESendFromFile,
- ESwitchToLocal,
- ESwitchToGlobal,
- EDecodeLoggingOn,
- EDecodeLoggingOff,
- EBinaryDumpOn,
- EBinaryDumpOff,
- ESendNotification,
- ECreateToInbox,
- ECreateToSentItems,
- ESendFromDrafts,
- EFindMMSFolder,
- ESendOneByOne,
- ECreateToDrafts,
- ESendViaClient,
- ESendMemFail,
- EFetchMemFail,
- EReceiveForced,
- ECreateHeadersFromFile,
- ESwitchToOffline,
- ESwitchToOnline,
- ECopyDrafts,
- ECreateNotification,
- EReply,
- EReplyToAll,
- EForward,
- EFetchingManual,
- EFirstBoot,
- ENoFirstBoot,
- EFindNetworkStatus,
- ESendReadReport,
- ECreateMMBoxViewConf,
- EGetMMBoxView,
- ECleanMMBox,
- EShowMMBox
-};
-
-#define ETestLabel1 1
-#define ETestLabel2 2
-#define ETestLabel3 3
-#define ETestLabel4 4
-
-#define EServiceList 2
-
-
-enum TTestBedDlgCtrlIds
- {
- ETestEditField = 1
- };
-
-enum TEditServiceControls
- {
- EFolderLabel = 1,
- EEditUri
-// EEditServiceFolder,
-// ENameLabel,
-// EEditServiceName,
-// ENumberLabel,
-// EEditServiceNumber
- };
-
-enum
- {
- EFsViewDialogId = 1
- };
-
-#endif
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmsteststaticutils.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,203 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSTESTSTATICUTILS_H
-#define MMSTESTSTATICUTILS_H
-
-#include <e32std.h>
-#include <msvstd.h>
-#include <badesca.h>
-
-#include "mmsconst.h"
-
-class RFs;
-class CMsvSession;
-class CMmsEncode;
-class CMmsHeaders;
-
-#ifdef __WINS__
-_LIT( KRootPath, "c:\\" );
-#else
-// This is removable disk.
-// drive letter should not be hard coded, must be investigated further
-// We use c: for a while for the tests (to be cahnged later)
-_LIT( KRootPath, "c:\\" );
-//_LIT( KRootPath, "e:\\" );
-#endif
-
-// directory where mmbox descriptions are created
-_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
-// directory where created headers are dumped
-_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
-// content type of MMS PDUs
-_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
-
-_LIT( KWild, "*" );
-
-
-/**
- * joined array structure
- *
- */
-NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
- {
-public:
- TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
- TInt MdcaCount() const;
- TPtrC16 MdcaPoint(TInt aIndex) const;
-private:
- CDesCArray* const & iArray1;
- CDesCArray* const & iArray2;
- };
-
-/**
- * static utility functions
- *
- */
-class TMmsTestUtils
- {
-
-public:
-
- /**
- *
- */
- TMmsTestUtils();
-
- /**
- * read phone number for sending messages
- *
- * @param aFileName full path for filename
- * @param aFs file system handle
- * @return allocated pointer containing the name
- * The caller must delete the pointer when no longer needed
- */
- static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
-
- static void DecodeLoggingOnL();
- static void DecodeLoggingOffL();
- static void BinaryDumpOnL();
- static void BinaryDumpOffL();
-
- /**
- * Clean all temporary directories used in local mode.
- * Does not delete the directories, only the contents
- *
- * @param aFs file system handle
- */
- static void CleanDirectoryL( RFs& aFs );
-
- /**
- * Dump a binary message
- *
- * @param aBuffer buffer containing the binary message
- * @param aFilename full path of the directory whenre the dump goes
- * @param aParse reference to parser (to save stack space)
- * @param aFs file system handle
- */
- static void Dump(
- CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
-
- /**
- * Delete all MMS messages and notifications from a given folder
- *
- * @param aBoxId folder id
- * @param aSession Messaging server session
- */
- static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
-
- /**
- * turn on logging messages sent to email addresses
- */
- static void EmailLoggingOnL();
-
- /**
- * turn off logging messages sent to email addresses
- */
- static void EmailLoggingOffL();
-
- /**
- * load list of children into selection and return count
- *
- * @param aBoxId folder id
- * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
- * caller is responsible of deleting the pointer afterwards.
- * Pointer may be NULL at entry, and a new pointer will be allocated
- * @param aSession messge server session
- * @param aMessageType child MTM type, default is multimedia message
- * @return number of entries in selection
- */
- static TInt CountChildrenL(
- TMsvId aBoxId,
- CMsvEntrySelection*& aMsvEntrySelection,
- CMsvSession& aSession,
- TUid aMessageType = KUidMsgTypeMultimedia);
-
- /**
- * Create a folder entry
- *
- * @param aSession messge server session
- * @param aParentFolder the parent folder
- * @param aFolderName name of the folder
- * @param aFolderId will contain the if of the new folder if creation was successful
- */
- static void CreateFolderEntryL(
- CMsvSession& aSession,
- TMsvId aParentFolder,
- const TDesC& aFolderName,
- TMsvId& aFolderId );
-
- /**
- * Create an MMS notification from data in buffer
- * @param aNotificationFolder mms notification folder (target folder)
- * @param aServiceId id of MMS service
- * @param aEncodeBuffer buffer that contains the data
- * @param aSession message server session
- * @return id of the created notification
- */
- static TMsvId CreateNotificationEntryL(
- TMsvId aNotificationFolder,
- TMsvId aServiceId,
- CBufFlat* aEncodeBuffer,
- CMsvSession& aSession );
-
- /**
- * Encode an MMS notification into buffer
- * @param aUrl url of the notification for local messages a filepath
- * @param aSize size of the message
- * @param aMmsHeaders MMS headers structure for creating the notification
- * @param aMmsEncoder reference to CMmsEncode class
- * @param aEncodeBuffer flat buffer that will contain the encoded notification
- */
- static void FormNotification(
- TDesC8& aUrl,
- TInt aSize,
- CMmsHeaders& aMmsHeaders,
- CMmsEncode& aMmsEncoder,
- CBufFlat* aEncodeBuffer );
-
-
- static TBool IsDrive(const TDesC& aFileName);
- static TBool IsDir(const TDesC& aFileName, RFs& aFs);
- static TBool IsFile(const TDesC& aFileName, RFs& aFs);
-
-
-private:
-
- };
-
-
-#endif // MMSTESTSTATICUTILS_H
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmstestuitimer.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef C_TESTUITIMER_H
-#define C_TESTUITIMER_H
-
-
-#include <e32base.h>
-
-#define KPeriod 10000 // period of timer
-
-/**
- * timer for test programs
- */
-NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
- {
-public:
-
- static CTestUiTimer* NewL();
- virtual ~CTestUiTimer();
-
- void RunL();
- void DoCancel();
- void ConstructL();
- void IssueRequest();
- void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
-
-private:
- CTestUiTimer();
-
-public:
- TTimeIntervalMicroSeconds32 period;
-
-private: // data
- CActive* iObject;
- };
-
-#endif // C_TESTUITIMER_H
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/mmstestbed.pro Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-QT += testlib
-QT -= gui
-
-TEMPLATE = lib
-
-TARGET = mmstestbed
-
-INCLUDEPATH += .
-INCLUDEPATH += inc
-INCLUDEPATH += ../../inc
-INCLUDEPATH += ../../../../../mmsengine/inc
-INCLUDEPATH += ../../../../../mmsengine/mmscodec/inc
-INCLUDEPATH += ../../../../../mmsengine/mmshttptransport/inc
-INCLUDEPATH += ../../../../../mmsengine/mmsmessage/inc
-INCLUDEPATH += ../../../../../mmsengine/mmsconninit/inc
-INCLUDEPATH += ../../../../../mmsengine/mmsserver/inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_MMSTESTBED_DLL
-
-SOURCES += src/mmstestbed.cpp \
- src/mmsteststaticutils.cpp \
- src/mmsreadfile.cpp \
- src/mmstestuitimer.cpp
-
-HEADERS += inc/mmstestbed.h \
- inc/mmsteststaticutils.h \
- inc/mmsreadfile.h \
- inc/mmstestuitimer.h \
- inc/mmstestbed.hrh
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-symbian {
- TARGET.CAPABILITY = CAP_GENERAL_DLL
- TARGET.EPOCSTACKSIZE = 0x8000
- TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
- TARGET.EPOCALLOWDLLDATA = 1
- }
-
-# Build.inf rules
-BLD_INF_RULES.prj_exports += \
- "$${LITERAL_HASH}include <platform_paths.hrh>"
-
-LIBS += -lmsgs \
- -lmmsmessage \
- -lmmsconninit \
- -lmmscodec \
- -lmmsserversettings \
- -lcentralrepository \
- -lapparc \
- -lbafl \
- -lefsrv \
- -lesock \
- -lestor \
- -leuser \
- -llogcli \
- -llogwrap \
- -lapgrfx \
- -lapmime
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmsreadfile.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1799 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-// INCLUDE FILES
-#include <e32base.h>
-#include <badesca.h>
-#include <e32def.h>
-#include <s32file.h>
-#include <msvids.h>
-#include <mtmdef.h>
-//#include <eikenv.h>
-#include <apgcli.h>
-#include <CMsvMimeHeaders.h>
-#include <AknNoteWrappers.h>
-
-#include <mmsservercommon.h>
-#include "mmsconst.h"
-#include "mmsclient.h"
-#include "mmsheaders.h"
-#include "mmsreadfile.h"
-#include "mmsmmboxviewheaders.h"
-#include "mmsmmboxmessageheaders.h"
-#include "mmsmmboxflags.h"
-#include "mmssettings.h"
-
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-const TInt KMmsGranularity = 8;
-_LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
-
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// ==================== LOCAL FUNCTIONS ====================
-
-
-// ================= MEMBER FUNCTIONS =======================
-
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CMmsReadFile::CMmsReadFile()
- {
- // all member variables in a class derived from CBase
- // are automatically set to 0.
- }
-
-
-//
-void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
- {
- // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
- iFs = aFs;
- iReader = &aReadStream;
- iByteBuffer = HBufC8::NewL( DefaultBufLen );
- iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
- iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
- Reset();
- }
-
-// Two-phased constructor.
-CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
- {
- CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
- CleanupStack::PushL( self );
- self->ConstructL( aFs, aReadStream );
- CleanupStack::Pop();
- return self;
- }
-
-
-// Destructor
-CMmsReadFile::~CMmsReadFile()
- {
- Reset(); // resets and destroys all array data
- if (iAliasArray != NULL) iAliasArray->Reset();
- delete iByteBuffer;
- delete iAliasArray;
- delete iAttaStructures;
- }
-
-void CMmsReadFile::Reset()
- {
- // reset all arrays
- if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
- iAttaCount = 0;
- iAttaRoot = 0;
- }
-
-// ---------------------------------------------------------
-// CMmsReadFile()::CompleteTest
-// ---------------------------------------------------------
-//
-TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
-{
- Reset(); // new message
-
- TUint32 val;
- TUint limit = 1000000;
- TUint sizeLimit = 1000 * 1024; //max message size 1000 kB!
- TUint allLimit = 999999;
- TInt error;
- TRadix radix = EDecimal;
- TLex16 lex;
- TTestReadStatus readStatus = ETestUnknown;
- CMmsAttaStructure* oneAtta = NULL;
- TInt index;
- TTime y1970( K1970 );
- TTimeIntervalMicroSeconds interval;
- TTime date;
- TInt order = 0;
- TInt16 shortInteger = 0;
-
- //iso luuppi, joka kiertää ja lukee kunnes EOF tule vastaan
- //Big Loop, which passes around and read until the EOF
-
- iMessageType = iNextMessageType;
- while(readStatus != ETestEof)
- {
- readStatus = ReadRowL();
- if ( readStatus == ETestEof )
- {
- return(-1);
- }
- if ( readStatus == ETestUnknown )
- {
- // A line containing only comments, or an unknown tag
- // As using the scripts to test settings is no longer supported,
- // any old keywords used to test CMmsSettings class are ignored
- continue;
- }
- if( readStatus == ETestNewMessage )
- {
- iNextMessageType = readStatus;
- if(aMessageCounter++)
- {
- return(NULL);
- }
- else
- {
- iMessageType = iNextMessageType;
- continue;
- }
- }
- if ( iMessageType == ETestNewMessage)
- {
- switch(readStatus)
- {
- case ETestFrom:
- aMmsHeaders.SetSenderL( iValueBuffer );
- break;
- case ETestFromAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
- }
- break;
- case ETestTo:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
- break;
- case ETestToAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
- }
- break;
- case ETestCc:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
- break;
- case ETestCcAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
- }
- break;
- case ETestBcc:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
- break;
- case ETestBccAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
- }
- break;
- case ETestSubject:
- aMmsHeaders.SetSubjectL( iValueBuffer );
- break;
- case ETestExpiryRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetExpiryInterval( val );
- }
- break;
- case ETestExpiryAbs:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- // expiry date in seconds from 1.1.1970.
- aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
- break;
- case ETestDeliveryTimeRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetDeliveryTimeInterval( val );
- }
- break;
- case ETestDeliveryTimeAbs:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
- break;
- case ETestDate:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetDate( (interval.Int64())/1000000 );
- case ETestPriority:
- val = 0;
- if ((iValueBuffer.CompareF(KLow)) == 0)
- {
- val = EMmsPriorityLow;
- }
- else if ((iValueBuffer.CompareF(KNormal)) == 0)
- {
- val = EMmsPriorityNormal;
- }
- else if ((iValueBuffer.CompareF(KHigh)) == 0)
- {
- val = EMmsPriorityHigh;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessagePriority( val );
- break;
- case ETestSenderVisibility:
- val = 0;
- if ((iValueBuffer.CompareF(KHide)) == 0)
- {
- val = EMmsSenderVisibilityHide;
- }
- else if ((iValueBuffer.CompareF(KShow)) == 0)
- {
- val = EMmsSenderVisibilityShow;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetSenderVisibility( val );
- break;
- case ETestDeliveryReport:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDeliveryReport( val );
- break;
- case ETestDelivReportSendAllow:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReportAllowed( val );
- break;
-
- case ETestReadReply:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReadReply( val );
- break;
- case ETestNewAttachment:
- oneAtta = CMmsAttaStructure::NewL();
- iAttaStructures->AppendL(oneAtta);
- oneAtta->iAtta->Des().Copy( iValueBuffer );
- iAttaCount++;
- break;
- case ETestAttachmentType:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaType->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttachmentContLoc:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaName->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttaRecommendedName:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttachmentCharset:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- if (oneAtta != NULL)
- {
- oneAtta->iAttaCharset = val;
- }
- }
- break;
- case ETestAttachmentCid:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaCid->Des().Copy(iValueBuffer);
- }
- break;
- case ETestAttContTypeParamName:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttContTypeParamValue:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttXTypeParamName:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttXTypeParamValue:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttachmentRoot:
- iAttaRoot = iAttaCount;
- break;
- case ETestAlias:
- // all aliases are global even if they appear
- // in the middle of a message
- iAliasArray->AppendL( iValueBuffer );
- iAliasCount++;
- break;
- case ETestMessageClass: // should be handled!
- val = EMmsClassPersonal;
- if ((iValueBuffer.CompareF(KPersonal)) == 0)
- {
- val = EMmsClassPersonal;
- }
- else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
- {
- val = EMmsClassAdvertisement;
- }
- else if ((iValueBuffer.CompareF(KInformational)) == 0)
- {
- val = EMmsClassInformational;
- }
- else if ((iValueBuffer.CompareF(KAuto)) == 0)
- {
- val = EMmsClassAuto;
- }
- else
- {
- val = (TMmsMessageClass)KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessageClass( val );
- break;
- case ETestReplyCharging:
- val = 0;
- if ((iValueBuffer.CompareF(KRequested)) == 0)
- {
- val = KMmsReplyChargingRequested;
- }
- else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
- {
- val = KMmsReplyChargingRequestedTextOnly;
- }
- else if ((iValueBuffer.CompareF(KAccepted)) == 0)
- {
- val = KMmsReplyChargingAccepted;
- }
- else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
- {
- val = KMmsReplyChargingAcceptedTextOnly;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReplyCharging( val );
- break;
- case ETestReplyChargAbs:
- error = date.Set(iValueBuffer);
- if ( error == KErrNone )
- {
- interval = date.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
- }
- break;
- case ETestReplyChargRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetReplyChargingInterval( val );
- }
- break;
- case ETestReplyChargSize:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,sizeLimit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetReplyChargingSize( val );
- }
- break;
- case ETestReplyChargID:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
- break;
- case ETestTID:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetTidL( iByteBuffer->Des() );
- break;
- case ETestContentLocation:
- iByteBuffer->Des().Copy( iValueBuffer );
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
- {
- aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
- }
- else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
- }
- else
- {
- aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
- }
- break;
- case ETestPreviouslySentIndex:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- order = val;
- break;
- case ETestPreviouslySentBy:
- aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
- break;
- case ETestPreviouslySentDate:
- error = date.Set(iValueBuffer);
- if ( error == KErrNone )
- {
- interval = date.MicroSecondsFrom( y1970 );
- aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
- }
- break;
- case ETestMessageId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
- break;
- case ETestMessageSize:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,sizeLimit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetMessageSize( val );
- }
- break;
- case ETestVersion:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,EHex,limit);
- shortInteger = TInt16( val );
- if (error == KErrNone)
- {
- aMmsHeaders.SetMmsVersion( shortInteger );
- }
- break;
- case ETestReadStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KRead)) == 0)
- {
- val = KMmsReadStatusRead;
- }
- else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
- {
- val = KMmsReadStatusDeletedWithoutBeingRead;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReadStatus( val );
- break;
- case ETestResponseStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
- {
- val = KMmsErrorUnspecified;
- }
- else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
- {
- val = KMmsErrorServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
- {
- val = KMmsErrorSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
- {
- val = KMmsErrorMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
- {
- val = KMmsErrorNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
- {
- val = KMmsErrorNoContentAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
- {
- val = KMmsErrorUnsupportedMessage;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
- {
- val = KMmsErrorTransientSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
- {
- val = KMmsErrorTransientMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorPermanentMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
- {
- val = KMmsErrorPermanentSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorPermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
- {
- val = KMmsErrorPermanentContentNotAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingForwardingDenied;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingNotSupported;
- }
- else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
- {
- val = KMmsErrorTransientPartialSuccess;
- }
- else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
- {
- val = KMmsErrorPermanentAddressHidingNotSupported;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteStatusL( order, val );
- }
- else
- {
- aMmsHeaders.SetResponseStatus( val );
- }
- break;
- case ETestResponseText:
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
- }
- else
- {
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- }
- break;
- case ETestRetrieveStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
- {
- val = KMmsErrorReceiveTransientMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorReceiveTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorReceivePermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
- {
- val = KMmsErrorReceivePermanentContentUnsupported;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetResponseStatus( val );
- break;
- case ETestRetrieveText:
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- break;
- case ETestStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KDeferred)) == 0)
- {
- val = KMmsMessageStatusDeferred;
- }
- else if ((iValueBuffer.CompareF(KExpired)) == 0)
- {
- val = KMmsMessageStatusExpired;
- }
- else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
- {
- val = KMmsMessageStatusRetrieved;
- }
- else if ((iValueBuffer.CompareF(KRejected)) == 0)
- {
- val = KMmsMessageStatusRejected;
- }
- else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
- {
- val = KMmsMessageStatusUnrecognized;
- }
- else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
- {
- val = KMmsMessageStatusIndeterminate;
- }
- else if ((iValueBuffer.CompareF(KForwarded)) == 0)
- {
- val = KMmsMessageStatusForwarded;
- }
- else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
- {
- val = KMmsMessageStatusUnreachable;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetStatus( val );
- break;
- case ETestMessageType:
- val = 0;
- if ((iValueBuffer.CompareF(KSendReq)) == 0)
- {
- val = KMmsMessageTypeMSendReq;
- }
- else if ((iValueBuffer.CompareF(KSendConf)) == 0)
- {
- val = KMmsMessageTypeMSendConf;
- }
- else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
- {
- val = KMmsMessageTypeMNotificationInd;
- }
- else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
- {
- val = KMmsMessageTypeMNotifyRespInd;
- }
- else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
- {
- val = KMmsMessageTypeMRetrieveConf;
- }
- else if ((iValueBuffer.CompareF(KAckInd)) == 0)
- {
- val = KMmsMessageTypeAcknowledgeInd;
- }
- else if ((iValueBuffer.CompareF(KDelInd)) == 0)
- {
- val = KMmsMessageTypeDeliveryInd;
- }
- else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
- {
- val = KMmsMessageTypeReadRecInd;
- }
- else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
- {
- val = KMmsMessageTypeReadOrigInd;
- }
- else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
- {
- val = KMmsMessageTypeForwardReq;
- }
- else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
- {
- val = KMmsMessageTypeForwardConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
- {
- val = KMmsMessageTypeMboxStoreReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
- {
- val = KMmsMessageTypeMboxStoreConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
- {
- val = KMmsMessageTypeMboxViewReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
- {
- val = KMmsMessageTypeMboxViewConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
- {
- val = KMmsMessageTypeMBoxUploadReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
- {
- val = KMmsMessageTypeMBoxUploadConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
- {
- val = KMmsMessageTypeMBoxDeleteReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
- {
- val = KMmsMessageTypeMBoxDeleteConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
- {
- val = KMmsMessageTypeMBoxDescr;
- }
- else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
- {
- val = KMmsMessageTypeDeleteReq;
- }
- else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
- {
- val = KMmsMessageTypeDeleteConf;
- }
- else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
- {
- val = KMmsMessageTypeCancelReq;
- }
- else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
- {
- val = KMmsMessageTypeCancelConf;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessageType( val );
- break;
- case ETestAttribute:
- val = 0;
- iByteBuffer->Des().Copy( iValueBuffer );
- if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
- {
- val = KMmsAssignedBcc;
- }
- else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
- {
- val = KMmsAssignedCc;
- }
- else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
- {
- val = KMmsAssignedContent;
- }
- else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
- {
- val = KMmsAssignedContentType;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
- {
- val = KMmsAssignedDate;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
- {
- val = KMmsAssignedDeliveryReport;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
- {
- val = KMmsAssignedDeliveryTime;
- }
- else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
- {
- val = KMmsAssignedExpiry;
- }
- else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
- {
- val = KMmsAssignedFrom;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
- {
- val = KMmsAssignedMessageClass;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
- {
- val = KMmsAssignedMessageId;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
- {
- val = KMmsAssignedMessageSize;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
- {
- val = KMmsAssignedPriority;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
- {
- val = KMmsAssignedReadReply;
- }
- else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
- {
- val = KMmsAssignedSubject;
- }
- else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
- {
- val = KMmsAssignedTo;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
- {
- val = KMmsAssignedReplyCharging;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
- {
- val = KMmsAssignedReplyChargingID;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
- {
- val = KMmsAssignedReplyChargingDeadline;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
- {
- val = KMmsAssignedReplyChargingSize;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
- {
- val = KMmsAssignedPreviouslySentBy;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
- {
- val = KMmsAssignedPreviouslySentDate;
- }
- else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
- {
- val = KMmsAssignedAdditionalHeaders;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
- break;
- case ETestDistributionIndicator:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDistributionIndicator( val );
- break;
- case ETestLimit:
- aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if( error == KErrNone )
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
- }
- break;
- case ETestMessageQuota:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
- }
- break;
- case ETestSizeQuota:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
- }
- break;
- case ETestMessageTotal:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
- }
- break;
- case ETestSizeTotal:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
- }
- break;
- case ETestMessageCount:
- aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
- }
- break;
- case ETestAddKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
- break;
- case ETestRemoveKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
- break;
- case ETestFilterKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
- break;
- case ETestMMState:
- val = 0;
- if ((iValueBuffer.CompareF(KDraft)) == 0)
- {
- val = KMmsDraft;
- }
- else if ((iValueBuffer.CompareF(KSent)) == 0)
- {
- val = KMmsSent;
- }
- else if ((iValueBuffer.CompareF(KNew)) == 0)
- {
- val = KMmsNew;
- }
- else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
- {
- val = KMmsRetrieved;
- }
- else if ((iValueBuffer.CompareF(KForwarded)) == 0)
- {
- val = KMmsForwarded;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
- {
- aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
- }
- else
- {
- aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
- }
- break;
- case ETestQuota:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
- break;
- case ETestStart:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
- }
- break;
- case ETestStore:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
- break;
- case ETestStored:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
- break;
- case ETestStoreStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorStoreStatusTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorPermanentMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorStoreStatusPermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
- {
- val = KMmsErrorStoreStatusPermanentMmboxFull;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
- break;
- case ETestStoreStatusText:
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
- break;
- case ETestTotals:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
- break;
-
- case ETestDeleteInfoIndex:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- order = val;
- break;
-
- case ETestApplicId:
- aMmsHeaders.SetApplicIdL( iValueBuffer );
- break;
- case ETestReplyApplicId:
- aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
- break;
- case ETestApplicInfo:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
- break;
- case ETestContentClass:
- val = 0;
- if ((iValueBuffer.CompareF(KText)) == 0)
- {
- val = KMmsContentClassText;
- }
- else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
- {
- val = KMmsContentClassImageBasic;
- }
- else if ((iValueBuffer.CompareF(KImageRich)) == 0)
- {
- val = KMmsContentClassImageRich;
- }
- else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
- {
- val = KMmsContentClassVideoBasic;
- }
- else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
- {
- val = KMmsContentClassVideoRich;
- }
- else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
- {
- val = KMmsContentClassMegaPixel;
- }
- else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
- {
- val = KMmsContentClassContentBasic;
- }
- else if ((iValueBuffer.CompareF(KContentRich)) == 0)
- {
- val = KMmsContentClassContentRich;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetContentClass( val );
- break;
- case ETestDrmContent:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDrmContent( val );
- break;
- case ETestAdaptationAllowed:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetAdaptationAllowed( val );
- break;
- case ETestRecommendedRetrievalMode:
- val = 0;
- if ((iValueBuffer.CompareF(KManual)) == 0)
- {
- val = KMmsRecommendedRetrievalModeManual;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetRecommendedRetrievalMode( val );
- break;
- case ETestRecRetrievalModeText:
- aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
- break;
- case ETestReplaceId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
- break;
- case ETestStatusText:
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- break;
- case ETestCancelId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
- break;
- case ETestCancelStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
- {
- val = KMmsCancelRequestSuccessfullyReceived;
- }
- else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
- {
- val = KMmsCancelRequestCorrupted;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetCancelStatus( val );
- break;
- default:
- break;
- }
- }
- else
- {
- switch(readStatus)
- {
- case ETestAlias:
- iAliasArray->AppendL( iValueBuffer );
- iAliasCount++;
- break;
-
- default:
- break;
- }
-
- }
- }
- return(-1);
-}
-
-// ---------------------------------------------------------
-// CMmsReadFile()::ReadRowL
-// ---------------------------------------------------------
-//
-TTestReadStatus CMmsReadFile::ReadRowL()
- {
-
- TBuf8<DefaultBufLen> RowBuffer;
- TBuf8<32> KeyBuffer;
-
- // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
- TChar delim( 10 );
- iReader->ReadL( RowBuffer, delim);
- TInt length = RowBuffer.Length();
- if ( RowBuffer.Length() < 2 )
- {
- return ETestEof;
- }
- RowBuffer.Delete(length - 2,2);
-
- // DROP POSSIBLE COMMENT OUT
- TInt pos = RowBuffer.Locate( ';' );
- if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
-
- if ( RowBuffer.Length() == 0 )
- {
- // the line contained only comment
- return ETestUnknown;
- }
-
- // First split the row (:)
- pos = RowBuffer.Locate( ':' );
- if (pos > 0)
- {
- TPtrC8 p = RowBuffer.Mid( pos+1 );
- length = p.Length();
- iValueBuffer.Zero();
- for (TInt i=0; i < length; ++i)
- {
- iValueBuffer.Append(p[i]);
- }
- iValueBuffer.Trim();
- TPtrC8 pp = RowBuffer.Left(pos);
- KeyBuffer.CopyUC(pp);
- KeyBuffer.Trim();
- }
- // TRY TO FIND CORRECT TAG
- if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
- if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
- if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
- if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
- if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
- if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
- if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
- if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
- if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
- if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
- if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
- if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
- if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
- if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
- if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
- if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
- if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
- if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
- if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
- if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
- if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
- if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
- if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
- if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
- if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
- if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
- if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
- if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
- if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
- if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
- if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
- if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
- if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
- if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
- if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
- if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
- if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
- if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
- if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
- if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
- if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
- if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
- if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
- if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
- if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
- if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
- if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
- if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
- if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
- if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
- if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
- if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
- if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
- if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
- if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
- if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
- if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
- if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
- if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
- if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
- if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
- if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
- if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
- if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
- if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
- if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
- if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
- if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
- if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
- if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
- if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
- if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
- if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
- if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
- if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
- if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
- if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
- if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
- if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
- if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
- if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
- if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
- if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
- if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
- if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
- if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
- return ETestUnknown;
- }
-
-// ---------------------------------------------------------
-// CMmsReadFile()::CreateMessageL
-// program build a message from given parts
-// ---------------------------------------------------------
-//
-void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
- {
-
- // Reset inactivity timer to keem viewServer from crashing
- User::ResetInactivityTime();
-
- TInt i;
- TInt error = KErrNone;
- RFile attaFile;
- _LIT8(KLeftAngle, "<");
- _LIT8(KRightAngle, ">");
- // we can't use "seconds from" as it only returns a
- // 32 bit signed integer. If fails in 2038.
- // "microseconds from" returns a 64 bit signed integer
-
- CMsvStore* store = aMmsClient->Entry().EditStoreL();
- CleanupStack::PushL(store);
- aMmsHeaders->StoreL(*store);
- store->CommitL();
- CleanupStack::PopAndDestroy( store );
- store = NULL;
-
- aMmsClient->LoadMessageL(); // read store is needed to do this
-
- store = aMmsClient->Entry().EditStoreL();
- CleanupStack::PushL(store);
- CMsvAttachment* attaInfo = NULL;
- TMsvAttachmentId attaId = 0;
-
- for ( i=0; i < iAttaStructures->Count(); ++i)
- {
- attaId = KMsvNullIndexEntryId;
- iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
-
- error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
- User::LeaveIfError( error );
-
- CleanupClosePushL(attaFile);
-
- CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
- CleanupStack::PushL( mimeHeaders );
- TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
-
- TDataRecognitionResult result;
- result.Reset(); // make sure that it is cleared
-
- if(iAttaStructures->At(i)->iAttaCid->Length())
- {
- TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
- if (attaCID.Find(KLeftAngle) == 0 &&
- attaCID.Find(KRightAngle) == attaCID.Length()-1 )
- {
- // remove angle brackets from cid
- attaCID = attaCID.Mid(1,attaCID.Length()-2);
- }
- mimeHeaders->SetContentIdL(attaCID);
- }
-
- if (iAttaStructures->At(i)->iAttaCharset)
- {
- mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
- }
-
- if (iAttaStructures->At(i)->iAttaName->Length())
- {
- iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
- }
- iParse.Set( iFilename, NULL, NULL );
- iFilename.Copy( iParse.NameAndExt() );
-
- mimeHeaders->SetContentLocationL( iFilename );
-
- // if Mime type has not been set, use RapaRecognizer
- if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
- {
- // TO BE IMPLEMENTED
-
- RApaLsSession lsSession;
-
- if ( lsSession.Connect() == KErrNone )
- {
- CleanupClosePushL( lsSession );
-
- iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
- if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
- {
- // Check confidence level. Recognization must be at least
- // "EProbable". We don't accept the result if it is "EPossible"
- // or "EUnlikely" or "ENotRecognized"!
-
- if ( result.iConfidence < CApaDataRecognizerType::EProbable )
- {
- result.Reset(); // clear buffer and try again with longer buffer
- }
-
- TPtrC8 mimeBuf8 = result.iDataType.Des8();
-
- if ( mimeBuf8.Length() == 0 )
- {
- // Open file buffer and try again..
-
- TInt bufSize = 0;
- (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
- if ( bufSize <= 0 )
- {
- bufSize = 30;
- }
- HBufC8* buf = HBufC8::NewLC( bufSize );
- TPtr8 des = buf->Des();
-
- RFile file;
- TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
- if ( err == KErrNone )
- {
- err = file.Read( des );
- file.Close();
- if ( err == KErrNone )
- {
- if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
- {
- mimeBuf8.Set( result.iDataType.Des8() );
- }
- }
-
- }
- CleanupStack::PopAndDestroy(); // buf
- }
- if ( mimeBuf8.Length() > 0 &&
- result.iConfidence >= CApaDataRecognizerType::EProbable )
- {
- contentType.Set( result.iDataType.Des8() );
- }
- }
- CleanupStack::PopAndDestroy(1); // lssession
- }
- }
-
- if ( contentType.Length() > 0 )
- {
- TInt position = contentType.Find( KMmsSlash8 );
- if ( position >= 0 )
- {
- mimeHeaders->SetContentTypeL( contentType.Left( position ) );
- }
- if ( position < contentType.Length() - 1 )
- {
- mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
- }
-// CreateAttachment2L sets the content type to attaInfo
-// attaInfo->SetMimeTypeL( contentType );
- }
-
- if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
- {
- iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
- iParse.Set( iFilename, NULL, NULL );
- iFilename.Copy( iParse.NameAndExt() );
- mimeHeaders->SetSuggestedFilenameL( iFilename );
- }
-
- TInt j = 0;
- for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
- {
- mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
- }
- for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
- {
- mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
- }
-
- attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
- // attaInfo does not go onto cleaunpstack because ownership will
- // be transferred to attachment manager.
-
- aMmsClient->CreateAttachment2L(
- *store,
- attaFile,
- contentType,
- *mimeHeaders,
- attaInfo,
- attaId);
- attaInfo = NULL; // ownership transferred
-
- CleanupStack::PopAndDestroy(); // mimeHeaders
- CleanupStack::PopAndDestroy(); // attaFile.Close()
-
- if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
- {
- aMmsClient->SetMessageRootL( attaId );
- }
- }
-
- store->CommitL();
- CleanupStack::PopAndDestroy(); // store
-
- // This frees all memory and resets all values
- Reset();
- // Reset inactivity timer to keem viewServer from crashing
- User::ResetInactivityTime();
- }
-
-
-// ---------------------------------------------------------
-// CMmsReadFile()::FindAlias
-// program build a message from given parts
-// ---------------------------------------------------------
-//
-TInt CMmsReadFile::FindAlias( TPtrC aAlias )
- {
- TBuf<DefaultBufLen> abuf;
- for( TInt i=0; i < iAliasCount; ++i )
- {
- abuf.Copy( iAliasArray->MdcaPoint(i) );
- abuf.SetLength( abuf.Locate('=') );
- if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
- }
- return( -1 );
- }
-
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CMmsAttaStructure::CMmsAttaStructure()
- {
- iAtta = NULL;
- iAttaType = NULL;
- iAttaName = NULL;
- iAttaCid = NULL;
- iAttaRecommendedName = NULL;
- }
-
-
-//
-void CMmsAttaStructure::ConstructL()
- {
- iAtta = HBufC8::NewL(DefaultBufLen);
- iAttaType = HBufC8::NewL(DefaultBufLen);
- iAttaName = HBufC8::NewL(DefaultBufLen);
- iAttaCid = HBufC8::NewL(DefaultBufLen);
- iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
- iAttaCharset = 0;
- iXTypeParams = new(ELeave) CDesC8ArrayFlat(4);
- iContentTypeParams = new(ELeave) CDesC8ArrayFlat(4);
-
- }
-
-// Two-phased constructor.
-CMmsAttaStructure* CMmsAttaStructure::NewL()
- {
- CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// Destructor
-CMmsAttaStructure::~CMmsAttaStructure()
- {
- delete iAtta;
- delete iAttaName;
- delete iAttaType;
- delete iAttaCid;
- delete iAttaRecommendedName;
- if ( iContentTypeParams )
- {
- iContentTypeParams->Reset();
- }
- delete iContentTypeParams;
- if ( iXTypeParams )
- {
- iXTypeParams->Reset();
- }
- delete iXTypeParams;
- }
-
-
-// End of File
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmstestbed.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2357 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <mtmdef.h>
-#include <CoreApplicationUIsSDKCRKeys.h>
-#include <mmsheaders.h>
-#include <mmscmds.h>
-#include <mmsencode.h>
-#include <mmscliententry.h>
-#include <logwrap.h>
-#include <logcli.h>
-#include <logview.h>
-#include "mmssettings.h" //use mmssettings.h instead of cmmssettings.h
-#include "mmstestbed.h"
-#include "mmsreadfile.h"
-#include "mmstestuitimer.h"
-#include "mmsteststaticutils.h"
-#include "mmstestbed.hrh"
-
-//constants
-_LIT( KMmsSender, "0601234567" );
-
-MmsTestBed::MmsTestBed()
- {
- //start the timer
- iTimer = CTestUiTimer::NewL();
- iTimer->Cancel();
-
- iWait = CMsvOperationActiveSchedulerWait::NewLC();
- // don't leave iWait on cleanup stack
- CleanupStack::Pop();
-
- //open msvsession
- iSession = CMsvSession::OpenSyncL(*this);
- //create client registry
- iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
- //create client mtm
- iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
- KUidMsgTypeMultimedia);
-
- User::LeaveIfError( iFs.Connect() );
- iFs.SetSessionPath( KRootPath );
- iSettings = CMmsSettings::NewL();
- iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
- findDefaultL();
- iServiceId = iDefaultServiceId;
-
- //validate the settings
- iSettings->ValidateSettings();
-
- iLogEvent = CLogEvent::NewL();
- iLogEvent->SetEventType(KLogMmsEventTypeUid);
- iLogClient = NULL; // we test soon if this is available
- iLogView = NULL; // needs log client
- if ( checkLogClient() )
- {
- // first we generate a general view of all events
- // we'll set the filter when we update the view
- iLogView = CLogViewEvent::NewL( *iLogClient );
- }
- iLogFilter = CLogFilter::NewL();
- // we try to filter MMS events
- iLogFilter->SetEventType(KLogMmsEventTypeUid);
- }
-
-MmsTestBed::~MmsTestBed()
- {
- delete iLogView;
- delete iLogFilter;
- delete iLogClient;
- delete iLogEvent;
- delete iSettings;
- delete iMmsHeaders;
- if(iTimer)
- {
- iTimer->Cancel();
- delete iTimer;
- }
- //delete iMsvEntrySelection;
- delete iMmsClient;
- delete iClientMtmRegistry;
- //delete iClientMtmRegistry;
- delete iSession;
- delete iWait;
- }
-
-void MmsTestBed::setConnectionLocal(bool value)
- {
- //value = true for global off, local on
- //value = false for global on, local off
- iSettings->LoadSettingsL();
- iSettings->SetLocalMode( value );
- iSettings->SaveSettingsL();
- }
-
-void MmsTestBed::fromOutboxToMmsc()
- {
- CMsvEntry* cEntry = NULL;
-
- // Get List of services
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
- KUidMsgTypeMultimedia);
- CleanupStack::PushL(selection);
-
- // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
- for (TInt i = 0; i < selection->Count(); ++i)
- {
- cEntry->SetEntryL(selection->At(i));
- TMsvEntry entry = cEntry->Entry();
- entry.SetReadOnly(EFalse);
- entry.SetSendingState(KMsvSendStateUnknown);
- cEntry->ChangeL(entry);
- }
-
- selection->InsertL(0, iServiceId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack(parameters);
-
- op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending)
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if (iWait->iStatus.Int() != KErrNone)
- {
- //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- CleanupStack::PopAndDestroy(); //cEntry
- }
-
-void MmsTestBed::fromMmscToInbox()
- {
- CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
- CleanupStack::PushL(msvEntrySelection);
-
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- msvEntrySelection->InsertL(0, iServiceId);
- }
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack(parameters);
-
- op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
- paramPack, iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending)
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if (iWait->iStatus.Int() != KErrNone)
- {
- //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); //msvEntrySelection
- }
-
-void MmsTestBed::findDefaultL()
- {
- iSettings->LoadSettingsL();
- iDefaultServiceId = iSettings->Service();
- }
-
-void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
- TAny* aArg2, TAny* /*aArg3*/)
- {
- iEvent = aEvent;
- if (aEvent == EMsvGeneralError)
- {
- return;
- }
- TMsvId parentId = KMsvNullIndexEntryId;
- if (aArg2 != NULL)
- {
- parentId = *(TMsvId*) aArg2;
- }
-
- CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
- TMsvEntry tEntry;
- TMsvId service;
- TInt error = KErrNone;
- error = iSession->GetEntry(selection->At(0), service, tEntry);
-
- CMsvEntry* cEntry = NULL;
- switch (aEvent)
- {
- case EMsvEntriesCreated:
- {
- if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
- {
- // emit signal for new entry into INBOX
- emit entryCreatedInInbox(tEntry.Id());
- }
- else if (parentId == KMsvDraftEntryIdValue)
- {
- // emit signal for new entry into Draft
- emit entryCreatedInDraft(tEntry.Id());
- }
- else if (parentId == iServiceId)
- {
- // emit signal for new Entry into SERVICE
- }
- else
- {
- // do nothing
- }
- }
- break;
- case EMsvEntriesChanged:
- {
- TMsvId id;
- CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
- if (selection == NULL)
- {
- // no selection, cannot handle
- return;
- }
- id = selection->At(0);
- //DEBUG Entry changed"));
- if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
- {
-/*
- cEntry = iSession->GetEntryL( parentId );
- CleanupStack::PushL( cEntry );
- TRAPD (error, cEntry->SetEntryL( id ));
- if ( error != KErrNone )
- {
- CleanupStack::PopAndDestroy(); // cEntry
- return;
- }
- TMsvEntry tEntry = cEntry->Entry();
- if ( tEntry.Visible() )
- {
- // generate fake delivery report
- CMsvStore* store = cEntry->ReadStoreL();
- CleanupStack::PushL( store );
- CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
- CleanupStack::PushL( mmsHeaders );
- mmsHeaders->RestoreL( *store );
- iEncodeBuffer->ResizeL( 0 );
- generateDeliveryReport( mmsHeaders );
- CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
- }
- CleanupStack::PopAndDestroy(); // cEntry
-*/
- }
- }
- break;
- case EMsvEntriesDeleted:
- {
- //emit signal for entry deleted
- }
- break;
- case EMsvEntriesMoved:
- {
- if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
- {
- // entry moved to outbox
- emit entryMovedToOutbox(tEntry.Id());
- }
- else if (parentId == KMsvSentEntryIdValue)
- {
- // entry moved to sent folder
- emit entryMovedToSent(tEntry.Id());
- }
- else
- {
- // do nothing
- }
- }
- break;
- default:
- break;
- }
- }
-
-void MmsTestBed::createMmsService()
- {
- CMmsSettings * settings = CMmsSettings::NewL();
- CleanupStack::PushL( settings );
- settings->CreateNewServiceL( *iSession );
- CleanupStack::PopAndDestroy(); // settings
- return;
- }
-
-void MmsTestBed::cleanup()
- {
- TMsvId entryToBeKilled;
- // Get access to root index
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
-
- entryToBeKilled = iSettings->Service();
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- while (entryToBeKilled != KMsvNullIndexEntryId)
- {
- // delete child of root entry
- deleteEntry(entryToBeKilled, *cEntry);
- entryToBeKilled = iSettings->Service();
- }
-
- CleanupStack::PopAndDestroy(); // cEntry
- // We deleted everything!
- iDefaultServiceId = KMsvNullIndexEntryId;
- iServiceId = KMsvNullIndexEntryId;
- }
-
-void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
- {
- aClientEntry.DeleteL(aEntryId);
- }
-
-void MmsTestBed::cleanupAndCreateNewService()
- {
- cleanup();
- // all old service entries have been destroyed, create a new one
- createMmsService();
- }
-
-void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
- {
- // update settings in mmsclient
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
-
- RFileReadStream readStream;
- readStream.PushL();
-// TMsvId id = KMsvNullIndexEntryId;
- CBufFlat* encodeBuffer = NULL;
- CMmsEncode* encoder = NULL;
-
- // Open the file
- TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
- if (err != KErrNone) User::Leave( err );
-
- TInt retCode = 0;
- CMmsReadFile* readFile = NULL;
- readFile = CMmsReadFile::NewL( iFs, readStream );
- CleanupStack::PushL( readFile );
-
- TInt messageCounter = 0;
- CMsvEntry* cEntry = NULL;
-
- while(!retCode)
- {
- // READ MESSAGE TO BUFFERS
- iMmsHeaders->Reset(iSettings);
- // put in some message type just for fun (testing...)
- iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
- retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
- if(readFile->iMessageType == ETestNewMessage)
- {
- // CREATE MESSAGE ENTRY
- switch ( aCommand )
- {
- case ECreateToInbox:
- case ECreateNotification:
- cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- break;
- case ECreateToSentItems:
- cEntry = iSession->GetEntryL(KMsvSentEntryId);
- break;
- case ECreateToDrafts:
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- break;
- case ECreateHeadersFromFile:
- // here we just encode headers, no message entry
- // the entry is fake.
- break;
- case ECreateMMBoxViewConf:
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- // entry is not created for the description items
- // they become attachments
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- }
- break;
- default:
- cEntry = iSession->GetEntryL(aBox);
- break;
- }
-
- // if we are just playing with headers we have no entry
- if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
- {
- CleanupStack::PushL(cEntry);
- iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
-
- // CREATE MESSAGE
- iMmsClient->CreateMessageL(iServiceId);
- }
- else if ( aCommand == ECreateMMBoxViewConf )
- {
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- CleanupStack::PushL(cEntry);
- iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
-
- // CREATE MESSAGE
- iMmsClient->CreateMessageL(iServiceId);
- }
- else
- {
- encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
- CleanupStack::PushL( encodeBuffer );
- encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
-
- // encode headers to a binary file
- encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
-
- iFilename = KMmsMMBoxDescriptionDirectory;
- TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
-
- CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
- encodeBuffer = NULL;
- encoder = NULL;
- }
- }
- else
- {
- encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
- CleanupStack::PushL( encodeBuffer );
- encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
-
- // encode headers to a binary file
- encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
-
- iFilename = KMmsDumpDirectory;
- TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
-
- CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
- encodeBuffer = NULL;
- encoder = NULL;
- }
- }
-
- if ( aCommand != ECreateHeadersFromFile &&
- ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
- {
- if(readFile->iMessageType == ETestSettings)
- {
- TMsvId ServiceId = iMmsClient->DefaultServiceL();
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
- }
-
- TMemoryInfoV1Buf memory;
- UserHal::MemoryInfo( memory );
- TInt available = memory().iFreeRamInBytes;
-// TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
-
- TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
-
- available = memory().iFreeRamInBytes;
-// TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
-
- if(readFile->iMessageType == ETestNewMessage)
- {
- TMsvEntry tEntry = iMmsClient->Entry().Entry();
- TMsvId id = tEntry.Id();
- if ( err == KErrNone )
- {
- // SAVE MESSAGE
- iMmsClient->SaveMessageL();
-
- // If we are creating a MMBox View confirmation,
- // we add all binary files from KMmsMMBoxDirectory
- // as attachments.
-
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- addMMBoxDescriptions();
- }
-
- // reload the entry in case mms client put something into it
- // MESSAGE MUST BE SET VISIBLE
- tEntry = iMmsClient->Entry().Entry();
- if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
- {
- tEntry.iMtmData1 |= KMmsMessageAdvertisement;
- }
- else if ( iMmsClient->MessageClass() == EMmsClassInformational )
- {
- tEntry.iMtmData1 |= KMmsMessageInformational;
- }
- tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
-
- // Test: Set all as editor oriented - except notifications!
- if ( aCommand == ECreateNotification )
- {
- tEntry.iMtm = KUidMsgMMSNotification;
- }
- else
- {
- tEntry.iMtmData1 |= KMmsMessageEditorOriented;
- }
- if ( aCommand == ECreateToInbox )
- {
- tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
- tEntry.SetReadOnly( ETrue );
- tEntry.SetNew( ETrue );
- tEntry.SetUnread( ETrue );
- }
- else if ( aCommand == ECreateToSentItems )
- {
- tEntry.SetReadOnly( ETrue );
- }
- tEntry.SetVisible( ETrue );
- tEntry.SetInPreparation( EFalse );
- TTime now;
- now.UniversalTime();
- tEntry.iDate = now;
- TMsvId entryId = tEntry.Id();
- iMmsClient->Entry().ChangeL( tEntry );
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- // Encode to the directory that is used to fetch MMBox view
- iFilename.Copy( KMmsMMBoxDirectory );
- encodeMessageFromDrafts();
- cEntry->SetEntryL( KMsvDraftEntryId );
- cEntry->DeleteL( entryId );
- }
- }
- else
- {
- //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
- iSession->RemoveEntry(id);
- err = KErrNone; // clear error
- }
- CleanupStack::PopAndDestroy(); // cEntry
- cEntry = NULL;
- }
- if(readFile->iMessageType == ETestSettings)
- {
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
- }
- }
-
- CleanupStack::PopAndDestroy(); //readFile
-
- readStream.Close();
- readStream.Pop();
-
- /*
- iMmsClient->SwitchCurrentEntryL(id);
- */
- }
-
-void MmsTestBed::addMMBoxDescriptions()
- {
- // add the contents of KMmsMMBoxDescriptionDirectory as attachments
- CDir* fileList = NULL;
- TInt i = 0; // general counter
- TInt error = KErrNone;
- iCurrentPath = KMmsMMBoxDescriptionDirectory;
-
- iFs.SetSessionPath(iCurrentPath);
-
- TFindFile finder( iFs );
- error = finder.FindWildByPath( KWild, NULL, fileList );
- CleanupStack::PushL( fileList );
- TInt fileCounter = 0;
-
- if ( error == KErrNone )
- {
- fileCounter = fileList->Count();
- }
-
- TEntry entry;
-
- if ( error == KErrNone )
- {
- for ( i = 0; i < fileCounter; ++i )
- {
- // Reset inactivity timer to keep viewServer from crashing
- User::ResetInactivityTime();
- entry = (*fileList)[i]; // name is entry.iName
- iFilename.Copy( iCurrentPath );
- iFilename.Append( entry.iName );
- TPtrC ptr;
- ptr.Set( iFilename );
- iWait->iStatus = KErrNone;
- iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
-
- iWait->Start();
- // The descriptions are cleared after being used
- iFs.Delete( ptr);
- }
- }
-
- iMmsClient->SaveMessageL(); // just in case somthing must be updated
- CleanupStack::PopAndDestroy(); // fileList
- fileList = NULL;
- }
-
-void MmsTestBed::encodeMessageFromDrafts()
- {
- CMmsEncode* encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
- // encode a message iMmsClientPoints to
- iMmsClient->LoadMessageL();
- CMsvStore* store = iMmsClient->Entry().ReadStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->RestoreL( *store );
- CleanupStack::PopAndDestroy(); // store
- store = NULL;
- iWait->iStatus = KErrNone;
-
-// caller sets the directory
-// iFilename = KMmsMessageDumpDirectory;
-
- CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
- CleanupStack::PushL( entryWrapper );
- iEncodeBuffer->ResizeL(0);
- encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
- iWait->Start();
- if ( iWait->iStatus == KErrNone )
- {
- TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
- }
- iEncodeBuffer->ResizeL(0);
- CleanupStack::PopAndDestroy(); // entryWrapper
- CleanupStack::PopAndDestroy(); // encoder
- }
-
-void MmsTestBed::deleteNotifications()
- {
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
-
- CMsvEntry* cEntry = NULL;
- // delete all messages from the specified box
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
-
- if ( mmsFolderId != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL(mmsFolderId);
-
- // show invisible entries
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL(msvEntrySelection);
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- if (msvEntrySelection->Count() > 0)
- {
- CMsvOperation* op = iSession->TransferCommandL(
- *msvEntrySelection,
- EMmsDeleteEntries,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- CleanupStack::PopAndDestroy(); // op
- }
-
- // These cannot be deleted unless we have the a server mtm
- // corresponding to this mtm type.
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CleanupStack::PopAndDestroy(); //msvEntrySelection
- msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
- CleanupStack::PushL(msvEntrySelection);
-
- if (msvEntrySelection->Count() > 0)
- {
- CMsvOperation* op = iSession->TransferCommandL(
- *msvEntrySelection,
- EMmsDeleteEntries,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- CleanupStack::PopAndDestroy(); // op
- }
-
- CleanupStack::PopAndDestroy(); //msvEntrySelection
-
- CleanupStack::PopAndDestroy(); //cEntry
- }
- }
-
-TMsvId MmsTestBed::findMMSFolder()
- {
- return iSettings->NotificationFolder();
- }
-
-void MmsTestBed::restoreFactorySettings()
- {
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
- // do not reset access point
- TInt accessPoint = iSettings->AccessPoint( 0 );
- iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
- TInt count = iSettings->AccessPointCount();
- TInt i = 0;
- for ( i = count - 1; i >= 0; --i )
- {
- iSettings->DeleteAccessPointL( i );
- }
- // restore the original access point
- if ( accessPoint > 0 )
- {
- // a negative access point is an error (most likely "KErrNotFound")
- iSettings->AddAccessPointL( accessPoint, 0 );
- }
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
-
-void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
- {
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
-
- iSettings->SetReceivingModeHome( aState );
-
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
-
-void MmsTestBed::sendFromFile()
- {
- CMsvOperation * op = NULL;
-
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
- CleanupStack::PushL( cEntry );
-
- CMsvEntrySelection* selection = NULL;
- selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy(); // cEntry
- CleanupStack::PushL( selection );
-
- TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
- if ( error != KErrNone )
- {
- CleanupStack::PopAndDestroy(); // selection
- delete op;
- return;
- }
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(2); // op, selection
- }
-
-void MmsTestBed::sendOneByOne()
- {
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
- CleanupStack::PushL( cEntry );
-
- CMsvEntrySelection* selection = NULL;
- selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL( selection );
-
- CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( shortSelection );
-
- TInt i;
-
- for ( i = 0; i < selection->Count(); ++i )
- {
- shortSelection->Reset();
- shortSelection->AppendL( selection->At( i ) );
-
- CMsvOperation * op = NULL;
-
- TTime now;
- now.UniversalTime();
-
- TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
- if ( error != KErrNone )
- {
- delete op;
- CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
- return;
- }
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
-
- }
- CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
- }
-
-void MmsTestBed::sendNotifications()
- {
- // Only send one notification!!
-
- TInt error = KErrNone;
-
- if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
- {
- //Not a file
- return;
- }
- TMsvId mmsFolder = findMMSFolder();
-
- TEntry entry;
-
-
- // now I think we have a filename
- TEntry orgEntry;
- TUint size = 0;
- error = iFs.Entry( iCurrentFile, orgEntry );
- size = orgEntry.iSize;
-
- //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
- if ( size == 0 )
- {
- //empty file
- //TMmsLogger::Log(_L("- empty file"));
- return;
- }
-
- if ( iEncodeBuffer == NULL )
- {
- iEncodeBuffer = CBufFlat::NewL( size );
- }
- else
- {
- iEncodeBuffer->ResizeL( 0 );
- iEncodeBuffer->ResizeL( size );
- }
-
- RFile inFile;
- error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
- TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
- if ( error == KErrNone )
- {
- error = inFile.Read( ptr, size );
- inFile.Close();
- }
- else
- {
- //Error
- //TMmsLogger::Log(_L("- can't read file"));
- return;
- }
-
- TUint8 byte;
- TUint position = 0;
- TUint32 uintvar = 0;
-
- if ( size > 2 )
- {
- iEncodeBuffer->Read( 1, &byte, 1 );
- if ( byte == 6 ) // PUSH PDU
- {
- // try to find out length of header
- position = 2;
- iEncodeBuffer->Read( position, &byte, 1);
-
- while ( byte & 0x80 && position < size )
- {
- uintvar += ( byte & 0x7f );
- uintvar <<= 7;
- position++;
- iEncodeBuffer->Read( position, &byte, 1 );
- }
-
- // add last byte without shift
- uintvar += byte;
- position++;
- }
- }
-
- position += uintvar;
-
- if ( position < size )
- {
- ptr = iEncodeBuffer->Ptr( position );
- size = ptr.Length();
- }
-
- if ( size == 0 )
- {
- //no MMS stuff
- //TMmsLogger::Log(_L("- no MMS stuff"));
- return;
- }
-
- TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
-
- // Now we have streamed our data into this entry.
- // Now we have an entry that says: local service, MMS MTM
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- if ( entryId != KMsvNullIndexEntryId )
- {
- selection->AppendL( entryId );
- }
- else
- {
- selection->AppendL( iDefaultServiceId );
- }
-
- TWatcherParameters parameters; // initialized to zero
- parameters.iWatcherId = RThread().Id();
- parameters.iDataPointer = &ptr;
- TWatcherParametersBuf paramPack( parameters );
-
- CMsvOperation * op = NULL;
-
- op = iSession->TransferCommandL(
- *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- User::After(1000000);
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::copyDrafts()
- {
- CMsvEntry* cEntry = NULL;
-// Copies contents of sent folder to drafts for retrying sending.
-
- cEntry = iSession->GetEntryL(KMsvSentEntryId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages in drafts
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-
- TMsvLocalOperationProgress progress;
- cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
-
- TInt i = 0;
- for ( i = 0; i < selection->Count(); ++i )
- {
- cEntry->SetEntryL( selection->At( i ) );
- TMsvEntry entry = cEntry->Entry();
- entry.SetReadOnly( EFalse );
- cEntry->ChangeL( entry );
- }
-
- CleanupStack::PopAndDestroy(2); // selection, cEntry
- }
-
-void MmsTestBed::garbageCollection(TUint32 aReason)
- {
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
-
- TMMSGarbageCollectionParameters parameters; // initialized to zero
- parameters.iReasonFlags = aReason;
- TMMSGarbageCollectionParametersBuf paramPack( parameters );
- op = iSession->TransferCommandL(
- *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::messageVariation()
- {
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
-
- op = iSession->TransferCommandL(
- *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::cancelSendScheduling()
- {
- CMsvEntry* cEntry = NULL;
- setFetchingState( EMmsReceivingPostpone );
- testFile( iCurrentFile );
- scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
- deleteSendSchedule();
-
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- if (iMsvEntrySelection != NULL)
- {
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- }
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy();
- }
-
-void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
- {
- CMsvEntry* cEntry = NULL;
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- cEntry = iSession->GetEntryL(aBoxId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-// selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledSend,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::deleteSendSchedule()
- {
- CMsvEntry* cEntry = NULL;
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsDeleteSchedule,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::cancelFetchScheduling()
- {
- TMsvId mmsFolder = findMMSFolder();
- CMsvEntry* cEntry = NULL;
- setFetchingState( EMmsReceivingPostpone );
- testFile( iCurrentFile );
- fromOutboxToMmsc(); // immediate send (EMmsSend)
-
- // Wait until notification has arrived - may take a while in global mode
- TInt i = 0;
- while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
- && i < 2000 )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- i++;
- if ( (i/100) * 100 == i )
- {
- //TMmsLogger::Log(_L("%d:th wait cycle"), i );
- }
- CActiveScheduler::Start();
- }
- iTimer->Cancel();
-
- fetchForced( 10000 ); // delay to allow cancelling
- deleteFetchSchedule();
-
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(mmsFolder);
- if (iMsvEntrySelection != NULL)
- {
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- }
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
- {
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledReceiveForced,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::deleteFetchSchedule()
- {
- CMsvEntry* cEntry = NULL;
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
- cEntry = iSession->GetEntryL( mmsFolderId );
- CleanupStack::PushL(cEntry);
- // Get all notifications
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsDeleteSchedule,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::doAFetchCycle()
- {
- // Sends a message from iCurrentFile and lets it come back
- TMsvId mmsFolder = findMMSFolder();
- testFile( iCurrentFile );
- fromOutboxToMmsc(); // immediate send (EMmsSend)
- // fetching will start automatically
-
- TInt i = 0;
- while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
- && i < 2000
- && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- i++;
- if ( (i/100) * 100 == i )
- {
- //TMmsLogger::Log(_L("%d:th wait cycle"), i );
- }
- CActiveScheduler::Start();
- }
- iTimer->Cancel();
- }
-
-bool MmsTestBed::checkLogClient()
- {
- if ( iLogClient == NULL )
- {
- TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
- }
- return ( iLogClient != NULL );
- }
-
-int MmsTestBed::getLogEntries()
- {
- TInt count = 0;
- if ( !iLogView )
- {
- return 0;
- }
-
- if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
- {
- // should complete with KErrNone
- iWait->Start();
- if ( iWait->iStatus.Int() == KErrNone )
- {
- count = iLogView->CountL();
- }
- }
- return count;
- }
-
-void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
- {
- CMsvOperation* opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
- iWait->Start();
- if (!opert->iStatus.Int()==KErrNone)
- {
- // what should we do? panic?
- }
-
- TPckgBuf<TMsvLocalOperationProgress> package;
- package.Copy(opert->ProgressL());
- *(TMsvId*)&aNewEntry = package().iId;
-
- delete opert; opert=NULL;
- }
-
-void MmsTestBed::cleanOutbox()
- {
- TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
- }
-
-void MmsTestBed::cleanInbox()
- {
- TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
- }
-
-void MmsTestBed::cleanSent()
- {
- TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
- }
-
-void MmsTestBed::cleanDrafts()
- {
- TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
- }
-
-void MmsTestBed::cleanAll()
- {
- cleanInbox();
- cleanOutbox();
- cleanSent();
- cleanDrafts();
- TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
- deleteNotifications();
- }
-
-void MmsTestBed::reply()
- {
- // The first message from inbox is replied to
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
- CMsvOperation * op = NULL;
- op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::replyToAll()
- {
- // The first message from inbox is replied to
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
-
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
- KMsvMessagePartRecipient;
- CMsvOperation * op = NULL;
- op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::forward()
- {
- // The first message from inbox is forwarded
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
-
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
- KMsvMessagePartRecipient | KMsvMessagePartAttachments;
- CMsvOperation * op = NULL;
- op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- iMmsClient->SwitchCurrentEntryL( newEntry );
- // Add a sender: 0601234567
- iMmsClient->LoadMessageL();
- iMmsClient->SetSenderL( KMmsSender );
- iMmsClient->SaveMessageL();
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::sendReadReport()
- {
- // TURN READ REPORTS ON (until available from menu)
- iSettings->LoadSettingsL();
- iSettings->SetReadReplyReportSendingAllowed( ETrue );
- iSettings->SaveSettingsL();
- iMmsClient->RestoreSettingsL();
-
-
- // Read report is sent for the first message in inbox
- CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
-
- if ( iMsvEntrySelection->Count() == 0 )
- {
- return;
- }
- TMsvId originalEntry = iMsvEntrySelection->At( 0 );
-
- // new test using Client MTM
- CMsvOperation * op = NULL;
- op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy( op );
- op = NULL;
-
- // Try sending the read report to current entry
-
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy( op );
- op = NULL;
-
-/*
- cEntry->SetEntryL( originalEntry );
- iMmsHeaders->Reset();
- CMsvStore* store = cEntry->ReadStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->RestoreL( *store );
- CleanupStack::PopAndDestroy( store );
- store = NULL;
- HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
- CleanupStack::PushL( messageId );
- messageId->Des().Copy( iMmsHeaders->MessageId() );
-
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- iMmsClient->LoadMessageL();
-
- iMmsHeaders->Reset();
- iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
- // Message id cannot be accessed via MMS Client MTM!
-
- iMmsHeaders->SetMessageIdL( messageId->Des() );
- CleanupStack::PopAndDestroy( messageId );
-
- iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
- // sender must be insert-address-token because we don't know our number
- TTime now;
- now.UniversalTime();
-
- _LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
-
- TTime y1970( K1970 );
- TTimeIntervalMicroSeconds interval;
- // we can't use "seconds from" as it only returns a
- // 32 bit signed integer. If fails in 2038.
- // "microseconds from" returns a 64 bit signed integer
- interval = now.MicroSecondsFrom( y1970 );
- // date in iMmsHeaders() in seconds from 1.1.1970.
- iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
- iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
-
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = FindMMSFolderL();
-
- cEntry->SetEntryL( mmsFolderId );
-
- TMsvEntry entry;
- entry.iType = KUidMsvMessageEntry;
- entry.iMtm = KUidMsgTypeMultimedia;
- entry.SetVisible( ETrue );
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- entry.iRelatedId = iDefaultServiceId;
- entry.iMtmData1 = KMmsMessageReadRecInd;
- cEntry->CreateL( entry );
- TMsvId entryId = entry.Id();
-
- cEntry->SetEntryL( entryId );
-
- store = cEntry->EditStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->StoreL( *store );
- store->CommitL();
- CleanupStack::PopAndDestroy( store );
- store = NULL;
-
- CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, entryId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy( op );
- CleanupStack::PopAndDestroy( selection );
-*/
- CleanupStack::PopAndDestroy( cEntry );
- }
-
-int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
- {
- TInt error = KErrNone;
- TInt messageCount = 0;
- TInt failureCount = 0;
- do {
- CMsvEntry* cEntry = NULL;
-
- // Get List of services
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- failureCount++;
- // These are failures that fail in Message server.
- if ( failureCount >= 63 && failureCount <= 64 )
- {
- failureCount = 65;
- }
- cEntry->SetEntryL( iServiceId );
- TMsvEntry entry = cEntry->Entry();
- entry.iMtmData3 &= 0x0000000FF;
- entry.iMtmData3 |= failureCount << 8;
- cEntry->ChangeL( entry );
-
- selection->InsertL(0, iServiceId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
-
- if ( error == KErrNone )
- {
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- error = iWait->iStatus.Int();
- if ( iWait->iStatus.Int() != KErrNoMemory )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
- }
-
- CleanupStack::PopAndDestroy(); // op
- }
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // selection
- CleanupStack::PopAndDestroy(); // cEntry
- selection = NULL;
- cEntry = NULL;
- cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
- CleanupStack::PushL(cEntry);
- selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- messageCount = selection->Count();
- delete selection;
- selection = 0;
- CleanupStack::PopAndDestroy(); //cEntry
- }
- while ( error == KErrNoMemory || messageCount > 0 );
- return failureCount;
- }
-
-int MmsTestBed::fromMmscToInboxWithMemoryFailure()
- {
- TInt error = KErrNone;
- TInt failureCount = 0;
- TInt messageCount = 0;
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
-
- do {
- // Inbox must be cleaned if failure makes message to be fetched more than once.
- // should not happen, but this test is quite stressful, and perfect result
- // cannot be guaranteed.
- // What is expected:
- // 1. Program does not crash
- // 2. After sufficient number of retries the message is fetched and notification deleted.
- TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
- CMsvEntry* cEntry = NULL;
- CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
- CleanupStack::PushL(msvEntrySelection);
-
- cEntry = iSession->GetEntryL(iServiceId);
- CleanupStack::PushL(cEntry);
-
- failureCount++;
- // These are failures that fail in Message server.
- if ( failureCount >= 63 && failureCount <= 64 )
- {
- failureCount = 65;
- }
- cEntry->SetEntryL( iServiceId );
-
- TMsvEntry entry = cEntry->Entry();
- entry.iMtmData3 &= 0x0000000FF;
- entry.iMtmData3 |= failureCount << 8;
- cEntry->ChangeL( entry );
-
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- msvEntrySelection->InsertL(0, iServiceId);
- }
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
- EMmsReceiveForced,
- *msvEntrySelection,
- paramPack,
- iWait->iStatus) );
-
- if ( error == KErrNone )
- {
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- error = iWait->iStatus.Int();
- if ( iWait->iStatus.Int() != KErrNoMemory )
- {
- //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
- }
- }
-
- CleanupStack::PopAndDestroy(); // op
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // msvEntrySelection
- CleanupStack::PopAndDestroy(); // cEntry
- msvEntrySelection = NULL;
- cEntry = NULL;
- cEntry = iSession->GetEntryL( mmsFolderId );
- CleanupStack::PushL(cEntry);
- msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- messageCount = msvEntrySelection->Count();
- delete msvEntrySelection;
- msvEntrySelection = 0;
- CleanupStack::PopAndDestroy(); //cEntry
- }
- while ( error == KErrNoMemory || messageCount > 0 );
- if ( error != KErrNoMemory && error != KErrNone )
- {
- //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
- }
- return failureCount;
- }
-
-void MmsTestBed::sendViaClient()
- {
- CMsvEntry* cEntry = NULL;
-
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages in drafts
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-
- CMsvOperation * op = NULL;
- TTime now;
- now.UniversalTime();
- op = iMmsClient->SendL( *selection, iWait->iStatus, now );
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
- {
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledReceive,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::fetchForcedImmediate()
- {
- TCommandParameters parameters;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsReceiveForced,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::getEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-
- CLogEventType* eventType = CLogEventType::NewL();
- CleanupStack::PushL( eventType );
- eventType->SetUid(iLogEvent->EventType());
- iLogClient->GetEventType( *eventType, iWait->iStatus );
-
- iWait->Start();
- CleanupStack::PopAndDestroy(); // eventType
- }
-
-void MmsTestBed::addEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-
- CLogEventType* eventType = CLogEventType::NewL();
- CleanupStack::PushL( eventType );
- eventType->SetUid(iLogEvent->EventType());
- eventType->SetDescription(_L("Multimedia Message") );
- eventType->SetLoggingEnabled( ETrue );
-
-// iWait->iStatus = KRequestPending;
- iLogClient->AddEventType( *eventType, iWait->iStatus );
- iWait->Start();
- CleanupStack::PopAndDestroy(); // eventType
- }
-
-void MmsTestBed::deleteEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-// iWait->iStatus = KRequestPending;
- iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
- iWait->Start();
- }
-
-void MmsTestBed::cleanLog()
- {
- TInt count = 0;
-
- count = getLogEntries();
-
- TInt i;
- for ( i = 0; i < count; ++i )
- {
- // when a view is created, it will be positioned on the first event
-// iWait->iStatus = KRequestPending;
- iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
- iWait->Start();
-
- if ( iLogView->NextL( iWait->iStatus ) )
- {
- // should complete with KErrNone
- iWait->Start();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- // could not get next event!
- break;
- }
- }
- else
- {
- break; // no more events!
- }
- }
- }
-
-void MmsTestBed::setOnline(bool value)
- {
- //value = true for online mode
- //value = false for offline mode
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
- if( retval == KErrNone )
- {
- repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
- delete repository;
- }
- }
-
-void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
- {
- iEncodeBuffer->ResizeL( 1024 );
-
- TInt position = 0;
-
- // encode message type
- iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
- position++;
- iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
- position++;
-
- // version
- iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
- position++;
-
- TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
- iEncodeBuffer->Write( position, &version, 1 );
- position++;
-
- // message id from the headers
- // At least once MMSC did not send us the message id!
- // if message id is missing, we cannot match the entry!
- // This only a fake. Real delivery reports should always
- // contain the message id.
- if ( aMmsHeaders->MessageId().Length() > 0 )
- {
- iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
- position++;
- iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
- position += aMmsHeaders->MessageId().Length();
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
- }
-
- // To is taken from the headers
- iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
- position++;
-
- TPtrC recipient;
- if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
- aMmsHeaders->ToRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->ToRecipients()[0] );
- }
- else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
- aMmsHeaders->CcRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->CcRecipients()[0] );
- }
- else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
- aMmsHeaders->BccRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->BccRecipients()[0] );
- }
- else
- {
- recipient.Set( _L("Jasso-Kissa@jii.fi") );
- }
-
- TMmsAddressType addressType = EMmsAddressTypeUnknown;
-
- if ( recipient.Find( KMiuMau ) != KErrNotFound )
- {
- addressType = EMmsAddressTypeEmail;
- }
- else
- {
- addressType = EMmsAddressTypeMobile;
- }
-
- TUint8 character;
- TInt i;
- if ( addressType == EMmsAddressTypeEmail )
- {
- // email address - ASCII ONLY - THIS IS JUST A TEST!
-
- for ( i = 0; i < recipient.Length(); ++i )
- {
- character = TUint8( recipient[i] & 0xff );
- iEncodeBuffer->Write( position, &character, 1 );
- position++;
- }
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
-
- }
- else
- {
- // must be a phone number
- // We expect for now that the format is correct as is
- // All legal characters present in a phone number are ASCII
-
- TInt i;
- for ( i = 0; i < recipient.Length(); ++i )
- {
- character = TUint8( recipient[i] & 0xff );
- iEncodeBuffer->Write( position, &character, 1 );
- position++;
- }
- iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
- position += KMmsPlmnLength;
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
- }
-
- // date
- iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
- position++;
-
- TLocale locale;
- locale.Refresh();
- TInt64 UtcDate;
- TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
-
- TTime now;
- now.UniversalTime();
- UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
-
- UtcDate -= universalTimeOffset.Int();
-
- if ( locale.QueryHomeHasDaylightSavingOn() )
- {
- TTimeIntervalSeconds daylightSaving( 60 * 60 );
- UtcDate -= daylightSaving.Int();
- }
-
- TUint8 len; // number of bytes we will need
- len = 0;
- TUint8 array[8];
-
- TInt64 temp = UtcDate;
-
- for (i = 7; i >= 0; --i)
- {
- array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
- I64LSR( temp, 8 );
- }
-
- len = 8;
- i = 0;
- while( ( array[i]== 0 ) && ( i < 8 ) )
- {
- i++;
- len--;
- }
-
- // a zero should be coded as short integer.
- // However, if there is a valid reason to code a zero as a long integer,
- // we allow it. The caller should know what he is doing.
- if ( len == 0 )
- {
- len = 1;
- }
- // write short length
- iEncodeBuffer->Write( position, &len, 1 );
- position++;
- // write as many bytes as were non-zero
- iEncodeBuffer->Write( position, &(array[8 - len] ), len );
- position+= len;
- // status
- iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
- position++;
- iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
- position++;
- // DONE!!!
- iEncodeBuffer->ResizeL( position );
- return;
- }
-
-void MmsTestBed::sendDeliveryReport()
- {
- if ( iEncodeBuffer->Size() == 0 )
- {
- //No delivery report
- return;
- }
-
-
- TMsvId mmsFolder = findMMSFolder();
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
-
- TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
- TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
-
- // Now we have streamed our data into this entry.
- // Now we have an entry that says: local service, MMS MTM
-
- if ( entryId != KMsvNullIndexEntryId )
- {
- selection->AppendL( entryId );
- }
- else
- {
- selection->AppendL( iDefaultServiceId );
- }
-
- TWatcherParameters parameters; // initialized to zero
- parameters.iWatcherId = RThread().Id();
- parameters.iDataPointer = &ptr;
- TWatcherParametersBuf paramPack( parameters );
-
- CMsvOperation * op = NULL;
-
-// iWait->iStatus = KRequestPending;
- op = iSession->TransferCommandL(
- *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmsteststaticutils.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,528 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <f32file.h>
-#include <centralrepository.h>
-#include <apparc.h>
-#include <msvapi.h>
-#include <msvids.h>
-
-#include "mmsteststaticutils.h"
-#include "mmsconst.h"
-#include "MmsEnginePrivateCRKeys.h"
-#include "mmssettings.h"
-#include "mmsheaders.h"
-#include "mmsservercommon.h"
-#include "mmsencode.h"
-
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
-: iArray1(aArray1), iArray2(aArray2)
- {
- }
-
-TInt TMmsJoinedArrays::MdcaCount() const
- {
- TInt count=0;
- if (iArray1)
- count += iArray1->MdcaCount();
- if (iArray2)
- count += iArray2->MdcaCount();
- return count;
- }
-
-TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
- {
- if (iArray1)
- {
- if (aIndex < iArray1->MdcaCount())
- return iArray1->MdcaPoint(aIndex);
- else
- aIndex -= iArray1->MdcaCount();
- }
- return iArray2->MdcaPoint(aIndex);
- }
-
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-TMmsTestUtils::TMmsTestUtils()
- {
-
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
- {
- RFile file;
- TInt error = KErrNone;
-
- TInt textBufferSize = 256;
- HBufC* textBuffer = HBufC::NewL( textBufferSize );
- TPtr textPtr = textBuffer->Des();
- TFileText textFile;
-
- error = file.Open( aFs, aFileName,
- EFileRead|EFileShareReadersOnly );
-
- if ( error == KErrNone )
- {
- textFile.Set( file );
- error = textFile.Seek( ESeekStart );
- }
-
- if ( error == KErrNone )
- {
- error = textFile.Read( textPtr );
- }
-
- file.Close();
-
- if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
- {
- textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
- }
-
- return textBuffer;
- }
-
-//----------------------------------------------------------------------------------------
-// turn on detailed logging while decoding a message
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::DecodeLoggingOnL()
- {
- // CenRep for decodelogging
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 1;
- repository->Set( KMmsEngineDecodeLog, temp );
- delete repository;
- }
- }
-
-//----------------------------------------------------------------------------------------
-// turn off detailed logging while decoding a message
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::DecodeLoggingOffL()
- {
- // CenRep for decodelogging
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 0;
- repository->Set( KMmsEngineDecodeLog, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn on binary dump of incoming messages
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::BinaryDumpOnL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 1;
- repository->Set( KMmsEngineBinaryDump, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn off binary dump of incoming messages
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::BinaryDumpOffL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 0;
- repository->Set( KMmsEngineBinaryDump, temp );
- delete repository;
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
- {
- // Delete the files in the directory
- CFileMan* fileMan = CFileMan::NewL( aFs );
- CleanupStack::PushL( fileMan );
- fileMan->RmDir( KMmsDefaultLocalModeDir );
- fileMan->RmDir( KMmsMMBoxDirectory );
- fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
- CleanupStack::PopAndDestroy(); // fileManager
- // we don't want to throw these away!
- aFs.MkDirAll( KMmsDefaultLocalModeDir );
- aFs.MkDirAll( KMmsMMBoxDirectory );
- aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
- {
- TInt error = KErrNone;
- aFs.MkDirAll( aFilename );
- TUint att;
- if ( aFs.Att( aFilename, att ) == KErrNone )
- {
- _LIT( KRelated, "dump.mms");
- aParse.Set( aFilename, &KRelated, NULL );
- aFilename = aParse.FullName();
- error = CApaApplication::GenerateFileName( aFs, aFilename );
- if ( error == KErrNone )
- {
- RFile file;
- error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
- // for message id generation
- aParse.Set( aFilename, NULL, NULL );
- if ( error == KErrNone )
- {
- // the data is supposed to be in the encode buffer
- TPtr8 ptr = aBuffer.Ptr( 0 );
- file.Write( ptr );
- file.Flush();
- }
-
- // done - close files
- file.Close();
- }
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
- {
- CMsvEntry* cEntry = NULL;
- // delete all messages from the specified box
- cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(aBoxId);
- // show invisible entries
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL(msvEntrySelection);
-
- CMsvEntrySelection* selection = NULL;
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
- CleanupStack::PushL( selection );
- if ( selection->Count() > 0 )
- {
- msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
- }
- CleanupStack::PopAndDestroy(); // selection
-
- int i;
- for (i = 0; i < msvEntrySelection->Count(); ++i)
- {
- CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
- CleanupStack::PushL( entry );
- TMsvEntry tEntry = entry->Entry();
- tEntry.SetReadOnly(EFalse);
- entry->ChangeL(tEntry);
- cEntry->DeleteL( msvEntrySelection->At(i) );
- CleanupStack::PopAndDestroy( entry );
- }
-
- CleanupStack::PopAndDestroy(msvEntrySelection);
- CleanupStack::PopAndDestroy(cEntry);
- }
-
-//----------------------------------------------------------------------------------------
-// turn on logging email recipients
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::EmailLoggingOnL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
- if( retval == KErrNone )
- {
- TInt temp = 1;
- repository->Set( KMmsEngineLogEmailRecipients, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn off logging email recipients
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::EmailLoggingOffL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
- if( retval == KErrNone )
- {
- TInt temp = 0;
- repository->Set( KMmsEngineLogEmailRecipients, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
- {
- CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(aBoxId);
- if (aMsvEntrySelection != NULL)
- {
- delete aMsvEntrySelection;
- aMsvEntrySelection = NULL;
- }
- aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
- CleanupStack::PopAndDestroy(); // cEntry
- return aMsvEntrySelection->Count();
- }
-
-
-// -----------------------------------------------------------------------------
-// CreateFolderEntryL
-//
-// -----------------------------------------------------------------------------
-//
-void TMmsTestUtils::CreateFolderEntryL(
- CMsvSession& aSession,
- TMsvId aParentFolder,
- const TDesC& aFolderName,
- TMsvId& aFolderId )
- {
- aFolderId = KMsvNullIndexEntryId;
- CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
- CleanupStack::PushL( cEntry );
-
- // Create a new folder.
-
- TMsvEntry entry;
- entry.iType = KUidMsvFolderEntry;
- entry.iMtm = KUidMsvLocalServiceMtm;
- entry.iDetails.Set( aFolderName );
- entry.SetVisible( EFalse );
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- cEntry->CreateL( entry );
- aFolderId = entry.Id();
- CleanupStack::PopAndDestroy( cEntry );
-
- }
-
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TMsvId TMmsTestUtils::CreateNotificationEntryL(
- TMsvId aNotificationFolder,
- TMsvId aServiceId,
- CBufFlat* aEncodeBuffer,
- CMsvSession& aSession )
- {
- TMsvId entryId = KMsvNullIndexEntryId;
- if ( aNotificationFolder == KMsvNullIndexEntryId )
- {
- // no folder no entry
- return entryId;
- }
-
- CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
- CleanupStack::PushL(cEntry);
-
- TMsvEntry entry;
- entry.iType = KUidMsvMessageEntry;
- entry.iMtm = KUidMsgTypeMultimedia;
- entry.SetVisible( ETrue );
- // If we want to put data here, InPreparation must be set to true first
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- entry.iRelatedId = aServiceId;
- entry.iMtmData2 = KMmsNotificationBinary;
- cEntry->CreateL( entry );
- entryId = entry.Id();
-
- //
- // Stream
- // 1) length of the data as 32 bit integer
- // 2) pushed message data
- // into created entry's stream
- //
- cEntry->SetEntryL( entryId );
- CMsvStore* store = cEntry->EditStoreL();
- CleanupStack::PushL( store ); // ***
- RMsvWriteStream outs;
- outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
- TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
- outs.WriteUint32L( ptr.Length() );
- outs.WriteL( ptr );
- outs.CommitL();
- outs.Close();
- store->CommitL();
-
- CleanupStack::PopAndDestroy( &outs ); // close outs
- CleanupStack::PopAndDestroy( store );
- CleanupStack::PopAndDestroy( cEntry );
-
- return entryId;
-
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::FormNotification(
- TDesC8& aUrl,
- TInt aSize,
- CMmsHeaders& aMmsHeaders,
- CMmsEncode& aMmsEncoder,
- CBufFlat* aEncodeBuffer )
- {
- // for test purposes aUrl will contain the filename.
-
- // Reset sets the default encapsulation version
- // The default version has been set from MmsSettings in NewL
- aMmsHeaders.Reset();
-
- // construct the notification into iMmsHeaders, and call encode
-
- aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
-
- TTime currentTime;
- currentTime.UniversalTime();
- currentTime.Int64();
-
- TPtrC8 tid;
- TBufC8<KMMSMAXTIDLENGTH> target;
- TInt random = 0;
-
- // we don't generate a true random TID: We generate the
- // TID from the URL so that if we generate a notification
- // twice from the same file, we get the same TID and the
- // same URL. This way we can test the pruning function in
- // server MTM
-
- TInt i;
- for ( i = 0; i < aUrl.Length(); ++i )
- {
- random += aUrl[ i ];
- }
-
- target.Des().Num( random );
- tid.Set( target.Des() );
- aMmsHeaders.SetTidL( tid );
-
- aMmsHeaders.SetMessageClass( EMmsClassPersonal );
- aMmsHeaders.SetMessageSize( aSize );
- const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
- aMmsHeaders.SetExpiryInterval( KTenHours );
- aMmsHeaders.SetContentLocationL( aUrl );
-
- aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
-
- }
-
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
- {
- //Is the name a file?
- if (IsDrive(aFileName))
- return EFalse;
- return !(IsDir(aFileName, aFs));
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
- {
- //Is the name a directory?
- TEntry entry;
- TInt err = aFs.Entry(aFileName, entry);
- if (err)
- return EFalse;
- else
- return entry.IsDir();
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
- {
- //horrible little function to figure if the path is just a drive
- TBool retVal = EFalse;
- if (aFileName.Length()==3) //eg "c:\"
- {
- if ((aFileName[1] == ':') && (aFileName[2] == '\\'))
- retVal=ETrue;
- }
- else if (aFileName.Length()==2) //eg "c:"
- {
- if (aFileName[1] == ':')
- retVal=ETrue;
- }
- return retVal;
- }
-
-// end of file
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmstestuitimer.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include "mmstestuitimer.h"
-
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer::CTestUiTimer(): CTimer( 5 )
- {
- period = KPeriod;
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::ConstructL()
- {
- CTimer::ConstructL();
- CActiveScheduler::Add(this);
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer* CTestUiTimer::NewL()
- {
- CTestUiTimer* self = new(ELeave) CTestUiTimer();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer::~CTestUiTimer()
- {
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::IssueRequest()
- {
- // No operation to cancel if this function is called
- iObject = NULL;
- After(period);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
- {
- iObject = aObject;
- TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
- After( timeout );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::DoCancel()
- {
- CTimer::DoCancel();
- if ( iObject )
- {
- iObject->Cancel();
- iObject = NULL;
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::RunL()
- {
- if ( iObject )
- {
- // If we timeout while holding an active object, we cancel it
- iObject->Cancel();
- iObject = NULL;
- }
- else
- {
- CActiveScheduler::Stop();
- }
- }
-
-// ======== GLOBAL FUNCTIONS ========
-
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/inc/testconvergedmessageutils.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: Main test class declaration for ConvergedMessageUtils
- */
-
-#ifndef TEST_MMS_PLUGIN_H
-#define TEST_MMS_PLUGIN_H
-
-#ifdef BUILD_TEST_DLL
-#define TEST_EXPORT Q_DECL_EXPORT
-#else
-#define TEST_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <QSignalSpy>
-#include <e32const.h>
-
-//Forward Declarations
-class UniEditorMmsPlugin;
-class ConvergedMessage;
-class MmsTestBed;
-
-//Main Tets Class Declaration
-class TEST_EXPORT TestConvergedMessageUtils: public QObject
- {
- Q_OBJECT
-
-private slots:
-
- /**
- * Initialises the whole Test
- **/
- void initTestCase();//called before the first testfunction is executed.
-
- /**
- * Initialises each Test Case
- **/
- void init();//called before each testfunction is executed.
-
- /**
- * Creates a MMS messsage
- **/
- void createMMS();
-
- /**
- * Tests the MMS message
- **/
- void testMMS();
-
- /**
- * Test Methods of ConvergedMessageId which were not part of the tests above
- **/
- void testConvergedMessageIdUnusedMethods();
-
-
- /**
- * Test Methods of ConvergedMessageAttachment which were not part of the tests above
- **/
- void testConvergedMessageAttachmentUnusedMethods();
-
- /**
- * Cleans up each Test Case
- **/
- void cleanup();//called after every testfunction.
-
- /**
- * Cleans up the whole Test Case
- **/
- void cleanupTestCase();//called after the last testfunction was executed.
-
-private: //Data
-
- /**
- * msgPlugin - MMS Message Plug-in
- **/
- UniEditorMmsPlugin* msgPlugin;
-
- /**
- * mmstestbed - MMS Message Simulator
- **/
- MmsTestBed* mmstestbed;
-
- /**
- * spy_draft - Signal Spy for Draft Folder
- **/
- QSignalSpy* spy_draft;
-
- /**
- * mmsMsgId - The MMS message Id
- **/
- long int mmsMsgId;
- };
-#endif //TEST_MMS_PLUGIN_H
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/inc/testconvergedmessageutils.ini Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: Input data Set File for TestConvergedMessageUtils test cases
- */
-
-const char TEST_MSG_BODY[] = "TestTextE_1_2";
-const char TEST_MSG_SUBJECT[] = "Message Subject";
-const char TEST_SENDER[] = "+919860479112";
-const char TEST_ATTACHMENT[] = "c:\\sample.txt";
-const char TEST_CC[] = "DummyCCAddress";
-const char TEST_BCC[] = "DummyBCCAddress";
-const char TEST_ALIAS[] = "DummySenderAlias";
-
-//out put directory for test results.
-QString OUTPUTDIRECTORY = "c:/logs/TestConvergedMessageUtils";
-//o/p directory for data to be written on temp file.
-QString TEMPDIR = "c:/logs/TestConvergedMessageUtils/testdata";
-//test result O/P file name.
-QString RESULTFILE = "c:/logs/TestConvergedMessageUtils/result_%1.txt";
-// folder named UID3 of msgapptestsuite inside private folder.
-const QString PRIVATE_DIR("C:/private/E39cd515");
\ No newline at end of file
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/src/testconvergedmessageutils.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,343 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: Main test class definition for ConvergedMessageUtils
- */
-
-#include <QtTest/QtTest>
-#include <QTimer>
-#include <QSignalSpy>
-#include "debugtraces.h"
-#include "testconvergedmessageutils.h"
-#include "convergedmessage.h"
-#include "convergedmessageid.h"
-#include "unieditormmsplugin.h"
-#include "mmstestbed.h"
-#include "testconvergedmessageutils.ini"
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::initTestCase
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::initTestCase()
-{
- //register user defined object to meta system.
- qRegisterMetaType<long int> ("long int");
-
- //Verify MmsTestBed Instance.
- mmstestbed = new MmsTestBed;
- QVERIFY(mmstestbed != NULL);
-
- //Instantiate UniEditorMmsPlugin and verify if it is correctly Instantited.
- msgPlugin = new UniEditorMmsPlugin();
- QVERIFY(msgPlugin != NULL);
-
- //set up signalspy to listen to signals emitted by mmstestbed
- spy_draft = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInDraft(long int)));
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::init
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::init()
-{
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::createMMS
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::createMMS()
-{
- //Create a Converged Message instance.
- QString subject = TEST_MSG_SUBJECT;
-
- qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
-
- QString sender(TEST_SENDER);
- ConvergedMessageAddress address(sender);
- ConvergedMessageAttachmentList attachmentList;
-
- //Add a text attachment to attachment list.
- QString attachmentPath = TEST_ATTACHMENT;
- ConvergedMessageAttachment* attachment =
- new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
-
- attachmentList.append(attachment);
-
- //Instantiate a Converged Message object and set service a MMS
- ConvergedMessage msg;
-
- msg.setMessageType(ConvergedMessage::Mms);
-
- //Set Subject
- msg.setSubject(subject);
-
- //Set Timestamp and verify
- msg.setTimeStamp(timeStamp);
- QVERIFY(timeStamp == msg.timeStamp());
-
- //Set Alias to an address
- address.setAlias(QString (TEST_ALIAS));
-
- //Set recipient.
- msg.addToRecipient(address);
-
- //Add attachments' list
- msg.addAttachments(attachmentList);
- msg.setPriority(ConvergedMessage::Normal);
-
- //Adding CC Address
- QString ccAddress(TEST_CC);
- ConvergedMessageAddress ccAdd(ccAddress);
- msg.addCcRecipient(ccAdd);
-
- //Adding BCC Address
- QString bccAddress(TEST_BCC);
- ConvergedMessageAddress bccAdd(bccAddress);
- msg.addBccRecipient(bccAdd);
-
- //Adding From Address
- QString recipientAddress(TEST_SENDER);
- ConvergedMessageAddress recipientAdd(recipientAddress);
- msg.addFromRecipient(recipientAdd);
-
- //Set Body Text and verify
- msg.setBodyText(QString(TEST_MSG_BODY));
- QVERIFY(msg.bodyText().compare(QString(TEST_MSG_BODY)) == 0);
-
- //Removing Body Text as MMS messages do not contain Body Text
- msg.setBodyText(QString(NULL));
-
- //Set Property and Verify
- msg.setProperty(ConvergedMessage::Attachment);
- msg.setProperty(ConvergedMessage::Unread);
- QVERIFY(msg.properties() == ConvergedMessage::Attachment | ConvergedMessage::Unread);
- QVERIFY(msg.hasAttachment() == true);
- QVERIFY(msg.isUnread() == true);
-
- //Set Location
- msg.setLocation(ConvergedMessage::Draft);
-
- //Set Sending State and Verify
- msg.setSendingState(ConvergedMessage::Waiting);
- QVERIFY(msg.sendingState() == ConvergedMessage::Waiting);
-
- //Set Direction
- msg.setDirection(ConvergedMessage::Outgoing);
-
- //Set Priority
- msg.setPriority(ConvergedMessage::Normal);
-
- //Set Sub Type and verify
- msg.setMessageSubType(ConvergedMessage::NokiaService);
- QVERIFY(msg.messageSubType() == ConvergedMessage::NokiaService);
-
- //Create another Converged Message
- ConvergedMessage msgCopyFirst(msg);
- ConvergedMessage msgCopySecond(*(msg.id()));//by Id
- QCOMPARE(msgCopySecond.id()->getId(), msg.id()->getId());//Verify if the copy was as expected
-
- //Create a Converged Message with serializing and deserializing and verify
- QFile file("c:\\test.txt");
- file.open(QIODevice::WriteOnly);
- QDataStream out(&file); // Serialize the data into the file
- msg.serialize(out); // Serialize a string
- file.close();
-
- file.open(QIODevice::ReadOnly);
- QDataStream in(&file); // read the data serialized from the file
-
- ConvergedMessage msgCopyThird;//Third Copy of the Actual Message
- msgCopyThird.deserialize(in);
- file.close();
-
- //Verify the 3rd Copy with the Original Copy
- QVERIFY(msgCopyThird.id()->getId() == msg.id()->getId());
- QCOMPARE(msgCopyThird.subject(), msg.subject());
- QVERIFY(msgCopyThird.messageType() == msg.messageType());
-
- //Get a valid MMS message ID and verify that it is valid.
- mmsMsgId = msgPlugin->convertTo(&msgCopyFirst);
- QVERIFY(mmsMsgId != -1);
- QDEBUG_WRITE("MMS Successfully Sent to Dratfs Folder");
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::testMMS
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::testMMS()
-{
- long int mmsDraftMsgId;
-
- //check if draft-folder signal was received...this means message was created in draft
- if( 1 <= spy_draft->count())
- {
- //compare the msgid and verify with the ID given by MMS plugin
- void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
- mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
- QVERIFY(mmsDraftMsgId == mmsMsgId);
-
- //Validate the MMS message with all the values set before.
- ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
- QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
- QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
- QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_ALIAS).contains(draftMsg->toAddressList()[0]->alias(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
- QVERIFY(draftMsg->attachments().count() == 1);
- QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
- QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT).mid(QString(TEST_ATTACHMENT).indexOf(QString("Sample.txt"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);
- QVERIFY(draftMsg->location() == ConvergedMessage::Draft);
- QVERIFY(draftMsg->priority() == ConvergedMessage::Normal);
- QVERIFY(draftMsg->direction() == ConvergedMessage::Outgoing);
- QDEBUG_WRITE("MMS Successfully Verified at Drafts Folder");
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to create message in Draft");
- }
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::testConvergedMessageIdUnusedMethods
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::testConvergedMessageIdUnusedMethods()
-{
- //Create a copy of ConvergedMessageId object from another object
- ConvergedMessageId msgId1;
- msgId1.setId(0x646);
-
- //Verify if the two objects match
- ConvergedMessageId msgId3;
- msgId3 = msgId1;
- QVERIFY(msgId3 == msgId1);
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::testConvergedMessageAttachmentUnusedMethods
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::testConvergedMessageAttachmentUnusedMethods()
-{
- //Set Attachment File Path and Type and Verify
- ConvergedMessageAttachment msgAttachment;
- msgAttachment.setFilePath(QString(TEST_ATTACHMENT));
- QCOMPARE(msgAttachment.filePath(), QString(TEST_ATTACHMENT));
- msgAttachment.setAttachmentType(ConvergedMessageAttachment::EAttachment);
- QVERIFY(msgAttachment.attachmentType() == ConvergedMessageAttachment::EAttachment);
-
- //Second Copy with same Contents
- ConvergedMessageAttachment msgAttachmentCopy;
- msgAttachmentCopy.setFilePath(QString(TEST_ATTACHMENT));
- msgAttachmentCopy.setAttachmentType(ConvergedMessageAttachment::EAttachment);
-
- //Verify if they are same
- QVERIFY(msgAttachmentCopy == msgAttachment);
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::cleanup
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::cleanup()
-{
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::cleanupTestCase
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::cleanupTestCase()
-{
- //Cleanup
- mmstestbed->cleanAll();//Clean All messages from varios Folders
- delete spy_draft;//Signal for Draft Folder
- delete msgPlugin;//MMS Plugin
- delete mmstestbed;//MMS Testbed
-}
-
-//---------------------------------------------------------------
-// getObject
-// factory method to create objects.
-//---------------------------------------------------------------
-QObject* getObject(QString className)
-{
- if(className == "TestConvergedMessageUtils" )
- {
- return new TestConvergedMessageUtils;
- }
- else
- {
- return 0;
- }
-}
-
-//---------------------------------------------------------------
-// createOutPutDirectory
-// creating o/p directory.
-//---------------------------------------------------------------
-void createOutPutDirectory()
- {
- QDir dir;
- //o/p dir
- dir.mkdir(OUTPUTDIRECTORY);
- //tmp dir
- dir.mkdir(TEMPDIR);
- // dir inside private folder.
- dir.mkdir(PRIVATE_DIR);
- }
-
-//---------------------------------------------------------------
-// main
-// main entry point
-//---------------------------------------------------------------
-int main(int argc, char *argv[])
- {
- int ret = -1;
- QCoreApplication app(argc, argv);
-
- //creating output directory.
- createOutPutDirectory();
-
- //the configuration file.
- QFile data("c:/testconvergedmessageutils.cfg");
-
- if (data.open(QFile::ReadOnly))
- {
- QTextStream in(&data);
- while(!in.atEnd())
- {
- QStringList args;
- QString appName = argv[0];
- args << appName;
-
- QString option = "-o";
- args << option;
-
- QString outFile = RESULTFILE;
- QString name = in.readLine();
- outFile = outFile.arg(name);
- args << outFile;
-
- QObject* tc = getObject(name);
-
- if(tc)
- {
- ret = QTest::qExec(tc, args);
- delete tc;
- }
- }
- }
- data.close();
- return ret;
- }
-
-//End of File
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/testconvergedmessageutils.cfg Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-TestConvergedMessageUtils
\ No newline at end of file
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/testconvergedmessageutils.pl Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: Test Case Report Generation file for ConvergedMessageUtils
-#
-#!/usr/bin/perl -w
-use warnings;
-use strict;
-
-my $TOTALCASES = 0;
-my $TOTALPASSED = 0;
-my $TOTALRUN = 0;
-my $TOTALFAILED = 0;
-my $TOTALSKIPPED = 0;
-
-sub parse_line
-{
- my $line = $_[0];
- my @parts = split (" ", $line);
- my $passed = $parts[1];
- my $failed = $parts[3];
- my $skipped = $parts[5];
-
- my $total = $passed + $failed + $skipped;
- my $passrate = $passed * 100 / $total;
- my $passrateround = sprintf("%.0f",$passrate);
- my $runrate = ($total - $skipped)*100/$total;
- my $runrateround = sprintf("%.0f",$runrate);
-
- $TOTALCASES += $total;
- $TOTALPASSED += $passed;
- $TOTALRUN += ($total - $skipped);
- $TOTALFAILED += $failed;
- $TOTALSKIPPED += $skipped;
-
- printf MYFILE "<td>\n";
- printf MYFILE "$passed\n";
- printf MYFILE "</td>\n";
-
- if($failed > 0)
- {
- printf MYFILE "<td style=\"font-weight:bold;color:red\">\n";
- printf MYFILE "$failed\n";
- printf MYFILE "</td>\n";
- }
- else
- {
- printf MYFILE "<td>\n";
- printf MYFILE "$failed\n";
- printf MYFILE "</td>\n";
- }
-
- printf MYFILE "<td>\n";
- printf MYFILE "$skipped\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$total\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE ("$passrateround %%\n");
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$runrateround %%\n";
- printf MYFILE "</td>\n";
-
-
-}
-
-sub parse_file
- {
- my $pattern = "Totals";
- my $file = $_[0];
- open (FILE,$file);
-
- while (my $line= <FILE>)
- {
- chomp ($line);
- if ($line =~ m/$pattern/)
- {
- parse_line $line;
- }
- }
- close(FILE);
- }
-
-
-sub generate_report
- {
- open (MYFILE, '>/epoc32/winscw/c/logs/TestConvergedMessageUtils/report.html');
- printf MYFILE "<html>\n";
- printf MYFILE "<body>\n";
- printf MYFILE "<head>\n";
- printf MYFILE "<title>ConvergedMessageUtils Test Reports</title>";
- printf MYFILE "</head>\n";
- printf MYFILE "<h2 align = center>ConvergedMessageUtils Test Report</h2>\n";
- printf MYFILE "<table border = 2 cellpadding = 10 align = center>\n";
- printf MYFILE "<tr style = \" background-color:lavender \">\n";
- printf MYFILE "<th>Module</th>\n";
- printf MYFILE "<th style = color:green>Passed</th>\n";
- printf MYFILE "<th style = color:red>Failed</th>\n";
- printf MYFILE "<th style = color:chocolate>Skipped</th>\n";
- printf MYFILE "<th>Total Cases</th>\n";
- printf MYFILE "<th>Pass Rate</th>\n";
- printf MYFILE "<th>Run Rate</th>\n";
- printf MYFILE "</tr>\n";
-
-
- my @files = </epoc32/winscw/c/logs/TestConvergedMessageUtils/*.txt>;
- foreach my $file (@files)
- {
- my @splitedpath = split("/",$file);
- my $filename = $splitedpath[-1];
- my $length = length($filename);
- my $name = substr($filename,11,$length-15);
- printf MYFILE "<tr>\n";
- printf MYFILE "<td>\n";
- printf MYFILE "<a HREF=$filename style = text-decoration:none><b>$name</b></a>\n";
- printf MYFILE "</td>\n";
-
- parse_file $file;
-
- printf MYFILE "</tr>\n";
- }
-
- printf MYFILE "<tr style= \"font-weight:bold; color:white; background-color:gray\">\n";
- printf MYFILE "<td>\n";
- printf MYFILE "<b>Overall</b>\n";
- printf MYFILE "</td>\n";
-
-
- printf MYFILE "<td>\n";
- printf MYFILE "$TOTALPASSED\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$TOTALFAILED\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$TOTALSKIPPED\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$TOTALCASES\n";
- printf MYFILE "</td>\n";
-
- my $passrate = $TOTALPASSED*100/$TOTALCASES;
- my $passrateround = sprintf("%.0f",$passrate);
- printf MYFILE "<td>\n";
- printf MYFILE "$passrateround%%\n";
- printf MYFILE "</td>\n";
-
- my $runrate = ($TOTALCASES - $TOTALSKIPPED)*100/$TOTALCASES;
- my $runrateround = sprintf("%.0f",$runrate);
- printf MYFILE "<td>\n";
- printf MYFILE "$runrateround%%\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "</tr>\n";
-
- printf MYFILE "</table>\n";
- printf MYFILE "</body>\n";
- printf MYFILE "</html>\n";
-
- close (MYFILE);
- }
-
-
-generate_report;
\ No newline at end of file
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/testconvergedmessageutils.pro Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: Test Case Project Definition for ConvergedMessageUtils
-#
-
-QT += testlib
-QT -= gui
-
-TEMPLATE = app
-TARGET = testconvergedmessageutils
-
-
-INCLUDEPATH += ./inc
-INCLUDEPATH += ../../inc
-INCLUDEPATH += ../mmstestbed/inc
-INCLUDEPATH += ../../../../../inc
-INCLUDEPATH += ../../../s60qconversions/inc
-INCLUDEPATH += ../../../unidatautils/unidatamodel/inc
-INCLUDEPATH += ../../../../../../../mw/hb/include/hbcore
-INCLUDEPATH += ../../../unieditorutils/editorgenutils/inc
-INCLUDEPATH += ../../../unieditorutils/unieditorplugins/unieditormmsplugin/inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_TEST_DLL
-CONFIG += hb plugin
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-SOURCES += \
- ./src/testconvergedmessageutils.cpp \
- ../../../unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp \
- ../../../unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp
-
-# Input
-HEADERS += \
- ./inc/testconvergedmessageutils.h \
- ../../../unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin.h \
- ../../../unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
- symbian {
- TARGET.CAPABILITY = All -TCB -DRM
- TARGET.EPOCSTACKSIZE = 0x8000
- TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
- BLD_INF_RULES.prj_exports += "testconvergedmessageutils.cfg c:/testconvergedmessageutils.cfg"
- BLD_INF_RULES.prj_exports += "testconvergedmessageutils.pl c:/testconvergedmessageutils.pl"
- }
-
-LIBS += -leuser \
- -lconvergedmessageutils \
- -ls60qconversions \
- -lMsgMedia \
- -leditorgenutils \
- -lcone \
- -leikcoctl \
- -leikcore \
- -leikdlg \
- -lmsgs \
- -letext \
- -lgsmu \
- -lmmsgenutils \
- -lefsrv \
- -lestor \
- -lsmcm \
- -lCommonEngine \
- -lbafl \
- -lCdlEngine \
- -lFeatMgr \
- -lapmime \
- -lapgrfx \
- -lcharconv \
- -lInetProtUtil \
- -lsmildtd \
- -lxmldom \
- -lxmlparser \
- -lcone \
- -lQtCore \
- -letel \
- -lcommdb \
- -lcommsdat \
- -letelmm \
- -lunidatamodelloader \
- -lunidatamodel \
- -lavkon \
- -leikcoctl \
- -leikctl \
- -lform \
- -luiklaf\
- -lmmstestbed \
- -lmmsmessage \
- -lmmsserversettings \
- -lxqutils
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/bwins/mmstestbedu.def Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,71 @@
+EXPORTS
+ ?cleanSent@MmsTestBed@@QAEXXZ @ 1 NONAME ; void MmsTestBed::cleanSent(void)
+ ?cancelSendScheduling@MmsTestBed@@QAEXXZ @ 2 NONAME ; void MmsTestBed::cancelSendScheduling(void)
+ ?replyToAll@MmsTestBed@@QAEXXZ @ 3 NONAME ; void MmsTestBed::replyToAll(void)
+ ?getLogEntries@MmsTestBed@@AAEHXZ @ 4 NONAME ; int MmsTestBed::getLogEntries(void)
+ ?restoreFactorySettings@MmsTestBed@@QAEXXZ @ 5 NONAME ; void MmsTestBed::restoreFactorySettings(void)
+ ?fromOutboxToMmscWithMemoryFailure@MmsTestBed@@QAEHXZ @ 6 NONAME ; int MmsTestBed::fromOutboxToMmscWithMemoryFailure(void)
+ ?encodeMessageFromDrafts@MmsTestBed@@AAEXXZ @ 7 NONAME ; void MmsTestBed::encodeMessageFromDrafts(void)
+ ?reply@MmsTestBed@@QAEXXZ @ 8 NONAME ; void MmsTestBed::reply(void)
+ ?deleteEntry@MmsTestBed@@AAEXJAAVCMsvEntry@@@Z @ 9 NONAME ; void MmsTestBed::deleteEntry(long, class CMsvEntry &)
+ ?findDefaultL@MmsTestBed@@AAEXXZ @ 10 NONAME ; void MmsTestBed::findDefaultL(void)
+ ?messageVariation@MmsTestBed@@QAEXXZ @ 11 NONAME ; void MmsTestBed::messageVariation(void)
+ ?sendReadReport@MmsTestBed@@QAEXXZ @ 12 NONAME ; void MmsTestBed::sendReadReport(void)
+ ?garbageCollection@MmsTestBed@@QAEXK@Z @ 13 NONAME ; void MmsTestBed::garbageCollection(unsigned long)
+ ?fetchForced@MmsTestBed@@QAEXH@Z @ 14 NONAME ; void MmsTestBed::fetchForced(int)
+ ?scheduledSend@MmsTestBed@@QAEXJH@Z @ 15 NONAME ; void MmsTestBed::scheduledSend(long, int)
+ ?createMmsService@MmsTestBed@@AAEXXZ @ 16 NONAME ; void MmsTestBed::createMmsService(void)
+ ?trUtf8@MmsTestBed@@SA?AVQString@@PBD0H@Z @ 17 NONAME ; class QString MmsTestBed::trUtf8(char const *, char const *, int)
+ ?qt_metacast@MmsTestBed@@UAEPAXPBD@Z @ 18 NONAME ; void * MmsTestBed::qt_metacast(char const *)
+ ?deleteEventType@MmsTestBed@@QAEXXZ @ 19 NONAME ; void MmsTestBed::deleteEventType(void)
+ ??_EMmsTestBed@@UAE@I@Z @ 20 NONAME ; MmsTestBed::~MmsTestBed(unsigned int)
+ ?cleanLog@MmsTestBed@@QAEXXZ @ 21 NONAME ; void MmsTestBed::cleanLog(void)
+ ?createEntry@MmsTestBed@@QAEXAAVTMsvEntry@@AAVCMsvEntry@@@Z @ 22 NONAME ; void MmsTestBed::createEntry(class TMsvEntry &, class CMsvEntry &)
+ ?scheduledFetch@MmsTestBed@@QAEXH@Z @ 23 NONAME ; void MmsTestBed::scheduledFetch(int)
+ ?sendFromFile@MmsTestBed@@QAEXXZ @ 24 NONAME ; void MmsTestBed::sendFromFile(void)
+ ??0MmsTestBed@@QAE@XZ @ 25 NONAME ; MmsTestBed::MmsTestBed(void)
+ ?cleanInbox@MmsTestBed@@QAEXXZ @ 26 NONAME ; void MmsTestBed::cleanInbox(void)
+ ?deleteFetchSchedule@MmsTestBed@@QAEXXZ @ 27 NONAME ; void MmsTestBed::deleteFetchSchedule(void)
+ ?fromMmscToInbox@MmsTestBed@@QAEXXZ @ 28 NONAME ; void MmsTestBed::fromMmscToInbox(void)
+ ?doAFetchCycle@MmsTestBed@@QAEXXZ @ 29 NONAME ; void MmsTestBed::doAFetchCycle(void)
+ ?entryMovedToSent@MmsTestBed@@IAEXJ@Z @ 30 NONAME ; void MmsTestBed::entryMovedToSent(long)
+ ?cleanupAndCreateNewService@MmsTestBed@@QAEXXZ @ 31 NONAME ; void MmsTestBed::cleanupAndCreateNewService(void)
+ ?cleanup@MmsTestBed@@AAEXXZ @ 32 NONAME ; void MmsTestBed::cleanup(void)
+ ?qt_metacall@MmsTestBed@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 33 NONAME ; int MmsTestBed::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?getEventType@MmsTestBed@@QAEXXZ @ 34 NONAME ; void MmsTestBed::getEventType(void)
+ ?sendViaClient@MmsTestBed@@QAEXXZ @ 35 NONAME ; void MmsTestBed::sendViaClient(void)
+ ?setFetchingState@MmsTestBed@@QAEXW4TMmsReceivingMode@@@Z @ 36 NONAME ; void MmsTestBed::setFetchingState(enum TMmsReceivingMode)
+ ?sendNotifications@MmsTestBed@@QAEXXZ @ 37 NONAME ; void MmsTestBed::sendNotifications(void)
+ ?metaObject@MmsTestBed@@UBEPBUQMetaObject@@XZ @ 38 NONAME ; struct QMetaObject const * MmsTestBed::metaObject(void) const
+ ?setOnline@MmsTestBed@@QAEX_N@Z @ 39 NONAME ; void MmsTestBed::setOnline(bool)
+ ?cleanOutbox@MmsTestBed@@QAEXXZ @ 40 NONAME ; void MmsTestBed::cleanOutbox(void)
+ ?checkLogClient@MmsTestBed@@AAE_NXZ @ 41 NONAME ; bool MmsTestBed::checkLogClient(void)
+ ?cleanDrafts@MmsTestBed@@QAEXXZ @ 42 NONAME ; void MmsTestBed::cleanDrafts(void)
+ ?tr@MmsTestBed@@SA?AVQString@@PBD0H@Z @ 43 NONAME ; class QString MmsTestBed::tr(char const *, char const *, int)
+ ?copyDrafts@MmsTestBed@@QAEXXZ @ 44 NONAME ; void MmsTestBed::copyDrafts(void)
+ ?fromMmscToInboxWithMemoryFailure@MmsTestBed@@QAEHXZ @ 45 NONAME ; int MmsTestBed::fromMmscToInboxWithMemoryFailure(void)
+ ?fetchForcedImmediate@MmsTestBed@@QAEXXZ @ 46 NONAME ; void MmsTestBed::fetchForcedImmediate(void)
+ ?deleteSendSchedule@MmsTestBed@@QAEXXZ @ 47 NONAME ; void MmsTestBed::deleteSendSchedule(void)
+ ?staticMetaObject@MmsTestBed@@2UQMetaObject@@B @ 48 NONAME ; struct QMetaObject const MmsTestBed::staticMetaObject
+ ?entryCreatedInDraft@MmsTestBed@@IAEXJ@Z @ 49 NONAME ; void MmsTestBed::entryCreatedInDraft(long)
+ ?generateDeliveryReport@MmsTestBed@@QAEXPAVCMmsHeaders@@@Z @ 50 NONAME ; void MmsTestBed::generateDeliveryReport(class CMmsHeaders *)
+ ?forward@MmsTestBed@@QAEXXZ @ 51 NONAME ; void MmsTestBed::forward(void)
+ ?entryCreatedInInbox@MmsTestBed@@IAEXJ@Z @ 52 NONAME ; void MmsTestBed::entryCreatedInInbox(long)
+ ?fromOutboxToMmsc@MmsTestBed@@QAEXXZ @ 53 NONAME ; void MmsTestBed::fromOutboxToMmsc(void)
+ ?entryMovedToOutbox@MmsTestBed@@IAEXJ@Z @ 54 NONAME ; void MmsTestBed::entryMovedToOutbox(long)
+ ?findMMSFolder@MmsTestBed@@AAEJXZ @ 55 NONAME ; long MmsTestBed::findMMSFolder(void)
+ ??1MmsTestBed@@UAE@XZ @ 56 NONAME ; MmsTestBed::~MmsTestBed(void)
+ ?cleanAll@MmsTestBed@@QAEXXZ @ 57 NONAME ; void MmsTestBed::cleanAll(void)
+ ?getStaticMetaObject@MmsTestBed@@SAABUQMetaObject@@XZ @ 58 NONAME ; struct QMetaObject const & MmsTestBed::getStaticMetaObject(void)
+ ?sendDeliveryReport@MmsTestBed@@QAEXXZ @ 59 NONAME ; void MmsTestBed::sendDeliveryReport(void)
+ ?setConnectionLocal@MmsTestBed@@QAEX_N@Z @ 60 NONAME ; void MmsTestBed::setConnectionLocal(bool)
+ ?sendOneByOne@MmsTestBed@@QAEXXZ @ 61 NONAME ; void MmsTestBed::sendOneByOne(void)
+ ?cancelFetchScheduling@MmsTestBed@@QAEXXZ @ 62 NONAME ; void MmsTestBed::cancelFetchScheduling(void)
+ ?trUtf8@MmsTestBed@@SA?AVQString@@PBD0@Z @ 63 NONAME ; class QString MmsTestBed::trUtf8(char const *, char const *)
+ ?deleteNotifications@MmsTestBed@@QAEXXZ @ 64 NONAME ; void MmsTestBed::deleteNotifications(void)
+ ?testFile@MmsTestBed@@AAEXAAV?$TBuf@$0BAA@@@HJ@Z @ 65 NONAME ; void MmsTestBed::testFile(class TBuf<256> &, int, long)
+ ?HandleSessionEventL@MmsTestBed@@MAEXW4TMsvSessionEvent@MMsvSessionObserver@@PAX11@Z @ 66 NONAME ; void MmsTestBed::HandleSessionEventL(enum MMsvSessionObserver::TMsvSessionEvent, void *, void *, void *)
+ ?tr@MmsTestBed@@SA?AVQString@@PBD0@Z @ 67 NONAME ; class QString MmsTestBed::tr(char const *, char const *)
+ ?addEventType@MmsTestBed@@QAEXXZ @ 68 NONAME ; void MmsTestBed::addEventType(void)
+ ?addMMBoxDescriptions@MmsTestBed@@AAEXXZ @ 69 NONAME ; void MmsTestBed::addMMBoxDescriptions(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/eabi/mmstestbedu.def Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,72 @@
+EXPORTS
+ _ZN10MmsTestBed10cleanInboxEv @ 1 NONAME
+ _ZN10MmsTestBed10copyDraftsEv @ 2 NONAME
+ _ZN10MmsTestBed10replyToAllEv @ 3 NONAME
+ _ZN10MmsTestBed11cleanDraftsEv @ 4 NONAME
+ _ZN10MmsTestBed11cleanOutboxEv @ 5 NONAME
+ _ZN10MmsTestBed11createEntryER9TMsvEntryR9CMsvEntry @ 6 NONAME
+ _ZN10MmsTestBed11deleteEntryElR9CMsvEntry @ 7 NONAME
+ _ZN10MmsTestBed11fetchForcedEi @ 8 NONAME
+ _ZN10MmsTestBed11qt_metacallEN11QMetaObject4CallEiPPv @ 9 NONAME
+ _ZN10MmsTestBed11qt_metacastEPKc @ 10 NONAME
+ _ZN10MmsTestBed12addEventTypeEv @ 11 NONAME
+ _ZN10MmsTestBed12findDefaultLEv @ 12 NONAME
+ _ZN10MmsTestBed12getEventTypeEv @ 13 NONAME
+ _ZN10MmsTestBed12sendFromFileEv @ 14 NONAME
+ _ZN10MmsTestBed12sendOneByOneEv @ 15 NONAME
+ _ZN10MmsTestBed13doAFetchCycleEv @ 16 NONAME
+ _ZN10MmsTestBed13findMMSFolderEv @ 17 NONAME
+ _ZN10MmsTestBed13getLogEntriesEv @ 18 NONAME
+ _ZN10MmsTestBed13scheduledSendEli @ 19 NONAME
+ _ZN10MmsTestBed13sendViaClientEv @ 20 NONAME
+ _ZN10MmsTestBed14checkLogClientEv @ 21 NONAME
+ _ZN10MmsTestBed14scheduledFetchEi @ 22 NONAME
+ _ZN10MmsTestBed14sendReadReportEv @ 23 NONAME
+ _ZN10MmsTestBed15deleteEventTypeEv @ 24 NONAME
+ _ZN10MmsTestBed15fromMmscToInboxEv @ 25 NONAME
+ _ZN10MmsTestBed16createMmsServiceEv @ 26 NONAME
+ _ZN10MmsTestBed16entryMovedToSentEl @ 27 NONAME
+ _ZN10MmsTestBed16fromOutboxToMmscEv @ 28 NONAME
+ _ZN10MmsTestBed16messageVariationEv @ 29 NONAME
+ _ZN10MmsTestBed16setFetchingStateE17TMmsReceivingMode @ 30 NONAME
+ _ZN10MmsTestBed16staticMetaObjectE @ 31 NONAME DATA 16
+ _ZN10MmsTestBed17garbageCollectionEm @ 32 NONAME
+ _ZN10MmsTestBed17sendNotificationsEv @ 33 NONAME
+ _ZN10MmsTestBed18deleteSendScheduleEv @ 34 NONAME
+ _ZN10MmsTestBed18entryMovedToOutboxEl @ 35 NONAME
+ _ZN10MmsTestBed18sendDeliveryReportEv @ 36 NONAME
+ _ZN10MmsTestBed18setConnectionLocalEb @ 37 NONAME
+ _ZN10MmsTestBed19HandleSessionEventLEN19MMsvSessionObserver16TMsvSessionEventEPvS2_S2_ @ 38 NONAME
+ _ZN10MmsTestBed19deleteFetchScheduleEv @ 39 NONAME
+ _ZN10MmsTestBed19deleteNotificationsEv @ 40 NONAME
+ _ZN10MmsTestBed19entryCreatedInDraftEl @ 41 NONAME
+ _ZN10MmsTestBed19entryCreatedInInboxEl @ 42 NONAME
+ _ZN10MmsTestBed19getStaticMetaObjectEv @ 43 NONAME
+ _ZN10MmsTestBed20addMMBoxDescriptionsEv @ 44 NONAME
+ _ZN10MmsTestBed20cancelSendSchedulingEv @ 45 NONAME
+ _ZN10MmsTestBed20fetchForcedImmediateEv @ 46 NONAME
+ _ZN10MmsTestBed21cancelFetchSchedulingEv @ 47 NONAME
+ _ZN10MmsTestBed22generateDeliveryReportEP11CMmsHeaders @ 48 NONAME
+ _ZN10MmsTestBed22restoreFactorySettingsEv @ 49 NONAME
+ _ZN10MmsTestBed23encodeMessageFromDraftsEv @ 50 NONAME
+ _ZN10MmsTestBed26cleanupAndCreateNewServiceEv @ 51 NONAME
+ _ZN10MmsTestBed32fromMmscToInboxWithMemoryFailureEv @ 52 NONAME
+ _ZN10MmsTestBed33fromOutboxToMmscWithMemoryFailureEv @ 53 NONAME
+ _ZN10MmsTestBed5replyEv @ 54 NONAME
+ _ZN10MmsTestBed7cleanupEv @ 55 NONAME
+ _ZN10MmsTestBed7forwardEv @ 56 NONAME
+ _ZN10MmsTestBed8cleanAllEv @ 57 NONAME
+ _ZN10MmsTestBed8cleanLogEv @ 58 NONAME
+ _ZN10MmsTestBed8testFileER4TBufILi256EEil @ 59 NONAME
+ _ZN10MmsTestBed9cleanSentEv @ 60 NONAME
+ _ZN10MmsTestBed9setOnlineEb @ 61 NONAME
+ _ZN10MmsTestBedC1Ev @ 62 NONAME
+ _ZN10MmsTestBedC2Ev @ 63 NONAME
+ _ZN10MmsTestBedD0Ev @ 64 NONAME
+ _ZN10MmsTestBedD1Ev @ 65 NONAME
+ _ZN10MmsTestBedD2Ev @ 66 NONAME
+ _ZNK10MmsTestBed10metaObjectEv @ 67 NONAME
+ _ZTI10MmsTestBed @ 68 NONAME
+ _ZTV10MmsTestBed @ 69 NONAME
+ _ZThn8_N10MmsTestBed19HandleSessionEventLEN19MMsvSessionObserver16TMsvSessionEventEPvS2_S2_ @ 70 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/inc/mmsreadfile.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,471 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSREADFILE_H
+#define MMSREADFILE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <f32file.h>
+#include <msvstd.h>
+
+// forward references
+class CMmsAttaStructure;
+class CMmsHeaders;
+class CEikonEnv;
+class CMmsClientMtm;
+
+// Out-of-range value for any MMS header with assigned number
+// Used in coverage tests to get coverage for "default" branches
+// in "case" statements.
+const TInt KMmsTestIllegalValue = 255;
+
+//
+// TEST KEY WORDS
+// Extended to include all MMS headers to allow generation of arbitrary PDUs
+// Content type header cannot be separately defined,
+// it will always be "multipat/mixed" or "multipart/related"
+_LIT8( KTestEndOfFile, "EOF" );
+_LIT8( KTestNewMessage, "MESSAGE BEGIN" );
+//------------------------------------------------
+_LIT8( KTestMessageType, "MESSAGE-TYPE" ); //X-Mms-Message-Type
+_LIT8( KTestDate, "DATE" ); // Date
+_LIT8( KTestFrom, "FROM" ); // From
+_LIT8( KTestTo, "TO" ); // To
+_LIT8( KTestCc, "CC" ); // Cc
+_LIT8( KTestBcc, "BCC" ); // Bcc
+_LIT8( KTestSubject, "SUBJECT" ); // Subject
+_LIT8( KTestExpiryRel, "EXPIRY-REL" ); // X-Mms-Expiry, relative
+_LIT8( KTestExpiryAbs, "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
+_LIT8( KTestDeliveryTimeRel, "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
+_LIT8( KTestDeliveryTimeAbs, "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
+_LIT8( KTestPriority, "PRIORITY" ); // X-Mms-Priority
+_LIT8( KTestSenderVisibility, "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
+_LIT8( KTestDeliveryReport, "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
+_LIT8( KTestReadReply, "READ-REPLY" ); // X-Mms-Read-Report
+// ---------------------------------------------------
+_LIT8( KTestNewAttachment, "ATTACHMENT" );
+_LIT8( KTestAttachmentType, "ATTACHMENTTYPE" );
+_LIT8( KTestAttachmentName, "ATTACHMENTNAME" );
+_LIT8( KTestAttachmentContLoc, "ATTACHMENTCONTLOC" );
+_LIT8( KTestAttachmentCharset, "ATTACHMENTCHARSET" );
+_LIT8( KTestAttachmentCid, "ATTACHMENTCID" );
+_LIT8( KTestAttachmentRoot, "ATTACHMENTROOT" );
+// content-type and x-type parameters for attachments
+// should appear in name-value pairs.
+// Test program is not responsible for verifying illegal scripts
+_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
+_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
+_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
+_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
+// -----------------------------------------------------
+_LIT8( KTestMessageClass, "MESSAGE-CLASS" ); // X-Mms-Message-Class
+_LIT8( KTestDelivRepSendAllow, "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
+_LIT8( KTestAcceptAdvertis, "ACCEPT-ADVERTISEMENTS" );
+_LIT8( KTestRetryCount, "RETRY-COUNT" );
+_LIT8( KTestRetryInterval, "RETRY-INTERVAL" );
+// -------------------------------------------------
+_LIT8( KTestAlias, "ALIAS" );
+_LIT8( KTestFromAlias, "FROMALIAS" );
+_LIT8( KTestToAlias, "TOALIAS" );
+_LIT8( KTestCcAlias, "CCALIAS" );
+_LIT8( KTestBccAlias, "BCCALIAS" );
+// -------------------------------------------------
+// more Message headers to allow testing all possible PDUs and
+// MMS 1.1 headers
+_LIT8( KTestReplyCharging, "REPLY-CHARGING" ); // X-Mms-Reply-Charging
+_LIT8( KTestReplyChargAbs, "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
+_LIT8( KTestReplyChargRel, "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
+_LIT8( KTestReplyChargSize, "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
+_LIT8( KTestReplyChargID, "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
+_LIT8( KTestTID, "TID" );
+_LIT8( KTestContentLocation, "CONTLOC" ); // X-Mms-Content-Location
+// The following three must appear as triplets.
+// index must be first, address and date may appear in any order
+_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
+_LIT8( KTestPreviouslySentBy, "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
+_LIT8( KTestPreviouslySentDate, "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
+//---
+_LIT8( KTestMessageId, "MESSAGE-ID" ); // Message-ID
+_LIT8( KTestMessageSize, "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
+_LIT8( KTestVersion, "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
+_LIT8( KTestReadStatus, "READ-STATUS" ); // X-Mms-Read-Status
+_LIT8( KTestResponseStatus, "RESPONSE-STATUS" ); // X-Mms-Response-Status
+_LIT8( KTestResponseText, "RESPONSE-TEXT" ); // X-Mms-Response-Text
+_LIT8( KTestRetrieveStatus, "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
+_LIT8( KTestRetrieveText, "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
+_LIT8( KTestStatus, "STATUS" ); // X-Mms-Status
+// -------------------------------------------------
+// MMS 1.2 headers
+_LIT8( KTestAttribute, "ATTRIBUTE" ); // X-Mms-Attribute
+// The value should be one of the following:
+// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
+// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
+// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
+// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
+// PREV-SENT-DATE, ADDITIONAL-HEADERS
+_LIT8( KTestDistributionIndicator, "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
+_LIT8( KTestLimit, "LIMIT" ); // X-Mms-Limit
+_LIT8( KTestMessageQuota, "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
+_LIT8( KTestSizeQuota, "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
+_LIT8( KTestMessageTotal, "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
+_LIT8( KTestSizeTotal, "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
+_LIT8( KTestMessageCount, "MESSAGE-COUNT" ); // X-Mms-Message-Count
+_LIT8( KTestAddKeyword, "ADD-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestRemoveKeyword, "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestFilterKeyword, "FILTER-KEYWORD" ); // X-Mms-MM-FLags
+_LIT8( KTestMMState, "MESSAGE-STATE" ); // X-Mms-MM-State
+_LIT8( KTestQuota, "QUOTA" ); // X-Mms-Quotas
+_LIT8( KTestStart, "START" ); // X-Mms-Start
+_LIT8( KTestStore, "STORE" ); // X-Mms-Store
+_LIT8( KTestStored, "STORED" ); // X-Mms-Stored
+_LIT8( KTestStoreStatus, "STORE-STATUS" ); // X-Mms-Store-Status
+_LIT8( KTestStoreStatusText, "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
+_LIT8( KTestTotals, "TOTALS" ); // X-Mms-Totals
+// Delete confirmation header structure
+// This consists of index, content location, response status and response status text.
+// All three values are not always necessary for each index, but at least content-location
+// and response status should be present.
+// The index retains its value until a new index is encountered.
+_LIT8( KTestDeleteInfoIndex, "DELETESTATUSINDEX" ); // index for next delete info fields
+// This header must precede content-location, response-status and response-text fields
+// in a delete confirmation. Index retains its value until a new index is encountered.
+
+// Element descriptor header not implemented
+
+// Application id headers
+// These will officially be supported in MMS encapsulation version 1.3
+// Java has non-standard support even earlier
+
+_LIT8( KTestApplicId, "APPLIC-ID" ); // X-Mms-Applic-ID
+_LIT8( KTestReplyApplicId, "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
+_LIT8( KTestApplicInfo, "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
+
+// Since Encapsulation 1.3
+_LIT8( KTestContentClass, "CONTENT-CLASS" ); // X-Mms-Content-Class
+_LIT8( KTestDrmContent, "DRM-CONTENT" ); // X-Mms-DRM-Content
+_LIT8( KTestAdaptationAllowed, "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
+_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
+_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
+_LIT8( KTestReplaceId, "REPLACE-ID" ); // X-Mms-Replace-ID
+_LIT8( KTestStatusText, "STATUS-TEXT" ); // X-Mms-Status-Text
+_LIT8( KTestCancelId, "CANCEL-ID" ); // X-Mms-Cancel-ID
+_LIT8( KTestCancelStatus, "CANCEL-STATUS" ); // X-Mms-Cancel-Status
+
+// DATA TYPES
+#define aSet 1
+#define aReset 0
+#define PartCount 100
+#define MaxAttaCount 10
+#define DefaultBufLen 256
+#define MaxRecipients 5
+
+// status returned by ReadRow
+enum TTestReadStatus
+ {
+ ETestUnknown,
+ ETestNewMessage,
+ ETestNewAttachment,
+ ETestEof, // End of file
+ ETestMessageType,
+ ETestDate,
+ ETestFrom,
+ ETestTo,
+ ETestCc,
+ ETestBcc,
+ ETestAlias,
+ ETestFromAlias,
+ ETestToAlias,
+ ETestCcAlias,
+ ETestBccAlias,
+ ETestSubject,
+ ETestExpiryRel,
+ ETestExpiryAbs,
+ ETestDeliveryTimeRel,
+ ETestDeliveryTimeAbs,
+ ETestPriority,
+ ETestSenderVisibility,
+ ETestDeliveryReport,
+ ETestReadReply,
+ ETestAttachmentType,
+// ETestAttachmentName,
+ ETestAttachmentCharset,
+ ETestAttachmentCid,
+ ETestAttachmentRoot,
+ ETestSettings,
+ ETestMessageClass,
+ ETestDelivReportSendAllow,
+ ETestSingleMessageClass,
+ ETestReplyCharging,
+ ETestReplyChargAbs,
+ ETestReplyChargRel,
+ ETestReplyChargSize,
+ ETestReplyChargID,
+ ETestTID,
+ ETestContentLocation,
+ ETestPreviouslySentIndex,
+ ETestPreviouslySentBy,
+ ETestPreviouslySentDate,
+ ETestMessageId,
+ ETestMessageSize,
+ ETestVersion,
+ ETestReadStatus,
+ ETestResponseStatus,
+ ETestResponseText,
+ ETestRetrieveStatus,
+ ETestRetrieveText,
+ ETestStatus,
+ ETestAttribute,
+ ETestDistributionIndicator,
+ ETestLimit,
+ ETestMessageQuota,
+ ETestSizeQuota,
+ ETestMessageTotal,
+ ETestSizeTotal,
+ ETestMessageCount,
+ ETestAddKeyword,
+ ETestRemoveKeyword,
+ ETestFilterKeyword,
+ ETestMMState,
+ ETestQuota,
+ ETestStart,
+ ETestStore,
+ ETestStored,
+ ETestStoreStatus,
+ ETestStoreStatusText,
+ ETestTotals,
+ ETestDeleteInfoIndex,
+ ETestApplicId,
+ ETestReplyApplicId,
+ ETestApplicInfo,
+ ETestContentClass,
+ ETestDrmContent,
+ ETestAdaptationAllowed,
+ ETestRecommendedRetrievalMode,
+ ETestRecRetrievalModeText,
+ ETestReplaceId,
+ ETestStatusText,
+ ETestCancelId,
+ ETestCancelStatus,
+ ETestAttaRecommendedName,
+ ETestAttachmentContLoc,
+ ETestAttContTypeParamName,
+ ETestAttContTypeParamValue,
+ ETestAttXTypeParamName,
+ ETestAttXTypeParamValue
+
+ };
+
+// VALUE KEYWORDS
+_LIT( KPersonal, "Personal" );
+_LIT( KAdvertisement, "Advertisement" );
+_LIT( KInformational, "Informational" );
+_LIT( KAuto, "Auto" );
+_LIT( KLow, "Low" );
+_LIT( KNormal, "Normal" );
+_LIT( KHigh, "High" );
+_LIT( KHide, "Hide" );
+_LIT( KShow, "Show" );
+_LIT( KYes, "Yes" );
+_LIT( KNo, "No" );
+_LIT( KOn, "On" );
+_LIT( KOff, "Off" );
+_LIT( KDeferred, "Deferred" );
+_LIT( KExpired, "Expired" );
+_LIT( KRetrieved, "Retrieved" );
+_LIT( KRejected, "Rejected" );
+_LIT( KUnrecognized, "Unrecognized" );
+_LIT( KIndeterminate, "Indeterminate" );
+_LIT( KForwarded, "Forwarded" );
+_LIT( KUnreachable, "Unreachable" );
+_LIT( KDraft, "Draft");
+_LIT( KSent, "Sent" );
+_LIT( KNew, "New" );
+// X-Mms-Message-Type
+_LIT( KSendReq, "SendReq" );
+_LIT( KSendConf, "SendConf" );
+_LIT( KNotifInd, "NotifInd" );
+_LIT( KNotifResp, "NotifResp" );
+_LIT( KRetrConf, "RetrConf" );
+_LIT( KAckInd, "AckInd" );
+_LIT( KDelInd, "DelInd" );
+_LIT( KReadReqInd, "ReadReqInd" );
+_LIT( KReadOrigInd, "ReadOrigInd" );
+_LIT( KForwardRec, "ForwardReq" );
+_LIT( KForwardConf, "ForwardConf" );
+_LIT( KMBoxStoreReq, "MBoxStoreReq" );
+_LIT( KMBoxStoreConf, "MBoxStoreConf" );
+_LIT( KMBoxViewReq, "MBoxViewReq" );
+_LIT( KMBoxViewConf, "MBoxViewConf" );
+_LIT( KMBoxUploadReq, "MBoxUploadReq" );
+_LIT( KMBoxUploadConf, "MBoxUploadConf" );
+_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
+_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
+_LIT( KMBoxDescr, "MBoxDescr" );
+_LIT( KDeleteReq, "DeleteReq" );
+_LIT( KDeleteConf, "DeleteConf" );
+_LIT( KCancelReq, "CancelReq" );
+_LIT( KCancelResp, "CancelConf" );
+// X-Mms-Read-Status
+_LIT( KRead, "Read" );
+_LIT( KDelNotRead, "DeletedNotRead" );
+// X-Mms-Reply-Charging
+_LIT( KRequested, "Requested" );
+_LIT( KReqTextOnly, "ReqTextOnly" );
+_LIT( KAccepted, "Accepted" );
+_LIT( KAccTextOnly, "AccTextOnly" );
+// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
+_LIT( KCancelSuccessful, "CancelSuccess" );
+_LIT( KCancelCorrupted, "CancelCorrupted" );
+// X-Mms-Content-Class
+_LIT( KText, "Text" );
+_LIT( KImageBasic, "ImageBasic" );
+_LIT( KImageRich, "ImageRich" );
+_LIT( KVideoBasic, "VideoBasic" );
+_LIT( KVideoRich, "VideoRich" );
+_LIT( KMegaPixel, "MegaPixel" );
+_LIT( KContentBasic, "ContentBasic" );
+_LIT( KContentRich, "ContentRich" );
+// X-Mms-Recommended-Retrieval-Mode
+_LIT( KManual, "Manual" );
+
+//X-Mms-ResponseStatus
+// legacy values
+_LIT( KOk, "OK" );
+_LIT( KErrUnspecified, "Unspecified" );
+_LIT( KErrServiceDenied, "ServiceDenied" );
+_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
+_LIT( KErrAddressUnresolved, "AddressUnresolved" );
+_LIT( KErrMessageNotFound, "MessageNotFound" );
+_LIT( KErrNetworkProblem, "NetworkProblem" );
+_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
+_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
+// values since 1.1 (and 1.2)
+_LIT( KErrTransient, "TransientFailure" );
+_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
+_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
+_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
+_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
+_LIT( KErrPermanent, "PermanentFailure" );
+_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
+_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
+_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
+_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
+_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
+_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
+_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
+_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
+_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
+_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
+_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
+//X-Mms-RetrieveStatus (one extra value)
+_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
+//X-Mms-Store-Status (one extra value)
+_LIT( KErrMMBoxFull, "MMBoxFull" );
+
+_LIT8( KTestContent, "Content" ); // For attribute list only
+_LIT8( KTestAdditionalHeaders, "ADDITIONAL-HEADERS" ); // For attribute list only
+_LIT8( KTestDeliveryTime, "DELIVERY-TIME"); // for attribute list only
+_LIT8( KTestExpiry, "EXPIRY"); // for attribute list only
+_LIT8( KTestReplyCharg, "REPLY-CHARG-DEADLINE" ); // for attribute list only
+_LIT8( KTestContentType, "CONTENT-TYPE" ); // for attribute list only
+
+/**
+* CMmsReadFile
+*/
+NONSHARABLE_CLASS( CMmsReadFile ):public CBase
+ {
+ public: // Constructors and destructor
+
+ static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
+ virtual ~CMmsReadFile(); // Destructor
+
+ public: // New functions
+
+ TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
+ TTestReadStatus ReadRowL();
+ void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
+ TInt FindAlias(TPtrC alias);
+ void SetAttaStructure( TBool aOldAttaStructure = EFalse );
+
+ protected: // Functions from base classes
+
+ private:
+
+ CMmsReadFile(); // C++ default constructor.
+ // By default constructor is private.
+ void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
+ void Reset();
+
+ public: // data
+ TInt iMessageType;
+
+
+ private: // Data
+
+ RFs iFs;
+ RFileReadStream* iReader;
+ TBuf<DefaultBufLen> iValueBuffer;
+ CDesCArray* iAliasArray; // aliases
+ HBufC8* iByteBuffer;
+ TTime iDate;
+ CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
+ TInt iAttaCount;
+ TInt iAttaRoot;
+ TInt iAliasCount;
+ TInt iNextMessageType;
+ TParse iParse;
+ TFileName iFilename;
+
+ protected: // Data
+ private: // Data
+
+ // CArrayFixFlat <TestMessage>* iMessages;
+
+ public: // Friend classes
+ protected: // Friend classes
+ private: // Friend classes
+
+ };
+
+
+NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
+ {
+ public: // Constructors and destructor
+ static CMmsAttaStructure* NewL(); // Two-phased constructor.
+ virtual ~CMmsAttaStructure(); // Destructor
+ private:
+ CMmsAttaStructure(); // C++ default constructor.
+ // By default constructor is private.
+ void ConstructL();
+
+ public: // Data
+ HBufC8* iAtta;
+ HBufC8* iAttaName; // content location
+ HBufC8* iAttaType;
+ HBufC8* iAttaCid;
+ TInt iAttaCharset;
+ HBufC* iAttaRecommendedName; // recommended filename
+ CDesC8ArrayFlat* iContentTypeParams; // zero or more "parameter"
+ CDesC8ArrayFlat* iXTypeParams; // zero or more X-Type "parameters"
+
+ };
+
+
+#endif // MMSREADFILE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/inc/mmstestbed.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSTESTBED_H
+#define MMSTESTBED_H
+
+#ifdef BUILD_MMSTESTBED_DLL
+#define MMSTESTBED_EXPORT Q_DECL_EXPORT
+#else
+#define MMSTESTBED_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <QString>
+
+#include <msvids.h> //for consts like KMsvNullIndexEntryIdValue
+#include <MSVAPI.H>
+#include <MTCLREG.H>
+#include <mmsclient.h>
+//#include <mmsservercommon.h>
+
+class CTestUiTimer;
+class CMsvSession;
+class CMmsClientMtm;
+class CMmsSettings;
+class CMmsHeaders;
+class CLogEvent;
+class CLogViewEvent;
+class CLogFilter;
+class CLogClient;
+
+class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
+ {
+ Q_OBJECT
+
+public:
+ /**
+ *
+ */
+ MmsTestBed();
+ ~MmsTestBed();
+ void setConnectionLocal(bool value);
+ void fromOutboxToMmsc();
+ void fromMmscToInbox();
+ /**
+ * cleanup MMS service
+ */
+ void cleanupAndCreateNewService();
+ void deleteNotifications();
+ void restoreFactorySettings();
+ void setFetchingState( TMmsReceivingMode aState );
+ void sendFromFile();
+ void sendOneByOne();
+ void sendNotifications();
+ void copyDrafts();
+ void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
+ void messageVariation();
+ void cancelSendScheduling();
+ void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
+ void deleteSendSchedule();
+ void cancelFetchScheduling();
+ void fetchForced(TInt aDelay = 5);
+ void deleteFetchSchedule();
+ void doAFetchCycle();
+ void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
+ void cleanOutbox();
+ void cleanInbox();
+ void cleanSent();
+ void cleanDrafts();
+ void cleanAll();
+ void reply();
+ void replyToAll();
+ void forward();
+ void sendReadReport(); // send a read report
+ int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
+ int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
+ void sendViaClient();
+ void scheduledFetch(TInt aDelay = 5);
+ void fetchForcedImmediate();
+ void getEventType();
+ void addEventType();
+ void deleteEventType();
+ void cleanLog();
+ void setOnline(bool value);
+ void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
+ void sendDeliveryReport();
+
+signals:
+ void entryCreatedInDraft(long int id);
+ void entryMovedToOutbox(long int id);
+ void entryMovedToSent(long int id);
+ void entryCreatedInInbox(long int id);
+
+protected:
+ /**
+ * From MMsvSessionObserver
+ */
+ void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+ TAny* aArg2, TAny* aArg3);
+
+private:
+ void findDefaultL();
+ void createMmsService();
+ void cleanup();
+ void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
+ void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
+ void addMMBoxDescriptions();
+ void encodeMessageFromDrafts();
+ TMsvId findMMSFolder();
+ bool checkLogClient();
+ int getLogEntries();
+
+private:
+ //data
+ CTestUiTimer* iTimer;
+ CMsvOperationActiveSchedulerWait* iWait;
+ CMsvSession* iSession;
+ CClientMtmRegistry* iClientMtmRegistry;
+ CMmsClientMtm* iMmsClient;
+ CMmsSettings* iSettings;
+ CMmsHeaders* iMmsHeaders;
+ TMsvId iServiceId;
+ TMsvId iDefaultServiceId;
+ TMsvSessionEvent iEvent;
+ RFs iFs;
+ TFileName iFilename;
+ TFileName iCurrentFile;
+ TFileName iCurrentPath;
+ TParse iParse; // parse buffer as member to save stack space
+ CBufFlat* iEncodeBuffer;
+ CMsvEntrySelection* iMsvEntrySelection;
+ CLogEvent* iLogEvent;
+ CLogClient* iLogClient;
+ CLogViewEvent* iLogView;
+ CLogFilter* iLogFilter;
+ };
+
+#endif // MMSTESTBED_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/inc/mmstestbed.hrh Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <bldvariant.hrh>
+
+
+#ifndef MMSTESTBED_HRH
+#define MMSTESTBED_HRH
+
+enum
+{
+ EAppMainOk = 1,
+ EAppMainCancel,
+ //
+ EMenufrmCmdCascadeTest,
+ ECleanup,
+ ECleanOutbox,
+ ESaveSettings,
+ ELoadSettings,
+ ECleanInbox,
+ EShowIn,
+ EShowOut,
+ EOutToMMSC,
+ EMMSCToIn,
+ ESendScheduled,
+ EReceiveScheduled,
+ EShowSent,
+ ECleanSent,
+ EStartMyNotifier,
+ EGetEventType,
+ EAddEventType,
+ EDeleteEventType,
+ EViewLog,
+ ECleanLog,
+ EShowWapAccessPoints,
+ ESelectWapAccessPoint,
+ EShowConnectionMode,
+ EShowIAP,
+ EConnectToIAP,
+ EDeleteSendSchedule,
+ EDeleteReceiveSchedule,
+ EDeleteNotifications,
+ ERestoreFactorySettings,
+ ECreateFromFile,
+ EShowNotifications,
+ ESendDeliveryReport,
+ EShowDrafts,
+ ECleanDrafts,
+ ECleanAll,
+ EFetchingDeferred,
+ EFetchingOn,
+ ESendFromFile,
+ ESwitchToLocal,
+ ESwitchToGlobal,
+ EDecodeLoggingOn,
+ EDecodeLoggingOff,
+ EBinaryDumpOn,
+ EBinaryDumpOff,
+ ESendNotification,
+ ECreateToInbox,
+ ECreateToSentItems,
+ ESendFromDrafts,
+ EFindMMSFolder,
+ ESendOneByOne,
+ ECreateToDrafts,
+ ESendViaClient,
+ ESendMemFail,
+ EFetchMemFail,
+ EReceiveForced,
+ ECreateHeadersFromFile,
+ ESwitchToOffline,
+ ESwitchToOnline,
+ ECopyDrafts,
+ ECreateNotification,
+ EReply,
+ EReplyToAll,
+ EForward,
+ EFetchingManual,
+ EFirstBoot,
+ ENoFirstBoot,
+ EFindNetworkStatus,
+ ESendReadReport,
+ ECreateMMBoxViewConf,
+ EGetMMBoxView,
+ ECleanMMBox,
+ EShowMMBox
+};
+
+#define ETestLabel1 1
+#define ETestLabel2 2
+#define ETestLabel3 3
+#define ETestLabel4 4
+
+#define EServiceList 2
+
+
+enum TTestBedDlgCtrlIds
+ {
+ ETestEditField = 1
+ };
+
+enum TEditServiceControls
+ {
+ EFolderLabel = 1,
+ EEditUri
+// EEditServiceFolder,
+// ENameLabel,
+// EEditServiceName,
+// ENumberLabel,
+// EEditServiceNumber
+ };
+
+enum
+ {
+ EFsViewDialogId = 1
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/inc/mmsteststaticutils.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSTESTSTATICUTILS_H
+#define MMSTESTSTATICUTILS_H
+
+#include <e32std.h>
+#include <msvstd.h>
+#include <badesca.h>
+
+#include "mmsconst.h"
+
+class RFs;
+class CMsvSession;
+class CMmsEncode;
+class CMmsHeaders;
+
+#ifdef __WINS__
+_LIT( KRootPath, "c:\\" );
+#else
+// This is removable disk.
+// drive letter should not be hard coded, must be investigated further
+// We use c: for a while for the tests (to be cahnged later)
+_LIT( KRootPath, "c:\\" );
+//_LIT( KRootPath, "e:\\" );
+#endif
+
+// directory where mmbox descriptions are created
+_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
+// directory where created headers are dumped
+_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
+// content type of MMS PDUs
+_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
+
+_LIT( KWild, "*" );
+
+
+/**
+ * joined array structure
+ *
+ */
+NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
+ {
+public:
+ TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
+ TInt MdcaCount() const;
+ TPtrC16 MdcaPoint(TInt aIndex) const;
+private:
+ CDesCArray* const & iArray1;
+ CDesCArray* const & iArray2;
+ };
+
+/**
+ * static utility functions
+ *
+ */
+class TMmsTestUtils
+ {
+
+public:
+
+ /**
+ *
+ */
+ TMmsTestUtils();
+
+ /**
+ * read phone number for sending messages
+ *
+ * @param aFileName full path for filename
+ * @param aFs file system handle
+ * @return allocated pointer containing the name
+ * The caller must delete the pointer when no longer needed
+ */
+ static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
+
+ static void DecodeLoggingOnL();
+ static void DecodeLoggingOffL();
+ static void BinaryDumpOnL();
+ static void BinaryDumpOffL();
+
+ /**
+ * Clean all temporary directories used in local mode.
+ * Does not delete the directories, only the contents
+ *
+ * @param aFs file system handle
+ */
+ static void CleanDirectoryL( RFs& aFs );
+
+ /**
+ * Dump a binary message
+ *
+ * @param aBuffer buffer containing the binary message
+ * @param aFilename full path of the directory whenre the dump goes
+ * @param aParse reference to parser (to save stack space)
+ * @param aFs file system handle
+ */
+ static void Dump(
+ CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
+
+ /**
+ * Delete all MMS messages and notifications from a given folder
+ *
+ * @param aBoxId folder id
+ * @param aSession Messaging server session
+ */
+ static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
+
+ /**
+ * turn on logging messages sent to email addresses
+ */
+ static void EmailLoggingOnL();
+
+ /**
+ * turn off logging messages sent to email addresses
+ */
+ static void EmailLoggingOffL();
+
+ /**
+ * load list of children into selection and return count
+ *
+ * @param aBoxId folder id
+ * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
+ * caller is responsible of deleting the pointer afterwards.
+ * Pointer may be NULL at entry, and a new pointer will be allocated
+ * @param aSession messge server session
+ * @param aMessageType child MTM type, default is multimedia message
+ * @return number of entries in selection
+ */
+ static TInt CountChildrenL(
+ TMsvId aBoxId,
+ CMsvEntrySelection*& aMsvEntrySelection,
+ CMsvSession& aSession,
+ TUid aMessageType = KUidMsgTypeMultimedia);
+
+ /**
+ * Create a folder entry
+ *
+ * @param aSession messge server session
+ * @param aParentFolder the parent folder
+ * @param aFolderName name of the folder
+ * @param aFolderId will contain the if of the new folder if creation was successful
+ */
+ static void CreateFolderEntryL(
+ CMsvSession& aSession,
+ TMsvId aParentFolder,
+ const TDesC& aFolderName,
+ TMsvId& aFolderId );
+
+ /**
+ * Create an MMS notification from data in buffer
+ * @param aNotificationFolder mms notification folder (target folder)
+ * @param aServiceId id of MMS service
+ * @param aEncodeBuffer buffer that contains the data
+ * @param aSession message server session
+ * @return id of the created notification
+ */
+ static TMsvId CreateNotificationEntryL(
+ TMsvId aNotificationFolder,
+ TMsvId aServiceId,
+ CBufFlat* aEncodeBuffer,
+ CMsvSession& aSession );
+
+ /**
+ * Encode an MMS notification into buffer
+ * @param aUrl url of the notification for local messages a filepath
+ * @param aSize size of the message
+ * @param aMmsHeaders MMS headers structure for creating the notification
+ * @param aMmsEncoder reference to CMmsEncode class
+ * @param aEncodeBuffer flat buffer that will contain the encoded notification
+ */
+ static void FormNotification(
+ TDesC8& aUrl,
+ TInt aSize,
+ CMmsHeaders& aMmsHeaders,
+ CMmsEncode& aMmsEncoder,
+ CBufFlat* aEncodeBuffer );
+
+
+ static TBool IsDrive(const TDesC& aFileName);
+ static TBool IsDir(const TDesC& aFileName, RFs& aFs);
+ static TBool IsFile(const TDesC& aFileName, RFs& aFs);
+
+
+private:
+
+ };
+
+
+#endif // MMSTESTSTATICUTILS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/inc/mmstestuitimer.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef C_TESTUITIMER_H
+#define C_TESTUITIMER_H
+
+
+#include <e32base.h>
+
+#define KPeriod 10000 // period of timer
+
+/**
+ * timer for test programs
+ */
+NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
+ {
+public:
+
+ static CTestUiTimer* NewL();
+ virtual ~CTestUiTimer();
+
+ void RunL();
+ void DoCancel();
+ void ConstructL();
+ void IssueRequest();
+ void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
+
+private:
+ CTestUiTimer();
+
+public:
+ TTimeIntervalMicroSeconds32 period;
+
+private: // data
+ CActive* iObject;
+ };
+
+#endif // C_TESTUITIMER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/mmstestbed.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,90 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Project Definiton File for mmstestbed
+#
+
+QT += testlib
+QT -= gui
+
+CONFIG += hb
+CONFIG += symbian_test
+CONFIG += qtestlib
+
+TEMPLATE = lib
+
+TARGET = mmstestbed
+
+INCLUDEPATH += .
+INCLUDEPATH += inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmshttptransport/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmsconninit/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmsserver/inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_MMSTESTBED_DLL
+
+SOURCES += src/mmstestbed.cpp \
+ src/mmsteststaticutils.cpp \
+ src/mmsreadfile.cpp \
+ src/mmstestuitimer.cpp
+
+HEADERS += inc/mmstestbed.h \
+ inc/mmsteststaticutils.h \
+ inc/mmsreadfile.h \
+ inc/mmstestuitimer.h \
+ inc/mmstestbed.hrh
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+symbian {
+ TARGET.UID3 = 0xE5c588a1
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.EPOCSTACKSIZE = 0x8000
+ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+ TARGET.EPOCALLOWDLLDATA = 1
+ VENDORID = VID_DEFAULT
+ }
+
+#Def File rules
+defBlock = \
+"$${LITERAL_HASH}if defined(EABI)" \
+"DEFFILE eabi/mmstestbedu.def" \
+"$${LITERAL_HASH}else" \
+"DEFFILE bwins/mmstestbedu.def" \
+"$${LITERAL_HASH}endif"
+
+# Build.inf rules
+BLD_INF_RULES.prj_exports += \
+ "$${LITERAL_HASH}include <platform_paths.hrh>"
+
+LIBS += -lmsgs \
+ -lmmsmessage \
+ -lmmsconninit \
+ -lmmscodec \
+ -lmmsserversettings \
+ -lcentralrepository \
+ -lapparc \
+ -lbafl \
+ -lefsrv \
+ -lesock \
+ -lestor \
+ -leuser \
+ -llogcli \
+ -llogwrap \
+ -lapgrfx \
+ -lapmime
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/src/mmsreadfile.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,1799 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <badesca.h>
+#include <e32def.h>
+#include <s32file.h>
+#include <msvids.h>
+#include <mtmdef.h>
+//#include <eikenv.h>
+#include <apgcli.h>
+#include <CMsvMimeHeaders.h>
+#include <AknNoteWrappers.h>
+
+#include <mmsservercommon.h>
+#include "mmsconst.h"
+#include "mmsclient.h"
+#include "mmsheaders.h"
+#include "mmsreadfile.h"
+#include "mmsmmboxviewheaders.h"
+#include "mmsmmboxmessageheaders.h"
+#include "mmsmmboxflags.h"
+#include "mmssettings.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KMmsGranularity = 8;
+_LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
+
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// ==================== LOCAL FUNCTIONS ====================
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsReadFile::CMmsReadFile()
+ {
+ // all member variables in a class derived from CBase
+ // are automatically set to 0.
+ }
+
+
+//
+void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
+ {
+ // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
+ iFs = aFs;
+ iReader = &aReadStream;
+ iByteBuffer = HBufC8::NewL( DefaultBufLen );
+ iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
+ iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
+ Reset();
+ }
+
+// Two-phased constructor.
+CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
+ {
+ CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
+ CleanupStack::PushL( self );
+ self->ConstructL( aFs, aReadStream );
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+// Destructor
+CMmsReadFile::~CMmsReadFile()
+ {
+ Reset(); // resets and destroys all array data
+ if (iAliasArray != NULL) iAliasArray->Reset();
+ delete iByteBuffer;
+ delete iAliasArray;
+ delete iAttaStructures;
+ }
+
+void CMmsReadFile::Reset()
+ {
+ // reset all arrays
+ if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
+ iAttaCount = 0;
+ iAttaRoot = 0;
+ }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CompleteTest
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
+{
+ Reset(); // new message
+
+ TUint32 val;
+ TUint limit = 1000000;
+ TUint sizeLimit = 1000 * 1024; //max message size 1000 kB!
+ TUint allLimit = 999999;
+ TInt error;
+ TRadix radix = EDecimal;
+ TLex16 lex;
+ TTestReadStatus readStatus = ETestUnknown;
+ CMmsAttaStructure* oneAtta = NULL;
+ TInt index;
+ TTime y1970( K1970 );
+ TTimeIntervalMicroSeconds interval;
+ TTime date;
+ TInt order = 0;
+ TInt16 shortInteger = 0;
+
+ //iso luuppi, joka kiertää ja lukee kunnes EOF tule vastaan
+ //Big Loop, which passes around and read until the EOF
+
+ iMessageType = iNextMessageType;
+ while(readStatus != ETestEof)
+ {
+ readStatus = ReadRowL();
+ if ( readStatus == ETestEof )
+ {
+ return(-1);
+ }
+ if ( readStatus == ETestUnknown )
+ {
+ // A line containing only comments, or an unknown tag
+ // As using the scripts to test settings is no longer supported,
+ // any old keywords used to test CMmsSettings class are ignored
+ continue;
+ }
+ if( readStatus == ETestNewMessage )
+ {
+ iNextMessageType = readStatus;
+ if(aMessageCounter++)
+ {
+ return(NULL);
+ }
+ else
+ {
+ iMessageType = iNextMessageType;
+ continue;
+ }
+ }
+ if ( iMessageType == ETestNewMessage)
+ {
+ switch(readStatus)
+ {
+ case ETestFrom:
+ aMmsHeaders.SetSenderL( iValueBuffer );
+ break;
+ case ETestFromAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
+ }
+ break;
+ case ETestTo:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
+ break;
+ case ETestToAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
+ }
+ break;
+ case ETestCc:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
+ break;
+ case ETestCcAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
+ }
+ break;
+ case ETestBcc:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
+ break;
+ case ETestBccAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
+ }
+ break;
+ case ETestSubject:
+ aMmsHeaders.SetSubjectL( iValueBuffer );
+ break;
+ case ETestExpiryRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetExpiryInterval( val );
+ }
+ break;
+ case ETestExpiryAbs:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ // expiry date in seconds from 1.1.1970.
+ aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
+ break;
+ case ETestDeliveryTimeRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetDeliveryTimeInterval( val );
+ }
+ break;
+ case ETestDeliveryTimeAbs:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
+ break;
+ case ETestDate:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetDate( (interval.Int64())/1000000 );
+ case ETestPriority:
+ val = 0;
+ if ((iValueBuffer.CompareF(KLow)) == 0)
+ {
+ val = EMmsPriorityLow;
+ }
+ else if ((iValueBuffer.CompareF(KNormal)) == 0)
+ {
+ val = EMmsPriorityNormal;
+ }
+ else if ((iValueBuffer.CompareF(KHigh)) == 0)
+ {
+ val = EMmsPriorityHigh;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessagePriority( val );
+ break;
+ case ETestSenderVisibility:
+ val = 0;
+ if ((iValueBuffer.CompareF(KHide)) == 0)
+ {
+ val = EMmsSenderVisibilityHide;
+ }
+ else if ((iValueBuffer.CompareF(KShow)) == 0)
+ {
+ val = EMmsSenderVisibilityShow;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetSenderVisibility( val );
+ break;
+ case ETestDeliveryReport:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDeliveryReport( val );
+ break;
+ case ETestDelivReportSendAllow:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReportAllowed( val );
+ break;
+
+ case ETestReadReply:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReadReply( val );
+ break;
+ case ETestNewAttachment:
+ oneAtta = CMmsAttaStructure::NewL();
+ iAttaStructures->AppendL(oneAtta);
+ oneAtta->iAtta->Des().Copy( iValueBuffer );
+ iAttaCount++;
+ break;
+ case ETestAttachmentType:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaType->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttachmentContLoc:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaName->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttaRecommendedName:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttachmentCharset:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaCharset = val;
+ }
+ }
+ break;
+ case ETestAttachmentCid:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaCid->Des().Copy(iValueBuffer);
+ }
+ break;
+ case ETestAttContTypeParamName:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttContTypeParamValue:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttXTypeParamName:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttXTypeParamValue:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttachmentRoot:
+ iAttaRoot = iAttaCount;
+ break;
+ case ETestAlias:
+ // all aliases are global even if they appear
+ // in the middle of a message
+ iAliasArray->AppendL( iValueBuffer );
+ iAliasCount++;
+ break;
+ case ETestMessageClass: // should be handled!
+ val = EMmsClassPersonal;
+ if ((iValueBuffer.CompareF(KPersonal)) == 0)
+ {
+ val = EMmsClassPersonal;
+ }
+ else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
+ {
+ val = EMmsClassAdvertisement;
+ }
+ else if ((iValueBuffer.CompareF(KInformational)) == 0)
+ {
+ val = EMmsClassInformational;
+ }
+ else if ((iValueBuffer.CompareF(KAuto)) == 0)
+ {
+ val = EMmsClassAuto;
+ }
+ else
+ {
+ val = (TMmsMessageClass)KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessageClass( val );
+ break;
+ case ETestReplyCharging:
+ val = 0;
+ if ((iValueBuffer.CompareF(KRequested)) == 0)
+ {
+ val = KMmsReplyChargingRequested;
+ }
+ else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
+ {
+ val = KMmsReplyChargingRequestedTextOnly;
+ }
+ else if ((iValueBuffer.CompareF(KAccepted)) == 0)
+ {
+ val = KMmsReplyChargingAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
+ {
+ val = KMmsReplyChargingAcceptedTextOnly;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReplyCharging( val );
+ break;
+ case ETestReplyChargAbs:
+ error = date.Set(iValueBuffer);
+ if ( error == KErrNone )
+ {
+ interval = date.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
+ }
+ break;
+ case ETestReplyChargRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetReplyChargingInterval( val );
+ }
+ break;
+ case ETestReplyChargSize:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,sizeLimit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetReplyChargingSize( val );
+ }
+ break;
+ case ETestReplyChargID:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
+ break;
+ case ETestTID:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetTidL( iByteBuffer->Des() );
+ break;
+ case ETestContentLocation:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
+ {
+ aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
+ }
+ else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
+ }
+ else
+ {
+ aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
+ }
+ break;
+ case ETestPreviouslySentIndex:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ order = val;
+ break;
+ case ETestPreviouslySentBy:
+ aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
+ break;
+ case ETestPreviouslySentDate:
+ error = date.Set(iValueBuffer);
+ if ( error == KErrNone )
+ {
+ interval = date.MicroSecondsFrom( y1970 );
+ aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
+ }
+ break;
+ case ETestMessageId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
+ break;
+ case ETestMessageSize:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,sizeLimit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetMessageSize( val );
+ }
+ break;
+ case ETestVersion:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,EHex,limit);
+ shortInteger = TInt16( val );
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetMmsVersion( shortInteger );
+ }
+ break;
+ case ETestReadStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KRead)) == 0)
+ {
+ val = KMmsReadStatusRead;
+ }
+ else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
+ {
+ val = KMmsReadStatusDeletedWithoutBeingRead;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReadStatus( val );
+ break;
+ case ETestResponseStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
+ {
+ val = KMmsErrorUnspecified;
+ }
+ else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
+ {
+ val = KMmsErrorServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
+ {
+ val = KMmsErrorMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
+ {
+ val = KMmsErrorNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
+ {
+ val = KMmsErrorNoContentAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
+ {
+ val = KMmsErrorUnsupportedMessage;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorTransientSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+ {
+ val = KMmsErrorTransientMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorPermanentMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorPermanentSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorPermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
+ {
+ val = KMmsErrorPermanentContentNotAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingForwardingDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingNotSupported;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
+ {
+ val = KMmsErrorTransientPartialSuccess;
+ }
+ else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
+ {
+ val = KMmsErrorPermanentAddressHidingNotSupported;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteStatusL( order, val );
+ }
+ else
+ {
+ aMmsHeaders.SetResponseStatus( val );
+ }
+ break;
+ case ETestResponseText:
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
+ }
+ else
+ {
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ }
+ break;
+ case ETestRetrieveStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+ {
+ val = KMmsErrorReceiveTransientMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorReceiveTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorReceivePermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
+ {
+ val = KMmsErrorReceivePermanentContentUnsupported;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetResponseStatus( val );
+ break;
+ case ETestRetrieveText:
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ break;
+ case ETestStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KDeferred)) == 0)
+ {
+ val = KMmsMessageStatusDeferred;
+ }
+ else if ((iValueBuffer.CompareF(KExpired)) == 0)
+ {
+ val = KMmsMessageStatusExpired;
+ }
+ else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+ {
+ val = KMmsMessageStatusRetrieved;
+ }
+ else if ((iValueBuffer.CompareF(KRejected)) == 0)
+ {
+ val = KMmsMessageStatusRejected;
+ }
+ else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
+ {
+ val = KMmsMessageStatusUnrecognized;
+ }
+ else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
+ {
+ val = KMmsMessageStatusIndeterminate;
+ }
+ else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+ {
+ val = KMmsMessageStatusForwarded;
+ }
+ else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
+ {
+ val = KMmsMessageStatusUnreachable;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetStatus( val );
+ break;
+ case ETestMessageType:
+ val = 0;
+ if ((iValueBuffer.CompareF(KSendReq)) == 0)
+ {
+ val = KMmsMessageTypeMSendReq;
+ }
+ else if ((iValueBuffer.CompareF(KSendConf)) == 0)
+ {
+ val = KMmsMessageTypeMSendConf;
+ }
+ else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
+ {
+ val = KMmsMessageTypeMNotificationInd;
+ }
+ else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
+ {
+ val = KMmsMessageTypeMNotifyRespInd;
+ }
+ else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
+ {
+ val = KMmsMessageTypeMRetrieveConf;
+ }
+ else if ((iValueBuffer.CompareF(KAckInd)) == 0)
+ {
+ val = KMmsMessageTypeAcknowledgeInd;
+ }
+ else if ((iValueBuffer.CompareF(KDelInd)) == 0)
+ {
+ val = KMmsMessageTypeDeliveryInd;
+ }
+ else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
+ {
+ val = KMmsMessageTypeReadRecInd;
+ }
+ else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
+ {
+ val = KMmsMessageTypeReadOrigInd;
+ }
+ else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
+ {
+ val = KMmsMessageTypeForwardReq;
+ }
+ else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
+ {
+ val = KMmsMessageTypeForwardConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
+ {
+ val = KMmsMessageTypeMboxStoreReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
+ {
+ val = KMmsMessageTypeMboxStoreConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
+ {
+ val = KMmsMessageTypeMboxViewReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
+ {
+ val = KMmsMessageTypeMboxViewConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
+ {
+ val = KMmsMessageTypeMBoxUploadReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
+ {
+ val = KMmsMessageTypeMBoxUploadConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDeleteReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDeleteConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDescr;
+ }
+ else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
+ {
+ val = KMmsMessageTypeDeleteReq;
+ }
+ else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
+ {
+ val = KMmsMessageTypeDeleteConf;
+ }
+ else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
+ {
+ val = KMmsMessageTypeCancelReq;
+ }
+ else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
+ {
+ val = KMmsMessageTypeCancelConf;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessageType( val );
+ break;
+ case ETestAttribute:
+ val = 0;
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
+ {
+ val = KMmsAssignedBcc;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
+ {
+ val = KMmsAssignedCc;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
+ {
+ val = KMmsAssignedContent;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
+ {
+ val = KMmsAssignedContentType;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
+ {
+ val = KMmsAssignedDate;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
+ {
+ val = KMmsAssignedDeliveryReport;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
+ {
+ val = KMmsAssignedDeliveryTime;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
+ {
+ val = KMmsAssignedExpiry;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
+ {
+ val = KMmsAssignedFrom;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
+ {
+ val = KMmsAssignedMessageClass;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
+ {
+ val = KMmsAssignedMessageId;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
+ {
+ val = KMmsAssignedMessageSize;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
+ {
+ val = KMmsAssignedPriority;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
+ {
+ val = KMmsAssignedReadReply;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
+ {
+ val = KMmsAssignedSubject;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
+ {
+ val = KMmsAssignedTo;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
+ {
+ val = KMmsAssignedReplyCharging;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
+ {
+ val = KMmsAssignedReplyChargingID;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
+ {
+ val = KMmsAssignedReplyChargingDeadline;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
+ {
+ val = KMmsAssignedReplyChargingSize;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
+ {
+ val = KMmsAssignedPreviouslySentBy;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
+ {
+ val = KMmsAssignedPreviouslySentDate;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
+ {
+ val = KMmsAssignedAdditionalHeaders;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
+ break;
+ case ETestDistributionIndicator:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDistributionIndicator( val );
+ break;
+ case ETestLimit:
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if( error == KErrNone )
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
+ }
+ break;
+ case ETestMessageQuota:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
+ }
+ break;
+ case ETestSizeQuota:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
+ }
+ break;
+ case ETestMessageTotal:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
+ }
+ break;
+ case ETestSizeTotal:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
+ }
+ break;
+ case ETestMessageCount:
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
+ }
+ break;
+ case ETestAddKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
+ break;
+ case ETestRemoveKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
+ break;
+ case ETestFilterKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
+ break;
+ case ETestMMState:
+ val = 0;
+ if ((iValueBuffer.CompareF(KDraft)) == 0)
+ {
+ val = KMmsDraft;
+ }
+ else if ((iValueBuffer.CompareF(KSent)) == 0)
+ {
+ val = KMmsSent;
+ }
+ else if ((iValueBuffer.CompareF(KNew)) == 0)
+ {
+ val = KMmsNew;
+ }
+ else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+ {
+ val = KMmsRetrieved;
+ }
+ else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+ {
+ val = KMmsForwarded;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
+ }
+ else
+ {
+ aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
+ }
+ break;
+ case ETestQuota:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
+ break;
+ case ETestStart:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
+ }
+ break;
+ case ETestStore:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
+ break;
+ case ETestStored:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
+ break;
+ case ETestStoreStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorStoreStatusTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorPermanentMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorStoreStatusPermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
+ {
+ val = KMmsErrorStoreStatusPermanentMmboxFull;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
+ break;
+ case ETestStoreStatusText:
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
+ break;
+ case ETestTotals:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
+ break;
+
+ case ETestDeleteInfoIndex:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ order = val;
+ break;
+
+ case ETestApplicId:
+ aMmsHeaders.SetApplicIdL( iValueBuffer );
+ break;
+ case ETestReplyApplicId:
+ aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
+ break;
+ case ETestApplicInfo:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
+ break;
+ case ETestContentClass:
+ val = 0;
+ if ((iValueBuffer.CompareF(KText)) == 0)
+ {
+ val = KMmsContentClassText;
+ }
+ else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
+ {
+ val = KMmsContentClassImageBasic;
+ }
+ else if ((iValueBuffer.CompareF(KImageRich)) == 0)
+ {
+ val = KMmsContentClassImageRich;
+ }
+ else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
+ {
+ val = KMmsContentClassVideoBasic;
+ }
+ else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
+ {
+ val = KMmsContentClassVideoRich;
+ }
+ else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
+ {
+ val = KMmsContentClassMegaPixel;
+ }
+ else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
+ {
+ val = KMmsContentClassContentBasic;
+ }
+ else if ((iValueBuffer.CompareF(KContentRich)) == 0)
+ {
+ val = KMmsContentClassContentRich;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetContentClass( val );
+ break;
+ case ETestDrmContent:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDrmContent( val );
+ break;
+ case ETestAdaptationAllowed:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetAdaptationAllowed( val );
+ break;
+ case ETestRecommendedRetrievalMode:
+ val = 0;
+ if ((iValueBuffer.CompareF(KManual)) == 0)
+ {
+ val = KMmsRecommendedRetrievalModeManual;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetRecommendedRetrievalMode( val );
+ break;
+ case ETestRecRetrievalModeText:
+ aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
+ break;
+ case ETestReplaceId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+ break;
+ case ETestStatusText:
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ break;
+ case ETestCancelId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+ break;
+ case ETestCancelStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
+ {
+ val = KMmsCancelRequestSuccessfullyReceived;
+ }
+ else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
+ {
+ val = KMmsCancelRequestCorrupted;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetCancelStatus( val );
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch(readStatus)
+ {
+ case ETestAlias:
+ iAliasArray->AppendL( iValueBuffer );
+ iAliasCount++;
+ break;
+
+ default:
+ break;
+ }
+
+ }
+ }
+ return(-1);
+}
+
+// ---------------------------------------------------------
+// CMmsReadFile()::ReadRowL
+// ---------------------------------------------------------
+//
+TTestReadStatus CMmsReadFile::ReadRowL()
+ {
+
+ TBuf8<DefaultBufLen> RowBuffer;
+ TBuf8<32> KeyBuffer;
+
+ // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
+ TChar delim( 10 );
+ iReader->ReadL( RowBuffer, delim);
+ TInt length = RowBuffer.Length();
+ if ( RowBuffer.Length() < 2 )
+ {
+ return ETestEof;
+ }
+ RowBuffer.Delete(length - 2,2);
+
+ // DROP POSSIBLE COMMENT OUT
+ TInt pos = RowBuffer.Locate( ';' );
+ if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
+
+ if ( RowBuffer.Length() == 0 )
+ {
+ // the line contained only comment
+ return ETestUnknown;
+ }
+
+ // First split the row (:)
+ pos = RowBuffer.Locate( ':' );
+ if (pos > 0)
+ {
+ TPtrC8 p = RowBuffer.Mid( pos+1 );
+ length = p.Length();
+ iValueBuffer.Zero();
+ for (TInt i=0; i < length; ++i)
+ {
+ iValueBuffer.Append(p[i]);
+ }
+ iValueBuffer.Trim();
+ TPtrC8 pp = RowBuffer.Left(pos);
+ KeyBuffer.CopyUC(pp);
+ KeyBuffer.Trim();
+ }
+ // TRY TO FIND CORRECT TAG
+ if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
+ if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
+ if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
+ if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
+ if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
+ if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
+ if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
+ if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
+ if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
+ if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
+ if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
+ if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
+ if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
+ if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
+ if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
+ if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
+ if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
+ if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
+ if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
+ if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
+ if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
+ if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
+ if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
+ if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
+ if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
+ if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
+ if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
+ if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
+ if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
+ if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
+ if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
+ if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
+ if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
+ if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
+ if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
+ if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
+ if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
+ if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
+ if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
+ if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
+ if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
+ if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
+ if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
+ if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
+ if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
+ if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
+ if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
+ if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
+ if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
+ if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
+ if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
+ if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
+ if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
+ if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
+ if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
+ if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
+ if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
+ if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
+ if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
+ if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
+ if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
+ if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
+ if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
+ if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
+ if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
+ if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
+ if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
+ if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
+ if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
+ if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
+ if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
+ if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
+ if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
+ if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
+ if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
+ if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
+ if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
+ if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
+ if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
+ if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
+ if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
+ if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
+ if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
+ return ETestUnknown;
+ }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CreateMessageL
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
+ {
+
+ // Reset inactivity timer to keem viewServer from crashing
+ User::ResetInactivityTime();
+
+ TInt i;
+ TInt error = KErrNone;
+ RFile attaFile;
+ _LIT8(KLeftAngle, "<");
+ _LIT8(KRightAngle, ">");
+ // we can't use "seconds from" as it only returns a
+ // 32 bit signed integer. If fails in 2038.
+ // "microseconds from" returns a 64 bit signed integer
+
+ CMsvStore* store = aMmsClient->Entry().EditStoreL();
+ CleanupStack::PushL(store);
+ aMmsHeaders->StoreL(*store);
+ store->CommitL();
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+
+ aMmsClient->LoadMessageL(); // read store is needed to do this
+
+ store = aMmsClient->Entry().EditStoreL();
+ CleanupStack::PushL(store);
+ CMsvAttachment* attaInfo = NULL;
+ TMsvAttachmentId attaId = 0;
+
+ for ( i=0; i < iAttaStructures->Count(); ++i)
+ {
+ attaId = KMsvNullIndexEntryId;
+ iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+
+ error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
+ User::LeaveIfError( error );
+
+ CleanupClosePushL(attaFile);
+
+ CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+ CleanupStack::PushL( mimeHeaders );
+ TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
+
+ TDataRecognitionResult result;
+ result.Reset(); // make sure that it is cleared
+
+ if(iAttaStructures->At(i)->iAttaCid->Length())
+ {
+ TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
+ if (attaCID.Find(KLeftAngle) == 0 &&
+ attaCID.Find(KRightAngle) == attaCID.Length()-1 )
+ {
+ // remove angle brackets from cid
+ attaCID = attaCID.Mid(1,attaCID.Length()-2);
+ }
+ mimeHeaders->SetContentIdL(attaCID);
+ }
+
+ if (iAttaStructures->At(i)->iAttaCharset)
+ {
+ mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
+ }
+
+ if (iAttaStructures->At(i)->iAttaName->Length())
+ {
+ iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
+ }
+ iParse.Set( iFilename, NULL, NULL );
+ iFilename.Copy( iParse.NameAndExt() );
+
+ mimeHeaders->SetContentLocationL( iFilename );
+
+ // if Mime type has not been set, use RapaRecognizer
+ if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
+ {
+ // TO BE IMPLEMENTED
+
+ RApaLsSession lsSession;
+
+ if ( lsSession.Connect() == KErrNone )
+ {
+ CleanupClosePushL( lsSession );
+
+ iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+ if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
+ {
+ // Check confidence level. Recognization must be at least
+ // "EProbable". We don't accept the result if it is "EPossible"
+ // or "EUnlikely" or "ENotRecognized"!
+
+ if ( result.iConfidence < CApaDataRecognizerType::EProbable )
+ {
+ result.Reset(); // clear buffer and try again with longer buffer
+ }
+
+ TPtrC8 mimeBuf8 = result.iDataType.Des8();
+
+ if ( mimeBuf8.Length() == 0 )
+ {
+ // Open file buffer and try again..
+
+ TInt bufSize = 0;
+ (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
+ if ( bufSize <= 0 )
+ {
+ bufSize = 30;
+ }
+ HBufC8* buf = HBufC8::NewLC( bufSize );
+ TPtr8 des = buf->Des();
+
+ RFile file;
+ TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
+ if ( err == KErrNone )
+ {
+ err = file.Read( des );
+ file.Close();
+ if ( err == KErrNone )
+ {
+ if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
+ {
+ mimeBuf8.Set( result.iDataType.Des8() );
+ }
+ }
+
+ }
+ CleanupStack::PopAndDestroy(); // buf
+ }
+ if ( mimeBuf8.Length() > 0 &&
+ result.iConfidence >= CApaDataRecognizerType::EProbable )
+ {
+ contentType.Set( result.iDataType.Des8() );
+ }
+ }
+ CleanupStack::PopAndDestroy(1); // lssession
+ }
+ }
+
+ if ( contentType.Length() > 0 )
+ {
+ TInt position = contentType.Find( KMmsSlash8 );
+ if ( position >= 0 )
+ {
+ mimeHeaders->SetContentTypeL( contentType.Left( position ) );
+ }
+ if ( position < contentType.Length() - 1 )
+ {
+ mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
+ }
+// CreateAttachment2L sets the content type to attaInfo
+// attaInfo->SetMimeTypeL( contentType );
+ }
+
+ if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
+ {
+ iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
+ iParse.Set( iFilename, NULL, NULL );
+ iFilename.Copy( iParse.NameAndExt() );
+ mimeHeaders->SetSuggestedFilenameL( iFilename );
+ }
+
+ TInt j = 0;
+ for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
+ {
+ mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
+ }
+ for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
+ {
+ mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
+ }
+
+ attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
+ // attaInfo does not go onto cleaunpstack because ownership will
+ // be transferred to attachment manager.
+
+ aMmsClient->CreateAttachment2L(
+ *store,
+ attaFile,
+ contentType,
+ *mimeHeaders,
+ attaInfo,
+ attaId);
+ attaInfo = NULL; // ownership transferred
+
+ CleanupStack::PopAndDestroy(); // mimeHeaders
+ CleanupStack::PopAndDestroy(); // attaFile.Close()
+
+ if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
+ {
+ aMmsClient->SetMessageRootL( attaId );
+ }
+ }
+
+ store->CommitL();
+ CleanupStack::PopAndDestroy(); // store
+
+ // This frees all memory and resets all values
+ Reset();
+ // Reset inactivity timer to keem viewServer from crashing
+ User::ResetInactivityTime();
+ }
+
+
+// ---------------------------------------------------------
+// CMmsReadFile()::FindAlias
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::FindAlias( TPtrC aAlias )
+ {
+ TBuf<DefaultBufLen> abuf;
+ for( TInt i=0; i < iAliasCount; ++i )
+ {
+ abuf.Copy( iAliasArray->MdcaPoint(i) );
+ abuf.SetLength( abuf.Locate('=') );
+ if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
+ }
+ return( -1 );
+ }
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsAttaStructure::CMmsAttaStructure()
+ {
+ iAtta = NULL;
+ iAttaType = NULL;
+ iAttaName = NULL;
+ iAttaCid = NULL;
+ iAttaRecommendedName = NULL;
+ }
+
+
+//
+void CMmsAttaStructure::ConstructL()
+ {
+ iAtta = HBufC8::NewL(DefaultBufLen);
+ iAttaType = HBufC8::NewL(DefaultBufLen);
+ iAttaName = HBufC8::NewL(DefaultBufLen);
+ iAttaCid = HBufC8::NewL(DefaultBufLen);
+ iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
+ iAttaCharset = 0;
+ iXTypeParams = new(ELeave) CDesC8ArrayFlat(4);
+ iContentTypeParams = new(ELeave) CDesC8ArrayFlat(4);
+
+ }
+
+// Two-phased constructor.
+CMmsAttaStructure* CMmsAttaStructure::NewL()
+ {
+ CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// Destructor
+CMmsAttaStructure::~CMmsAttaStructure()
+ {
+ delete iAtta;
+ delete iAttaName;
+ delete iAttaType;
+ delete iAttaCid;
+ delete iAttaRecommendedName;
+ if ( iContentTypeParams )
+ {
+ iContentTypeParams->Reset();
+ }
+ delete iContentTypeParams;
+ if ( iXTypeParams )
+ {
+ iXTypeParams->Reset();
+ }
+ delete iXTypeParams;
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/src/mmstestbed.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,2357 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <mtmdef.h>
+#include <CoreApplicationUIsSDKCRKeys.h>
+#include <mmsheaders.h>
+#include <mmscmds.h>
+#include <mmsencode.h>
+#include <mmscliententry.h>
+#include <logwrap.h>
+#include <logcli.h>
+#include <logview.h>
+#include "mmssettings.h" //use mmssettings.h instead of cmmssettings.h
+#include "mmstestbed.h"
+#include "mmsreadfile.h"
+#include "mmstestuitimer.h"
+#include "mmsteststaticutils.h"
+#include "mmstestbed.hrh"
+
+//constants
+_LIT( KMmsSender, "0601234567" );
+
+MmsTestBed::MmsTestBed()
+ {
+ //start the timer
+ iTimer = CTestUiTimer::NewL();
+ iTimer->Cancel();
+
+ iWait = CMsvOperationActiveSchedulerWait::NewLC();
+ // don't leave iWait on cleanup stack
+ CleanupStack::Pop();
+
+ //open msvsession
+ iSession = CMsvSession::OpenSyncL(*this);
+ //create client registry
+ iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
+ //create client mtm
+ iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
+ KUidMsgTypeMultimedia);
+
+ User::LeaveIfError( iFs.Connect() );
+ iFs.SetSessionPath( KRootPath );
+ iSettings = CMmsSettings::NewL();
+ iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
+ findDefaultL();
+ iServiceId = iDefaultServiceId;
+
+ //validate the settings
+ iSettings->ValidateSettings();
+
+ iLogEvent = CLogEvent::NewL();
+ iLogEvent->SetEventType(KLogMmsEventTypeUid);
+ iLogClient = NULL; // we test soon if this is available
+ iLogView = NULL; // needs log client
+ if ( checkLogClient() )
+ {
+ // first we generate a general view of all events
+ // we'll set the filter when we update the view
+ iLogView = CLogViewEvent::NewL( *iLogClient );
+ }
+ iLogFilter = CLogFilter::NewL();
+ // we try to filter MMS events
+ iLogFilter->SetEventType(KLogMmsEventTypeUid);
+ }
+
+MmsTestBed::~MmsTestBed()
+ {
+ delete iLogView;
+ delete iLogFilter;
+ delete iLogClient;
+ delete iLogEvent;
+ delete iSettings;
+ delete iMmsHeaders;
+ if(iTimer)
+ {
+ iTimer->Cancel();
+ delete iTimer;
+ }
+ //delete iMsvEntrySelection;
+ delete iMmsClient;
+ delete iClientMtmRegistry;
+ //delete iClientMtmRegistry;
+ delete iSession;
+ delete iWait;
+ }
+
+void MmsTestBed::setConnectionLocal(bool value)
+ {
+ //value = true for global off, local on
+ //value = false for global on, local off
+ iSettings->LoadSettingsL();
+ iSettings->SetLocalMode( value );
+ iSettings->SaveSettingsL();
+ }
+
+void MmsTestBed::fromOutboxToMmsc()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ // Get List of services
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
+ KUidMsgTypeMultimedia);
+ CleanupStack::PushL(selection);
+
+ // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
+ for (TInt i = 0; i < selection->Count(); ++i)
+ {
+ cEntry->SetEntryL(selection->At(i));
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetReadOnly(EFalse);
+ entry.SetSendingState(KMsvSendStateUnknown);
+ cEntry->ChangeL(entry);
+ }
+
+ selection->InsertL(0, iServiceId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack(parameters);
+
+ op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending)
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if (iWait->iStatus.Int() != KErrNone)
+ {
+ //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+
+void MmsTestBed::fromMmscToInbox()
+ {
+ CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+ CleanupStack::PushL(msvEntrySelection);
+
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ msvEntrySelection->InsertL(0, iServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack(parameters);
+
+ op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
+ paramPack, iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending)
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if (iWait->iStatus.Int() != KErrNone)
+ {
+ //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+ }
+
+void MmsTestBed::findDefaultL()
+ {
+ iSettings->LoadSettingsL();
+ iDefaultServiceId = iSettings->Service();
+ }
+
+void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+ TAny* aArg2, TAny* /*aArg3*/)
+ {
+ iEvent = aEvent;
+ if (aEvent == EMsvGeneralError)
+ {
+ return;
+ }
+ TMsvId parentId = KMsvNullIndexEntryId;
+ if (aArg2 != NULL)
+ {
+ parentId = *(TMsvId*) aArg2;
+ }
+
+ CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+ TMsvEntry tEntry;
+ TMsvId service;
+ TInt error = KErrNone;
+ error = iSession->GetEntry(selection->At(0), service, tEntry);
+
+ CMsvEntry* cEntry = NULL;
+ switch (aEvent)
+ {
+ case EMsvEntriesCreated:
+ {
+ if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+ {
+ // emit signal for new entry into INBOX
+ emit entryCreatedInInbox(tEntry.Id());
+ }
+ else if (parentId == KMsvDraftEntryIdValue)
+ {
+ // emit signal for new entry into Draft
+ emit entryCreatedInDraft(tEntry.Id());
+ }
+ else if (parentId == iServiceId)
+ {
+ // emit signal for new Entry into SERVICE
+ }
+ else
+ {
+ // do nothing
+ }
+ }
+ break;
+ case EMsvEntriesChanged:
+ {
+ TMsvId id;
+ CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+ if (selection == NULL)
+ {
+ // no selection, cannot handle
+ return;
+ }
+ id = selection->At(0);
+ //DEBUG Entry changed"));
+ if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+ {
+/*
+ cEntry = iSession->GetEntryL( parentId );
+ CleanupStack::PushL( cEntry );
+ TRAPD (error, cEntry->SetEntryL( id ));
+ if ( error != KErrNone )
+ {
+ CleanupStack::PopAndDestroy(); // cEntry
+ return;
+ }
+ TMsvEntry tEntry = cEntry->Entry();
+ if ( tEntry.Visible() )
+ {
+ // generate fake delivery report
+ CMsvStore* store = cEntry->ReadStoreL();
+ CleanupStack::PushL( store );
+ CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
+ CleanupStack::PushL( mmsHeaders );
+ mmsHeaders->RestoreL( *store );
+ iEncodeBuffer->ResizeL( 0 );
+ generateDeliveryReport( mmsHeaders );
+ CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+*/
+ }
+ }
+ break;
+ case EMsvEntriesDeleted:
+ {
+ //emit signal for entry deleted
+ }
+ break;
+ case EMsvEntriesMoved:
+ {
+ if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
+ {
+ // entry moved to outbox
+ emit entryMovedToOutbox(tEntry.Id());
+ }
+ else if (parentId == KMsvSentEntryIdValue)
+ {
+ // entry moved to sent folder
+ emit entryMovedToSent(tEntry.Id());
+ }
+ else
+ {
+ // do nothing
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+void MmsTestBed::createMmsService()
+ {
+ CMmsSettings * settings = CMmsSettings::NewL();
+ CleanupStack::PushL( settings );
+ settings->CreateNewServiceL( *iSession );
+ CleanupStack::PopAndDestroy(); // settings
+ return;
+ }
+
+void MmsTestBed::cleanup()
+ {
+ TMsvId entryToBeKilled;
+ // Get access to root index
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+
+ entryToBeKilled = iSettings->Service();
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ while (entryToBeKilled != KMsvNullIndexEntryId)
+ {
+ // delete child of root entry
+ deleteEntry(entryToBeKilled, *cEntry);
+ entryToBeKilled = iSettings->Service();
+ }
+
+ CleanupStack::PopAndDestroy(); // cEntry
+ // We deleted everything!
+ iDefaultServiceId = KMsvNullIndexEntryId;
+ iServiceId = KMsvNullIndexEntryId;
+ }
+
+void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
+ {
+ aClientEntry.DeleteL(aEntryId);
+ }
+
+void MmsTestBed::cleanupAndCreateNewService()
+ {
+ cleanup();
+ // all old service entries have been destroyed, create a new one
+ createMmsService();
+ }
+
+void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
+ {
+ // update settings in mmsclient
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+
+ RFileReadStream readStream;
+ readStream.PushL();
+// TMsvId id = KMsvNullIndexEntryId;
+ CBufFlat* encodeBuffer = NULL;
+ CMmsEncode* encoder = NULL;
+
+ // Open the file
+ TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
+ if (err != KErrNone) User::Leave( err );
+
+ TInt retCode = 0;
+ CMmsReadFile* readFile = NULL;
+ readFile = CMmsReadFile::NewL( iFs, readStream );
+ CleanupStack::PushL( readFile );
+
+ TInt messageCounter = 0;
+ CMsvEntry* cEntry = NULL;
+
+ while(!retCode)
+ {
+ // READ MESSAGE TO BUFFERS
+ iMmsHeaders->Reset(iSettings);
+ // put in some message type just for fun (testing...)
+ iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
+ retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
+ if(readFile->iMessageType == ETestNewMessage)
+ {
+ // CREATE MESSAGE ENTRY
+ switch ( aCommand )
+ {
+ case ECreateToInbox:
+ case ECreateNotification:
+ cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ break;
+ case ECreateToSentItems:
+ cEntry = iSession->GetEntryL(KMsvSentEntryId);
+ break;
+ case ECreateToDrafts:
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ break;
+ case ECreateHeadersFromFile:
+ // here we just encode headers, no message entry
+ // the entry is fake.
+ break;
+ case ECreateMMBoxViewConf:
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ // entry is not created for the description items
+ // they become attachments
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ }
+ break;
+ default:
+ cEntry = iSession->GetEntryL(aBox);
+ break;
+ }
+
+ // if we are just playing with headers we have no entry
+ if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
+ {
+ CleanupStack::PushL(cEntry);
+ iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+ // CREATE MESSAGE
+ iMmsClient->CreateMessageL(iServiceId);
+ }
+ else if ( aCommand == ECreateMMBoxViewConf )
+ {
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ CleanupStack::PushL(cEntry);
+ iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+ // CREATE MESSAGE
+ iMmsClient->CreateMessageL(iServiceId);
+ }
+ else
+ {
+ encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+ CleanupStack::PushL( encodeBuffer );
+ encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+
+ // encode headers to a binary file
+ encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+ iFilename = KMmsMMBoxDescriptionDirectory;
+ TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+ CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+ encodeBuffer = NULL;
+ encoder = NULL;
+ }
+ }
+ else
+ {
+ encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+ CleanupStack::PushL( encodeBuffer );
+ encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+
+ // encode headers to a binary file
+ encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+ iFilename = KMmsDumpDirectory;
+ TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+ CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+ encodeBuffer = NULL;
+ encoder = NULL;
+ }
+ }
+
+ if ( aCommand != ECreateHeadersFromFile &&
+ ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
+ {
+ if(readFile->iMessageType == ETestSettings)
+ {
+ TMsvId ServiceId = iMmsClient->DefaultServiceL();
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+ }
+
+ TMemoryInfoV1Buf memory;
+ UserHal::MemoryInfo( memory );
+ TInt available = memory().iFreeRamInBytes;
+// TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
+
+ TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
+
+ available = memory().iFreeRamInBytes;
+// TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
+
+ if(readFile->iMessageType == ETestNewMessage)
+ {
+ TMsvEntry tEntry = iMmsClient->Entry().Entry();
+ TMsvId id = tEntry.Id();
+ if ( err == KErrNone )
+ {
+ // SAVE MESSAGE
+ iMmsClient->SaveMessageL();
+
+ // If we are creating a MMBox View confirmation,
+ // we add all binary files from KMmsMMBoxDirectory
+ // as attachments.
+
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ addMMBoxDescriptions();
+ }
+
+ // reload the entry in case mms client put something into it
+ // MESSAGE MUST BE SET VISIBLE
+ tEntry = iMmsClient->Entry().Entry();
+ if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
+ {
+ tEntry.iMtmData1 |= KMmsMessageAdvertisement;
+ }
+ else if ( iMmsClient->MessageClass() == EMmsClassInformational )
+ {
+ tEntry.iMtmData1 |= KMmsMessageInformational;
+ }
+ tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
+
+ // Test: Set all as editor oriented - except notifications!
+ if ( aCommand == ECreateNotification )
+ {
+ tEntry.iMtm = KUidMsgMMSNotification;
+ }
+ else
+ {
+ tEntry.iMtmData1 |= KMmsMessageEditorOriented;
+ }
+ if ( aCommand == ECreateToInbox )
+ {
+ tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
+ tEntry.SetReadOnly( ETrue );
+ tEntry.SetNew( ETrue );
+ tEntry.SetUnread( ETrue );
+ }
+ else if ( aCommand == ECreateToSentItems )
+ {
+ tEntry.SetReadOnly( ETrue );
+ }
+ tEntry.SetVisible( ETrue );
+ tEntry.SetInPreparation( EFalse );
+ TTime now;
+ now.UniversalTime();
+ tEntry.iDate = now;
+ TMsvId entryId = tEntry.Id();
+ iMmsClient->Entry().ChangeL( tEntry );
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ // Encode to the directory that is used to fetch MMBox view
+ iFilename.Copy( KMmsMMBoxDirectory );
+ encodeMessageFromDrafts();
+ cEntry->SetEntryL( KMsvDraftEntryId );
+ cEntry->DeleteL( entryId );
+ }
+ }
+ else
+ {
+ //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
+ iSession->RemoveEntry(id);
+ err = KErrNone; // clear error
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ cEntry = NULL;
+ }
+ if(readFile->iMessageType == ETestSettings)
+ {
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); //readFile
+
+ readStream.Close();
+ readStream.Pop();
+
+ /*
+ iMmsClient->SwitchCurrentEntryL(id);
+ */
+ }
+
+void MmsTestBed::addMMBoxDescriptions()
+ {
+ // add the contents of KMmsMMBoxDescriptionDirectory as attachments
+ CDir* fileList = NULL;
+ TInt i = 0; // general counter
+ TInt error = KErrNone;
+ iCurrentPath = KMmsMMBoxDescriptionDirectory;
+
+ iFs.SetSessionPath(iCurrentPath);
+
+ TFindFile finder( iFs );
+ error = finder.FindWildByPath( KWild, NULL, fileList );
+ CleanupStack::PushL( fileList );
+ TInt fileCounter = 0;
+
+ if ( error == KErrNone )
+ {
+ fileCounter = fileList->Count();
+ }
+
+ TEntry entry;
+
+ if ( error == KErrNone )
+ {
+ for ( i = 0; i < fileCounter; ++i )
+ {
+ // Reset inactivity timer to keep viewServer from crashing
+ User::ResetInactivityTime();
+ entry = (*fileList)[i]; // name is entry.iName
+ iFilename.Copy( iCurrentPath );
+ iFilename.Append( entry.iName );
+ TPtrC ptr;
+ ptr.Set( iFilename );
+ iWait->iStatus = KErrNone;
+ iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
+
+ iWait->Start();
+ // The descriptions are cleared after being used
+ iFs.Delete( ptr);
+ }
+ }
+
+ iMmsClient->SaveMessageL(); // just in case somthing must be updated
+ CleanupStack::PopAndDestroy(); // fileList
+ fileList = NULL;
+ }
+
+void MmsTestBed::encodeMessageFromDrafts()
+ {
+ CMmsEncode* encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+ // encode a message iMmsClientPoints to
+ iMmsClient->LoadMessageL();
+ CMsvStore* store = iMmsClient->Entry().ReadStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->RestoreL( *store );
+ CleanupStack::PopAndDestroy(); // store
+ store = NULL;
+ iWait->iStatus = KErrNone;
+
+// caller sets the directory
+// iFilename = KMmsMessageDumpDirectory;
+
+ CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
+ CleanupStack::PushL( entryWrapper );
+ iEncodeBuffer->ResizeL(0);
+ encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
+ iWait->Start();
+ if ( iWait->iStatus == KErrNone )
+ {
+ TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
+ }
+ iEncodeBuffer->ResizeL(0);
+ CleanupStack::PopAndDestroy(); // entryWrapper
+ CleanupStack::PopAndDestroy(); // encoder
+ }
+
+void MmsTestBed::deleteNotifications()
+ {
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+
+ CMsvEntry* cEntry = NULL;
+ // delete all messages from the specified box
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+
+ if ( mmsFolderId != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL(mmsFolderId);
+
+ // show invisible entries
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL(msvEntrySelection);
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ if (msvEntrySelection->Count() > 0)
+ {
+ CMsvOperation* op = iSession->TransferCommandL(
+ *msvEntrySelection,
+ EMmsDeleteEntries,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ // These cannot be deleted unless we have the a server mtm
+ // corresponding to this mtm type.
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+ msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
+ CleanupStack::PushL(msvEntrySelection);
+
+ if (msvEntrySelection->Count() > 0)
+ {
+ CMsvOperation* op = iSession->TransferCommandL(
+ *msvEntrySelection,
+ EMmsDeleteEntries,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ }
+
+TMsvId MmsTestBed::findMMSFolder()
+ {
+ return iSettings->NotificationFolder();
+ }
+
+void MmsTestBed::restoreFactorySettings()
+ {
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+ // do not reset access point
+ TInt accessPoint = iSettings->AccessPoint( 0 );
+ iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
+ TInt count = iSettings->AccessPointCount();
+ TInt i = 0;
+ for ( i = count - 1; i >= 0; --i )
+ {
+ iSettings->DeleteAccessPointL( i );
+ }
+ // restore the original access point
+ if ( accessPoint > 0 )
+ {
+ // a negative access point is an error (most likely "KErrNotFound")
+ iSettings->AddAccessPointL( accessPoint, 0 );
+ }
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+
+void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
+ {
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+
+ iSettings->SetReceivingModeHome( aState );
+
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+
+void MmsTestBed::sendFromFile()
+ {
+ CMsvOperation * op = NULL;
+
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ CleanupStack::PushL( cEntry );
+
+ CMsvEntrySelection* selection = NULL;
+ selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy(); // cEntry
+ CleanupStack::PushL( selection );
+
+ TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
+ if ( error != KErrNone )
+ {
+ CleanupStack::PopAndDestroy(); // selection
+ delete op;
+ return;
+ }
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(2); // op, selection
+ }
+
+void MmsTestBed::sendOneByOne()
+ {
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ CleanupStack::PushL( cEntry );
+
+ CMsvEntrySelection* selection = NULL;
+ selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL( selection );
+
+ CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( shortSelection );
+
+ TInt i;
+
+ for ( i = 0; i < selection->Count(); ++i )
+ {
+ shortSelection->Reset();
+ shortSelection->AppendL( selection->At( i ) );
+
+ CMsvOperation * op = NULL;
+
+ TTime now;
+ now.UniversalTime();
+
+ TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
+ if ( error != KErrNone )
+ {
+ delete op;
+ CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+ return;
+ }
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+
+ }
+ CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+ }
+
+void MmsTestBed::sendNotifications()
+ {
+ // Only send one notification!!
+
+ TInt error = KErrNone;
+
+ if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
+ {
+ //Not a file
+ return;
+ }
+ TMsvId mmsFolder = findMMSFolder();
+
+ TEntry entry;
+
+
+ // now I think we have a filename
+ TEntry orgEntry;
+ TUint size = 0;
+ error = iFs.Entry( iCurrentFile, orgEntry );
+ size = orgEntry.iSize;
+
+ //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
+ if ( size == 0 )
+ {
+ //empty file
+ //TMmsLogger::Log(_L("- empty file"));
+ return;
+ }
+
+ if ( iEncodeBuffer == NULL )
+ {
+ iEncodeBuffer = CBufFlat::NewL( size );
+ }
+ else
+ {
+ iEncodeBuffer->ResizeL( 0 );
+ iEncodeBuffer->ResizeL( size );
+ }
+
+ RFile inFile;
+ error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
+ TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+ if ( error == KErrNone )
+ {
+ error = inFile.Read( ptr, size );
+ inFile.Close();
+ }
+ else
+ {
+ //Error
+ //TMmsLogger::Log(_L("- can't read file"));
+ return;
+ }
+
+ TUint8 byte;
+ TUint position = 0;
+ TUint32 uintvar = 0;
+
+ if ( size > 2 )
+ {
+ iEncodeBuffer->Read( 1, &byte, 1 );
+ if ( byte == 6 ) // PUSH PDU
+ {
+ // try to find out length of header
+ position = 2;
+ iEncodeBuffer->Read( position, &byte, 1);
+
+ while ( byte & 0x80 && position < size )
+ {
+ uintvar += ( byte & 0x7f );
+ uintvar <<= 7;
+ position++;
+ iEncodeBuffer->Read( position, &byte, 1 );
+ }
+
+ // add last byte without shift
+ uintvar += byte;
+ position++;
+ }
+ }
+
+ position += uintvar;
+
+ if ( position < size )
+ {
+ ptr = iEncodeBuffer->Ptr( position );
+ size = ptr.Length();
+ }
+
+ if ( size == 0 )
+ {
+ //no MMS stuff
+ //TMmsLogger::Log(_L("- no MMS stuff"));
+ return;
+ }
+
+ TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+
+ // Now we have streamed our data into this entry.
+ // Now we have an entry that says: local service, MMS MTM
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ if ( entryId != KMsvNullIndexEntryId )
+ {
+ selection->AppendL( entryId );
+ }
+ else
+ {
+ selection->AppendL( iDefaultServiceId );
+ }
+
+ TWatcherParameters parameters; // initialized to zero
+ parameters.iWatcherId = RThread().Id();
+ parameters.iDataPointer = &ptr;
+ TWatcherParametersBuf paramPack( parameters );
+
+ CMsvOperation * op = NULL;
+
+ op = iSession->TransferCommandL(
+ *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ User::After(1000000);
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::copyDrafts()
+ {
+ CMsvEntry* cEntry = NULL;
+// Copies contents of sent folder to drafts for retrying sending.
+
+ cEntry = iSession->GetEntryL(KMsvSentEntryId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages in drafts
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+
+ TMsvLocalOperationProgress progress;
+ cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
+
+ TInt i = 0;
+ for ( i = 0; i < selection->Count(); ++i )
+ {
+ cEntry->SetEntryL( selection->At( i ) );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetReadOnly( EFalse );
+ cEntry->ChangeL( entry );
+ }
+
+ CleanupStack::PopAndDestroy(2); // selection, cEntry
+ }
+
+void MmsTestBed::garbageCollection(TUint32 aReason)
+ {
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+
+ TMMSGarbageCollectionParameters parameters; // initialized to zero
+ parameters.iReasonFlags = aReason;
+ TMMSGarbageCollectionParametersBuf paramPack( parameters );
+ op = iSession->TransferCommandL(
+ *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::messageVariation()
+ {
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+
+ op = iSession->TransferCommandL(
+ *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::cancelSendScheduling()
+ {
+ CMsvEntry* cEntry = NULL;
+ setFetchingState( EMmsReceivingPostpone );
+ testFile( iCurrentFile );
+ scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
+ deleteSendSchedule();
+
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ if (iMsvEntrySelection != NULL)
+ {
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ }
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy();
+ }
+
+void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
+ {
+ CMsvEntry* cEntry = NULL;
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ cEntry = iSession->GetEntryL(aBoxId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+// selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledSend,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::deleteSendSchedule()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsDeleteSchedule,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::cancelFetchScheduling()
+ {
+ TMsvId mmsFolder = findMMSFolder();
+ CMsvEntry* cEntry = NULL;
+ setFetchingState( EMmsReceivingPostpone );
+ testFile( iCurrentFile );
+ fromOutboxToMmsc(); // immediate send (EMmsSend)
+
+ // Wait until notification has arrived - may take a while in global mode
+ TInt i = 0;
+ while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
+ && i < 2000 )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ i++;
+ if ( (i/100) * 100 == i )
+ {
+ //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+ }
+ CActiveScheduler::Start();
+ }
+ iTimer->Cancel();
+
+ fetchForced( 10000 ); // delay to allow cancelling
+ deleteFetchSchedule();
+
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(mmsFolder);
+ if (iMsvEntrySelection != NULL)
+ {
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ }
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
+ {
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledReceiveForced,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::deleteFetchSchedule()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+ cEntry = iSession->GetEntryL( mmsFolderId );
+ CleanupStack::PushL(cEntry);
+ // Get all notifications
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsDeleteSchedule,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::doAFetchCycle()
+ {
+ // Sends a message from iCurrentFile and lets it come back
+ TMsvId mmsFolder = findMMSFolder();
+ testFile( iCurrentFile );
+ fromOutboxToMmsc(); // immediate send (EMmsSend)
+ // fetching will start automatically
+
+ TInt i = 0;
+ while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
+ && i < 2000
+ && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ i++;
+ if ( (i/100) * 100 == i )
+ {
+ //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+ }
+ CActiveScheduler::Start();
+ }
+ iTimer->Cancel();
+ }
+
+bool MmsTestBed::checkLogClient()
+ {
+ if ( iLogClient == NULL )
+ {
+ TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
+ }
+ return ( iLogClient != NULL );
+ }
+
+int MmsTestBed::getLogEntries()
+ {
+ TInt count = 0;
+ if ( !iLogView )
+ {
+ return 0;
+ }
+
+ if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
+ {
+ // should complete with KErrNone
+ iWait->Start();
+ if ( iWait->iStatus.Int() == KErrNone )
+ {
+ count = iLogView->CountL();
+ }
+ }
+ return count;
+ }
+
+void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
+ {
+ CMsvOperation* opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
+ iWait->Start();
+ if (!opert->iStatus.Int()==KErrNone)
+ {
+ // what should we do? panic?
+ }
+
+ TPckgBuf<TMsvLocalOperationProgress> package;
+ package.Copy(opert->ProgressL());
+ *(TMsvId*)&aNewEntry = package().iId;
+
+ delete opert; opert=NULL;
+ }
+
+void MmsTestBed::cleanOutbox()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanInbox()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanSent()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanDrafts()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanAll()
+ {
+ cleanInbox();
+ cleanOutbox();
+ cleanSent();
+ cleanDrafts();
+ TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
+ deleteNotifications();
+ }
+
+void MmsTestBed::reply()
+ {
+ // The first message from inbox is replied to
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::replyToAll()
+ {
+ // The first message from inbox is replied to
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+ KMsvMessagePartRecipient;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::forward()
+ {
+ // The first message from inbox is forwarded
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+ KMsvMessagePartRecipient | KMsvMessagePartAttachments;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ iMmsClient->SwitchCurrentEntryL( newEntry );
+ // Add a sender: 0601234567
+ iMmsClient->LoadMessageL();
+ iMmsClient->SetSenderL( KMmsSender );
+ iMmsClient->SaveMessageL();
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::sendReadReport()
+ {
+ // TURN READ REPORTS ON (until available from menu)
+ iSettings->LoadSettingsL();
+ iSettings->SetReadReplyReportSendingAllowed( ETrue );
+ iSettings->SaveSettingsL();
+ iMmsClient->RestoreSettingsL();
+
+
+ // Read report is sent for the first message in inbox
+ CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+
+ if ( iMsvEntrySelection->Count() == 0 )
+ {
+ return;
+ }
+ TMsvId originalEntry = iMsvEntrySelection->At( 0 );
+
+ // new test using Client MTM
+ CMsvOperation * op = NULL;
+ op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy( op );
+ op = NULL;
+
+ // Try sending the read report to current entry
+
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy( op );
+ op = NULL;
+
+/*
+ cEntry->SetEntryL( originalEntry );
+ iMmsHeaders->Reset();
+ CMsvStore* store = cEntry->ReadStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->RestoreL( *store );
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+ HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
+ CleanupStack::PushL( messageId );
+ messageId->Des().Copy( iMmsHeaders->MessageId() );
+
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ iMmsClient->LoadMessageL();
+
+ iMmsHeaders->Reset();
+ iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
+ // Message id cannot be accessed via MMS Client MTM!
+
+ iMmsHeaders->SetMessageIdL( messageId->Des() );
+ CleanupStack::PopAndDestroy( messageId );
+
+ iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
+ // sender must be insert-address-token because we don't know our number
+ TTime now;
+ now.UniversalTime();
+
+ _LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
+
+ TTime y1970( K1970 );
+ TTimeIntervalMicroSeconds interval;
+ // we can't use "seconds from" as it only returns a
+ // 32 bit signed integer. If fails in 2038.
+ // "microseconds from" returns a 64 bit signed integer
+ interval = now.MicroSecondsFrom( y1970 );
+ // date in iMmsHeaders() in seconds from 1.1.1970.
+ iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
+ iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
+
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = FindMMSFolderL();
+
+ cEntry->SetEntryL( mmsFolderId );
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvMessageEntry;
+ entry.iMtm = KUidMsgTypeMultimedia;
+ entry.SetVisible( ETrue );
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ entry.iRelatedId = iDefaultServiceId;
+ entry.iMtmData1 = KMmsMessageReadRecInd;
+ cEntry->CreateL( entry );
+ TMsvId entryId = entry.Id();
+
+ cEntry->SetEntryL( entryId );
+
+ store = cEntry->EditStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->StoreL( *store );
+ store->CommitL();
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+
+ CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, entryId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy( op );
+ CleanupStack::PopAndDestroy( selection );
+*/
+ CleanupStack::PopAndDestroy( cEntry );
+ }
+
+int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
+ {
+ TInt error = KErrNone;
+ TInt messageCount = 0;
+ TInt failureCount = 0;
+ do {
+ CMsvEntry* cEntry = NULL;
+
+ // Get List of services
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ failureCount++;
+ // These are failures that fail in Message server.
+ if ( failureCount >= 63 && failureCount <= 64 )
+ {
+ failureCount = 65;
+ }
+ cEntry->SetEntryL( iServiceId );
+ TMsvEntry entry = cEntry->Entry();
+ entry.iMtmData3 &= 0x0000000FF;
+ entry.iMtmData3 |= failureCount << 8;
+ cEntry->ChangeL( entry );
+
+ selection->InsertL(0, iServiceId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
+
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ error = iWait->iStatus.Int();
+ if ( iWait->iStatus.Int() != KErrNoMemory )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // op
+ }
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // selection
+ CleanupStack::PopAndDestroy(); // cEntry
+ selection = NULL;
+ cEntry = NULL;
+ cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
+ CleanupStack::PushL(cEntry);
+ selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ messageCount = selection->Count();
+ delete selection;
+ selection = 0;
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ while ( error == KErrNoMemory || messageCount > 0 );
+ return failureCount;
+ }
+
+int MmsTestBed::fromMmscToInboxWithMemoryFailure()
+ {
+ TInt error = KErrNone;
+ TInt failureCount = 0;
+ TInt messageCount = 0;
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+
+ do {
+ // Inbox must be cleaned if failure makes message to be fetched more than once.
+ // should not happen, but this test is quite stressful, and perfect result
+ // cannot be guaranteed.
+ // What is expected:
+ // 1. Program does not crash
+ // 2. After sufficient number of retries the message is fetched and notification deleted.
+ TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+ CMsvEntry* cEntry = NULL;
+ CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+ CleanupStack::PushL(msvEntrySelection);
+
+ cEntry = iSession->GetEntryL(iServiceId);
+ CleanupStack::PushL(cEntry);
+
+ failureCount++;
+ // These are failures that fail in Message server.
+ if ( failureCount >= 63 && failureCount <= 64 )
+ {
+ failureCount = 65;
+ }
+ cEntry->SetEntryL( iServiceId );
+
+ TMsvEntry entry = cEntry->Entry();
+ entry.iMtmData3 &= 0x0000000FF;
+ entry.iMtmData3 |= failureCount << 8;
+ cEntry->ChangeL( entry );
+
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ msvEntrySelection->InsertL(0, iServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsReceiveForced,
+ *msvEntrySelection,
+ paramPack,
+ iWait->iStatus) );
+
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ error = iWait->iStatus.Int();
+ if ( iWait->iStatus.Int() != KErrNoMemory )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // msvEntrySelection
+ CleanupStack::PopAndDestroy(); // cEntry
+ msvEntrySelection = NULL;
+ cEntry = NULL;
+ cEntry = iSession->GetEntryL( mmsFolderId );
+ CleanupStack::PushL(cEntry);
+ msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ messageCount = msvEntrySelection->Count();
+ delete msvEntrySelection;
+ msvEntrySelection = 0;
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ while ( error == KErrNoMemory || messageCount > 0 );
+ if ( error != KErrNoMemory && error != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
+ }
+ return failureCount;
+ }
+
+void MmsTestBed::sendViaClient()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages in drafts
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+
+ CMsvOperation * op = NULL;
+ TTime now;
+ now.UniversalTime();
+ op = iMmsClient->SendL( *selection, iWait->iStatus, now );
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
+ {
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledReceive,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::fetchForcedImmediate()
+ {
+ TCommandParameters parameters;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsReceiveForced,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::getEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+
+ CLogEventType* eventType = CLogEventType::NewL();
+ CleanupStack::PushL( eventType );
+ eventType->SetUid(iLogEvent->EventType());
+ iLogClient->GetEventType( *eventType, iWait->iStatus );
+
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // eventType
+ }
+
+void MmsTestBed::addEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+
+ CLogEventType* eventType = CLogEventType::NewL();
+ CleanupStack::PushL( eventType );
+ eventType->SetUid(iLogEvent->EventType());
+ eventType->SetDescription(_L("Multimedia Message") );
+ eventType->SetLoggingEnabled( ETrue );
+
+// iWait->iStatus = KRequestPending;
+ iLogClient->AddEventType( *eventType, iWait->iStatus );
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // eventType
+ }
+
+void MmsTestBed::deleteEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+// iWait->iStatus = KRequestPending;
+ iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
+ iWait->Start();
+ }
+
+void MmsTestBed::cleanLog()
+ {
+ TInt count = 0;
+
+ count = getLogEntries();
+
+ TInt i;
+ for ( i = 0; i < count; ++i )
+ {
+ // when a view is created, it will be positioned on the first event
+// iWait->iStatus = KRequestPending;
+ iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
+ iWait->Start();
+
+ if ( iLogView->NextL( iWait->iStatus ) )
+ {
+ // should complete with KErrNone
+ iWait->Start();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ // could not get next event!
+ break;
+ }
+ }
+ else
+ {
+ break; // no more events!
+ }
+ }
+ }
+
+void MmsTestBed::setOnline(bool value)
+ {
+ //value = true for online mode
+ //value = false for offline mode
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
+ if( retval == KErrNone )
+ {
+ repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
+ delete repository;
+ }
+ }
+
+void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
+ {
+ iEncodeBuffer->ResizeL( 1024 );
+
+ TInt position = 0;
+
+ // encode message type
+ iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
+ position++;
+
+ // version
+ iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
+ position++;
+
+ TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
+ iEncodeBuffer->Write( position, &version, 1 );
+ position++;
+
+ // message id from the headers
+ // At least once MMSC did not send us the message id!
+ // if message id is missing, we cannot match the entry!
+ // This only a fake. Real delivery reports should always
+ // contain the message id.
+ if ( aMmsHeaders->MessageId().Length() > 0 )
+ {
+ iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
+ position += aMmsHeaders->MessageId().Length();
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+ }
+
+ // To is taken from the headers
+ iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
+ position++;
+
+ TPtrC recipient;
+ if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->ToRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->ToRecipients()[0] );
+ }
+ else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->CcRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->CcRecipients()[0] );
+ }
+ else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->BccRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->BccRecipients()[0] );
+ }
+ else
+ {
+ recipient.Set( _L("Jasso-Kissa@jii.fi") );
+ }
+
+ TMmsAddressType addressType = EMmsAddressTypeUnknown;
+
+ if ( recipient.Find( KMiuMau ) != KErrNotFound )
+ {
+ addressType = EMmsAddressTypeEmail;
+ }
+ else
+ {
+ addressType = EMmsAddressTypeMobile;
+ }
+
+ TUint8 character;
+ TInt i;
+ if ( addressType == EMmsAddressTypeEmail )
+ {
+ // email address - ASCII ONLY - THIS IS JUST A TEST!
+
+ for ( i = 0; i < recipient.Length(); ++i )
+ {
+ character = TUint8( recipient[i] & 0xff );
+ iEncodeBuffer->Write( position, &character, 1 );
+ position++;
+ }
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+
+ }
+ else
+ {
+ // must be a phone number
+ // We expect for now that the format is correct as is
+ // All legal characters present in a phone number are ASCII
+
+ TInt i;
+ for ( i = 0; i < recipient.Length(); ++i )
+ {
+ character = TUint8( recipient[i] & 0xff );
+ iEncodeBuffer->Write( position, &character, 1 );
+ position++;
+ }
+ iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
+ position += KMmsPlmnLength;
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+ }
+
+ // date
+ iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
+ position++;
+
+ TLocale locale;
+ locale.Refresh();
+ TInt64 UtcDate;
+ TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
+
+ TTime now;
+ now.UniversalTime();
+ UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
+
+ UtcDate -= universalTimeOffset.Int();
+
+ if ( locale.QueryHomeHasDaylightSavingOn() )
+ {
+ TTimeIntervalSeconds daylightSaving( 60 * 60 );
+ UtcDate -= daylightSaving.Int();
+ }
+
+ TUint8 len; // number of bytes we will need
+ len = 0;
+ TUint8 array[8];
+
+ TInt64 temp = UtcDate;
+
+ for (i = 7; i >= 0; --i)
+ {
+ array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
+ I64LSR( temp, 8 );
+ }
+
+ len = 8;
+ i = 0;
+ while( ( array[i]== 0 ) && ( i < 8 ) )
+ {
+ i++;
+ len--;
+ }
+
+ // a zero should be coded as short integer.
+ // However, if there is a valid reason to code a zero as a long integer,
+ // we allow it. The caller should know what he is doing.
+ if ( len == 0 )
+ {
+ len = 1;
+ }
+ // write short length
+ iEncodeBuffer->Write( position, &len, 1 );
+ position++;
+ // write as many bytes as were non-zero
+ iEncodeBuffer->Write( position, &(array[8 - len] ), len );
+ position+= len;
+ // status
+ iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
+ position++;
+ // DONE!!!
+ iEncodeBuffer->ResizeL( position );
+ return;
+ }
+
+void MmsTestBed::sendDeliveryReport()
+ {
+ if ( iEncodeBuffer->Size() == 0 )
+ {
+ //No delivery report
+ return;
+ }
+
+
+ TMsvId mmsFolder = findMMSFolder();
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+
+ TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+ TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+
+ // Now we have streamed our data into this entry.
+ // Now we have an entry that says: local service, MMS MTM
+
+ if ( entryId != KMsvNullIndexEntryId )
+ {
+ selection->AppendL( entryId );
+ }
+ else
+ {
+ selection->AppendL( iDefaultServiceId );
+ }
+
+ TWatcherParameters parameters; // initialized to zero
+ parameters.iWatcherId = RThread().Id();
+ parameters.iDataPointer = &ptr;
+ TWatcherParametersBuf paramPack( parameters );
+
+ CMsvOperation * op = NULL;
+
+// iWait->iStatus = KRequestPending;
+ op = iSession->TransferCommandL(
+ *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/src/mmsteststaticutils.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,528 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <f32file.h>
+#include <centralrepository.h>
+#include <apparc.h>
+#include <msvapi.h>
+#include <msvids.h>
+
+#include "mmsteststaticutils.h"
+#include "mmsconst.h"
+#include "MmsEnginePrivateCRKeys.h"
+#include "mmssettings.h"
+#include "mmsheaders.h"
+#include "mmsservercommon.h"
+#include "mmsencode.h"
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
+: iArray1(aArray1), iArray2(aArray2)
+ {
+ }
+
+TInt TMmsJoinedArrays::MdcaCount() const
+ {
+ TInt count=0;
+ if (iArray1)
+ count += iArray1->MdcaCount();
+ if (iArray2)
+ count += iArray2->MdcaCount();
+ return count;
+ }
+
+TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
+ {
+ if (iArray1)
+ {
+ if (aIndex < iArray1->MdcaCount())
+ return iArray1->MdcaPoint(aIndex);
+ else
+ aIndex -= iArray1->MdcaCount();
+ }
+ return iArray2->MdcaPoint(aIndex);
+ }
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsTestUtils::TMmsTestUtils()
+ {
+
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
+ {
+ RFile file;
+ TInt error = KErrNone;
+
+ TInt textBufferSize = 256;
+ HBufC* textBuffer = HBufC::NewL( textBufferSize );
+ TPtr textPtr = textBuffer->Des();
+ TFileText textFile;
+
+ error = file.Open( aFs, aFileName,
+ EFileRead|EFileShareReadersOnly );
+
+ if ( error == KErrNone )
+ {
+ textFile.Set( file );
+ error = textFile.Seek( ESeekStart );
+ }
+
+ if ( error == KErrNone )
+ {
+ error = textFile.Read( textPtr );
+ }
+
+ file.Close();
+
+ if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
+ {
+ textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
+ }
+
+ return textBuffer;
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOnL()
+ {
+ // CenRep for decodelogging
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 1;
+ repository->Set( KMmsEngineDecodeLog, temp );
+ delete repository;
+ }
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOffL()
+ {
+ // CenRep for decodelogging
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 0;
+ repository->Set( KMmsEngineDecodeLog, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOnL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 1;
+ repository->Set( KMmsEngineBinaryDump, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOffL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 0;
+ repository->Set( KMmsEngineBinaryDump, temp );
+ delete repository;
+ }
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
+ {
+ // Delete the files in the directory
+ CFileMan* fileMan = CFileMan::NewL( aFs );
+ CleanupStack::PushL( fileMan );
+ fileMan->RmDir( KMmsDefaultLocalModeDir );
+ fileMan->RmDir( KMmsMMBoxDirectory );
+ fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
+ CleanupStack::PopAndDestroy(); // fileManager
+ // we don't want to throw these away!
+ aFs.MkDirAll( KMmsDefaultLocalModeDir );
+ aFs.MkDirAll( KMmsMMBoxDirectory );
+ aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
+ {
+ TInt error = KErrNone;
+ aFs.MkDirAll( aFilename );
+ TUint att;
+ if ( aFs.Att( aFilename, att ) == KErrNone )
+ {
+ _LIT( KRelated, "dump.mms");
+ aParse.Set( aFilename, &KRelated, NULL );
+ aFilename = aParse.FullName();
+ error = CApaApplication::GenerateFileName( aFs, aFilename );
+ if ( error == KErrNone )
+ {
+ RFile file;
+ error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
+ // for message id generation
+ aParse.Set( aFilename, NULL, NULL );
+ if ( error == KErrNone )
+ {
+ // the data is supposed to be in the encode buffer
+ TPtr8 ptr = aBuffer.Ptr( 0 );
+ file.Write( ptr );
+ file.Flush();
+ }
+
+ // done - close files
+ file.Close();
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
+ {
+ CMsvEntry* cEntry = NULL;
+ // delete all messages from the specified box
+ cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(aBoxId);
+ // show invisible entries
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL(msvEntrySelection);
+
+ CMsvEntrySelection* selection = NULL;
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
+ CleanupStack::PushL( selection );
+ if ( selection->Count() > 0 )
+ {
+ msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
+ }
+ CleanupStack::PopAndDestroy(); // selection
+
+ int i;
+ for (i = 0; i < msvEntrySelection->Count(); ++i)
+ {
+ CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
+ CleanupStack::PushL( entry );
+ TMsvEntry tEntry = entry->Entry();
+ tEntry.SetReadOnly(EFalse);
+ entry->ChangeL(tEntry);
+ cEntry->DeleteL( msvEntrySelection->At(i) );
+ CleanupStack::PopAndDestroy( entry );
+ }
+
+ CleanupStack::PopAndDestroy(msvEntrySelection);
+ CleanupStack::PopAndDestroy(cEntry);
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOnL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+ if( retval == KErrNone )
+ {
+ TInt temp = 1;
+ repository->Set( KMmsEngineLogEmailRecipients, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOffL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+ if( retval == KErrNone )
+ {
+ TInt temp = 0;
+ repository->Set( KMmsEngineLogEmailRecipients, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
+ {
+ CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(aBoxId);
+ if (aMsvEntrySelection != NULL)
+ {
+ delete aMsvEntrySelection;
+ aMsvEntrySelection = NULL;
+ }
+ aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
+ CleanupStack::PopAndDestroy(); // cEntry
+ return aMsvEntrySelection->Count();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CreateFolderEntryL
+//
+// -----------------------------------------------------------------------------
+//
+void TMmsTestUtils::CreateFolderEntryL(
+ CMsvSession& aSession,
+ TMsvId aParentFolder,
+ const TDesC& aFolderName,
+ TMsvId& aFolderId )
+ {
+ aFolderId = KMsvNullIndexEntryId;
+ CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
+ CleanupStack::PushL( cEntry );
+
+ // Create a new folder.
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvFolderEntry;
+ entry.iMtm = KUidMsvLocalServiceMtm;
+ entry.iDetails.Set( aFolderName );
+ entry.SetVisible( EFalse );
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ cEntry->CreateL( entry );
+ aFolderId = entry.Id();
+ CleanupStack::PopAndDestroy( cEntry );
+
+ }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TMsvId TMmsTestUtils::CreateNotificationEntryL(
+ TMsvId aNotificationFolder,
+ TMsvId aServiceId,
+ CBufFlat* aEncodeBuffer,
+ CMsvSession& aSession )
+ {
+ TMsvId entryId = KMsvNullIndexEntryId;
+ if ( aNotificationFolder == KMsvNullIndexEntryId )
+ {
+ // no folder no entry
+ return entryId;
+ }
+
+ CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
+ CleanupStack::PushL(cEntry);
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvMessageEntry;
+ entry.iMtm = KUidMsgTypeMultimedia;
+ entry.SetVisible( ETrue );
+ // If we want to put data here, InPreparation must be set to true first
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ entry.iRelatedId = aServiceId;
+ entry.iMtmData2 = KMmsNotificationBinary;
+ cEntry->CreateL( entry );
+ entryId = entry.Id();
+
+ //
+ // Stream
+ // 1) length of the data as 32 bit integer
+ // 2) pushed message data
+ // into created entry's stream
+ //
+ cEntry->SetEntryL( entryId );
+ CMsvStore* store = cEntry->EditStoreL();
+ CleanupStack::PushL( store ); // ***
+ RMsvWriteStream outs;
+ outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
+ TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
+ outs.WriteUint32L( ptr.Length() );
+ outs.WriteL( ptr );
+ outs.CommitL();
+ outs.Close();
+ store->CommitL();
+
+ CleanupStack::PopAndDestroy( &outs ); // close outs
+ CleanupStack::PopAndDestroy( store );
+ CleanupStack::PopAndDestroy( cEntry );
+
+ return entryId;
+
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::FormNotification(
+ TDesC8& aUrl,
+ TInt aSize,
+ CMmsHeaders& aMmsHeaders,
+ CMmsEncode& aMmsEncoder,
+ CBufFlat* aEncodeBuffer )
+ {
+ // for test purposes aUrl will contain the filename.
+
+ // Reset sets the default encapsulation version
+ // The default version has been set from MmsSettings in NewL
+ aMmsHeaders.Reset();
+
+ // construct the notification into iMmsHeaders, and call encode
+
+ aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
+
+ TTime currentTime;
+ currentTime.UniversalTime();
+ currentTime.Int64();
+
+ TPtrC8 tid;
+ TBufC8<KMMSMAXTIDLENGTH> target;
+ TInt random = 0;
+
+ // we don't generate a true random TID: We generate the
+ // TID from the URL so that if we generate a notification
+ // twice from the same file, we get the same TID and the
+ // same URL. This way we can test the pruning function in
+ // server MTM
+
+ TInt i;
+ for ( i = 0; i < aUrl.Length(); ++i )
+ {
+ random += aUrl[ i ];
+ }
+
+ target.Des().Num( random );
+ tid.Set( target.Des() );
+ aMmsHeaders.SetTidL( tid );
+
+ aMmsHeaders.SetMessageClass( EMmsClassPersonal );
+ aMmsHeaders.SetMessageSize( aSize );
+ const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
+ aMmsHeaders.SetExpiryInterval( KTenHours );
+ aMmsHeaders.SetContentLocationL( aUrl );
+
+ aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
+
+ }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
+ {
+ //Is the name a file?
+ if (IsDrive(aFileName))
+ return EFalse;
+ return !(IsDir(aFileName, aFs));
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
+ {
+ //Is the name a directory?
+ TEntry entry;
+ TInt err = aFs.Entry(aFileName, entry);
+ if (err)
+ return EFalse;
+ else
+ return entry.IsDir();
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
+ {
+ //horrible little function to figure if the path is just a drive
+ TBool retVal = EFalse;
+ if (aFileName.Length()==3) //eg "c:\"
+ {
+ if ((aFileName[1] == ':') && (aFileName[2] == '\\'))
+ retVal=ETrue;
+ }
+ else if (aFileName.Length()==2) //eg "c:"
+ {
+ if (aFileName[1] == ':')
+ retVal=ETrue;
+ }
+ return retVal;
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/src/mmstestuitimer.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include "mmstestuitimer.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::CTestUiTimer(): CTimer( 5 )
+ {
+ period = KPeriod;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer* CTestUiTimer::NewL()
+ {
+ CTestUiTimer* self = new(ELeave) CTestUiTimer();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::~CTestUiTimer()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::IssueRequest()
+ {
+ // No operation to cancel if this function is called
+ iObject = NULL;
+ After(period);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
+ {
+ iObject = aObject;
+ TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
+ After( timeout );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::DoCancel()
+ {
+ CTimer::DoCancel();
+ if ( iObject )
+ {
+ iObject->Cancel();
+ iObject = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::RunL()
+ {
+ if ( iObject )
+ {
+ // If we timeout while holding an active object, we cancel it
+ iObject->Cancel();
+ iObject = NULL;
+ }
+ else
+ {
+ CActiveScheduler::Stop();
+ }
+ }
+
+// ======== GLOBAL FUNCTIONS ========
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/data/TestConvergedMessageUtilsSample.txt Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,1 @@
+MMSTEST Text
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/inc/testconvergedmessageutils.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Main test class declaration for ConvergedMessageUtils
+ */
+
+#ifndef TEST_MMS_PLUGIN_H
+#define TEST_MMS_PLUGIN_H
+
+#ifdef BUILD_TEST_DLL
+#define TEST_EXPORT Q_DECL_EXPORT
+#else
+#define TEST_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <QSignalSpy>
+#include <e32const.h>
+
+//Forward Declarations
+class UniEditorMmsPlugin;
+class ConvergedMessage;
+class MmsTestBed;
+
+//Main Tets Class Declaration
+class TEST_EXPORT TestConvergedMessageUtils: public QObject
+ {
+ Q_OBJECT
+
+private slots:
+
+ /**
+ * Initialises the whole Test
+ **/
+ void initTestCase();//called before the first testfunction is executed.
+
+ /**
+ * Initialises each Test Case
+ **/
+ void init();//called before each testfunction is executed.
+
+ /**
+ * Creates a MMS messsage
+ **/
+ void createMMS();
+
+ /**
+ * Tests the MMS message
+ **/
+ void testMMS();
+
+ /**
+ * Test Methods of ConvergedMessageId which were not part of the tests above
+ **/
+ void testConvergedMessageIdUnusedMethods();
+
+
+ /**
+ * Test Methods of ConvergedMessageAttachment which were not part of the tests above
+ **/
+ void testConvergedMessageAttachmentUnusedMethods();
+
+ /**
+ * Cleans up each Test Case
+ **/
+ void cleanup();//called after every testfunction.
+
+ /**
+ * Cleans up the whole Test Case
+ **/
+ void cleanupTestCase();//called after the last testfunction was executed.
+
+private: //Data
+
+ /**
+ * msgPlugin - MMS Message Plug-in
+ **/
+ UniEditorMmsPlugin* msgPlugin;
+
+ /**
+ * mmstestbed - MMS Message Simulator
+ **/
+ MmsTestBed* mmstestbed;
+
+ /**
+ * spy_draft - Signal Spy for Draft Folder
+ **/
+ QSignalSpy* spy_draft;
+
+ /**
+ * mmsMsgId - The MMS message Id
+ **/
+ long int mmsMsgId;
+ };
+#endif //TEST_MMS_PLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/inc/testconvergedmessageutils.ini Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Input data Set File for TestConvergedMessageUtils test cases
+ */
+
+const char TEST_MSG_BODY[] = "TestTextE_1_2";
+const char TEST_MSG_SUBJECT[] = "Message Subject";
+const char TEST_SENDER[] = "+919860479112";
+const char TEST_ATTACHMENT[] = "c:\\data\\TestConvergedMessageUtilsSample.txt";
+const char TEST_CC[] = "DummyCCAddress";
+const char TEST_BCC[] = "DummyBCCAddress";
+const char TEST_ALIAS[] = "DummySenderAlias";
+
+//out put directory for test results.
+QString OUTPUTDIRECTORY = "c:/logs/TestConvergedMessageUtils";
+//o/p directory for data to be written on temp file.
+QString TEMPDIR = "c:/logs/TestConvergedMessageUtils/testdata";
+//test result O/P file name.
+QString RESULTFILE = "c:/logs/TestConvergedMessageUtils/result_%1.txt";
+// folder named UID3 of msgapptestsuite inside private folder.
+const QString PRIVATE_DIR("C:/private/E39cd515");
+//application class name
+const QString appClassName("TestConvergedMessageUtils");
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/src/testconvergedmessageutils.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,331 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Main test class definition for ConvergedMessageUtils
+ */
+
+#include <QtTest/QtTest>
+#include <QTimer>
+#include <QSignalSpy>
+#include "debugtraces.h"
+#include "testconvergedmessageutils.h"
+#include "convergedmessage.h"
+#include "convergedmessageid.h"
+#include "unieditormmsplugin.h"
+#include "mmstestbed.h"
+#include "testconvergedmessageutils.ini"
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::initTestCase
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::initTestCase()
+{
+ //register user defined object to meta system.
+ qRegisterMetaType<long int> ("long int");
+
+ //Verify MmsTestBed Instance.
+ mmstestbed = new MmsTestBed;
+ QVERIFY(mmstestbed != NULL);
+
+ //Instantiate UniEditorMmsPlugin and verify if it is correctly Instantited.
+ msgPlugin = new UniEditorMmsPlugin;
+ QVERIFY(msgPlugin != NULL);
+
+ //set up signalspy to listen to signals emitted by mmstestbed
+ spy_draft = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInDraft(long int)));
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::init
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::init()
+{
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::createMMS
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::createMMS()
+{
+ //Create a Converged Message instance.
+ QString subject = TEST_MSG_SUBJECT;
+
+ qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
+
+ QString sender(TEST_SENDER);
+ ConvergedMessageAddress address(sender);
+ ConvergedMessageAttachmentList attachmentList;
+
+ //Add a text attachment to attachment list.
+ QString attachmentPath = TEST_ATTACHMENT;
+ ConvergedMessageAttachment* attachment =
+ new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
+
+ attachmentList.append(attachment);
+
+ //Instantiate a Converged Message object and set service a MMS
+ ConvergedMessage msg;
+
+ msg.setMessageType(ConvergedMessage::Mms);
+
+ //Set Subject
+ msg.setSubject(subject);
+
+ //Set Timestamp and verify
+ msg.setTimeStamp(timeStamp);
+ QVERIFY(timeStamp == msg.timeStamp());
+
+ //Set Alias to an address
+ address.setAlias(QString (TEST_ALIAS));
+
+ //Set recipient.
+ msg.addToRecipient(address);
+
+ //Add attachments' list
+ msg.addAttachments(attachmentList);
+ msg.setPriority(ConvergedMessage::Normal);
+
+ //Adding CC Address
+ QString ccAddress(TEST_CC);
+ ConvergedMessageAddress ccAdd(ccAddress);
+ msg.addCcRecipient(ccAdd);
+
+ //Adding BCC Address
+ QString bccAddress(TEST_BCC);
+ ConvergedMessageAddress bccAdd(bccAddress);
+ msg.addBccRecipient(bccAdd);
+
+ //Adding From Address
+ QString recipientAddress(TEST_SENDER);
+ ConvergedMessageAddress recipientAdd(recipientAddress);
+ msg.addFromRecipient(recipientAdd);
+
+ //Set Body Text and verify
+ msg.setBodyText(QString(TEST_MSG_BODY));
+ QVERIFY(msg.bodyText().compare(QString(TEST_MSG_BODY)) == 0);
+
+ //Removing Body Text as MMS messages do not contain Body Text
+ msg.setBodyText(QString(NULL));
+
+ //Set Property and Verify
+ msg.setProperty(ConvergedMessage::Attachment);
+ msg.setProperty(ConvergedMessage::Unread);
+ QVERIFY(msg.properties() == ConvergedMessage::Attachment | ConvergedMessage::Unread);
+ QVERIFY(msg.hasAttachment() == true);
+ QVERIFY(msg.isUnread() == true);
+
+ //Set Location
+ msg.setLocation(ConvergedMessage::Draft);
+
+ //Set Sending State and Verify
+ msg.setSendingState(ConvergedMessage::Waiting);
+ QVERIFY(msg.sendingState() == ConvergedMessage::Waiting);
+
+ //Set Direction
+ msg.setDirection(ConvergedMessage::Outgoing);
+
+ //Set Priority
+ msg.setPriority(ConvergedMessage::Normal);
+
+ //Set Sub Type and verify
+ msg.setMessageSubType(ConvergedMessage::NokiaService);
+ QVERIFY(msg.messageSubType() == ConvergedMessage::NokiaService);
+
+ //Create another Converged Message
+ ConvergedMessage msgCopyFirst(msg);
+ ConvergedMessage msgCopySecond(*(msg.id()));//by Id
+ QCOMPARE(msgCopySecond.id()->getId(), msg.id()->getId());//Verify if the copy was as expected
+
+ //Create a Converged Message with serializing and deserializing and verify
+ QFile file("c:\\test.txt");
+ file.open(QIODevice::WriteOnly);
+ QDataStream out(&file); // Serialize the data into the file
+ msg.serialize(out); // Serialize a string
+ file.close();
+
+ file.open(QIODevice::ReadOnly);
+ QDataStream in(&file); // read the data serialized from the file
+
+ ConvergedMessage msgCopyThird;//Third Copy of the Actual Message
+ msgCopyThird.deserialize(in);
+ file.close();
+
+ //Verify the 3rd Copy with the Original Copy
+ QVERIFY(msgCopyThird.id()->getId() == msg.id()->getId());
+ QCOMPARE(msgCopyThird.subject(), msg.subject());
+ QVERIFY(msgCopyThird.messageType() == msg.messageType());
+
+ //Get a valid MMS message ID and verify that it is valid.
+ mmsMsgId = msgPlugin->convertTo(&msgCopyFirst);
+ QVERIFY(mmsMsgId != -1);
+ QDEBUG_WRITE("MMS Successfully Sent to Dratfs Folder");
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::testMMS
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::testMMS()
+{
+ long int mmsDraftMsgId;
+
+ //check if draft-folder signal was received...this means message was created in draft
+ if( 1 <= spy_draft->count())
+ {
+ //compare the msgid and verify with the ID given by MMS plugin
+ void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
+ mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
+ QVERIFY(mmsDraftMsgId == mmsMsgId);
+
+ //Validate the MMS message with all the values set before.
+ ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
+ QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
+ QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
+ QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_ALIAS).contains(draftMsg->toAddressList()[0]->alias(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(draftMsg->attachments().count() == 1);
+ QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
+ QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT).mid(QString(TEST_ATTACHMENT).indexOf(QString("Sample.txt"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);
+ QVERIFY(draftMsg->location() == ConvergedMessage::Draft);
+ QVERIFY(draftMsg->priority() == ConvergedMessage::Normal);
+ QVERIFY(draftMsg->direction() == ConvergedMessage::Outgoing);
+ QDEBUG_WRITE("MMS Successfully Verified at Drafts Folder");
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to create message in Draft");
+ }
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::testConvergedMessageIdUnusedMethods
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::testConvergedMessageIdUnusedMethods()
+{
+ //Create a copy of ConvergedMessageId object from another object
+ ConvergedMessageId msgId1;
+ msgId1.setId(0x646);
+
+ //Verify if the two objects match
+ ConvergedMessageId msgId3;
+ msgId3 = msgId1;
+ QVERIFY(msgId3 == msgId1);
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::testConvergedMessageAttachmentUnusedMethods
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::testConvergedMessageAttachmentUnusedMethods()
+{
+ //Set Attachment File Path and Type and Verify
+ ConvergedMessageAttachment msgAttachment;
+ msgAttachment.setFilePath(QString(TEST_ATTACHMENT));
+ QCOMPARE(msgAttachment.filePath(), QString(TEST_ATTACHMENT));
+ msgAttachment.setAttachmentType(ConvergedMessageAttachment::EAttachment);
+ QVERIFY(msgAttachment.attachmentType() == ConvergedMessageAttachment::EAttachment);
+
+ //Second Copy with same Contents
+ ConvergedMessageAttachment msgAttachmentCopy;
+ msgAttachmentCopy.setFilePath(QString(TEST_ATTACHMENT));
+ msgAttachmentCopy.setAttachmentType(ConvergedMessageAttachment::EAttachment);
+
+ //Verify if they are same
+ QVERIFY(msgAttachmentCopy == msgAttachment);
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::cleanup
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::cleanup()
+{
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::cleanupTestCase
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::cleanupTestCase()
+{
+ //Cleanup
+ mmstestbed->cleanAll();//Clean All messages from varios Folders
+ delete spy_draft;//Signal for Draft Folder
+ delete msgPlugin;//MMS Plugin
+ delete mmstestbed;//MMS Testbed
+}
+
+//---------------------------------------------------------------
+// getObject
+// factory method to create objects.
+//---------------------------------------------------------------
+QObject* getObject(QString className)
+{
+ if(className == "TestConvergedMessageUtils" )
+ {
+ return new TestConvergedMessageUtils;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+//---------------------------------------------------------------
+// createOutPutDirectory
+// creating o/p directory.
+//---------------------------------------------------------------
+void createOutPutDirectory()
+ {
+ QDir dir;
+ //o/p dir
+ dir.mkdir(OUTPUTDIRECTORY);
+ //tmp dir
+ dir.mkdir(TEMPDIR);
+ // dir inside private folder.
+ dir.mkdir(PRIVATE_DIR);
+ }
+
+//---------------------------------------------------------------
+// main
+// main entry point
+//---------------------------------------------------------------
+int main(int argc, char *argv[])
+ {
+ int ret = -1;
+ QCoreApplication app(argc, argv);
+
+ //creating output directory.
+ createOutPutDirectory();
+
+ QStringList args;
+ QString appName = argv[0];
+ args << appName;
+
+ QString option = "-o";
+ args << option;
+
+ QString outFile = RESULTFILE;
+ outFile = outFile.arg(appClassName);
+ args << outFile;
+
+ QObject* tc = getObject(appClassName);
+
+ if(tc)
+ {
+ ret = QTest::qExec(tc, args);
+ delete tc;
+ }
+ return ret;
+ }
+
+//End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/testconvergedmessageutils.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,134 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Test Case Project Definition for ConvergedMessageUtils
+#
+
+QT += testlib
+QT -= gui
+
+CONFIG += hb
+CONFIG += symbian_test
+CONFIG += qtestlib
+
+TEMPLATE = app
+TARGET = testconvergedmessageutils
+
+INCLUDEPATH += ./inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../mmstestbed/inc
+INCLUDEPATH += ../../../../../../inc
+INCLUDEPATH += ../../../../unidatautils/unidatamodel/inc
+INCLUDEPATH += ../../../../../../../../mw/hb/include/hbcore
+INCLUDEPATH += ../../../../unieditorutils/editorgenutils/inc
+INCLUDEPATH += ../../../../unieditorutils/unieditorplugins/unieditormmsplugin/inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_TEST_DLL
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+SOURCES += \
+ ./src/testconvergedmessageutils.cpp \
+ ../../../../unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp \
+ ../../../../unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp
+
+# Input
+HEADERS += \
+ ./inc/testconvergedmessageutils.h \
+ ../../../../unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin.h \
+ ../../../../unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+ symbian {
+ TARGET.UID3 = 0xE39cd515
+ TARGET.CAPABILITY = All -TCB -DRM
+ TARGET.EPOCSTACKSIZE = 0x8000
+ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+ VENDORID = VID_DEFAULT
+ BLD_INF_RULES.prj_exports += "data/TestConvergedMessageUtilsSample.txt c:/data/TestConvergedMessageUtilsSample.txt"
+ }
+
+LIBS += -leuser \
+ -lconvergedmessageutils \
+ -lMsgMedia \
+ -leditorgenutils \
+ -lcone \
+ -leikcoctl \
+ -leikcore \
+ -leikdlg \
+ -lmsgs \
+ -letext \
+ -lgsmu \
+ -lmmsgenutils \
+ -lefsrv \
+ -lestor \
+ -lsmcm \
+ -lCommonEngine \
+ -lbafl \
+ -lCdlEngine \
+ -lFeatMgr \
+ -lapmime \
+ -lapgrfx \
+ -lcharconv \
+ -lInetProtUtil \
+ -lsmildtd \
+ -lxmldom \
+ -lxmlparser \
+ -lcone \
+ -lQtCore \
+ -letel \
+ -lcommdb \
+ -lcommsdat \
+ -letelmm \
+ -lunidatamodelloader \
+ -lunidatamodel \
+ -lavkon \
+ -leikcoctl \
+ -leikctl \
+ -lform \
+ -luiklaf\
+ -lmmstestbed \
+ -lmmsmessage \
+ -lmmsserversettings \
+ -lxqutils \
+ -lQtContacts
+
+packageheader = "$${LITERAL_HASH}{\"TestConvergedMessageUtils\"},(0xE39cd515),1,0,0,TYPE=SA"
+
+vendorinfo = \
+ "; Localised Vendor name" \
+ "%{\"Nokia\"}" \
+ "; Unique Vendor name" \
+ ":\"Nokia\""
+
+dependencyinfo = \
+ "; Default HW/platform dependencies" \
+ "[0x101F7961],0,0,0,{\"S60ProductID\"}" \
+ "[0x2001E61C],4,6,3,{"Qt"}
+
+default_deployment.pkg_prerules = packageheader \
+ vendorinfo \
+ dependencyinfo
+
+#Copy the dependent DLL
+symbian: {
+ addDll.sources = mmstestbed.dll
+ addDll.path = /sys/bin
+ DEPLOYMENT += addDll
+
+ addFile1.sources = ./data/TestConvergedMessageUtilsSample.txt
+ addFile1.path = C:/data/
+ DEPLOYMENT += addFile1
+ }
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutilsapp.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,22 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Project Definiton File for testconvergedmessageutilsapp
+#
+
+TEMPLATE = subdirs
+
+SUBDIRS += mmstestbed/mmstestbed.pro
+SUBDIRS += testconvergedmessageutils/testconvergedmessageutils.pro
+
+CONFIG += ordered
\ No newline at end of file
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/tsrc.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/tsrc.pro Wed Aug 18 09:45:25 2010 +0300
@@ -11,12 +11,11 @@
#
# Contributors:
#
-# Description: Project Definiton File for both MMSTestBed and TestConvergedMessageUtils
+# Description: Project Definiton File for testconvergedmessageutilsapp
#
TEMPLATE = subdirs
-SUBDIRS += mmstestbed/mmstestbed.pro
-SUBDIRS += testconvergedmessageutils/testconvergedmessageutils.pro
+SUBDIRS += testconvergedmessageutilsapp/testconvergedmessageutilsapp.pro
CONFIG += ordered
\ No newline at end of file
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/inc/unibiomessagedataplugin_p.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/inc/unibiomessagedataplugin_p.h Wed Aug 18 09:45:25 2010 +0300
@@ -19,6 +19,7 @@
#define UNIBIOMESSAGEDATAPLUGINPRIVATE_H_
#include "unidatamodelplugininterface.h"
+#include <e32base.h>
//Forward Declarations
class CClientMtmRegistry;
@@ -30,7 +31,7 @@
/**
* Symbian specific implementation of the uni SMS plugin
*/
-class UniBioMessageDataPluginPrivate : public MMsvSessionObserver
+class UniBioMessageDataPluginPrivate : public CBase, public MMsvSessionObserver
{
public:
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/rom/unibiomessagedataplugin.iby Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/rom/unibiomessagedataplugin.iby Wed Aug 18 09:45:25 2010 +0300
@@ -46,7 +46,6 @@
data=DATAZ_\BIOFILE_DIR\olp.rsc BIOFILE_DIR\olp.rsc
data=DATAZ_\BIOFILE_DIR\olp.mbm BIOFILE_DIR\olp.mbm
-data=DATAZ_\BIOFILE_DIR\prov.rsc BIOFILE_DIR\prov.rsc
#endif // __UNI_VCAL_DATA_PLUGIN_IBY__
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -30,7 +30,7 @@
UniBioMessageDataPlugin::UniBioMessageDataPlugin(QObject* parent) :
QObject(parent)
{
- d_ptr = new UniBioMessageDataPluginPrivate(this);
+ d_ptr = q_check_ptr(new UniBioMessageDataPluginPrivate(this));
}
// UniBioMessageDataPlugin::~UniBioMessageDataPlugin()
@@ -120,7 +120,8 @@
//---------------------------------------------------------------
UniMessageInfoList UniBioMessageDataPlugin::attachmentList()
{
- RFile file = d_ptr->attachmentL();
+ RFile file;
+ QT_TRAP_THROWING(file = d_ptr->attachmentL());
if(attachmentCount() == 0)
{
@@ -135,8 +136,8 @@
int size;
TFileName fullName;
- User::LeaveIfError(file.FullName(fullName));
- User::LeaveIfError(file.Size(size));
+ qt_symbian_throwIfError(file.FullName(fullName));
+ qt_symbian_throwIfError(file.Size(size));
path = XQConversions::s60DescToQString(*fullName.AllocL());
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin_p.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin_p.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -52,11 +52,11 @@
if(attachmentProcessed == EFalse && iAttachmentCount == 1)
{
- CMsvStore* store = iMsvEntry->EditStoreL();
+ TRAP_IGNORE( CMsvStore* store = iMsvEntry->EditStoreL();
CleanupStack::PushL(store);
MMsvAttachmentManagerSync& attachMan = store->AttachmentManagerExtensionsL();
attachMan.RemoveAttachmentL(0);
- CleanupStack::PopAndDestroy();
+ CleanupStack::PopAndDestroy(););
}
if (iMsvEntry) {
@@ -75,7 +75,7 @@
//---------------------------------------------------------------
UniBioMessageDataPluginPrivate::UniBioMessageDataPluginPrivate(UniBioMessageDataPlugin* plugin) :
q_ptr(plugin), iMSession(NULL), iMtmReg(NULL), iBioClientMtm(NULL),
- iMsvEntry(NULL)
+ iMsvEntry(NULL),iAttachmentCount(0)
{
iMSession = CMsvSession::OpenSyncL(*this);
done = EFalse;
@@ -247,7 +247,13 @@
CMsvStore* store1 = iMsvEntry->ReadStoreL();
CleanupStack::PushL(store1);
MMsvAttachmentManager& attachMan = store1->AttachmentManagerL();
- RFile file = attachMan.GetAttachmentFileL(0);
+ RFile file;
+
+ if (iAttachmentCount > 0)
+ {
+ file = attachMan.GetAttachmentFileL(0);
+ }
+
CleanupStack::PopAndDestroy(store1);
return file;
}
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/bwins/test_unidatamodel_vcal_pluginu.def Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-EXPORTS
- ?SetForMtmTypeL@TestUniDataModelVCalPlugin@@AAEXAAVTMsvEntry@@W4TBIOMessageType@@@Z @ 1 NONAME ; void TestUniDataModelVCalPlugin::SetForMtmTypeL(class TMsvEntry &, enum TBIOMessageType)
- ?SetSessionPath@TestUniDataModelVCalPlugin@@AAEXABVTDesC16@@@Z @ 2 NONAME ; void TestUniDataModelVCalPlugin::SetSessionPath(class TDesC16 const &)
- ?CreateBioEntryClientSideL@TestUniDataModelVCalPlugin@@AAEXAAVTMsvEntry@@AAVCRichText@@@Z @ 3 NONAME ; void TestUniDataModelVCalPlugin::CreateBioEntryClientSideL(class TMsvEntry &, class CRichText &)
- ?trUtf8@TestUniDataModelVCalPlugin@@SA?AVQString@@PBD0H@Z @ 4 NONAME ; class QString TestUniDataModelVCalPlugin::trUtf8(char const *, char const *, int)
- ?qt_metacall@TestUniDataModelVCalPlugin@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 5 NONAME ; int TestUniDataModelVCalPlugin::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?CreateBIOEntryL@TestUniDataModelVCalPlugin@@AAEJAAVTDesC16@@W4TBIOMessageType@@@Z @ 6 NONAME ; long TestUniDataModelVCalPlugin::CreateBIOEntryL(class TDesC16 &, enum TBIOMessageType)
- ?initTestCase@TestUniDataModelVCalPlugin@@AAEXXZ @ 7 NONAME ; void TestUniDataModelVCalPlugin::initTestCase(void)
- ?CreateBIOEntryFromFileL@TestUniDataModelVCalPlugin@@AAEJABVTDesC16@@W4TBIOMessageType@@@Z @ 8 NONAME ; long TestUniDataModelVCalPlugin::CreateBIOEntryFromFileL(class TDesC16 const &, enum TBIOMessageType)
- ?testPluginLoading@TestUniDataModelVCalPlugin@@AAEXXZ @ 9 NONAME ; void TestUniDataModelVCalPlugin::testPluginLoading(void)
- ?testGetPluginWithoutLoading@TestUniDataModelVCalPlugin@@AAEXXZ @ 10 NONAME ; void TestUniDataModelVCalPlugin::testGetPluginWithoutLoading(void)
- ?testDraftsVCalMessage@TestUniDataModelVCalPlugin@@AAEXXZ @ 11 NONAME ; void TestUniDataModelVCalPlugin::testDraftsVCalMessage(void)
- ?tr@TestUniDataModelVCalPlugin@@SA?AVQString@@PBD0@Z @ 12 NONAME ; class QString TestUniDataModelVCalPlugin::tr(char const *, char const *)
- ?getStaticMetaObject@TestUniDataModelVCalPlugin@@SAABUQMetaObject@@XZ @ 13 NONAME ; struct QMetaObject const & TestUniDataModelVCalPlugin::getStaticMetaObject(void)
- ?testInBoxVCalMessage@TestUniDataModelVCalPlugin@@AAEXXZ @ 14 NONAME ; void TestUniDataModelVCalPlugin::testInBoxVCalMessage(void)
- ?qt_metacast@TestUniDataModelVCalPlugin@@UAEPAXPBD@Z @ 15 NONAME ; void * TestUniDataModelVCalPlugin::qt_metacast(char const *)
- ?init@TestUniDataModelVCalPlugin@@AAEXXZ @ 16 NONAME ; void TestUniDataModelVCalPlugin::init(void)
- ?metaObject@TestUniDataModelVCalPlugin@@UBEPBUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const * TestUniDataModelVCalPlugin::metaObject(void) const
- ?tr@TestUniDataModelVCalPlugin@@SA?AVQString@@PBD0H@Z @ 18 NONAME ; class QString TestUniDataModelVCalPlugin::tr(char const *, char const *, int)
- ?ReadFromFileL@TestUniDataModelVCalPlugin@@AAEPAVHBufC16@@ABVTDesC16@@@Z @ 19 NONAME ; class HBufC16 * TestUniDataModelVCalPlugin::ReadFromFileL(class TDesC16 const &)
- ?SetBIOServiceIdL@TestUniDataModelVCalPlugin@@AAEJXZ @ 20 NONAME ; long TestUniDataModelVCalPlugin::SetBIOServiceIdL(void)
- ?cleanupTestCase@TestUniDataModelVCalPlugin@@AAEXXZ @ 21 NONAME ; void TestUniDataModelVCalPlugin::cleanupTestCase(void)
- ?SetMessageType@TestUniDataModelVCalPlugin@@AAE?AW4TBIOMessageType@@ABVTDesC16@@@Z @ 22 NONAME ; enum TBIOMessageType TestUniDataModelVCalPlugin::SetMessageType(class TDesC16 const &)
- ?trUtf8@TestUniDataModelVCalPlugin@@SA?AVQString@@PBD0@Z @ 23 NONAME ; class QString TestUniDataModelVCalPlugin::trUtf8(char const *, char const *)
- ?testUnusedAPIs@TestUniDataModelVCalPlugin@@AAEXXZ @ 24 NONAME ; void TestUniDataModelVCalPlugin::testUnusedAPIs(void)
- ?staticMetaObject@TestUniDataModelVCalPlugin@@2UQMetaObject@@B @ 25 NONAME ; struct QMetaObject const TestUniDataModelVCalPlugin::staticMetaObject
- ?GenerateMessagesL@TestUniDataModelVCalPlugin@@AAEPAVCMsvEntrySelection@@XZ @ 26 NONAME ; class CMsvEntrySelection * TestUniDataModelVCalPlugin::GenerateMessagesL(void)
- ?testPluginLoadingMultipleTimes@TestUniDataModelVCalPlugin@@AAEXXZ @ 27 NONAME ; void TestUniDataModelVCalPlugin::testPluginLoadingMultipleTimes(void)
- ?cleanup@TestUniDataModelVCalPlugin@@AAEXXZ @ 28 NONAME ; void TestUniDataModelVCalPlugin::cleanup(void)
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/data/TestUniDataModelVCalPlugin.cfg Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,1 @@
+TestUniDataModelVCalPlugin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/data/TestUniDataModelVCalPlugin.pl Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,182 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+#!/usr/bin/perl -w
+use warnings;
+use strict;
+
+my $TOTALCASES = 0;
+my $TOTALPASSED = 0;
+my $TOTALRUN = 0;
+my $TOTALFAILED = 0;
+my $TOTALSKIPPED = 0;
+
+sub parse_line
+{
+ my $line = $_[0];
+ my @parts = split (" ", $line);
+ my $passed = $parts[1];
+ my $failed = $parts[3];
+ my $skipped = $parts[5];
+
+ my $total = $passed + $failed + $skipped;
+ my $passrate = $passed * 100 / $total;
+ my $passrateround = sprintf("%.0f",$passrate);
+ my $runrate = ($total - $skipped)*100/$total;
+ my $runrateround = sprintf("%.0f",$runrate);
+
+ $TOTALCASES += $total;
+ $TOTALPASSED += $passed;
+ $TOTALRUN += ($total - $skipped);
+ $TOTALFAILED += $failed;
+ $TOTALSKIPPED += $skipped;
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$passed\n";
+ printf MYFILE "</td>\n";
+
+ if($failed > 0)
+ {
+ printf MYFILE "<td style=\"font-weight:bold;color:red\">\n";
+ printf MYFILE "$failed\n";
+ printf MYFILE "</td>\n";
+ }
+ else
+ {
+ printf MYFILE "<td>\n";
+ printf MYFILE "$failed\n";
+ printf MYFILE "</td>\n";
+ }
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$skipped\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$total\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE ("$passrateround %%\n");
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$runrateround %%\n";
+ printf MYFILE "</td>\n";
+
+
+}
+
+sub parse_file
+ {
+ my $pattern = "Totals";
+ my $file = $_[0];
+ open (FILE,$file);
+
+ while (my $line= <FILE>)
+ {
+ chomp ($line);
+ if ($line =~ m/$pattern/)
+ {
+ parse_line $line;
+ }
+ }
+ close(FILE);
+ }
+
+
+sub generate_report
+ {
+ open (MYFILE, '>/epoc32/winscw/c/logs/messagingtestsuite/report.html');
+ printf MYFILE "<html>\n";
+ printf MYFILE "<body>\n";
+ printf MYFILE "<head>\n";
+ printf MYFILE "<title>MsgApp Test Suite Reports</title>";
+ printf MYFILE "</head>\n";
+ printf MYFILE "<h2 align = center>Messaging101 Test Suite Report</h2>\n";
+ printf MYFILE "<table border = 2 cellpadding = 10 align = center>\n";
+ printf MYFILE "<tr style = \" background-color:lavender \">\n";
+ printf MYFILE "<th>Module</th>\n";
+ printf MYFILE "<th style = color:green>Passed</th>\n";
+ printf MYFILE "<th style = color:red>Failed</th>\n";
+ printf MYFILE "<th style = color:chocolate>Skipped</th>\n";
+ printf MYFILE "<th>Total Cases</th>\n";
+ printf MYFILE "<th>Pass Rate</th>\n";
+ printf MYFILE "<th>Run Rate</th>\n";
+ printf MYFILE "</tr>\n";
+
+
+ my @files = </epoc32/winscw/c/logs/messagingtestsuite/*.txt>;
+ foreach my $file (@files)
+ {
+ my @splitedpath = split("/",$file);
+ my $filename = $splitedpath[-1];
+ my $length = length($filename);
+ my $name = substr($filename,11,$length-15);
+ printf MYFILE "<tr>\n";
+ printf MYFILE "<td>\n";
+ printf MYFILE "<a HREF=$filename style = text-decoration:none><b>$name</b></a>\n";
+ printf MYFILE "</td>\n";
+
+ parse_file $file;
+
+ printf MYFILE "</tr>\n";
+ }
+
+ printf MYFILE "<tr style= \"font-weight:bold; color:white; background-color:gray\">\n";
+ printf MYFILE "<td>\n";
+ printf MYFILE "<b>Overall</b>\n";
+ printf MYFILE "</td>\n";
+
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALPASSED\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALFAILED\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALSKIPPED\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALCASES\n";
+ printf MYFILE "</td>\n";
+
+ my $passrate = $TOTALPASSED*100/$TOTALCASES;
+ my $passrateround = sprintf("%.0f",$passrate);
+ printf MYFILE "<td>\n";
+ printf MYFILE "$passrateround%%\n";
+ printf MYFILE "</td>\n";
+
+ my $runrate = ($TOTALCASES - $TOTALSKIPPED)*100/$TOTALCASES;
+ my $runrateround = sprintf("%.0f",$runrate);
+ printf MYFILE "<td>\n";
+ printf MYFILE "$runrateround%%\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "</tr>\n";
+
+ printf MYFILE "</table>\n";
+ printf MYFILE "</body>\n";
+ printf MYFILE "</html>\n";
+
+ close (MYFILE);
+ }
+
+
+generate_report;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/inc/testunidatamodelvcalplugin.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef TEST_UNI_DATA_MODEL_VCAL_PLUGIN_H
+#define TEST_UNI_DATA_MODEL_VCAL_PLUGIN_H
+
+#ifdef BUILD_TEST_DLL
+#define TEST_EXPORT Q_DECL_EXPORT
+#else
+#define TEST_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <txtetext.h>
+#include <txtrich.h>
+#include <mtclreg.h>
+#include <mtclbase.h>
+#include <msvids.h>
+#include <smsclnt.h>
+#include <smuthdr.h>
+#include <QDateTime>
+#include <e32math.h>
+
+
+#include <bsp.h>
+
+const TInt32 KUidBIOVCalenderMsg = {0x10005533}; // VCalender diary
+
+class UniDataModelPluginInterface;
+class UniDataModelLoader;
+class MsgObserver;
+class S60QConversions;
+class ConvergedMessage;
+class CBIODatabase;
+class ConvergedMessgageAddress;
+
+typedef enum
+ { // GENERATE A MESSAGE USING....
+ ENoMessage, // .. error cases
+ EBioIapSettingsMessage, // .. IAP grammar, includes Internet settings
+ // Email settings, and logon scripts,
+ EBioEnpMessage, // .. Email Notification grammar.
+ EBioRingTonesMessage, // .. Ringing Tones binary data
+ EBioOpLogoMessage, // .. Logo for Operator service
+ EBioCompBusCardMessage, // .. Compact Business Card data
+ EBiovCardMessage, // .. virtual business card data
+ EBiovCalenderMessage, // .. vCalender data
+ EBioWAPSettingsMessage, // .. wap settings
+ EBioWPRVSettingsMessage // .. wprv settings
+ } TBIOMessageType;
+
+
+class TEST_EXPORT TestUniDataModelVCalPlugin : public QObject
+{
+Q_OBJECT
+
+private slots:
+ //called by frame work.
+ void initTestCase();//called before the first testfunction is executed.
+ void init();//called before each testfunction is executed.
+
+ //test cases.
+ void testInBoxVCalMessage();
+ void testDraftsVCalMessage();
+ void testUnusedAPIs();
+ void cleanup();//called after every testfunction.
+ void cleanupTestCase();//called after the last testfunction was executed.
+
+private:
+
+ TMsvId CreateBIOEntryL(TDesC& aText, TBIOMessageType aMessageType);
+ void CreateBioEntryClientSideL(TMsvEntry& aEntry, CRichText& aBody);
+ HBufC* ReadFromFileL(const TDesC& aFile);
+ void SetSessionPath(const TDesC& aSessionPath);
+ TMsvId CreateBIOEntryFromFileL(const TDesC& aFilename,
+ TBIOMessageType aMessageType);
+ TBIOMessageType SetMessageType(const TDesC& aFileName);
+ CMsvEntrySelection* GenerateMessagesL();
+ TMsvId SetBIOServiceIdL();
+ void SetForMtmTypeL(TMsvEntry& aEntry, TBIOMessageType aType);
+
+private:
+
+ UniDataModelPluginInterface* pluginInterface;
+ MsgObserver* iObserver;
+ CMsvSession* iMSession;
+ CClientMtmRegistry* iMtmReg;
+ TMsvId messageId;
+ UniDataModelLoader* pluginLoader;
+ QDateTime retTimeStamp;
+ RFs iFs;
+ CDir* iDir;
+ TInt iFilesProcessed;
+ CMsvEntry* iMsvEntry;
+ CBIODatabase* iBioDb;
+ TMsvId newEntryId;
+ HBufC* tempNumber;
+ TBufC<KMaxFileName> currentFile;
+ TBool inbox;
+ TBool drafts;
+};
+
+class MsgObserver : public MMsvSessionObserver
+{
+public:
+ void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2,
+ TAny* aArg3);
+};
+
+#endif //TEST_UNI_DATA_MODEL_VCAL_PLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/inc/testunidatamodelvcalplugin.ini Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,8 @@
+//this file is used to provide predefined set of input data.
+
+//eg.
+const char TEST_MSG_RECIEPIENT[] = "Shweta Singh<77>";
+const char TEST_MSG_FROM1[] = "88";
+const char TEST_MSG_ALIAS1[] = "Shweta Singh";
+const char TEST_MSG_FROM2[] = "999";
+const char TEST_MSG_SUBJECT[] = "Hi";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/src/testunidatamodelvcalplugin.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,643 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+#include <QtTest/QtTest>
+#include <QtDebug>
+#include <QTimer>
+#include <QSignalSpy>
+#include <xqconversions.h>
+#include <bsp.h>
+#include <biodb.h>
+#include <biouids.h>
+#include <biocmtm.h>
+#include "convergedmessageaddress.h"
+
+#include "testunidatamodelvcalplugin.h"
+#include <unidatamodelloader.h>
+#include "testunidatamodelvcalplugin.ini"
+#include "unidatamodelplugininterface.h"
+#include <convergedmessage.h>
+
+const TInt KTelephoneNumberMaxLength = 32;
+_LIT(KBIOTxtFilePath, "C:\\test\\");
+_LIT(KBIOvCalenderPrefix, "vcal*");
+// vCalender
+_LIT(KUnixEpoch, "19700000:000000.000000");
+#define KBioUidValue 0x10001262
+
+const TUid KBioUidValueUid =
+{KBioUidValue};
+
+
+//factory method to create objects.
+QObject* getObject(QString className)
+{
+ if(className == "TestUniDataModelVCalPlugin" )
+ {
+ return new TestUniDataModelVCalPlugin;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+//main entry point
+int main(int argc, char *argv[])
+ {
+ int ret = -1;
+ QCoreApplication app(argc, argv);
+
+ //the configuration file.
+ QFile data("c:/TestUniDataModelVCalPlugin.cfg");
+ if (data.open(QFile::ReadOnly))
+ {
+ QTextStream in(&data);
+ while(!in.atEnd())
+ {
+ QString name = in.readLine();
+ QObject* tc = getObject(name);
+
+ if(tc)
+ {
+ ret = QTest::qExec(tc, argc, argv);
+ delete tc;
+ }
+ }
+ }
+ return ret;
+
+ }
+
+
+
+
+
+//---------------------------------------------------------------
+// TestUniDataModelVCalPlugin::init
+//---------------------------------------------------------------
+
+
+void TestUniDataModelVCalPlugin::initTestCase()
+{
+ iObserver = new (ELeave) MsgObserver();
+
+ // Create a new messaging server session..
+ iMSession = CMsvSession::OpenSyncL(*iObserver);
+
+ iMsvEntry = iMSession->GetEntryL(KMsvRootIndexEntryId);
+ newEntryId = 0;
+ pluginLoader = new UniDataModelLoader();
+
+ retTimeStamp = QDateTime::currentDateTime();
+ int err = iFs.Connect();
+ QVERIFY(err == 0);
+ iBioDb = CBIODatabase::NewL(iFs);
+ iFs.SetSessionPath(_L("c:\\"));
+ inbox = EFalse;
+ drafts = EFalse;
+}
+void TestUniDataModelVCalPlugin::cleanupTestCase()
+{
+ delete iMsvEntry;
+ iMsvEntry = NULL;
+ delete iObserver;
+ iObserver = NULL;
+ delete iMSession;
+ iMSession = NULL;
+ delete pluginLoader;
+}
+
+void TestUniDataModelVCalPlugin::init()
+{
+
+}
+
+//---------------------------------------------------------------
+// TestUniDataModelVCalPlugin::cleanup
+//---------------------------------------------------------------
+void TestUniDataModelVCalPlugin::cleanup()
+{
+
+
+}
+
+void TestUniDataModelVCalPlugin::testInBoxVCalMessage()
+{
+ inbox = ETrue;
+ GenerateMessagesL();
+
+ pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
+ pluginInterface->setMessageId(newEntryId);
+
+ int count = pluginInterface->attachmentCount();
+ QVERIFY(count == 1);
+
+ UniMessageInfoList attachmentlist = pluginInterface->attachmentList();
+ QVERIFY(!attachmentlist.isEmpty());
+
+ UniMessageInfo* att = attachmentlist.at(0);
+ QString path = att->path();
+
+ QString recepient(TEST_MSG_FROM1);
+ QString fromaddress;
+ pluginInterface->fromAddress(fromaddress);
+ QVERIFY(recepient == fromaddress);
+
+ QString body;
+ pluginInterface->body(body);
+ QVERIFY(!body.isEmpty());
+
+ // Compare input message , with the read message
+ RFile origFile;
+ int op = origFile.Open(iFs, currentFile, EFileRead);
+ QVERIFY(op == 0);
+
+ TBuf8<1000> readBuf;
+ HBufC* readBuf16 = HBufC::NewL(2000);
+
+ origFile.Read(readBuf);
+ readBuf16->Des().Copy(readBuf);
+
+ QString orig = XQConversions::s60DescToQString(*readBuf16);
+ origFile.Close();
+
+ HBufC* filepath = XQConversions::qStringToS60Desc(path);
+
+ int size = pluginInterface->messageSize();
+
+ MsgPriority priority = pluginInterface->messagePriority();
+ // Normal priority
+ qDebug() << "prority" << priority;
+ QVERIFY(priority == 1);
+
+ QVERIFY(pluginInterface->timeStamp() == retTimeStamp);
+
+ ConvergedMessageAddressList recipientList;
+ pluginInterface->toRecipientList(recipientList);
+ QVERIFY(recipientList.count() == 0);
+ qDebug() << "recipientList.count" << recipientList.count();
+
+ if (inbox)
+ {
+ iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
+ qDebug() << "SetEntry" ;
+ }
+
+
+}
+
+void TestUniDataModelVCalPlugin::testDraftsVCalMessage()
+{
+ drafts = ETrue;
+ GenerateMessagesL();
+
+ pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
+ pluginInterface->setMessageId(newEntryId);
+
+ int count = pluginInterface->attachmentCount();
+ QVERIFY(count == 1);
+
+ UniMessageInfoList attachmentlist = pluginInterface->attachmentList();
+ QVERIFY(!attachmentlist.isEmpty());
+
+ UniMessageInfo* att = attachmentlist.at(0);
+ QString path = att->path();
+
+ QString fromaddress;
+ pluginInterface->fromAddress(fromaddress);
+ QVERIFY(!fromaddress.isEmpty()); //added ! shweta
+
+ QString body;
+ pluginInterface->body(body);
+ QVERIFY(!body.isEmpty());
+
+ // Compare input message , with the read message
+ RFile origFile;
+ int op = origFile.Open(iFs, currentFile, EFileRead);
+ QVERIFY(op == 0);
+
+ TBuf8<1000> readBuf;
+ HBufC* readBuf16 = HBufC::NewL(2000);
+
+ origFile.Read(readBuf);
+ readBuf16->Des().Copy(readBuf);
+
+ QString orig = XQConversions::s60DescToQString(*readBuf16);
+ origFile.Close();
+
+ int size = pluginInterface->messageSize();
+
+ MsgPriority priority = pluginInterface->messagePriority();
+ // Normal priority
+ qDebug() << "prority" << priority;
+ QVERIFY(priority == 1);
+
+ QVERIFY(pluginInterface->timeStamp() == retTimeStamp);
+
+ QString recepient(TEST_MSG_FROM1);
+ ConvergedMessageAddressList recipientList;
+ ConvergedMessageAddress alias(recepient);
+
+ recipientList.append(&alias);
+ pluginInterface->toRecipientList(recipientList);
+
+ QVERIFY( recipientList.count() != 0 );
+ qDebug() << "recipientList.count()"<<recipientList.count() ;
+
+ const QString& copy = recipientList[0]->address();
+ qDebug() << "copy = "<<recipientList[0]->address();
+ QVERIFY(recepient == copy);
+ qDebug() << "Receipient Verified";
+
+ if (drafts)
+ {
+ iMsvEntry->SetEntryL(KMsvDraftEntryId);
+ qDebug() << "SetEntry" ;
+ }
+ }
+
+
+
+void TestUniDataModelVCalPlugin::testUnusedAPIs()
+{
+ pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
+
+ QVERIFY(pluginInterface->objectCount() == 0);
+
+ UniMessageInfoList objectlist = pluginInterface->objectList();
+ QVERIFY(objectlist.isEmpty());
+
+ QVERIFY(pluginInterface->slideCount() == 0);
+
+ UniMessageInfoList slidelist = pluginInterface->slideContent(0);
+ QVERIFY(slidelist.isEmpty());
+
+ QVERIFY(pluginInterface->hasAttachment() == true );
+
+ ConvergedMessageAddressList recipientList;
+
+ pluginInterface->ccRecipientList(recipientList);
+ QVERIFY(recipientList.count() == 0);
+
+ pluginInterface->bccRecipientList(recipientList);
+ QVERIFY(recipientList.count() == 0);
+}
+
+CMsvEntrySelection* TestUniDataModelVCalPlugin::GenerateMessagesL()
+{
+ HBufC* aFileDirectory = KBIOTxtFilePath().AllocL();
+ TMsvId messageId;
+ TBIOMessageType currentMsgType;
+
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection();
+ CleanupStack::PushL(selection);
+
+ TInt err = iFs.GetDir(aFileDirectory->Des(),
+ KEntryAttMatchMask,
+ ESortByName,
+ iDir);
+ if (err == KErrPathNotFound)
+ {
+ TInt makeDirErr = iFs.MkDirAll(aFileDirectory->Des());
+ makeDirErr == KErrNone ? User::Leave(KErrNotFound)
+ : User::Leave(makeDirErr);
+ }
+ else if (err != KErrNone)
+ {
+ User::Leave(err);
+ }
+
+ // Set the session path for the RFs
+ SetSessionPath(aFileDirectory->Des());
+ if (iDir)
+ {
+ delete iDir;
+ iDir = NULL;
+ }
+
+ User::LeaveIfError(iFs.GetDir(_L("*.txt"), KEntryAttNormal, ESortByName, iDir));
+ TInt count = iDir->Count();
+ if (count == 0)
+ {
+ User::Leave(KErrNotFound); // No files to process
+ }
+
+ TBuf<60> outputBuf;
+
+ for (TInt loop = 0; loop < count; loop++)
+ {
+ TEntry as = (*iDir)[0];
+ currentFile = (as.iName);
+ // Not processed all the messages - so keep the current state
+ iFilesProcessed++; // Here because need to update the counter promptly
+ currentMsgType = SetMessageType(currentFile);
+ if (currentMsgType != ENoMessage) // skip any dodgy filenames
+ {
+ messageId = CreateBIOEntryFromFileL(currentFile, currentMsgType);
+ selection->AppendL(messageId);
+ TPtrC tempPtr = (currentFile.Des());
+
+ }
+ }
+ CleanupStack::Pop(); // selection
+
+ return selection;
+}
+
+TBIOMessageType TestUniDataModelVCalPlugin::SetMessageType(
+ const TDesC& aFileName)
+{
+
+ if (aFileName.MatchF(KBIOvCalenderPrefix) == 0)
+ {
+ return EBiovCalenderMessage;
+ }
+
+ return ENoMessage;
+}
+
+TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryFromFileL(
+ const TDesC& aFilename,
+ TBIOMessageType aMessageType)
+{
+ //First use the filename to get the message body,
+ // then convert '\n' to the paragraph delimiters used in proper SMS
+ HBufC* tempBuffer;
+
+ tempBuffer = ReadFromFileL(aFilename);
+ CleanupStack::PushL(tempBuffer);
+
+ newEntryId = CreateBIOEntryL(*tempBuffer, aMessageType);
+
+ // Finished with our local descriptors - free up some memory
+ CleanupStack::PopAndDestroy();
+
+ return newEntryId;
+}
+
+void TestUniDataModelVCalPlugin::SetSessionPath(const TDesC& aSessionPath)
+{
+ iFs.SetSessionPath(aSessionPath);
+}
+
+HBufC* TestUniDataModelVCalPlugin::ReadFromFileL(const TDesC& aFile)
+{
+ RFile file;
+ TBuf8<1024> lineBuffer;
+ TInt err = KErrNone;
+
+ err = file.Open(iFs, aFile, EFileStreamText | EFileRead | EFileShareAny);
+
+ if (err != KErrNone) // Didn't find the file, so leave - should only get valid filenames!
+ {
+ User::Leave(KErrNotFound);
+ }
+
+ HBufC* bioBuf = HBufC::NewLC(65535); // Create a new descriptor on the heap.
+ HBufC* copyBuffer = HBufC::NewLC(1024);
+
+ do // Read in the text from file, and also check if there is a name field:
+ {
+ err = file.Read(lineBuffer);// Read upto 256 chars, '\n' and all...
+ //err = ReadLineL(file,lineBuffer);
+ if (err == KErrNone) // Made a valid read,
+ if (lineBuffer.Length() == 0) // but read 0 chars
+ err = KErrEof; // so set err value to end processing
+
+ if (err == KErrNone)
+ {
+ copyBuffer->Des().Copy(lineBuffer);// Copy, and overwrite existing text
+ if ( (bioBuf->Length() + copyBuffer->Length())
+ > bioBuf->Des().MaxLength())
+ {
+ bioBuf = bioBuf->ReAllocL(bioBuf->Length()
+ + copyBuffer->Length());
+ }
+ bioBuf->Des().Append(*copyBuffer);
+ //bioBuf->Des().Append(_L("\n"));
+ }
+ }while (err != KErrEof);
+
+ CleanupStack::PopAndDestroy(); // Destroy the copyBuffer.
+ CleanupStack::Pop();// Remove the bioBuf.
+
+ file.Close();
+ return bioBuf;
+}
+
+TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryL(TDesC& aText,
+ TBIOMessageType aMessageType)
+{
+ // Ensure that we have a valid service ID to work with:
+ TMsvId iBioServiceId;
+
+ iBioServiceId = SetBIOServiceIdL();
+
+ HBufC* localBuffer = aText.AllocL();
+ CleanupStack::PushL(localBuffer);
+
+ TPtr messDes = localBuffer->Des();
+
+ if (aMessageType != EBiovCardMessage && aMessageType
+ != EBiovCalenderMessage)
+ {
+ // convert \r\n to \n since this is what is expected from SMS when not vCard data
+ for (TInt i = 0; i < messDes.Length(); i++)
+ {
+ if (messDes[i] == (TText) '\r' && i < messDes.Length() - 1
+ && messDes[i + 1] == (TText) '\n')
+ messDes.Delete(i, 1);
+ }
+ }
+
+ // Create and fill a CRichText object for the jobbie:
+ CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
+ CleanupStack::PushL(paraFormatLayer);
+ CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
+ CleanupStack::PushL(charFormatLayer);
+ CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer);
+ CleanupStack::PushL(richText);
+
+ TInt pos = richText->DocumentLength();
+ richText->InsertL(pos, messDes);
+
+ TMsvEntry newBioEntry;
+ newBioEntry.SetNew(ETrue);
+ newBioEntry.SetComplete(EFalse);
+ newBioEntry.SetUnread(ETrue);
+ newBioEntry.SetVisible(ETrue);
+ newBioEntry.SetReadOnly(EFalse);
+ newBioEntry.SetFailed(EFalse);
+ newBioEntry.SetOperation(EFalse);
+ newBioEntry.SetMultipleRecipients(EFalse);
+ newBioEntry.SetAttachment(EFalse);
+ newBioEntry.iMtm = KUidBIOMessageTypeMtm;
+ newBioEntry.iType = KUidMsvMessageEntry;
+ newBioEntry.iServiceId = iBioServiceId;
+ TTime now;
+ now.UniversalTime();
+ newBioEntry.iDate = now;
+
+ TTime unixEpoch(KUnixEpoch);
+ TTimeIntervalSeconds seconds;
+ TTime timeStamp = newBioEntry.iDate;
+ timeStamp.SecondsFrom(unixEpoch, seconds);
+ retTimeStamp.setTime_t(seconds.Int());
+
+ newBioEntry.iDescription.Set(richText->Read(0, richText->DocumentLength()));
+ TBufC<KTelephoneNumberMaxLength> telNumber;
+
+ QString recepient(TEST_MSG_FROM1);
+ tempNumber = XQConversions::qStringToS60Desc(recepient);
+
+ telNumber = tempNumber->Des();
+ newBioEntry.iDetails.Set(telNumber);
+
+ SetForMtmTypeL(newBioEntry, aMessageType);
+
+ newBioEntry.iSize = richText->DocumentLength();// msgSize;
+ CreateBioEntryClientSideL(newBioEntry, *richText);
+
+ CleanupStack::PopAndDestroy(4); // richText, charFormatLayer, paraFormatLayer, localBuffer
+ return newBioEntry.Id();
+}
+
+void TestUniDataModelVCalPlugin::CreateBioEntryClientSideL(TMsvEntry& aEntry,
+ CRichText& aBody)
+{
+ if (inbox)
+ {
+ iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
+ }
+ else if (drafts)
+ {
+ iMsvEntry->SetEntryL(KMsvDraftEntryId);
+ }
+ // Get the global inbox.
+
+ iMsvEntry->CreateL(aEntry);
+ iMsvEntry->SetEntryL(aEntry.Id());
+
+ // Save all the changes
+ CMsvStore* store = iMsvEntry->EditStoreL();
+ CleanupStack::PushL(store);
+
+ if (store->HasBodyTextL())
+ {
+ store->DeleteBodyTextL();
+ }
+
+ CPlainText* pText = CPlainText::NewL();
+ CleanupStack::PushL(pText);
+
+ if (inbox)
+ {
+ CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *pText);
+ CleanupStack::PushL(smsHeader);
+ smsHeader->SetFromAddressL(*tempNumber);
+ smsHeader->StoreL(*store);
+
+ }
+ else if (drafts)
+ {
+
+ QString recepient(TEST_MSG_FROM1);
+ QString recepient2(TEST_MSG_FROM2);
+ QString alias(TEST_MSG_ALIAS1);
+
+ HBufC* addr = XQConversions::qStringToS60Desc(recepient);
+ HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2);
+ HBufC* alias1 = XQConversions::qStringToS60Desc(alias);
+
+ CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsSubmit, *pText);
+ CleanupStack::PushL(smsHeader);
+
+ CSmsNumber* number1 = CSmsNumber::NewL(); // create the instance
+ CleanupStack::PushL(number1);
+
+ number1->SetNameL(TPtrC());
+ number1->SetAddressL(*addr);
+ smsHeader->Recipients().AppendL(number1);
+ CleanupStack::Pop(number1);
+
+ CSmsNumber* number2 = CSmsNumber::NewL();
+ CleanupStack::PushL(number2);
+
+ number2->SetNameL(*alias1);
+ number2->SetAddressL(*addr2);
+
+ smsHeader->Recipients().AppendL(number2);
+ CleanupStack::Pop(number2);
+ smsHeader->StoreL(*store);
+
+ }
+
+ store->StoreBodyTextL(aBody);
+ store->CommitL();
+
+ CleanupStack::PopAndDestroy(3); //store - close the store
+
+ aEntry.SetComplete(ETrue);
+ // Update the entry
+ iMsvEntry->ChangeL(aEntry);
+ iMsvEntry->SetEntryL(KMsvRootIndexEntryId);
+}
+
+TMsvId TestUniDataModelVCalPlugin::SetBIOServiceIdL()
+{
+ // Haven't found an entry so create a BIO Message service:
+ TMsvEntry bioServiceEntry;
+ bioServiceEntry.iMtm = KUidBIOMessageTypeMtm;
+ bioServiceEntry.iType = KUidMsvServiceEntry;
+ bioServiceEntry.SetVisible(EFalse);
+ bioServiceEntry.iDate.UniversalTime();
+ bioServiceEntry.iDescription.Set(_L("BIO Message Service ")); // Is there such a thing?
+ bioServiceEntry.iDetails.Set(_L("BIO Message Service"));
+
+ TMsvId newBIOServiceId;
+
+ iMsvEntry->SetEntryL(KMsvRootIndexEntryId);
+ iMsvEntry->CreateL(bioServiceEntry); // Needs to be a child of the root!
+ newBIOServiceId = bioServiceEntry.Id();
+
+ return newBIOServiceId;
+}
+
+void TestUniDataModelVCalPlugin::SetForMtmTypeL(TMsvEntry& aEntry,
+ TBIOMessageType aType)
+{
+ TInt index;
+
+ aEntry.iBioType = KUidBIOVCalenderMsg;
+
+ // Set other TMsvEntry fields if we have a BIO message type
+ if (aType != ENoMessage)
+ {
+ aEntry.SetMtmData2(0);
+ aEntry.SetMtmData3(0);
+ }
+
+ // set description from BIF file
+ iBioDb->GetBioIndexWithMsgIDL(TUid::Uid(aEntry.iBioType), index);
+ if (index == KErrNotFound)
+ User::Leave(KErrNotFound);
+ aEntry.iDescription.Set(iBioDb->BifReader(index).Description());
+}
+
+void MsgObserver::HandleSessionEventL(TMsvSessionEvent /*aEvent*/,
+ TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/)
+{
+}
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,618 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-#include <QtTest/QtTest>
-#include <QtDebug>
-#include <QTimer>
-#include <QSignalSpy>
-#include <xqconversions.h>
-#include <bsp.h>
-#include <biodb.h>
-#include <biouids.h>
-#include <biocmtm.h>
-
-#include "serviceinfo.h"
-#include "testunidatamodelvcalplugin.h"
-#include "unidatamodelloader.h"
-#include "testunidatamodelvcalplugin.ini"
-#include "unidatamodelplugininterface.h"
-#include "convergedmessage.h"
-
-const TInt KTelephoneNumberMaxLength = 32;
-_LIT(KBIOTxtFilePath, "C:\\test\\");
-_LIT(KBIOvCalenderPrefix, "vcal*");
-// vCalender
-_LIT(KUnixEpoch, "19700000:000000.000000");
-#define KBioUidValue 0x10001262
-
-const TUid KBioUidValueUid =
-{KBioUidValue};
-
-//---------------------------------------------------------------
-// TestUniDataModelVCalPlugin::init
-//---------------------------------------------------------------
-
-
-void TestUniDataModelVCalPlugin::initTestCase()
-{
-
-}
-void TestUniDataModelVCalPlugin::cleanupTestCase()
-{
-
-}
-
-void TestUniDataModelVCalPlugin::init()
-{
- iObserver = new (ELeave) MsgObserver();
-
- // Create a new messaging server session..
- iMSession = CMsvSession::OpenSyncL(*iObserver);
-
- iMsvEntry = iMSession->GetEntryL(KMsvRootIndexEntryId);
- newEntryId = 0;
- pluginLoader = new UniDataModelLoader();
-
- retTimeStamp = QDateTime::currentDateTime();
- int err = iFs.Connect();
- QVERIFY(err == 0);
- iBioDb = CBIODatabase::NewL(iFs);
- iFs.SetSessionPath(_L("c:\\"));
- inbox = EFalse;
- drafts = EFalse;
-}
-
-//---------------------------------------------------------------
-// TestUniDataModelVCalPlugin::cleanup
-//---------------------------------------------------------------
-void TestUniDataModelVCalPlugin::cleanup()
-{
- if (newEntryId > 0)
- iMsvEntry->DeleteL(newEntryId);
- delete iMsvEntry;
- iMsvEntry = NULL;
- delete iObserver;
- iObserver = NULL;
- delete iMSession;
- iMSession = NULL;
- delete pluginLoader;
-
-}
-
-void TestUniDataModelVCalPlugin::testInBoxVCalMessage()
-{
- inbox = ETrue;
- GenerateMessagesL();
-
- pluginInterface = pluginLoader->getDataModelPlugin("bio:vcal");
- pluginInterface->setMessageId(newEntryId);
-
- int count = pluginInterface->attachmentCount();
- QVERIFY(count == 1);
-
- UniMessageInfoList attachmentlist = pluginInterface->attachmentList();
- QVERIFY(!attachmentlist.isEmpty());
-
- UniMessageInfo* att = attachmentlist.at(0);
- QString path = att->path();
-
- QString recepient(TEST_MSG_FROM1);
- QString fromaddress;
- pluginInterface->fromAddress(fromaddress);
- QVERIFY(recepient == fromaddress);
-
- QString body;
- pluginInterface->body(body);
- QVERIFY(!body.isEmpty());
-
- // Compare input message , with the read message
- RFile origFile;
- int op = origFile.Open(iFs, currentFile, EFileRead);
- QVERIFY(op == 0);
-
- TBuf8<1000> readBuf;
- HBufC* readBuf16 = HBufC::NewL(2000);
-
- origFile.Read(readBuf);
- readBuf16->Des().Copy(readBuf);
-
- QString orig = XQConversions::s60DescToQString(*readBuf16);
- origFile.Close();
-
- HBufC* filepath = XQConversions::qStringToS60Desc(path);
-
- RFile file;
- op = file.Open(iFs, *filepath, EFileRead);
- QVERIFY(op == 0);
-
- file.Read(readBuf);
- readBuf16->Des().Copy(readBuf);
- QString bod = XQConversions::s60DescToQString(*readBuf16);
-
- delete readBuf16;
- file.Close();
- // compare Input body and output body
- QVERIFY(bod == orig );
-
- int size = pluginInterface->messageSize();
-
- MsgPriority priority = pluginInterface->messagePriority();
- // Normal priority
- qDebug() << "prority" << priority;
- QVERIFY(priority == 1);
-
- QVERIFY(pluginInterface->timeStamp() == retTimeStamp);
-
- ConvergedMessageAddressList recipientList;
- pluginInterface->toRecipientList(recipientList);
- QVERIFY(recipientList.count() == 0);
- iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
-}
-
-void TestUniDataModelVCalPlugin::testDraftsVCalMessage()
-{
- drafts = ETrue;
- GenerateMessagesL();
-
- pluginInterface = pluginLoader->getDataModelPlugin("bio:vcal");
- pluginInterface->setMessageId(newEntryId);
-
- int count = pluginInterface->attachmentCount();
- QVERIFY(count == 1);
-
- UniMessageInfoList attachmentlist = pluginInterface->attachmentList();
- QVERIFY(!attachmentlist.isEmpty());
-
- UniMessageInfo* att = attachmentlist.at(0);
- QString path = att->path();
-
- QString fromaddress;
- pluginInterface->fromAddress(fromaddress);
- QVERIFY(fromaddress.isEmpty());
-
- QString body;
- pluginInterface->body(body);
- QVERIFY(!body.isEmpty());
-
- // Compare input message , with the read message
- RFile origFile;
- int op = origFile.Open(iFs, currentFile, EFileRead);
- QVERIFY(op == 0);
-
- TBuf8<1000> readBuf;
- HBufC* readBuf16 = HBufC::NewL(2000);
-
- origFile.Read(readBuf);
- readBuf16->Des().Copy(readBuf);
-
- QString orig = XQConversions::s60DescToQString(*readBuf16);
- origFile.Close();
-
- HBufC* filepath = XQConversions::qStringToS60Desc(path);
-
- RFile file;
- op = file.Open(iFs, *filepath, EFileRead);
- QVERIFY(op == 0);
-
- file.Read(readBuf);
-
- readBuf16->Des().Copy(readBuf);
-
- QString bod = XQConversions::s60DescToQString(*readBuf16);
-
- delete readBuf16;
- file.Close();
- // compare Input body and output body
- QVERIFY(bod == orig );
-
- int size = pluginInterface->messageSize();
-
- MsgPriority priority = pluginInterface->messagePriority();
- // Normal priority
- qDebug() << "prority" << priority;
- QVERIFY(priority == 1);
-
- QVERIFY(pluginInterface->timeStamp() == retTimeStamp);
-
- ConvergedMessageAddressList recipientList;
- pluginInterface->toRecipientList(recipientList);
- QString recepient(TEST_MSG_FROM1);
- QString recepient2(TEST_MSG_FROM2);
- QString origalias(TEST_MSG_ALIAS1);
-
- QVERIFY(recipientList.count() == 2);
-
- QVERIFY(recepient == recipientList[0]->address());
-
- QVERIFY( recipientList[0]->alias().isEmpty());
-
- const QString& as = recipientList[1]->address();
- const QString& as1 = recipientList[1]->alias();
- QVERIFY(recepient2 == as);
-
- QVERIFY(origalias == as1);
- iMsvEntry->SetEntryL(KMsvDraftEntryId);
-}
-
-
-
-void TestUniDataModelVCalPlugin::testUnusedAPIs()
-{
- pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
-
- QVERIFY(pluginInterface->objectCount() == 0);
-
- UniMessageInfoList objectlist = pluginInterface->objectList();
- QVERIFY(objectlist.isEmpty());
-
- QVERIFY(pluginInterface->slideCount() == 0);
-
- UniMessageInfoList slidelist = pluginInterface->slideContent(0);
- QVERIFY(slidelist.isEmpty());
-
- QVERIFY(pluginInterface->hasAttachment() == true );
-
- ConvergedMessageAddressList recipientList;
-
- pluginInterface->ccRecipientList(recipientList);
- QVERIFY(recipientList.count() == 0);
-
- pluginInterface->bccRecipientList(recipientList);
- QVERIFY(recipientList.count() == 0);
-}
-
-CMsvEntrySelection* TestUniDataModelVCalPlugin::GenerateMessagesL()
-{
- HBufC* aFileDirectory = KBIOTxtFilePath().AllocL();
- TMsvId messageId;
- TBIOMessageType currentMsgType;
-
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection();
- CleanupStack::PushL(selection);
-
- TInt err = iFs.GetDir(aFileDirectory->Des(),
- KEntryAttMatchMask,
- ESortByName,
- iDir);
- if (err == KErrPathNotFound)
- {
- TInt makeDirErr = iFs.MkDirAll(aFileDirectory->Des());
- makeDirErr == KErrNone ? User::Leave(KErrNotFound)
- : User::Leave(makeDirErr);
- }
- else if (err != KErrNone)
- {
- User::Leave(err);
- }
-
- // Set the session path for the RFs
- SetSessionPath(aFileDirectory->Des());
- if (iDir)
- {
- delete iDir;
- iDir = NULL;
- }
-
- User::LeaveIfError(iFs.GetDir(_L("*.txt"), KEntryAttNormal, ESortByName, iDir));
- TInt count = iDir->Count();
- if (count == 0)
- {
- User::Leave(KErrNotFound); // No files to process
- }
-
- TBuf<60> outputBuf;
-
- for (TInt loop = 0; loop < count; loop++)
- {
- TEntry as = (*iDir)[0];
- currentFile = (as.iName);
- // Not processed all the messages - so keep the current state
- iFilesProcessed++; // Here because need to update the counter promptly
- currentMsgType = SetMessageType(currentFile);
- if (currentMsgType != ENoMessage) // skip any dodgy filenames
- {
- messageId = CreateBIOEntryFromFileL(currentFile, currentMsgType);
- selection->AppendL(messageId);
- TPtrC tempPtr = (currentFile.Des());
-
- }
- }
- CleanupStack::Pop(); // selection
- return selection;
-}
-
-TBIOMessageType TestUniDataModelVCalPlugin::SetMessageType(
- const TDesC& aFileName)
-{
-
- if (aFileName.MatchF(KBIOvCalenderPrefix) == 0)
- {
- return EBiovCalenderMessage;
- }
-
- return ENoMessage;
-}
-
-TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryFromFileL(
- const TDesC& aFilename,
- TBIOMessageType aMessageType)
-{
- //First use the filename to get the message body,
- // then convert '\n' to the paragraph delimiters used in proper SMS
- HBufC* tempBuffer;
-
- tempBuffer = ReadFromFileL(aFilename);
- CleanupStack::PushL(tempBuffer);
-
- newEntryId = CreateBIOEntryL(*tempBuffer, aMessageType);
-
- // Finished with our local descriptors - free up some memory
- CleanupStack::PopAndDestroy();
- return newEntryId;
-}
-
-void TestUniDataModelVCalPlugin::SetSessionPath(const TDesC& aSessionPath)
-{
- iFs.SetSessionPath(aSessionPath);
-}
-
-HBufC* TestUniDataModelVCalPlugin::ReadFromFileL(const TDesC& aFile)
-{
- RFile file;
- TBuf8<1024> lineBuffer;
- TInt err = KErrNone;
-
- err = file.Open(iFs, aFile, EFileStreamText | EFileRead | EFileShareAny);
-
- if (err != KErrNone) // Didn't find the file, so leave - should only get valid filenames!
- {
- User::Leave(KErrNotFound);
- }
-
- HBufC* bioBuf = HBufC::NewLC(65535); // Create a new descriptor on the heap.
- HBufC* copyBuffer = HBufC::NewLC(1024);
-
- do // Read in the text from file, and also check if there is a name field:
- {
- err = file.Read(lineBuffer);// Read upto 256 chars, '\n' and all...
- //err = ReadLineL(file,lineBuffer);
- if (err == KErrNone) // Made a valid read,
- if (lineBuffer.Length() == 0) // but read 0 chars
- err = KErrEof; // so set err value to end processing
-
- if (err == KErrNone)
- {
- copyBuffer->Des().Copy(lineBuffer);// Copy, and overwrite existing text
- if ( (bioBuf->Length() + copyBuffer->Length())
- > bioBuf->Des().MaxLength())
- {
- bioBuf = bioBuf->ReAllocL(bioBuf->Length()
- + copyBuffer->Length());
- }
- bioBuf->Des().Append(*copyBuffer);
- //bioBuf->Des().Append(_L("\n"));
- }
- }while (err != KErrEof);
-
- CleanupStack::PopAndDestroy(); // Destroy the copyBuffer.
- CleanupStack::Pop();// Remove the bioBuf.
-
- file.Close();
- return bioBuf;
-}
-
-TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryL(TDesC& aText,
- TBIOMessageType aMessageType)
-{
- // Ensure that we have a valid service ID to work with:
- TMsvId iBioServiceId;
-
- iBioServiceId = SetBIOServiceIdL();
-
- HBufC* localBuffer = aText.AllocL();
- CleanupStack::PushL(localBuffer);
-
- TPtr messDes = localBuffer->Des();
-
- if (aMessageType != EBiovCardMessage && aMessageType
- != EBiovCalenderMessage)
- {
- // convert \r\n to \n since this is what is expected from SMS when not vCard data
- for (TInt i = 0; i < messDes.Length(); i++)
- {
- if (messDes[i] == (TText) '\r' && i < messDes.Length() - 1
- && messDes[i + 1] == (TText) '\n')
- messDes.Delete(i, 1);
- }
- }
-
- // Create and fill a CRichText object for the jobbie:
- CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
- CleanupStack::PushL(paraFormatLayer);
- CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
- CleanupStack::PushL(charFormatLayer);
- CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer);
- CleanupStack::PushL(richText);
-
- TInt pos = richText->DocumentLength();
- richText->InsertL(pos, messDes);
-
- TMsvEntry newBioEntry;
- newBioEntry.SetNew(ETrue);
- newBioEntry.SetComplete(EFalse);
- newBioEntry.SetUnread(ETrue);
- newBioEntry.SetVisible(ETrue);
- newBioEntry.SetReadOnly(EFalse);
- newBioEntry.SetFailed(EFalse);
- newBioEntry.SetOperation(EFalse);
- newBioEntry.SetMultipleRecipients(EFalse);
- newBioEntry.SetAttachment(EFalse);
- newBioEntry.iMtm = KUidBIOMessageTypeMtm;
- newBioEntry.iType = KUidMsvMessageEntry;
- newBioEntry.iServiceId = iBioServiceId;
- TTime now;
- now.UniversalTime();
- newBioEntry.iDate = now;
-
- TTime unixEpoch(KUnixEpoch);
- TTimeIntervalSeconds seconds;
- TTime timeStamp = newBioEntry.iDate;
- timeStamp.SecondsFrom(unixEpoch, seconds);
- retTimeStamp.setTime_t(seconds.Int());
-
- newBioEntry.iDescription.Set(richText->Read(0, richText->DocumentLength()));
- TBufC<KTelephoneNumberMaxLength> telNumber;
-
- QString recepient(TEST_MSG_FROM1);
- tempNumber = XQConversions::qStringToS60Desc(recepient);
-
- telNumber = tempNumber->Des();
- newBioEntry.iDetails.Set(telNumber);
-
- SetForMtmTypeL(newBioEntry, aMessageType);
-
- newBioEntry.iSize = richText->DocumentLength();// msgSize;
- CreateBioEntryClientSideL(newBioEntry, *richText);
-
- CleanupStack::PopAndDestroy(4); // richText, charFormatLayer, paraFormatLayer, localBuffer
- return newBioEntry.Id();
-}
-
-void TestUniDataModelVCalPlugin::CreateBioEntryClientSideL(TMsvEntry& aEntry,
- CRichText& aBody)
-{
- if (inbox)
- {
- iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
- }
- else if (drafts)
- {
- iMsvEntry->SetEntryL(KMsvDraftEntryId);
- }
- // Get the global inbox.
-
- iMsvEntry->CreateL(aEntry);
- iMsvEntry->SetEntryL(aEntry.Id());
-
- // Save all the changes
- CMsvStore* store = iMsvEntry->EditStoreL();
- CleanupStack::PushL(store);
-
- if (store->HasBodyTextL())
- {
- store->DeleteBodyTextL();
- }
-
- CPlainText* pText = CPlainText::NewL();
- CleanupStack::PushL(pText);
-
- if (inbox)
- {
- CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *pText);
- CleanupStack::PushL(smsHeader);
- smsHeader->SetFromAddressL(*tempNumber);
- smsHeader->StoreL(*store);
-
- }
- else if (drafts)
- {
-
- QString recepient(TEST_MSG_FROM1);
- QString recepient2(TEST_MSG_FROM2);
- QString alias(TEST_MSG_ALIAS1);
-
- HBufC* addr = XQConversions::qStringToS60Desc(recepient);
- HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2);
- HBufC* alias1 = XQConversions::qStringToS60Desc(alias);
-
- CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsSubmit, *pText);
- CleanupStack::PushL(smsHeader);
-
- CSmsNumber* number1 = CSmsNumber::NewL(); // create the instance
- CleanupStack::PushL(number1);
-
- number1->SetNameL(TPtrC());
- number1->SetAddressL(*addr);
- smsHeader->Recipients().AppendL(number1);
- CleanupStack::Pop(number1);
-
- CSmsNumber* number2 = CSmsNumber::NewL();
- CleanupStack::PushL(number2);
-
- number2->SetNameL(*alias1);
- number2->SetAddressL(*addr2);
-
- smsHeader->Recipients().AppendL(number2);
- CleanupStack::Pop(number2);
- smsHeader->StoreL(*store);
-
- }
-
- store->StoreBodyTextL(aBody);
- store->CommitL();
-
- CleanupStack::PopAndDestroy(3); //store - close the store
-
- aEntry.SetComplete(ETrue);
- // Update the entry
- iMsvEntry->ChangeL(aEntry);
- iMsvEntry->SetEntryL(KMsvRootIndexEntryId);
-}
-
-TMsvId TestUniDataModelVCalPlugin::SetBIOServiceIdL()
-{
- // Haven't found an entry so create a BIO Message service:
- TMsvEntry bioServiceEntry;
- bioServiceEntry.iMtm = KUidBIOMessageTypeMtm;
- bioServiceEntry.iType = KUidMsvServiceEntry;
- bioServiceEntry.SetVisible(EFalse);
- bioServiceEntry.iDate.UniversalTime();
- bioServiceEntry.iDescription.Set(_L("BIO Message Service ")); // Is there such a thing?
- bioServiceEntry.iDetails.Set(_L("BIO Message Service"));
-
- TMsvId newBIOServiceId;
-
- iMsvEntry->SetEntryL(KMsvRootIndexEntryId);
- iMsvEntry->CreateL(bioServiceEntry); // Needs to be a child of the root!
- newBIOServiceId = bioServiceEntry.Id();
-
- return newBIOServiceId;
-}
-
-void TestUniDataModelVCalPlugin::SetForMtmTypeL(TMsvEntry& aEntry,
- TBIOMessageType aType)
-{
- TInt index;
-
- aEntry.iBioType = KUidBIOVCalenderMsg;
-
- // Set other TMsvEntry fields if we have a BIO message type
- if (aType != ENoMessage)
- {
- aEntry.SetMtmData2(0);
- aEntry.SetMtmData3(0);
- }
-
- // set description from BIF file
- iBioDb->GetBioIndexWithMsgIDL(TUid::Uid(aEntry.iBioType), index);
- if (index == KErrNotFound)
- User::Leave(KErrNotFound);
- aEntry.iDescription.Set(iBioDb->BifReader(index).Description());
-}
-
-void MsgObserver::HandleSessionEventL(TMsvSessionEvent /*aEvent*/,
- TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/)
-{
-}
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef TEST_UNI_DATA_MODEL_VCAL_PLUGIN_H
-#define TEST_UNI_DATA_MODEL_VCAL_PLUGIN_H
-
-#ifdef BUILD_TEST_DLL
-#define TEST_EXPORT Q_DECL_EXPORT
-#else
-#define TEST_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <txtetext.h>
-#include <txtrich.h>
-#include <mtclreg.h>
-#include <mtclbase.h>
-#include <msvids.h>
-#include <smsclnt.h>
-#include <smuthdr.h>
-#include <QDateTime>
-#include <e32math.h>
-
-
-#include <bsp.h>
-
-const TInt32 KUidBIOVCalenderMsg = {0x10005533}; // VCalender diary
-
-class UniDataModelPluginInterface;
-class UniDataModelLoader;
-class MsgObserver;
-
-class ConvergedMessage;
-class CBIODatabase;
-
-
-typedef enum
- { // GENERATE A MESSAGE USING....
- ENoMessage, // .. error cases
- EBioIapSettingsMessage, // .. IAP grammar, includes Internet settings
- // Email settings, and logon scripts,
- EBioEnpMessage, // .. Email Notification grammar.
- EBioRingTonesMessage, // .. Ringing Tones binary data
- EBioOpLogoMessage, // .. Logo for Operator service
- EBioCompBusCardMessage, // .. Compact Business Card data
- EBiovCardMessage, // .. virtual business card data
- EBiovCalenderMessage, // .. vCalender data
- EBioWAPSettingsMessage, // .. wap settings
- EBioWPRVSettingsMessage // .. wprv settings
- } TBIOMessageType;
-
-
-class TEST_EXPORT TestUniDataModelVCalPlugin : public QObject
-{
-Q_OBJECT
-
-private slots:
- //called by frame work.
- void initTestCase();//called before the first testfunction is executed.
- void cleanupTestCase();//called after the last testfunction was executed.
- void init();//called before each testfunction is executed.
- void cleanup();//called after every testfunction.
- //test cases.
- void testInBoxVCalMessage();
- void testDraftsVCalMessage();
- void testUnusedAPIs();
-
-private:
- TMsvId CreateBIOEntryL(TDesC& aText, TBIOMessageType aMessageType);
- void CreateBioEntryClientSideL(TMsvEntry& aEntry, CRichText& aBody);
- HBufC* ReadFromFileL(const TDesC& aFile);
- void SetSessionPath(const TDesC& aSessionPath);
- TMsvId CreateBIOEntryFromFileL(const TDesC& aFilename,
- TBIOMessageType aMessageType);
- TBIOMessageType SetMessageType(const TDesC& aFileName);
- CMsvEntrySelection* GenerateMessagesL();
- TMsvId SetBIOServiceIdL();
- void SetForMtmTypeL(TMsvEntry& aEntry, TBIOMessageType aType);
-
-private:
- UniDataModelPluginInterface* pluginInterface;
- MsgObserver* iObserver;
- CMsvSession* iMSession;
- CClientMtmRegistry* iMtmReg;
- TMsvId messageId;
- UniDataModelLoader* pluginLoader;
- QDateTime retTimeStamp;
- RFs iFs;
- CDir* iDir;
- TInt iFilesProcessed;
- CMsvEntry* iMsvEntry;
- CBIODatabase* iBioDb;
- TMsvId newEntryId;
- HBufC* tempNumber;
- TBufC<KMaxFileName> currentFile;
- TBool inbox;
- TBool drafts;
-};
-
-class MsgObserver : public MMsvSessionObserver
-{
-public:
- void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2,
- TAny* aArg3);
-};
-
-#endif //TEST_UNI_DATA_MODEL_VCAL_PLUGIN_H
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.ini Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-//this file is used to provide predefined set of input data.
-
-//eg.
-const char TEST_MSG_BODY[] = "This string is message body test string";
-const char TEST_MSG_RECIEPIENT[] = "Javaid Nabi<9741596546>";
-const char TEST_MSG_FROM1[] = "9741596546";
-const char TEST_MSG_ALIAS1[] = "Javaid Nabi";
-const char TEST_MSG_FROM2[] = "9797979797";
-const char TEST_MSG_ALIAS2[] = "Rajesh Batchu";
-const char TEST_MSG_SUBJECT[] = "Message Subject";
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro Wed Aug 18 09:45:25 2010 +0300
@@ -17,23 +17,28 @@
QT += testlib
QT -= gui
-TEMPLATE = lib
-TARGET = test-unidatamodel-vcal-plugin
+TEMPLATE = app
+TARGET = testunidatamodelvcalplugin
+CONFIG += hb
+CONFIG += symbian_test
+CONFIG += qtestlib
INCLUDEPATH += .
INCLUDEPATH += ../../../../../../inc
+INCLUDEPATH += ../../../../../../../inc
+INCLUDEPATH += ../../../../../../../../../../epoc32/include/platform/mw
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
DEFINES += BUILD_TEST_DLL
SOURCES += \
- testunidatamodelvcalplugin.cpp
+ src/testunidatamodelvcalplugin.cpp
# Input
HEADERS += \
- testunidatamodelvcalplugin.h
+ inc/testunidatamodelvcalplugin.h
@@ -45,16 +50,45 @@
TARGET.EPOCALLOWDLLDATA = 1
BLD_INF_RULES.prj_exports += "vcal1.txt /epoc32/winscw/c/test/vcal1.txt"
BLD_INF_RULES.prj_exports += "BioMtm.rsc /epoc32/winscw/c/resource/messaging/mtm/BioMtm.rsc"
- }
+ BLD_INF_RULES.prj_exports += "data/TestUniDataModelVCalPlugin.cfg c:/TestUniDataModelVCalPlugin.cfg"
+ BLD_INF_RULES.prj_exports += "data/TestUniDataModelVCalPlugin.pl c:/TestUniDataModelVCalPlugin.pl"
+ }
+
+
+packageheader = "$${LITERAL_HASH}{\"testunidatamodelvcalplugin\"},(0xE2815e10),1,0,0,TYPE=SA"
-defBlock = \
- "$${LITERAL_HASH}if defined(EABI)" \
- "DEFFILE ../eabi/test_unidatamodel_vcal_plugin.def" \
- "$${LITERAL_HASH}else" \
- "DEFFILE ../bwins/test_unidatamodel_vcal_plugin.def" \
- "$${LITERAL_HASH}endif"
-
-MMP_RULES += defBlock
+vendorinfo = \
+ "; Localised Vendor name" \
+ "%{\"Nokia\"}" \
+ "; Unique Vendor name" \
+ ":\"Nokia\""
+
+dependencyinfo = \
+ "; Default HW/platform dependencies" \
+ "[0x101F7961],0,0,0,{\"S60ProductID\"}" \
+ "[0x2001E61C],4,6,3,{"Qt"}
+
+default_deployment.pkg_prerules = packageheader \
+ vendorinfo \
+ dependencyinfo
+
+
+#Copy the dependent DLL
+symbian: {
+ addCfg.sources = ./data/TestUniDataModelVCalPlugin.cfg
+ addCfg.path = C:/
+ DEPLOYMENT += addCfg
+
+ addPl.sources = ./data/TestUniDataModelVCalPlugin.pl
+ addPl.path = C:/
+ DEPLOYMENT += addPl
+
+ addP2.sources = ./vcal1.txt
+ addP2.path = C:/test
+ DEPLOYMENT += addP2
+
+ }
+
LIBS += -leuser \
-lconvergedmessageutils\
@@ -68,7 +102,7 @@
-lbioc \
-lefsrv \
-lbiodb \
- -lbifu \
- -lxqutils
+ -lxqutils \
+ -lbifu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/tsrc.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+CONFIG += symbian_test
+
+#Sub .pro files
+SUBDIRS += testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro
+
+
+# Platforms
+SYMBIAN_PLATFORMS = DEFAULT
\ No newline at end of file
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/inc/unimmsdataplugin_p.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/inc/unimmsdataplugin_p.h Wed Aug 18 09:45:25 2010 +0300
@@ -36,7 +36,7 @@
/**
* Symbian specific implementation of the uni MMS plugin
*/
-class UniMMSDataPluginPrivate : public MUniDataModelObserver, public MMsvSessionObserver
+class UniMMSDataPluginPrivate :public CBase, public MUniDataModelObserver, public MMsvSessionObserver
{
public:
/**
@@ -165,11 +165,11 @@
- /**
- * Subject of the message
- * @QString subject
- */
- QString subject();
+ /**
+ * Subject of the message
+ * @QString subject
+ */
+ QString subjectL();
/**
* Session with the Messaging server
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -23,7 +23,7 @@
UniMMSDataPlugin::UniMMSDataPlugin(QObject* parent) :
QObject(parent)
{
- d_ptr = new UniMMSDataPluginPrivate();
+ d_ptr = q_check_ptr (new UniMMSDataPluginPrivate());
}
UniMMSDataPlugin::~UniMMSDataPlugin()
@@ -138,11 +138,14 @@
int error;
TRAP(error,d_ptr->restoreL(mtm));
QDEBUG_WRITE_FORMAT("Exiting restore with error= ",error);
+ qt_symbian_throwIfError(error);
}
QString UniMMSDataPlugin::subject()
{
- return d_ptr->subject();
+ QString subject;
+ TRAPD(err, subject =d_ptr->subjectL());
+ return subject;
}
CMsvSession* UniMMSDataPlugin::session()
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin_p.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin_p.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -127,7 +127,7 @@
}
-QString UniMMSDataPluginPrivate::subject()
+QString UniMMSDataPluginPrivate::subjectL()
{
TPtrC sub = mMmsClient->SubjectL();
return XQConversions::s60DescToQString(sub);
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/inc/unismsdataplugin_p.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/inc/unismsdataplugin_p.h Wed Aug 18 09:45:25 2010 +0300
@@ -32,7 +32,7 @@
/**
* Symbian specific implementation of the uni SMS plugin
*/
-class UniSMSDataPluginPrivate :public MMsvSessionObserver
+class UniSMSDataPluginPrivate :public CBase, public MMsvSessionObserver
{
public:
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/src/unismsdataplugin.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/src/unismsdataplugin.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -30,7 +30,7 @@
UniSMSDataPlugin::UniSMSDataPlugin(QObject* parent) :
QObject(parent)
{
- d_ptr = new UniSMSDataPluginPrivate(this);
+ d_ptr = q_check_ptr(new UniSMSDataPluginPrivate(this));
}
//---------------------------------------------------------------
--- a/messagingapp/msgutils/unieditorutils/bwins/editorgenutilsu.def Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/bwins/editorgenutilsu.def Wed Aug 18 09:45:25 2010 +0300
@@ -10,21 +10,22 @@
?DoCancel@CMuiuOperationWait@@MAEXXZ @ 9 NONAME ; void CMuiuOperationWait::DoCancel(void)
?MaxMmsMsgSizeL@UniEditorGenUtils@@QAEHXZ @ 10 NONAME ; int UniEditorGenUtils::MaxMmsMsgSizeL(void)
??_ECMuiuOperationWait@@UAE@I@Z @ 11 NONAME ; CMuiuOperationWait::~CMuiuOperationWait(unsigned int)
- ?ReplaceCharacters@UniEditorGenUtils@@QAEXAAVTDes16@@ABVTDesC16@@VTChar@@@Z @ 12 NONAME ; void UniEditorGenUtils::ReplaceCharacters(class TDes16 &, class TDesC16 const &, class TChar)
- ?NumberToBase@UniEditorGenUtils@@QAE?AVTChar@@V2@@Z @ 13 NONAME ; class TChar UniEditorGenUtils::NumberToBase(class TChar)
- ?IsValidEmailAddress@UniEditorGenUtils@@QAEHABVTDesC16@@@Z @ 14 NONAME ; int UniEditorGenUtils::IsValidEmailAddress(class TDesC16 const &)
- ?ConvertDigitsTo@UniEditorGenUtils@@QAEXAAVTDes16@@W4TDigitType@@@Z @ 15 NONAME ; void UniEditorGenUtils::ConvertDigitsTo(class TDes16 &, enum TDigitType)
- ?NewLC@CMuiuOperationWait@@SAPAV1@H@Z @ 16 NONAME ; class CMuiuOperationWait * CMuiuOperationWait::NewLC(int)
- ?RunL@CMuiuOperationWait@@MAEXXZ @ 17 NONAME ; void CMuiuOperationWait::RunL(void)
- ?getFileInfoL@UniEditorGenUtils@@QAEXVQString@@AAHAAV2@AAW4TMsgMediaType@@@Z @ 18 NONAME ; void UniEditorGenUtils::getFileInfoL(class QString, int &, class QString &, enum TMsgMediaType &)
- ?MaxMmsRecipientsL@UniEditorGenUtils@@QAEHXZ @ 19 NONAME ; int UniEditorGenUtils::MaxMmsRecipientsL(void)
- ??1CMuiuOperationWait@@UAE@XZ @ 20 NONAME ; CMuiuOperationWait::~CMuiuOperationWait(void)
- ?VerifyEmailAddressesL@UniEditorGenUtils@@QAEHV?$QList@PAVConvergedMessageAddress@@@@@Z @ 21 NONAME ; int UniEditorGenUtils::VerifyEmailAddressesL(class QList<class ConvergedMessageAddress *>)
- ?WriteEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHABVTDes16@@0ABH@Z @ 22 NONAME ; int UniEditorGenUtils::WriteEmailOverSmsSettingsL(class TDes16 const &, class TDes16 const &, int const &)
- ?ReadEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHAAVTDes16@@0AAH@Z @ 23 NONAME ; int UniEditorGenUtils::ReadEmailOverSmsSettingsL(class TDes16 &, class TDes16 &, int &)
- ?absoluteMaxSmsPartsL@UniEditorGenUtils@@AAEHXZ @ 24 NONAME ; int UniEditorGenUtils::absoluteMaxSmsPartsL(void)
- ?UTF8Size@UniEditorGenUtils@@QAEHVQString@@@Z @ 25 NONAME ; int UniEditorGenUtils::UTF8Size(class QString)
- ?IsPhoneOfflineL@UniEditorGenUtils@@QAEHXZ @ 26 NONAME ; int UniEditorGenUtils::IsPhoneOfflineL(void)
- ??1UniEditorGenUtils@@QAE@XZ @ 27 NONAME ; UniEditorGenUtils::~UniEditorGenUtils(void)
- ?AcceptEmailAddressesL@UniEditorGenUtils@@QAEHXZ @ 28 NONAME ; int UniEditorGenUtils::AcceptEmailAddressesL(void)
+ ??_EUniEditorGenUtils@@UAE@I@Z @ 12 NONAME ; UniEditorGenUtils::~UniEditorGenUtils(unsigned int)
+ ?ReplaceCharacters@UniEditorGenUtils@@QAEXAAVTDes16@@ABVTDesC16@@VTChar@@@Z @ 13 NONAME ; void UniEditorGenUtils::ReplaceCharacters(class TDes16 &, class TDesC16 const &, class TChar)
+ ?NumberToBase@UniEditorGenUtils@@QAE?AVTChar@@V2@@Z @ 14 NONAME ; class TChar UniEditorGenUtils::NumberToBase(class TChar)
+ ?IsValidEmailAddress@UniEditorGenUtils@@QAEHABVTDesC16@@@Z @ 15 NONAME ; int UniEditorGenUtils::IsValidEmailAddress(class TDesC16 const &)
+ ?ConvertDigitsTo@UniEditorGenUtils@@QAEXAAVTDes16@@W4TDigitType@@@Z @ 16 NONAME ; void UniEditorGenUtils::ConvertDigitsTo(class TDes16 &, enum TDigitType)
+ ?NewLC@CMuiuOperationWait@@SAPAV1@H@Z @ 17 NONAME ; class CMuiuOperationWait * CMuiuOperationWait::NewLC(int)
+ ?RunL@CMuiuOperationWait@@MAEXXZ @ 18 NONAME ; void CMuiuOperationWait::RunL(void)
+ ?getFileInfoL@UniEditorGenUtils@@QAEXVQString@@AAHAAV2@AAW4TMsgMediaType@@@Z @ 19 NONAME ; void UniEditorGenUtils::getFileInfoL(class QString, int &, class QString &, enum TMsgMediaType &)
+ ??1UniEditorGenUtils@@UAE@XZ @ 20 NONAME ; UniEditorGenUtils::~UniEditorGenUtils(void)
+ ?MaxMmsRecipientsL@UniEditorGenUtils@@QAEHXZ @ 21 NONAME ; int UniEditorGenUtils::MaxMmsRecipientsL(void)
+ ??1CMuiuOperationWait@@UAE@XZ @ 22 NONAME ; CMuiuOperationWait::~CMuiuOperationWait(void)
+ ?VerifyEmailAddressesL@UniEditorGenUtils@@QAEHV?$QList@PAVConvergedMessageAddress@@@@@Z @ 23 NONAME ; int UniEditorGenUtils::VerifyEmailAddressesL(class QList<class ConvergedMessageAddress *>)
+ ?WriteEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHABVTDes16@@0ABH@Z @ 24 NONAME ; int UniEditorGenUtils::WriteEmailOverSmsSettingsL(class TDes16 const &, class TDes16 const &, int const &)
+ ?ReadEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHAAVTDes16@@0AAH@Z @ 25 NONAME ; int UniEditorGenUtils::ReadEmailOverSmsSettingsL(class TDes16 &, class TDes16 &, int &)
+ ?absoluteMaxSmsPartsL@UniEditorGenUtils@@AAEHXZ @ 26 NONAME ; int UniEditorGenUtils::absoluteMaxSmsPartsL(void)
+ ?UTF8Size@UniEditorGenUtils@@QAEHVQString@@@Z @ 27 NONAME ; int UniEditorGenUtils::UTF8Size(class QString)
+ ?IsPhoneOfflineL@UniEditorGenUtils@@QAEHXZ @ 28 NONAME ; int UniEditorGenUtils::IsPhoneOfflineL(void)
+ ?AcceptEmailAddressesL@UniEditorGenUtils@@QAEHXZ @ 29 NONAME ; int UniEditorGenUtils::AcceptEmailAddressesL(void)
--- a/messagingapp/msgutils/unieditorutils/eabi/editorgenutilsu.def Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/eabi/editorgenutilsu.def Wed Aug 18 09:45:25 2010 +0300
@@ -20,17 +20,20 @@
_ZN17UniEditorGenUtils8UTF8SizeE7QString @ 19 NONAME
_ZN17UniEditorGenUtilsC1Ev @ 20 NONAME
_ZN17UniEditorGenUtilsC2Ev @ 21 NONAME
- _ZN17UniEditorGenUtilsD1Ev @ 22 NONAME
- _ZN17UniEditorGenUtilsD2Ev @ 23 NONAME
- _ZN18CMuiuOperationWait4RunLEv @ 24 NONAME
- _ZN18CMuiuOperationWait5NewLCEi @ 25 NONAME
- _ZN18CMuiuOperationWait5StartEv @ 26 NONAME
- _ZN18CMuiuOperationWait8DoCancelEv @ 27 NONAME
- _ZN18CMuiuOperationWaitC1Ei @ 28 NONAME
- _ZN18CMuiuOperationWaitC2Ei @ 29 NONAME
- _ZN18CMuiuOperationWaitD0Ev @ 30 NONAME
- _ZN18CMuiuOperationWaitD1Ev @ 31 NONAME
- _ZN18CMuiuOperationWaitD2Ev @ 32 NONAME
- _ZTI18CMuiuOperationWait @ 33 NONAME
- _ZTV18CMuiuOperationWait @ 34 NONAME
+ _ZN17UniEditorGenUtilsD0Ev @ 22 NONAME
+ _ZN17UniEditorGenUtilsD1Ev @ 23 NONAME
+ _ZN17UniEditorGenUtilsD2Ev @ 24 NONAME
+ _ZN18CMuiuOperationWait4RunLEv @ 25 NONAME
+ _ZN18CMuiuOperationWait5NewLCEi @ 26 NONAME
+ _ZN18CMuiuOperationWait5StartEv @ 27 NONAME
+ _ZN18CMuiuOperationWait8DoCancelEv @ 28 NONAME
+ _ZN18CMuiuOperationWaitC1Ei @ 29 NONAME
+ _ZN18CMuiuOperationWaitC2Ei @ 30 NONAME
+ _ZN18CMuiuOperationWaitD0Ev @ 31 NONAME
+ _ZN18CMuiuOperationWaitD1Ev @ 32 NONAME
+ _ZN18CMuiuOperationWaitD2Ev @ 33 NONAME
+ _ZTI17UniEditorGenUtils @ 34 NONAME
+ _ZTI18CMuiuOperationWait @ 35 NONAME
+ _ZTV17UniEditorGenUtils @ 36 NONAME
+ _ZTV18CMuiuOperationWait @ 37 NONAME
--- a/messagingapp/msgutils/unieditorutils/editorgenutils/inc/UniEditorGenUtils.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/editorgenutils/inc/UniEditorGenUtils.h Wed Aug 18 09:45:25 2010 +0300
@@ -45,7 +45,7 @@
class CMsgMediaResolver;
// CLASS DECLARATION
-class MUIU_UTILS_EXPORT UniEditorGenUtils
+class MUIU_UTILS_EXPORT UniEditorGenUtils :public CBase
{
public:
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h Wed Aug 18 09:45:25 2010 +0300
@@ -210,6 +210,26 @@
*/
void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2,
TAny* aArg3);
+
+ /**
+ * Populate sender address (for reply/replyAll case)
+ */
+ void populateSenderL(ConvergedMessage& aMessage);
+
+ /**
+ * Populates converged message for reply case
+ */
+ void convertFromReplyHandlerL(ConvergedMessage* aMessage);
+
+ /**
+ * Populates converged message for replyAll case
+ */
+ void convertFromReplyAllHandlerL(ConvergedMessage* aMessage);
+
+ /**
+ * Populates converged message for default case
+ */
+ void convertFromDefaultHandlerL(ConvergedMessage* aMessage);
private:
// Data
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -28,8 +28,7 @@
QObject(parent)
{
int error;
- TRAP( error, d_ptr = CUniEditorMmsPluginPrivate::NewL());
- QDEBUG_WRITE_FORMAT("UniEditorMmsPlugin returning with ",error);
+ QT_TRAP_THROWING( d_ptr = CUniEditorMmsPluginPrivate::NewL());
}
//---------------------------------------------------------------
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -43,6 +43,7 @@
#include "UniSendingSettings.h"
#include "unidatamodelloader.h"
#include "unidatamodelplugininterface.h"
+#include "msgcontacthandler.h"
#include <xqconversions.h>
#include "debugtraces.h"
#include "UniEditorGenUtils.h"
@@ -62,6 +63,7 @@
const TUid KSenduiMtmMmsUid = {KSenduiMtmMmsUidValue};
#define LOC_FWD hbTrId("txt_messaging_formlabel_fwd")
+#define LOC_RE hbTrId("txt_messaging_formlabel_re")
// -----------------------------------------------------------------------------
// Two-phased constructor.
@@ -139,6 +141,18 @@
{
convertFromForwardHandlerL(*msg);
}
+ else if(aOperation == UniEditorPluginInterface::Reply)
+ {
+ convertFromReplyHandlerL(msg);
+ }
+ else if(aOperation == UniEditorPluginInterface::ReplyAll)
+ {
+ convertFromReplyAllHandlerL(msg);
+ }
+ else if(aOperation == UniEditorPluginInterface::Default)
+ {
+ convertFromDefaultHandlerL(msg);
+ }
CleanupStack::Pop(msg);
QDEBUG_WRITE("Exit convertFromL");
return msg;
@@ -275,11 +289,18 @@
if( slideContentList.at(i)->mimetype().contains("text") )
{
QString textContent;
+ QByteArray textArray;
QFile file(slideContentList.at(i)->path());
if (file.open(QIODevice::ReadOnly)) {
- textContent = file.readAll();
+ textArray = file.readAll();
+ char *data = new char[textArray.size()+1];
+ strcpy(data,textArray.data());
+ //This is needed since MMS text content
+ //is stored in UTF8 format
+ textContent = textContent.fromUtf8(data,strlen(data));
aMessage.setBodyText(textContent);
file.close();
+ delete []data;
}
else {
return;
@@ -945,7 +966,7 @@
{
}
-
+// -----------------------------------------------------------------------------
// HandleSessionEventL
// @see Header
// -----------------------------------------------------------------------------
@@ -957,4 +978,202 @@
// do nothing
}
+// -----------------------------------------------------------------------------
+// populateSenderL
+// @see Header
+// -----------------------------------------------------------------------------
+//
+void CUniEditorMmsPluginPrivate::populateSenderL(
+ ConvergedMessage& aMessage)
+ {
+ // get sender address
+ HBufC* fromAddress = (MmsMtmL()->Sender()).AllocLC();
+ HBufC* pureAddr = TMmsGenUtils::PureAddress(*fromAddress).AllocLC();
+ HBufC* aliasAddr = TMmsGenUtils::Alias(*fromAddress).AllocLC();
+
+ if(pureAddr->Length() > 0)
+ {
+ ConvergedMessageAddress messageAddress(
+ XQConversions::s60DescToQString(*pureAddr),
+ XQConversions::s60DescToQString(*aliasAddr));
+ aMessage.addToRecipient(messageAddress);
+ }
+ CleanupStack::PopAndDestroy(3, fromAddress );
+ }
+
+// -----------------------------------------------------------------------------
+// convertFromReplyHandlerL
+// @see Header
+// -----------------------------------------------------------------------------
+//
+void CUniEditorMmsPluginPrivate::convertFromReplyHandlerL(
+ ConvergedMessage* aMessage)
+ {
+ // for received mms, populate sender address into To-field
+ // for sent mms, populate recipients into To-field
+ TMsvEntry entry = MmsMtmL()->Entry().Entry();
+ if( entry.Parent() == KMsvGlobalInBoxIndexEntryIdValue )
+ {
+ populateSenderL(*aMessage);
+ }
+ else
+ {
+ populateRecipientsL(*aMessage);
+ }
+
+ // resolve contacts
+ ConvergedMessageAddressList addrList = aMessage->toAddressList();
+ int addrCount = addrList.count();
+ for(int i=0; i<addrCount; i++)
+ {
+ ConvergedMessageAddress* addr = addrList.at(i);
+ // resolve contact if alias is empty
+ if(addr->alias().isEmpty())
+ {
+ QString alias;
+ int count;
+ int localId =
+ MsgContactHandler::resolveContactDisplayName(
+ addr->address(), alias, count);
+ addr->setAlias(alias);
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// convertFromReplyAllHandlerL
+// @see Header
+// -----------------------------------------------------------------------------
+//
+void CUniEditorMmsPluginPrivate::convertFromReplyAllHandlerL(
+ ConvergedMessage* aMessage)
+ {
+ // populate all recipients (and sender for received mms)
+ TMsvEntry entry = MmsMtmL()->Entry().Entry();
+ if( entry.Parent() == KMsvGlobalInBoxIndexEntryIdValue )
+ {
+ populateSenderL(*aMessage);
+ }
+ populateRecipientsL(*aMessage);
+
+ // resolve to-field contacts
+ ConvergedMessageAddressList addrList = aMessage->toAddressList();
+ int addrCount = addrList.count();
+ for(int i=0; i<addrCount; i++)
+ {
+ ConvergedMessageAddress* addr = addrList.at(i);
+ // resolve contact if alias is empty
+ if(addr->alias().isEmpty())
+ {
+ QString alias;
+ int count;
+ int localId =
+ MsgContactHandler::resolveContactDisplayName(
+ addr->address(), alias, count);
+ addr->setAlias(alias);
+ }
+ }
+
+ // resolve cc-field contacts
+ addrList = aMessage->ccAddressList();
+ addrCount = addrList.count();
+ for(int i=0; i<addrCount; i++)
+ {
+ ConvergedMessageAddress* addr = addrList.at(i);
+ // resolve contact if alias is empty
+ if(addr->alias().isEmpty())
+ {
+ QString alias;
+ int count;
+ int localId =
+ MsgContactHandler::resolveContactDisplayName(
+ addr->address(), alias, count);
+ addr->setAlias(alias);
+ }
+ }
+
+ // resolve bcc-field contacts
+ addrList = aMessage->bccAddressList();
+ addrCount = addrList.count();
+ for(int i=0; i<addrCount; i++)
+ {
+ ConvergedMessageAddress* addr = addrList.at(i);
+ // resolve contact if alias is empty
+ if(addr->alias().isEmpty())
+ {
+ QString alias;
+ int count;
+ int localId =
+ MsgContactHandler::resolveContactDisplayName(
+ addr->address(), alias, count);
+ addr->setAlias(alias);
+ }
+ }
+
+ // populate the subject field
+ QString subject = XQConversions::s60DescToQString(
+ MmsMtmL()->SubjectL());
+ if(!subject.startsWith(LOC_RE, Qt::CaseInsensitive))
+ {
+ subject.insert(0, LOC_RE);
+ }
+ aMessage->setSubject(subject);
+ }
+
+// -----------------------------------------------------------------------------
+// convertFromDefaultHandlerL
+// @see Header
+// -----------------------------------------------------------------------------
+void CUniEditorMmsPluginPrivate::convertFromDefaultHandlerL(ConvergedMessage* aMessage)
+{
+ QDEBUG_WRITE("Enter convertFromDefaultHandlerL");
+
+ TMsvEntry entry = MmsMtmL()->Entry().Entry();
+
+ if( entry.Parent() == KMsvGlobalInBoxIndexEntryIdValue )
+ {
+ // get sender address
+ HBufC* fromAddress = (MmsMtmL()->Sender()).AllocLC();
+ HBufC* pureAddr = TMmsGenUtils::PureAddress(*fromAddress).AllocLC();
+ HBufC* aliasAddr = TMmsGenUtils::Alias(*fromAddress).AllocLC();
+
+ if(pureAddr->Length() > 0)
+ {
+ ConvergedMessageAddress messageAddress(
+ XQConversions::s60DescToQString(*pureAddr),
+ XQConversions::s60DescToQString(*aliasAddr));
+ aMessage->addFromRecipient(messageAddress);
+ }
+ CleanupStack::PopAndDestroy(3, fromAddress );
+ }
+ else
+ {
+ populateRecipientsL(*aMessage);
+ }
+
+ //populate convergedmessage with the subject prepended with FW:
+ QString subject = XQConversions::s60DescToQString(MmsMtmL()->SubjectL());
+ aMessage->setSubject(subject);
+
+ // Priority
+ TMsvPriority priority = entry.Priority();
+ if( EMsvHighPriority == priority )
+ {
+ aMessage->setPriority(ConvergedMessage::High);
+ }
+ else if( EMsvLowPriority == priority )
+ {
+ aMessage->setPriority(ConvergedMessage::Low);
+ }
+ else if( EMsvMediumPriority == priority )
+ {
+ aMessage->setPriority(ConvergedMessage::Normal);
+ }
+
+ //Populate body and attachments
+ //The region info inside slides is not maintained
+ populateMessageBodyL(*aMessage);
+
+ QDEBUG_WRITE("Exit convertFromDefaultHandlerL");
+}
// End of File
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmsreadfile.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,471 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSREADFILE_H
-#define MMSREADFILE_H
-
-// INCLUDES
-#include <e32base.h>
-#include <badesca.h>
-#include <f32file.h>
-#include <msvstd.h>
-
-// forward references
-class CMmsAttaStructure;
-class CMmsHeaders;
-class CEikonEnv;
-class CMmsClientMtm;
-
-// Out-of-range value for any MMS header with assigned number
-// Used in coverage tests to get coverage for "default" branches
-// in "case" statements.
-const TInt KMmsTestIllegalValue = 255;
-
-//
-// TEST KEY WORDS
-// Extended to include all MMS headers to allow generation of arbitrary PDUs
-// Content type header cannot be separately defined,
-// it will always be "multipat/mixed" or "multipart/related"
-_LIT8( KTestEndOfFile, "EOF" );
-_LIT8( KTestNewMessage, "MESSAGE BEGIN" );
-//------------------------------------------------
-_LIT8( KTestMessageType, "MESSAGE-TYPE" ); //X-Mms-Message-Type
-_LIT8( KTestDate, "DATE" ); // Date
-_LIT8( KTestFrom, "FROM" ); // From
-_LIT8( KTestTo, "TO" ); // To
-_LIT8( KTestCc, "CC" ); // Cc
-_LIT8( KTestBcc, "BCC" ); // Bcc
-_LIT8( KTestSubject, "SUBJECT" ); // Subject
-_LIT8( KTestExpiryRel, "EXPIRY-REL" ); // X-Mms-Expiry, relative
-_LIT8( KTestExpiryAbs, "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
-_LIT8( KTestDeliveryTimeRel, "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
-_LIT8( KTestDeliveryTimeAbs, "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
-_LIT8( KTestPriority, "PRIORITY" ); // X-Mms-Priority
-_LIT8( KTestSenderVisibility, "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
-_LIT8( KTestDeliveryReport, "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
-_LIT8( KTestReadReply, "READ-REPLY" ); // X-Mms-Read-Report
-// ---------------------------------------------------
-_LIT8( KTestNewAttachment, "ATTACHMENT" );
-_LIT8( KTestAttachmentType, "ATTACHMENTTYPE" );
-_LIT8( KTestAttachmentName, "ATTACHMENTNAME" );
-_LIT8( KTestAttachmentContLoc, "ATTACHMENTCONTLOC" );
-_LIT8( KTestAttachmentCharset, "ATTACHMENTCHARSET" );
-_LIT8( KTestAttachmentCid, "ATTACHMENTCID" );
-_LIT8( KTestAttachmentRoot, "ATTACHMENTROOT" );
-// content-type and x-type parameters for attachments
-// should appear in name-value pairs.
-// Test program is not responsible for verifying illegal scripts
-_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
-_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
-_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
-_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
-// -----------------------------------------------------
-_LIT8( KTestMessageClass, "MESSAGE-CLASS" ); // X-Mms-Message-Class
-_LIT8( KTestDelivRepSendAllow, "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
-_LIT8( KTestAcceptAdvertis, "ACCEPT-ADVERTISEMENTS" );
-_LIT8( KTestRetryCount, "RETRY-COUNT" );
-_LIT8( KTestRetryInterval, "RETRY-INTERVAL" );
-// -------------------------------------------------
-_LIT8( KTestAlias, "ALIAS" );
-_LIT8( KTestFromAlias, "FROMALIAS" );
-_LIT8( KTestToAlias, "TOALIAS" );
-_LIT8( KTestCcAlias, "CCALIAS" );
-_LIT8( KTestBccAlias, "BCCALIAS" );
-// -------------------------------------------------
-// more Message headers to allow testing all possible PDUs and
-// MMS 1.1 headers
-_LIT8( KTestReplyCharging, "REPLY-CHARGING" ); // X-Mms-Reply-Charging
-_LIT8( KTestReplyChargAbs, "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
-_LIT8( KTestReplyChargRel, "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
-_LIT8( KTestReplyChargSize, "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
-_LIT8( KTestReplyChargID, "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
-_LIT8( KTestTID, "TID" );
-_LIT8( KTestContentLocation, "CONTLOC" ); // X-Mms-Content-Location
-// The following three must appear as triplets.
-// index must be first, address and date may appear in any order
-_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
-_LIT8( KTestPreviouslySentBy, "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
-_LIT8( KTestPreviouslySentDate, "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
-//---
-_LIT8( KTestMessageId, "MESSAGE-ID" ); // Message-ID
-_LIT8( KTestMessageSize, "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
-_LIT8( KTestVersion, "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
-_LIT8( KTestReadStatus, "READ-STATUS" ); // X-Mms-Read-Status
-_LIT8( KTestResponseStatus, "RESPONSE-STATUS" ); // X-Mms-Response-Status
-_LIT8( KTestResponseText, "RESPONSE-TEXT" ); // X-Mms-Response-Text
-_LIT8( KTestRetrieveStatus, "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
-_LIT8( KTestRetrieveText, "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
-_LIT8( KTestStatus, "STATUS" ); // X-Mms-Status
-// -------------------------------------------------
-// MMS 1.2 headers
-_LIT8( KTestAttribute, "ATTRIBUTE" ); // X-Mms-Attribute
-// The value should be one of the following:
-// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
-// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
-// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
-// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
-// PREV-SENT-DATE, ADDITIONAL-HEADERS
-_LIT8( KTestDistributionIndicator, "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
-_LIT8( KTestLimit, "LIMIT" ); // X-Mms-Limit
-_LIT8( KTestMessageQuota, "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
-_LIT8( KTestSizeQuota, "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
-_LIT8( KTestMessageTotal, "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
-_LIT8( KTestSizeTotal, "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
-_LIT8( KTestMessageCount, "MESSAGE-COUNT" ); // X-Mms-Message-Count
-_LIT8( KTestAddKeyword, "ADD-KEYWORD" ); // X-Mms-MM-Flags
-_LIT8( KTestRemoveKeyword, "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
-_LIT8( KTestFilterKeyword, "FILTER-KEYWORD" ); // X-Mms-MM-FLags
-_LIT8( KTestMMState, "MESSAGE-STATE" ); // X-Mms-MM-State
-_LIT8( KTestQuota, "QUOTA" ); // X-Mms-Quotas
-_LIT8( KTestStart, "START" ); // X-Mms-Start
-_LIT8( KTestStore, "STORE" ); // X-Mms-Store
-_LIT8( KTestStored, "STORED" ); // X-Mms-Stored
-_LIT8( KTestStoreStatus, "STORE-STATUS" ); // X-Mms-Store-Status
-_LIT8( KTestStoreStatusText, "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
-_LIT8( KTestTotals, "TOTALS" ); // X-Mms-Totals
-// Delete confirmation header structure
-// This consists of index, content location, response status and response status text.
-// All three values are not always necessary for each index, but at least content-location
-// and response status should be present.
-// The index retains its value until a new index is encountered.
-_LIT8( KTestDeleteInfoIndex, "DELETESTATUSINDEX" ); // index for next delete info fields
-// This header must precede content-location, response-status and response-text fields
-// in a delete confirmation. Index retains its value until a new index is encountered.
-
-// Element descriptor header not implemented
-
-// Application id headers
-// These will officially be supported in MMS encapsulation version 1.3
-// Java has non-standard support even earlier
-
-_LIT8( KTestApplicId, "APPLIC-ID" ); // X-Mms-Applic-ID
-_LIT8( KTestReplyApplicId, "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
-_LIT8( KTestApplicInfo, "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
-
-// Since Encapsulation 1.3
-_LIT8( KTestContentClass, "CONTENT-CLASS" ); // X-Mms-Content-Class
-_LIT8( KTestDrmContent, "DRM-CONTENT" ); // X-Mms-DRM-Content
-_LIT8( KTestAdaptationAllowed, "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
-_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
-_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
-_LIT8( KTestReplaceId, "REPLACE-ID" ); // X-Mms-Replace-ID
-_LIT8( KTestStatusText, "STATUS-TEXT" ); // X-Mms-Status-Text
-_LIT8( KTestCancelId, "CANCEL-ID" ); // X-Mms-Cancel-ID
-_LIT8( KTestCancelStatus, "CANCEL-STATUS" ); // X-Mms-Cancel-Status
-
-// DATA TYPES
-#define aSet 1
-#define aReset 0
-#define PartCount 100
-#define MaxAttaCount 10
-#define DefaultBufLen 256
-#define MaxRecipients 5
-
-// status returned by ReadRow
-enum TTestReadStatus
- {
- ETestUnknown,
- ETestNewMessage,
- ETestNewAttachment,
- ETestEof, // End of file
- ETestMessageType,
- ETestDate,
- ETestFrom,
- ETestTo,
- ETestCc,
- ETestBcc,
- ETestAlias,
- ETestFromAlias,
- ETestToAlias,
- ETestCcAlias,
- ETestBccAlias,
- ETestSubject,
- ETestExpiryRel,
- ETestExpiryAbs,
- ETestDeliveryTimeRel,
- ETestDeliveryTimeAbs,
- ETestPriority,
- ETestSenderVisibility,
- ETestDeliveryReport,
- ETestReadReply,
- ETestAttachmentType,
-// ETestAttachmentName,
- ETestAttachmentCharset,
- ETestAttachmentCid,
- ETestAttachmentRoot,
- ETestSettings,
- ETestMessageClass,
- ETestDelivReportSendAllow,
- ETestSingleMessageClass,
- ETestReplyCharging,
- ETestReplyChargAbs,
- ETestReplyChargRel,
- ETestReplyChargSize,
- ETestReplyChargID,
- ETestTID,
- ETestContentLocation,
- ETestPreviouslySentIndex,
- ETestPreviouslySentBy,
- ETestPreviouslySentDate,
- ETestMessageId,
- ETestMessageSize,
- ETestVersion,
- ETestReadStatus,
- ETestResponseStatus,
- ETestResponseText,
- ETestRetrieveStatus,
- ETestRetrieveText,
- ETestStatus,
- ETestAttribute,
- ETestDistributionIndicator,
- ETestLimit,
- ETestMessageQuota,
- ETestSizeQuota,
- ETestMessageTotal,
- ETestSizeTotal,
- ETestMessageCount,
- ETestAddKeyword,
- ETestRemoveKeyword,
- ETestFilterKeyword,
- ETestMMState,
- ETestQuota,
- ETestStart,
- ETestStore,
- ETestStored,
- ETestStoreStatus,
- ETestStoreStatusText,
- ETestTotals,
- ETestDeleteInfoIndex,
- ETestApplicId,
- ETestReplyApplicId,
- ETestApplicInfo,
- ETestContentClass,
- ETestDrmContent,
- ETestAdaptationAllowed,
- ETestRecommendedRetrievalMode,
- ETestRecRetrievalModeText,
- ETestReplaceId,
- ETestStatusText,
- ETestCancelId,
- ETestCancelStatus,
- ETestAttaRecommendedName,
- ETestAttachmentContLoc,
- ETestAttContTypeParamName,
- ETestAttContTypeParamValue,
- ETestAttXTypeParamName,
- ETestAttXTypeParamValue
-
- };
-
-// VALUE KEYWORDS
-_LIT( KPersonal, "Personal" );
-_LIT( KAdvertisement, "Advertisement" );
-_LIT( KInformational, "Informational" );
-_LIT( KAuto, "Auto" );
-_LIT( KLow, "Low" );
-_LIT( KNormal, "Normal" );
-_LIT( KHigh, "High" );
-_LIT( KHide, "Hide" );
-_LIT( KShow, "Show" );
-_LIT( KYes, "Yes" );
-_LIT( KNo, "No" );
-_LIT( KOn, "On" );
-_LIT( KOff, "Off" );
-_LIT( KDeferred, "Deferred" );
-_LIT( KExpired, "Expired" );
-_LIT( KRetrieved, "Retrieved" );
-_LIT( KRejected, "Rejected" );
-_LIT( KUnrecognized, "Unrecognized" );
-_LIT( KIndeterminate, "Indeterminate" );
-_LIT( KForwarded, "Forwarded" );
-_LIT( KUnreachable, "Unreachable" );
-_LIT( KDraft, "Draft");
-_LIT( KSent, "Sent" );
-_LIT( KNew, "New" );
-// X-Mms-Message-Type
-_LIT( KSendReq, "SendReq" );
-_LIT( KSendConf, "SendConf" );
-_LIT( KNotifInd, "NotifInd" );
-_LIT( KNotifResp, "NotifResp" );
-_LIT( KRetrConf, "RetrConf" );
-_LIT( KAckInd, "AckInd" );
-_LIT( KDelInd, "DelInd" );
-_LIT( KReadReqInd, "ReadReqInd" );
-_LIT( KReadOrigInd, "ReadOrigInd" );
-_LIT( KForwardRec, "ForwardReq" );
-_LIT( KForwardConf, "ForwardConf" );
-_LIT( KMBoxStoreReq, "MBoxStoreReq" );
-_LIT( KMBoxStoreConf, "MBoxStoreConf" );
-_LIT( KMBoxViewReq, "MBoxViewReq" );
-_LIT( KMBoxViewConf, "MBoxViewConf" );
-_LIT( KMBoxUploadReq, "MBoxUploadReq" );
-_LIT( KMBoxUploadConf, "MBoxUploadConf" );
-_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
-_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
-_LIT( KMBoxDescr, "MBoxDescr" );
-_LIT( KDeleteReq, "DeleteReq" );
-_LIT( KDeleteConf, "DeleteConf" );
-_LIT( KCancelReq, "CancelReq" );
-_LIT( KCancelResp, "CancelConf" );
-// X-Mms-Read-Status
-_LIT( KRead, "Read" );
-_LIT( KDelNotRead, "DeletedNotRead" );
-// X-Mms-Reply-Charging
-_LIT( KRequested, "Requested" );
-_LIT( KReqTextOnly, "ReqTextOnly" );
-_LIT( KAccepted, "Accepted" );
-_LIT( KAccTextOnly, "AccTextOnly" );
-// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
-_LIT( KCancelSuccessful, "CancelSuccess" );
-_LIT( KCancelCorrupted, "CancelCorrupted" );
-// X-Mms-Content-Class
-_LIT( KText, "Text" );
-_LIT( KImageBasic, "ImageBasic" );
-_LIT( KImageRich, "ImageRich" );
-_LIT( KVideoBasic, "VideoBasic" );
-_LIT( KVideoRich, "VideoRich" );
-_LIT( KMegaPixel, "MegaPixel" );
-_LIT( KContentBasic, "ContentBasic" );
-_LIT( KContentRich, "ContentRich" );
-// X-Mms-Recommended-Retrieval-Mode
-_LIT( KManual, "Manual" );
-
-//X-Mms-ResponseStatus
-// legacy values
-_LIT( KOk, "OK" );
-_LIT( KErrUnspecified, "Unspecified" );
-_LIT( KErrServiceDenied, "ServiceDenied" );
-_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
-_LIT( KErrAddressUnresolved, "AddressUnresolved" );
-_LIT( KErrMessageNotFound, "MessageNotFound" );
-_LIT( KErrNetworkProblem, "NetworkProblem" );
-_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
-_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
-// values since 1.1 (and 1.2)
-_LIT( KErrTransient, "TransientFailure" );
-_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
-_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
-_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
-_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
-_LIT( KErrPermanent, "PermanentFailure" );
-_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
-_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
-_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
-_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
-_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
-_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
-_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
-_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
-_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
-_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
-_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
-//X-Mms-RetrieveStatus (one extra value)
-_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
-//X-Mms-Store-Status (one extra value)
-_LIT( KErrMMBoxFull, "MMBoxFull" );
-
-_LIT8( KTestContent, "Content" ); // For attribute list only
-_LIT8( KTestAdditionalHeaders, "ADDITIONAL-HEADERS" ); // For attribute list only
-_LIT8( KTestDeliveryTime, "DELIVERY-TIME"); // for attribute list only
-_LIT8( KTestExpiry, "EXPIRY"); // for attribute list only
-_LIT8( KTestReplyCharg, "REPLY-CHARG-DEADLINE" ); // for attribute list only
-_LIT8( KTestContentType, "CONTENT-TYPE" ); // for attribute list only
-
-/**
-* CMmsReadFile
-*/
-NONSHARABLE_CLASS( CMmsReadFile ):public CBase
- {
- public: // Constructors and destructor
-
- static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
- virtual ~CMmsReadFile(); // Destructor
-
- public: // New functions
-
- TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
- TTestReadStatus ReadRowL();
- void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
- TInt FindAlias(TPtrC alias);
- void SetAttaStructure( TBool aOldAttaStructure = EFalse );
-
- protected: // Functions from base classes
-
- private:
-
- CMmsReadFile(); // C++ default constructor.
- // By default constructor is private.
- void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
- void Reset();
-
- public: // data
- TInt iMessageType;
-
-
- private: // Data
-
- RFs iFs;
- RFileReadStream* iReader;
- TBuf<DefaultBufLen> iValueBuffer;
- CDesCArray* iAliasArray; // aliases
- HBufC8* iByteBuffer;
- TTime iDate;
- CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
- TInt iAttaCount;
- TInt iAttaRoot;
- TInt iAliasCount;
- TInt iNextMessageType;
- TParse iParse;
- TFileName iFilename;
-
- protected: // Data
- private: // Data
-
- // CArrayFixFlat <TestMessage>* iMessages;
-
- public: // Friend classes
- protected: // Friend classes
- private: // Friend classes
-
- };
-
-
-NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
- {
- public: // Constructors and destructor
- static CMmsAttaStructure* NewL(); // Two-phased constructor.
- virtual ~CMmsAttaStructure(); // Destructor
- private:
- CMmsAttaStructure(); // C++ default constructor.
- // By default constructor is private.
- void ConstructL();
-
- public: // Data
- HBufC8* iAtta;
- HBufC8* iAttaName; // content location
- HBufC8* iAttaType;
- HBufC8* iAttaCid;
- TInt iAttaCharset;
- HBufC* iAttaRecommendedName; // recommended filename
- CDesC8ArrayFlat* iContentTypeParams; // zero or more "parameter"
- CDesC8ArrayFlat* iXTypeParams; // zero or more X-Type "parameters"
-
- };
-
-
-#endif // MMSREADFILE_H
-
-// End of File
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestbed.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSTESTBED_H
-#define MMSTESTBED_H
-
-#ifdef BUILD_MMSTESTBED_DLL
-#define MMSTESTBED_EXPORT Q_DECL_EXPORT
-#else
-#define MMSTESTBED_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <QString>
-
-#include <msvids.h> //for consts like KMsvNullIndexEntryIdValue
-#include <MSVAPI.H>
-#include <MTCLREG.H>
-#include <mmsclient.h>
-//#include <mmsservercommon.h>
-
-class CTestUiTimer;
-class CMsvSession;
-class CMmsClientMtm;
-class CMmsSettings;
-class CMmsHeaders;
-class CLogEvent;
-class CLogViewEvent;
-class CLogFilter;
-class CLogClient;
-
-class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
- {
- Q_OBJECT
-
-public:
- /**
- *
- */
- MmsTestBed();
- ~MmsTestBed();
- void setConnectionLocal(bool value);
- void fromOutboxToMmsc();
- void fromMmscToInbox();
- /**
- * cleanup MMS service
- */
- void cleanupAndCreateNewService();
- void deleteNotifications();
- void restoreFactorySettings();
- void setFetchingState( TMmsReceivingMode aState );
- void sendFromFile();
- void sendOneByOne();
- void sendNotifications();
- void copyDrafts();
- void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
- void messageVariation();
- void cancelSendScheduling();
- void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
- void deleteSendSchedule();
- void cancelFetchScheduling();
- void fetchForced(TInt aDelay = 5);
- void deleteFetchSchedule();
- void doAFetchCycle();
- void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
- void cleanOutbox();
- void cleanInbox();
- void cleanSent();
- void cleanDrafts();
- void cleanAll();
- void reply();
- void replyToAll();
- void forward();
- void sendReadReport(); // send a read report
- int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
- int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
- void sendViaClient();
- void scheduledFetch(TInt aDelay = 5);
- void fetchForcedImmediate();
- void getEventType();
- void addEventType();
- void deleteEventType();
- void cleanLog();
- void setOnline(bool value);
- void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
- void sendDeliveryReport();
-
-signals:
- void entryCreatedInDraft(long int id);
- void entryMovedToOutbox(long int id);
- void entryMovedToSent(long int id);
- void entryCreatedInInbox(long int id);
-
-protected:
- /**
- * From MMsvSessionObserver
- */
- void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
- TAny* aArg2, TAny* aArg3);
-
-private:
- void findDefaultL();
- void createMmsService();
- void cleanup();
- void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
- void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
- void addMMBoxDescriptions();
- void encodeMessageFromDrafts();
- TMsvId findMMSFolder();
- bool checkLogClient();
- int getLogEntries();
-
-private:
- //data
- CTestUiTimer* iTimer;
- CMsvOperationActiveSchedulerWait* iWait;
- CMsvSession* iSession;
- CClientMtmRegistry* iClientMtmRegistry;
- CMmsClientMtm* iMmsClient;
- CMmsSettings* iSettings;
- CMmsHeaders* iMmsHeaders;
- TMsvId iServiceId;
- TMsvId iDefaultServiceId;
- TMsvSessionEvent iEvent;
- RFs iFs;
- TFileName iFilename;
- TFileName iCurrentFile;
- TFileName iCurrentPath;
- TParse iParse; // parse buffer as member to save stack space
- CBufFlat* iEncodeBuffer;
- CMsvEntrySelection* iMsvEntrySelection;
- CLogEvent* iLogEvent;
- CLogClient* iLogClient;
- CLogViewEvent* iLogView;
- CLogFilter* iLogFilter;
- };
-
-#endif // MMSTESTBED_H
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestbed.hrh Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <bldvariant.hrh>
-
-
-#ifndef MMSTESTBED_HRH
-#define MMSTESTBED_HRH
-
-enum
-{
- EAppMainOk = 1,
- EAppMainCancel,
- //
- EMenufrmCmdCascadeTest,
- ECleanup,
- ECleanOutbox,
- ESaveSettings,
- ELoadSettings,
- ECleanInbox,
- EShowIn,
- EShowOut,
- EOutToMMSC,
- EMMSCToIn,
- ESendScheduled,
- EReceiveScheduled,
- EShowSent,
- ECleanSent,
- EStartMyNotifier,
- EGetEventType,
- EAddEventType,
- EDeleteEventType,
- EViewLog,
- ECleanLog,
- EShowWapAccessPoints,
- ESelectWapAccessPoint,
- EShowConnectionMode,
- EShowIAP,
- EConnectToIAP,
- EDeleteSendSchedule,
- EDeleteReceiveSchedule,
- EDeleteNotifications,
- ERestoreFactorySettings,
- ECreateFromFile,
- EShowNotifications,
- ESendDeliveryReport,
- EShowDrafts,
- ECleanDrafts,
- ECleanAll,
- EFetchingDeferred,
- EFetchingOn,
- ESendFromFile,
- ESwitchToLocal,
- ESwitchToGlobal,
- EDecodeLoggingOn,
- EDecodeLoggingOff,
- EBinaryDumpOn,
- EBinaryDumpOff,
- ESendNotification,
- ECreateToInbox,
- ECreateToSentItems,
- ESendFromDrafts,
- EFindMMSFolder,
- ESendOneByOne,
- ECreateToDrafts,
- ESendViaClient,
- ESendMemFail,
- EFetchMemFail,
- EReceiveForced,
- ECreateHeadersFromFile,
- ESwitchToOffline,
- ESwitchToOnline,
- ECopyDrafts,
- ECreateNotification,
- EReply,
- EReplyToAll,
- EForward,
- EFetchingManual,
- EFirstBoot,
- ENoFirstBoot,
- EFindNetworkStatus,
- ESendReadReport,
- ECreateMMBoxViewConf,
- EGetMMBoxView,
- ECleanMMBox,
- EShowMMBox
-};
-
-#define ETestLabel1 1
-#define ETestLabel2 2
-#define ETestLabel3 3
-#define ETestLabel4 4
-
-#define EServiceList 2
-
-
-enum TTestBedDlgCtrlIds
- {
- ETestEditField = 1
- };
-
-enum TEditServiceControls
- {
- EFolderLabel = 1,
- EEditUri
-// EEditServiceFolder,
-// ENameLabel,
-// EEditServiceName,
-// ENumberLabel,
-// EEditServiceNumber
- };
-
-enum
- {
- EFsViewDialogId = 1
- };
-
-#endif
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmsteststaticutils.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,203 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSTESTSTATICUTILS_H
-#define MMSTESTSTATICUTILS_H
-
-#include <e32std.h>
-#include <msvstd.h>
-#include <badesca.h>
-
-#include "mmsconst.h"
-
-class RFs;
-class CMsvSession;
-class CMmsEncode;
-class CMmsHeaders;
-
-#ifdef __WINS__
-_LIT( KRootPath, "c:\\" );
-#else
-// This is removable disk.
-// drive letter should not be hard coded, must be investigated further
-// We use c: for a while for the tests (to be cahnged later)
-_LIT( KRootPath, "c:\\" );
-//_LIT( KRootPath, "e:\\" );
-#endif
-
-// directory where mmbox descriptions are created
-_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
-// directory where created headers are dumped
-_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
-// content type of MMS PDUs
-_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
-
-_LIT( KWild, "*" );
-
-
-/**
- * joined array structure
- *
- */
-NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
- {
-public:
- TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
- TInt MdcaCount() const;
- TPtrC16 MdcaPoint(TInt aIndex) const;
-private:
- CDesCArray* const & iArray1;
- CDesCArray* const & iArray2;
- };
-
-/**
- * static utility functions
- *
- */
-class TMmsTestUtils
- {
-
-public:
-
- /**
- *
- */
- TMmsTestUtils();
-
- /**
- * read phone number for sending messages
- *
- * @param aFileName full path for filename
- * @param aFs file system handle
- * @return allocated pointer containing the name
- * The caller must delete the pointer when no longer needed
- */
- static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
-
- static void DecodeLoggingOnL();
- static void DecodeLoggingOffL();
- static void BinaryDumpOnL();
- static void BinaryDumpOffL();
-
- /**
- * Clean all temporary directories used in local mode.
- * Does not delete the directories, only the contents
- *
- * @param aFs file system handle
- */
- static void CleanDirectoryL( RFs& aFs );
-
- /**
- * Dump a binary message
- *
- * @param aBuffer buffer containing the binary message
- * @param aFilename full path of the directory whenre the dump goes
- * @param aParse reference to parser (to save stack space)
- * @param aFs file system handle
- */
- static void Dump(
- CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
-
- /**
- * Delete all MMS messages and notifications from a given folder
- *
- * @param aBoxId folder id
- * @param aSession Messaging server session
- */
- static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
-
- /**
- * turn on logging messages sent to email addresses
- */
- static void EmailLoggingOnL();
-
- /**
- * turn off logging messages sent to email addresses
- */
- static void EmailLoggingOffL();
-
- /**
- * load list of children into selection and return count
- *
- * @param aBoxId folder id
- * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
- * caller is responsible of deleting the pointer afterwards.
- * Pointer may be NULL at entry, and a new pointer will be allocated
- * @param aSession messge server session
- * @param aMessageType child MTM type, default is multimedia message
- * @return number of entries in selection
- */
- static TInt CountChildrenL(
- TMsvId aBoxId,
- CMsvEntrySelection*& aMsvEntrySelection,
- CMsvSession& aSession,
- TUid aMessageType = KUidMsgTypeMultimedia);
-
- /**
- * Create a folder entry
- *
- * @param aSession messge server session
- * @param aParentFolder the parent folder
- * @param aFolderName name of the folder
- * @param aFolderId will contain the if of the new folder if creation was successful
- */
- static void CreateFolderEntryL(
- CMsvSession& aSession,
- TMsvId aParentFolder,
- const TDesC& aFolderName,
- TMsvId& aFolderId );
-
- /**
- * Create an MMS notification from data in buffer
- * @param aNotificationFolder mms notification folder (target folder)
- * @param aServiceId id of MMS service
- * @param aEncodeBuffer buffer that contains the data
- * @param aSession message server session
- * @return id of the created notification
- */
- static TMsvId CreateNotificationEntryL(
- TMsvId aNotificationFolder,
- TMsvId aServiceId,
- CBufFlat* aEncodeBuffer,
- CMsvSession& aSession );
-
- /**
- * Encode an MMS notification into buffer
- * @param aUrl url of the notification for local messages a filepath
- * @param aSize size of the message
- * @param aMmsHeaders MMS headers structure for creating the notification
- * @param aMmsEncoder reference to CMmsEncode class
- * @param aEncodeBuffer flat buffer that will contain the encoded notification
- */
- static void FormNotification(
- TDesC8& aUrl,
- TInt aSize,
- CMmsHeaders& aMmsHeaders,
- CMmsEncode& aMmsEncoder,
- CBufFlat* aEncodeBuffer );
-
-
- static TBool IsDrive(const TDesC& aFileName);
- static TBool IsDir(const TDesC& aFileName, RFs& aFs);
- static TBool IsFile(const TDesC& aFileName, RFs& aFs);
-
-
-private:
-
- };
-
-
-#endif // MMSTESTSTATICUTILS_H
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestuitimer.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef C_TESTUITIMER_H
-#define C_TESTUITIMER_H
-
-
-#include <e32base.h>
-
-#define KPeriod 10000 // period of timer
-
-/**
- * timer for test programs
- */
-NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
- {
-public:
-
- static CTestUiTimer* NewL();
- virtual ~CTestUiTimer();
-
- void RunL();
- void DoCancel();
- void ConstructL();
- void IssueRequest();
- void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
-
-private:
- CTestUiTimer();
-
-public:
- TTimeIntervalMicroSeconds32 period;
-
-private: // data
- CActive* iObject;
- };
-
-#endif // C_TESTUITIMER_H
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/mmstestbed.pro Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-QT += testlib
-QT -= gui
-
-TEMPLATE = lib
-
-TARGET = mmstestbed
-
-INCLUDEPATH += .
-INCLUDEPATH += inc
-INCLUDEPATH += ../../inc
-INCLUDEPATH += ../../../../../../../mmsengine/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmscodec/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmshttptransport/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsmessage/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsconninit/inc
-#INCLUDEPATH += ../../../mmsengine/mmscodec/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsserver/inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_MMSTESTBED_DLL
-
-SOURCES += src/mmstestbed.cpp \
- src/mmsteststaticutils.cpp \
- src/mmsreadfile.cpp \
- src/mmstestuitimer.cpp
-
-HEADERS += inc/mmstestbed.h \
- inc/mmsteststaticutils.h \
- inc/mmsreadfile.h \
- inc/mmstestuitimer.h \
- inc/mmstestbed.hrh
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-symbian {
- TARGET.CAPABILITY = CAP_GENERAL_DLL
- TARGET.EPOCSTACKSIZE = 0x8000
- TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
- TARGET.EPOCALLOWDLLDATA = 1
- }
-
-# Build.inf rules
-BLD_INF_RULES.prj_exports += \
- "$${LITERAL_HASH}include <platform_paths.hrh>"
-
-LIBS += -lmsgs \
- -lmmsmessage \
- -lmmsconninit \
- -lmmscodec \
- -lmmsserversettings \
- -lcentralrepository \
- -lapparc \
- -lbafl \
- -lefsrv \
- -lesock \
- -lestor \
- -leuser \
- -llogcli \
- -llogwrap \
- -lapgrfx \
- -lapmime
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmsreadfile.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1799 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-// INCLUDE FILES
-#include <e32base.h>
-#include <badesca.h>
-#include <e32def.h>
-#include <s32file.h>
-#include <msvids.h>
-#include <mtmdef.h>
-//#include <eikenv.h>
-#include <apgcli.h>
-#include <CMsvMimeHeaders.h>
-#include <AknNoteWrappers.h>
-
-#include <mmsservercommon.h>
-#include "mmsconst.h"
-#include "mmsclient.h"
-#include "mmsheaders.h"
-#include "mmsreadfile.h"
-#include "mmsmmboxviewheaders.h"
-#include "mmsmmboxmessageheaders.h"
-#include "mmsmmboxflags.h"
-#include "mmssettings.h"
-
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-const TInt KMmsGranularity = 8;
-_LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
-
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// ==================== LOCAL FUNCTIONS ====================
-
-
-// ================= MEMBER FUNCTIONS =======================
-
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CMmsReadFile::CMmsReadFile()
- {
- // all member variables in a class derived from CBase
- // are automatically set to 0.
- }
-
-
-//
-void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
- {
- // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
- iFs = aFs;
- iReader = &aReadStream;
- iByteBuffer = HBufC8::NewL( DefaultBufLen );
- iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
- iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
- Reset();
- }
-
-// Two-phased constructor.
-CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
- {
- CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
- CleanupStack::PushL( self );
- self->ConstructL( aFs, aReadStream );
- CleanupStack::Pop();
- return self;
- }
-
-
-// Destructor
-CMmsReadFile::~CMmsReadFile()
- {
- Reset(); // resets and destroys all array data
- if (iAliasArray != NULL) iAliasArray->Reset();
- delete iByteBuffer;
- delete iAliasArray;
- delete iAttaStructures;
- }
-
-void CMmsReadFile::Reset()
- {
- // reset all arrays
- if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
- iAttaCount = 0;
- iAttaRoot = 0;
- }
-
-// ---------------------------------------------------------
-// CMmsReadFile()::CompleteTest
-// ---------------------------------------------------------
-//
-TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
-{
- Reset(); // new message
-
- TUint32 val;
- TUint limit = 1000000;
- TUint sizeLimit = 1000 * 1024; //max message size 1000 kB!
- TUint allLimit = 999999;
- TInt error;
- TRadix radix = EDecimal;
- TLex16 lex;
- TTestReadStatus readStatus = ETestUnknown;
- CMmsAttaStructure* oneAtta = NULL;
- TInt index;
- TTime y1970( K1970 );
- TTimeIntervalMicroSeconds interval;
- TTime date;
- TInt order = 0;
- TInt16 shortInteger = 0;
-
- //iso luuppi, joka kiertää ja lukee kunnes EOF tule vastaan
- //Big Loop, which passes around and read until the EOF
-
- iMessageType = iNextMessageType;
- while(readStatus != ETestEof)
- {
- readStatus = ReadRowL();
- if ( readStatus == ETestEof )
- {
- return(-1);
- }
- if ( readStatus == ETestUnknown )
- {
- // A line containing only comments, or an unknown tag
- // As using the scripts to test settings is no longer supported,
- // any old keywords used to test CMmsSettings class are ignored
- continue;
- }
- if( readStatus == ETestNewMessage )
- {
- iNextMessageType = readStatus;
- if(aMessageCounter++)
- {
- return(NULL);
- }
- else
- {
- iMessageType = iNextMessageType;
- continue;
- }
- }
- if ( iMessageType == ETestNewMessage)
- {
- switch(readStatus)
- {
- case ETestFrom:
- aMmsHeaders.SetSenderL( iValueBuffer );
- break;
- case ETestFromAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
- }
- break;
- case ETestTo:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
- break;
- case ETestToAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
- }
- break;
- case ETestCc:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
- break;
- case ETestCcAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
- }
- break;
- case ETestBcc:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
- break;
- case ETestBccAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
- }
- break;
- case ETestSubject:
- aMmsHeaders.SetSubjectL( iValueBuffer );
- break;
- case ETestExpiryRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetExpiryInterval( val );
- }
- break;
- case ETestExpiryAbs:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- // expiry date in seconds from 1.1.1970.
- aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
- break;
- case ETestDeliveryTimeRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetDeliveryTimeInterval( val );
- }
- break;
- case ETestDeliveryTimeAbs:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
- break;
- case ETestDate:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetDate( (interval.Int64())/1000000 );
- case ETestPriority:
- val = 0;
- if ((iValueBuffer.CompareF(KLow)) == 0)
- {
- val = EMmsPriorityLow;
- }
- else if ((iValueBuffer.CompareF(KNormal)) == 0)
- {
- val = EMmsPriorityNormal;
- }
- else if ((iValueBuffer.CompareF(KHigh)) == 0)
- {
- val = EMmsPriorityHigh;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessagePriority( val );
- break;
- case ETestSenderVisibility:
- val = 0;
- if ((iValueBuffer.CompareF(KHide)) == 0)
- {
- val = EMmsSenderVisibilityHide;
- }
- else if ((iValueBuffer.CompareF(KShow)) == 0)
- {
- val = EMmsSenderVisibilityShow;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetSenderVisibility( val );
- break;
- case ETestDeliveryReport:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDeliveryReport( val );
- break;
- case ETestDelivReportSendAllow:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReportAllowed( val );
- break;
-
- case ETestReadReply:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReadReply( val );
- break;
- case ETestNewAttachment:
- oneAtta = CMmsAttaStructure::NewL();
- iAttaStructures->AppendL(oneAtta);
- oneAtta->iAtta->Des().Copy( iValueBuffer );
- iAttaCount++;
- break;
- case ETestAttachmentType:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaType->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttachmentContLoc:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaName->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttaRecommendedName:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttachmentCharset:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- if (oneAtta != NULL)
- {
- oneAtta->iAttaCharset = val;
- }
- }
- break;
- case ETestAttachmentCid:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaCid->Des().Copy(iValueBuffer);
- }
- break;
- case ETestAttContTypeParamName:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttContTypeParamValue:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttXTypeParamName:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttXTypeParamValue:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttachmentRoot:
- iAttaRoot = iAttaCount;
- break;
- case ETestAlias:
- // all aliases are global even if they appear
- // in the middle of a message
- iAliasArray->AppendL( iValueBuffer );
- iAliasCount++;
- break;
- case ETestMessageClass: // should be handled!
- val = EMmsClassPersonal;
- if ((iValueBuffer.CompareF(KPersonal)) == 0)
- {
- val = EMmsClassPersonal;
- }
- else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
- {
- val = EMmsClassAdvertisement;
- }
- else if ((iValueBuffer.CompareF(KInformational)) == 0)
- {
- val = EMmsClassInformational;
- }
- else if ((iValueBuffer.CompareF(KAuto)) == 0)
- {
- val = EMmsClassAuto;
- }
- else
- {
- val = (TMmsMessageClass)KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessageClass( val );
- break;
- case ETestReplyCharging:
- val = 0;
- if ((iValueBuffer.CompareF(KRequested)) == 0)
- {
- val = KMmsReplyChargingRequested;
- }
- else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
- {
- val = KMmsReplyChargingRequestedTextOnly;
- }
- else if ((iValueBuffer.CompareF(KAccepted)) == 0)
- {
- val = KMmsReplyChargingAccepted;
- }
- else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
- {
- val = KMmsReplyChargingAcceptedTextOnly;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReplyCharging( val );
- break;
- case ETestReplyChargAbs:
- error = date.Set(iValueBuffer);
- if ( error == KErrNone )
- {
- interval = date.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
- }
- break;
- case ETestReplyChargRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetReplyChargingInterval( val );
- }
- break;
- case ETestReplyChargSize:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,sizeLimit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetReplyChargingSize( val );
- }
- break;
- case ETestReplyChargID:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
- break;
- case ETestTID:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetTidL( iByteBuffer->Des() );
- break;
- case ETestContentLocation:
- iByteBuffer->Des().Copy( iValueBuffer );
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
- {
- aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
- }
- else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
- }
- else
- {
- aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
- }
- break;
- case ETestPreviouslySentIndex:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- order = val;
- break;
- case ETestPreviouslySentBy:
- aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
- break;
- case ETestPreviouslySentDate:
- error = date.Set(iValueBuffer);
- if ( error == KErrNone )
- {
- interval = date.MicroSecondsFrom( y1970 );
- aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
- }
- break;
- case ETestMessageId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
- break;
- case ETestMessageSize:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,sizeLimit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetMessageSize( val );
- }
- break;
- case ETestVersion:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,EHex,limit);
- shortInteger = TInt16( val );
- if (error == KErrNone)
- {
- aMmsHeaders.SetMmsVersion( shortInteger );
- }
- break;
- case ETestReadStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KRead)) == 0)
- {
- val = KMmsReadStatusRead;
- }
- else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
- {
- val = KMmsReadStatusDeletedWithoutBeingRead;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReadStatus( val );
- break;
- case ETestResponseStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
- {
- val = KMmsErrorUnspecified;
- }
- else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
- {
- val = KMmsErrorServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
- {
- val = KMmsErrorSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
- {
- val = KMmsErrorMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
- {
- val = KMmsErrorNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
- {
- val = KMmsErrorNoContentAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
- {
- val = KMmsErrorUnsupportedMessage;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
- {
- val = KMmsErrorTransientSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
- {
- val = KMmsErrorTransientMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorPermanentMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
- {
- val = KMmsErrorPermanentSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorPermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
- {
- val = KMmsErrorPermanentContentNotAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingForwardingDenied;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingNotSupported;
- }
- else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
- {
- val = KMmsErrorTransientPartialSuccess;
- }
- else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
- {
- val = KMmsErrorPermanentAddressHidingNotSupported;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteStatusL( order, val );
- }
- else
- {
- aMmsHeaders.SetResponseStatus( val );
- }
- break;
- case ETestResponseText:
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
- }
- else
- {
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- }
- break;
- case ETestRetrieveStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
- {
- val = KMmsErrorReceiveTransientMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorReceiveTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorReceivePermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
- {
- val = KMmsErrorReceivePermanentContentUnsupported;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetResponseStatus( val );
- break;
- case ETestRetrieveText:
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- break;
- case ETestStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KDeferred)) == 0)
- {
- val = KMmsMessageStatusDeferred;
- }
- else if ((iValueBuffer.CompareF(KExpired)) == 0)
- {
- val = KMmsMessageStatusExpired;
- }
- else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
- {
- val = KMmsMessageStatusRetrieved;
- }
- else if ((iValueBuffer.CompareF(KRejected)) == 0)
- {
- val = KMmsMessageStatusRejected;
- }
- else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
- {
- val = KMmsMessageStatusUnrecognized;
- }
- else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
- {
- val = KMmsMessageStatusIndeterminate;
- }
- else if ((iValueBuffer.CompareF(KForwarded)) == 0)
- {
- val = KMmsMessageStatusForwarded;
- }
- else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
- {
- val = KMmsMessageStatusUnreachable;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetStatus( val );
- break;
- case ETestMessageType:
- val = 0;
- if ((iValueBuffer.CompareF(KSendReq)) == 0)
- {
- val = KMmsMessageTypeMSendReq;
- }
- else if ((iValueBuffer.CompareF(KSendConf)) == 0)
- {
- val = KMmsMessageTypeMSendConf;
- }
- else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
- {
- val = KMmsMessageTypeMNotificationInd;
- }
- else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
- {
- val = KMmsMessageTypeMNotifyRespInd;
- }
- else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
- {
- val = KMmsMessageTypeMRetrieveConf;
- }
- else if ((iValueBuffer.CompareF(KAckInd)) == 0)
- {
- val = KMmsMessageTypeAcknowledgeInd;
- }
- else if ((iValueBuffer.CompareF(KDelInd)) == 0)
- {
- val = KMmsMessageTypeDeliveryInd;
- }
- else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
- {
- val = KMmsMessageTypeReadRecInd;
- }
- else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
- {
- val = KMmsMessageTypeReadOrigInd;
- }
- else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
- {
- val = KMmsMessageTypeForwardReq;
- }
- else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
- {
- val = KMmsMessageTypeForwardConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
- {
- val = KMmsMessageTypeMboxStoreReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
- {
- val = KMmsMessageTypeMboxStoreConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
- {
- val = KMmsMessageTypeMboxViewReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
- {
- val = KMmsMessageTypeMboxViewConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
- {
- val = KMmsMessageTypeMBoxUploadReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
- {
- val = KMmsMessageTypeMBoxUploadConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
- {
- val = KMmsMessageTypeMBoxDeleteReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
- {
- val = KMmsMessageTypeMBoxDeleteConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
- {
- val = KMmsMessageTypeMBoxDescr;
- }
- else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
- {
- val = KMmsMessageTypeDeleteReq;
- }
- else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
- {
- val = KMmsMessageTypeDeleteConf;
- }
- else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
- {
- val = KMmsMessageTypeCancelReq;
- }
- else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
- {
- val = KMmsMessageTypeCancelConf;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessageType( val );
- break;
- case ETestAttribute:
- val = 0;
- iByteBuffer->Des().Copy( iValueBuffer );
- if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
- {
- val = KMmsAssignedBcc;
- }
- else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
- {
- val = KMmsAssignedCc;
- }
- else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
- {
- val = KMmsAssignedContent;
- }
- else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
- {
- val = KMmsAssignedContentType;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
- {
- val = KMmsAssignedDate;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
- {
- val = KMmsAssignedDeliveryReport;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
- {
- val = KMmsAssignedDeliveryTime;
- }
- else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
- {
- val = KMmsAssignedExpiry;
- }
- else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
- {
- val = KMmsAssignedFrom;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
- {
- val = KMmsAssignedMessageClass;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
- {
- val = KMmsAssignedMessageId;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
- {
- val = KMmsAssignedMessageSize;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
- {
- val = KMmsAssignedPriority;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
- {
- val = KMmsAssignedReadReply;
- }
- else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
- {
- val = KMmsAssignedSubject;
- }
- else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
- {
- val = KMmsAssignedTo;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
- {
- val = KMmsAssignedReplyCharging;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
- {
- val = KMmsAssignedReplyChargingID;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
- {
- val = KMmsAssignedReplyChargingDeadline;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
- {
- val = KMmsAssignedReplyChargingSize;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
- {
- val = KMmsAssignedPreviouslySentBy;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
- {
- val = KMmsAssignedPreviouslySentDate;
- }
- else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
- {
- val = KMmsAssignedAdditionalHeaders;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
- break;
- case ETestDistributionIndicator:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDistributionIndicator( val );
- break;
- case ETestLimit:
- aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if( error == KErrNone )
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
- }
- break;
- case ETestMessageQuota:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
- }
- break;
- case ETestSizeQuota:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
- }
- break;
- case ETestMessageTotal:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
- }
- break;
- case ETestSizeTotal:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
- }
- break;
- case ETestMessageCount:
- aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
- }
- break;
- case ETestAddKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
- break;
- case ETestRemoveKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
- break;
- case ETestFilterKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
- break;
- case ETestMMState:
- val = 0;
- if ((iValueBuffer.CompareF(KDraft)) == 0)
- {
- val = KMmsDraft;
- }
- else if ((iValueBuffer.CompareF(KSent)) == 0)
- {
- val = KMmsSent;
- }
- else if ((iValueBuffer.CompareF(KNew)) == 0)
- {
- val = KMmsNew;
- }
- else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
- {
- val = KMmsRetrieved;
- }
- else if ((iValueBuffer.CompareF(KForwarded)) == 0)
- {
- val = KMmsForwarded;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
- {
- aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
- }
- else
- {
- aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
- }
- break;
- case ETestQuota:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
- break;
- case ETestStart:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
- }
- break;
- case ETestStore:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
- break;
- case ETestStored:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
- break;
- case ETestStoreStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorStoreStatusTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorPermanentMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorStoreStatusPermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
- {
- val = KMmsErrorStoreStatusPermanentMmboxFull;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
- break;
- case ETestStoreStatusText:
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
- break;
- case ETestTotals:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
- break;
-
- case ETestDeleteInfoIndex:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- order = val;
- break;
-
- case ETestApplicId:
- aMmsHeaders.SetApplicIdL( iValueBuffer );
- break;
- case ETestReplyApplicId:
- aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
- break;
- case ETestApplicInfo:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
- break;
- case ETestContentClass:
- val = 0;
- if ((iValueBuffer.CompareF(KText)) == 0)
- {
- val = KMmsContentClassText;
- }
- else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
- {
- val = KMmsContentClassImageBasic;
- }
- else if ((iValueBuffer.CompareF(KImageRich)) == 0)
- {
- val = KMmsContentClassImageRich;
- }
- else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
- {
- val = KMmsContentClassVideoBasic;
- }
- else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
- {
- val = KMmsContentClassVideoRich;
- }
- else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
- {
- val = KMmsContentClassMegaPixel;
- }
- else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
- {
- val = KMmsContentClassContentBasic;
- }
- else if ((iValueBuffer.CompareF(KContentRich)) == 0)
- {
- val = KMmsContentClassContentRich;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetContentClass( val );
- break;
- case ETestDrmContent:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDrmContent( val );
- break;
- case ETestAdaptationAllowed:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetAdaptationAllowed( val );
- break;
- case ETestRecommendedRetrievalMode:
- val = 0;
- if ((iValueBuffer.CompareF(KManual)) == 0)
- {
- val = KMmsRecommendedRetrievalModeManual;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetRecommendedRetrievalMode( val );
- break;
- case ETestRecRetrievalModeText:
- aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
- break;
- case ETestReplaceId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
- break;
- case ETestStatusText:
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- break;
- case ETestCancelId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
- break;
- case ETestCancelStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
- {
- val = KMmsCancelRequestSuccessfullyReceived;
- }
- else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
- {
- val = KMmsCancelRequestCorrupted;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetCancelStatus( val );
- break;
- default:
- break;
- }
- }
- else
- {
- switch(readStatus)
- {
- case ETestAlias:
- iAliasArray->AppendL( iValueBuffer );
- iAliasCount++;
- break;
-
- default:
- break;
- }
-
- }
- }
- return(-1);
-}
-
-// ---------------------------------------------------------
-// CMmsReadFile()::ReadRowL
-// ---------------------------------------------------------
-//
-TTestReadStatus CMmsReadFile::ReadRowL()
- {
-
- TBuf8<DefaultBufLen> RowBuffer;
- TBuf8<32> KeyBuffer;
-
- // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
- TChar delim( 10 );
- iReader->ReadL( RowBuffer, delim);
- TInt length = RowBuffer.Length();
- if ( RowBuffer.Length() < 2 )
- {
- return ETestEof;
- }
- RowBuffer.Delete(length - 2,2);
-
- // DROP POSSIBLE COMMENT OUT
- TInt pos = RowBuffer.Locate( ';' );
- if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
-
- if ( RowBuffer.Length() == 0 )
- {
- // the line contained only comment
- return ETestUnknown;
- }
-
- // First split the row (:)
- pos = RowBuffer.Locate( ':' );
- if (pos > 0)
- {
- TPtrC8 p = RowBuffer.Mid( pos+1 );
- length = p.Length();
- iValueBuffer.Zero();
- for (TInt i=0; i < length; ++i)
- {
- iValueBuffer.Append(p[i]);
- }
- iValueBuffer.Trim();
- TPtrC8 pp = RowBuffer.Left(pos);
- KeyBuffer.CopyUC(pp);
- KeyBuffer.Trim();
- }
- // TRY TO FIND CORRECT TAG
- if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
- if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
- if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
- if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
- if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
- if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
- if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
- if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
- if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
- if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
- if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
- if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
- if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
- if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
- if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
- if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
- if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
- if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
- if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
- if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
- if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
- if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
- if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
- if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
- if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
- if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
- if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
- if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
- if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
- if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
- if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
- if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
- if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
- if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
- if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
- if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
- if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
- if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
- if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
- if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
- if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
- if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
- if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
- if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
- if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
- if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
- if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
- if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
- if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
- if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
- if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
- if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
- if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
- if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
- if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
- if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
- if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
- if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
- if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
- if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
- if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
- if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
- if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
- if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
- if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
- if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
- if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
- if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
- if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
- if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
- if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
- if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
- if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
- if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
- if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
- if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
- if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
- if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
- if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
- if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
- if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
- if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
- if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
- if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
- if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
- if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
- return ETestUnknown;
- }
-
-// ---------------------------------------------------------
-// CMmsReadFile()::CreateMessageL
-// program build a message from given parts
-// ---------------------------------------------------------
-//
-void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
- {
-
- // Reset inactivity timer to keem viewServer from crashing
- User::ResetInactivityTime();
-
- TInt i;
- TInt error = KErrNone;
- RFile attaFile;
- _LIT8(KLeftAngle, "<");
- _LIT8(KRightAngle, ">");
- // we can't use "seconds from" as it only returns a
- // 32 bit signed integer. If fails in 2038.
- // "microseconds from" returns a 64 bit signed integer
-
- CMsvStore* store = aMmsClient->Entry().EditStoreL();
- CleanupStack::PushL(store);
- aMmsHeaders->StoreL(*store);
- store->CommitL();
- CleanupStack::PopAndDestroy( store );
- store = NULL;
-
- aMmsClient->LoadMessageL(); // read store is needed to do this
-
- store = aMmsClient->Entry().EditStoreL();
- CleanupStack::PushL(store);
- CMsvAttachment* attaInfo = NULL;
- TMsvAttachmentId attaId = 0;
-
- for ( i=0; i < iAttaStructures->Count(); ++i)
- {
- attaId = KMsvNullIndexEntryId;
- iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
-
- error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
- User::LeaveIfError( error );
-
- CleanupClosePushL(attaFile);
-
- CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
- CleanupStack::PushL( mimeHeaders );
- TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
-
- TDataRecognitionResult result;
- result.Reset(); // make sure that it is cleared
-
- if(iAttaStructures->At(i)->iAttaCid->Length())
- {
- TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
- if (attaCID.Find(KLeftAngle) == 0 &&
- attaCID.Find(KRightAngle) == attaCID.Length()-1 )
- {
- // remove angle brackets from cid
- attaCID = attaCID.Mid(1,attaCID.Length()-2);
- }
- mimeHeaders->SetContentIdL(attaCID);
- }
-
- if (iAttaStructures->At(i)->iAttaCharset)
- {
- mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
- }
-
- if (iAttaStructures->At(i)->iAttaName->Length())
- {
- iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
- }
- iParse.Set( iFilename, NULL, NULL );
- iFilename.Copy( iParse.NameAndExt() );
-
- mimeHeaders->SetContentLocationL( iFilename );
-
- // if Mime type has not been set, use RapaRecognizer
- if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
- {
- // TO BE IMPLEMENTED
-
- RApaLsSession lsSession;
-
- if ( lsSession.Connect() == KErrNone )
- {
- CleanupClosePushL( lsSession );
-
- iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
- if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
- {
- // Check confidence level. Recognization must be at least
- // "EProbable". We don't accept the result if it is "EPossible"
- // or "EUnlikely" or "ENotRecognized"!
-
- if ( result.iConfidence < CApaDataRecognizerType::EProbable )
- {
- result.Reset(); // clear buffer and try again with longer buffer
- }
-
- TPtrC8 mimeBuf8 = result.iDataType.Des8();
-
- if ( mimeBuf8.Length() == 0 )
- {
- // Open file buffer and try again..
-
- TInt bufSize = 0;
- (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
- if ( bufSize <= 0 )
- {
- bufSize = 30;
- }
- HBufC8* buf = HBufC8::NewLC( bufSize );
- TPtr8 des = buf->Des();
-
- RFile file;
- TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
- if ( err == KErrNone )
- {
- err = file.Read( des );
- file.Close();
- if ( err == KErrNone )
- {
- if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
- {
- mimeBuf8.Set( result.iDataType.Des8() );
- }
- }
-
- }
- CleanupStack::PopAndDestroy(); // buf
- }
- if ( mimeBuf8.Length() > 0 &&
- result.iConfidence >= CApaDataRecognizerType::EProbable )
- {
- contentType.Set( result.iDataType.Des8() );
- }
- }
- CleanupStack::PopAndDestroy(1); // lssession
- }
- }
-
- if ( contentType.Length() > 0 )
- {
- TInt position = contentType.Find( KMmsSlash8 );
- if ( position >= 0 )
- {
- mimeHeaders->SetContentTypeL( contentType.Left( position ) );
- }
- if ( position < contentType.Length() - 1 )
- {
- mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
- }
-// CreateAttachment2L sets the content type to attaInfo
-// attaInfo->SetMimeTypeL( contentType );
- }
-
- if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
- {
- iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
- iParse.Set( iFilename, NULL, NULL );
- iFilename.Copy( iParse.NameAndExt() );
- mimeHeaders->SetSuggestedFilenameL( iFilename );
- }
-
- TInt j = 0;
- for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
- {
- mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
- }
- for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
- {
- mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
- }
-
- attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
- // attaInfo does not go onto cleaunpstack because ownership will
- // be transferred to attachment manager.
-
- aMmsClient->CreateAttachment2L(
- *store,
- attaFile,
- contentType,
- *mimeHeaders,
- attaInfo,
- attaId);
- attaInfo = NULL; // ownership transferred
-
- CleanupStack::PopAndDestroy(); // mimeHeaders
- CleanupStack::PopAndDestroy(); // attaFile.Close()
-
- if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
- {
- aMmsClient->SetMessageRootL( attaId );
- }
- }
-
- store->CommitL();
- CleanupStack::PopAndDestroy(); // store
-
- // This frees all memory and resets all values
- Reset();
- // Reset inactivity timer to keem viewServer from crashing
- User::ResetInactivityTime();
- }
-
-
-// ---------------------------------------------------------
-// CMmsReadFile()::FindAlias
-// program build a message from given parts
-// ---------------------------------------------------------
-//
-TInt CMmsReadFile::FindAlias( TPtrC aAlias )
- {
- TBuf<DefaultBufLen> abuf;
- for( TInt i=0; i < iAliasCount; ++i )
- {
- abuf.Copy( iAliasArray->MdcaPoint(i) );
- abuf.SetLength( abuf.Locate('=') );
- if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
- }
- return( -1 );
- }
-
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CMmsAttaStructure::CMmsAttaStructure()
- {
- iAtta = NULL;
- iAttaType = NULL;
- iAttaName = NULL;
- iAttaCid = NULL;
- iAttaRecommendedName = NULL;
- }
-
-
-//
-void CMmsAttaStructure::ConstructL()
- {
- iAtta = HBufC8::NewL(DefaultBufLen);
- iAttaType = HBufC8::NewL(DefaultBufLen);
- iAttaName = HBufC8::NewL(DefaultBufLen);
- iAttaCid = HBufC8::NewL(DefaultBufLen);
- iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
- iAttaCharset = 0;
- iXTypeParams = new(ELeave) CDesC8ArrayFlat(4);
- iContentTypeParams = new(ELeave) CDesC8ArrayFlat(4);
-
- }
-
-// Two-phased constructor.
-CMmsAttaStructure* CMmsAttaStructure::NewL()
- {
- CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// Destructor
-CMmsAttaStructure::~CMmsAttaStructure()
- {
- delete iAtta;
- delete iAttaName;
- delete iAttaType;
- delete iAttaCid;
- delete iAttaRecommendedName;
- if ( iContentTypeParams )
- {
- iContentTypeParams->Reset();
- }
- delete iContentTypeParams;
- if ( iXTypeParams )
- {
- iXTypeParams->Reset();
- }
- delete iXTypeParams;
- }
-
-
-// End of File
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmstestbed.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2357 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <mtmdef.h>
-#include <CoreApplicationUIsSDKCRKeys.h>
-#include <mmsheaders.h>
-#include <mmscmds.h>
-#include <mmsencode.h>
-#include <mmscliententry.h>
-#include <logwrap.h>
-#include <logcli.h>
-#include <logview.h>
-#include "mmssettings.h" //use mmssettings.h instead of cmmssettings.h
-#include "mmstestbed.h"
-#include "mmsreadfile.h"
-#include "mmstestuitimer.h"
-#include "mmsteststaticutils.h"
-#include "mmstestbed.hrh"
-
-//constants
-_LIT( KMmsSender, "0601234567" );
-
-MmsTestBed::MmsTestBed()
- {
- //start the timer
- iTimer = CTestUiTimer::NewL();
- iTimer->Cancel();
-
- iWait = CMsvOperationActiveSchedulerWait::NewLC();
- // don't leave iWait on cleanup stack
- CleanupStack::Pop();
-
- //open msvsession
- iSession = CMsvSession::OpenSyncL(*this);
- //create client registry
- iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
- //create client mtm
- iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
- KUidMsgTypeMultimedia);
-
- User::LeaveIfError( iFs.Connect() );
- iFs.SetSessionPath( KRootPath );
- iSettings = CMmsSettings::NewL();
- iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
- findDefaultL();
- iServiceId = iDefaultServiceId;
-
- //validate the settings
- iSettings->ValidateSettings();
-
- iLogEvent = CLogEvent::NewL();
- iLogEvent->SetEventType(KLogMmsEventTypeUid);
- iLogClient = NULL; // we test soon if this is available
- iLogView = NULL; // needs log client
- if ( checkLogClient() )
- {
- // first we generate a general view of all events
- // we'll set the filter when we update the view
- iLogView = CLogViewEvent::NewL( *iLogClient );
- }
- iLogFilter = CLogFilter::NewL();
- // we try to filter MMS events
- iLogFilter->SetEventType(KLogMmsEventTypeUid);
- }
-
-MmsTestBed::~MmsTestBed()
- {
- delete iLogView;
- delete iLogFilter;
- delete iLogClient;
- delete iLogEvent;
- delete iSettings;
- delete iMmsHeaders;
- if(iTimer)
- {
- iTimer->Cancel();
- delete iTimer;
- }
- //delete iMsvEntrySelection;
- delete iMmsClient;
- delete iClientMtmRegistry;
- //delete iClientMtmRegistry;
- delete iSession;
- delete iWait;
- }
-
-void MmsTestBed::setConnectionLocal(bool value)
- {
- //value = true for global off, local on
- //value = false for global on, local off
- iSettings->LoadSettingsL();
- iSettings->SetLocalMode( value );
- iSettings->SaveSettingsL();
- }
-
-void MmsTestBed::fromOutboxToMmsc()
- {
- CMsvEntry* cEntry = NULL;
-
- // Get List of services
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
- KUidMsgTypeMultimedia);
- CleanupStack::PushL(selection);
-
- // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
- for (TInt i = 0; i < selection->Count(); ++i)
- {
- cEntry->SetEntryL(selection->At(i));
- TMsvEntry entry = cEntry->Entry();
- entry.SetReadOnly(EFalse);
- entry.SetSendingState(KMsvSendStateUnknown);
- cEntry->ChangeL(entry);
- }
-
- selection->InsertL(0, iServiceId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack(parameters);
-
- op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending)
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if (iWait->iStatus.Int() != KErrNone)
- {
- //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- CleanupStack::PopAndDestroy(); //cEntry
- }
-
-void MmsTestBed::fromMmscToInbox()
- {
- CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
- CleanupStack::PushL(msvEntrySelection);
-
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- msvEntrySelection->InsertL(0, iServiceId);
- }
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack(parameters);
-
- op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
- paramPack, iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending)
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if (iWait->iStatus.Int() != KErrNone)
- {
- //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); //msvEntrySelection
- }
-
-void MmsTestBed::findDefaultL()
- {
- iSettings->LoadSettingsL();
- iDefaultServiceId = iSettings->Service();
- }
-
-void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
- TAny* aArg2, TAny* /*aArg3*/)
- {
- iEvent = aEvent;
- if (aEvent == EMsvGeneralError)
- {
- return;
- }
- TMsvId parentId = KMsvNullIndexEntryId;
- if (aArg2 != NULL)
- {
- parentId = *(TMsvId*) aArg2;
- }
-
- CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
- TMsvEntry tEntry;
- TMsvId service;
- TInt error = KErrNone;
- error = iSession->GetEntry(selection->At(0), service, tEntry);
-
- CMsvEntry* cEntry = NULL;
- switch (aEvent)
- {
- case EMsvEntriesCreated:
- {
- if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
- {
- // emit signal for new entry into INBOX
- emit entryCreatedInInbox(tEntry.Id());
- }
- else if (parentId == KMsvDraftEntryIdValue)
- {
- // emit signal for new entry into Draft
- emit entryCreatedInDraft(tEntry.Id());
- }
- else if (parentId == iServiceId)
- {
- // emit signal for new Entry into SERVICE
- }
- else
- {
- // do nothing
- }
- }
- break;
- case EMsvEntriesChanged:
- {
- TMsvId id;
- CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
- if (selection == NULL)
- {
- // no selection, cannot handle
- return;
- }
- id = selection->At(0);
- //DEBUG Entry changed"));
- if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
- {
-/*
- cEntry = iSession->GetEntryL( parentId );
- CleanupStack::PushL( cEntry );
- TRAPD (error, cEntry->SetEntryL( id ));
- if ( error != KErrNone )
- {
- CleanupStack::PopAndDestroy(); // cEntry
- return;
- }
- TMsvEntry tEntry = cEntry->Entry();
- if ( tEntry.Visible() )
- {
- // generate fake delivery report
- CMsvStore* store = cEntry->ReadStoreL();
- CleanupStack::PushL( store );
- CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
- CleanupStack::PushL( mmsHeaders );
- mmsHeaders->RestoreL( *store );
- iEncodeBuffer->ResizeL( 0 );
- generateDeliveryReport( mmsHeaders );
- CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
- }
- CleanupStack::PopAndDestroy(); // cEntry
-*/
- }
- }
- break;
- case EMsvEntriesDeleted:
- {
- //emit signal for entry deleted
- }
- break;
- case EMsvEntriesMoved:
- {
- if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
- {
- // entry moved to outbox
- emit entryMovedToOutbox(tEntry.Id());
- }
- else if (parentId == KMsvSentEntryIdValue)
- {
- // entry moved to sent folder
- emit entryMovedToSent(tEntry.Id());
- }
- else
- {
- // do nothing
- }
- }
- break;
- default:
- break;
- }
- }
-
-void MmsTestBed::createMmsService()
- {
- CMmsSettings * settings = CMmsSettings::NewL();
- CleanupStack::PushL( settings );
- settings->CreateNewServiceL( *iSession );
- CleanupStack::PopAndDestroy(); // settings
- return;
- }
-
-void MmsTestBed::cleanup()
- {
- TMsvId entryToBeKilled;
- // Get access to root index
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
-
- entryToBeKilled = iSettings->Service();
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- while (entryToBeKilled != KMsvNullIndexEntryId)
- {
- // delete child of root entry
- deleteEntry(entryToBeKilled, *cEntry);
- entryToBeKilled = iSettings->Service();
- }
-
- CleanupStack::PopAndDestroy(); // cEntry
- // We deleted everything!
- iDefaultServiceId = KMsvNullIndexEntryId;
- iServiceId = KMsvNullIndexEntryId;
- }
-
-void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
- {
- aClientEntry.DeleteL(aEntryId);
- }
-
-void MmsTestBed::cleanupAndCreateNewService()
- {
- cleanup();
- // all old service entries have been destroyed, create a new one
- createMmsService();
- }
-
-void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
- {
- // update settings in mmsclient
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
-
- RFileReadStream readStream;
- readStream.PushL();
-// TMsvId id = KMsvNullIndexEntryId;
- CBufFlat* encodeBuffer = NULL;
- CMmsEncode* encoder = NULL;
-
- // Open the file
- TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
- if (err != KErrNone) User::Leave( err );
-
- TInt retCode = 0;
- CMmsReadFile* readFile = NULL;
- readFile = CMmsReadFile::NewL( iFs, readStream );
- CleanupStack::PushL( readFile );
-
- TInt messageCounter = 0;
- CMsvEntry* cEntry = NULL;
-
- while(!retCode)
- {
- // READ MESSAGE TO BUFFERS
- iMmsHeaders->Reset(iSettings);
- // put in some message type just for fun (testing...)
- iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
- retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
- if(readFile->iMessageType == ETestNewMessage)
- {
- // CREATE MESSAGE ENTRY
- switch ( aCommand )
- {
- case ECreateToInbox:
- case ECreateNotification:
- cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- break;
- case ECreateToSentItems:
- cEntry = iSession->GetEntryL(KMsvSentEntryId);
- break;
- case ECreateToDrafts:
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- break;
- case ECreateHeadersFromFile:
- // here we just encode headers, no message entry
- // the entry is fake.
- break;
- case ECreateMMBoxViewConf:
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- // entry is not created for the description items
- // they become attachments
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- }
- break;
- default:
- cEntry = iSession->GetEntryL(aBox);
- break;
- }
-
- // if we are just playing with headers we have no entry
- if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
- {
- CleanupStack::PushL(cEntry);
- iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
-
- // CREATE MESSAGE
- iMmsClient->CreateMessageL(iServiceId);
- }
- else if ( aCommand == ECreateMMBoxViewConf )
- {
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- CleanupStack::PushL(cEntry);
- iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
-
- // CREATE MESSAGE
- iMmsClient->CreateMessageL(iServiceId);
- }
- else
- {
- encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
- CleanupStack::PushL( encodeBuffer );
- encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
-
- // encode headers to a binary file
- encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
-
- iFilename = KMmsMMBoxDescriptionDirectory;
- TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
-
- CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
- encodeBuffer = NULL;
- encoder = NULL;
- }
- }
- else
- {
- encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
- CleanupStack::PushL( encodeBuffer );
- encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
-
- // encode headers to a binary file
- encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
-
- iFilename = KMmsDumpDirectory;
- TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
-
- CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
- encodeBuffer = NULL;
- encoder = NULL;
- }
- }
-
- if ( aCommand != ECreateHeadersFromFile &&
- ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
- {
- if(readFile->iMessageType == ETestSettings)
- {
- TMsvId ServiceId = iMmsClient->DefaultServiceL();
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
- }
-
- TMemoryInfoV1Buf memory;
- UserHal::MemoryInfo( memory );
- TInt available = memory().iFreeRamInBytes;
-// TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
-
- TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
-
- available = memory().iFreeRamInBytes;
-// TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
-
- if(readFile->iMessageType == ETestNewMessage)
- {
- TMsvEntry tEntry = iMmsClient->Entry().Entry();
- TMsvId id = tEntry.Id();
- if ( err == KErrNone )
- {
- // SAVE MESSAGE
- iMmsClient->SaveMessageL();
-
- // If we are creating a MMBox View confirmation,
- // we add all binary files from KMmsMMBoxDirectory
- // as attachments.
-
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- addMMBoxDescriptions();
- }
-
- // reload the entry in case mms client put something into it
- // MESSAGE MUST BE SET VISIBLE
- tEntry = iMmsClient->Entry().Entry();
- if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
- {
- tEntry.iMtmData1 |= KMmsMessageAdvertisement;
- }
- else if ( iMmsClient->MessageClass() == EMmsClassInformational )
- {
- tEntry.iMtmData1 |= KMmsMessageInformational;
- }
- tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
-
- // Test: Set all as editor oriented - except notifications!
- if ( aCommand == ECreateNotification )
- {
- tEntry.iMtm = KUidMsgMMSNotification;
- }
- else
- {
- tEntry.iMtmData1 |= KMmsMessageEditorOriented;
- }
- if ( aCommand == ECreateToInbox )
- {
- tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
- tEntry.SetReadOnly( ETrue );
- tEntry.SetNew( ETrue );
- tEntry.SetUnread( ETrue );
- }
- else if ( aCommand == ECreateToSentItems )
- {
- tEntry.SetReadOnly( ETrue );
- }
- tEntry.SetVisible( ETrue );
- tEntry.SetInPreparation( EFalse );
- TTime now;
- now.UniversalTime();
- tEntry.iDate = now;
- TMsvId entryId = tEntry.Id();
- iMmsClient->Entry().ChangeL( tEntry );
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- // Encode to the directory that is used to fetch MMBox view
- iFilename.Copy( KMmsMMBoxDirectory );
- encodeMessageFromDrafts();
- cEntry->SetEntryL( KMsvDraftEntryId );
- cEntry->DeleteL( entryId );
- }
- }
- else
- {
- //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
- iSession->RemoveEntry(id);
- err = KErrNone; // clear error
- }
- CleanupStack::PopAndDestroy(); // cEntry
- cEntry = NULL;
- }
- if(readFile->iMessageType == ETestSettings)
- {
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
- }
- }
-
- CleanupStack::PopAndDestroy(); //readFile
-
- readStream.Close();
- readStream.Pop();
-
- /*
- iMmsClient->SwitchCurrentEntryL(id);
- */
- }
-
-void MmsTestBed::addMMBoxDescriptions()
- {
- // add the contents of KMmsMMBoxDescriptionDirectory as attachments
- CDir* fileList = NULL;
- TInt i = 0; // general counter
- TInt error = KErrNone;
- iCurrentPath = KMmsMMBoxDescriptionDirectory;
-
- iFs.SetSessionPath(iCurrentPath);
-
- TFindFile finder( iFs );
- error = finder.FindWildByPath( KWild, NULL, fileList );
- CleanupStack::PushL( fileList );
- TInt fileCounter = 0;
-
- if ( error == KErrNone )
- {
- fileCounter = fileList->Count();
- }
-
- TEntry entry;
-
- if ( error == KErrNone )
- {
- for ( i = 0; i < fileCounter; ++i )
- {
- // Reset inactivity timer to keep viewServer from crashing
- User::ResetInactivityTime();
- entry = (*fileList)[i]; // name is entry.iName
- iFilename.Copy( iCurrentPath );
- iFilename.Append( entry.iName );
- TPtrC ptr;
- ptr.Set( iFilename );
- iWait->iStatus = KErrNone;
- iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
-
- iWait->Start();
- // The descriptions are cleared after being used
- iFs.Delete( ptr);
- }
- }
-
- iMmsClient->SaveMessageL(); // just in case somthing must be updated
- CleanupStack::PopAndDestroy(); // fileList
- fileList = NULL;
- }
-
-void MmsTestBed::encodeMessageFromDrafts()
- {
- CMmsEncode* encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
- // encode a message iMmsClientPoints to
- iMmsClient->LoadMessageL();
- CMsvStore* store = iMmsClient->Entry().ReadStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->RestoreL( *store );
- CleanupStack::PopAndDestroy(); // store
- store = NULL;
- iWait->iStatus = KErrNone;
-
-// caller sets the directory
-// iFilename = KMmsMessageDumpDirectory;
-
- CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
- CleanupStack::PushL( entryWrapper );
- iEncodeBuffer->ResizeL(0);
- encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
- iWait->Start();
- if ( iWait->iStatus == KErrNone )
- {
- TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
- }
- iEncodeBuffer->ResizeL(0);
- CleanupStack::PopAndDestroy(); // entryWrapper
- CleanupStack::PopAndDestroy(); // encoder
- }
-
-void MmsTestBed::deleteNotifications()
- {
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
-
- CMsvEntry* cEntry = NULL;
- // delete all messages from the specified box
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
-
- if ( mmsFolderId != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL(mmsFolderId);
-
- // show invisible entries
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL(msvEntrySelection);
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- if (msvEntrySelection->Count() > 0)
- {
- CMsvOperation* op = iSession->TransferCommandL(
- *msvEntrySelection,
- EMmsDeleteEntries,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- CleanupStack::PopAndDestroy(); // op
- }
-
- // These cannot be deleted unless we have the a server mtm
- // corresponding to this mtm type.
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CleanupStack::PopAndDestroy(); //msvEntrySelection
- msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
- CleanupStack::PushL(msvEntrySelection);
-
- if (msvEntrySelection->Count() > 0)
- {
- CMsvOperation* op = iSession->TransferCommandL(
- *msvEntrySelection,
- EMmsDeleteEntries,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- CleanupStack::PopAndDestroy(); // op
- }
-
- CleanupStack::PopAndDestroy(); //msvEntrySelection
-
- CleanupStack::PopAndDestroy(); //cEntry
- }
- }
-
-TMsvId MmsTestBed::findMMSFolder()
- {
- return iSettings->NotificationFolder();
- }
-
-void MmsTestBed::restoreFactorySettings()
- {
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
- // do not reset access point
- TInt accessPoint = iSettings->AccessPoint( 0 );
- iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
- TInt count = iSettings->AccessPointCount();
- TInt i = 0;
- for ( i = count - 1; i >= 0; --i )
- {
- iSettings->DeleteAccessPointL( i );
- }
- // restore the original access point
- if ( accessPoint > 0 )
- {
- // a negative access point is an error (most likely "KErrNotFound")
- iSettings->AddAccessPointL( accessPoint, 0 );
- }
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
-
-void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
- {
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
-
- iSettings->SetReceivingModeHome( aState );
-
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
-
-void MmsTestBed::sendFromFile()
- {
- CMsvOperation * op = NULL;
-
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
- CleanupStack::PushL( cEntry );
-
- CMsvEntrySelection* selection = NULL;
- selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy(); // cEntry
- CleanupStack::PushL( selection );
-
- TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
- if ( error != KErrNone )
- {
- CleanupStack::PopAndDestroy(); // selection
- delete op;
- return;
- }
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(2); // op, selection
- }
-
-void MmsTestBed::sendOneByOne()
- {
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
- CleanupStack::PushL( cEntry );
-
- CMsvEntrySelection* selection = NULL;
- selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL( selection );
-
- CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( shortSelection );
-
- TInt i;
-
- for ( i = 0; i < selection->Count(); ++i )
- {
- shortSelection->Reset();
- shortSelection->AppendL( selection->At( i ) );
-
- CMsvOperation * op = NULL;
-
- TTime now;
- now.UniversalTime();
-
- TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
- if ( error != KErrNone )
- {
- delete op;
- CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
- return;
- }
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
-
- }
- CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
- }
-
-void MmsTestBed::sendNotifications()
- {
- // Only send one notification!!
-
- TInt error = KErrNone;
-
- if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
- {
- //Not a file
- return;
- }
- TMsvId mmsFolder = findMMSFolder();
-
- TEntry entry;
-
-
- // now I think we have a filename
- TEntry orgEntry;
- TUint size = 0;
- error = iFs.Entry( iCurrentFile, orgEntry );
- size = orgEntry.iSize;
-
- //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
- if ( size == 0 )
- {
- //empty file
- //TMmsLogger::Log(_L("- empty file"));
- return;
- }
-
- if ( iEncodeBuffer == NULL )
- {
- iEncodeBuffer = CBufFlat::NewL( size );
- }
- else
- {
- iEncodeBuffer->ResizeL( 0 );
- iEncodeBuffer->ResizeL( size );
- }
-
- RFile inFile;
- error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
- TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
- if ( error == KErrNone )
- {
- error = inFile.Read( ptr, size );
- inFile.Close();
- }
- else
- {
- //Error
- //TMmsLogger::Log(_L("- can't read file"));
- return;
- }
-
- TUint8 byte;
- TUint position = 0;
- TUint32 uintvar = 0;
-
- if ( size > 2 )
- {
- iEncodeBuffer->Read( 1, &byte, 1 );
- if ( byte == 6 ) // PUSH PDU
- {
- // try to find out length of header
- position = 2;
- iEncodeBuffer->Read( position, &byte, 1);
-
- while ( byte & 0x80 && position < size )
- {
- uintvar += ( byte & 0x7f );
- uintvar <<= 7;
- position++;
- iEncodeBuffer->Read( position, &byte, 1 );
- }
-
- // add last byte without shift
- uintvar += byte;
- position++;
- }
- }
-
- position += uintvar;
-
- if ( position < size )
- {
- ptr = iEncodeBuffer->Ptr( position );
- size = ptr.Length();
- }
-
- if ( size == 0 )
- {
- //no MMS stuff
- //TMmsLogger::Log(_L("- no MMS stuff"));
- return;
- }
-
- TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
-
- // Now we have streamed our data into this entry.
- // Now we have an entry that says: local service, MMS MTM
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- if ( entryId != KMsvNullIndexEntryId )
- {
- selection->AppendL( entryId );
- }
- else
- {
- selection->AppendL( iDefaultServiceId );
- }
-
- TWatcherParameters parameters; // initialized to zero
- parameters.iWatcherId = RThread().Id();
- parameters.iDataPointer = &ptr;
- TWatcherParametersBuf paramPack( parameters );
-
- CMsvOperation * op = NULL;
-
- op = iSession->TransferCommandL(
- *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- User::After(1000000);
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::copyDrafts()
- {
- CMsvEntry* cEntry = NULL;
-// Copies contents of sent folder to drafts for retrying sending.
-
- cEntry = iSession->GetEntryL(KMsvSentEntryId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages in drafts
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-
- TMsvLocalOperationProgress progress;
- cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
-
- TInt i = 0;
- for ( i = 0; i < selection->Count(); ++i )
- {
- cEntry->SetEntryL( selection->At( i ) );
- TMsvEntry entry = cEntry->Entry();
- entry.SetReadOnly( EFalse );
- cEntry->ChangeL( entry );
- }
-
- CleanupStack::PopAndDestroy(2); // selection, cEntry
- }
-
-void MmsTestBed::garbageCollection(TUint32 aReason)
- {
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
-
- TMMSGarbageCollectionParameters parameters; // initialized to zero
- parameters.iReasonFlags = aReason;
- TMMSGarbageCollectionParametersBuf paramPack( parameters );
- op = iSession->TransferCommandL(
- *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::messageVariation()
- {
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
-
- op = iSession->TransferCommandL(
- *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::cancelSendScheduling()
- {
- CMsvEntry* cEntry = NULL;
- setFetchingState( EMmsReceivingPostpone );
- testFile( iCurrentFile );
- scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
- deleteSendSchedule();
-
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- if (iMsvEntrySelection != NULL)
- {
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- }
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy();
- }
-
-void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
- {
- CMsvEntry* cEntry = NULL;
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- cEntry = iSession->GetEntryL(aBoxId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-// selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledSend,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::deleteSendSchedule()
- {
- CMsvEntry* cEntry = NULL;
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsDeleteSchedule,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::cancelFetchScheduling()
- {
- TMsvId mmsFolder = findMMSFolder();
- CMsvEntry* cEntry = NULL;
- setFetchingState( EMmsReceivingPostpone );
- testFile( iCurrentFile );
- fromOutboxToMmsc(); // immediate send (EMmsSend)
-
- // Wait until notification has arrived - may take a while in global mode
- TInt i = 0;
- while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
- && i < 2000 )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- i++;
- if ( (i/100) * 100 == i )
- {
- //TMmsLogger::Log(_L("%d:th wait cycle"), i );
- }
- CActiveScheduler::Start();
- }
- iTimer->Cancel();
-
- fetchForced( 10000 ); // delay to allow cancelling
- deleteFetchSchedule();
-
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(mmsFolder);
- if (iMsvEntrySelection != NULL)
- {
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- }
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
- {
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledReceiveForced,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::deleteFetchSchedule()
- {
- CMsvEntry* cEntry = NULL;
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
- cEntry = iSession->GetEntryL( mmsFolderId );
- CleanupStack::PushL(cEntry);
- // Get all notifications
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsDeleteSchedule,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::doAFetchCycle()
- {
- // Sends a message from iCurrentFile and lets it come back
- TMsvId mmsFolder = findMMSFolder();
- testFile( iCurrentFile );
- fromOutboxToMmsc(); // immediate send (EMmsSend)
- // fetching will start automatically
-
- TInt i = 0;
- while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
- && i < 2000
- && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- i++;
- if ( (i/100) * 100 == i )
- {
- //TMmsLogger::Log(_L("%d:th wait cycle"), i );
- }
- CActiveScheduler::Start();
- }
- iTimer->Cancel();
- }
-
-bool MmsTestBed::checkLogClient()
- {
- if ( iLogClient == NULL )
- {
- TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
- }
- return ( iLogClient != NULL );
- }
-
-int MmsTestBed::getLogEntries()
- {
- TInt count = 0;
- if ( !iLogView )
- {
- return 0;
- }
-
- if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
- {
- // should complete with KErrNone
- iWait->Start();
- if ( iWait->iStatus.Int() == KErrNone )
- {
- count = iLogView->CountL();
- }
- }
- return count;
- }
-
-void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
- {
- CMsvOperation* opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
- iWait->Start();
- if (!opert->iStatus.Int()==KErrNone)
- {
- // what should we do? panic?
- }
-
- TPckgBuf<TMsvLocalOperationProgress> package;
- package.Copy(opert->ProgressL());
- *(TMsvId*)&aNewEntry = package().iId;
-
- delete opert; opert=NULL;
- }
-
-void MmsTestBed::cleanOutbox()
- {
- TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
- }
-
-void MmsTestBed::cleanInbox()
- {
- TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
- }
-
-void MmsTestBed::cleanSent()
- {
- TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
- }
-
-void MmsTestBed::cleanDrafts()
- {
- TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
- }
-
-void MmsTestBed::cleanAll()
- {
- cleanInbox();
- cleanOutbox();
- cleanSent();
- cleanDrafts();
- TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
- deleteNotifications();
- }
-
-void MmsTestBed::reply()
- {
- // The first message from inbox is replied to
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
- CMsvOperation * op = NULL;
- op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::replyToAll()
- {
- // The first message from inbox is replied to
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
-
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
- KMsvMessagePartRecipient;
- CMsvOperation * op = NULL;
- op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::forward()
- {
- // The first message from inbox is forwarded
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
-
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
- KMsvMessagePartRecipient | KMsvMessagePartAttachments;
- CMsvOperation * op = NULL;
- op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- iMmsClient->SwitchCurrentEntryL( newEntry );
- // Add a sender: 0601234567
- iMmsClient->LoadMessageL();
- iMmsClient->SetSenderL( KMmsSender );
- iMmsClient->SaveMessageL();
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::sendReadReport()
- {
- // TURN READ REPORTS ON (until available from menu)
- iSettings->LoadSettingsL();
- iSettings->SetReadReplyReportSendingAllowed( ETrue );
- iSettings->SaveSettingsL();
- iMmsClient->RestoreSettingsL();
-
-
- // Read report is sent for the first message in inbox
- CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
-
- if ( iMsvEntrySelection->Count() == 0 )
- {
- return;
- }
- TMsvId originalEntry = iMsvEntrySelection->At( 0 );
-
- // new test using Client MTM
- CMsvOperation * op = NULL;
- op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy( op );
- op = NULL;
-
- // Try sending the read report to current entry
-
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy( op );
- op = NULL;
-
-/*
- cEntry->SetEntryL( originalEntry );
- iMmsHeaders->Reset();
- CMsvStore* store = cEntry->ReadStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->RestoreL( *store );
- CleanupStack::PopAndDestroy( store );
- store = NULL;
- HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
- CleanupStack::PushL( messageId );
- messageId->Des().Copy( iMmsHeaders->MessageId() );
-
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- iMmsClient->LoadMessageL();
-
- iMmsHeaders->Reset();
- iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
- // Message id cannot be accessed via MMS Client MTM!
-
- iMmsHeaders->SetMessageIdL( messageId->Des() );
- CleanupStack::PopAndDestroy( messageId );
-
- iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
- // sender must be insert-address-token because we don't know our number
- TTime now;
- now.UniversalTime();
-
- _LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
-
- TTime y1970( K1970 );
- TTimeIntervalMicroSeconds interval;
- // we can't use "seconds from" as it only returns a
- // 32 bit signed integer. If fails in 2038.
- // "microseconds from" returns a 64 bit signed integer
- interval = now.MicroSecondsFrom( y1970 );
- // date in iMmsHeaders() in seconds from 1.1.1970.
- iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
- iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
-
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = FindMMSFolderL();
-
- cEntry->SetEntryL( mmsFolderId );
-
- TMsvEntry entry;
- entry.iType = KUidMsvMessageEntry;
- entry.iMtm = KUidMsgTypeMultimedia;
- entry.SetVisible( ETrue );
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- entry.iRelatedId = iDefaultServiceId;
- entry.iMtmData1 = KMmsMessageReadRecInd;
- cEntry->CreateL( entry );
- TMsvId entryId = entry.Id();
-
- cEntry->SetEntryL( entryId );
-
- store = cEntry->EditStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->StoreL( *store );
- store->CommitL();
- CleanupStack::PopAndDestroy( store );
- store = NULL;
-
- CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, entryId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy( op );
- CleanupStack::PopAndDestroy( selection );
-*/
- CleanupStack::PopAndDestroy( cEntry );
- }
-
-int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
- {
- TInt error = KErrNone;
- TInt messageCount = 0;
- TInt failureCount = 0;
- do {
- CMsvEntry* cEntry = NULL;
-
- // Get List of services
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- failureCount++;
- // These are failures that fail in Message server.
- if ( failureCount >= 63 && failureCount <= 64 )
- {
- failureCount = 65;
- }
- cEntry->SetEntryL( iServiceId );
- TMsvEntry entry = cEntry->Entry();
- entry.iMtmData3 &= 0x0000000FF;
- entry.iMtmData3 |= failureCount << 8;
- cEntry->ChangeL( entry );
-
- selection->InsertL(0, iServiceId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
-
- if ( error == KErrNone )
- {
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- error = iWait->iStatus.Int();
- if ( iWait->iStatus.Int() != KErrNoMemory )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
- }
-
- CleanupStack::PopAndDestroy(); // op
- }
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // selection
- CleanupStack::PopAndDestroy(); // cEntry
- selection = NULL;
- cEntry = NULL;
- cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
- CleanupStack::PushL(cEntry);
- selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- messageCount = selection->Count();
- delete selection;
- selection = 0;
- CleanupStack::PopAndDestroy(); //cEntry
- }
- while ( error == KErrNoMemory || messageCount > 0 );
- return failureCount;
- }
-
-int MmsTestBed::fromMmscToInboxWithMemoryFailure()
- {
- TInt error = KErrNone;
- TInt failureCount = 0;
- TInt messageCount = 0;
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
-
- do {
- // Inbox must be cleaned if failure makes message to be fetched more than once.
- // should not happen, but this test is quite stressful, and perfect result
- // cannot be guaranteed.
- // What is expected:
- // 1. Program does not crash
- // 2. After sufficient number of retries the message is fetched and notification deleted.
- TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
- CMsvEntry* cEntry = NULL;
- CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
- CleanupStack::PushL(msvEntrySelection);
-
- cEntry = iSession->GetEntryL(iServiceId);
- CleanupStack::PushL(cEntry);
-
- failureCount++;
- // These are failures that fail in Message server.
- if ( failureCount >= 63 && failureCount <= 64 )
- {
- failureCount = 65;
- }
- cEntry->SetEntryL( iServiceId );
-
- TMsvEntry entry = cEntry->Entry();
- entry.iMtmData3 &= 0x0000000FF;
- entry.iMtmData3 |= failureCount << 8;
- cEntry->ChangeL( entry );
-
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- msvEntrySelection->InsertL(0, iServiceId);
- }
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
- EMmsReceiveForced,
- *msvEntrySelection,
- paramPack,
- iWait->iStatus) );
-
- if ( error == KErrNone )
- {
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- error = iWait->iStatus.Int();
- if ( iWait->iStatus.Int() != KErrNoMemory )
- {
- //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
- }
- }
-
- CleanupStack::PopAndDestroy(); // op
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // msvEntrySelection
- CleanupStack::PopAndDestroy(); // cEntry
- msvEntrySelection = NULL;
- cEntry = NULL;
- cEntry = iSession->GetEntryL( mmsFolderId );
- CleanupStack::PushL(cEntry);
- msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- messageCount = msvEntrySelection->Count();
- delete msvEntrySelection;
- msvEntrySelection = 0;
- CleanupStack::PopAndDestroy(); //cEntry
- }
- while ( error == KErrNoMemory || messageCount > 0 );
- if ( error != KErrNoMemory && error != KErrNone )
- {
- //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
- }
- return failureCount;
- }
-
-void MmsTestBed::sendViaClient()
- {
- CMsvEntry* cEntry = NULL;
-
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages in drafts
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-
- CMsvOperation * op = NULL;
- TTime now;
- now.UniversalTime();
- op = iMmsClient->SendL( *selection, iWait->iStatus, now );
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
- {
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledReceive,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::fetchForcedImmediate()
- {
- TCommandParameters parameters;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsReceiveForced,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::getEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-
- CLogEventType* eventType = CLogEventType::NewL();
- CleanupStack::PushL( eventType );
- eventType->SetUid(iLogEvent->EventType());
- iLogClient->GetEventType( *eventType, iWait->iStatus );
-
- iWait->Start();
- CleanupStack::PopAndDestroy(); // eventType
- }
-
-void MmsTestBed::addEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-
- CLogEventType* eventType = CLogEventType::NewL();
- CleanupStack::PushL( eventType );
- eventType->SetUid(iLogEvent->EventType());
- eventType->SetDescription(_L("Multimedia Message") );
- eventType->SetLoggingEnabled( ETrue );
-
-// iWait->iStatus = KRequestPending;
- iLogClient->AddEventType( *eventType, iWait->iStatus );
- iWait->Start();
- CleanupStack::PopAndDestroy(); // eventType
- }
-
-void MmsTestBed::deleteEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-// iWait->iStatus = KRequestPending;
- iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
- iWait->Start();
- }
-
-void MmsTestBed::cleanLog()
- {
- TInt count = 0;
-
- count = getLogEntries();
-
- TInt i;
- for ( i = 0; i < count; ++i )
- {
- // when a view is created, it will be positioned on the first event
-// iWait->iStatus = KRequestPending;
- iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
- iWait->Start();
-
- if ( iLogView->NextL( iWait->iStatus ) )
- {
- // should complete with KErrNone
- iWait->Start();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- // could not get next event!
- break;
- }
- }
- else
- {
- break; // no more events!
- }
- }
- }
-
-void MmsTestBed::setOnline(bool value)
- {
- //value = true for online mode
- //value = false for offline mode
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
- if( retval == KErrNone )
- {
- repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
- delete repository;
- }
- }
-
-void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
- {
- iEncodeBuffer->ResizeL( 1024 );
-
- TInt position = 0;
-
- // encode message type
- iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
- position++;
- iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
- position++;
-
- // version
- iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
- position++;
-
- TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
- iEncodeBuffer->Write( position, &version, 1 );
- position++;
-
- // message id from the headers
- // At least once MMSC did not send us the message id!
- // if message id is missing, we cannot match the entry!
- // This only a fake. Real delivery reports should always
- // contain the message id.
- if ( aMmsHeaders->MessageId().Length() > 0 )
- {
- iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
- position++;
- iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
- position += aMmsHeaders->MessageId().Length();
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
- }
-
- // To is taken from the headers
- iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
- position++;
-
- TPtrC recipient;
- if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
- aMmsHeaders->ToRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->ToRecipients()[0] );
- }
- else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
- aMmsHeaders->CcRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->CcRecipients()[0] );
- }
- else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
- aMmsHeaders->BccRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->BccRecipients()[0] );
- }
- else
- {
- recipient.Set( _L("Jasso-Kissa@jii.fi") );
- }
-
- TMmsAddressType addressType = EMmsAddressTypeUnknown;
-
- if ( recipient.Find( KMiuMau ) != KErrNotFound )
- {
- addressType = EMmsAddressTypeEmail;
- }
- else
- {
- addressType = EMmsAddressTypeMobile;
- }
-
- TUint8 character;
- TInt i;
- if ( addressType == EMmsAddressTypeEmail )
- {
- // email address - ASCII ONLY - THIS IS JUST A TEST!
-
- for ( i = 0; i < recipient.Length(); ++i )
- {
- character = TUint8( recipient[i] & 0xff );
- iEncodeBuffer->Write( position, &character, 1 );
- position++;
- }
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
-
- }
- else
- {
- // must be a phone number
- // We expect for now that the format is correct as is
- // All legal characters present in a phone number are ASCII
-
- TInt i;
- for ( i = 0; i < recipient.Length(); ++i )
- {
- character = TUint8( recipient[i] & 0xff );
- iEncodeBuffer->Write( position, &character, 1 );
- position++;
- }
- iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
- position += KMmsPlmnLength;
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
- }
-
- // date
- iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
- position++;
-
- TLocale locale;
- locale.Refresh();
- TInt64 UtcDate;
- TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
-
- TTime now;
- now.UniversalTime();
- UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
-
- UtcDate -= universalTimeOffset.Int();
-
- if ( locale.QueryHomeHasDaylightSavingOn() )
- {
- TTimeIntervalSeconds daylightSaving( 60 * 60 );
- UtcDate -= daylightSaving.Int();
- }
-
- TUint8 len; // number of bytes we will need
- len = 0;
- TUint8 array[8];
-
- TInt64 temp = UtcDate;
-
- for (i = 7; i >= 0; --i)
- {
- array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
- I64LSR( temp, 8 );
- }
-
- len = 8;
- i = 0;
- while( ( array[i]== 0 ) && ( i < 8 ) )
- {
- i++;
- len--;
- }
-
- // a zero should be coded as short integer.
- // However, if there is a valid reason to code a zero as a long integer,
- // we allow it. The caller should know what he is doing.
- if ( len == 0 )
- {
- len = 1;
- }
- // write short length
- iEncodeBuffer->Write( position, &len, 1 );
- position++;
- // write as many bytes as were non-zero
- iEncodeBuffer->Write( position, &(array[8 - len] ), len );
- position+= len;
- // status
- iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
- position++;
- iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
- position++;
- // DONE!!!
- iEncodeBuffer->ResizeL( position );
- return;
- }
-
-void MmsTestBed::sendDeliveryReport()
- {
- if ( iEncodeBuffer->Size() == 0 )
- {
- //No delivery report
- return;
- }
-
-
- TMsvId mmsFolder = findMMSFolder();
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
-
- TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
- TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
-
- // Now we have streamed our data into this entry.
- // Now we have an entry that says: local service, MMS MTM
-
- if ( entryId != KMsvNullIndexEntryId )
- {
- selection->AppendL( entryId );
- }
- else
- {
- selection->AppendL( iDefaultServiceId );
- }
-
- TWatcherParameters parameters; // initialized to zero
- parameters.iWatcherId = RThread().Id();
- parameters.iDataPointer = &ptr;
- TWatcherParametersBuf paramPack( parameters );
-
- CMsvOperation * op = NULL;
-
-// iWait->iStatus = KRequestPending;
- op = iSession->TransferCommandL(
- *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmsteststaticutils.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,528 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <f32file.h>
-#include <centralrepository.h>
-#include <apparc.h>
-#include <msvapi.h>
-#include <msvids.h>
-
-#include "mmsteststaticutils.h"
-#include "mmsconst.h"
-#include "MmsEnginePrivateCRKeys.h"
-#include "mmssettings.h"
-#include "mmsheaders.h"
-#include "mmsservercommon.h"
-#include "mmsencode.h"
-
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
-: iArray1(aArray1), iArray2(aArray2)
- {
- }
-
-TInt TMmsJoinedArrays::MdcaCount() const
- {
- TInt count=0;
- if (iArray1)
- count += iArray1->MdcaCount();
- if (iArray2)
- count += iArray2->MdcaCount();
- return count;
- }
-
-TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
- {
- if (iArray1)
- {
- if (aIndex < iArray1->MdcaCount())
- return iArray1->MdcaPoint(aIndex);
- else
- aIndex -= iArray1->MdcaCount();
- }
- return iArray2->MdcaPoint(aIndex);
- }
-
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-TMmsTestUtils::TMmsTestUtils()
- {
-
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
- {
- RFile file;
- TInt error = KErrNone;
-
- TInt textBufferSize = 256;
- HBufC* textBuffer = HBufC::NewL( textBufferSize );
- TPtr textPtr = textBuffer->Des();
- TFileText textFile;
-
- error = file.Open( aFs, aFileName,
- EFileRead|EFileShareReadersOnly );
-
- if ( error == KErrNone )
- {
- textFile.Set( file );
- error = textFile.Seek( ESeekStart );
- }
-
- if ( error == KErrNone )
- {
- error = textFile.Read( textPtr );
- }
-
- file.Close();
-
- if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
- {
- textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
- }
-
- return textBuffer;
- }
-
-//----------------------------------------------------------------------------------------
-// turn on detailed logging while decoding a message
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::DecodeLoggingOnL()
- {
- // CenRep for decodelogging
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 1;
- repository->Set( KMmsEngineDecodeLog, temp );
- delete repository;
- }
- }
-
-//----------------------------------------------------------------------------------------
-// turn off detailed logging while decoding a message
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::DecodeLoggingOffL()
- {
- // CenRep for decodelogging
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 0;
- repository->Set( KMmsEngineDecodeLog, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn on binary dump of incoming messages
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::BinaryDumpOnL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 1;
- repository->Set( KMmsEngineBinaryDump, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn off binary dump of incoming messages
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::BinaryDumpOffL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 0;
- repository->Set( KMmsEngineBinaryDump, temp );
- delete repository;
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
- {
- // Delete the files in the directory
- CFileMan* fileMan = CFileMan::NewL( aFs );
- CleanupStack::PushL( fileMan );
- fileMan->RmDir( KMmsDefaultLocalModeDir );
- fileMan->RmDir( KMmsMMBoxDirectory );
- fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
- CleanupStack::PopAndDestroy(); // fileManager
- // we don't want to throw these away!
- aFs.MkDirAll( KMmsDefaultLocalModeDir );
- aFs.MkDirAll( KMmsMMBoxDirectory );
- aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
- {
- TInt error = KErrNone;
- aFs.MkDirAll( aFilename );
- TUint att;
- if ( aFs.Att( aFilename, att ) == KErrNone )
- {
- _LIT( KRelated, "dump.mms");
- aParse.Set( aFilename, &KRelated, NULL );
- aFilename = aParse.FullName();
- error = CApaApplication::GenerateFileName( aFs, aFilename );
- if ( error == KErrNone )
- {
- RFile file;
- error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
- // for message id generation
- aParse.Set( aFilename, NULL, NULL );
- if ( error == KErrNone )
- {
- // the data is supposed to be in the encode buffer
- TPtr8 ptr = aBuffer.Ptr( 0 );
- file.Write( ptr );
- file.Flush();
- }
-
- // done - close files
- file.Close();
- }
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
- {
- CMsvEntry* cEntry = NULL;
- // delete all messages from the specified box
- cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(aBoxId);
- // show invisible entries
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL(msvEntrySelection);
-
- CMsvEntrySelection* selection = NULL;
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
- CleanupStack::PushL( selection );
- if ( selection->Count() > 0 )
- {
- msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
- }
- CleanupStack::PopAndDestroy(); // selection
-
- int i;
- for (i = 0; i < msvEntrySelection->Count(); ++i)
- {
- CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
- CleanupStack::PushL( entry );
- TMsvEntry tEntry = entry->Entry();
- tEntry.SetReadOnly(EFalse);
- entry->ChangeL(tEntry);
- cEntry->DeleteL( msvEntrySelection->At(i) );
- CleanupStack::PopAndDestroy( entry );
- }
-
- CleanupStack::PopAndDestroy(msvEntrySelection);
- CleanupStack::PopAndDestroy(cEntry);
- }
-
-//----------------------------------------------------------------------------------------
-// turn on logging email recipients
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::EmailLoggingOnL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
- if( retval == KErrNone )
- {
- TInt temp = 1;
- repository->Set( KMmsEngineLogEmailRecipients, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn off logging email recipients
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::EmailLoggingOffL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
- if( retval == KErrNone )
- {
- TInt temp = 0;
- repository->Set( KMmsEngineLogEmailRecipients, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
- {
- CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(aBoxId);
- if (aMsvEntrySelection != NULL)
- {
- delete aMsvEntrySelection;
- aMsvEntrySelection = NULL;
- }
- aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
- CleanupStack::PopAndDestroy(); // cEntry
- return aMsvEntrySelection->Count();
- }
-
-
-// -----------------------------------------------------------------------------
-// CreateFolderEntryL
-//
-// -----------------------------------------------------------------------------
-//
-void TMmsTestUtils::CreateFolderEntryL(
- CMsvSession& aSession,
- TMsvId aParentFolder,
- const TDesC& aFolderName,
- TMsvId& aFolderId )
- {
- aFolderId = KMsvNullIndexEntryId;
- CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
- CleanupStack::PushL( cEntry );
-
- // Create a new folder.
-
- TMsvEntry entry;
- entry.iType = KUidMsvFolderEntry;
- entry.iMtm = KUidMsvLocalServiceMtm;
- entry.iDetails.Set( aFolderName );
- entry.SetVisible( EFalse );
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- cEntry->CreateL( entry );
- aFolderId = entry.Id();
- CleanupStack::PopAndDestroy( cEntry );
-
- }
-
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TMsvId TMmsTestUtils::CreateNotificationEntryL(
- TMsvId aNotificationFolder,
- TMsvId aServiceId,
- CBufFlat* aEncodeBuffer,
- CMsvSession& aSession )
- {
- TMsvId entryId = KMsvNullIndexEntryId;
- if ( aNotificationFolder == KMsvNullIndexEntryId )
- {
- // no folder no entry
- return entryId;
- }
-
- CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
- CleanupStack::PushL(cEntry);
-
- TMsvEntry entry;
- entry.iType = KUidMsvMessageEntry;
- entry.iMtm = KUidMsgTypeMultimedia;
- entry.SetVisible( ETrue );
- // If we want to put data here, InPreparation must be set to true first
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- entry.iRelatedId = aServiceId;
- entry.iMtmData2 = KMmsNotificationBinary;
- cEntry->CreateL( entry );
- entryId = entry.Id();
-
- //
- // Stream
- // 1) length of the data as 32 bit integer
- // 2) pushed message data
- // into created entry's stream
- //
- cEntry->SetEntryL( entryId );
- CMsvStore* store = cEntry->EditStoreL();
- CleanupStack::PushL( store ); // ***
- RMsvWriteStream outs;
- outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
- TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
- outs.WriteUint32L( ptr.Length() );
- outs.WriteL( ptr );
- outs.CommitL();
- outs.Close();
- store->CommitL();
-
- CleanupStack::PopAndDestroy( &outs ); // close outs
- CleanupStack::PopAndDestroy( store );
- CleanupStack::PopAndDestroy( cEntry );
-
- return entryId;
-
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::FormNotification(
- TDesC8& aUrl,
- TInt aSize,
- CMmsHeaders& aMmsHeaders,
- CMmsEncode& aMmsEncoder,
- CBufFlat* aEncodeBuffer )
- {
- // for test purposes aUrl will contain the filename.
-
- // Reset sets the default encapsulation version
- // The default version has been set from MmsSettings in NewL
- aMmsHeaders.Reset();
-
- // construct the notification into iMmsHeaders, and call encode
-
- aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
-
- TTime currentTime;
- currentTime.UniversalTime();
- currentTime.Int64();
-
- TPtrC8 tid;
- TBufC8<KMMSMAXTIDLENGTH> target;
- TInt random = 0;
-
- // we don't generate a true random TID: We generate the
- // TID from the URL so that if we generate a notification
- // twice from the same file, we get the same TID and the
- // same URL. This way we can test the pruning function in
- // server MTM
-
- TInt i;
- for ( i = 0; i < aUrl.Length(); ++i )
- {
- random += aUrl[ i ];
- }
-
- target.Des().Num( random );
- tid.Set( target.Des() );
- aMmsHeaders.SetTidL( tid );
-
- aMmsHeaders.SetMessageClass( EMmsClassPersonal );
- aMmsHeaders.SetMessageSize( aSize );
- const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
- aMmsHeaders.SetExpiryInterval( KTenHours );
- aMmsHeaders.SetContentLocationL( aUrl );
-
- aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
-
- }
-
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
- {
- //Is the name a file?
- if (IsDrive(aFileName))
- return EFalse;
- return !(IsDir(aFileName, aFs));
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
- {
- //Is the name a directory?
- TEntry entry;
- TInt err = aFs.Entry(aFileName, entry);
- if (err)
- return EFalse;
- else
- return entry.IsDir();
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
- {
- //horrible little function to figure if the path is just a drive
- TBool retVal = EFalse;
- if (aFileName.Length()==3) //eg "c:\"
- {
- if ((aFileName[1] == ':') && (aFileName[2] == '\\'))
- retVal=ETrue;
- }
- else if (aFileName.Length()==2) //eg "c:"
- {
- if (aFileName[1] == ':')
- retVal=ETrue;
- }
- return retVal;
- }
-
-// end of file
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmstestuitimer.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include "mmstestuitimer.h"
-
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer::CTestUiTimer(): CTimer( 5 )
- {
- period = KPeriod;
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::ConstructL()
- {
- CTimer::ConstructL();
- CActiveScheduler::Add(this);
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer* CTestUiTimer::NewL()
- {
- CTestUiTimer* self = new(ELeave) CTestUiTimer();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer::~CTestUiTimer()
- {
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::IssueRequest()
- {
- // No operation to cancel if this function is called
- iObject = NULL;
- After(period);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
- {
- iObject = aObject;
- TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
- After( timeout );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::DoCancel()
- {
- CTimer::DoCancel();
- if ( iObject )
- {
- iObject->Cancel();
- iObject = NULL;
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::RunL()
- {
- if ( iObject )
- {
- // If we timeout while holding an active object, we cancel it
- iObject->Cancel();
- iObject = NULL;
- }
- else
- {
- CActiveScheduler::Stop();
- }
- }
-
-// ======== GLOBAL FUNCTIONS ========
-
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/inc/testmmsplugin.h Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: Main test class declaration for MMS Plugin
- */
-
-#ifndef TEST_MMS_PLUGIN_H
-#define TEST_MMS_PLUGIN_H
-
-#ifdef BUILD_TEST_DLL
-#define TEST_EXPORT Q_DECL_EXPORT
-#else
-#define TEST_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <QSignalSpy>
-#include <e32const.h>
-
-//Forward Declarations
-class UniEditorMmsPlugin;
-class ConvergedMessage;
-class MmsTestBed;
-
-//Class Declaration: TestMmsPlugin
-class TEST_EXPORT TestMmsPlugin: public QObject
- {
- Q_OBJECT
-
-private slots:
-
- /**
- * Initialises the whole Test
- **/
- void initTestCase();//called before the first testfunction is executed.
-
- /**
- * Initialises each Test Case
- **/
- void init();//called before each testfunction is executed.
-
- /**
- * Creates a MMS messsage with a text attachment
- **/
- void createMMSWithTextAttachment();
-
- /**
- * Tests the MMS message with a text attachment
- **/
- void testMMSWithTextAttachment();
-
- /**
- * Sends the MMS message with a text attachment
- **/
- void sendMMSWithTextAttachment();
-
- /**
- * Tests that the MMS message is sent successfully
- **/
- void testSentMMSWithTextAttachment();
-
- /**
- * Creates a MMS messsage with a text and an Image attachments
- **/
- void createMMSWithTextAndImageAttachment();
-
- /**
- * Tests the MMS message with a text and an Image attachments
- **/
- void testMMSWithTextAndImageAttachment();
-
- /**
- * Sends the MMS message with a text and an Image attachments
- **/
- void sendMMSWithTextAndImageAttachment();
-
- /**
- * Tests that the MMS message is sent successfully
- **/
- void testSentMMSWithTextAndImageAttachment();
-
- /**
- * Cleans up each Test Case
- **/
- void cleanup();
-
- /**
- * Cleans up the whole Test Case
- **/
- void cleanupTestCase();
-
-private: // Data
-
- /**
- * msgPlugin - MMS Message Plug-in
- **/
- UniEditorMmsPlugin* msgPlugin;
-
- /**
- * mmstestbed - MMS Message Simulator
- **/
- MmsTestBed* mmstestbed;
-
- /**
- * spy_draft - Signal Spy for Draft Folder
- **/
- QSignalSpy* spy_draft;
-
- /**
- * spy_outbox - Signal Spy for Outbox Folder
- **/
- QSignalSpy* spy_outbox;
-
- /**
- * spy_sent - Signal Spy for Sent Folder
- **/
- QSignalSpy* spy_sent;
-
- /**
- * spy_inbox - Signal Spy for Inbox Folder
- **/
- QSignalSpy* spy_inbox;
-
- /**
- * mmsMsgId - The MMS message Id
- **/
- long int mmsMsgId;
- };
-#endif //TEST_MMS_PLUGIN_H
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/inc/testmmsplugin.ini Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-//this file is used to provide predefined set of input data.
-
-//eg.
-const char TEST_MSG_SUBJECT[] = "Message Subject";
-const char TEST_SENDER[] = "DummySender<+919860479112>";
-const char TEST_ATTACHMENT4[] = "c:\\SmileyFace.gif";
-const char TEST_ATTACHMENT5[] = "c:\\sample.txt";
-const char TEST_CC[] = "DummyCCAddress<+919860479113>";
-const char TEST_BCC[] = "DummyBCCAddress<+919860479114>";
\ No newline at end of file
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/src/testmmsplugin.cpp Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,415 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: : Main test class definition for MMS Plugin
- */
-
-#include <QtTest/QtTest>
-#include <QTimer>
-#include <QSignalSpy>
-#include "debugtraces.h"
-#include "testmmsplugin.h"
-#include "convergedmessage.h"
-#include "convergedmessageid.h"
-#include "unieditormmsplugin.h"
-#include "mmstestbed.h"
-#include "testmmsplugin.ini"
-
-//---------------------------------------------------------------
-// TestMmsPlugin::initTestCase
-//---------------------------------------------------------------
-void TestMmsPlugin::initTestCase()
-{
- //Instantiate UniEditorMmsPlugin and verify if it is correctly Instantited.
- msgPlugin = new UniEditorMmsPlugin();
- QVERIFY(msgPlugin != NULL);
-
- //Verify if MMS service is Validated.
- QCOMPARE(msgPlugin->validateService(), 1);
- QCOMPARE(msgPlugin->isServiceValid(), 1);
- msgPlugin->setEncodingSettings(ETrue, ESmsEncodingNone, -1);
- QString str("Hello");
- TInt numOfRemainingChars = 1;
- TInt numOfPDUs = 1;
- TBool unicodeMode = ETrue;
- TSmsEncoding smsEncoding = ESmsEncodingNone;
- QVERIFY(msgPlugin->getNumPDUs(str, numOfRemainingChars, numOfPDUs, unicodeMode, smsEncoding) == true);
-
- //Verify MmsTestBed Instance.
- mmstestbed = new MmsTestBed;
- QVERIFY(mmstestbed != NULL);
-
- //register user defined object to meta system.
- qRegisterMetaType<long int> ("long int");
-
- //set up signalspy to listen to signals emitted by mmstestbed
- spy_draft = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInDraft(long int)));
- spy_outbox = new QSignalSpy(mmstestbed, SIGNAL(entryMovedToOutbox(long int)));
- spy_sent = new QSignalSpy(mmstestbed, SIGNAL(entryMovedToSent(long int)));
- spy_inbox = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInInbox(long int)));
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::init
-//---------------------------------------------------------------
-void TestMmsPlugin::init()
-{
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::createMMSWithTextAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::createMMSWithTextAttachment()
-{
- //Create a Converged Message instance.
- QString subject = TEST_MSG_SUBJECT;
- qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
-
- QString sender(TEST_SENDER);
- ConvergedMessageAddress address(sender);
- ConvergedMessageAttachmentList attachmentList;
-
- //Add a text attachment to attachment list.
- QString attachmentPath = TEST_ATTACHMENT5;
- ConvergedMessageAttachment* attachment =
- new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
-
- attachmentList.append(attachment);
-
- //Instantiate a Converged Message object and set service a MMS
- ConvergedMessage msg;
- msg.setMessageType(ConvergedMessage::Mms);
-
- //Set Subject
- msg.setSubject(subject);
-
- msg.setTimeStamp(timeStamp);
-
- //Set recipient.
- msg.addToRecipient(address);
-
- //Add attachments' list
- msg.addAttachments(attachmentList);
- msg.setPriority(ConvergedMessage::Normal);
-
- //Adding CC Address
- QString ccAddress(TEST_CC);
- ConvergedMessageAddress ccAdd(ccAddress);
- msg.addCcRecipient(ccAdd);
-
- //Adding BCC Address
- QString bccAddress(TEST_BCC);
- ConvergedMessageAddress bccAdd(bccAddress);
- msg.addBccRecipient(bccAdd);
-
- //Adding From Address
- QString recipientAddress(TEST_SENDER);
- ConvergedMessageAddress recipientAdd(recipientAddress);
- msg.addFromRecipient(recipientAdd);
-
- //start send and prepare to test send-success or fail
- mmstestbed->cleanAll();
- mmstestbed->setConnectionLocal(true);
-
- //Get a valid MMS message ID and verify that it is valid.
- mmsMsgId = msgPlugin->convertTo(&msg);
- QVERIFY(mmsMsgId != -1);
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testMMSWithTextAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::testMMSWithTextAttachment()
-{
- long int mmsDraftMsgId;
-
- //check if draft-folder signal was received...this means message was created in draft
- if( 1 <= spy_draft->count())
- {
- //compare the msgid and verify with the ID given by MMS plugin
- void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
- mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
- QVERIFY(mmsDraftMsgId == mmsMsgId);
-
- //Validate the MMS message with all the values set before.
- ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
- QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
- QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
- QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
- QVERIFY(draftMsg->attachments().count() == 1);
- QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
- QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT5).mid(QString(TEST_ATTACHMENT5).indexOf(QString("Sample.txt"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to create message in Draft");
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- }
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::sendMMSWithTextAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::sendMMSWithTextAttachment()
-{
- //Send the MMS message and verify if it was sent successfully.
- bool sent = msgPlugin->send(mmsMsgId);
- QVERIFY(sent == true);
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testSentMMSWithTextAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::testSentMMSWithTextAttachment()
-{
- QTest::qWait(10000); //to ensure path completion
-
- //check if outbox-folder signal was received...this means message was moved to outbox for send
- if( 1 <= spy_outbox->count())
- {
- //compare the msgid
- void * temp = const_cast<void*>(spy_outbox->at(0).at(0).data());
- long int outboxId = *reinterpret_cast< long int(*)>(temp);
- QCOMPARE(outboxId, mmsMsgId);
-
- //push the message from outbox to mmsc(sent folder)
- mmstestbed->fromOutboxToMmsc();
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
-
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- return;
- }
-
- //check if sent-folder signal was received....this means message was successfully sent scheduled.
- if( 1 <= spy_sent->count())
- {
- //check for send-path
- void * temp = const_cast<void*>(spy_sent->at(0).at(0).data());
- long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
- QCOMPARE(sentmsgid, mmsMsgId);
-
- //issue a fetch request on the sent message, to test the receive path
- mmstestbed->fromMmscToInbox();
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
-
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- return;
- }
-
- //check if inbox-folder signal was received....this means message was successfully received at the inbox folder.
- if( spy_inbox->count() <= 0)
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Inbox folder");
-
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- }
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::createMMSWithTextAndImageAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::createMMSWithTextAndImageAttachment()
-{
- //Create a Converged Message instance.
- QString subject = TEST_MSG_SUBJECT;
- qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
-
- QString sender(TEST_SENDER);
- ConvergedMessageAddress address(sender);
- ConvergedMessageAttachmentList attachmentList;
-
- //Add a text attachment to attachment list.
- QString attachmentPath1 = TEST_ATTACHMENT5;
- ConvergedMessageAttachment* attachment =
- new ConvergedMessageAttachment(attachmentPath1, ConvergedMessageAttachment::EInline);
-
- //Add an image attachment to attachment list.
- QString attachmentPath2 = TEST_ATTACHMENT4;
- ConvergedMessageAttachment* attachmentImage =
- new ConvergedMessageAttachment(attachmentPath2, ConvergedMessageAttachment::EAttachment);
-
- attachmentList.append(attachment);
- attachmentList.append(attachmentImage);
-
- //Instantiate a Converged Message object and set service a MMS
- ConvergedMessage msg;
- msg.setMessageType(ConvergedMessage::Mms);
- msg.setSubject(subject);
- msg.setTimeStamp(timeStamp);
- msg.addToRecipient(address);
-
- //Add attachments' list
- msg.addAttachments(attachmentList);
- msg.setPriority(ConvergedMessage::Normal);
-
- //Adding CC Address
- QString ccAddress(TEST_CC);
- ConvergedMessageAddress ccAdd(ccAddress);
- msg.addCcRecipient(ccAdd);
-
- //Adding BCC Address
- QString bccAddress(TEST_BCC);
- ConvergedMessageAddress bccAdd(bccAddress);
- msg.addBccRecipient(bccAdd);
-
- //Adding From Address
- QString recipientAddress(TEST_SENDER);
- ConvergedMessageAddress recipientAdd(recipientAddress);
- msg.addFromRecipient(recipientAdd);
-
- //start send and prepare to test send-success or fail
- mmstestbed->cleanAll();
- mmstestbed->setConnectionLocal(true);
-
- //Get a valid MMS message ID and verify that it is valid.
- mmsMsgId = msgPlugin->convertTo(&msg);
- QVERIFY(mmsMsgId != -1);
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testMMSWithTextAndImageAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::testMMSWithTextAndImageAttachment()
-{
- long int mmsDraftMsgId;
-
- //check if draft-folder signal was received...this means message was created in draft
- if( 1 <= spy_draft->count())
- {
- //compare the msgid and verify with the ID given by MMS plugin
- void * temp = const_cast<void*>(spy_draft->at(1).at(0).data());
- mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
- QVERIFY(mmsDraftMsgId == mmsMsgId);
-
- //Validate the MMS message with all the values set before.
- ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
- QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
- QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
- QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
- QVERIFY(draftMsg->attachments().count() == 1);
- QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
- QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT4).mid(QString(TEST_ATTACHMENT4).indexOf(QString("SmileyFace.gif"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to create message in Draft");
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- }
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::sendMMSWithTextAndImageAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::sendMMSWithTextAndImageAttachment()
-{
- //Send the MMS message and verify if it was sent successfully.
- bool sent = msgPlugin->send(mmsMsgId);
- QVERIFY(sent == true);
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testSentMMSWithTextAndImageAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::testSentMMSWithTextAndImageAttachment()
-{
- QTest::qWait(10000); //to ensure path completion
-
- //check if outbox-folder signal was received...this means message was moved to outbox for send
- if( 1 <= spy_outbox->count())
- {
- //compare the msgid
- void * temp = const_cast<void*>(spy_outbox->at(1).at(0).data());
- long int outboxId = *reinterpret_cast< long int(*)>(temp);
- QCOMPARE(outboxId, mmsMsgId);
-
- //push the message from outbox to mmsc(sent folder)
- mmstestbed->fromOutboxToMmsc();
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
-
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- return;
- }
-
- //check if sent-folder signal was received....this means message was successfully sent scheduled.
- if( 1 <= spy_sent->count())
- {
- //check for send-path
- void * temp = const_cast<void*>(spy_sent->at(1).at(0).data());
- long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
- QCOMPARE(sentmsgid, mmsMsgId);
-
- //issue a fetch request on the sent message, to test the receive path
- mmstestbed->fromMmscToInbox();
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
-
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- return;
- }
-
- //check if inbox-folder signal was received....this means message was successfully received at the inbox folder.
- if( spy_inbox->count() <= 0)
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Inbox folder");
-
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- }
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::cleanup
-//---------------------------------------------------------------
-void TestMmsPlugin::cleanup()
-{
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::cleanupTestCase
-//---------------------------------------------------------------
-void TestMmsPlugin::cleanupTestCase()
-{
- //Cleanup
- delete spy_draft;//Signal for Draft Folder
- delete spy_outbox;//Signal for Outbox Folder
- delete spy_sent;//Signal for Sent Folder
- delete spy_inbox;//Signal for inbox Folder
- delete msgPlugin;//MMS Plugin
- delete mmstestbed;//MMS Testbed
-}
-
-//End of File
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.pro Tue Jul 06 14:12:40 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-QT += testlib
-QT -= gui
-
-TEMPLATE = lib
-TARGET = test-mms-plugin
-
-INCLUDEPATH += ./inc
-INCLUDEPATH += ../../../../../../../inc
-INCLUDEPATH += ../../../../../unidatautils/unidatamodels/inc
-INCLUDEPATH += ../../../../../s60qconversions/inc
-INCLUDEPATH += ../../../../editorgenutils/inc
-INCLUDEPATH += ../../../../../../../inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsmessage/inc
-INCLUDEPATH += ../../../../../../../mmsengine/inc
-INCLUDEPATH += ../../../../../unidatautils/unidatamodel/inc
-INCLUDEPATH += ../mmstestbed/inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_TEST_DLL
-
-CONFIG += hb plugin
-
-SOURCES += \
- ./src/testmmsplugin.cpp \
- ../../src/unieditormmsplugin.cpp \
- ../../src/unieditormmsplugin_p.cpp
-
-
-# Input
-HEADERS += \
- ./inc/testmmsplugin.h \
- ../../inc/unieditormmsplugin.h \
- ../../inc/unieditormmsplugin_p.h
-
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
- symbian {
- TARGET.CAPABILITY = CAP_GENERAL_DLL
- TARGET.EPOCSTACKSIZE = 0x8000
- TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
- TARGET.EPOCALLOWDLLDATA = 1
- }
-
- LIBS += -leuser \
- -lconvergedmessageutils \
- -ls60qconversions \
- -lMsgMedia \
- -leditorgenutils \
- -lcone \
- -leikcoctl \
- -leikcore \
- -leikdlg \
- -lmsgs \
- -letext \
- -lgsmu \
- -lmmsgenutils \
- -lefsrv \
- -lestor \
- -lsmcm \
- -lCommonEngine \
- -lbafl \
- -lCdlEngine \
- -lFeatMgr \
- -lapmime \
- -lapgrfx \
- -lcharconv \
- -lInetProtUtil \
- -lsmildtd \
- -lxmldom \
- -lxmlparser \
- -lcone \
- -lQtCore \
- -letel \
- -lcommdb \
- -lcommsdat \
- -letelmm \
- -lunidatamodelloader \
- -lunidatamodel \
- -lavkon \
- -leikcoctl \
- -leikctl \
- -lform \
- -luiklaf\
- -lmmstestbed \
- -lmmsmessage \
- -lmmsserversettings \
- -lxqutils
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/bwins/mmstestbedu.def Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,71 @@
+EXPORTS
+ ?cleanSent@MmsTestBed@@QAEXXZ @ 1 NONAME ; void MmsTestBed::cleanSent(void)
+ ?cancelSendScheduling@MmsTestBed@@QAEXXZ @ 2 NONAME ; void MmsTestBed::cancelSendScheduling(void)
+ ?replyToAll@MmsTestBed@@QAEXXZ @ 3 NONAME ; void MmsTestBed::replyToAll(void)
+ ?getLogEntries@MmsTestBed@@AAEHXZ @ 4 NONAME ; int MmsTestBed::getLogEntries(void)
+ ?restoreFactorySettings@MmsTestBed@@QAEXXZ @ 5 NONAME ; void MmsTestBed::restoreFactorySettings(void)
+ ?fromOutboxToMmscWithMemoryFailure@MmsTestBed@@QAEHXZ @ 6 NONAME ; int MmsTestBed::fromOutboxToMmscWithMemoryFailure(void)
+ ?encodeMessageFromDrafts@MmsTestBed@@AAEXXZ @ 7 NONAME ; void MmsTestBed::encodeMessageFromDrafts(void)
+ ?reply@MmsTestBed@@QAEXXZ @ 8 NONAME ; void MmsTestBed::reply(void)
+ ?deleteEntry@MmsTestBed@@AAEXJAAVCMsvEntry@@@Z @ 9 NONAME ; void MmsTestBed::deleteEntry(long, class CMsvEntry &)
+ ?findDefaultL@MmsTestBed@@AAEXXZ @ 10 NONAME ; void MmsTestBed::findDefaultL(void)
+ ?messageVariation@MmsTestBed@@QAEXXZ @ 11 NONAME ; void MmsTestBed::messageVariation(void)
+ ?sendReadReport@MmsTestBed@@QAEXXZ @ 12 NONAME ; void MmsTestBed::sendReadReport(void)
+ ?garbageCollection@MmsTestBed@@QAEXK@Z @ 13 NONAME ; void MmsTestBed::garbageCollection(unsigned long)
+ ?fetchForced@MmsTestBed@@QAEXH@Z @ 14 NONAME ; void MmsTestBed::fetchForced(int)
+ ?scheduledSend@MmsTestBed@@QAEXJH@Z @ 15 NONAME ; void MmsTestBed::scheduledSend(long, int)
+ ?createMmsService@MmsTestBed@@AAEXXZ @ 16 NONAME ; void MmsTestBed::createMmsService(void)
+ ?trUtf8@MmsTestBed@@SA?AVQString@@PBD0H@Z @ 17 NONAME ; class QString MmsTestBed::trUtf8(char const *, char const *, int)
+ ?qt_metacast@MmsTestBed@@UAEPAXPBD@Z @ 18 NONAME ; void * MmsTestBed::qt_metacast(char const *)
+ ?deleteEventType@MmsTestBed@@QAEXXZ @ 19 NONAME ; void MmsTestBed::deleteEventType(void)
+ ??_EMmsTestBed@@UAE@I@Z @ 20 NONAME ; MmsTestBed::~MmsTestBed(unsigned int)
+ ?cleanLog@MmsTestBed@@QAEXXZ @ 21 NONAME ; void MmsTestBed::cleanLog(void)
+ ?createEntry@MmsTestBed@@QAEXAAVTMsvEntry@@AAVCMsvEntry@@@Z @ 22 NONAME ; void MmsTestBed::createEntry(class TMsvEntry &, class CMsvEntry &)
+ ?scheduledFetch@MmsTestBed@@QAEXH@Z @ 23 NONAME ; void MmsTestBed::scheduledFetch(int)
+ ?sendFromFile@MmsTestBed@@QAEXXZ @ 24 NONAME ; void MmsTestBed::sendFromFile(void)
+ ??0MmsTestBed@@QAE@XZ @ 25 NONAME ; MmsTestBed::MmsTestBed(void)
+ ?cleanInbox@MmsTestBed@@QAEXXZ @ 26 NONAME ; void MmsTestBed::cleanInbox(void)
+ ?deleteFetchSchedule@MmsTestBed@@QAEXXZ @ 27 NONAME ; void MmsTestBed::deleteFetchSchedule(void)
+ ?fromMmscToInbox@MmsTestBed@@QAEXXZ @ 28 NONAME ; void MmsTestBed::fromMmscToInbox(void)
+ ?doAFetchCycle@MmsTestBed@@QAEXXZ @ 29 NONAME ; void MmsTestBed::doAFetchCycle(void)
+ ?entryMovedToSent@MmsTestBed@@IAEXJ@Z @ 30 NONAME ; void MmsTestBed::entryMovedToSent(long)
+ ?cleanupAndCreateNewService@MmsTestBed@@QAEXXZ @ 31 NONAME ; void MmsTestBed::cleanupAndCreateNewService(void)
+ ?cleanup@MmsTestBed@@AAEXXZ @ 32 NONAME ; void MmsTestBed::cleanup(void)
+ ?qt_metacall@MmsTestBed@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 33 NONAME ; int MmsTestBed::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?getEventType@MmsTestBed@@QAEXXZ @ 34 NONAME ; void MmsTestBed::getEventType(void)
+ ?sendViaClient@MmsTestBed@@QAEXXZ @ 35 NONAME ; void MmsTestBed::sendViaClient(void)
+ ?setFetchingState@MmsTestBed@@QAEXW4TMmsReceivingMode@@@Z @ 36 NONAME ; void MmsTestBed::setFetchingState(enum TMmsReceivingMode)
+ ?sendNotifications@MmsTestBed@@QAEXXZ @ 37 NONAME ; void MmsTestBed::sendNotifications(void)
+ ?metaObject@MmsTestBed@@UBEPBUQMetaObject@@XZ @ 38 NONAME ; struct QMetaObject const * MmsTestBed::metaObject(void) const
+ ?setOnline@MmsTestBed@@QAEX_N@Z @ 39 NONAME ; void MmsTestBed::setOnline(bool)
+ ?cleanOutbox@MmsTestBed@@QAEXXZ @ 40 NONAME ; void MmsTestBed::cleanOutbox(void)
+ ?checkLogClient@MmsTestBed@@AAE_NXZ @ 41 NONAME ; bool MmsTestBed::checkLogClient(void)
+ ?cleanDrafts@MmsTestBed@@QAEXXZ @ 42 NONAME ; void MmsTestBed::cleanDrafts(void)
+ ?tr@MmsTestBed@@SA?AVQString@@PBD0H@Z @ 43 NONAME ; class QString MmsTestBed::tr(char const *, char const *, int)
+ ?copyDrafts@MmsTestBed@@QAEXXZ @ 44 NONAME ; void MmsTestBed::copyDrafts(void)
+ ?fromMmscToInboxWithMemoryFailure@MmsTestBed@@QAEHXZ @ 45 NONAME ; int MmsTestBed::fromMmscToInboxWithMemoryFailure(void)
+ ?fetchForcedImmediate@MmsTestBed@@QAEXXZ @ 46 NONAME ; void MmsTestBed::fetchForcedImmediate(void)
+ ?deleteSendSchedule@MmsTestBed@@QAEXXZ @ 47 NONAME ; void MmsTestBed::deleteSendSchedule(void)
+ ?staticMetaObject@MmsTestBed@@2UQMetaObject@@B @ 48 NONAME ; struct QMetaObject const MmsTestBed::staticMetaObject
+ ?entryCreatedInDraft@MmsTestBed@@IAEXJ@Z @ 49 NONAME ; void MmsTestBed::entryCreatedInDraft(long)
+ ?generateDeliveryReport@MmsTestBed@@QAEXPAVCMmsHeaders@@@Z @ 50 NONAME ; void MmsTestBed::generateDeliveryReport(class CMmsHeaders *)
+ ?forward@MmsTestBed@@QAEXXZ @ 51 NONAME ; void MmsTestBed::forward(void)
+ ?entryCreatedInInbox@MmsTestBed@@IAEXJ@Z @ 52 NONAME ; void MmsTestBed::entryCreatedInInbox(long)
+ ?fromOutboxToMmsc@MmsTestBed@@QAEXXZ @ 53 NONAME ; void MmsTestBed::fromOutboxToMmsc(void)
+ ?entryMovedToOutbox@MmsTestBed@@IAEXJ@Z @ 54 NONAME ; void MmsTestBed::entryMovedToOutbox(long)
+ ?findMMSFolder@MmsTestBed@@AAEJXZ @ 55 NONAME ; long MmsTestBed::findMMSFolder(void)
+ ??1MmsTestBed@@UAE@XZ @ 56 NONAME ; MmsTestBed::~MmsTestBed(void)
+ ?cleanAll@MmsTestBed@@QAEXXZ @ 57 NONAME ; void MmsTestBed::cleanAll(void)
+ ?getStaticMetaObject@MmsTestBed@@SAABUQMetaObject@@XZ @ 58 NONAME ; struct QMetaObject const & MmsTestBed::getStaticMetaObject(void)
+ ?sendDeliveryReport@MmsTestBed@@QAEXXZ @ 59 NONAME ; void MmsTestBed::sendDeliveryReport(void)
+ ?setConnectionLocal@MmsTestBed@@QAEX_N@Z @ 60 NONAME ; void MmsTestBed::setConnectionLocal(bool)
+ ?sendOneByOne@MmsTestBed@@QAEXXZ @ 61 NONAME ; void MmsTestBed::sendOneByOne(void)
+ ?cancelFetchScheduling@MmsTestBed@@QAEXXZ @ 62 NONAME ; void MmsTestBed::cancelFetchScheduling(void)
+ ?trUtf8@MmsTestBed@@SA?AVQString@@PBD0@Z @ 63 NONAME ; class QString MmsTestBed::trUtf8(char const *, char const *)
+ ?deleteNotifications@MmsTestBed@@QAEXXZ @ 64 NONAME ; void MmsTestBed::deleteNotifications(void)
+ ?testFile@MmsTestBed@@AAEXAAV?$TBuf@$0BAA@@@HJ@Z @ 65 NONAME ; void MmsTestBed::testFile(class TBuf<256> &, int, long)
+ ?HandleSessionEventL@MmsTestBed@@MAEXW4TMsvSessionEvent@MMsvSessionObserver@@PAX11@Z @ 66 NONAME ; void MmsTestBed::HandleSessionEventL(enum MMsvSessionObserver::TMsvSessionEvent, void *, void *, void *)
+ ?tr@MmsTestBed@@SA?AVQString@@PBD0@Z @ 67 NONAME ; class QString MmsTestBed::tr(char const *, char const *)
+ ?addEventType@MmsTestBed@@QAEXXZ @ 68 NONAME ; void MmsTestBed::addEventType(void)
+ ?addMMBoxDescriptions@MmsTestBed@@AAEXXZ @ 69 NONAME ; void MmsTestBed::addMMBoxDescriptions(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/eabi/mmstestbedu.def Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,72 @@
+EXPORTS
+ _ZN10MmsTestBed10cleanInboxEv @ 1 NONAME
+ _ZN10MmsTestBed10copyDraftsEv @ 2 NONAME
+ _ZN10MmsTestBed10replyToAllEv @ 3 NONAME
+ _ZN10MmsTestBed11cleanDraftsEv @ 4 NONAME
+ _ZN10MmsTestBed11cleanOutboxEv @ 5 NONAME
+ _ZN10MmsTestBed11createEntryER9TMsvEntryR9CMsvEntry @ 6 NONAME
+ _ZN10MmsTestBed11deleteEntryElR9CMsvEntry @ 7 NONAME
+ _ZN10MmsTestBed11fetchForcedEi @ 8 NONAME
+ _ZN10MmsTestBed11qt_metacallEN11QMetaObject4CallEiPPv @ 9 NONAME
+ _ZN10MmsTestBed11qt_metacastEPKc @ 10 NONAME
+ _ZN10MmsTestBed12addEventTypeEv @ 11 NONAME
+ _ZN10MmsTestBed12findDefaultLEv @ 12 NONAME
+ _ZN10MmsTestBed12getEventTypeEv @ 13 NONAME
+ _ZN10MmsTestBed12sendFromFileEv @ 14 NONAME
+ _ZN10MmsTestBed12sendOneByOneEv @ 15 NONAME
+ _ZN10MmsTestBed13doAFetchCycleEv @ 16 NONAME
+ _ZN10MmsTestBed13findMMSFolderEv @ 17 NONAME
+ _ZN10MmsTestBed13getLogEntriesEv @ 18 NONAME
+ _ZN10MmsTestBed13scheduledSendEli @ 19 NONAME
+ _ZN10MmsTestBed13sendViaClientEv @ 20 NONAME
+ _ZN10MmsTestBed14checkLogClientEv @ 21 NONAME
+ _ZN10MmsTestBed14scheduledFetchEi @ 22 NONAME
+ _ZN10MmsTestBed14sendReadReportEv @ 23 NONAME
+ _ZN10MmsTestBed15deleteEventTypeEv @ 24 NONAME
+ _ZN10MmsTestBed15fromMmscToInboxEv @ 25 NONAME
+ _ZN10MmsTestBed16createMmsServiceEv @ 26 NONAME
+ _ZN10MmsTestBed16entryMovedToSentEl @ 27 NONAME
+ _ZN10MmsTestBed16fromOutboxToMmscEv @ 28 NONAME
+ _ZN10MmsTestBed16messageVariationEv @ 29 NONAME
+ _ZN10MmsTestBed16setFetchingStateE17TMmsReceivingMode @ 30 NONAME
+ _ZN10MmsTestBed16staticMetaObjectE @ 31 NONAME DATA 16
+ _ZN10MmsTestBed17garbageCollectionEm @ 32 NONAME
+ _ZN10MmsTestBed17sendNotificationsEv @ 33 NONAME
+ _ZN10MmsTestBed18deleteSendScheduleEv @ 34 NONAME
+ _ZN10MmsTestBed18entryMovedToOutboxEl @ 35 NONAME
+ _ZN10MmsTestBed18sendDeliveryReportEv @ 36 NONAME
+ _ZN10MmsTestBed18setConnectionLocalEb @ 37 NONAME
+ _ZN10MmsTestBed19HandleSessionEventLEN19MMsvSessionObserver16TMsvSessionEventEPvS2_S2_ @ 38 NONAME
+ _ZN10MmsTestBed19deleteFetchScheduleEv @ 39 NONAME
+ _ZN10MmsTestBed19deleteNotificationsEv @ 40 NONAME
+ _ZN10MmsTestBed19entryCreatedInDraftEl @ 41 NONAME
+ _ZN10MmsTestBed19entryCreatedInInboxEl @ 42 NONAME
+ _ZN10MmsTestBed19getStaticMetaObjectEv @ 43 NONAME
+ _ZN10MmsTestBed20addMMBoxDescriptionsEv @ 44 NONAME
+ _ZN10MmsTestBed20cancelSendSchedulingEv @ 45 NONAME
+ _ZN10MmsTestBed20fetchForcedImmediateEv @ 46 NONAME
+ _ZN10MmsTestBed21cancelFetchSchedulingEv @ 47 NONAME
+ _ZN10MmsTestBed22generateDeliveryReportEP11CMmsHeaders @ 48 NONAME
+ _ZN10MmsTestBed22restoreFactorySettingsEv @ 49 NONAME
+ _ZN10MmsTestBed23encodeMessageFromDraftsEv @ 50 NONAME
+ _ZN10MmsTestBed26cleanupAndCreateNewServiceEv @ 51 NONAME
+ _ZN10MmsTestBed32fromMmscToInboxWithMemoryFailureEv @ 52 NONAME
+ _ZN10MmsTestBed33fromOutboxToMmscWithMemoryFailureEv @ 53 NONAME
+ _ZN10MmsTestBed5replyEv @ 54 NONAME
+ _ZN10MmsTestBed7cleanupEv @ 55 NONAME
+ _ZN10MmsTestBed7forwardEv @ 56 NONAME
+ _ZN10MmsTestBed8cleanAllEv @ 57 NONAME
+ _ZN10MmsTestBed8cleanLogEv @ 58 NONAME
+ _ZN10MmsTestBed8testFileER4TBufILi256EEil @ 59 NONAME
+ _ZN10MmsTestBed9cleanSentEv @ 60 NONAME
+ _ZN10MmsTestBed9setOnlineEb @ 61 NONAME
+ _ZN10MmsTestBedC1Ev @ 62 NONAME
+ _ZN10MmsTestBedC2Ev @ 63 NONAME
+ _ZN10MmsTestBedD0Ev @ 64 NONAME
+ _ZN10MmsTestBedD1Ev @ 65 NONAME
+ _ZN10MmsTestBedD2Ev @ 66 NONAME
+ _ZNK10MmsTestBed10metaObjectEv @ 67 NONAME
+ _ZTI10MmsTestBed @ 68 NONAME
+ _ZTV10MmsTestBed @ 69 NONAME
+ _ZThn8_N10MmsTestBed19HandleSessionEventLEN19MMsvSessionObserver16TMsvSessionEventEPvS2_S2_ @ 70 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/inc/mmsreadfile.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,471 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSREADFILE_H
+#define MMSREADFILE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <f32file.h>
+#include <msvstd.h>
+
+// forward references
+class CMmsAttaStructure;
+class CMmsHeaders;
+class CEikonEnv;
+class CMmsClientMtm;
+
+// Out-of-range value for any MMS header with assigned number
+// Used in coverage tests to get coverage for "default" branches
+// in "case" statements.
+const TInt KMmsTestIllegalValue = 255;
+
+//
+// TEST KEY WORDS
+// Extended to include all MMS headers to allow generation of arbitrary PDUs
+// Content type header cannot be separately defined,
+// it will always be "multipat/mixed" or "multipart/related"
+_LIT8( KTestEndOfFile, "EOF" );
+_LIT8( KTestNewMessage, "MESSAGE BEGIN" );
+//------------------------------------------------
+_LIT8( KTestMessageType, "MESSAGE-TYPE" ); //X-Mms-Message-Type
+_LIT8( KTestDate, "DATE" ); // Date
+_LIT8( KTestFrom, "FROM" ); // From
+_LIT8( KTestTo, "TO" ); // To
+_LIT8( KTestCc, "CC" ); // Cc
+_LIT8( KTestBcc, "BCC" ); // Bcc
+_LIT8( KTestSubject, "SUBJECT" ); // Subject
+_LIT8( KTestExpiryRel, "EXPIRY-REL" ); // X-Mms-Expiry, relative
+_LIT8( KTestExpiryAbs, "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
+_LIT8( KTestDeliveryTimeRel, "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
+_LIT8( KTestDeliveryTimeAbs, "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
+_LIT8( KTestPriority, "PRIORITY" ); // X-Mms-Priority
+_LIT8( KTestSenderVisibility, "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
+_LIT8( KTestDeliveryReport, "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
+_LIT8( KTestReadReply, "READ-REPLY" ); // X-Mms-Read-Report
+// ---------------------------------------------------
+_LIT8( KTestNewAttachment, "ATTACHMENT" );
+_LIT8( KTestAttachmentType, "ATTACHMENTTYPE" );
+_LIT8( KTestAttachmentName, "ATTACHMENTNAME" );
+_LIT8( KTestAttachmentContLoc, "ATTACHMENTCONTLOC" );
+_LIT8( KTestAttachmentCharset, "ATTACHMENTCHARSET" );
+_LIT8( KTestAttachmentCid, "ATTACHMENTCID" );
+_LIT8( KTestAttachmentRoot, "ATTACHMENTROOT" );
+// content-type and x-type parameters for attachments
+// should appear in name-value pairs.
+// Test program is not responsible for verifying illegal scripts
+_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
+_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
+_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
+_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
+// -----------------------------------------------------
+_LIT8( KTestMessageClass, "MESSAGE-CLASS" ); // X-Mms-Message-Class
+_LIT8( KTestDelivRepSendAllow, "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
+_LIT8( KTestAcceptAdvertis, "ACCEPT-ADVERTISEMENTS" );
+_LIT8( KTestRetryCount, "RETRY-COUNT" );
+_LIT8( KTestRetryInterval, "RETRY-INTERVAL" );
+// -------------------------------------------------
+_LIT8( KTestAlias, "ALIAS" );
+_LIT8( KTestFromAlias, "FROMALIAS" );
+_LIT8( KTestToAlias, "TOALIAS" );
+_LIT8( KTestCcAlias, "CCALIAS" );
+_LIT8( KTestBccAlias, "BCCALIAS" );
+// -------------------------------------------------
+// more Message headers to allow testing all possible PDUs and
+// MMS 1.1 headers
+_LIT8( KTestReplyCharging, "REPLY-CHARGING" ); // X-Mms-Reply-Charging
+_LIT8( KTestReplyChargAbs, "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
+_LIT8( KTestReplyChargRel, "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
+_LIT8( KTestReplyChargSize, "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
+_LIT8( KTestReplyChargID, "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
+_LIT8( KTestTID, "TID" );
+_LIT8( KTestContentLocation, "CONTLOC" ); // X-Mms-Content-Location
+// The following three must appear as triplets.
+// index must be first, address and date may appear in any order
+_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
+_LIT8( KTestPreviouslySentBy, "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
+_LIT8( KTestPreviouslySentDate, "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
+//---
+_LIT8( KTestMessageId, "MESSAGE-ID" ); // Message-ID
+_LIT8( KTestMessageSize, "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
+_LIT8( KTestVersion, "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
+_LIT8( KTestReadStatus, "READ-STATUS" ); // X-Mms-Read-Status
+_LIT8( KTestResponseStatus, "RESPONSE-STATUS" ); // X-Mms-Response-Status
+_LIT8( KTestResponseText, "RESPONSE-TEXT" ); // X-Mms-Response-Text
+_LIT8( KTestRetrieveStatus, "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
+_LIT8( KTestRetrieveText, "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
+_LIT8( KTestStatus, "STATUS" ); // X-Mms-Status
+// -------------------------------------------------
+// MMS 1.2 headers
+_LIT8( KTestAttribute, "ATTRIBUTE" ); // X-Mms-Attribute
+// The value should be one of the following:
+// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
+// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
+// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
+// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
+// PREV-SENT-DATE, ADDITIONAL-HEADERS
+_LIT8( KTestDistributionIndicator, "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
+_LIT8( KTestLimit, "LIMIT" ); // X-Mms-Limit
+_LIT8( KTestMessageQuota, "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
+_LIT8( KTestSizeQuota, "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
+_LIT8( KTestMessageTotal, "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
+_LIT8( KTestSizeTotal, "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
+_LIT8( KTestMessageCount, "MESSAGE-COUNT" ); // X-Mms-Message-Count
+_LIT8( KTestAddKeyword, "ADD-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestRemoveKeyword, "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestFilterKeyword, "FILTER-KEYWORD" ); // X-Mms-MM-FLags
+_LIT8( KTestMMState, "MESSAGE-STATE" ); // X-Mms-MM-State
+_LIT8( KTestQuota, "QUOTA" ); // X-Mms-Quotas
+_LIT8( KTestStart, "START" ); // X-Mms-Start
+_LIT8( KTestStore, "STORE" ); // X-Mms-Store
+_LIT8( KTestStored, "STORED" ); // X-Mms-Stored
+_LIT8( KTestStoreStatus, "STORE-STATUS" ); // X-Mms-Store-Status
+_LIT8( KTestStoreStatusText, "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
+_LIT8( KTestTotals, "TOTALS" ); // X-Mms-Totals
+// Delete confirmation header structure
+// This consists of index, content location, response status and response status text.
+// All three values are not always necessary for each index, but at least content-location
+// and response status should be present.
+// The index retains its value until a new index is encountered.
+_LIT8( KTestDeleteInfoIndex, "DELETESTATUSINDEX" ); // index for next delete info fields
+// This header must precede content-location, response-status and response-text fields
+// in a delete confirmation. Index retains its value until a new index is encountered.
+
+// Element descriptor header not implemented
+
+// Application id headers
+// These will officially be supported in MMS encapsulation version 1.3
+// Java has non-standard support even earlier
+
+_LIT8( KTestApplicId, "APPLIC-ID" ); // X-Mms-Applic-ID
+_LIT8( KTestReplyApplicId, "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
+_LIT8( KTestApplicInfo, "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
+
+// Since Encapsulation 1.3
+_LIT8( KTestContentClass, "CONTENT-CLASS" ); // X-Mms-Content-Class
+_LIT8( KTestDrmContent, "DRM-CONTENT" ); // X-Mms-DRM-Content
+_LIT8( KTestAdaptationAllowed, "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
+_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
+_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
+_LIT8( KTestReplaceId, "REPLACE-ID" ); // X-Mms-Replace-ID
+_LIT8( KTestStatusText, "STATUS-TEXT" ); // X-Mms-Status-Text
+_LIT8( KTestCancelId, "CANCEL-ID" ); // X-Mms-Cancel-ID
+_LIT8( KTestCancelStatus, "CANCEL-STATUS" ); // X-Mms-Cancel-Status
+
+// DATA TYPES
+#define aSet 1
+#define aReset 0
+#define PartCount 100
+#define MaxAttaCount 10
+#define DefaultBufLen 256
+#define MaxRecipients 5
+
+// status returned by ReadRow
+enum TTestReadStatus
+ {
+ ETestUnknown,
+ ETestNewMessage,
+ ETestNewAttachment,
+ ETestEof, // End of file
+ ETestMessageType,
+ ETestDate,
+ ETestFrom,
+ ETestTo,
+ ETestCc,
+ ETestBcc,
+ ETestAlias,
+ ETestFromAlias,
+ ETestToAlias,
+ ETestCcAlias,
+ ETestBccAlias,
+ ETestSubject,
+ ETestExpiryRel,
+ ETestExpiryAbs,
+ ETestDeliveryTimeRel,
+ ETestDeliveryTimeAbs,
+ ETestPriority,
+ ETestSenderVisibility,
+ ETestDeliveryReport,
+ ETestReadReply,
+ ETestAttachmentType,
+// ETestAttachmentName,
+ ETestAttachmentCharset,
+ ETestAttachmentCid,
+ ETestAttachmentRoot,
+ ETestSettings,
+ ETestMessageClass,
+ ETestDelivReportSendAllow,
+ ETestSingleMessageClass,
+ ETestReplyCharging,
+ ETestReplyChargAbs,
+ ETestReplyChargRel,
+ ETestReplyChargSize,
+ ETestReplyChargID,
+ ETestTID,
+ ETestContentLocation,
+ ETestPreviouslySentIndex,
+ ETestPreviouslySentBy,
+ ETestPreviouslySentDate,
+ ETestMessageId,
+ ETestMessageSize,
+ ETestVersion,
+ ETestReadStatus,
+ ETestResponseStatus,
+ ETestResponseText,
+ ETestRetrieveStatus,
+ ETestRetrieveText,
+ ETestStatus,
+ ETestAttribute,
+ ETestDistributionIndicator,
+ ETestLimit,
+ ETestMessageQuota,
+ ETestSizeQuota,
+ ETestMessageTotal,
+ ETestSizeTotal,
+ ETestMessageCount,
+ ETestAddKeyword,
+ ETestRemoveKeyword,
+ ETestFilterKeyword,
+ ETestMMState,
+ ETestQuota,
+ ETestStart,
+ ETestStore,
+ ETestStored,
+ ETestStoreStatus,
+ ETestStoreStatusText,
+ ETestTotals,
+ ETestDeleteInfoIndex,
+ ETestApplicId,
+ ETestReplyApplicId,
+ ETestApplicInfo,
+ ETestContentClass,
+ ETestDrmContent,
+ ETestAdaptationAllowed,
+ ETestRecommendedRetrievalMode,
+ ETestRecRetrievalModeText,
+ ETestReplaceId,
+ ETestStatusText,
+ ETestCancelId,
+ ETestCancelStatus,
+ ETestAttaRecommendedName,
+ ETestAttachmentContLoc,
+ ETestAttContTypeParamName,
+ ETestAttContTypeParamValue,
+ ETestAttXTypeParamName,
+ ETestAttXTypeParamValue
+
+ };
+
+// VALUE KEYWORDS
+_LIT( KPersonal, "Personal" );
+_LIT( KAdvertisement, "Advertisement" );
+_LIT( KInformational, "Informational" );
+_LIT( KAuto, "Auto" );
+_LIT( KLow, "Low" );
+_LIT( KNormal, "Normal" );
+_LIT( KHigh, "High" );
+_LIT( KHide, "Hide" );
+_LIT( KShow, "Show" );
+_LIT( KYes, "Yes" );
+_LIT( KNo, "No" );
+_LIT( KOn, "On" );
+_LIT( KOff, "Off" );
+_LIT( KDeferred, "Deferred" );
+_LIT( KExpired, "Expired" );
+_LIT( KRetrieved, "Retrieved" );
+_LIT( KRejected, "Rejected" );
+_LIT( KUnrecognized, "Unrecognized" );
+_LIT( KIndeterminate, "Indeterminate" );
+_LIT( KForwarded, "Forwarded" );
+_LIT( KUnreachable, "Unreachable" );
+_LIT( KDraft, "Draft");
+_LIT( KSent, "Sent" );
+_LIT( KNew, "New" );
+// X-Mms-Message-Type
+_LIT( KSendReq, "SendReq" );
+_LIT( KSendConf, "SendConf" );
+_LIT( KNotifInd, "NotifInd" );
+_LIT( KNotifResp, "NotifResp" );
+_LIT( KRetrConf, "RetrConf" );
+_LIT( KAckInd, "AckInd" );
+_LIT( KDelInd, "DelInd" );
+_LIT( KReadReqInd, "ReadReqInd" );
+_LIT( KReadOrigInd, "ReadOrigInd" );
+_LIT( KForwardRec, "ForwardReq" );
+_LIT( KForwardConf, "ForwardConf" );
+_LIT( KMBoxStoreReq, "MBoxStoreReq" );
+_LIT( KMBoxStoreConf, "MBoxStoreConf" );
+_LIT( KMBoxViewReq, "MBoxViewReq" );
+_LIT( KMBoxViewConf, "MBoxViewConf" );
+_LIT( KMBoxUploadReq, "MBoxUploadReq" );
+_LIT( KMBoxUploadConf, "MBoxUploadConf" );
+_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
+_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
+_LIT( KMBoxDescr, "MBoxDescr" );
+_LIT( KDeleteReq, "DeleteReq" );
+_LIT( KDeleteConf, "DeleteConf" );
+_LIT( KCancelReq, "CancelReq" );
+_LIT( KCancelResp, "CancelConf" );
+// X-Mms-Read-Status
+_LIT( KRead, "Read" );
+_LIT( KDelNotRead, "DeletedNotRead" );
+// X-Mms-Reply-Charging
+_LIT( KRequested, "Requested" );
+_LIT( KReqTextOnly, "ReqTextOnly" );
+_LIT( KAccepted, "Accepted" );
+_LIT( KAccTextOnly, "AccTextOnly" );
+// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
+_LIT( KCancelSuccessful, "CancelSuccess" );
+_LIT( KCancelCorrupted, "CancelCorrupted" );
+// X-Mms-Content-Class
+_LIT( KText, "Text" );
+_LIT( KImageBasic, "ImageBasic" );
+_LIT( KImageRich, "ImageRich" );
+_LIT( KVideoBasic, "VideoBasic" );
+_LIT( KVideoRich, "VideoRich" );
+_LIT( KMegaPixel, "MegaPixel" );
+_LIT( KContentBasic, "ContentBasic" );
+_LIT( KContentRich, "ContentRich" );
+// X-Mms-Recommended-Retrieval-Mode
+_LIT( KManual, "Manual" );
+
+//X-Mms-ResponseStatus
+// legacy values
+_LIT( KOk, "OK" );
+_LIT( KErrUnspecified, "Unspecified" );
+_LIT( KErrServiceDenied, "ServiceDenied" );
+_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
+_LIT( KErrAddressUnresolved, "AddressUnresolved" );
+_LIT( KErrMessageNotFound, "MessageNotFound" );
+_LIT( KErrNetworkProblem, "NetworkProblem" );
+_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
+_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
+// values since 1.1 (and 1.2)
+_LIT( KErrTransient, "TransientFailure" );
+_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
+_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
+_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
+_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
+_LIT( KErrPermanent, "PermanentFailure" );
+_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
+_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
+_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
+_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
+_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
+_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
+_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
+_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
+_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
+_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
+_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
+//X-Mms-RetrieveStatus (one extra value)
+_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
+//X-Mms-Store-Status (one extra value)
+_LIT( KErrMMBoxFull, "MMBoxFull" );
+
+_LIT8( KTestContent, "Content" ); // For attribute list only
+_LIT8( KTestAdditionalHeaders, "ADDITIONAL-HEADERS" ); // For attribute list only
+_LIT8( KTestDeliveryTime, "DELIVERY-TIME"); // for attribute list only
+_LIT8( KTestExpiry, "EXPIRY"); // for attribute list only
+_LIT8( KTestReplyCharg, "REPLY-CHARG-DEADLINE" ); // for attribute list only
+_LIT8( KTestContentType, "CONTENT-TYPE" ); // for attribute list only
+
+/**
+* CMmsReadFile
+*/
+NONSHARABLE_CLASS( CMmsReadFile ):public CBase
+ {
+ public: // Constructors and destructor
+
+ static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
+ virtual ~CMmsReadFile(); // Destructor
+
+ public: // New functions
+
+ TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
+ TTestReadStatus ReadRowL();
+ void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
+ TInt FindAlias(TPtrC alias);
+ void SetAttaStructure( TBool aOldAttaStructure = EFalse );
+
+ protected: // Functions from base classes
+
+ private:
+
+ CMmsReadFile(); // C++ default constructor.
+ // By default constructor is private.
+ void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
+ void Reset();
+
+ public: // data
+ TInt iMessageType;
+
+
+ private: // Data
+
+ RFs iFs;
+ RFileReadStream* iReader;
+ TBuf<DefaultBufLen> iValueBuffer;
+ CDesCArray* iAliasArray; // aliases
+ HBufC8* iByteBuffer;
+ TTime iDate;
+ CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
+ TInt iAttaCount;
+ TInt iAttaRoot;
+ TInt iAliasCount;
+ TInt iNextMessageType;
+ TParse iParse;
+ TFileName iFilename;
+
+ protected: // Data
+ private: // Data
+
+ // CArrayFixFlat <TestMessage>* iMessages;
+
+ public: // Friend classes
+ protected: // Friend classes
+ private: // Friend classes
+
+ };
+
+
+NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
+ {
+ public: // Constructors and destructor
+ static CMmsAttaStructure* NewL(); // Two-phased constructor.
+ virtual ~CMmsAttaStructure(); // Destructor
+ private:
+ CMmsAttaStructure(); // C++ default constructor.
+ // By default constructor is private.
+ void ConstructL();
+
+ public: // Data
+ HBufC8* iAtta;
+ HBufC8* iAttaName; // content location
+ HBufC8* iAttaType;
+ HBufC8* iAttaCid;
+ TInt iAttaCharset;
+ HBufC* iAttaRecommendedName; // recommended filename
+ CDesC8ArrayFlat* iContentTypeParams; // zero or more "parameter"
+ CDesC8ArrayFlat* iXTypeParams; // zero or more X-Type "parameters"
+
+ };
+
+
+#endif // MMSREADFILE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/inc/mmstestbed.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSTESTBED_H
+#define MMSTESTBED_H
+
+#ifdef BUILD_MMSTESTBED_DLL
+#define MMSTESTBED_EXPORT Q_DECL_EXPORT
+#else
+#define MMSTESTBED_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <QString>
+
+#include <msvids.h> //for consts like KMsvNullIndexEntryIdValue
+#include <MSVAPI.H>
+#include <MTCLREG.H>
+#include <mmsclient.h>
+//#include <mmsservercommon.h>
+
+class CTestUiTimer;
+class CMsvSession;
+class CMmsClientMtm;
+class CMmsSettings;
+class CMmsHeaders;
+class CLogEvent;
+class CLogViewEvent;
+class CLogFilter;
+class CLogClient;
+
+class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
+ {
+ Q_OBJECT
+
+public:
+ /**
+ *
+ */
+ MmsTestBed();
+ ~MmsTestBed();
+ void setConnectionLocal(bool value);
+ void fromOutboxToMmsc();
+ void fromMmscToInbox();
+ /**
+ * cleanup MMS service
+ */
+ void cleanupAndCreateNewService();
+ void deleteNotifications();
+ void restoreFactorySettings();
+ void setFetchingState( TMmsReceivingMode aState );
+ void sendFromFile();
+ void sendOneByOne();
+ void sendNotifications();
+ void copyDrafts();
+ void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
+ void messageVariation();
+ void cancelSendScheduling();
+ void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
+ void deleteSendSchedule();
+ void cancelFetchScheduling();
+ void fetchForced(TInt aDelay = 5);
+ void deleteFetchSchedule();
+ void doAFetchCycle();
+ void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
+ void cleanOutbox();
+ void cleanInbox();
+ void cleanSent();
+ void cleanDrafts();
+ void cleanAll();
+ void reply();
+ void replyToAll();
+ void forward();
+ void sendReadReport(); // send a read report
+ int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
+ int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
+ void sendViaClient();
+ void scheduledFetch(TInt aDelay = 5);
+ void fetchForcedImmediate();
+ void getEventType();
+ void addEventType();
+ void deleteEventType();
+ void cleanLog();
+ void setOnline(bool value);
+ void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
+ void sendDeliveryReport();
+
+signals:
+ void entryCreatedInDraft(long int id);
+ void entryMovedToOutbox(long int id);
+ void entryMovedToSent(long int id);
+ void entryCreatedInInbox(long int id);
+
+protected:
+ /**
+ * From MMsvSessionObserver
+ */
+ void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+ TAny* aArg2, TAny* aArg3);
+
+private:
+ void findDefaultL();
+ void createMmsService();
+ void cleanup();
+ void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
+ void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
+ void addMMBoxDescriptions();
+ void encodeMessageFromDrafts();
+ TMsvId findMMSFolder();
+ bool checkLogClient();
+ int getLogEntries();
+
+private:
+ //data
+ CTestUiTimer* iTimer;
+ CMsvOperationActiveSchedulerWait* iWait;
+ CMsvSession* iSession;
+ CClientMtmRegistry* iClientMtmRegistry;
+ CMmsClientMtm* iMmsClient;
+ CMmsSettings* iSettings;
+ CMmsHeaders* iMmsHeaders;
+ TMsvId iServiceId;
+ TMsvId iDefaultServiceId;
+ TMsvSessionEvent iEvent;
+ RFs iFs;
+ TFileName iFilename;
+ TFileName iCurrentFile;
+ TFileName iCurrentPath;
+ TParse iParse; // parse buffer as member to save stack space
+ CBufFlat* iEncodeBuffer;
+ CMsvEntrySelection* iMsvEntrySelection;
+ CLogEvent* iLogEvent;
+ CLogClient* iLogClient;
+ CLogViewEvent* iLogView;
+ CLogFilter* iLogFilter;
+ };
+
+#endif // MMSTESTBED_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/inc/mmstestbed.hrh Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <bldvariant.hrh>
+
+
+#ifndef MMSTESTBED_HRH
+#define MMSTESTBED_HRH
+
+enum
+{
+ EAppMainOk = 1,
+ EAppMainCancel,
+ //
+ EMenufrmCmdCascadeTest,
+ ECleanup,
+ ECleanOutbox,
+ ESaveSettings,
+ ELoadSettings,
+ ECleanInbox,
+ EShowIn,
+ EShowOut,
+ EOutToMMSC,
+ EMMSCToIn,
+ ESendScheduled,
+ EReceiveScheduled,
+ EShowSent,
+ ECleanSent,
+ EStartMyNotifier,
+ EGetEventType,
+ EAddEventType,
+ EDeleteEventType,
+ EViewLog,
+ ECleanLog,
+ EShowWapAccessPoints,
+ ESelectWapAccessPoint,
+ EShowConnectionMode,
+ EShowIAP,
+ EConnectToIAP,
+ EDeleteSendSchedule,
+ EDeleteReceiveSchedule,
+ EDeleteNotifications,
+ ERestoreFactorySettings,
+ ECreateFromFile,
+ EShowNotifications,
+ ESendDeliveryReport,
+ EShowDrafts,
+ ECleanDrafts,
+ ECleanAll,
+ EFetchingDeferred,
+ EFetchingOn,
+ ESendFromFile,
+ ESwitchToLocal,
+ ESwitchToGlobal,
+ EDecodeLoggingOn,
+ EDecodeLoggingOff,
+ EBinaryDumpOn,
+ EBinaryDumpOff,
+ ESendNotification,
+ ECreateToInbox,
+ ECreateToSentItems,
+ ESendFromDrafts,
+ EFindMMSFolder,
+ ESendOneByOne,
+ ECreateToDrafts,
+ ESendViaClient,
+ ESendMemFail,
+ EFetchMemFail,
+ EReceiveForced,
+ ECreateHeadersFromFile,
+ ESwitchToOffline,
+ ESwitchToOnline,
+ ECopyDrafts,
+ ECreateNotification,
+ EReply,
+ EReplyToAll,
+ EForward,
+ EFetchingManual,
+ EFirstBoot,
+ ENoFirstBoot,
+ EFindNetworkStatus,
+ ESendReadReport,
+ ECreateMMBoxViewConf,
+ EGetMMBoxView,
+ ECleanMMBox,
+ EShowMMBox
+};
+
+#define ETestLabel1 1
+#define ETestLabel2 2
+#define ETestLabel3 3
+#define ETestLabel4 4
+
+#define EServiceList 2
+
+
+enum TTestBedDlgCtrlIds
+ {
+ ETestEditField = 1
+ };
+
+enum TEditServiceControls
+ {
+ EFolderLabel = 1,
+ EEditUri
+// EEditServiceFolder,
+// ENameLabel,
+// EEditServiceName,
+// ENumberLabel,
+// EEditServiceNumber
+ };
+
+enum
+ {
+ EFsViewDialogId = 1
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/inc/mmsteststaticutils.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSTESTSTATICUTILS_H
+#define MMSTESTSTATICUTILS_H
+
+#include <e32std.h>
+#include <msvstd.h>
+#include <badesca.h>
+
+#include "mmsconst.h"
+
+class RFs;
+class CMsvSession;
+class CMmsEncode;
+class CMmsHeaders;
+
+#ifdef __WINS__
+_LIT( KRootPath, "c:\\" );
+#else
+// This is removable disk.
+// drive letter should not be hard coded, must be investigated further
+// We use c: for a while for the tests (to be cahnged later)
+_LIT( KRootPath, "c:\\" );
+//_LIT( KRootPath, "e:\\" );
+#endif
+
+// directory where mmbox descriptions are created
+_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
+// directory where created headers are dumped
+_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
+// content type of MMS PDUs
+_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
+
+_LIT( KWild, "*" );
+
+
+/**
+ * joined array structure
+ *
+ */
+NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
+ {
+public:
+ TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
+ TInt MdcaCount() const;
+ TPtrC16 MdcaPoint(TInt aIndex) const;
+private:
+ CDesCArray* const & iArray1;
+ CDesCArray* const & iArray2;
+ };
+
+/**
+ * static utility functions
+ *
+ */
+class TMmsTestUtils
+ {
+
+public:
+
+ /**
+ *
+ */
+ TMmsTestUtils();
+
+ /**
+ * read phone number for sending messages
+ *
+ * @param aFileName full path for filename
+ * @param aFs file system handle
+ * @return allocated pointer containing the name
+ * The caller must delete the pointer when no longer needed
+ */
+ static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
+
+ static void DecodeLoggingOnL();
+ static void DecodeLoggingOffL();
+ static void BinaryDumpOnL();
+ static void BinaryDumpOffL();
+
+ /**
+ * Clean all temporary directories used in local mode.
+ * Does not delete the directories, only the contents
+ *
+ * @param aFs file system handle
+ */
+ static void CleanDirectoryL( RFs& aFs );
+
+ /**
+ * Dump a binary message
+ *
+ * @param aBuffer buffer containing the binary message
+ * @param aFilename full path of the directory whenre the dump goes
+ * @param aParse reference to parser (to save stack space)
+ * @param aFs file system handle
+ */
+ static void Dump(
+ CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
+
+ /**
+ * Delete all MMS messages and notifications from a given folder
+ *
+ * @param aBoxId folder id
+ * @param aSession Messaging server session
+ */
+ static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
+
+ /**
+ * turn on logging messages sent to email addresses
+ */
+ static void EmailLoggingOnL();
+
+ /**
+ * turn off logging messages sent to email addresses
+ */
+ static void EmailLoggingOffL();
+
+ /**
+ * load list of children into selection and return count
+ *
+ * @param aBoxId folder id
+ * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
+ * caller is responsible of deleting the pointer afterwards.
+ * Pointer may be NULL at entry, and a new pointer will be allocated
+ * @param aSession messge server session
+ * @param aMessageType child MTM type, default is multimedia message
+ * @return number of entries in selection
+ */
+ static TInt CountChildrenL(
+ TMsvId aBoxId,
+ CMsvEntrySelection*& aMsvEntrySelection,
+ CMsvSession& aSession,
+ TUid aMessageType = KUidMsgTypeMultimedia);
+
+ /**
+ * Create a folder entry
+ *
+ * @param aSession messge server session
+ * @param aParentFolder the parent folder
+ * @param aFolderName name of the folder
+ * @param aFolderId will contain the if of the new folder if creation was successful
+ */
+ static void CreateFolderEntryL(
+ CMsvSession& aSession,
+ TMsvId aParentFolder,
+ const TDesC& aFolderName,
+ TMsvId& aFolderId );
+
+ /**
+ * Create an MMS notification from data in buffer
+ * @param aNotificationFolder mms notification folder (target folder)
+ * @param aServiceId id of MMS service
+ * @param aEncodeBuffer buffer that contains the data
+ * @param aSession message server session
+ * @return id of the created notification
+ */
+ static TMsvId CreateNotificationEntryL(
+ TMsvId aNotificationFolder,
+ TMsvId aServiceId,
+ CBufFlat* aEncodeBuffer,
+ CMsvSession& aSession );
+
+ /**
+ * Encode an MMS notification into buffer
+ * @param aUrl url of the notification for local messages a filepath
+ * @param aSize size of the message
+ * @param aMmsHeaders MMS headers structure for creating the notification
+ * @param aMmsEncoder reference to CMmsEncode class
+ * @param aEncodeBuffer flat buffer that will contain the encoded notification
+ */
+ static void FormNotification(
+ TDesC8& aUrl,
+ TInt aSize,
+ CMmsHeaders& aMmsHeaders,
+ CMmsEncode& aMmsEncoder,
+ CBufFlat* aEncodeBuffer );
+
+
+ static TBool IsDrive(const TDesC& aFileName);
+ static TBool IsDir(const TDesC& aFileName, RFs& aFs);
+ static TBool IsFile(const TDesC& aFileName, RFs& aFs);
+
+
+private:
+
+ };
+
+
+#endif // MMSTESTSTATICUTILS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/inc/mmstestuitimer.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef C_TESTUITIMER_H
+#define C_TESTUITIMER_H
+
+
+#include <e32base.h>
+
+#define KPeriod 10000 // period of timer
+
+/**
+ * timer for test programs
+ */
+NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
+ {
+public:
+
+ static CTestUiTimer* NewL();
+ virtual ~CTestUiTimer();
+
+ void RunL();
+ void DoCancel();
+ void ConstructL();
+ void IssueRequest();
+ void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
+
+private:
+ CTestUiTimer();
+
+public:
+ TTimeIntervalMicroSeconds32 period;
+
+private: // data
+ CActive* iObject;
+ };
+
+#endif // C_TESTUITIMER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/mmstestbed.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,90 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Project file for mmstestbed
+#
+
+QT += testlib
+QT -= gui
+
+TEMPLATE = lib
+
+TARGET = mmstestbed
+
+INCLUDEPATH += .
+INCLUDEPATH += inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../../../../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmshttptransport/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsconninit/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsserver/inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_MMSTESTBED_DLL
+
+CONFIG += hb
+CONFIG += symbian_test
+CONFIG += qtestlib
+
+SOURCES += src/mmstestbed.cpp \
+ src/mmsteststaticutils.cpp \
+ src/mmsreadfile.cpp \
+ src/mmstestuitimer.cpp
+
+HEADERS += inc/mmstestbed.h \
+ inc/mmsteststaticutils.h \
+ inc/mmsreadfile.h \
+ inc/mmstestuitimer.h \
+ inc/mmstestbed.hrh
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+symbian {
+ TARGET.UID3 = 0xE5c588a1
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.EPOCSTACKSIZE = 0x8000
+ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+ TARGET.EPOCALLOWDLLDATA = 1
+ VENDORID = VID_DEFAULT
+ }
+
+#Def File rules
+defBlock = \
+"$${LITERAL_HASH}if defined(EABI)" \
+"DEFFILE eabi/mmstestbedu.def" \
+"$${LITERAL_HASH}else" \
+"DEFFILE bwins/mmstestbedu.def" \
+"$${LITERAL_HASH}endif"
+
+# Build.inf rules
+BLD_INF_RULES.prj_exports += \
+ "$${LITERAL_HASH}include <platform_paths.hrh>"
+
+LIBS += -lmsgs \
+ -lmmsmessage \
+ -lmmsconninit \
+ -lmmscodec \
+ -lmmsserversettings \
+ -lcentralrepository \
+ -lapparc \
+ -lbafl \
+ -lefsrv \
+ -lesock \
+ -lestor \
+ -leuser \
+ -llogcli \
+ -llogwrap \
+ -lapgrfx \
+ -lapmime
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/src/mmsreadfile.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,1799 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <badesca.h>
+#include <e32def.h>
+#include <s32file.h>
+#include <msvids.h>
+#include <mtmdef.h>
+//#include <eikenv.h>
+#include <apgcli.h>
+#include <CMsvMimeHeaders.h>
+#include <AknNoteWrappers.h>
+
+#include <mmsservercommon.h>
+#include "mmsconst.h"
+#include "mmsclient.h"
+#include "mmsheaders.h"
+#include "mmsreadfile.h"
+#include "mmsmmboxviewheaders.h"
+#include "mmsmmboxmessageheaders.h"
+#include "mmsmmboxflags.h"
+#include "mmssettings.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KMmsGranularity = 8;
+_LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
+
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// ==================== LOCAL FUNCTIONS ====================
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsReadFile::CMmsReadFile()
+ {
+ // all member variables in a class derived from CBase
+ // are automatically set to 0.
+ }
+
+
+//
+void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
+ {
+ // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
+ iFs = aFs;
+ iReader = &aReadStream;
+ iByteBuffer = HBufC8::NewL( DefaultBufLen );
+ iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
+ iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
+ Reset();
+ }
+
+// Two-phased constructor.
+CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
+ {
+ CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
+ CleanupStack::PushL( self );
+ self->ConstructL( aFs, aReadStream );
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+// Destructor
+CMmsReadFile::~CMmsReadFile()
+ {
+ Reset(); // resets and destroys all array data
+ if (iAliasArray != NULL) iAliasArray->Reset();
+ delete iByteBuffer;
+ delete iAliasArray;
+ delete iAttaStructures;
+ }
+
+void CMmsReadFile::Reset()
+ {
+ // reset all arrays
+ if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
+ iAttaCount = 0;
+ iAttaRoot = 0;
+ }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CompleteTest
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
+{
+ Reset(); // new message
+
+ TUint32 val;
+ TUint limit = 1000000;
+ TUint sizeLimit = 1000 * 1024; //max message size 1000 kB!
+ TUint allLimit = 999999;
+ TInt error;
+ TRadix radix = EDecimal;
+ TLex16 lex;
+ TTestReadStatus readStatus = ETestUnknown;
+ CMmsAttaStructure* oneAtta = NULL;
+ TInt index;
+ TTime y1970( K1970 );
+ TTimeIntervalMicroSeconds interval;
+ TTime date;
+ TInt order = 0;
+ TInt16 shortInteger = 0;
+
+ //iso luuppi, joka kiertää ja lukee kunnes EOF tule vastaan
+ //Big Loop, which passes around and read until the EOF
+
+ iMessageType = iNextMessageType;
+ while(readStatus != ETestEof)
+ {
+ readStatus = ReadRowL();
+ if ( readStatus == ETestEof )
+ {
+ return(-1);
+ }
+ if ( readStatus == ETestUnknown )
+ {
+ // A line containing only comments, or an unknown tag
+ // As using the scripts to test settings is no longer supported,
+ // any old keywords used to test CMmsSettings class are ignored
+ continue;
+ }
+ if( readStatus == ETestNewMessage )
+ {
+ iNextMessageType = readStatus;
+ if(aMessageCounter++)
+ {
+ return(NULL);
+ }
+ else
+ {
+ iMessageType = iNextMessageType;
+ continue;
+ }
+ }
+ if ( iMessageType == ETestNewMessage)
+ {
+ switch(readStatus)
+ {
+ case ETestFrom:
+ aMmsHeaders.SetSenderL( iValueBuffer );
+ break;
+ case ETestFromAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
+ }
+ break;
+ case ETestTo:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
+ break;
+ case ETestToAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
+ }
+ break;
+ case ETestCc:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
+ break;
+ case ETestCcAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
+ }
+ break;
+ case ETestBcc:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
+ break;
+ case ETestBccAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
+ }
+ break;
+ case ETestSubject:
+ aMmsHeaders.SetSubjectL( iValueBuffer );
+ break;
+ case ETestExpiryRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetExpiryInterval( val );
+ }
+ break;
+ case ETestExpiryAbs:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ // expiry date in seconds from 1.1.1970.
+ aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
+ break;
+ case ETestDeliveryTimeRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetDeliveryTimeInterval( val );
+ }
+ break;
+ case ETestDeliveryTimeAbs:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
+ break;
+ case ETestDate:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetDate( (interval.Int64())/1000000 );
+ case ETestPriority:
+ val = 0;
+ if ((iValueBuffer.CompareF(KLow)) == 0)
+ {
+ val = EMmsPriorityLow;
+ }
+ else if ((iValueBuffer.CompareF(KNormal)) == 0)
+ {
+ val = EMmsPriorityNormal;
+ }
+ else if ((iValueBuffer.CompareF(KHigh)) == 0)
+ {
+ val = EMmsPriorityHigh;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessagePriority( val );
+ break;
+ case ETestSenderVisibility:
+ val = 0;
+ if ((iValueBuffer.CompareF(KHide)) == 0)
+ {
+ val = EMmsSenderVisibilityHide;
+ }
+ else if ((iValueBuffer.CompareF(KShow)) == 0)
+ {
+ val = EMmsSenderVisibilityShow;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetSenderVisibility( val );
+ break;
+ case ETestDeliveryReport:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDeliveryReport( val );
+ break;
+ case ETestDelivReportSendAllow:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReportAllowed( val );
+ break;
+
+ case ETestReadReply:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReadReply( val );
+ break;
+ case ETestNewAttachment:
+ oneAtta = CMmsAttaStructure::NewL();
+ iAttaStructures->AppendL(oneAtta);
+ oneAtta->iAtta->Des().Copy( iValueBuffer );
+ iAttaCount++;
+ break;
+ case ETestAttachmentType:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaType->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttachmentContLoc:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaName->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttaRecommendedName:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttachmentCharset:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaCharset = val;
+ }
+ }
+ break;
+ case ETestAttachmentCid:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaCid->Des().Copy(iValueBuffer);
+ }
+ break;
+ case ETestAttContTypeParamName:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttContTypeParamValue:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttXTypeParamName:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttXTypeParamValue:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttachmentRoot:
+ iAttaRoot = iAttaCount;
+ break;
+ case ETestAlias:
+ // all aliases are global even if they appear
+ // in the middle of a message
+ iAliasArray->AppendL( iValueBuffer );
+ iAliasCount++;
+ break;
+ case ETestMessageClass: // should be handled!
+ val = EMmsClassPersonal;
+ if ((iValueBuffer.CompareF(KPersonal)) == 0)
+ {
+ val = EMmsClassPersonal;
+ }
+ else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
+ {
+ val = EMmsClassAdvertisement;
+ }
+ else if ((iValueBuffer.CompareF(KInformational)) == 0)
+ {
+ val = EMmsClassInformational;
+ }
+ else if ((iValueBuffer.CompareF(KAuto)) == 0)
+ {
+ val = EMmsClassAuto;
+ }
+ else
+ {
+ val = (TMmsMessageClass)KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessageClass( val );
+ break;
+ case ETestReplyCharging:
+ val = 0;
+ if ((iValueBuffer.CompareF(KRequested)) == 0)
+ {
+ val = KMmsReplyChargingRequested;
+ }
+ else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
+ {
+ val = KMmsReplyChargingRequestedTextOnly;
+ }
+ else if ((iValueBuffer.CompareF(KAccepted)) == 0)
+ {
+ val = KMmsReplyChargingAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
+ {
+ val = KMmsReplyChargingAcceptedTextOnly;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReplyCharging( val );
+ break;
+ case ETestReplyChargAbs:
+ error = date.Set(iValueBuffer);
+ if ( error == KErrNone )
+ {
+ interval = date.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
+ }
+ break;
+ case ETestReplyChargRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetReplyChargingInterval( val );
+ }
+ break;
+ case ETestReplyChargSize:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,sizeLimit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetReplyChargingSize( val );
+ }
+ break;
+ case ETestReplyChargID:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
+ break;
+ case ETestTID:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetTidL( iByteBuffer->Des() );
+ break;
+ case ETestContentLocation:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
+ {
+ aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
+ }
+ else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
+ }
+ else
+ {
+ aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
+ }
+ break;
+ case ETestPreviouslySentIndex:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ order = val;
+ break;
+ case ETestPreviouslySentBy:
+ aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
+ break;
+ case ETestPreviouslySentDate:
+ error = date.Set(iValueBuffer);
+ if ( error == KErrNone )
+ {
+ interval = date.MicroSecondsFrom( y1970 );
+ aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
+ }
+ break;
+ case ETestMessageId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
+ break;
+ case ETestMessageSize:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,sizeLimit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetMessageSize( val );
+ }
+ break;
+ case ETestVersion:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,EHex,limit);
+ shortInteger = TInt16( val );
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetMmsVersion( shortInteger );
+ }
+ break;
+ case ETestReadStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KRead)) == 0)
+ {
+ val = KMmsReadStatusRead;
+ }
+ else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
+ {
+ val = KMmsReadStatusDeletedWithoutBeingRead;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReadStatus( val );
+ break;
+ case ETestResponseStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
+ {
+ val = KMmsErrorUnspecified;
+ }
+ else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
+ {
+ val = KMmsErrorServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
+ {
+ val = KMmsErrorMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
+ {
+ val = KMmsErrorNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
+ {
+ val = KMmsErrorNoContentAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
+ {
+ val = KMmsErrorUnsupportedMessage;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorTransientSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+ {
+ val = KMmsErrorTransientMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorPermanentMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorPermanentSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorPermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
+ {
+ val = KMmsErrorPermanentContentNotAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingForwardingDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingNotSupported;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
+ {
+ val = KMmsErrorTransientPartialSuccess;
+ }
+ else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
+ {
+ val = KMmsErrorPermanentAddressHidingNotSupported;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteStatusL( order, val );
+ }
+ else
+ {
+ aMmsHeaders.SetResponseStatus( val );
+ }
+ break;
+ case ETestResponseText:
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
+ }
+ else
+ {
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ }
+ break;
+ case ETestRetrieveStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+ {
+ val = KMmsErrorReceiveTransientMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorReceiveTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorReceivePermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
+ {
+ val = KMmsErrorReceivePermanentContentUnsupported;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetResponseStatus( val );
+ break;
+ case ETestRetrieveText:
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ break;
+ case ETestStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KDeferred)) == 0)
+ {
+ val = KMmsMessageStatusDeferred;
+ }
+ else if ((iValueBuffer.CompareF(KExpired)) == 0)
+ {
+ val = KMmsMessageStatusExpired;
+ }
+ else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+ {
+ val = KMmsMessageStatusRetrieved;
+ }
+ else if ((iValueBuffer.CompareF(KRejected)) == 0)
+ {
+ val = KMmsMessageStatusRejected;
+ }
+ else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
+ {
+ val = KMmsMessageStatusUnrecognized;
+ }
+ else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
+ {
+ val = KMmsMessageStatusIndeterminate;
+ }
+ else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+ {
+ val = KMmsMessageStatusForwarded;
+ }
+ else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
+ {
+ val = KMmsMessageStatusUnreachable;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetStatus( val );
+ break;
+ case ETestMessageType:
+ val = 0;
+ if ((iValueBuffer.CompareF(KSendReq)) == 0)
+ {
+ val = KMmsMessageTypeMSendReq;
+ }
+ else if ((iValueBuffer.CompareF(KSendConf)) == 0)
+ {
+ val = KMmsMessageTypeMSendConf;
+ }
+ else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
+ {
+ val = KMmsMessageTypeMNotificationInd;
+ }
+ else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
+ {
+ val = KMmsMessageTypeMNotifyRespInd;
+ }
+ else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
+ {
+ val = KMmsMessageTypeMRetrieveConf;
+ }
+ else if ((iValueBuffer.CompareF(KAckInd)) == 0)
+ {
+ val = KMmsMessageTypeAcknowledgeInd;
+ }
+ else if ((iValueBuffer.CompareF(KDelInd)) == 0)
+ {
+ val = KMmsMessageTypeDeliveryInd;
+ }
+ else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
+ {
+ val = KMmsMessageTypeReadRecInd;
+ }
+ else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
+ {
+ val = KMmsMessageTypeReadOrigInd;
+ }
+ else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
+ {
+ val = KMmsMessageTypeForwardReq;
+ }
+ else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
+ {
+ val = KMmsMessageTypeForwardConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
+ {
+ val = KMmsMessageTypeMboxStoreReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
+ {
+ val = KMmsMessageTypeMboxStoreConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
+ {
+ val = KMmsMessageTypeMboxViewReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
+ {
+ val = KMmsMessageTypeMboxViewConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
+ {
+ val = KMmsMessageTypeMBoxUploadReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
+ {
+ val = KMmsMessageTypeMBoxUploadConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDeleteReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDeleteConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDescr;
+ }
+ else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
+ {
+ val = KMmsMessageTypeDeleteReq;
+ }
+ else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
+ {
+ val = KMmsMessageTypeDeleteConf;
+ }
+ else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
+ {
+ val = KMmsMessageTypeCancelReq;
+ }
+ else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
+ {
+ val = KMmsMessageTypeCancelConf;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessageType( val );
+ break;
+ case ETestAttribute:
+ val = 0;
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
+ {
+ val = KMmsAssignedBcc;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
+ {
+ val = KMmsAssignedCc;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
+ {
+ val = KMmsAssignedContent;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
+ {
+ val = KMmsAssignedContentType;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
+ {
+ val = KMmsAssignedDate;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
+ {
+ val = KMmsAssignedDeliveryReport;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
+ {
+ val = KMmsAssignedDeliveryTime;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
+ {
+ val = KMmsAssignedExpiry;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
+ {
+ val = KMmsAssignedFrom;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
+ {
+ val = KMmsAssignedMessageClass;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
+ {
+ val = KMmsAssignedMessageId;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
+ {
+ val = KMmsAssignedMessageSize;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
+ {
+ val = KMmsAssignedPriority;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
+ {
+ val = KMmsAssignedReadReply;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
+ {
+ val = KMmsAssignedSubject;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
+ {
+ val = KMmsAssignedTo;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
+ {
+ val = KMmsAssignedReplyCharging;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
+ {
+ val = KMmsAssignedReplyChargingID;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
+ {
+ val = KMmsAssignedReplyChargingDeadline;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
+ {
+ val = KMmsAssignedReplyChargingSize;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
+ {
+ val = KMmsAssignedPreviouslySentBy;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
+ {
+ val = KMmsAssignedPreviouslySentDate;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
+ {
+ val = KMmsAssignedAdditionalHeaders;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
+ break;
+ case ETestDistributionIndicator:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDistributionIndicator( val );
+ break;
+ case ETestLimit:
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if( error == KErrNone )
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
+ }
+ break;
+ case ETestMessageQuota:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
+ }
+ break;
+ case ETestSizeQuota:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
+ }
+ break;
+ case ETestMessageTotal:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
+ }
+ break;
+ case ETestSizeTotal:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
+ }
+ break;
+ case ETestMessageCount:
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
+ }
+ break;
+ case ETestAddKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
+ break;
+ case ETestRemoveKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
+ break;
+ case ETestFilterKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
+ break;
+ case ETestMMState:
+ val = 0;
+ if ((iValueBuffer.CompareF(KDraft)) == 0)
+ {
+ val = KMmsDraft;
+ }
+ else if ((iValueBuffer.CompareF(KSent)) == 0)
+ {
+ val = KMmsSent;
+ }
+ else if ((iValueBuffer.CompareF(KNew)) == 0)
+ {
+ val = KMmsNew;
+ }
+ else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+ {
+ val = KMmsRetrieved;
+ }
+ else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+ {
+ val = KMmsForwarded;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
+ }
+ else
+ {
+ aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
+ }
+ break;
+ case ETestQuota:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
+ break;
+ case ETestStart:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
+ }
+ break;
+ case ETestStore:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
+ break;
+ case ETestStored:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
+ break;
+ case ETestStoreStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorStoreStatusTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorPermanentMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorStoreStatusPermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
+ {
+ val = KMmsErrorStoreStatusPermanentMmboxFull;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
+ break;
+ case ETestStoreStatusText:
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
+ break;
+ case ETestTotals:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
+ break;
+
+ case ETestDeleteInfoIndex:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ order = val;
+ break;
+
+ case ETestApplicId:
+ aMmsHeaders.SetApplicIdL( iValueBuffer );
+ break;
+ case ETestReplyApplicId:
+ aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
+ break;
+ case ETestApplicInfo:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
+ break;
+ case ETestContentClass:
+ val = 0;
+ if ((iValueBuffer.CompareF(KText)) == 0)
+ {
+ val = KMmsContentClassText;
+ }
+ else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
+ {
+ val = KMmsContentClassImageBasic;
+ }
+ else if ((iValueBuffer.CompareF(KImageRich)) == 0)
+ {
+ val = KMmsContentClassImageRich;
+ }
+ else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
+ {
+ val = KMmsContentClassVideoBasic;
+ }
+ else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
+ {
+ val = KMmsContentClassVideoRich;
+ }
+ else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
+ {
+ val = KMmsContentClassMegaPixel;
+ }
+ else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
+ {
+ val = KMmsContentClassContentBasic;
+ }
+ else if ((iValueBuffer.CompareF(KContentRich)) == 0)
+ {
+ val = KMmsContentClassContentRich;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetContentClass( val );
+ break;
+ case ETestDrmContent:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDrmContent( val );
+ break;
+ case ETestAdaptationAllowed:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetAdaptationAllowed( val );
+ break;
+ case ETestRecommendedRetrievalMode:
+ val = 0;
+ if ((iValueBuffer.CompareF(KManual)) == 0)
+ {
+ val = KMmsRecommendedRetrievalModeManual;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetRecommendedRetrievalMode( val );
+ break;
+ case ETestRecRetrievalModeText:
+ aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
+ break;
+ case ETestReplaceId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+ break;
+ case ETestStatusText:
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ break;
+ case ETestCancelId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+ break;
+ case ETestCancelStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
+ {
+ val = KMmsCancelRequestSuccessfullyReceived;
+ }
+ else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
+ {
+ val = KMmsCancelRequestCorrupted;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetCancelStatus( val );
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch(readStatus)
+ {
+ case ETestAlias:
+ iAliasArray->AppendL( iValueBuffer );
+ iAliasCount++;
+ break;
+
+ default:
+ break;
+ }
+
+ }
+ }
+ return(-1);
+}
+
+// ---------------------------------------------------------
+// CMmsReadFile()::ReadRowL
+// ---------------------------------------------------------
+//
+TTestReadStatus CMmsReadFile::ReadRowL()
+ {
+
+ TBuf8<DefaultBufLen> RowBuffer;
+ TBuf8<32> KeyBuffer;
+
+ // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
+ TChar delim( 10 );
+ iReader->ReadL( RowBuffer, delim);
+ TInt length = RowBuffer.Length();
+ if ( RowBuffer.Length() < 2 )
+ {
+ return ETestEof;
+ }
+ RowBuffer.Delete(length - 2,2);
+
+ // DROP POSSIBLE COMMENT OUT
+ TInt pos = RowBuffer.Locate( ';' );
+ if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
+
+ if ( RowBuffer.Length() == 0 )
+ {
+ // the line contained only comment
+ return ETestUnknown;
+ }
+
+ // First split the row (:)
+ pos = RowBuffer.Locate( ':' );
+ if (pos > 0)
+ {
+ TPtrC8 p = RowBuffer.Mid( pos+1 );
+ length = p.Length();
+ iValueBuffer.Zero();
+ for (TInt i=0; i < length; ++i)
+ {
+ iValueBuffer.Append(p[i]);
+ }
+ iValueBuffer.Trim();
+ TPtrC8 pp = RowBuffer.Left(pos);
+ KeyBuffer.CopyUC(pp);
+ KeyBuffer.Trim();
+ }
+ // TRY TO FIND CORRECT TAG
+ if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
+ if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
+ if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
+ if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
+ if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
+ if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
+ if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
+ if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
+ if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
+ if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
+ if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
+ if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
+ if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
+ if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
+ if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
+ if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
+ if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
+ if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
+ if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
+ if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
+ if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
+ if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
+ if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
+ if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
+ if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
+ if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
+ if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
+ if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
+ if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
+ if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
+ if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
+ if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
+ if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
+ if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
+ if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
+ if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
+ if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
+ if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
+ if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
+ if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
+ if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
+ if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
+ if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
+ if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
+ if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
+ if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
+ if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
+ if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
+ if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
+ if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
+ if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
+ if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
+ if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
+ if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
+ if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
+ if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
+ if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
+ if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
+ if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
+ if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
+ if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
+ if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
+ if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
+ if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
+ if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
+ if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
+ if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
+ if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
+ if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
+ if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
+ if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
+ if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
+ if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
+ if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
+ if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
+ if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
+ if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
+ if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
+ if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
+ if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
+ if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
+ if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
+ if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
+ return ETestUnknown;
+ }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CreateMessageL
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
+ {
+
+ // Reset inactivity timer to keem viewServer from crashing
+ User::ResetInactivityTime();
+
+ TInt i;
+ TInt error = KErrNone;
+ RFile attaFile;
+ _LIT8(KLeftAngle, "<");
+ _LIT8(KRightAngle, ">");
+ // we can't use "seconds from" as it only returns a
+ // 32 bit signed integer. If fails in 2038.
+ // "microseconds from" returns a 64 bit signed integer
+
+ CMsvStore* store = aMmsClient->Entry().EditStoreL();
+ CleanupStack::PushL(store);
+ aMmsHeaders->StoreL(*store);
+ store->CommitL();
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+
+ aMmsClient->LoadMessageL(); // read store is needed to do this
+
+ store = aMmsClient->Entry().EditStoreL();
+ CleanupStack::PushL(store);
+ CMsvAttachment* attaInfo = NULL;
+ TMsvAttachmentId attaId = 0;
+
+ for ( i=0; i < iAttaStructures->Count(); ++i)
+ {
+ attaId = KMsvNullIndexEntryId;
+ iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+
+ error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
+ User::LeaveIfError( error );
+
+ CleanupClosePushL(attaFile);
+
+ CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+ CleanupStack::PushL( mimeHeaders );
+ TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
+
+ TDataRecognitionResult result;
+ result.Reset(); // make sure that it is cleared
+
+ if(iAttaStructures->At(i)->iAttaCid->Length())
+ {
+ TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
+ if (attaCID.Find(KLeftAngle) == 0 &&
+ attaCID.Find(KRightAngle) == attaCID.Length()-1 )
+ {
+ // remove angle brackets from cid
+ attaCID = attaCID.Mid(1,attaCID.Length()-2);
+ }
+ mimeHeaders->SetContentIdL(attaCID);
+ }
+
+ if (iAttaStructures->At(i)->iAttaCharset)
+ {
+ mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
+ }
+
+ if (iAttaStructures->At(i)->iAttaName->Length())
+ {
+ iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
+ }
+ iParse.Set( iFilename, NULL, NULL );
+ iFilename.Copy( iParse.NameAndExt() );
+
+ mimeHeaders->SetContentLocationL( iFilename );
+
+ // if Mime type has not been set, use RapaRecognizer
+ if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
+ {
+ // TO BE IMPLEMENTED
+
+ RApaLsSession lsSession;
+
+ if ( lsSession.Connect() == KErrNone )
+ {
+ CleanupClosePushL( lsSession );
+
+ iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+ if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
+ {
+ // Check confidence level. Recognization must be at least
+ // "EProbable". We don't accept the result if it is "EPossible"
+ // or "EUnlikely" or "ENotRecognized"!
+
+ if ( result.iConfidence < CApaDataRecognizerType::EProbable )
+ {
+ result.Reset(); // clear buffer and try again with longer buffer
+ }
+
+ TPtrC8 mimeBuf8 = result.iDataType.Des8();
+
+ if ( mimeBuf8.Length() == 0 )
+ {
+ // Open file buffer and try again..
+
+ TInt bufSize = 0;
+ (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
+ if ( bufSize <= 0 )
+ {
+ bufSize = 30;
+ }
+ HBufC8* buf = HBufC8::NewLC( bufSize );
+ TPtr8 des = buf->Des();
+
+ RFile file;
+ TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
+ if ( err == KErrNone )
+ {
+ err = file.Read( des );
+ file.Close();
+ if ( err == KErrNone )
+ {
+ if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
+ {
+ mimeBuf8.Set( result.iDataType.Des8() );
+ }
+ }
+
+ }
+ CleanupStack::PopAndDestroy(); // buf
+ }
+ if ( mimeBuf8.Length() > 0 &&
+ result.iConfidence >= CApaDataRecognizerType::EProbable )
+ {
+ contentType.Set( result.iDataType.Des8() );
+ }
+ }
+ CleanupStack::PopAndDestroy(1); // lssession
+ }
+ }
+
+ if ( contentType.Length() > 0 )
+ {
+ TInt position = contentType.Find( KMmsSlash8 );
+ if ( position >= 0 )
+ {
+ mimeHeaders->SetContentTypeL( contentType.Left( position ) );
+ }
+ if ( position < contentType.Length() - 1 )
+ {
+ mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
+ }
+// CreateAttachment2L sets the content type to attaInfo
+// attaInfo->SetMimeTypeL( contentType );
+ }
+
+ if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
+ {
+ iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
+ iParse.Set( iFilename, NULL, NULL );
+ iFilename.Copy( iParse.NameAndExt() );
+ mimeHeaders->SetSuggestedFilenameL( iFilename );
+ }
+
+ TInt j = 0;
+ for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
+ {
+ mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
+ }
+ for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
+ {
+ mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
+ }
+
+ attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
+ // attaInfo does not go onto cleaunpstack because ownership will
+ // be transferred to attachment manager.
+
+ aMmsClient->CreateAttachment2L(
+ *store,
+ attaFile,
+ contentType,
+ *mimeHeaders,
+ attaInfo,
+ attaId);
+ attaInfo = NULL; // ownership transferred
+
+ CleanupStack::PopAndDestroy(); // mimeHeaders
+ CleanupStack::PopAndDestroy(); // attaFile.Close()
+
+ if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
+ {
+ aMmsClient->SetMessageRootL( attaId );
+ }
+ }
+
+ store->CommitL();
+ CleanupStack::PopAndDestroy(); // store
+
+ // This frees all memory and resets all values
+ Reset();
+ // Reset inactivity timer to keem viewServer from crashing
+ User::ResetInactivityTime();
+ }
+
+
+// ---------------------------------------------------------
+// CMmsReadFile()::FindAlias
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::FindAlias( TPtrC aAlias )
+ {
+ TBuf<DefaultBufLen> abuf;
+ for( TInt i=0; i < iAliasCount; ++i )
+ {
+ abuf.Copy( iAliasArray->MdcaPoint(i) );
+ abuf.SetLength( abuf.Locate('=') );
+ if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
+ }
+ return( -1 );
+ }
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsAttaStructure::CMmsAttaStructure()
+ {
+ iAtta = NULL;
+ iAttaType = NULL;
+ iAttaName = NULL;
+ iAttaCid = NULL;
+ iAttaRecommendedName = NULL;
+ }
+
+
+//
+void CMmsAttaStructure::ConstructL()
+ {
+ iAtta = HBufC8::NewL(DefaultBufLen);
+ iAttaType = HBufC8::NewL(DefaultBufLen);
+ iAttaName = HBufC8::NewL(DefaultBufLen);
+ iAttaCid = HBufC8::NewL(DefaultBufLen);
+ iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
+ iAttaCharset = 0;
+ iXTypeParams = new(ELeave) CDesC8ArrayFlat(4);
+ iContentTypeParams = new(ELeave) CDesC8ArrayFlat(4);
+
+ }
+
+// Two-phased constructor.
+CMmsAttaStructure* CMmsAttaStructure::NewL()
+ {
+ CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// Destructor
+CMmsAttaStructure::~CMmsAttaStructure()
+ {
+ delete iAtta;
+ delete iAttaName;
+ delete iAttaType;
+ delete iAttaCid;
+ delete iAttaRecommendedName;
+ if ( iContentTypeParams )
+ {
+ iContentTypeParams->Reset();
+ }
+ delete iContentTypeParams;
+ if ( iXTypeParams )
+ {
+ iXTypeParams->Reset();
+ }
+ delete iXTypeParams;
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/src/mmstestbed.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,2357 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <mtmdef.h>
+#include <CoreApplicationUIsSDKCRKeys.h>
+#include <mmsheaders.h>
+#include <mmscmds.h>
+#include <mmsencode.h>
+#include <mmscliententry.h>
+#include <logwrap.h>
+#include <logcli.h>
+#include <logview.h>
+#include "mmssettings.h" //use mmssettings.h instead of cmmssettings.h
+#include "mmstestbed.h"
+#include "mmsreadfile.h"
+#include "mmstestuitimer.h"
+#include "mmsteststaticutils.h"
+#include "mmstestbed.hrh"
+
+//constants
+_LIT( KMmsSender, "0601234567" );
+
+MmsTestBed::MmsTestBed()
+ {
+ //start the timer
+ iTimer = CTestUiTimer::NewL();
+ iTimer->Cancel();
+
+ iWait = CMsvOperationActiveSchedulerWait::NewLC();
+ // don't leave iWait on cleanup stack
+ CleanupStack::Pop();
+
+ //open msvsession
+ iSession = CMsvSession::OpenSyncL(*this);
+ //create client registry
+ iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
+ //create client mtm
+ iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
+ KUidMsgTypeMultimedia);
+
+ User::LeaveIfError( iFs.Connect() );
+ iFs.SetSessionPath( KRootPath );
+ iSettings = CMmsSettings::NewL();
+ iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
+ findDefaultL();
+ iServiceId = iDefaultServiceId;
+
+ //validate the settings
+ iSettings->ValidateSettings();
+
+ iLogEvent = CLogEvent::NewL();
+ iLogEvent->SetEventType(KLogMmsEventTypeUid);
+ iLogClient = NULL; // we test soon if this is available
+ iLogView = NULL; // needs log client
+ if ( checkLogClient() )
+ {
+ // first we generate a general view of all events
+ // we'll set the filter when we update the view
+ iLogView = CLogViewEvent::NewL( *iLogClient );
+ }
+ iLogFilter = CLogFilter::NewL();
+ // we try to filter MMS events
+ iLogFilter->SetEventType(KLogMmsEventTypeUid);
+ }
+
+MmsTestBed::~MmsTestBed()
+ {
+ delete iLogView;
+ delete iLogFilter;
+ delete iLogClient;
+ delete iLogEvent;
+ delete iSettings;
+ delete iMmsHeaders;
+ if(iTimer)
+ {
+ iTimer->Cancel();
+ delete iTimer;
+ }
+ //delete iMsvEntrySelection;
+ delete iMmsClient;
+ delete iClientMtmRegistry;
+ //delete iClientMtmRegistry;
+ delete iSession;
+ delete iWait;
+ }
+
+void MmsTestBed::setConnectionLocal(bool value)
+ {
+ //value = true for global off, local on
+ //value = false for global on, local off
+ iSettings->LoadSettingsL();
+ iSettings->SetLocalMode( value );
+ iSettings->SaveSettingsL();
+ }
+
+void MmsTestBed::fromOutboxToMmsc()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ // Get List of services
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
+ KUidMsgTypeMultimedia);
+ CleanupStack::PushL(selection);
+
+ // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
+ for (TInt i = 0; i < selection->Count(); ++i)
+ {
+ cEntry->SetEntryL(selection->At(i));
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetReadOnly(EFalse);
+ entry.SetSendingState(KMsvSendStateUnknown);
+ cEntry->ChangeL(entry);
+ }
+
+ selection->InsertL(0, iServiceId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack(parameters);
+
+ op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending)
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if (iWait->iStatus.Int() != KErrNone)
+ {
+ //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+
+void MmsTestBed::fromMmscToInbox()
+ {
+ CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+ CleanupStack::PushL(msvEntrySelection);
+
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ msvEntrySelection->InsertL(0, iServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack(parameters);
+
+ op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
+ paramPack, iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending)
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if (iWait->iStatus.Int() != KErrNone)
+ {
+ //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+ }
+
+void MmsTestBed::findDefaultL()
+ {
+ iSettings->LoadSettingsL();
+ iDefaultServiceId = iSettings->Service();
+ }
+
+void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+ TAny* aArg2, TAny* /*aArg3*/)
+ {
+ iEvent = aEvent;
+ if (aEvent == EMsvGeneralError)
+ {
+ return;
+ }
+ TMsvId parentId = KMsvNullIndexEntryId;
+ if (aArg2 != NULL)
+ {
+ parentId = *(TMsvId*) aArg2;
+ }
+
+ CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+ TMsvEntry tEntry;
+ TMsvId service;
+ TInt error = KErrNone;
+ error = iSession->GetEntry(selection->At(0), service, tEntry);
+
+ CMsvEntry* cEntry = NULL;
+ switch (aEvent)
+ {
+ case EMsvEntriesCreated:
+ {
+ if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+ {
+ // emit signal for new entry into INBOX
+ emit entryCreatedInInbox(tEntry.Id());
+ }
+ else if (parentId == KMsvDraftEntryIdValue)
+ {
+ // emit signal for new entry into Draft
+ emit entryCreatedInDraft(tEntry.Id());
+ }
+ else if (parentId == iServiceId)
+ {
+ // emit signal for new Entry into SERVICE
+ }
+ else
+ {
+ // do nothing
+ }
+ }
+ break;
+ case EMsvEntriesChanged:
+ {
+ TMsvId id;
+ CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+ if (selection == NULL)
+ {
+ // no selection, cannot handle
+ return;
+ }
+ id = selection->At(0);
+ //DEBUG Entry changed"));
+ if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+ {
+/*
+ cEntry = iSession->GetEntryL( parentId );
+ CleanupStack::PushL( cEntry );
+ TRAPD (error, cEntry->SetEntryL( id ));
+ if ( error != KErrNone )
+ {
+ CleanupStack::PopAndDestroy(); // cEntry
+ return;
+ }
+ TMsvEntry tEntry = cEntry->Entry();
+ if ( tEntry.Visible() )
+ {
+ // generate fake delivery report
+ CMsvStore* store = cEntry->ReadStoreL();
+ CleanupStack::PushL( store );
+ CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
+ CleanupStack::PushL( mmsHeaders );
+ mmsHeaders->RestoreL( *store );
+ iEncodeBuffer->ResizeL( 0 );
+ generateDeliveryReport( mmsHeaders );
+ CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+*/
+ }
+ }
+ break;
+ case EMsvEntriesDeleted:
+ {
+ //emit signal for entry deleted
+ }
+ break;
+ case EMsvEntriesMoved:
+ {
+ if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
+ {
+ // entry moved to outbox
+ emit entryMovedToOutbox(tEntry.Id());
+ }
+ else if (parentId == KMsvSentEntryIdValue)
+ {
+ // entry moved to sent folder
+ emit entryMovedToSent(tEntry.Id());
+ }
+ else
+ {
+ // do nothing
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+void MmsTestBed::createMmsService()
+ {
+ CMmsSettings * settings = CMmsSettings::NewL();
+ CleanupStack::PushL( settings );
+ settings->CreateNewServiceL( *iSession );
+ CleanupStack::PopAndDestroy(); // settings
+ return;
+ }
+
+void MmsTestBed::cleanup()
+ {
+ TMsvId entryToBeKilled;
+ // Get access to root index
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+
+ entryToBeKilled = iSettings->Service();
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ while (entryToBeKilled != KMsvNullIndexEntryId)
+ {
+ // delete child of root entry
+ deleteEntry(entryToBeKilled, *cEntry);
+ entryToBeKilled = iSettings->Service();
+ }
+
+ CleanupStack::PopAndDestroy(); // cEntry
+ // We deleted everything!
+ iDefaultServiceId = KMsvNullIndexEntryId;
+ iServiceId = KMsvNullIndexEntryId;
+ }
+
+void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
+ {
+ aClientEntry.DeleteL(aEntryId);
+ }
+
+void MmsTestBed::cleanupAndCreateNewService()
+ {
+ cleanup();
+ // all old service entries have been destroyed, create a new one
+ createMmsService();
+ }
+
+void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
+ {
+ // update settings in mmsclient
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+
+ RFileReadStream readStream;
+ readStream.PushL();
+// TMsvId id = KMsvNullIndexEntryId;
+ CBufFlat* encodeBuffer = NULL;
+ CMmsEncode* encoder = NULL;
+
+ // Open the file
+ TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
+ if (err != KErrNone) User::Leave( err );
+
+ TInt retCode = 0;
+ CMmsReadFile* readFile = NULL;
+ readFile = CMmsReadFile::NewL( iFs, readStream );
+ CleanupStack::PushL( readFile );
+
+ TInt messageCounter = 0;
+ CMsvEntry* cEntry = NULL;
+
+ while(!retCode)
+ {
+ // READ MESSAGE TO BUFFERS
+ iMmsHeaders->Reset(iSettings);
+ // put in some message type just for fun (testing...)
+ iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
+ retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
+ if(readFile->iMessageType == ETestNewMessage)
+ {
+ // CREATE MESSAGE ENTRY
+ switch ( aCommand )
+ {
+ case ECreateToInbox:
+ case ECreateNotification:
+ cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ break;
+ case ECreateToSentItems:
+ cEntry = iSession->GetEntryL(KMsvSentEntryId);
+ break;
+ case ECreateToDrafts:
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ break;
+ case ECreateHeadersFromFile:
+ // here we just encode headers, no message entry
+ // the entry is fake.
+ break;
+ case ECreateMMBoxViewConf:
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ // entry is not created for the description items
+ // they become attachments
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ }
+ break;
+ default:
+ cEntry = iSession->GetEntryL(aBox);
+ break;
+ }
+
+ // if we are just playing with headers we have no entry
+ if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
+ {
+ CleanupStack::PushL(cEntry);
+ iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+ // CREATE MESSAGE
+ iMmsClient->CreateMessageL(iServiceId);
+ }
+ else if ( aCommand == ECreateMMBoxViewConf )
+ {
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ CleanupStack::PushL(cEntry);
+ iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+ // CREATE MESSAGE
+ iMmsClient->CreateMessageL(iServiceId);
+ }
+ else
+ {
+ encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+ CleanupStack::PushL( encodeBuffer );
+ encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+
+ // encode headers to a binary file
+ encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+ iFilename = KMmsMMBoxDescriptionDirectory;
+ TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+ CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+ encodeBuffer = NULL;
+ encoder = NULL;
+ }
+ }
+ else
+ {
+ encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+ CleanupStack::PushL( encodeBuffer );
+ encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+
+ // encode headers to a binary file
+ encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+ iFilename = KMmsDumpDirectory;
+ TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+ CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+ encodeBuffer = NULL;
+ encoder = NULL;
+ }
+ }
+
+ if ( aCommand != ECreateHeadersFromFile &&
+ ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
+ {
+ if(readFile->iMessageType == ETestSettings)
+ {
+ TMsvId ServiceId = iMmsClient->DefaultServiceL();
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+ }
+
+ TMemoryInfoV1Buf memory;
+ UserHal::MemoryInfo( memory );
+ TInt available = memory().iFreeRamInBytes;
+// TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
+
+ TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
+
+ available = memory().iFreeRamInBytes;
+// TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
+
+ if(readFile->iMessageType == ETestNewMessage)
+ {
+ TMsvEntry tEntry = iMmsClient->Entry().Entry();
+ TMsvId id = tEntry.Id();
+ if ( err == KErrNone )
+ {
+ // SAVE MESSAGE
+ iMmsClient->SaveMessageL();
+
+ // If we are creating a MMBox View confirmation,
+ // we add all binary files from KMmsMMBoxDirectory
+ // as attachments.
+
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ addMMBoxDescriptions();
+ }
+
+ // reload the entry in case mms client put something into it
+ // MESSAGE MUST BE SET VISIBLE
+ tEntry = iMmsClient->Entry().Entry();
+ if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
+ {
+ tEntry.iMtmData1 |= KMmsMessageAdvertisement;
+ }
+ else if ( iMmsClient->MessageClass() == EMmsClassInformational )
+ {
+ tEntry.iMtmData1 |= KMmsMessageInformational;
+ }
+ tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
+
+ // Test: Set all as editor oriented - except notifications!
+ if ( aCommand == ECreateNotification )
+ {
+ tEntry.iMtm = KUidMsgMMSNotification;
+ }
+ else
+ {
+ tEntry.iMtmData1 |= KMmsMessageEditorOriented;
+ }
+ if ( aCommand == ECreateToInbox )
+ {
+ tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
+ tEntry.SetReadOnly( ETrue );
+ tEntry.SetNew( ETrue );
+ tEntry.SetUnread( ETrue );
+ }
+ else if ( aCommand == ECreateToSentItems )
+ {
+ tEntry.SetReadOnly( ETrue );
+ }
+ tEntry.SetVisible( ETrue );
+ tEntry.SetInPreparation( EFalse );
+ TTime now;
+ now.UniversalTime();
+ tEntry.iDate = now;
+ TMsvId entryId = tEntry.Id();
+ iMmsClient->Entry().ChangeL( tEntry );
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ // Encode to the directory that is used to fetch MMBox view
+ iFilename.Copy( KMmsMMBoxDirectory );
+ encodeMessageFromDrafts();
+ cEntry->SetEntryL( KMsvDraftEntryId );
+ cEntry->DeleteL( entryId );
+ }
+ }
+ else
+ {
+ //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
+ iSession->RemoveEntry(id);
+ err = KErrNone; // clear error
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ cEntry = NULL;
+ }
+ if(readFile->iMessageType == ETestSettings)
+ {
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); //readFile
+
+ readStream.Close();
+ readStream.Pop();
+
+ /*
+ iMmsClient->SwitchCurrentEntryL(id);
+ */
+ }
+
+void MmsTestBed::addMMBoxDescriptions()
+ {
+ // add the contents of KMmsMMBoxDescriptionDirectory as attachments
+ CDir* fileList = NULL;
+ TInt i = 0; // general counter
+ TInt error = KErrNone;
+ iCurrentPath = KMmsMMBoxDescriptionDirectory;
+
+ iFs.SetSessionPath(iCurrentPath);
+
+ TFindFile finder( iFs );
+ error = finder.FindWildByPath( KWild, NULL, fileList );
+ CleanupStack::PushL( fileList );
+ TInt fileCounter = 0;
+
+ if ( error == KErrNone )
+ {
+ fileCounter = fileList->Count();
+ }
+
+ TEntry entry;
+
+ if ( error == KErrNone )
+ {
+ for ( i = 0; i < fileCounter; ++i )
+ {
+ // Reset inactivity timer to keep viewServer from crashing
+ User::ResetInactivityTime();
+ entry = (*fileList)[i]; // name is entry.iName
+ iFilename.Copy( iCurrentPath );
+ iFilename.Append( entry.iName );
+ TPtrC ptr;
+ ptr.Set( iFilename );
+ iWait->iStatus = KErrNone;
+ iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
+
+ iWait->Start();
+ // The descriptions are cleared after being used
+ iFs.Delete( ptr);
+ }
+ }
+
+ iMmsClient->SaveMessageL(); // just in case somthing must be updated
+ CleanupStack::PopAndDestroy(); // fileList
+ fileList = NULL;
+ }
+
+void MmsTestBed::encodeMessageFromDrafts()
+ {
+ CMmsEncode* encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+ // encode a message iMmsClientPoints to
+ iMmsClient->LoadMessageL();
+ CMsvStore* store = iMmsClient->Entry().ReadStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->RestoreL( *store );
+ CleanupStack::PopAndDestroy(); // store
+ store = NULL;
+ iWait->iStatus = KErrNone;
+
+// caller sets the directory
+// iFilename = KMmsMessageDumpDirectory;
+
+ CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
+ CleanupStack::PushL( entryWrapper );
+ iEncodeBuffer->ResizeL(0);
+ encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
+ iWait->Start();
+ if ( iWait->iStatus == KErrNone )
+ {
+ TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
+ }
+ iEncodeBuffer->ResizeL(0);
+ CleanupStack::PopAndDestroy(); // entryWrapper
+ CleanupStack::PopAndDestroy(); // encoder
+ }
+
+void MmsTestBed::deleteNotifications()
+ {
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+
+ CMsvEntry* cEntry = NULL;
+ // delete all messages from the specified box
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+
+ if ( mmsFolderId != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL(mmsFolderId);
+
+ // show invisible entries
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL(msvEntrySelection);
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ if (msvEntrySelection->Count() > 0)
+ {
+ CMsvOperation* op = iSession->TransferCommandL(
+ *msvEntrySelection,
+ EMmsDeleteEntries,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ // These cannot be deleted unless we have the a server mtm
+ // corresponding to this mtm type.
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+ msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
+ CleanupStack::PushL(msvEntrySelection);
+
+ if (msvEntrySelection->Count() > 0)
+ {
+ CMsvOperation* op = iSession->TransferCommandL(
+ *msvEntrySelection,
+ EMmsDeleteEntries,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ }
+
+TMsvId MmsTestBed::findMMSFolder()
+ {
+ return iSettings->NotificationFolder();
+ }
+
+void MmsTestBed::restoreFactorySettings()
+ {
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+ // do not reset access point
+ TInt accessPoint = iSettings->AccessPoint( 0 );
+ iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
+ TInt count = iSettings->AccessPointCount();
+ TInt i = 0;
+ for ( i = count - 1; i >= 0; --i )
+ {
+ iSettings->DeleteAccessPointL( i );
+ }
+ // restore the original access point
+ if ( accessPoint > 0 )
+ {
+ // a negative access point is an error (most likely "KErrNotFound")
+ iSettings->AddAccessPointL( accessPoint, 0 );
+ }
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+
+void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
+ {
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+
+ iSettings->SetReceivingModeHome( aState );
+
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+
+void MmsTestBed::sendFromFile()
+ {
+ CMsvOperation * op = NULL;
+
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ CleanupStack::PushL( cEntry );
+
+ CMsvEntrySelection* selection = NULL;
+ selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy(); // cEntry
+ CleanupStack::PushL( selection );
+
+ TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
+ if ( error != KErrNone )
+ {
+ CleanupStack::PopAndDestroy(); // selection
+ delete op;
+ return;
+ }
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(2); // op, selection
+ }
+
+void MmsTestBed::sendOneByOne()
+ {
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ CleanupStack::PushL( cEntry );
+
+ CMsvEntrySelection* selection = NULL;
+ selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL( selection );
+
+ CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( shortSelection );
+
+ TInt i;
+
+ for ( i = 0; i < selection->Count(); ++i )
+ {
+ shortSelection->Reset();
+ shortSelection->AppendL( selection->At( i ) );
+
+ CMsvOperation * op = NULL;
+
+ TTime now;
+ now.UniversalTime();
+
+ TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
+ if ( error != KErrNone )
+ {
+ delete op;
+ CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+ return;
+ }
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+
+ }
+ CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+ }
+
+void MmsTestBed::sendNotifications()
+ {
+ // Only send one notification!!
+
+ TInt error = KErrNone;
+
+ if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
+ {
+ //Not a file
+ return;
+ }
+ TMsvId mmsFolder = findMMSFolder();
+
+ TEntry entry;
+
+
+ // now I think we have a filename
+ TEntry orgEntry;
+ TUint size = 0;
+ error = iFs.Entry( iCurrentFile, orgEntry );
+ size = orgEntry.iSize;
+
+ //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
+ if ( size == 0 )
+ {
+ //empty file
+ //TMmsLogger::Log(_L("- empty file"));
+ return;
+ }
+
+ if ( iEncodeBuffer == NULL )
+ {
+ iEncodeBuffer = CBufFlat::NewL( size );
+ }
+ else
+ {
+ iEncodeBuffer->ResizeL( 0 );
+ iEncodeBuffer->ResizeL( size );
+ }
+
+ RFile inFile;
+ error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
+ TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+ if ( error == KErrNone )
+ {
+ error = inFile.Read( ptr, size );
+ inFile.Close();
+ }
+ else
+ {
+ //Error
+ //TMmsLogger::Log(_L("- can't read file"));
+ return;
+ }
+
+ TUint8 byte;
+ TUint position = 0;
+ TUint32 uintvar = 0;
+
+ if ( size > 2 )
+ {
+ iEncodeBuffer->Read( 1, &byte, 1 );
+ if ( byte == 6 ) // PUSH PDU
+ {
+ // try to find out length of header
+ position = 2;
+ iEncodeBuffer->Read( position, &byte, 1);
+
+ while ( byte & 0x80 && position < size )
+ {
+ uintvar += ( byte & 0x7f );
+ uintvar <<= 7;
+ position++;
+ iEncodeBuffer->Read( position, &byte, 1 );
+ }
+
+ // add last byte without shift
+ uintvar += byte;
+ position++;
+ }
+ }
+
+ position += uintvar;
+
+ if ( position < size )
+ {
+ ptr = iEncodeBuffer->Ptr( position );
+ size = ptr.Length();
+ }
+
+ if ( size == 0 )
+ {
+ //no MMS stuff
+ //TMmsLogger::Log(_L("- no MMS stuff"));
+ return;
+ }
+
+ TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+
+ // Now we have streamed our data into this entry.
+ // Now we have an entry that says: local service, MMS MTM
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ if ( entryId != KMsvNullIndexEntryId )
+ {
+ selection->AppendL( entryId );
+ }
+ else
+ {
+ selection->AppendL( iDefaultServiceId );
+ }
+
+ TWatcherParameters parameters; // initialized to zero
+ parameters.iWatcherId = RThread().Id();
+ parameters.iDataPointer = &ptr;
+ TWatcherParametersBuf paramPack( parameters );
+
+ CMsvOperation * op = NULL;
+
+ op = iSession->TransferCommandL(
+ *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ User::After(1000000);
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::copyDrafts()
+ {
+ CMsvEntry* cEntry = NULL;
+// Copies contents of sent folder to drafts for retrying sending.
+
+ cEntry = iSession->GetEntryL(KMsvSentEntryId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages in drafts
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+
+ TMsvLocalOperationProgress progress;
+ cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
+
+ TInt i = 0;
+ for ( i = 0; i < selection->Count(); ++i )
+ {
+ cEntry->SetEntryL( selection->At( i ) );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetReadOnly( EFalse );
+ cEntry->ChangeL( entry );
+ }
+
+ CleanupStack::PopAndDestroy(2); // selection, cEntry
+ }
+
+void MmsTestBed::garbageCollection(TUint32 aReason)
+ {
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+
+ TMMSGarbageCollectionParameters parameters; // initialized to zero
+ parameters.iReasonFlags = aReason;
+ TMMSGarbageCollectionParametersBuf paramPack( parameters );
+ op = iSession->TransferCommandL(
+ *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::messageVariation()
+ {
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+
+ op = iSession->TransferCommandL(
+ *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::cancelSendScheduling()
+ {
+ CMsvEntry* cEntry = NULL;
+ setFetchingState( EMmsReceivingPostpone );
+ testFile( iCurrentFile );
+ scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
+ deleteSendSchedule();
+
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ if (iMsvEntrySelection != NULL)
+ {
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ }
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy();
+ }
+
+void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
+ {
+ CMsvEntry* cEntry = NULL;
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ cEntry = iSession->GetEntryL(aBoxId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+// selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledSend,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::deleteSendSchedule()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsDeleteSchedule,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::cancelFetchScheduling()
+ {
+ TMsvId mmsFolder = findMMSFolder();
+ CMsvEntry* cEntry = NULL;
+ setFetchingState( EMmsReceivingPostpone );
+ testFile( iCurrentFile );
+ fromOutboxToMmsc(); // immediate send (EMmsSend)
+
+ // Wait until notification has arrived - may take a while in global mode
+ TInt i = 0;
+ while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
+ && i < 2000 )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ i++;
+ if ( (i/100) * 100 == i )
+ {
+ //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+ }
+ CActiveScheduler::Start();
+ }
+ iTimer->Cancel();
+
+ fetchForced( 10000 ); // delay to allow cancelling
+ deleteFetchSchedule();
+
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(mmsFolder);
+ if (iMsvEntrySelection != NULL)
+ {
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ }
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
+ {
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledReceiveForced,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::deleteFetchSchedule()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+ cEntry = iSession->GetEntryL( mmsFolderId );
+ CleanupStack::PushL(cEntry);
+ // Get all notifications
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsDeleteSchedule,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::doAFetchCycle()
+ {
+ // Sends a message from iCurrentFile and lets it come back
+ TMsvId mmsFolder = findMMSFolder();
+ testFile( iCurrentFile );
+ fromOutboxToMmsc(); // immediate send (EMmsSend)
+ // fetching will start automatically
+
+ TInt i = 0;
+ while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
+ && i < 2000
+ && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ i++;
+ if ( (i/100) * 100 == i )
+ {
+ //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+ }
+ CActiveScheduler::Start();
+ }
+ iTimer->Cancel();
+ }
+
+bool MmsTestBed::checkLogClient()
+ {
+ if ( iLogClient == NULL )
+ {
+ TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
+ }
+ return ( iLogClient != NULL );
+ }
+
+int MmsTestBed::getLogEntries()
+ {
+ TInt count = 0;
+ if ( !iLogView )
+ {
+ return 0;
+ }
+
+ if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
+ {
+ // should complete with KErrNone
+ iWait->Start();
+ if ( iWait->iStatus.Int() == KErrNone )
+ {
+ count = iLogView->CountL();
+ }
+ }
+ return count;
+ }
+
+void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
+ {
+ CMsvOperation* opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
+ iWait->Start();
+ if (!opert->iStatus.Int()==KErrNone)
+ {
+ // what should we do? panic?
+ }
+
+ TPckgBuf<TMsvLocalOperationProgress> package;
+ package.Copy(opert->ProgressL());
+ *(TMsvId*)&aNewEntry = package().iId;
+
+ delete opert; opert=NULL;
+ }
+
+void MmsTestBed::cleanOutbox()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanInbox()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanSent()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanDrafts()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanAll()
+ {
+ cleanInbox();
+ cleanOutbox();
+ cleanSent();
+ cleanDrafts();
+ TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
+ deleteNotifications();
+ }
+
+void MmsTestBed::reply()
+ {
+ // The first message from inbox is replied to
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::replyToAll()
+ {
+ // The first message from inbox is replied to
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+ KMsvMessagePartRecipient;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::forward()
+ {
+ // The first message from inbox is forwarded
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+ KMsvMessagePartRecipient | KMsvMessagePartAttachments;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ iMmsClient->SwitchCurrentEntryL( newEntry );
+ // Add a sender: 0601234567
+ iMmsClient->LoadMessageL();
+ iMmsClient->SetSenderL( KMmsSender );
+ iMmsClient->SaveMessageL();
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::sendReadReport()
+ {
+ // TURN READ REPORTS ON (until available from menu)
+ iSettings->LoadSettingsL();
+ iSettings->SetReadReplyReportSendingAllowed( ETrue );
+ iSettings->SaveSettingsL();
+ iMmsClient->RestoreSettingsL();
+
+
+ // Read report is sent for the first message in inbox
+ CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+
+ if ( iMsvEntrySelection->Count() == 0 )
+ {
+ return;
+ }
+ TMsvId originalEntry = iMsvEntrySelection->At( 0 );
+
+ // new test using Client MTM
+ CMsvOperation * op = NULL;
+ op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy( op );
+ op = NULL;
+
+ // Try sending the read report to current entry
+
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy( op );
+ op = NULL;
+
+/*
+ cEntry->SetEntryL( originalEntry );
+ iMmsHeaders->Reset();
+ CMsvStore* store = cEntry->ReadStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->RestoreL( *store );
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+ HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
+ CleanupStack::PushL( messageId );
+ messageId->Des().Copy( iMmsHeaders->MessageId() );
+
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ iMmsClient->LoadMessageL();
+
+ iMmsHeaders->Reset();
+ iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
+ // Message id cannot be accessed via MMS Client MTM!
+
+ iMmsHeaders->SetMessageIdL( messageId->Des() );
+ CleanupStack::PopAndDestroy( messageId );
+
+ iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
+ // sender must be insert-address-token because we don't know our number
+ TTime now;
+ now.UniversalTime();
+
+ _LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
+
+ TTime y1970( K1970 );
+ TTimeIntervalMicroSeconds interval;
+ // we can't use "seconds from" as it only returns a
+ // 32 bit signed integer. If fails in 2038.
+ // "microseconds from" returns a 64 bit signed integer
+ interval = now.MicroSecondsFrom( y1970 );
+ // date in iMmsHeaders() in seconds from 1.1.1970.
+ iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
+ iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
+
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = FindMMSFolderL();
+
+ cEntry->SetEntryL( mmsFolderId );
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvMessageEntry;
+ entry.iMtm = KUidMsgTypeMultimedia;
+ entry.SetVisible( ETrue );
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ entry.iRelatedId = iDefaultServiceId;
+ entry.iMtmData1 = KMmsMessageReadRecInd;
+ cEntry->CreateL( entry );
+ TMsvId entryId = entry.Id();
+
+ cEntry->SetEntryL( entryId );
+
+ store = cEntry->EditStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->StoreL( *store );
+ store->CommitL();
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+
+ CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, entryId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy( op );
+ CleanupStack::PopAndDestroy( selection );
+*/
+ CleanupStack::PopAndDestroy( cEntry );
+ }
+
+int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
+ {
+ TInt error = KErrNone;
+ TInt messageCount = 0;
+ TInt failureCount = 0;
+ do {
+ CMsvEntry* cEntry = NULL;
+
+ // Get List of services
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ failureCount++;
+ // These are failures that fail in Message server.
+ if ( failureCount >= 63 && failureCount <= 64 )
+ {
+ failureCount = 65;
+ }
+ cEntry->SetEntryL( iServiceId );
+ TMsvEntry entry = cEntry->Entry();
+ entry.iMtmData3 &= 0x0000000FF;
+ entry.iMtmData3 |= failureCount << 8;
+ cEntry->ChangeL( entry );
+
+ selection->InsertL(0, iServiceId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
+
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ error = iWait->iStatus.Int();
+ if ( iWait->iStatus.Int() != KErrNoMemory )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // op
+ }
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // selection
+ CleanupStack::PopAndDestroy(); // cEntry
+ selection = NULL;
+ cEntry = NULL;
+ cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
+ CleanupStack::PushL(cEntry);
+ selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ messageCount = selection->Count();
+ delete selection;
+ selection = 0;
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ while ( error == KErrNoMemory || messageCount > 0 );
+ return failureCount;
+ }
+
+int MmsTestBed::fromMmscToInboxWithMemoryFailure()
+ {
+ TInt error = KErrNone;
+ TInt failureCount = 0;
+ TInt messageCount = 0;
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+
+ do {
+ // Inbox must be cleaned if failure makes message to be fetched more than once.
+ // should not happen, but this test is quite stressful, and perfect result
+ // cannot be guaranteed.
+ // What is expected:
+ // 1. Program does not crash
+ // 2. After sufficient number of retries the message is fetched and notification deleted.
+ TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+ CMsvEntry* cEntry = NULL;
+ CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+ CleanupStack::PushL(msvEntrySelection);
+
+ cEntry = iSession->GetEntryL(iServiceId);
+ CleanupStack::PushL(cEntry);
+
+ failureCount++;
+ // These are failures that fail in Message server.
+ if ( failureCount >= 63 && failureCount <= 64 )
+ {
+ failureCount = 65;
+ }
+ cEntry->SetEntryL( iServiceId );
+
+ TMsvEntry entry = cEntry->Entry();
+ entry.iMtmData3 &= 0x0000000FF;
+ entry.iMtmData3 |= failureCount << 8;
+ cEntry->ChangeL( entry );
+
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ msvEntrySelection->InsertL(0, iServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsReceiveForced,
+ *msvEntrySelection,
+ paramPack,
+ iWait->iStatus) );
+
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ error = iWait->iStatus.Int();
+ if ( iWait->iStatus.Int() != KErrNoMemory )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // msvEntrySelection
+ CleanupStack::PopAndDestroy(); // cEntry
+ msvEntrySelection = NULL;
+ cEntry = NULL;
+ cEntry = iSession->GetEntryL( mmsFolderId );
+ CleanupStack::PushL(cEntry);
+ msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ messageCount = msvEntrySelection->Count();
+ delete msvEntrySelection;
+ msvEntrySelection = 0;
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ while ( error == KErrNoMemory || messageCount > 0 );
+ if ( error != KErrNoMemory && error != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
+ }
+ return failureCount;
+ }
+
+void MmsTestBed::sendViaClient()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages in drafts
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+
+ CMsvOperation * op = NULL;
+ TTime now;
+ now.UniversalTime();
+ op = iMmsClient->SendL( *selection, iWait->iStatus, now );
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
+ {
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledReceive,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::fetchForcedImmediate()
+ {
+ TCommandParameters parameters;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsReceiveForced,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::getEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+
+ CLogEventType* eventType = CLogEventType::NewL();
+ CleanupStack::PushL( eventType );
+ eventType->SetUid(iLogEvent->EventType());
+ iLogClient->GetEventType( *eventType, iWait->iStatus );
+
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // eventType
+ }
+
+void MmsTestBed::addEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+
+ CLogEventType* eventType = CLogEventType::NewL();
+ CleanupStack::PushL( eventType );
+ eventType->SetUid(iLogEvent->EventType());
+ eventType->SetDescription(_L("Multimedia Message") );
+ eventType->SetLoggingEnabled( ETrue );
+
+// iWait->iStatus = KRequestPending;
+ iLogClient->AddEventType( *eventType, iWait->iStatus );
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // eventType
+ }
+
+void MmsTestBed::deleteEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+// iWait->iStatus = KRequestPending;
+ iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
+ iWait->Start();
+ }
+
+void MmsTestBed::cleanLog()
+ {
+ TInt count = 0;
+
+ count = getLogEntries();
+
+ TInt i;
+ for ( i = 0; i < count; ++i )
+ {
+ // when a view is created, it will be positioned on the first event
+// iWait->iStatus = KRequestPending;
+ iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
+ iWait->Start();
+
+ if ( iLogView->NextL( iWait->iStatus ) )
+ {
+ // should complete with KErrNone
+ iWait->Start();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ // could not get next event!
+ break;
+ }
+ }
+ else
+ {
+ break; // no more events!
+ }
+ }
+ }
+
+void MmsTestBed::setOnline(bool value)
+ {
+ //value = true for online mode
+ //value = false for offline mode
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
+ if( retval == KErrNone )
+ {
+ repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
+ delete repository;
+ }
+ }
+
+void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
+ {
+ iEncodeBuffer->ResizeL( 1024 );
+
+ TInt position = 0;
+
+ // encode message type
+ iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
+ position++;
+
+ // version
+ iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
+ position++;
+
+ TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
+ iEncodeBuffer->Write( position, &version, 1 );
+ position++;
+
+ // message id from the headers
+ // At least once MMSC did not send us the message id!
+ // if message id is missing, we cannot match the entry!
+ // This only a fake. Real delivery reports should always
+ // contain the message id.
+ if ( aMmsHeaders->MessageId().Length() > 0 )
+ {
+ iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
+ position += aMmsHeaders->MessageId().Length();
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+ }
+
+ // To is taken from the headers
+ iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
+ position++;
+
+ TPtrC recipient;
+ if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->ToRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->ToRecipients()[0] );
+ }
+ else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->CcRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->CcRecipients()[0] );
+ }
+ else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->BccRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->BccRecipients()[0] );
+ }
+ else
+ {
+ recipient.Set( _L("Jasso-Kissa@jii.fi") );
+ }
+
+ TMmsAddressType addressType = EMmsAddressTypeUnknown;
+
+ if ( recipient.Find( KMiuMau ) != KErrNotFound )
+ {
+ addressType = EMmsAddressTypeEmail;
+ }
+ else
+ {
+ addressType = EMmsAddressTypeMobile;
+ }
+
+ TUint8 character;
+ TInt i;
+ if ( addressType == EMmsAddressTypeEmail )
+ {
+ // email address - ASCII ONLY - THIS IS JUST A TEST!
+
+ for ( i = 0; i < recipient.Length(); ++i )
+ {
+ character = TUint8( recipient[i] & 0xff );
+ iEncodeBuffer->Write( position, &character, 1 );
+ position++;
+ }
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+
+ }
+ else
+ {
+ // must be a phone number
+ // We expect for now that the format is correct as is
+ // All legal characters present in a phone number are ASCII
+
+ TInt i;
+ for ( i = 0; i < recipient.Length(); ++i )
+ {
+ character = TUint8( recipient[i] & 0xff );
+ iEncodeBuffer->Write( position, &character, 1 );
+ position++;
+ }
+ iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
+ position += KMmsPlmnLength;
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+ }
+
+ // date
+ iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
+ position++;
+
+ TLocale locale;
+ locale.Refresh();
+ TInt64 UtcDate;
+ TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
+
+ TTime now;
+ now.UniversalTime();
+ UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
+
+ UtcDate -= universalTimeOffset.Int();
+
+ if ( locale.QueryHomeHasDaylightSavingOn() )
+ {
+ TTimeIntervalSeconds daylightSaving( 60 * 60 );
+ UtcDate -= daylightSaving.Int();
+ }
+
+ TUint8 len; // number of bytes we will need
+ len = 0;
+ TUint8 array[8];
+
+ TInt64 temp = UtcDate;
+
+ for (i = 7; i >= 0; --i)
+ {
+ array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
+ I64LSR( temp, 8 );
+ }
+
+ len = 8;
+ i = 0;
+ while( ( array[i]== 0 ) && ( i < 8 ) )
+ {
+ i++;
+ len--;
+ }
+
+ // a zero should be coded as short integer.
+ // However, if there is a valid reason to code a zero as a long integer,
+ // we allow it. The caller should know what he is doing.
+ if ( len == 0 )
+ {
+ len = 1;
+ }
+ // write short length
+ iEncodeBuffer->Write( position, &len, 1 );
+ position++;
+ // write as many bytes as were non-zero
+ iEncodeBuffer->Write( position, &(array[8 - len] ), len );
+ position+= len;
+ // status
+ iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
+ position++;
+ // DONE!!!
+ iEncodeBuffer->ResizeL( position );
+ return;
+ }
+
+void MmsTestBed::sendDeliveryReport()
+ {
+ if ( iEncodeBuffer->Size() == 0 )
+ {
+ //No delivery report
+ return;
+ }
+
+
+ TMsvId mmsFolder = findMMSFolder();
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+
+ TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+ TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+
+ // Now we have streamed our data into this entry.
+ // Now we have an entry that says: local service, MMS MTM
+
+ if ( entryId != KMsvNullIndexEntryId )
+ {
+ selection->AppendL( entryId );
+ }
+ else
+ {
+ selection->AppendL( iDefaultServiceId );
+ }
+
+ TWatcherParameters parameters; // initialized to zero
+ parameters.iWatcherId = RThread().Id();
+ parameters.iDataPointer = &ptr;
+ TWatcherParametersBuf paramPack( parameters );
+
+ CMsvOperation * op = NULL;
+
+// iWait->iStatus = KRequestPending;
+ op = iSession->TransferCommandL(
+ *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/src/mmsteststaticutils.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,528 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <f32file.h>
+#include <centralrepository.h>
+#include <apparc.h>
+#include <msvapi.h>
+#include <msvids.h>
+
+#include "mmsteststaticutils.h"
+#include "mmsconst.h"
+#include "MmsEnginePrivateCRKeys.h"
+#include "mmssettings.h"
+#include "mmsheaders.h"
+#include "mmsservercommon.h"
+#include "mmsencode.h"
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
+: iArray1(aArray1), iArray2(aArray2)
+ {
+ }
+
+TInt TMmsJoinedArrays::MdcaCount() const
+ {
+ TInt count=0;
+ if (iArray1)
+ count += iArray1->MdcaCount();
+ if (iArray2)
+ count += iArray2->MdcaCount();
+ return count;
+ }
+
+TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
+ {
+ if (iArray1)
+ {
+ if (aIndex < iArray1->MdcaCount())
+ return iArray1->MdcaPoint(aIndex);
+ else
+ aIndex -= iArray1->MdcaCount();
+ }
+ return iArray2->MdcaPoint(aIndex);
+ }
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsTestUtils::TMmsTestUtils()
+ {
+
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
+ {
+ RFile file;
+ TInt error = KErrNone;
+
+ TInt textBufferSize = 256;
+ HBufC* textBuffer = HBufC::NewL( textBufferSize );
+ TPtr textPtr = textBuffer->Des();
+ TFileText textFile;
+
+ error = file.Open( aFs, aFileName,
+ EFileRead|EFileShareReadersOnly );
+
+ if ( error == KErrNone )
+ {
+ textFile.Set( file );
+ error = textFile.Seek( ESeekStart );
+ }
+
+ if ( error == KErrNone )
+ {
+ error = textFile.Read( textPtr );
+ }
+
+ file.Close();
+
+ if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
+ {
+ textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
+ }
+
+ return textBuffer;
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOnL()
+ {
+ // CenRep for decodelogging
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 1;
+ repository->Set( KMmsEngineDecodeLog, temp );
+ delete repository;
+ }
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOffL()
+ {
+ // CenRep for decodelogging
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 0;
+ repository->Set( KMmsEngineDecodeLog, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOnL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 1;
+ repository->Set( KMmsEngineBinaryDump, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOffL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 0;
+ repository->Set( KMmsEngineBinaryDump, temp );
+ delete repository;
+ }
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
+ {
+ // Delete the files in the directory
+ CFileMan* fileMan = CFileMan::NewL( aFs );
+ CleanupStack::PushL( fileMan );
+ fileMan->RmDir( KMmsDefaultLocalModeDir );
+ fileMan->RmDir( KMmsMMBoxDirectory );
+ fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
+ CleanupStack::PopAndDestroy(); // fileManager
+ // we don't want to throw these away!
+ aFs.MkDirAll( KMmsDefaultLocalModeDir );
+ aFs.MkDirAll( KMmsMMBoxDirectory );
+ aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
+ {
+ TInt error = KErrNone;
+ aFs.MkDirAll( aFilename );
+ TUint att;
+ if ( aFs.Att( aFilename, att ) == KErrNone )
+ {
+ _LIT( KRelated, "dump.mms");
+ aParse.Set( aFilename, &KRelated, NULL );
+ aFilename = aParse.FullName();
+ error = CApaApplication::GenerateFileName( aFs, aFilename );
+ if ( error == KErrNone )
+ {
+ RFile file;
+ error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
+ // for message id generation
+ aParse.Set( aFilename, NULL, NULL );
+ if ( error == KErrNone )
+ {
+ // the data is supposed to be in the encode buffer
+ TPtr8 ptr = aBuffer.Ptr( 0 );
+ file.Write( ptr );
+ file.Flush();
+ }
+
+ // done - close files
+ file.Close();
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
+ {
+ CMsvEntry* cEntry = NULL;
+ // delete all messages from the specified box
+ cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(aBoxId);
+ // show invisible entries
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL(msvEntrySelection);
+
+ CMsvEntrySelection* selection = NULL;
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
+ CleanupStack::PushL( selection );
+ if ( selection->Count() > 0 )
+ {
+ msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
+ }
+ CleanupStack::PopAndDestroy(); // selection
+
+ int i;
+ for (i = 0; i < msvEntrySelection->Count(); ++i)
+ {
+ CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
+ CleanupStack::PushL( entry );
+ TMsvEntry tEntry = entry->Entry();
+ tEntry.SetReadOnly(EFalse);
+ entry->ChangeL(tEntry);
+ cEntry->DeleteL( msvEntrySelection->At(i) );
+ CleanupStack::PopAndDestroy( entry );
+ }
+
+ CleanupStack::PopAndDestroy(msvEntrySelection);
+ CleanupStack::PopAndDestroy(cEntry);
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOnL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+ if( retval == KErrNone )
+ {
+ TInt temp = 1;
+ repository->Set( KMmsEngineLogEmailRecipients, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOffL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+ if( retval == KErrNone )
+ {
+ TInt temp = 0;
+ repository->Set( KMmsEngineLogEmailRecipients, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
+ {
+ CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(aBoxId);
+ if (aMsvEntrySelection != NULL)
+ {
+ delete aMsvEntrySelection;
+ aMsvEntrySelection = NULL;
+ }
+ aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
+ CleanupStack::PopAndDestroy(); // cEntry
+ return aMsvEntrySelection->Count();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CreateFolderEntryL
+//
+// -----------------------------------------------------------------------------
+//
+void TMmsTestUtils::CreateFolderEntryL(
+ CMsvSession& aSession,
+ TMsvId aParentFolder,
+ const TDesC& aFolderName,
+ TMsvId& aFolderId )
+ {
+ aFolderId = KMsvNullIndexEntryId;
+ CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
+ CleanupStack::PushL( cEntry );
+
+ // Create a new folder.
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvFolderEntry;
+ entry.iMtm = KUidMsvLocalServiceMtm;
+ entry.iDetails.Set( aFolderName );
+ entry.SetVisible( EFalse );
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ cEntry->CreateL( entry );
+ aFolderId = entry.Id();
+ CleanupStack::PopAndDestroy( cEntry );
+
+ }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TMsvId TMmsTestUtils::CreateNotificationEntryL(
+ TMsvId aNotificationFolder,
+ TMsvId aServiceId,
+ CBufFlat* aEncodeBuffer,
+ CMsvSession& aSession )
+ {
+ TMsvId entryId = KMsvNullIndexEntryId;
+ if ( aNotificationFolder == KMsvNullIndexEntryId )
+ {
+ // no folder no entry
+ return entryId;
+ }
+
+ CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
+ CleanupStack::PushL(cEntry);
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvMessageEntry;
+ entry.iMtm = KUidMsgTypeMultimedia;
+ entry.SetVisible( ETrue );
+ // If we want to put data here, InPreparation must be set to true first
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ entry.iRelatedId = aServiceId;
+ entry.iMtmData2 = KMmsNotificationBinary;
+ cEntry->CreateL( entry );
+ entryId = entry.Id();
+
+ //
+ // Stream
+ // 1) length of the data as 32 bit integer
+ // 2) pushed message data
+ // into created entry's stream
+ //
+ cEntry->SetEntryL( entryId );
+ CMsvStore* store = cEntry->EditStoreL();
+ CleanupStack::PushL( store ); // ***
+ RMsvWriteStream outs;
+ outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
+ TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
+ outs.WriteUint32L( ptr.Length() );
+ outs.WriteL( ptr );
+ outs.CommitL();
+ outs.Close();
+ store->CommitL();
+
+ CleanupStack::PopAndDestroy( &outs ); // close outs
+ CleanupStack::PopAndDestroy( store );
+ CleanupStack::PopAndDestroy( cEntry );
+
+ return entryId;
+
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::FormNotification(
+ TDesC8& aUrl,
+ TInt aSize,
+ CMmsHeaders& aMmsHeaders,
+ CMmsEncode& aMmsEncoder,
+ CBufFlat* aEncodeBuffer )
+ {
+ // for test purposes aUrl will contain the filename.
+
+ // Reset sets the default encapsulation version
+ // The default version has been set from MmsSettings in NewL
+ aMmsHeaders.Reset();
+
+ // construct the notification into iMmsHeaders, and call encode
+
+ aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
+
+ TTime currentTime;
+ currentTime.UniversalTime();
+ currentTime.Int64();
+
+ TPtrC8 tid;
+ TBufC8<KMMSMAXTIDLENGTH> target;
+ TInt random = 0;
+
+ // we don't generate a true random TID: We generate the
+ // TID from the URL so that if we generate a notification
+ // twice from the same file, we get the same TID and the
+ // same URL. This way we can test the pruning function in
+ // server MTM
+
+ TInt i;
+ for ( i = 0; i < aUrl.Length(); ++i )
+ {
+ random += aUrl[ i ];
+ }
+
+ target.Des().Num( random );
+ tid.Set( target.Des() );
+ aMmsHeaders.SetTidL( tid );
+
+ aMmsHeaders.SetMessageClass( EMmsClassPersonal );
+ aMmsHeaders.SetMessageSize( aSize );
+ const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
+ aMmsHeaders.SetExpiryInterval( KTenHours );
+ aMmsHeaders.SetContentLocationL( aUrl );
+
+ aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
+
+ }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
+ {
+ //Is the name a file?
+ if (IsDrive(aFileName))
+ return EFalse;
+ return !(IsDir(aFileName, aFs));
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
+ {
+ //Is the name a directory?
+ TEntry entry;
+ TInt err = aFs.Entry(aFileName, entry);
+ if (err)
+ return EFalse;
+ else
+ return entry.IsDir();
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
+ {
+ //horrible little function to figure if the path is just a drive
+ TBool retVal = EFalse;
+ if (aFileName.Length()==3) //eg "c:\"
+ {
+ if ((aFileName[1] == ':') && (aFileName[2] == '\\'))
+ retVal=ETrue;
+ }
+ else if (aFileName.Length()==2) //eg "c:"
+ {
+ if (aFileName[1] == ':')
+ retVal=ETrue;
+ }
+ return retVal;
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/src/mmstestuitimer.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include "mmstestuitimer.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::CTestUiTimer(): CTimer( 5 )
+ {
+ period = KPeriod;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer* CTestUiTimer::NewL()
+ {
+ CTestUiTimer* self = new(ELeave) CTestUiTimer();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::~CTestUiTimer()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::IssueRequest()
+ {
+ // No operation to cancel if this function is called
+ iObject = NULL;
+ After(period);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
+ {
+ iObject = aObject;
+ TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
+ After( timeout );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::DoCancel()
+ {
+ CTimer::DoCancel();
+ if ( iObject )
+ {
+ iObject->Cancel();
+ iObject = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::RunL()
+ {
+ if ( iObject )
+ {
+ // If we timeout while holding an active object, we cancel it
+ iObject->Cancel();
+ iObject = NULL;
+ }
+ else
+ {
+ CActiveScheduler::Stop();
+ }
+ }
+
+// ======== GLOBAL FUNCTIONS ========
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsgpluginapp.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,22 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Project file for testmmsgpluginapp
+#
+
+TEMPLATE = subdirs
+
+SUBDIRS += mmstestbed/mmstestbed.pro
+SUBDIRS += testmmsplugin/testmmsplugin.pro
+
+CONFIG += ordered
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/data/TestMMSPluginSample.txt Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,1 @@
+MMSTEST Text
\ No newline at end of file
Binary file messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/data/TestMMSPluginSmileyFace.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/inc/testmmsplugin.h Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Main test class declaration for MMS Plugin
+ */
+
+#ifndef TEST_MMS_PLUGIN_H
+#define TEST_MMS_PLUGIN_H
+
+#ifdef BUILD_TEST_DLL
+#define TEST_EXPORT Q_DECL_EXPORT
+#else
+#define TEST_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <QSignalSpy>
+#include <e32const.h>
+
+//Forward Declarations
+class UniEditorMmsPlugin;
+class ConvergedMessage;
+class MmsTestBed;
+
+//Class Declaration: TestMmsPlugin
+class TEST_EXPORT TestMmsPlugin: public QObject
+ {
+ Q_OBJECT
+
+private slots:
+
+ /**
+ * Initialises the whole Test
+ **/
+ void initTestCase();//called before the first testfunction is executed.
+
+ /**
+ * Initialises each Test Case
+ **/
+ void init();//called before each testfunction is executed.
+
+ /**
+ * Creates a MMS messsage with a text attachment
+ **/
+ void createMMSWithTextAttachment();
+
+ /**
+ * Tests the MMS message with a text attachment
+ **/
+ void testMMSWithTextAttachment();
+
+ /**
+ * Sends the MMS message with a text attachment
+ **/
+ void sendMMSWithTextAttachment();
+
+ /**
+ * Tests that the MMS message is sent successfully
+ **/
+ void testSentMMSWithTextAttachment();
+
+ /**
+ * Creates a MMS messsage with a text and an Image attachments
+ **/
+ void createMMSWithTextAndImageAttachment();
+
+ /**
+ * Tests the MMS message with a text and an Image attachments
+ **/
+ void testMMSWithTextAndImageAttachment();
+
+ /**
+ * Sends the MMS message with a text and an Image attachments
+ **/
+ void sendMMSWithTextAndImageAttachment();
+
+ /**
+ * Tests that the MMS message is sent successfully
+ **/
+ void testSentMMSWithTextAndImageAttachment();
+
+ /**
+ * Cleans up each Test Case
+ **/
+ void cleanup();
+
+ /**
+ * Cleans up the whole Test Case
+ **/
+ void cleanupTestCase();
+
+private: // Data
+
+ /**
+ * msgPlugin - MMS Message Plug-in
+ **/
+ UniEditorMmsPlugin* msgPlugin;
+
+ /**
+ * mmstestbed - MMS Message Simulator
+ **/
+ MmsTestBed* mmstestbed;
+
+ /**
+ * spy_draft - Signal Spy for Draft Folder
+ **/
+ QSignalSpy* spy_draft;
+
+ /**
+ * spy_outbox - Signal Spy for Outbox Folder
+ **/
+ QSignalSpy* spy_outbox;
+
+ /**
+ * spy_sent - Signal Spy for Sent Folder
+ **/
+ QSignalSpy* spy_sent;
+
+ /**
+ * spy_inbox - Signal Spy for Inbox Folder
+ **/
+ QSignalSpy* spy_inbox;
+
+ /**
+ * mmsMsgId - The MMS message Id
+ **/
+ long int mmsMsgId;
+ };
+#endif //TEST_MMS_PLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/inc/testmmsplugin.ini Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,20 @@
+//this file is used to provide predefined set of input data.
+
+//eg.
+const char TEST_MSG_SUBJECT[] = "Message Subject";
+const char TEST_SENDER[] = "DummySender<+919860479112>";
+const char TEST_ATTACHMENT4[] = "c:\\data\\TestMMSPluginSmileyFace.gif";
+const char TEST_ATTACHMENT5[] = "c:\\data\\TestMMSPluginSample.txt";
+const char TEST_CC[] = "DummyCCAddress<+919860479113>";
+const char TEST_BCC[] = "DummyBCCAddress<+919860479114>";
+
+//out put directory for test results.
+QString OUTPUTDIRECTORY = "c:/logs/TestMmsPlugin";
+//o/p directory for data to be written on temp file.
+QString TEMPDIR = "c:/logs/TestMmsPlugin/testdata";
+//test result O/P file name.
+QString RESULTFILE = "c:/logs/TestMmsPlugin/result_%1.txt";
+// folder named UID3 of msgapptestsuite inside private folder.
+const QString PRIVATE_DIR("C:/private/E274bf60");
+//application class name
+const QString appClassName("TestMmsPlugin");
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/src/testmmsplugin.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,479 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: : Main test class definition for MMS Plugin
+ */
+
+#include <QtTest/QtTest>
+#include <QTimer>
+#include <QSignalSpy>
+#include "debugtraces.h"
+#include "testmmsplugin.h"
+#include "convergedmessage.h"
+#include "convergedmessageid.h"
+#include "unieditormmsplugin.h"
+#include "mmstestbed.h"
+#include "testmmsplugin.ini"
+
+//---------------------------------------------------------------
+// TestMmsPlugin::initTestCase
+//---------------------------------------------------------------
+void TestMmsPlugin::initTestCase()
+{
+ //Instantiate UniEditorMmsPlugin and verify if it is correctly Instantited.
+ msgPlugin = new UniEditorMmsPlugin();
+ QVERIFY(msgPlugin != NULL);
+
+ //Verify if MMS service is Validated.
+ QCOMPARE(msgPlugin->validateService(), 1);
+ QCOMPARE(msgPlugin->isServiceValid(), 1);
+ msgPlugin->setEncodingSettings(ETrue, ESmsEncodingNone, -1);
+ QString str("Hello");
+ TInt numOfRemainingChars = 1;
+ TInt numOfPDUs = 1;
+ TBool unicodeMode = ETrue;
+ TSmsEncoding smsEncoding = ESmsEncodingNone;
+ QVERIFY(msgPlugin->getNumPDUs(str, numOfRemainingChars, numOfPDUs, unicodeMode, smsEncoding) == true);
+
+ //Verify MmsTestBed Instance.
+ mmstestbed = new MmsTestBed;
+ QVERIFY(mmstestbed != NULL);
+
+ //register user defined object to meta system.
+ qRegisterMetaType<long int> ("long int");
+
+ //set up signalspy to listen to signals emitted by mmstestbed
+ spy_draft = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInDraft(long int)));
+ spy_outbox = new QSignalSpy(mmstestbed, SIGNAL(entryMovedToOutbox(long int)));
+ spy_sent = new QSignalSpy(mmstestbed, SIGNAL(entryMovedToSent(long int)));
+ spy_inbox = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInInbox(long int)));
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::init
+//---------------------------------------------------------------
+void TestMmsPlugin::init()
+{
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::createMMSWithTextAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::createMMSWithTextAttachment()
+{
+ //Create a Converged Message instance.
+ QString subject = TEST_MSG_SUBJECT;
+ qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
+
+ QString sender(TEST_SENDER);
+ ConvergedMessageAddress address(sender);
+ ConvergedMessageAttachmentList attachmentList;
+
+ //Add a text attachment to attachment list.
+ QString attachmentPath = TEST_ATTACHMENT5;
+ ConvergedMessageAttachment* attachment =
+ new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
+
+ attachmentList.append(attachment);
+
+ //Instantiate a Converged Message object and set service a MMS
+ ConvergedMessage msg;
+ msg.setMessageType(ConvergedMessage::Mms);
+
+ //Set Subject
+ msg.setSubject(subject);
+
+ msg.setTimeStamp(timeStamp);
+
+ //Set recipient.
+ msg.addToRecipient(address);
+
+ //Add attachments' list
+ msg.addAttachments(attachmentList);
+ msg.setPriority(ConvergedMessage::Normal);
+
+ //Adding CC Address
+ QString ccAddress(TEST_CC);
+ ConvergedMessageAddress ccAdd(ccAddress);
+ msg.addCcRecipient(ccAdd);
+
+ //Adding BCC Address
+ QString bccAddress(TEST_BCC);
+ ConvergedMessageAddress bccAdd(bccAddress);
+ msg.addBccRecipient(bccAdd);
+
+ //Adding From Address
+ QString recipientAddress(TEST_SENDER);
+ ConvergedMessageAddress recipientAdd(recipientAddress);
+ msg.addFromRecipient(recipientAdd);
+
+ //start send and prepare to test send-success or fail
+ mmstestbed->cleanAll();
+ mmstestbed->setConnectionLocal(true);
+
+ //Get a valid MMS message ID and verify that it is valid.
+ mmsMsgId = msgPlugin->convertTo(&msg);
+ QVERIFY(mmsMsgId != -1);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testMMSWithTextAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::testMMSWithTextAttachment()
+{
+ long int mmsDraftMsgId;
+
+ //check if draft-folder signal was received...this means message was created in draft
+ if( 1 <= spy_draft->count())
+ {
+ //compare the msgid and verify with the ID given by MMS plugin
+ void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
+ mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
+ QVERIFY(mmsDraftMsgId == mmsMsgId);
+
+ //Validate the MMS message with all the values set before.
+ ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
+ QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
+ QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
+ QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(draftMsg->attachments().count() == 1);
+ QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
+ QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT5).mid(QString(TEST_ATTACHMENT5).indexOf(QString("Sample.txt"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to create message in Draft");
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ }
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::sendMMSWithTextAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::sendMMSWithTextAttachment()
+{
+ //Send the MMS message and verify if it was sent successfully.
+ bool sent = msgPlugin->send(mmsMsgId);
+ QVERIFY(sent == true);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testSentMMSWithTextAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::testSentMMSWithTextAttachment()
+{
+ QTest::qWait(10000); //to ensure path completion
+
+ //check if outbox-folder signal was received...this means message was moved to outbox for send
+ if( 1 <= spy_outbox->count())
+ {
+ //compare the msgid
+ void * temp = const_cast<void*>(spy_outbox->at(0).at(0).data());
+ long int outboxId = *reinterpret_cast< long int(*)>(temp);
+ QCOMPARE(outboxId, mmsMsgId);
+
+ //push the message from outbox to mmsc(sent folder)
+ mmstestbed->fromOutboxToMmsc();
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
+
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+
+ //check if sent-folder signal was received....this means message was successfully sent scheduled.
+ if( 1 <= spy_sent->count())
+ {
+ //check for send-path
+ void * temp = const_cast<void*>(spy_sent->at(0).at(0).data());
+ long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
+ QCOMPARE(sentmsgid, mmsMsgId);
+
+ //issue a fetch request on the sent message, to test the receive path
+ mmstestbed->fromMmscToInbox();
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
+
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+
+ //check if inbox-folder signal was received....this means message was successfully received at the inbox folder.
+ if( spy_inbox->count() <= 0)
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Inbox folder");
+
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ }
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::createMMSWithTextAndImageAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::createMMSWithTextAndImageAttachment()
+{
+ //Create a Converged Message instance.
+ QString subject = TEST_MSG_SUBJECT;
+ qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
+
+ QString sender(TEST_SENDER);
+ ConvergedMessageAddress address(sender);
+ ConvergedMessageAttachmentList attachmentList;
+
+ //Add a text attachment to attachment list.
+ QString attachmentPath1 = TEST_ATTACHMENT5;
+ ConvergedMessageAttachment* attachment =
+ new ConvergedMessageAttachment(attachmentPath1, ConvergedMessageAttachment::EInline);
+
+ //Add an image attachment to attachment list.
+ QString attachmentPath2 = TEST_ATTACHMENT4;
+ ConvergedMessageAttachment* attachmentImage =
+ new ConvergedMessageAttachment(attachmentPath2, ConvergedMessageAttachment::EAttachment);
+
+ attachmentList.append(attachment);
+ attachmentList.append(attachmentImage);
+
+ //Instantiate a Converged Message object and set service a MMS
+ ConvergedMessage msg;
+ msg.setMessageType(ConvergedMessage::Mms);
+ msg.setSubject(subject);
+ msg.setTimeStamp(timeStamp);
+ msg.addToRecipient(address);
+
+ //Add attachments' list
+ msg.addAttachments(attachmentList);
+ msg.setPriority(ConvergedMessage::Normal);
+
+ //Adding CC Address
+ QString ccAddress(TEST_CC);
+ ConvergedMessageAddress ccAdd(ccAddress);
+ msg.addCcRecipient(ccAdd);
+
+ //Adding BCC Address
+ QString bccAddress(TEST_BCC);
+ ConvergedMessageAddress bccAdd(bccAddress);
+ msg.addBccRecipient(bccAdd);
+
+ //Adding From Address
+ QString recipientAddress(TEST_SENDER);
+ ConvergedMessageAddress recipientAdd(recipientAddress);
+ msg.addFromRecipient(recipientAdd);
+
+ //start send and prepare to test send-success or fail
+ mmstestbed->cleanAll();
+ mmstestbed->setConnectionLocal(true);
+
+ //Get a valid MMS message ID and verify that it is valid.
+ mmsMsgId = msgPlugin->convertTo(&msg);
+ QVERIFY(mmsMsgId != -1);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testMMSWithTextAndImageAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::testMMSWithTextAndImageAttachment()
+{
+ long int mmsDraftMsgId;
+
+ //check if draft-folder signal was received...this means message was created in draft
+ if( 1 <= spy_draft->count())
+ {
+ //compare the msgid and verify with the ID given by MMS plugin
+ void * temp = const_cast<void*>(spy_draft->at(1).at(0).data());
+ mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
+ QVERIFY(mmsDraftMsgId == mmsMsgId);
+
+ //Validate the MMS message with all the values set before.
+ ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
+ QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
+ QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
+ QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(draftMsg->attachments().count() == 1);
+ QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
+ QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT4).mid(QString(TEST_ATTACHMENT4).indexOf(QString("SmileyFace.gif"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to create message in Draft");
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ }
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::sendMMSWithTextAndImageAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::sendMMSWithTextAndImageAttachment()
+{
+ //Send the MMS message and verify if it was sent successfully.
+ bool sent = msgPlugin->send(mmsMsgId);
+ QVERIFY(sent == true);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testSentMMSWithTextAndImageAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::testSentMMSWithTextAndImageAttachment()
+{
+ QTest::qWait(10000); //to ensure path completion
+
+ //check if outbox-folder signal was received...this means message was moved to outbox for send
+ if( 1 <= spy_outbox->count())
+ {
+ //compare the msgid
+ void * temp = const_cast<void*>(spy_outbox->at(1).at(0).data());
+ long int outboxId = *reinterpret_cast< long int(*)>(temp);
+ QCOMPARE(outboxId, mmsMsgId);
+
+ //push the message from outbox to mmsc(sent folder)
+ mmstestbed->fromOutboxToMmsc();
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
+
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+
+ //check if sent-folder signal was received....this means message was successfully sent scheduled.
+ if( 1 <= spy_sent->count())
+ {
+ //check for send-path
+ void * temp = const_cast<void*>(spy_sent->at(1).at(0).data());
+ long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
+ QCOMPARE(sentmsgid, mmsMsgId);
+
+ //issue a fetch request on the sent message, to test the receive path
+ mmstestbed->fromMmscToInbox();
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
+
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+
+ //check if inbox-folder signal was received....this means message was successfully received at the inbox folder.
+ if( spy_inbox->count() <= 0)
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Inbox folder");
+
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ }
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::cleanup
+//---------------------------------------------------------------
+void TestMmsPlugin::cleanup()
+{
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::cleanupTestCase
+//---------------------------------------------------------------
+void TestMmsPlugin::cleanupTestCase()
+{
+ //Cleanup
+ delete spy_draft;//Signal for Draft Folder
+ delete spy_outbox;//Signal for Outbox Folder
+ delete spy_sent;//Signal for Sent Folder
+ delete spy_inbox;//Signal for inbox Folder
+ delete msgPlugin;//MMS Plugin
+ delete mmstestbed;//MMS Testbed
+}
+
+//---------------------------------------------------------------
+// getObject
+// factory method to create objects.
+//---------------------------------------------------------------
+QObject* getObject(QString className)
+{
+ if(className == "TestMmsPlugin" )
+ {
+ return new TestMmsPlugin;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+//---------------------------------------------------------------
+// createOutPutDirectory
+// creating o/p directory.
+//---------------------------------------------------------------
+void createOutPutDirectory()
+ {
+ QDir dir;
+ //o/p dir
+ dir.mkdir(OUTPUTDIRECTORY);
+ //tmp dir
+ dir.mkdir(TEMPDIR);
+ // dir inside private folder.
+ dir.mkdir(PRIVATE_DIR);
+ }
+
+//---------------------------------------------------------------
+// main
+// main entry point
+//---------------------------------------------------------------
+int main(int argc, char *argv[])
+ {
+ int ret = -1;
+ QCoreApplication app(argc, argv);
+
+ //creating output directory.
+ createOutPutDirectory();
+
+ QStringList args;
+ QString appName = argv[0];
+ args << appName;
+
+ QString option = "-o";
+ args << option;
+
+ QString outFile = RESULTFILE;
+ outFile = outFile.arg(appClassName);
+ args << outFile;
+
+ QObject* tc = getObject(appClassName);
+
+ if(tc)
+ {
+ ret = QTest::qExec(tc, args);
+ delete tc;
+ }
+ return ret;
+ }
+
+//End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/testmmsplugin.pro Wed Aug 18 09:45:25 2010 +0300
@@ -0,0 +1,138 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Project file for test_mms_plugin
+#
+
+QT += testlib
+QT -= gui
+
+TEMPLATE = app
+TARGET = testmmsplugin
+
+INCLUDEPATH += ./inc
+INCLUDEPATH += ../../../../../../../../inc
+INCLUDEPATH += ../../../../../../unidatautils/unidatamodels/inc
+INCLUDEPATH += ../../../../../editorgenutils/inc
+INCLUDEPATH += ../../../../../../../../inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../../unidatautils/unidatamodel/inc
+INCLUDEPATH += ../mmstestbed/inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_TEST_DLL
+
+CONFIG += hb
+CONFIG += symbian_test
+CONFIG += qtestlib
+
+SOURCES += \
+ ./src/testmmsplugin.cpp \
+ ../../../src/unieditormmsplugin.cpp \
+ ../../../src/unieditormmsplugin_p.cpp
+
+# Input
+HEADERS += \
+ ./inc/testmmsplugin.h \
+ ../../../inc/unieditormmsplugin.h \
+ ../../../inc/unieditormmsplugin_p.h
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+ symbian {
+ TARGET.UID3 = 0xE274bf60
+ TARGET.CAPABILITY = All -TCB -DRM
+ TARGET.EPOCSTACKSIZE = 0x8000
+ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+ VENDORID = VID_DEFAULT
+ BLD_INF_RULES.prj_exports += "data/TestMMSPluginSample.txt c:/data/TestMMSPluginSample.txt"
+ BLD_INF_RULES.prj_exports += "data/TestMMSPluginSmileyFace.gif c:/data/TestMMSPluginSmileyFace.gif"
+ }
+
+LIBS += -leuser \
+ -lconvergedmessageutils \
+ -lMsgMedia \
+ -leditorgenutils \
+ -lcone \
+ -leikcoctl \
+ -leikcore \
+ -leikdlg \
+ -lmsgs \
+ -letext \
+ -lgsmu \
+ -lmmsgenutils \
+ -lefsrv \
+ -lestor \
+ -lsmcm \
+ -lCommonEngine \
+ -lbafl \
+ -lCdlEngine \
+ -lFeatMgr \
+ -lapmime \
+ -lapgrfx \
+ -lcharconv \
+ -lInetProtUtil \
+ -lsmildtd \
+ -lxmldom \
+ -lxmlparser \
+ -lcone \
+ -lQtCore \
+ -letel \
+ -lcommdb \
+ -lcommsdat \
+ -letelmm \
+ -lunidatamodelloader \
+ -lunidatamodel \
+ -lavkon \
+ -leikcoctl \
+ -leikctl \
+ -lform \
+ -luiklaf\
+ -lmmstestbed \
+ -lmmsmessage \
+ -lmmsserversettings \
+ -lxqutils \
+ -lQtContacts
+
+packageheader = "$${LITERAL_HASH}{\"TestMMSPlugin\"},(0xE274bf60),1,0,0,TYPE=SA"
+
+vendorinfo = \
+ "; Localised Vendor name" \
+ "%{\"Nokia\"}" \
+ "; Unique Vendor name" \
+ ":\"Nokia\""
+
+dependencyinfo = \
+ "; Default HW/platform dependencies" \
+ "[0x101F7961],0,0,0,{\"S60ProductID\"}" \
+ "[0x2001E61C],4,6,3,{"Qt"}
+
+default_deployment.pkg_prerules = packageheader \
+ vendorinfo \
+ dependencyinfo
+
+#Copy the dependent DLL
+symbian: {
+ addDll.sources = mmstestbed.dll
+ addDll.path = /sys/bin
+ DEPLOYMENT += addDll
+
+ addFile1.sources = ./data/TestMMSPluginSample.txt
+ addFile1.path = C:/data/
+ DEPLOYMENT += addFile1
+
+ addFile2.sources = ./data/TestMMSPluginSmileyFace.gif
+ addFile2.path = C:/data/
+ DEPLOYMENT += addFile2
+ }
+
\ No newline at end of file
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/tsrc.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/tsrc.pro Wed Aug 18 09:45:25 2010 +0300
@@ -11,12 +11,11 @@
#
# Contributors:
#
-# Description:
+# Description: Project file for testmmsgplugin
#
TEMPLATE = subdirs
-SUBDIRS += mmstestbed/mmstestbed.pro
-SUBDIRS += testmmsgplugin/testmmsplugin.pro
+SUBDIRS += testmmsgpluginapp/testmmsgpluginapp.pro
CONFIG += ordered
\ No newline at end of file
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/unieditormmsplugin.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/unieditormmsplugin.pro Wed Aug 18 09:45:25 2010 +0300
@@ -44,21 +44,22 @@
src/unieditormmsplugin_p.cpp
LIBS += -leuser \
- -lcone \
- -lmsgs \
- -lmmsmessage \
- -lmmsserversettings \
- -lmmsgenutils \
- -lcommdb \
- -lefsrv \
- -lbafl \
- -leditorgenutils \
- -lunidatamodelloader \
- -lconvergedmessageutils \
- -lunidatamodel \
- -lmsgmedia \
- -leikctl \
- -lxqutils
+ -lcone \
+ -lmsgs \
+ -lmmsmessage \
+ -lmmsserversettings \
+ -lmmsgenutils \
+ -lcommdb \
+ -lefsrv \
+ -lbafl \
+ -leditorgenutils \
+ -lunidatamodelloader \
+ -lconvergedmessageutils \
+ -lunidatamodel \
+ -lmsgmedia \
+ -leikctl \
+ -lxqutils \
+ -lQtContacts
# Build.inf rules
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/inc/unieditorsmsplugin_p.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/inc/unieditorsmsplugin_p.h Wed Aug 18 09:45:25 2010 +0300
@@ -45,7 +45,7 @@
/**
* UniEditorSmsPluginPrivate
*/
-class UniEditorSmsPluginPrivate :public MMsvSessionObserver
+class UniEditorSmsPluginPrivate :public CBase, public MMsvSessionObserver
{
public: // Constructors and destructor
@@ -306,7 +306,17 @@
* @see MMsvSessionObserver
*/
void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2,
- TAny* aArg3);
+ TAny* aArg3);
+
+ /**
+ * Populate recipients for reply case
+ */
+ void populateMessageForReplyL(ConvergedMessage* aMessage);
+
+ /**
+ * Extract from address from Deliver PDU
+ */
+ void fromAddress(QString& messageAddress);
private: // Data
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -35,8 +35,7 @@
QObject(parent),
d_ptr(NULL)
{
- TRAPD(error, d_ptr = UniEditorSmsPluginPrivate::NewL());
- QDEBUG_WRITE_FORMAT("UniEditorSmsPlugin::UniEditorSmsPlugin error = ",error);
+ QT_TRAP_THROWING(d_ptr = UniEditorSmsPluginPrivate::NewL());
}
//---------------------------------------------------------------
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -62,6 +62,7 @@
#include "UniEditorGenUtils.h"
#include "unidatamodelloader.h"
#include "unidatamodelplugininterface.h"
+#include "msgcontacthandler.h"
#include <hbglobal.h> // for translation support
#include <xqconversions.h>
// resources
@@ -334,6 +335,15 @@
//Populate message body
populateMessageBodyL(aMessage,msvEntry);
}
+ else if(aOperation == UniEditorPluginInterface::Reply)
+ {
+ populateMessageForReplyL(aMessage);
+ }
+ else if(aOperation == UniEditorPluginInterface::ReplyAll)
+ {
+ // control should never reach here for sms
+ User::Leave(KErrArgument);
+ }
//This is required as the switch entry doesnot reset sms headers
//so if we fwd an inbox msg and then try to save that content to drafts
@@ -451,6 +461,7 @@
{
emailFields->AddAddressL( *pureAddr );
appendbuf.Set(pureAddr->Des().Left(appendLen));
+ iRecipients->AppendL( *addr );
}
else
{
@@ -458,6 +469,8 @@
{
SmsMtmL()->AddAddresseeL( *pureAddr, *aliasAddr );
appendbuf.Set(aliasAddr->Des().Left(appendLen));
+ iRecipients->AppendL(
+ *TMmsGenUtils::GenerateAddressL(*pureAddr, *aliasAddr));
}
else
{
@@ -465,11 +478,14 @@
{
SmsMtmL()->AddAddresseeL( *pureAddr, *alt_alias );
appendbuf.Set(alt_alias->Des().Left(appendLen));
+ iRecipients->AppendL(
+ *TMmsGenUtils::GenerateAddressL(*pureAddr, *alt_alias));
}
else
{
SmsMtmL()->AddAddresseeL( *pureAddr );
appendbuf.Set(pureAddr->Des().Left(appendLen));
+ iRecipients->AppendL( *addr );
}
}
}
@@ -478,7 +494,6 @@
{
idetailsBuf.Append( appendbuf );
}
- iRecipients->AppendL( *addr );
// cleanup
CleanupStack::PopAndDestroy(2, pureAddr );
@@ -1420,6 +1435,9 @@
aText.InsertL( 1, *subject );
aText.InsertL( writePosition-1, KUniSmsEndParenthesis );
}
+
+ CleanupStack::PopAndDestroy( subject );
+
}
// Clears the CSmsHeaders EmailFields for non Email addresses
@@ -1796,7 +1814,6 @@
aMessage->setSubject(XQConversions::s60DescToQString(
emailFields.Subject()));
}
-
}
// ----------------------------------------------------
@@ -1879,4 +1896,76 @@
// do nothing
}
+// -----------------------------------------------------------------------------
+// UniEditorSmsPluginPrivate::populateMessageForReplyL
+// @see Header
+// -----------------------------------------------------------------------------
+//
+void UniEditorSmsPluginPrivate::populateMessageForReplyL(
+ ConvergedMessage* aMessage)
+ {
+ // find out if the message is incoming or outgoing
+ CSmsPDU::TSmsPDUType smsPduType = SmsMtmL()->SmsHeader().Type();
+
+ // for incoming message, populate sender address in To-field
+ if(smsPduType == CSmsPDU::ESmsDeliver)
+ {
+ QString addr;
+ fromAddress(addr);
+ if(!addr.isEmpty())
+ {
+ ConvergedMessageAddress messageAddress(addr);
+ aMessage->addToRecipient(messageAddress);
+ }
+ }
+ // else, for outgoing message, populate receiver address in To-field
+ else if(smsPduType == CSmsPDU::ESmsSubmit)
+ {
+ populateRecipientsL(aMessage);
+ }
+
+ // resolve to-field contacts
+ ConvergedMessageAddressList addrList = aMessage->toAddressList();
+ int addrCount = addrList.count();
+ for(int i=0; i<addrCount; i++)
+ {
+ ConvergedMessageAddress* addr = addrList.at(i);
+ // resolve contact if alias is empty
+ if(addr->alias().isEmpty())
+ {
+ QString alias;
+ int count;
+ int localId =
+ MsgContactHandler::resolveContactDisplayName(
+ addr->address(), alias, count);
+ addr->setAlias(alias);
+ }
+ }
+ }
+
+//---------------------------------------------------------------
+// UniEditorSmsPluginPrivate::fromAddress
+// @see header
+//---------------------------------------------------------------
+void UniEditorSmsPluginPrivate::fromAddress(
+ QString& messageAddress)
+{
+ CPlainText* pText = CPlainText::NewL();
+ CleanupStack::PushL(pText);
+
+ CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *pText);
+ CleanupStack::PushL(smsHeader);
+
+ CMsvEntry &cEntry = SmsMtmL()->Entry();
+
+ CMsvStore* store = cEntry.ReadStoreL();
+ CleanupStack::PushL(store);
+
+ smsHeader->RestoreL(*store);
+
+ messageAddress
+ = XQConversions::s60DescToQString(smsHeader->FromAddress());
+ CleanupStack::PopAndDestroy(3, pText);
+}
+
// End of File
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/unieditorsmsplugin.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/unieditorsmsplugin.pro Wed Aug 18 09:45:25 2010 +0300
@@ -66,7 +66,8 @@
-lFeatMgr \
-lapmime \
-lunidatamodelloader \
- -lxqutils
+ -lxqutils \
+ -lQtContacts
# plugin stub deployment
plugin.sources = unieditorsmsplugin.dll
--- a/messagingapp/shareui/inc/shareuiprivate.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/shareui/inc/shareuiprivate.h Wed Aug 18 09:45:25 2010 +0300
@@ -231,6 +231,7 @@
* Whether to launch the sending application as embedded or not.
*/
bool mIsEmbedded;
+
};
#endif /* __SHARE_UI_PRIVATE_H__ */
--- a/messagingapp/shareui/src/shareuiprivate.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/shareui/src/shareuiprivate.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -31,7 +31,7 @@
#include <HbNotificationDialog>
#include <HbIconItem>
#include <HbTextItem>
-
+#include <HbColorScheme>
#include <xqserviceglobal.h>
#include <xqaiwrequest.h>
#include <xqaiwinterfacedescriptor.h>
@@ -54,6 +54,8 @@
#define LOC_SERVICE_ERROR hbTrId("Service error.")
#define LOC_PROTECTED_CONTENT hbTrId("Protected content.")
+const QString LIST_ITEM_TITLE("qtc_list_item_title_normal");
+
/**
* Constructor.
*/
@@ -84,7 +86,6 @@
delete request;
}
mAiwRequestList.clear();
-
}
/**
@@ -95,106 +96,103 @@
*
*/
bool ShareUiPrivate::init(QStringList& fileList, bool embedded)
- {
+ {
reset();
mIsEmbedded = embedded;
// No input files
- if ( fileList.count() == 0 )
- {
+ if (fileList.count() == 0) {
showNote(LOC_NO_FILES);
- return true;
- }
+ return true;
+ }
#ifdef __SHAREUI_MIME_HANDLING__
// Get the file attributes (MIME and forward lock)
QStringList mimeTypeList;
QStringList forwardStatusList;
getFileAttributes(fileList, mimeTypeList, forwardStatusList);
-
+
// Ignore protected files
QStringList filteredFileList;
QStringList filteredMimeList;
- for ( int i = 0; i < forwardStatusList.count(); i++ )
- {
- if ( forwardStatusList[i].toInt() )
- {
+ for (int i = 0; i < forwardStatusList.count(); i++) {
+ if (forwardStatusList[i].toInt()) {
filteredFileList << fileList[i];
filteredMimeList << mimeTypeList[i];
- }
}
- filteredMimeList.removeDuplicates();
-
+ }
+ filteredMimeList.removeDuplicates();
+
// Some protected content
- if ( fileList.count() != filteredFileList.count() )
- {
- showNote(LOC_PROTECTED_CONTENT);
+ if (fileList.count() != filteredFileList.count()) {
+ showNote(LOC_PROTECTED_CONTENT);
return true;
- }
-
+ }
+
// Only protected content
- if ( filteredFileList.count() == 0 )
- {
+ if (filteredFileList.count() == 0) {
showNote(LOC_NO_FILES);
- return true;
- }
+ return true;
+ }
#endif
#ifdef __SHAREUI_MIME_HANDLING__
- for ( int i = 0; i < filteredFileList.count(); i++ )
- {
+ for (int i = 0; i < filteredFileList.count(); i++) {
mFileList.append(QDir::toNativeSeparators(filteredFileList[i]));
- }
+ }
#else
for ( int i = 0; i < fileList.count(); i++ )
- {
+ {
mFileList.append(QDir::toNativeSeparators(fileList[i]));
- }
+ }
#endif
-
- QList<XQAiwInterfaceDescriptor> serviceDescriptorList =
- mAppManager.list(SERVICE_INTERFACE, SHARE_OP);
- if ( serviceDescriptorList.size() > 0 )
- {
+
+ QList<XQAiwInterfaceDescriptor> serviceDescriptorList = mAppManager.list(SERVICE_INTERFACE,
+ SHARE_OP);
+
+ if (serviceDescriptorList.size() > 0) {
initializeUi();
-
- for ( int i = 0; i < serviceDescriptorList.count() ; i++ )
- {
+ //sorting the services based on service names,
+ QMap<QString,XQAiwInterfaceDescriptor > serviceInterfaceMap;
+ for (int i = 0; i < serviceDescriptorList.count(); i++) {
+ serviceInterfaceMap.insert(serviceDescriptorList[i].serviceName(),
+ serviceDescriptorList[i]);
+ }
+ QStringList serviceNames = serviceInterfaceMap.keys();
+ serviceDescriptorList.clear();
+
+ for (int i = 0; i < serviceNames.count(); i++) {
#ifdef __SHAREUI_MIME_HANDLING__
// Filter services based on content type
- QString allowedTypes = serviceDescriptorList[i].customProperty
- (QString("allowed_mime_types"));
- QString blockedTypes = serviceDescriptorList[i].customProperty
- (QString("blocked_mime_types"));
-
+ QString allowedTypes = serviceInterfaceMap[serviceNames.at(i)].customProperty(QString(
+ "allowed_mime_types"));
+ QString blockedTypes = serviceInterfaceMap[serviceNames.at(i)].customProperty(QString(
+ "blocked_mime_types"));
+
// Check against MIME filters
- if ( ! isContentAllowed( filteredMimeList, allowedTypes ) )
+ if (!isContentAllowed(filteredMimeList, allowedTypes))
continue;
-
- if ( isContentBlocked( filteredMimeList, blockedTypes ) )
- continue;
+
+ if (isContentBlocked(filteredMimeList, blockedTypes))
+ continue;
#endif
- HbAction* action = fetchServiceAction(serviceDescriptorList[i]);
- QString iconName = serviceDescriptorList[i].customProperty
- (QString("aiw_action_icon"));
- if ( action )
- {
+ HbAction* action = fetchServiceAction(serviceInterfaceMap[serviceNames.at(i)]);
+ QString iconName = serviceInterfaceMap[serviceNames.at(i)].customProperty(QString("aiw_action_icon"));
+ if (action) {
updateShareUiDialogList(action, iconName);
- }
}
-
- if ( mContentItemModel->rowCount() == 0 )
- {
+ }
+ serviceInterfaceMap.clear();
+ if (mContentItemModel->rowCount() == 0) {
showNote(LOC_NO_SERVICES);
return true;
- }
+ }
mSharePopup->show();
- }
- else
- {
+ }
+ else {
showNote(LOC_NO_SERVICES);
- }
-
+ }
+
return true;
}
@@ -208,6 +206,8 @@
// make it delete itself on close
mSharePopup->setAttribute( Qt::WA_DeleteOnClose, true );
HbTextItem* heading = new HbTextItem(LOC_SEND_SELECTED_ITEM, mSharePopup);
+ QColor color = HbColorScheme::color( LIST_ITEM_TITLE );
+ heading->setTextColor( color );
heading->setAlignment(Qt::AlignCenter);
mSharePopup->setDismissPolicy(HbDialog::TapAnywhere);
mSharePopup->setHeadingWidget(heading);
@@ -486,7 +486,7 @@
HbNotificationDialog* dlg = new HbNotificationDialog();
dlg->setFocusPolicy(Qt::NoFocus);
dlg->setAttribute(Qt::WA_DeleteOnClose, true);
- dlg->setText(text);
+ dlg->setTitle(text);
dlg->show();
}
--- a/messagingapp/smartmessaging/ringbc/inc/ringbc_p.h Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/smartmessaging/ringbc/inc/ringbc_p.h Wed Aug 18 09:45:25 2010 +0300
@@ -21,10 +21,11 @@
#define RINGBC_PRIVATE_H
#include <QString>
+#include <e32base.h>
class RingBCNSMConverter;
-class RingBcPrivate
+class RingBcPrivate :public CBase
{
public:
/**
--- a/messagingapp/smartmessaging/ringbc/src/ringbc.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/smartmessaging/ringbc/src/ringbc.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -35,7 +35,7 @@
RingBc::RingBc()
{
QDEBUG_WRITE("RingBc::RingBc : Enter")
- d_ptr = new RingBcPrivate();
+ d_ptr = q_check_ptr(new RingBcPrivate());
QDEBUG_WRITE("RingBc::RingBc : Exit")
}
--- a/messagingapp/smartmessaging/ringbc/src/ringbc_p.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/smartmessaging/ringbc/src/ringbc_p.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -12,8 +12,7 @@
* Contributors:
*
* Description:
- * A class which takes care of reading the possible new
- * service centres from SIM and adds them to pda-side Sms Settings.
+ *
*
*/
@@ -40,9 +39,7 @@
{
QDEBUG_WRITE("RingBcPrivate::RingBcPrivate : Enter")
-
- TRAP_IGNORE(initL());
-
+ initL();
QDEBUG_WRITE("RingBcPrivate::RingBcPrivate : Exit")
}
@@ -90,23 +87,23 @@
if(error == KErrCorrupt)
{
- HbMessageBox::information("Ringing Tone Corrupted");
+ HbMessageBox::information("Ringing Tone Corrupted", 0, 0, HbMessageBox::Ok);
QDEBUG_WRITE("RingBcPrivate::saveTone : Ringing tone corrupted")
}
else if(error == KErrNoMemory || error == KErrDiskFull)
{
- HbMessageBox::information("No memory to save");
+ HbMessageBox::information("No memory to save", 0, 0, HbMessageBox::Ok);
QDEBUG_WRITE("RingBcPrivate::saveTone : Low memory")
}
else
{
- HbMessageBox::information("Error in Saving");
+ HbMessageBox::information("Error in Saving", 0, 0, HbMessageBox::Ok);
QDEBUG_WRITE("RingBcPrivate::saveTone : Error in Saving")
}
}
else
{
- HbMessageBox::information("Saved succesfully");
+ HbMessageBox::information("Saved succesfully", 0, 0, HbMessageBox::Ok);
QDEBUG_WRITE("RingBcPrivate::saveTone : Ringing tone saved successfully")
}
@@ -163,6 +160,10 @@
}
CleanupStack::PopAndDestroy(2); // title,fileMan
}
+ else
+ {
+ User::Leave(KErrCorrupt);
+ }
CleanupStack::PopAndDestroy(); // dataBuf
CleanupStack::PopAndDestroy(); //file
@@ -184,11 +185,13 @@
QString extension = pathList.at(pathList.count() - 1);
HBufC* fileName = XQConversions::qStringToS60Desc(path);
- TRAP_IGNORE( title = titleL(*fileName));
-
- title.append(QChar('.'));
- title.append(extension);
-
+ TRAPD(err, title = titleL(*fileName));
+ if(err == KErrNone)
+ {
+ title.append(QChar('.'));
+ title.append(extension);
+ }
+
QDEBUG_WRITE("RingBcPrivate::toneTitle : Exit")
return title;
}
@@ -227,7 +230,11 @@
{
HBufC* toneTitle = mConverter->TitleLC(data);
title = XQConversions::s60DescToQString(*toneTitle);
- CleanupStack::PopAndDestroy(); //title
+ CleanupStack::PopAndDestroy(); //tonetitle
+ }
+ else
+ {
+ User::Leave(KErrCorrupt);
}
CleanupStack::PopAndDestroy(); //dataBuf
}
Binary file mmsengine/conf/CI_mmsengine.confml has changed
Binary file mmsengine/conf/mmsengine.confml has changed
--- a/mmsengine/mmsengine.pro Tue Jul 06 14:12:40 2010 +0300
+++ b/mmsengine/mmsengine.pro Wed Aug 18 09:45:25 2010 +0300
@@ -47,6 +47,7 @@
"./loc/MmsUi.loc APP_LAYER_LOC_EXPORT_PATH(mmsui.loc)" \
#### Export confml and crml files ####
"./conf/mmsengine.confml APP_LAYER_CONFML(mmsengine.confml)" \
+ "./conf/CI_mmsengine.confml APP_LAYER_CONFML(CI_mmsengine.confml)" \
"./conf/mmsengine_100058DB.crml APP_LAYER_CRML(mmsengine_100058db.crml)" \
"./conf/mmsengine_101FB0D5.crml APP_LAYER_CRML(mmsengine_101fb0d5.crml)" \
"./conf/mmsengine_101FB0D5.crml APP_LAYER_CRML(mmsengine_101fb0d9.crml)"
--- a/mmsengine/mmsserver/src/mmsdeleteoperation.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/mmsengine/mmsserver/src/mmsdeleteoperation.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -26,7 +26,6 @@
#include <commdb.h>
#include <in_sock.h>
#include <commdbconnpref.h>
-#include <AknGlobalNote.h>
// the rest are local includes, needed always
#include "mmsconst.h"
--- a/mmsengine/mmsserver/src/mmsforwardoperation.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/mmsengine/mmsserver/src/mmsforwardoperation.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -27,7 +27,6 @@
#include <in_sock.h>
#include <commdbconnpref.h>
#include <featmgr.h>
-#include <AknGlobalNote.h>
// the rest are local includes, needed always
#include "mmsconst.h"
--- a/mmsengine/mmsserver/src/mmssendoperation.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/mmsengine/mmsserver/src/mmssendoperation.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -26,7 +26,6 @@
#include <commdb.h>
#include <in_sock.h>
#include <commdbconnpref.h>
-#include <AknGlobalNote.h>
// LOCAL INCLUDE FILES
#include "mmsconst.h"
--- a/mmsengine/mmssettings/src/cmmsaccounts.cpp Tue Jul 06 14:12:40 2010 +0300
+++ b/mmsengine/mmssettings/src/cmmsaccounts.cpp Wed Aug 18 09:45:25 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-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"
@@ -249,6 +249,7 @@
*/
EXPORT_C void CMmsAccounts::GetMMSAccountsL(RArray<TMmsAccountId>& aAccountIds) const
{
+ CleanupClosePushL( aAccountIds );
aAccountIds.Reset();
RArray<TUint32> accountIds;
CleanupClosePushL(accountIds);
@@ -268,7 +269,8 @@
aAccountIds.AppendL(accountId);
}
- CleanupStack::PopAndDestroy(&accountIds);
+ CleanupStack::PopAndDestroy(&accountIds);
+ CleanupStack::Pop(&aAccountIds); // aAccountIds
}
/**
--- a/mobilemessaging/smsmtm/servermtm/src/SMSSOUTB.CPP Tue Jul 06 14:12:40 2010 +0300
+++ b/mobilemessaging/smsmtm/servermtm/src/SMSSOUTB.CPP Wed Aug 18 09:45:25 2010 +0300
@@ -23,7 +23,6 @@
#include <logsmspdudata.h>
#include <smsulog.h>
#include <logwraplimits.h>
-#include <exterror.h>
#include "SMSSendSession.h"
#include "SMSSPAN.H"
@@ -211,15 +210,8 @@
{
if (iCurrentMessage)
{
- if( (iProgress.iError == KErrGsmSMSShortMessageTransferRejected) || (iProgress.iError == KErrGsmSMSInvalidMandatoryInformation) || (iProgress.iError == KErrGsmSMSUnidentifiedSubscriber) ||
- (iProgress.iError == KErrGsmSMSUnknownSubscriber) || (iProgress.iError == KErrGsmSMSNetworkOutOfOrder) )
- {
- DoComplete(iProgress.iError);
- }
- else
- {
- ReScheduleFailedMessageL();
- }
+ SMSSLOG(FLogFormat(_L8("CSmsOutboxSend::DoRunL(), error for ReSchedule %d"), iProgress.iError));
+ ReScheduleFailedMessageL();
}
else
{
@@ -523,7 +515,7 @@
_LIT16(KComma, ",");
RBuf16 buffer;
- buffer.Create(size+num);
+ buffer.CreateL(size+num);
if(num > 0)
{
rcpt = numbers[0];
--- a/msg_plat/conversation_services_client_api/inc/ccsrequesthandler.h Tue Jul 06 14:12:40 2010 +0300
+++ b/msg_plat/conversation_services_client_api/inc/ccsrequesthandler.h Wed Aug 18 09:45:25 2010 +0300
@@ -216,9 +216,13 @@
* This is a Async API.
*
* @param aClientConversation - class encapsulating Conversation Entry ID
+ * @param aKnownIndex - known index that is fetched
+ * @aPageSize - page size that has to be fetched.
*/
- IMPORT_C void GetConversationsL(
- CCsClientConversation* aClientConversation );
+ IMPORT_C void GetConversationsL(
+ CCsClientConversation* aClientConversation,
+ TInt aKnownIndex,
+ TInt aPageSize);
/**
* Delete a conversation.
@@ -279,8 +283,12 @@
* Data is returned via MCsResultsObserver.
*
* @param aContactId Contact Id.
+ * @param aKnownIndex known index fetched
+ * @param aPageSize page size to be fetched
*/
- IMPORT_C void GetMessagingHistoryL ( TInt aContactId );
+ IMPORT_C void GetMessagingHistoryL(TInt aContactId,
+ TInt aKnownIndex,
+ TInt aPageSize);
/**
* ClearMessagingHistoryL
--- a/msg_plat/conversation_services_client_api/inc/mcsresultsobserver.h Tue Jul 06 14:12:40 2010 +0300
+++ b/msg_plat/conversation_services_client_api/inc/mcsresultsobserver.h Wed Aug 18 09:45:25 2010 +0300
@@ -57,7 +57,8 @@
*/
virtual void Conversations(
- RPointerArray<CCsConversationEntry>& aConversationEntryList) = 0;
+ RPointerArray<CCsConversationEntry>& aConversationEntryList,
+ TInt& aTotalCount) = 0;
};
#endif // __M_CS_RESULTS_OBSERVER_H__
--- a/msg_plat/conversation_services_utilities_api/inc/ccsdefs.h Tue Jul 06 14:12:40 2010 +0300
+++ b/msg_plat/conversation_services_utilities_api/inc/ccsdefs.h Wed Aug 18 09:45:25 2010 +0300
@@ -199,7 +199,9 @@
ECsBioMsg_VCard,
ECsBioMsg_VCal,
ECsBioMgs_NokiaService,
-ECsUnknown
+ECsUnknown,
+ECsBlueTooth_VCard,
+ECsBlueTooth_VCal
};
/**