# HG changeset patch # User William Roberts # Date 1279812726 -3600 # Node ID 5b14749788d7ff2694ff4b0c334af6fc67eb91dc # Parent a32b19fb291e5fc121275ee62e406cb1bc6a6d06# Parent 36f374c67aa87169387ff7215fe6c69e1f15b498 Catchup to latest Symbian^4 diff -r a32b19fb291e -r 5b14749788d7 email/imap4mtm/group/messaging_email_imap.history.xml diff -r a32b19fb291e -r 5b14749788d7 email/imap4mtm/group/messaging_email_imap.mrp diff -r a32b19fb291e -r 5b14749788d7 email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp --- a/email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -167,7 +167,12 @@ void CImapOpFetchBody::FetchBodyL(TRequestStatus& aRequestStatus, const TMsvId aPart, const TImImap4GetPartialMailInfo& aGetPartialMailInfo) { __LOG_TEXT(iSession->LogId(), "CImapOpFetchBody::FetchBodyL(): fetching message"); - + + if(IsActive()) + { + Cancel(); + } + iRequestedPart=aPart; iGetPartialMailInfo=aGetPartialMailInfo; Queue(aRequestStatus); @@ -1408,6 +1413,7 @@ { // Set vCard flag in message aMessage.SetVCard(ETrue); + aMessage.iType=KUidMsvEmailTextEntry; } // text/x-vcalendar else if (aMime.ContentSubType().CompareF(KMIME_VCALENDAR)==0) @@ -1415,6 +1421,7 @@ // Set vCalendar flag in message aMessage.SetVCalendar(ETrue); iIsVCalendar = ETrue; + aMessage.iType=KUidMsvEmailTextEntry; } // text/calendar else if (aMime.ContentSubType().CompareF(KMIME_ICALENDAR)==0) @@ -1422,6 +1429,7 @@ // Set iCalendar flag in message aMessage.SetICalendar(ETrue); iIsICalendar = ETrue; + aMessage.iType=KUidMsvEmailTextEntry; } else aMessage.iType=KUidMsvEmailTextEntry; @@ -1502,6 +1510,7 @@ TPtrC8 dispositionName = aBodyStructure->ExtDispositionName(); if (dispositionName.Size() != 0) { + aMime.SetContentDispositionL(dispositionName); __LOG_FORMAT((iSession->LogId(), " adding disp name: %S", &dispositionName)); aMime.ContentDispositionParams().AppendL(dispositionName); aMime.ContentDispositionParams().AppendL(KNullDesC8); diff -r a32b19fb291e -r 5b14749788d7 email/imap4mtm/imapprotocolcontroller/src/cimapprotocolcontroller.cpp diff -r a32b19fb291e -r 5b14749788d7 email/imap4mtm/imapservermtm/src/cimapupsresponsewaiter.cpp diff -r a32b19fb291e -r 5b14749788d7 email/imap4mtm/imapservermtm/test/group/bld.inf diff -r a32b19fb291e -r 5b14749788d7 email/imap4mtm/imapservermtm/test/group/t_unit_imapservermtm_server.mmp diff -r a32b19fb291e -r 5b14749788d7 email/imap4mtm/imapsession/inc/cimapfetchbody.h --- a/email/imap4mtm/imapsession/inc/cimapfetchbody.h Thu Jun 17 09:57:06 2010 +0100 +++ b/email/imap4mtm/imapsession/inc/cimapfetchbody.h Thu Jul 22 16:32:06 2010 +0100 @@ -182,6 +182,7 @@ TBool iSendFetch; // When server responses with no body length, iUnexpectedFormat is set to ETrue. TBool iUnexpectedFormat; + TBool iCancelled; }; #endif // __CIMAPFETCHBODY_H__ diff -r a32b19fb291e -r 5b14749788d7 email/imap4mtm/imapsession/src/cimapcommand.cpp diff -r a32b19fb291e -r 5b14749788d7 email/imap4mtm/imapsession/src/cimapfetchbody.cpp --- a/email/imap4mtm/imapsession/src/cimapfetchbody.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/email/imap4mtm/imapsession/src/cimapfetchbody.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -66,7 +66,8 @@ iImapMailStore(aImapMailStore), iParent(aParent), iFetchBodyResponse(aFetchBodyResponse), - iSendFetch(ETrue) + iSendFetch(ETrue), + iCancelled(EFalse) { } @@ -86,7 +87,7 @@ void CImapFetchBody::Cancel() { __LOG_TEXT(iLogId, "CImapFetchBody::Cancel()"); // Overrides CImapCommand::Cancel() - + iCancelled = ETrue; iImapMailStore.CancelRequest(*this); CImapCommand::Cancel(); } @@ -226,6 +227,10 @@ { iOutStream=&aStream; + if(iCancelled) + { + return; + } #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT) // check for BINARY capability const CImapCapabilityInfo& capabilityInfo = iParent.CapabilityInfo(); diff -r a32b19fb291e -r 5b14749788d7 email/imap4mtm/imapsyncmanager/src/cimapfolder.cpp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/group/IMCM.mmp --- a/email/pop3andsmtpmtm/clientmtms/group/IMCM.mmp Thu Jun 17 09:57:06 2010 +0100 +++ b/email/pop3andsmtpmtm/clientmtms/group/IMCM.mmp Thu Jul 22 16:32:06 2010 +0100 @@ -19,6 +19,7 @@ /** @file */ +#include TARGET imcm.dll TARGETPATH /system/libs @@ -47,10 +48,10 @@ LIBRARY centralrepository.lib tzclient.lib numberconversion.lib SOURCEPATH . -START RESOURCE IMCM.rss -TARGETPATH resource/messaging +START RESOURCE imcm.rss LANG SC HEADER +TARGETPATH resource/messaging END #include "../../../../../../mw/messagingmw/messagingfw/msgtests/group/msgopt.mph" @@ -70,7 +71,7 @@ #endif - +OS_LAYER_SYSTEMINCLUDE diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/group/IMCM.rss --- a/email/pop3andsmtpmtm/clientmtms/group/IMCM.rss Thu Jun 17 09:57:06 2010 +0100 +++ b/email/pop3andsmtpmtm/clientmtms/group/IMCM.rss Thu Jul 22 16:32:06 2010 +0100 @@ -16,6 +16,8 @@ // #include "imcm.rls" +#include +#include #define PARABREAK 8233 #define TABCHAR 9 @@ -37,12 +39,12 @@ RESOURCE LBUF forward_formatting_string { - buffer=STRING_forward_formatting_string1; + buffer=qtn_mail_fwd"%S"; } RESOURCE LBUF reply_formatting_string { - buffer=STRING_reply_formatting_string1; + buffer=qtn_mail_re"%S"; } RESOURCE LBUF receipt_formatting_string @@ -52,17 +54,17 @@ RESOURCE LBUF email_address_formatting_string { - buffer=STRING_email_address_formatting_string1; + buffer="%S <%S>";//STRING_email_address_formatting_string1; } // Headers used in Body for Forwarded/Replyed message RESOURCE LBUF forward_body_header { - buffer=STRING_forward_body_header1 - STRING_forward_body_header2 - STRING_forward_body_header3 - STRING_forward_body_header4; + buffer=qtn_mail_forward_separator + qtn_mail_copy_subject" %S" + qtn_mail_copy_sender" %S" + qtn_mail_copy_date" %S"; } RESOURCE LBUF forward_body_header_toonly @@ -95,10 +97,10 @@ RESOURCE LBUF reply_body_header { - buffer=STRING_reply_body_header1 - STRING_reply_body_header2 - STRING_reply_body_header3 - STRING_reply_body_header4; + buffer=qtn_mail_reply_separator + qtn_mail_copy_subject" %S" + qtn_mail_copy_sender" %S" + qtn_mail_copy_date" %S"; } RESOURCE LBUF reply_body_header_toonly @@ -174,28 +176,29 @@ } // List of available character sets in Charconv.h +// at some point flags should be removed and only qtn_default_charset be used for all builds. RESOURCE L8BUF default_system_charset - { - buffer=STRING_default_system_charset; - } + { + buffer = qtn_default_email_charset; + } // If this value is set to 1, 8 bit body text data and character set information will be stored // when downloaded via IMPS and POPS. The body text will be decoded to the correct character set // when opened. If this value is set to 0, the body text is decoded and stored when downloading. RESOURCE INT8 store_8bit_body_text { - value = 0; + value = 1; } // Used for localised date time formatting for email forward and reply body headers RESOURCE LBUF body_header_datetime_format { - buffer=STRING_body_header_datetime_format; + buffer="%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:3%+B"; //STRING_body_header_datetime_format; } RESOURCE LBUF partial_download_footer_message { - buffer=STRING_partial_download_footer_message; + buffer=qtn_mail_rest_of_mail_not_fetched; } // If this value is set to 1,body text data will be stored when downloaded via IMPS and POPS using chunk storage option. @@ -203,5 +206,5 @@ RESOURCE INT8 store_plain_body_text { - value = 1; + value = 0; } diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/group/IMCMCOPY.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/group/bld.inf --- a/email/pop3andsmtpmtm/clientmtms/group/bld.inf Thu Jun 17 09:57:06 2010 +0100 +++ b/email/pop3andsmtpmtm/clientmtms/group/bld.inf Thu Jul 22 16:32:06 2010 +0100 @@ -14,6 +14,7 @@ // bld.inf // +#include PRJ_EXPORTS ../inc/MIUTHDR.H SYMBIAN_APP_LAYER_PUBLIC_EXPORT_PATH(miuthdr.h) @@ -64,6 +65,13 @@ #endif +//IBY exports +../rom/gtemailmtmResources.iby LANGUAGE_OS_LAYER_IBY_EXPORT_PATH(gtemailmtmResources.iby) +../rom/gtemailmtm.hby CORE_OS_LAYER_IBY_EXPORT_PATH(gtemailmtm.hby) + +// export localised loc file +../loc/imcm.loc OS_LAYER_LOC_EXPORT_PATH(imcm.loc) +../loc/imcm_default_charset.loc OS_LAYER_LOC_EXPORT_PATH(imcm_default_charset.loc) PRJ_MMPFILES IMCM.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/inc/MIUTRSLV.H --- a/email/pop3andsmtpmtm/clientmtms/inc/MIUTRSLV.H Thu Jun 17 09:57:06 2010 +0100 +++ b/email/pop3andsmtpmtm/clientmtms/inc/MIUTRSLV.H Thu Jul 22 16:32:06 2010 +0100 @@ -130,6 +130,7 @@ private: void DoRunL(); void DoComplete(TInt& ); + void DoCancel(); void CheckCurrentEntryL(); inline TBool CheckContentDetailsL(const TDesC& aContentLocation, const TDesC& aContentId); @@ -210,6 +211,7 @@ void DoRunL(); void DoComplete(TInt& ); + void DoCancel(); inline void SetStartParameterL(); private: CMsvEntry& iCurrentEntry; diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/inc/cimfinder.h --- a/email/pop3andsmtpmtm/clientmtms/inc/cimfinder.h Thu Jun 17 09:57:06 2010 +0100 +++ b/email/pop3andsmtpmtm/clientmtms/inc/cimfinder.h Thu Jul 22 16:32:06 2010 +0100 @@ -57,7 +57,7 @@ private: void DoRunL(); - + void DoCancel(); virtual void AddChildEntriesL() = 0; virtual TBool IsRequiredEntryType(TUid aEntryType) const = 0; diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/loc/imcm.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/email/pop3andsmtpmtm/clientmtms/loc/imcm.loc Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 is a localisation file for imcm.dll +* A .loc file is the one and only place where the logical strings +* to be localised are defined. +* >>> +* The text between >>> and <<< is just to document the syntax and +* you can remove it if you like. +* +*/ + + + + +// LOCALISATION STRINGS + +// d: Added in the beginning of the subject line when replying +// l: mce_header_field_pane_t1 +#define qtn_mail_re "RE: " + +// d: Added in the beginning of the subject line when forwarding +// l: mce_header_field_pane_t1 +#define qtn_mail_fwd "FWD: " + +// d: Text to be inserted into a message when replying +// d: Inerted in the beginning of the original message +// l: msg_header_pane_t2 +#define qtn_mail_reply_separator "--- original message ---" + +// d: Text to be inserted into a message when forwarding +// d: Inserted in the beginning of the original message +// l: msg_header_pane_t2 +#define qtn_mail_forward_separator "--- original message ---" + +// d: Text to be inserted into a message when forwarding or replying +// d: Inserted in the beginning of the original message +// l: msg_header_pane_t2 +#define qtn_mail_copy_subject "Subject:" + +// d: Text to be inserted into a message when forwarding or replying +// d: Inserted in the beginning of the original message +// l: msg_header_pane_t2 +#define qtn_mail_copy_sender "Sender:" + +// d: Text to be inserted into a message when forwarding or replying +// d: Inserted in the beginning of the original message +// l: msg_header_pane_t2 +#define qtn_mail_copy_date "Date:" + +// d: Text to be inserted into a message body if part of message body is filtered out +// l:none +#define qtn_mail_rest_of_mail_not_fetched "- - - Retrieve total mail selecting Retrieve from Options list. - - -" + +// End of File diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/loc/imcm_default_charset.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/email/pop3andsmtpmtm/clientmtms/loc/imcm_default_charset.loc Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* !!!!!!!LOCALISATION INSTRUCTIONS, IMPORTANT!!!!!!! +* These default charsets are used to define correct default charsets for different builds. +* +*/ + + + +// d: This is not visible to the user! +// l: None +#define qtn_default_email_charset "ISO-8859-1" + +// End of File diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/rom/gtemailmtm.hby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/email/pop3andsmtpmtm/clientmtms/rom/gtemailmtm.hby Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,9 @@ +#ifndef __GTEMAILMTM_HBY__ +#define __GTEMAILMTM_HBY__ + +// +// Moved to gtemailmtmResources.iby +// +//data=MULTI_LINGUIFY(RSC DATAZ_\resource\messaging\imcm resource\messaging\imcm) + +#endif diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/rom/gtemailmtmResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/email/pop3andsmtpmtm/clientmtms/rom/gtemailmtmResources.iby Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: gtemailmtmResources.iby* +*/ + +#ifndef __GTEMAILMTM_RESOURCES_IBY__ +#define __GTEMAILMTM_RESOURCES_IBY__ + +// Refer to gtemailmtm.hby +data=DATAZ_\resource\messaging\imcm.rsc resource\messaging\imcm.rsc + +#endif \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/src/CACHEMAN.CPP --- a/email/pop3andsmtpmtm/clientmtms/src/CACHEMAN.CPP Thu Jun 17 09:57:06 2010 +0100 +++ b/email/pop3andsmtpmtm/clientmtms/src/CACHEMAN.CPP Thu Jul 22 16:32:06 2010 +0100 @@ -122,6 +122,12 @@ } } +void CImFinder::DoCancel() + { + CMsgActive::DoCancel(); + } + + CImFinder::CImFinder(CMsvEntry& aEntry) : CMsgActive(EPriorityStandard), iCurrentEntry(aEntry) { } diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/src/CIMPLAINBODYTEXT.cpp --- a/email/pop3andsmtpmtm/clientmtms/src/CIMPLAINBODYTEXT.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/email/pop3andsmtpmtm/clientmtms/src/CIMPLAINBODYTEXT.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -468,4 +468,5 @@ void CImPlainBodyText::DoCancel() { iPlainTextArray[iIndex]->Cancel(); + CMsgActive::DoCancel(); } diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/src/MIUTMSG.CPP diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/src/MIUTRSLV.CPP --- a/email/pop3andsmtpmtm/clientmtms/src/MIUTRSLV.CPP Thu Jun 17 09:57:06 2010 +0100 +++ b/email/pop3andsmtpmtm/clientmtms/src/MIUTRSLV.CPP Thu Jul 22 16:32:06 2010 +0100 @@ -462,6 +462,12 @@ } } } + + +void CImMhtmlChildEntrySearcher::DoCancel() + { + CMsgActive::DoCancel(); + } void CImMhtmlChildEntrySearcher::DoComplete(TInt& ) { @@ -1043,7 +1049,10 @@ } } - +void CImMhtmlFirstPageFinder::DoCancel() + { + CMsgActive::DoCancel(); + } // The following class implements a class for parsing and combining URI's. diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/test/group/T_imcm04.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/clientmtms/test/testrom/bld.inf diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/group/messaging_email.history.xml diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/group/messaging_email.mrp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/popservermtm/src/POPS.CPP diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/popservermtm/src/POPSRFSH.CPP diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/popservermtm/test/group/T_POPSECURESOCKETS.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/popservermtm/test/group/T_PopFullDsk.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/popservermtm/test/group/T_pops4.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/popservermtm/test/group/T_pops5.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/popservermtm/test/group/T_pops6.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/popservermtm/test/group/T_popsCancelProgress.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/popservermtm/test/group/T_pops_synchronise.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/popservermtm/test/testrom/bld.inf diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/servermtmutils/src/IMCVCODC.CPP --- a/email/pop3andsmtpmtm/servermtmutils/src/IMCVCODC.CPP Thu Jun 17 09:57:06 2010 +0100 +++ b/email/pop3andsmtpmtm/servermtmutils/src/IMCVCODC.CPP Thu Jul 22 16:32:06 2010 +0100 @@ -1469,14 +1469,14 @@ // Intermediate buffer for decoding, prior to converting - HBufC8* decodeBuf8 = HBufC8::NewLC(aBufOut.MaxLength()); + HBufC8* decodeBuf8 = HBufC8::NewLC(aBufOut.MaxLength()); decodeBuf8->Des().Copy( aBufIn.Mid(i+1, j -i-1)); // Depending on type of encoding Q or B, decode. TPtr8 dataPtr8(dataBuf8->Des()); - + TPtr8 decodePtr8(decodeBuf8->Des()); switch (iEncodingInfo.EncodingType()) { case TImHeaderEncodingInfo::EBase64 : @@ -1484,14 +1484,13 @@ break; case TImHeaderEncodingInfo::EQP : // Replace all underscores in text with SPACE. - iQPCodec.Decode( *decodeBuf8, dataPtr8 ); - - i=dataPtr8.Length(); + i=decodePtr8.Length(); while (i--) { - if (dataPtr8[i] == KImcvUnderScore) - dataPtr8[i] = KImcvSpaceChar; + if (decodePtr8[i] == KImcvUnderScore) + decodePtr8[i] = KImcvSpaceChar; } + iQPCodec.Decode( *decodeBuf8, dataPtr8 ); break; default: dataBuf8->Des().Copy(*decodeBuf8); diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/servermtmutils/src/imcvrecv.cpp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/servermtmutils/test/group/T_IMSK01.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/servermtmutils/test/testrom/bld.inf diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/smtpservermtm/test/group/T_SMTS01.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/smtpservermtm/test/group/T_SMTS02.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/smtpservermtm/test/group/T_SMTSSECURESOCKETS.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/smtpservermtm/test/group/T_smts00.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/smtpservermtm/test/group/t_smtssmtpauth.mmp diff -r a32b19fb291e -r 5b14749788d7 email/pop3andsmtpmtm/smtpservermtm/test/testrom/bld.inf diff -r a32b19fb291e -r 5b14749788d7 inc/convergedmessage.h --- a/inc/convergedmessage.h Thu Jun 17 09:57:06 2010 +0100 +++ b/inc/convergedmessage.h Thu Jul 22 16:32:06 2010 +0100 @@ -64,7 +64,8 @@ Provisioning = 0x01, VCard = 0x02, VCal = 0x03, - Audio = 0x04 + Audio = 0x04, + NokiaService = 0x08 }; /** diff -r a32b19fb291e -r 5b14749788d7 inc/msgbiouids.h --- a/inc/msgbiouids.h Thu Jun 17 09:57:06 2010 +0100 +++ b/inc/msgbiouids.h Thu Jul 22 16:32:06 2010 +0100 @@ -63,6 +63,10 @@ /// UID for the Provisioning Message type for BIO database const TUid KMsgBioProvisioningMessage = {0x101F84D1}; +const TUid KMsgBioNokiaServiceMessage = {0x102832EA}; + +const TUid KMsgBioNokiaServiceSentMessage = {0x20022FE6}; + //// PoC const TUid KMsgBioUidPoC = {0x101FD869}; diff -r a32b19fb291e -r 5b14749788d7 inc/msgcontacthandler.h --- a/inc/msgcontacthandler.h Thu Jun 17 09:57:06 2010 +0100 +++ b/inc/msgcontacthandler.h Thu Jul 22 16:32:06 2010 +0100 @@ -52,37 +52,57 @@ QString& displayName, int& countPhoneNumber) { - QContactManager * phonebookManager; + QContactManager phonebookManager; + QVariant address(contactNumber); + + // apply filter on phone number field QContactDetailFilter phoneFilter; - phonebookManager = new QContactManager("symbian"); - phoneFilter.setDetailDefinitionName(QContactPhoneNumber::DefinitionName, - QContactPhoneNumber::FieldNumber); + phoneFilter.setDetailDefinitionName( + QContactPhoneNumber::DefinitionName, + QContactPhoneNumber::FieldNumber); - QVariant address(contactNumber); phoneFilter.setValue(address); phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith); - QList matchingContacts = - phonebookManager->contacts(phoneFilter); - + phonebookManager.contacts(phoneFilter); if (matchingContacts.count() > 0) { // Fill the contact details QContact match = matchingContacts.at(0); displayName = match.displayLabel(); - QList numbers = + QList numbers = match.details (); countPhoneNumber = numbers.count(); return match.localId(); } - else // no matching contacts + + // apply filter on email address field + QContactDetailFilter emailFilter; + emailFilter.setDetailDefinitionName( + QContactEmailAddress::DefinitionName, + QContactEmailAddress::FieldEmailAddress); + + emailFilter.setValue(address); + emailFilter.setMatchFlags(QContactFilter::MatchExactly); + matchingContacts = phonebookManager.contacts(emailFilter); + if ( matchingContacts.count() > 0 ) { - displayName = contactNumber; - return -1; + // Fill the contact details + QContact match = matchingContacts.at(0); + + displayName = match.displayLabel(); + QList numbers = + match.details (); + countPhoneNumber = numbers.count(); + return match.localId(); } + + // no matching contact + displayName = contactNumber; + return -1; } - + /** * This shall resolve contact number with display name * @param contactNumber number to resolve @@ -161,17 +181,20 @@ if (versitDocuments.count() > 0) { QVersitContactImporter importer; - QList contacts = - importer.importContacts(versitDocuments); - // get display-name - if (contacts.count() > 0) + bool import_docs = importer.importDocuments(versitDocuments); + if(import_docs) { - //resolveSynthesizedDisplayLabel - QContactManager* contactManager = + QList contacts = importer.contacts(); + // get display-name + if (contacts.count() > 0) + { + //resolveSynthesizedDisplayLabel + QContactManager* contactManager = new QContactManager("symbian"); - displayName + displayName = contactManager->synthesizedDisplayLabel(contacts[0]); - delete contactManager; + delete contactManager; + } } } } diff -r a32b19fb291e -r 5b14749788d7 inc/msgnotificationdialogpluginkeys.h diff -r a32b19fb291e -r 5b14749788d7 inc/unidatamodelloader.h diff -r a32b19fb291e -r 5b14749788d7 inc/unidatamodelplugininterface.h --- a/inc/unidatamodelplugininterface.h Thu Jun 17 09:57:06 2010 +0100 +++ b/inc/unidatamodelplugininterface.h Thu Jul 22 16:32:06 2010 +0100 @@ -84,6 +84,30 @@ inline const QString& mimetype(); /** + * isProtected + * @return true if DRM protected object else false. + */ + inline bool isProtected() const; + + /** + * setProtected + * @param isProtected true if DRM protected object else false. + */ + inline void setProtected(bool isProtected); + + /** + * isCorrupted + * @return true if object is corrupted else false. + */ + inline bool isCorrupted() const; + + /** + * setCorrupted + * @param corrupted true if object is corrupted else false. + */ + inline void setCorrupted(bool corrupted); + + /** * Serialize the data memebers into the stream. * @param stream data stream to which data is serialized. */ @@ -97,8 +121,10 @@ private: QString mPath; + QString mMimeType; int mSize; - QString mMimeType; + bool mProtected; + bool mCorrupt; }; diff -r a32b19fb291e -r 5b14749788d7 inc/unidatamodelplugininterface.inl --- a/inc/unidatamodelplugininterface.inl Thu Jun 17 09:57:06 2010 +0100 +++ b/inc/unidatamodelplugininterface.inl Thu Jul 22 16:32:06 2010 +0100 @@ -18,9 +18,8 @@ // UniMessageInfo::UniMessageInfo // @see header //---------------------------------------------------------------- - UniMessageInfo::UniMessageInfo( const QString& filepath, - const int size, - const QString& mimetype ) : mPath (filepath), mSize(size), mMimeType(mimetype) +UniMessageInfo::UniMessageInfo(const QString& filepath, const int size, const QString& mimetype) : + mPath(filepath), mMimeType(mimetype), mSize(size), mProtected(false), mCorrupt(false) { @@ -89,6 +88,42 @@ } //---------------------------------------------------------------- +// UniMessageInfo::isProtected +// @see header +//---------------------------------------------------------------- +inline bool UniMessageInfo::isProtected() const + { + return mProtected; + } + +//---------------------------------------------------------------- +// UniMessageInfo::setProtected +// @see header +//---------------------------------------------------------------- +inline void UniMessageInfo::setProtected(bool isProtected) + { + mProtected = isProtected; + } + +//---------------------------------------------------------------- +// UniMessageInfo::isCorrupted +// @see header +//---------------------------------------------------------------- +inline bool UniMessageInfo::isCorrupted() const + { + return mCorrupt; + } + +//---------------------------------------------------------------- +// UniMessageInfo::setCorrupted +// @see header +//---------------------------------------------------------------- +inline void UniMessageInfo::setCorrupted(bool corrupted) + { + mCorrupt = corrupted; + } + +//---------------------------------------------------------------- // UniMessageInfo::serialize // @see header //---------------------------------------------------------------- diff -r a32b19fb291e -r 5b14749788d7 inc/unieditorplugininterface.h diff -r a32b19fb291e -r 5b14749788d7 inc/unieditorpluginloader.h diff -r a32b19fb291e -r 5b14749788d7 layers.sysdef.xml diff -r a32b19fb291e -r 5b14749788d7 messaging_info/messaging_metadata/messaging_metadata.mrp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/conf/backup_registration.xml Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,5 @@ + + + + + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/messaging_101F87EB.crml Binary file messagingapp/conf/messaging_101F87EB.crml has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/messaging_101F87EC.crml Binary file messagingapp/conf/messaging_101F87EC.crml has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/messaging_101F87ED.crml Binary file messagingapp/conf/messaging_101F87ED.crml has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/messaging_101F87EE.crml Binary file messagingapp/conf/messaging_101F87EE.crml has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/messaging_101F87EF.crml Binary file messagingapp/conf/messaging_101F87EF.crml has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/messaging_101F8873.crml Binary file messagingapp/conf/messaging_101F8873.crml has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/messaging_101F8F28.crml Binary file messagingapp/conf/messaging_101F8F28.crml has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/messaging_102071F2.crml Binary file messagingapp/conf/messaging_102071F2.crml has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/messaging_102072E2.crml Binary file messagingapp/conf/messaging_102072E2.crml has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/messaging_102072E5.crml Binary file messagingapp/conf/messaging_102072E5.crml has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/messaging_102824A0.crml Binary file messagingapp/conf/messaging_102824A0.crml has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/messaging_1028281E.crml Binary file messagingapp/conf/messaging_1028281E.crml has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/conf/messaging_conf.pro --- a/messagingapp/conf/messaging_conf.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/conf/messaging_conf.pro Thu Jul 22 16:32:06 2010 +0100 @@ -35,6 +35,7 @@ "messaging_102072E5.crml APP_LAYER_CRML(messaging_102072E5.crml)" \ "messaging_102824A0.crml APP_LAYER_CRML(messaging_102824A0.crml)" \ "messaging_1028281E.crml APP_LAYER_CRML(messaging_1028281E.crml)" \ - "messaging_101F8F28.crml APP_LAYER_CRML(messaging_101F8F28.crml)" + "messaging_101F8F28.crml APP_LAYER_CRML(messaging_101F8F28.crml)" \ + "backup_registration.xml z:/private/2001FE79/backup_registration.xml" } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/messagingapp.pro diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/bwins/msghistoryu.def diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/client/bwins/csserverclientapiu.def --- a/messagingapp/msgappfw/client/bwins/csserverclientapiu.def Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/client/bwins/csserverclientapiu.def Thu Jul 22 16:32:06 2010 +0100 @@ -24,4 +24,5 @@ ?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) diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/client/eabi/csserverclientapiu.def --- a/messagingapp/msgappfw/client/eabi/csserverclientapiu.def Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/client/eabi/csserverclientapiu.def Thu Jul 22 16:32:06 2010 +0100 @@ -30,4 +30,5 @@ _ZTV17CCSRequestHandler @ 29 NONAME _ZTV22CCsNotificationHandler @ 30 NONAME _ZTV29CCsConversationChangeObserver @ 31 NONAME + _ZN17CCSRequestHandler34GetConversationFromConversationIdLEi @ 32 NONAME diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/client/src/ccsnotificationhandler.cpp --- a/messagingapp/msgappfw/client/src/ccsnotificationhandler.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/client/src/ccsnotificationhandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -126,7 +126,11 @@ case EModifyConversationListEvent: iRequestHandler->HandleModifyConversationList(iNotificationBuffer); break; - + + case EPartialDeleteConversationListEvent: + iRequestHandler->HandlePartialDeleteConversationList(iNotificationBuffer); + break; + case EAddConversationEvent: iRequestHandler->HandleAddConversation(iNotificationBuffer); break; diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/client/src/ccsrequesthandler.cpp --- a/messagingapp/msgappfw/client/src/ccsrequesthandler.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/client/src/ccsrequesthandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -59,13 +59,13 @@ // CCSRequestHandler::NewLC() // Two-phased constructor. // ----------------------------------------------------------------------------- -EXPORT_C CCSRequestHandler* CCSRequestHandler::NewLC(/*CVPbkContactManager* aVPbkContactManager*/) +EXPORT_C CCSRequestHandler* CCSRequestHandler::NewLC() { PRINT ( _L("Enter CCSRequestHandler::NewLC") ); CCSRequestHandler* self = new ( ELeave ) CCSRequestHandler(); CleanupStack::PushL( self ); - self->ConstructL(/*aVPbkContactManager*/); + self->ConstructL(); PRINT ( _L("End CCSRequestHandler::NewLC") ); @@ -178,6 +178,12 @@ //call panic } + // Speed up the allocation + if( listCount > 0 ) + { + clientConversationList.Reserve(listCount); + } + for (TInt iloop = 0 ; iloop < listCount; iloop++) { TRAP(error, @@ -240,7 +246,12 @@ { //call panic } - + // Speed up the allocation + if( conversationEntryCount > 0 ) + { + ConversationEntryList.Reserve(conversationEntryCount); + } + PRINT1 ( _L("Number of conversation entries = %d"), conversationEntryCount ); // conversation entries @@ -319,8 +330,11 @@ stream.Close(); // Delete and recreate the results buffer - delete iListResultsBuffer; - iListResultsBuffer = NULL; + if ( iListResultsBuffer) + { + delete iListResultsBuffer; + iListResultsBuffer = NULL; + } // Buffer created for the new size TRAP(error, @@ -370,8 +384,11 @@ stream.Close(); // Delete and recreate the results buffer - delete iConvResultsBuffer; - iConvResultsBuffer = NULL; + if ( iConvResultsBuffer ) + { + delete iConvResultsBuffer; + iConvResultsBuffer = NULL; + } // Buffer created for the new size TRAP(error, @@ -429,10 +446,14 @@ EXPORT_C void CCSRequestHandler::RemoveConversationListChangeEventL( MCsConversationListChangeObserver* /*aObserver*/) { - iConversationListChangeObserver = NULL; - - // De-register from the server - iNotificationHandler->RemoveConversationListChangeEventL(); + // Before removing observer, make sure it was added earlier. + if( iConversationListChangeObserver ) + { + iConversationListChangeObserver = NULL; + + // De-register from the server + iNotificationHandler->RemoveConversationListChangeEventL(); + } } // ----------------------------------------------------------------------------- @@ -466,11 +487,12 @@ { delete iConversationChangeObserver; iConversationChangeObserver = NULL; - } - - iNotificationHandler->RemoveConversationChangeEventL(aClientConversation); + if(aClientConversation) + { + iNotificationHandler->RemoveConversationChangeEventL(aClientConversation); + } + } } - // ----------------------------------------------------------------------------- // CCSRequestHandler::RequestCachingStatusEventL() // Add caching status Observer @@ -895,6 +917,50 @@ } // ----------------------------------------------------------------------------- +// CCSRequestHandler::HandlePartialDeleteConversationList() +// Process partial delete conversation lsit event received from server +// ----------------------------------------------------------------------------- + +void CCSRequestHandler::HandlePartialDeleteConversationList(HBufC8* aResultsBuffer) +{ + PRINT( _L("Enter CCSRequestHandler::HandlePartialDeleteConversationList") ); + + TInt error = KErrNone; + + // perpare client conversation + CCsClientConversation* clientConversation = NULL; + RDesReadStream resultStream(aResultsBuffer->Des()); + + TRAP(error, + resultStream.PushL(); + clientConversation = CCsClientConversation::NewL(); + CleanupStack::PushL(clientConversation); + clientConversation->InternalizeL(resultStream); + CleanupStack::Pop(clientConversation); + resultStream.Pop()); + + if ( error != KErrNone ) + { + // Ignore this conversation + } + + // Cleanup + resultStream.Close(); + + // Pass the results to the observer + if ( iConversationListChangeObserver ) + { + CleanupStack::PushL( clientConversation ); + iConversationListChangeObserver-> + PartialDeleteConversationList(*clientConversation); + } + + CleanupStack::PopAndDestroy();// clientConversation*/ + + PRINT( _L("End CCSRequestHandler::HandlePartialDeleteConversationList") ); +} + +// ----------------------------------------------------------------------------- // CCSRequestHandler::HandleModifyConversationList // Process modify conversation lsit event received from server // ----------------------------------------------------------------------------- @@ -1198,6 +1264,39 @@ } // ----------------------------------------------------------------------------- +// CCSRequestHandler::GetConversationFromConversationIdL() +// ----------------------------------------------------------------------------- +EXPORT_C CCsClientConversation* CCSRequestHandler::GetConversationFromConversationIdL(TInt aConversationId) +{ + // Create a buffer to store the results. + if(iResultsBuffer) + { + delete iResultsBuffer; + iResultsBuffer = NULL; + } + iResultsBuffer = HBufC8::NewL(KBigIpcBuffer); + + // Send the request + iSession.GetConversationFromConversationIdL(aConversationId, iResultsBuffer->Des()); + + // Parse the results + RDesReadStream resultStream(iResultsBuffer->Des()); + resultStream.PushL(); + CCsClientConversation* clientConversation = CCsClientConversation::NewL(); + CleanupStack::PushL(clientConversation); + clientConversation->InternalizeL(resultStream); + CleanupStack::Pop(clientConversation); + + // Cleanup + delete iResultsBuffer; + iResultsBuffer = NULL; + resultStream.Pop(); + resultStream.Close(); + + return clientConversation; +} + +// ----------------------------------------------------------------------------- // CCSRequestHandler::GetConversationFromMessageIdL() // ----------------------------------------------------------------------------- EXPORT_C CCsClientConversation* CCSRequestHandler::GetConversationFromMessageIdL(TInt aMessageId) diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/client/src/rcssession.cpp --- a/messagingapp/msgappfw/client/src/rcssession.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/client/src/rcssession.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -397,6 +397,20 @@ } // ---------------------------------------------------------------------------- +// RCsSession::GetConversationFromConversationIdL +// ---------------------------------------------------------------------------- +void RCsSession::GetConversationFromConversationIdL(TInt aConversationId, TPtr8 aResultsBuffer) + { + PRINT( _L("Enter RCsSession::GetConversationFromConversationIdL") ); + + TIpcArgs args(aConversationId, &aResultsBuffer); + + // Initiate the request + User::LeaveIfError (SendReceive(EGetConversationFromConversationId, args ) ); + PRINT( _L("End RCsSession::GetConversationFromConversationIdL") ); + } + +// ---------------------------------------------------------------------------- // RCsSession::GetConversationFromMessageIdL // ---------------------------------------------------------------------------- void RCsSession::GetConversationFromMessageIdL(TInt aMessageId, TPtr8 aResultsBuffer) diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/msgappfw.pro diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/msghistory/msghistory.pro --- a/messagingapp/msgappfw/msghistory/msghistory.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/msghistory/msghistory.pro Thu Jul 22 16:32:06 2010 +0100 @@ -17,7 +17,6 @@ TARGET = msghistory DEPENDPATH += . inc src INCLUDEPATH += . -INCLUDEPATH += ../../msgutils/s60qconversions/inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE DEFINES += MSGHISTORY_DLL @@ -51,8 +50,15 @@ src/msghistoryprivate.cpp \ src/msgitem.cpp - +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/msghistory.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/msghistory.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock LIBS += -lcsserverclientapi \ -lcsutils \ - -ls60qconversions \ No newline at end of file + -lxqutils diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/msghistory/src/msghistoryprivate.cpp --- a/messagingapp/msgappfw/msghistory/src/msghistoryprivate.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/msghistory/src/msghistoryprivate.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -19,7 +19,7 @@ #include #include #include -#include +#include //USER INCLUDES #include "msghistoryprivate.h" @@ -101,6 +101,9 @@ conversationId = handler->GetConversationIdL(aContactId)); CCsClientConversation* clientConversation = CCsClientConversation::NewL(); clientConversation->SetConversationEntryId(conversationId); + // set the contact id, which will be used in case when the + // conversation entry id is -1. + clientConversation->SetContactId(aContactId); //set dummy entry CCsConversationEntry *entry = CCsConversationEntry::NewL(); clientConversation->SetConversationEntryL(entry); @@ -125,6 +128,9 @@ conversationId = handler->GetConversationIdL(aContactId)); CCsClientConversation* clientConversation = CCsClientConversation::NewL(); clientConversation->SetConversationEntryId(conversationId); + // set the contact id, which will be used in case when the + // conversation entry id is -1. + clientConversation->SetContactId(aContactId); //set dummy entry CCsConversationEntry *entry = CCsConversationEntry::NewL(); clientConversation->SetConversationEntryL(entry); @@ -230,7 +236,7 @@ HBufC* description = entry.Description(); if( description && description->Length()) { - item.setBody(S60QConversions::s60DescToQString(*description)); + item.setBody(XQConversions::s60DescToQString(*description)); } // time stamp @@ -244,7 +250,7 @@ HBufC* contact = entry.Contact(); if( contact && contact->Length()) { - item.setPhoneNumber(S60QConversions::s60DescToQString(*contact)); + item.setPhoneNumber(XQConversions::s60DescToQString(*contact)); } //sending state diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/msghistory/src/msgitem.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsengine.cpp --- a/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsengine.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsengine.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -26,7 +26,7 @@ #include "debugtraces.h" #include #include -#include "s60qconversions.h" +#include const int ViewableLimit = 160; //--------------------------------------------------------------- @@ -137,7 +137,7 @@ // description QString descr = item.body(); - HBufC* description = S60QConversions::qStringToS60Desc(descr); + HBufC* description = XQConversions::qStringToS60Desc(descr); entry->SetDescriptionL(description->Des()); delete description; @@ -147,7 +147,7 @@ //contact details QString details = item.phoneNumber(); - HBufC* d_details = S60QConversions::qStringToS60Desc(details); + HBufC* d_details = XQConversions::qStringToS60Desc(details); entry->SetContactL(d_details->Des()); delete d_details; diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsengineutility.cpp --- a/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsengineutility.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsengineutility.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -32,7 +32,7 @@ #include "smilxmlreader.h" #include "smilliterals.h" #include "msgmimetypes.h" -#include "s60qconversions.h" +#include // CONSTANTS #define KForwardSlash '/' @@ -78,7 +78,7 @@ { //get smilfile's handle to parse RFile smilfile; - HBufC* path = S60QConversions::qStringToS60Desc(ismilfilepath); + HBufC* path = XQConversions::qStringToS60Desc(ismilfilepath); RFs fsSession; User::LeaveIfError(fsSession.Connect()); @@ -241,7 +241,7 @@ qDebug() << " Exit CNativeMmsUtility::getSmilFileL"; #endif - return S60QConversions::s60DescToQString(attachment->FilePath()); + return XQConversions::s60DescToQString(attachment->FilePath()); } } @@ -285,7 +285,7 @@ //because media source is relative to it. QString smildirpath = fileDir(ismilfilepath); QString mfilename = - S60QConversions::s60DescToQString(attrvalptr); + XQConversions::s60DescToQString(attrvalptr); filepath = smildirpath.append(mfilename); } readFileIntoBuffer(filepath, returnbuf); @@ -321,7 +321,7 @@ == 0) { QString filepath = - S60QConversions::s60DescToQString(attachment->FilePath()); + XQConversions::s60DescToQString(attachment->FilePath()); readFileIntoBuffer(filepath, returnbuf); break; } @@ -371,7 +371,7 @@ //because media source is relative to it. QString smildirpath = fileDir(ismilfilepath); QString mfilename = - S60QConversions::s60DescToQString(attrvalptr); + XQConversions::s60DescToQString(attrvalptr); filepath = smildirpath.append(mfilename); } // converting directory separators from native to @@ -409,7 +409,7 @@ CMsvAttachment *attachment = iattachmanager->GetAttachmentInfoL(i); TPtrC8 mimetype = attachment->MimeType(); QString filepath = - S60QConversions::s60DescToQString(attachment->FilePath()); + XQConversions::s60DescToQString(attachment->FilePath()); // converting directory separators from native to // universal (QT) format filepath.replace(KBackwardSlash, KForwardSlash); @@ -476,7 +476,7 @@ CMsvAttachment *attachment = iattachmanager->GetAttachmentInfoL(i); TPtrC8 mimetype = attachment->MimeType(); QString filepath = - S60QConversions::s60DescToQString(attachment->FilePath()); + XQConversions::s60DescToQString(attachment->FilePath()); // converting directory separators from native to // universal (QT) format filepath.replace(KBackwardSlash, KForwardSlash); @@ -577,7 +577,7 @@ qDebug() << " Exit CNativeMmsUtility::getByUrlL"; #endif - return S60QConversions::s60DescToQString(targetattachment->FilePath()); + return XQConversions::s60DescToQString(targetattachment->FilePath()); } else { diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsmodel.cpp --- a/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsmodel.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsmodel.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -19,7 +19,7 @@ #include "conversationsenginedefines.h" #include "conversationmsgstorehandler.h" #include "convergedmessage.h" -#include "s60qconversions.h" +#include #include "conversationsengineutility.h" #include @@ -251,7 +251,7 @@ QString subject(""); if( description && description->Length()) { - subject = (S60QConversions::s60DescToQString(*description)); + subject = (XQConversions::s60DescToQString(*description)); item.setData(subject, Subject); } @@ -266,7 +266,7 @@ HBufC* contact = entry.Contact(); if( contact && contact->Length()) { - item.setData(S60QConversions::s60DescToQString(*contact), ConversationAddress); + item.setData(XQConversions::s60DescToQString(*contact), ConversationAddress); } // message type. diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationssummarymodel.cpp --- a/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationssummarymodel.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationssummarymodel.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -18,7 +18,7 @@ #include "conversationssummarymodel.h" #include "conversationsenginedefines.h" #include "conversationsengineutility.h" -#include "s60qconversions.h" +#include #include "convergedmessage.h" #include @@ -214,7 +214,7 @@ HBufC* body = conEntry->Description(); if( body && body->Length()) { - QString bodytext(S60QConversions::s60DescToQString(*body)); + QString bodytext(XQConversions::s60DescToQString(*body)); item.setData(bodytext, BodyText); item.setData(bodytext, Subject ); } @@ -235,20 +235,20 @@ //first name if(firstname && firstname->Length()) { - displayName = S60QConversions::s60DescToQString(*firstname); + displayName = XQConversions::s60DescToQString(*firstname); item.setData(displayName,FirstName); } //last name HBufC* lastname = conversation.GetLastName(); if( lastname && lastname->Length()) { - item.setData(S60QConversions::s60DescToQString(*lastname),LastName); + item.setData(XQConversions::s60DescToQString(*lastname),LastName); } //nick name HBufC* nickname = conversation.GetNickName(); if (nickname && nickname->Length()) { - item.setData(S60QConversions::s60DescToQString(*nickname), NickName); + item.setData(XQConversions::s60DescToQString(*nickname), NickName); } //item.setData(displayName, NickName); @@ -258,7 +258,7 @@ QString contactNumber(""); if ( contactno && contactno->Length() ) { - contactNumber = S60QConversions::s60DescToQString(*contactno); + contactNumber = XQConversions::s60DescToQString(*contactno); } item.setData(contactNumber, ConversationAddress); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/msghistory/tsrc/test_appengine/test_appengine.pro --- a/messagingapp/msgappfw/msghistory/tsrc/test_appengine/test_appengine.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/msghistory/tsrc/test_appengine/test_appengine.pro Thu Jul 22 16:32:06 2010 +0100 @@ -20,7 +20,6 @@ DEPENDPATH += . src INCLUDEPATH += ../../../inc -INCLUDEPATH += ../../msgutils/s60qconversions/inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE DEFINES += BUILD_DLL @@ -64,7 +63,7 @@ LIBS += -lcsserverclientapi \ -lcsutils \ - -ls60qconversions \ + -lxqutils \ -lconvergedmessageutils \ -lmsgs \ -lInetProtUtil \ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/msghistory/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/msghistory/tsrc/tsrc.pro Thu Jul 22 16:32:06 2010 +0100 @@ -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 += msghistorytest/msghistorytest.pro + +# Platforms +SYMBIAN_PLATFORMS = DEFAULT \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/msgplugin/inc/ccsmsghandler.h --- a/messagingapp/msgappfw/plugins/msgplugin/inc/ccsmsghandler.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/plugins/msgplugin/inc/ccsmsghandler.h Thu Jul 22 16:32:06 2010 +0100 @@ -114,7 +114,13 @@ * Checks if the MTM type supported */ TBool IsMtmSupported(long uid); - + + /** + * Read all message Id in iMessageArray + * @aFolderId - Folder Id whose message need to be sync. + */ + void UpdateMessageArrayL(const TMsvId& aFolderId); + private: /** @@ -175,11 +181,6 @@ RPointerArray& addressList); /** - * Cleanup - */ - void CleanupL(); - - /** * Extracts the Message type based on the MTM value * @param aEntry, TMsvEntry */ @@ -232,21 +233,6 @@ TMsvEntry iPrevEntry; /** - * Root entry - */ - CMsvEntry* iRootEntry; - - /** - * Mesage count - */ - TInt iMessageCount; - - /** - * Messages under root entry - */ - CMsvEntrySelection* iMessages; - - /** * Master array for holding all the messages */ RArray* iMessageArray; diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/msgplugin/src/ccsmsghandler.cpp --- a/messagingapp/msgappfw/plugins/msgplugin/src/ccsmsghandler.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/plugins/msgplugin/src/ccsmsghandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -21,6 +21,7 @@ // USER INCLUDES #include "ccsmsghandler.h" #include "msgbiouids.h" +#include "ccsdefs.h" // SYSTEM INCLUDES #include @@ -68,7 +69,12 @@ CCsMsgHandler::~CCsMsgHandler() { PRINT ( _L("Enter CCsMsgHandler::~CCsMsgHandler") ); - + if(iIdle) + { + iIdle->Cancel(); + delete iIdle; + iIdle=NULL; + } if(iMsgPluginUtility) { delete iMsgPluginUtility; @@ -107,19 +113,6 @@ iSession = NULL; } - if ( iRootEntry ) - { - delete iRootEntry; - iRootEntry = NULL; - } - - if ( iMessages ) - { - iMessages->Reset(); - delete iMessages; - iMessages = NULL; - } - if(iMessageArray) { iMessageArray->Reset(); @@ -146,7 +139,7 @@ iMsgPluginUtility = CCsMsgPluginUtility::NewL(); - iConverstationEntryList = new(ELeave)RPointerArray(); + iConverstationEntryList = new(ELeave) RPointerArray(1); iMtmRegistry = CClientMtmRegistry::NewL( *iSession ); @@ -160,8 +153,6 @@ iMessageArray = new (ELeave)RArray (KMessageArrayGranularity); - iMessageCount = 0; - PRINT ( _L("End CCsMsgHandler::ConstructL") ); } @@ -201,12 +192,15 @@ entry.Parent() == KMsvSentEntryIdValue || entry.Parent() == KMsvGlobalOutBoxIndexEntryIdValue ) { + CleanupResetAndDestroyPushL(addressList); + iMsgPluginUtility->CreateContactL(iSession, entry, addressList); //process entry ExtractAddressesL(entry, ERead, addressList); - - addressList.ResetAndDestroy(); + + // Cleanup addressList + CleanupStack::PopAndDestroy(&addressList); } PRINT ( _L("Exit CCsMsgHandler::ProcessResultsL") ); @@ -348,6 +342,7 @@ if ( aParent == KMsvSentEntryIdValue || aParent == KMsvGlobalInBoxIndexEntryIdValue ) { + CleanupResetAndDestroyPushL(addressList); // currently server needs number, so getting it from header iMsgPluginUtility->CreateContactL(iSession, entry, addressList); @@ -356,7 +351,7 @@ // entry created in sent already exists, hence an update ExtractAddressesL(entry, EUpdate, addressList); - addressList.ResetAndDestroy(); + CleanupStack::PopAndDestroy(&addressList); } //for drafts and outbox, the entry changes multiple times, @@ -372,6 +367,7 @@ // as it is going to appear in sent items if( ECsSendStateSent != iMsgPluginUtility->GetSendState(entry) ) { + CleanupResetAndDestroyPushL(addressList); // currently server needs number, so getting it from header iMsgPluginUtility->CreateContactL(iSession, entry, addressList); @@ -382,7 +378,7 @@ iPrevEntry = entry; - addressList.ResetAndDestroy(); + CleanupStack::PopAndDestroy(&addressList); } }//end check changed entry } @@ -408,13 +404,11 @@ if (aContact.Length()>0) { - contact = aContact.AllocL(); - CleanupStack::PushL(contact); + contact = aContact.AllocLC(); } if (aDescription.Length()>0) { - sDescription = aDescription.AllocL(); - CleanupStack::PushL(sDescription); + sDescription = aDescription.AllocLC(); } //use utility to create conversation entry @@ -504,7 +498,7 @@ aEntry.iBioType != KUidMsgSubTypeMmsAudioMsg.iUid ) || aEntry.iMtm == KSenduiMtmBtUid ) { - tmpBuffer = aEntry.iDescription.AllocL(); + tmpBuffer = aEntry.iDescription.AllocLC(); description.Set( tmpBuffer->Des() ); } else if ( aEntry.iMtm == KSenduiMtmSmsUid ) @@ -514,7 +508,7 @@ CRichText& body = iSmsMtm->Body(); TInt smsLength = body.DocumentLength(); - tmpBuffer = HBufC::NewL(smsLength); + tmpBuffer = HBufC::NewLC(smsLength); TPtr ptr(tmpBuffer->Des()); body.Extract(ptr, 0); description.Set( tmpBuffer->Des() ); @@ -522,7 +516,7 @@ else if ( aEntry.iMtm == KSenduiMtmMmsUid || aEntry.iMtm == KSenduiMMSNotificationUid) { - tmpBuffer = aEntry.iDescription.AllocL(); + tmpBuffer = aEntry.iDescription.AllocLC(); description.Set( tmpBuffer->Des() ); iMmsMtm->SwitchCurrentEntryL( aEntry.Id() ); @@ -568,8 +562,12 @@ // Unknown ProcessEntryL(aEvent, KNullDesC, description, aEntry); } - - delete tmpBuffer; + + //Cleanup tmpBuffer + if ( tmpBuffer ) + { + CleanupStack::PopAndDestroy(); + } PRINT ( _L("Exit CCsMsgHandler::ExtractAddressesL") ); } @@ -589,108 +587,59 @@ // ----------------------------------------------------------------------------- // TInt CCsMsgHandler::UploadMsgL() -{ + { + //Release scheduler for scheduling. + User::After(1); + switch ( iState ) - { - case EReadInbox: { - iRootEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId); - - // Set sort order - TMsvSelectionOrdering order; - order.SetSorting(EMsvSortById); - iRootEntry->SetSortTypeL(order); - - iMessages = iRootEntry->ChildrenL(); - iMessageCount = iRootEntry->Count(); - if(iMessageCount) + case EReadInbox: { - for(int i = 0; i < iMessageCount; i ++) - { - iMessageArray->Append(iMessages->At(i)); - } + UpdateMessageArrayL(KMsvGlobalInBoxIndexEntryId); + iState = EReadSent; + return 1; } - iState = EReadSent; - CleanupL(); - - return 1; - } - case EReadSent: - { - iRootEntry = iSession->GetEntryL(KMsvSentEntryId); - - // Set sort order - TMsvSelectionOrdering order; - order.SetSorting(EMsvSortById); - iRootEntry->SetSortTypeL(order); - - iMessages = iRootEntry->ChildrenL(); - iMessageCount = iRootEntry->Count(); - if(iMessageCount) { - for(int i = 0; i < iMessageCount; i++ ) - { - iMessageArray->Append(iMessages->At(i)); - } + UpdateMessageArrayL(KMsvSentEntryId); + iState = EReadOutbox; + return 1; } - iState = EReadOutbox; - CleanupL(); - - return 1; - } - case EReadOutbox: - { - iRootEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId); - - // Set sort order - TMsvSelectionOrdering order; - order.SetSorting(EMsvSortById); - iRootEntry->SetSortTypeL(order); - - iMessages = iRootEntry->ChildrenL(); - iMessageCount = iRootEntry->Count(); - - if(iMessageCount) { - for(int i = 0; i < iMessageCount; i ++) - { - iMessageArray->Append(iMessages->At(i)); - } - iMessageCount=0; + UpdateMessageArrayL(KMsvGlobalOutBoxIndexEntryId); + iState = ESortEntries; + return 1; } - iState = ESortEntries; - CleanupL(); - - return 1; - } case ESortEntries: - { - //Sort the elements in the array by descending order of TMsvId's + { + //Sort the elements in the array by descending order of TMsvId's TLinearOrder order(CompareOrder); iMessageArray->Sort(order); iState = EProcessEntries; return 1; - } - + } case EProcessEntries: - { + { //Process one entry at a time in sequence //Process the first element in the array on each call, till the end if(iMessageArray->Count()) - { - ProcessResultsL(iSession->GetEntryL(iMessageArray->operator[](0))->Entry()); + { + CMsvEntry* msvEntry= iSession-> + GetEntryL(iMessageArray->operator[](0)); + CleanupStack::PushL(msvEntry); + ProcessResultsL(msvEntry->Entry()); + CleanupStack::PopAndDestroy(msvEntry); iMessageArray->Remove(0); - } + } else - { + { + iMessageArray->Reset(); iMsgObserver->HandleCachingCompleted(); return 0; //DONE - } - + } iState = EProcessEntries; return 1; } @@ -722,36 +671,19 @@ iState = EReadInbox; TCallBack callback = TCallBack(UploadMsg, (TAny*) this); - iIdle = CIdle::NewL(CActive::EPriorityLow); + + if(iIdle) + { + delete iIdle; + iIdle = NULL; + } + iIdle = CIdle::NewL(CActive::EPriorityIdle); iIdle->Start(callback); PRINT ( _L("End CCsMsgHandler::Start") ); } // ----------------------------------------------------------------------------- -// CCsMsgHandler::CleanupL() -// Helper function for state machine cleanup -// ----------------------------------------------------------------------------- -// -void CCsMsgHandler::CleanupL() - { - if ( iRootEntry ) - { - delete iRootEntry; - iRootEntry = NULL; - } - - if ( iMessages ) - { - iMessages->Reset(); - delete iMessages; - iMessages = NULL; - } - - iMessageCount = 0; - } - -// ----------------------------------------------------------------------------- // CCsMsgHandler::IsMtmSupported() // // ----------------------------------------------------------------------------- @@ -823,14 +755,52 @@ else if (aEntry.iBioType == KMsgBioUidVCalendar.iUid) { type = ECsBioMsg_VCal; - } - } - break; - default: - type = ECsUnknown; - break; + } + else if (aEntry.iBioType == KMsgBioNokiaServiceMessage.iUid) { + type = ECsBioMgs_NokiaService; } - return (type); + } + break; + default: + type = ECsUnknown; + break; + } + return (type); +} +// ----------------------------------------------------------------------------- +// void CCsMsgHandler::UpdateMessageArrayL(const TMsvId& aFolderId) +// Update iMessageArray with the message ID before upload message to csserver. +// ----------------------------------------------------------------------------- +// +void CCsMsgHandler::UpdateMessageArrayL(const TMsvId& aFolderId) + { + CMsvEntry* msvEntry = iSession->GetEntryL(aFolderId); + CleanupStack::PushL(msvEntry); + // Set sort order + TMsvSelectionOrdering order; + order.SetSorting(EMsvSortById); + msvEntry->SetSortTypeL(order); + + CMsvEntrySelection* messages = msvEntry->ChildrenL(); + // Cleanup msvEntry + CleanupStack::PopAndDestroy(msvEntry); + CleanupStack::PushL(messages); + + TInt messageCount = messages->Count(); + + // In case of large number of message caching + // to avoid multiple reallocation alloc memory + // one shot. + if( messageCount > KMessageArrayGranularity) + iMessageArray->Reserve(messageCount); + + for(int i = 0; i < messageCount; i ++) + { + TMsvId msgId=messages->At(i); + iMessageArray->Append(msgId); + } + // Cleanup messages + CleanupStack::PopAndDestroy(messages); } // End of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/msgplugin/src/ccsmsgpluginutility.cpp --- a/messagingapp/msgappfw/plugins/msgplugin/src/ccsmsgpluginutility.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/plugins/msgplugin/src/ccsmsgpluginutility.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -72,10 +72,13 @@ CleanupStack::PushL(conversationEntry); //set the values - conversationEntry->SetContactL( *aContact ); + if(aContact) + conversationEntry->SetContactL( *aContact ); conversationEntry->SetEntryId( aEnryId ); conversationEntry->SetTimeStampL( aTimeStamp ); + if (aDescription) { conversationEntry->SetDescriptionL( *aDescription ); + } conversationEntry->SetConversationDir( MapDirection( aDir ) ); conversationEntry->SetSendState( aSendState ); conversationEntry->ChangeAttributes( aMsgAttribs, ECsAttributeNone ); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/msgplugin/tsrc/conf/test_plugin.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/conf/test_plugin.cfg Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,72 @@ +/* +* ============================================================================== +* Name : test_plugin.cfg +* Part of : plugin / test_plugin +* Description : plugin related test cases +* Version: : % version:1 % +* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* ============================================================================ +*/ + +[Test] +title 1. CreateCcsPluginL +create test_plugin testplugin +testplugin CreateCcsPluginL +delete testplugin +[Endtest] + + +[Test] +title 2. CreateCCsMsgL +create test_plugin testplugin +testplugin CreateCCsMsgL +delete testplugin +[Endtest] + + +[Test] +title 3. CacheFromCcsPluginL +create test_plugin testplugin +testplugin CacheFromCcsPluginL +delete testplugin +[Endtest] + +[Test] +title 4. SmsMsgPluginValidationL +create test_plugin testplugin +testplugin SmsMsgPluginValidationL +delete testplugin +[Endtest] + + +[Test] +title 5. SendCcsMessageL +create test_plugin testplugin +testplugin SendCcsMessageL +delete testplugin +[Endtest] + + +[Test] +title 6. MmsMsgPluginValidationL +create test_plugin testplugin +testplugin MmsMsgPluginValidationL +delete testplugin +[Endtest] + +[Test] +title 7. BioMsgPluginValidationL +create test_plugin testplugin +testplugin BioMsgPluginValidationL +delete testplugin +[Endtest] diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/msgplugin/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/group/bld.inf Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + +#define BLD_INF_GROUP_0496D339 + + +prj_platforms + +WINSCW GCCE ARMV5 ARMV6 + +prj_testmmpfiles + +test_plugin.mmp + +prj_extensions + + +#if defined(WINSCW) +#else +#endif + + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/msgplugin/tsrc/group/test_plugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/group/test_plugin.mmp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,98 @@ +/*TYPE TESTCLASS*//* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// To get the OSEXT_LAYER_SYSTEMINCLUDE-definition +#include +#include + + +TARGET test_plugin.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E4 + +CAPABILITY ALL -TCB + +//TARGETPATH ?target_path +DEFFILE test_plugin.def + +#ifdef SBSV2 + USERINCLUDE ../inc + + #if defined(__S60_) + + #else // __S60_ not defined + SYSTEMINCLUDE /epoc32/include + SYSTEMINCLUDE /epoc32/include/internal + #endif // __S60_ + + SOURCEPATH ../src +#else // SBSV2 not defined + USERINCLUDE ..\inc + + #if defined(__S60_) + OSEXT_LAYER_SYSTEMINCLUDE + #else // __S60_ not defined + SYSTEMINCLUDE \epoc32\include + SYSTEMINCLUDE \epoc32\include\internal + #endif // __S60_ + + SOURCEPATH ..\src +#endif // SBSV2 + +SOURCEPATH ../src +SOURCE test_plugin.cpp +SOURCE test_pluginblocks.cpp +SOURCE ..\..\src\proxy.cpp +SOURCE ..\..\src\ccsmsg.cpp +SOURCE ..\..\src\ccsmsgpluginutility.cpp +SOURCE ..\..\src\ccsmsghandler.cpp + +USERINCLUDE ..\inc +USERINCLUDE ..\..\inc +USERINCLUDE ..\..\..\..\..\conversationserver\csserver\inc +USERINCLUDE ..\..\..\..\..\conversationserver\csutils\inc +USERINCLUDE ..\..\..\..\..\..\..\os\buildtools\devlib\devlibhelp\examples\SysLibs\CentRepExample +USERINCLUDE ..\..\..\..\..\messagingappbase\obexmtms\TObexMTM\INC +USERINCLUDE ..\..\..\..\..\..\inc +USERINCLUDE ..\..\..\..\utils\inc +USERINCLUDE ..\..\..\..\..\..\..\..\mw\messagingmw\messagingfw\msgtest\testutils\sms\inc + + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY efsrv.lib + + +LIBRARY eCom.lib +DEBUGLIBRARY flogger.lib + +LIBRARY csutils.lib +// Msg Server +LIBRARY Smcm.lib +LIBRARY gsmu.lib +LIBRARY etext.lib +LIBRARY msgs.lib +LIBRARY sendas2.lib + +LANG SC + + +// End of File diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/msgplugin/tsrc/group/test_plugin.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/group/test_plugin.pkg Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,41 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Header +#{"TestPlugin"}, (0x101FB3E3), 1, 2, 3, TYPE=SP + +;Language - standard language definitions +&EN + +;Vendor ID +:"Nokia Corporation" + +;Localised vendor +%{"Vendor-EN"} + +;Supports Series 60 v 0.9 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +;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" + +;CFG FILES +"..\conf\test_plugin.cfg" -"c:\Testframework\test_plugin.cfg" + + +"\EPOC32\RELEASE\ARMV5\UREL\test_plugin.dll" -"!:\sys\bin\test_plugin.dll" + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/msgplugin/tsrc/inc/test_plugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/inc/test_plugin.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,244 @@ +/* +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies 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 header for CS Message Plugin +#*/ + +#ifndef TEST_PLUGIN_H_ +#define TEST_PLUGIN_H_ + +// INCLUDES +#include +#include +#include +#include + +// USER INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// Logging path +_LIT( KTestPluginLogPath, "\\logs\\testframework\\test_plugin\\" ); +// Log file +_LIT( KTestPluginTestLogFile, "test_plugin.txt" ); +_LIT( KTestPluginTestLogFileWithTitle, "test_plugin_[%S].txt" ); + +// FORWARD DECLARATIONS +class CCsMsg; +class CCsMsgHandler; +class CCsMsgPluginUtility; +class MCsMsgObserver; +class CCsConversationEntry; +class CCsMsgPluginUtility; +class CMsvSession; +class CClientMtmRegistry; +class CSmsClientMtm; +class CMmsClientMtm; +class CMsvMimeHeaders; +class CAsyncWaiter; +class CMmsSettings; + +/** + * Message plugin class + **/ + +NONSHARABLE_CLASS(Ctest_plugin) : public CScriptBase,public MCsPluginEventObserver,public MMsvSessionObserver + { + private: + + /** + * C++ default constructor. + */ + Ctest_plugin(CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt ExampleL( CStifItemParser& aItem ); + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Ctest_plugin* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + * */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + /** + * Destructor. + */ + virtual ~Ctest_plugin(); + + private: // Data + + CCsMsg* iPlugin; + + /** + * MsvServer session object + */ + CMsvSession* iSession; + + /** + * Mtm registry object + */ + CClientMtmRegistry* iMtmRegistry; + + /** + * Sms Client mtm object + */ + CSmsClientMtm* iSmsClientMtm; + + /** + * MMS Client mtm object + */ + CMmsClientMtm* iMmsClientMtm; + + /** + * List contains the CCsConversationEntry objects that needs to be + * verified with the list obtained from sms plugin + */ + RPointerArray iTestConversationEntryList; + + /** + * List obtained from sms plugin + */ + RPointerArray iResultConversationEntryList; + + + public://Mcsplugineventobserver + /** + * AddConversations. + * Handle Conversation event from Plugins + * @param aConversationEntryLists List of conversation entries. + */ + void AddConversations(const RPointerArray& aConversationEntryLists); + + /** + * ModifyConversations. + * Update Conversation event from Plugins + * @param aConversationEntryLists List of conversation entries. + */ + void ModifyConversations(const RPointerArray& aConversationEntryLists); + + /** + * DeleteConversations. + * Delete Conversation event from Plugins + * @param aConversationEntryLists List of conversation entries. + */ + void DeleteConversations(const RPointerArray& aConversationEntryLists); + /** + * CachingCompleted. + * Caching complete event from Plugins + */ + void CachingCompleted(); + + /** + * CachingError. + * Caching error event from Plugins + * @param aError Caching Error infomation. + */ + void CachingError(const TInt aError) ; + + /** + * RefreshConversations + * Refresh all data from this plugin. + */ + void RefreshConversations(); + + public://from MmsvSessionObserver + /** + * Handles the MsvServer updates. Implemented for MMsvSessionObserver + */ + void HandleSessionEventL(TMsvSessionEvent aEvent, TAny *aArg1, TAny *aArg2, TAny *aArg3); + + public: + + virtual TInt CreateCCsMsgL( CStifItemParser& aItem ); + virtual TInt SendCcsMessageL( CStifItemParser& /*aItem*/ ); + virtual TInt CacheFromCcsPluginL( CStifItemParser& /*aItem*/ ); + virtual TInt CreateCcsPluginL( CStifItemParser& /*aItem*/ ); + virtual TInt SmsMsgPluginValidationL( CStifItemParser& aItem ); + virtual TInt MmsMsgPluginValidationL( CStifItemParser& aItem ); + virtual TInt BioMsgPluginValidationL( CStifItemParser& aItem ); + + TInt Compare(CCsConversationEntry *aResult, CCsConversationEntry *aTest); + /** + * Cleans messages from all foldes + */ + void CleanAllFoldersL(); + + /** + * Populates the messages in different folders which are used + * to verify the caching logic of ccs plugin + */ + void CreateInitialCacheL(); + + /** + * Cleans messages from the specified folder + * @param aBoxId , folder from where messages has to be deleted + * @param aDeleteOne , if set only one message is deleted + */ + void CleanMessagesInFolderL(TMsvId aBoxId ,TBool aDeleteOne = EFalse); + + /** + * Creates messages in the different folders and populates + * the iTestConversationEntryList + * @param aFolderId , the folder in which message is to be created + * @param aUnReadFlag , Used while creating message in inbox folder + */ + void CreateMessageL(const TMsvId aFolderId,TBool aUnReadFlag = EFalse); + void CreateMmsMessageL(const TMsvId aFolderId,TBool aUnReadFlag = EFalse); + void HandleAttachementL(CMsvStore* store,TFileName& sourceFileName ); + void CreateSmartMessageL(const TMsvId aFolderId,TBool aUnReadFlag = EFalse); + }; + +#endif /* TEST_PLUGIN_H_ */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/msgplugin/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/init/TestFramework.ini Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,44 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start + +[New_Module] +ModuleName= testscripter +TestCaseFile= C:\testframework\test_plugin.cfg +[End_Module] + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/msgplugin/tsrc/src/test_plugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/src/test_plugin.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,149 @@ +/* +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies 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 class for CS Message Plugin +# +*/ + + +// INCLUDE FILES +#include +#include "test_plugin.h" +#include + +// ----------------------------------------------------------------------------- +// Ctest_plugin::Ctest_plugin +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- + +Ctest_plugin::Ctest_plugin( CTestModuleIf& aTestModuleIf ) : CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// + +void Ctest_plugin::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KTestPluginTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KTestPluginTestLogFile); + } + + iLog = CStifLogger::NewL( KTestPluginLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + iSession = CMsvSession::OpenSyncL( *this); + iMtmRegistry = CClientMtmRegistry::NewL( *iSession ); + iSmsClientMtm = STATIC_CAST( CSmsClientMtm*, iMtmRegistry->NewMtmL( KUidMsgTypeSMS )); + + iMmsClientMtm = STATIC_CAST( CMmsClientMtm*, iMtmRegistry->NewMtmL( KUidMsgTypeMultimedia )); + iPlugin = NULL; + + TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles ); + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Ctest_plugin* Ctest_plugin::NewL( + CTestModuleIf& aTestModuleIf ) + { + Ctest_plugin* self = new (ELeave) Ctest_plugin( aTestModuleIf ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::~Cimcache_test +// Destructor +// ----------------------------------------------------------------------------- +// +Ctest_plugin::~Ctest_plugin() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +// ---------------------------------------------------------------------------- + // Ctest_plugin::HandleSessionEventL + // Implemented for MMsvSessionObserver + // ---------------------------------------------------------------------------- + // +void Ctest_plugin::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, + TAny */*aArg1*/, + TAny */*aArg2*/, + TAny */*aArg3*/) + { + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + return ( CScriptBase* ) Ctest_plugin::NewL( aTestModuleIf ); + } + + +// End of File diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/msgplugin/tsrc/src/test_pluginblocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/src/test_pluginblocks.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,985 @@ +/* +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies 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 CS Message Plugin +#*/ + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "test_plugin.h" +#include "CCsPlugin.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Ctest_plugin::Delete +// +// ----------------------------------------------------------------------------- +// +void Ctest_plugin::Delete() + { + iResultConversationEntryList.ResetAndDestroy(); + iResultConversationEntryList.Close(); + + iTestConversationEntryList.ResetAndDestroy(); + iTestConversationEntryList.Close(); + + if( iPlugin ) + { + delete iPlugin; + iPlugin = NULL; + } + + if (iSession) + { + delete iSession; + iSession = NULL; + } + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::RunMethodL +// +// ----------------------------------------------------------------------------- +// +TInt Ctest_plugin::RunMethodL( CStifItemParser& aItem ) + { + TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + ENTRY( "Example", Ctest_plugin::ExampleL ), + ENTRY( "CacheFromCcsPluginL", Ctest_plugin::CacheFromCcsPluginL ), + ENTRY( "CreateCCsMsgL", Ctest_plugin::CreateCCsMsgL ), + + ENTRY( "CreateCcsPluginL", Ctest_plugin::CreateCcsPluginL ), + ENTRY( "SendCcsMessageL", Ctest_plugin::SendCcsMessageL ), + ENTRY( "SmsMsgPluginValidationL", Ctest_plugin::SmsMsgPluginValidationL), + ENTRY( "MmsMsgPluginValidationL",Ctest_plugin::MmsMsgPluginValidationL), + ENTRY( "BioMsgPluginValidationL",Ctest_plugin::BioMsgPluginValidationL) + + }; + + const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); + return RunInternalL( KFunctions, count, aItem ); + } + +// ----------------------------------------------------------------------------- +// Ctestsmsplugin::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Ctest_plugin::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( Ktestplugin, "testplugin" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, Ktestplugin, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString ( string ) == KErrNone ) + { + TestModuleIf().Printf( i, Ktestplugin, + KParam, i, &string ); + i++; + } + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::CreateCCsMsgL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Ctest_plugin::CreateCCsMsgL( CStifItemParser& /*aItem*/ ) + { + + // Print to UI + _LIT( Ktestplugin, "CreateCCsMsgL" ); + _LIT( KFunction, "In CreateCCsMsgL" ); + TestModuleIf().Printf( 0, Ktestplugin, KFunction ); + // Print to log file + iLog->Log( KFunction ); + iPlugin = CCsMsg::NewL(this); + iPlugin->GetConversationsL(); + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::CacheFromCcsPluginL +// Creates the ccs plugin and initiates the caching +// ----------------------------------------------------------------------------- +// +TInt Ctest_plugin::CacheFromCcsPluginL( CStifItemParser& /*aItem*/ ) + { + // Print to UI + _LIT( Ktestplugin, "CacheFromCcsPluginL" ); + _LIT( KFunction, "In CacheFromCcsPluginL" ); + TestModuleIf().Printf( 0, Ktestplugin, KFunction ); + // Print to log file + iLog->Log( KFunction ); + + iTestConversationEntryList.ResetAndDestroy(); + iResultConversationEntryList.ResetAndDestroy(); + + iPlugin = CCsMsg::NewL(this); + iPlugin->GetConversationsL(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::CreateCcsPluginL +// Creates ccs plugin. +// ----------------------------------------------------------------------------- +// +TInt Ctest_plugin::CreateCcsPluginL( CStifItemParser& /*aItem*/ ) + { + // Print to UI + _LIT( Ktestplugin, "CreateCcsPluginL" ); + _LIT( KFunction, "In CreateCcsPluginL" ); + TestModuleIf().Printf( 0, Ktestplugin, KFunction ); + // Print to log file + iLog->Log( KFunction ); + + iTestConversationEntryList.ResetAndDestroy(); + iResultConversationEntryList.ResetAndDestroy(); + + iPlugin = CCsMsg::NewL(this); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Ctestsmsplugin::SendCcsMessageL +// Send ccs message using RSendAs api +// ----------------------------------------------------------------------------- +// +TInt Ctest_plugin::SendCcsMessageL( CStifItemParser& /*aItem*/ ) + { + // Print to UI + _LIT( Ktestplugin, "SendCcsMessageL" ); + _LIT( KFunction, "In SendCcsMessageL" ); + TestModuleIf().Printf( 0, Ktestplugin, KFunction ); + // Print to log file + iLog->Log( KFunction ); + + iTestConversationEntryList.ResetAndDestroy(); + iResultConversationEntryList.ResetAndDestroy(); + + RSendAs sendas; + CleanupClosePushL(sendas); + TInt res = sendas.Connect(); + User::LeaveIfError(res); + + RSendAsMessage message; + CleanupClosePushL(message); + TRAP(res, message.CreateL(sendas, KUidMsgTypeSMS)); + User::LeaveIfError(res); + + TBuf<512> MsgText; + MsgText.Copy(_L("Message being sent")); + message.SetBodyTextL(MsgText); + TBuf<15> RecAdd; + RecAdd.Copy(_L("123456789")); + message.AddRecipientL(RecAdd,RSendAsMessage::ESendAsRecipientTo ); + + + message.SendMessageAndCloseL(); + CleanupStack::Pop(1); // RMessage + CleanupStack::PopAndDestroy(1); // RSendAs + + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// Ctest_plugin::CreateMmsMessageL +// Creates messages in the different folders and populates the +// iTestConversationEntryList +// ----------------------------------------------------------------------------- +// +void Ctest_plugin::CreateMmsMessageL(const TMsvId aFolderId, + TBool aUnReadFlag) + { + + // create a new object to access an existing entry + CMsvEntry* msvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); + CleanupStack::PushL(msvEntry); + + TMsvId defaultServiceId = 0; + defaultServiceId = iMmsClientMtm->DefaultServiceL(); + + _LIT( KMMSBody, " Hi !!!"); + + CleanupStack::Pop(msvEntry); + iMmsClientMtm->SetCurrentEntryL(msvEntry); + iMmsClientMtm->CreateMessageL(defaultServiceId); + iMmsClientMtm->SetSubjectL(KMMSBody); + + // set some mms defaults + iMmsClientMtm->SetMessageClass(EMmsClassPersonal); + iMmsClientMtm->SetExpiryInterval(86400); + iMmsClientMtm->SetDeliveryTimeInterval(3600); + iMmsClientMtm->SetMessagePriority(EMmsPriorityLow); + iMmsClientMtm->SetSenderVisibility(EMmsMaximumSenderVisibility); + iMmsClientMtm->SetDeliveryReport(EMmsDeliveryReportYes); + iMmsClientMtm->SetReadReply(EMmsReadReplyYes); + + _LIT(KPhoneNumberString,"234567"); + TBuf<15> phoneNumberString; + phoneNumberString.Copy(KPhoneNumberString); + _LIT(KPhoneNumberString1,"mine<98450>"); + _LIT(KResultPhoneNumberString,"98450"); + + if (aFolderId == KMsvGlobalInBoxIndexEntryId) + { + iMmsClientMtm->SetSenderL(KResultPhoneNumberString); + } + + iMmsClientMtm->AddAddresseeL(KResultPhoneNumberString); + + CMsvStore* store = msvEntry->EditStoreL(); + CleanupStack::PushL(store); + + // set body as an attachment + CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL(); + CleanupStack::PushL(mimeHeaders); + mimeHeaders->SetContentTypeL( _L8("text") ); + mimeHeaders->SetContentSubTypeL( _L8("plain") ); + mimeHeaders->SetMimeCharset( KMmsUtf8 ); + mimeHeaders->SetSuggestedFilenameL( _L("body.txt") ); + + MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); + CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // ownership of attachmentInfo will be transferred + CleanupStack::PushL(attachmentInfo); + attachmentInfo->SetAttachmentNameL( _L("body.txt") ); + attachmentInfo->SetMimeTypeL( _L8("text/plain") ); + mimeHeaders->StoreL( *attachmentInfo ); + + RFile textFile; + + CMsvOperationActiveSchedulerWait* waiter = CMsvOperationActiveSchedulerWait::NewLC(); + attachMan.CreateAttachmentL(_L("body.txt"), textFile, attachmentInfo, waiter->iStatus ); + CleanupStack::Pop(); // waiter + CleanupStack::Pop(); // attachmentInfo + CleanupStack::PushL(waiter); + waiter->Start(); + CleanupStack::PopAndDestroy(waiter); + + HBufC8* tempBuf = HBufC8::NewLC( 10 ); + tempBuf->Des().Copy( KMMSBody ); + textFile.Write( tempBuf->Des() ); + textFile.Close(); + CleanupStack::PopAndDestroy(); //tempBuf + + CleanupStack::PopAndDestroy(); //mimeHeaders + + // get the entry of the message + TMsvEntry messageEntry = iMmsClientMtm->Entry().Entry(); + + // set the description field same as the message subject + messageEntry.iDescription.Set( KMMSBody ); + + // save the changes done above + iMmsClientMtm->Entry().ChangeL(messageEntry); + + TFileName attachmentFile( _L("c:\\pictures\\picture123.txt") ); + HandleAttachementL(store,attachmentFile ); + + // save the changes made to the message store + store->CommitL(); + CleanupStack::PopAndDestroy(store); + + // save the message + iMmsClientMtm->SaveMessageL(); + + // final fine tuning + messageEntry.SetAttachment(ETrue); + messageEntry.iDate.HomeTime(); + messageEntry.SetVisible(ETrue); + messageEntry.SetInPreparation(EFalse); + + if( aUnReadFlag ) + { + messageEntry.SetUnread(ETrue); + messageEntry.SetNew(ETrue); + } + else + { + messageEntry.SetUnread(EFalse); + messageEntry.SetNew(EFalse); + } + messageEntry.SetComplete(ETrue); + messageEntry.iServiceId = defaultServiceId; + messageEntry.iRelatedId = 0; + + if (aFolderId == KMsvDraftEntryId) + messageEntry.SetReadOnly(EFalse); + else + messageEntry.SetReadOnly(ETrue); + + messageEntry.iMtmData1 = KMmsMessageMRetrieveConf | KMmsMessageMobileTerminated; + + iMmsClientMtm->Entry().ChangeL(messageEntry); + + } + +void Ctest_plugin:: HandleAttachementL(CMsvStore* store,TFileName& sourceFileName ) + { + + // attachment settings + MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); + CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // ownership of attachmentInfo will be transferred + CleanupStack::PushL(attachmentInfo); + attachmentInfo->SetAttachmentNameL( sourceFileName); + attachmentInfo->SetMimeTypeL(_L8("text") ); + + CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL(); + CleanupStack::PushL(mimeHeaders); + mimeHeaders->SetContentTypeL( _L8("text") ); + mimeHeaders->SetContentSubTypeL( _L8("plain") ); + mimeHeaders->SetMimeCharset( KMmsUtf8 ); + mimeHeaders->StoreL( *attachmentInfo ); + CleanupStack::PopAndDestroy( mimeHeaders ); + + CMsvOperationActiveSchedulerWait* waiter = CMsvOperationActiveSchedulerWait::NewLC(); + TInt err; + TRAP(err, attachMan.AddAttachmentL(sourceFileName, attachmentInfo, waiter->iStatus )); + if (err == KErrNone) + { + waiter->Start(); + CleanupStack::PopAndDestroy(waiter); + CleanupStack::Pop(); // attachmentInfo, the ownership is transferred + } + else + { + CleanupStack::PopAndDestroy(waiter); + CleanupStack::PopAndDestroy(); // attachmentInfo, ownership is not transferred (leave occurs) + _LIT( Ktestplugin, "HandleAttachment" ); + _LIT( KFunction, "In HandleAttachment::Failed" ); + } + + } + + +// ----------------------------------------------------------------------------- +// Ctest_plugin::CreateSmartMessageL +// Creates messages in the different folders and populates the +// iTestConversationEntryList +// ----------------------------------------------------------------------------- +// +void Ctest_plugin::CreateSmartMessageL(const TMsvId aFolderId,TBool aUnReadFlag) +{ + + // create a new object to access an existing entry + CMsvEntry* msvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); + CleanupStack::PushL(msvEntry); + + TMsvId defaultServiceId = 0; + defaultServiceId = iSmsClientMtm->DefaultServiceL(); + + // mtm takes ownership of entry context + CleanupStack::Pop(msvEntry); + iSmsClientMtm->SetCurrentEntryL(msvEntry); + + // create a new message + iSmsClientMtm->CreateMessageL(defaultServiceId); + + // Add addressee + _LIT(KPhoneNumberString,"234567"); + TBuf<15> phoneNumberString; + phoneNumberString.Copy(KPhoneNumberString); + + _LIT(KPhoneNumberString1,"mine<98450>"); + _LIT(KResultPhoneNumberString,"98450"); + + // set the from field to sms header + if (aFolderId == KMsvGlobalInBoxIndexEntryId) + { + CSmsHeader& smsHeader = iSmsClientMtm->SmsHeader(); + smsHeader.SetFromAddressL(KResultPhoneNumberString); + } + + // set body, the BIO message itself + iSmsClientMtm->Body().Reset(); + iSmsClientMtm->Body().InsertL(0, _L("Business Card\nTester Mike\nThe Company Ltd.\nSoftware Engineer\ntel +358 66 1234567\n")); + + // get the entry of the message + TMsvEntry messageEntry = iSmsClientMtm->Entry().Entry(); + + // TO-DO: Add support for all BIO messages, currently just insert a business card message ... : + // set the message type + // parameters.iBIOMessageType ... + iSmsClientMtm->BioTypeChangedL(KMsgBioUidVCard); + messageEntry.iBioType = KMsgBioUidVCard.iUid; + + if (aFolderId == KMsvGlobalInBoxIndexEntryId) + { + iMmsClientMtm->SetSenderL(KResultPhoneNumberString); + } + + _LIT( KBioBody, " Hi !!!"); + + messageEntry.iDescription.Set(KBioBody); + + // set correct MTM type + messageEntry.iMtm= KUidBIOMessageTypeMtm; + + // save the changes done above + iSmsClientMtm->Entry().ChangeL(messageEntry); + + // save the message + iSmsClientMtm->SaveMessageL(); + + // final fine tuning + messageEntry.SetAttachment(EFalse); + messageEntry.iDate.HomeTime(); + messageEntry.SetVisible(ETrue); + messageEntry.SetInPreparation(EFalse); + + if( aUnReadFlag ) + { + messageEntry.SetUnread(ETrue); + messageEntry.SetNew(ETrue); + } + else + { + messageEntry.SetUnread(EFalse); + messageEntry.SetNew(EFalse); + } + + messageEntry.SetComplete(ETrue); + messageEntry.iServiceId = defaultServiceId; + messageEntry.iRelatedId = 0; + iSmsClientMtm->Entry().ChangeL(messageEntry); + + +} + +// ----------------------------------------------------------------------------- +// Ctest_plugin::CreateMessageL +// Creates messages in the different folders and populates the +// iTestConversationEntryList +// ----------------------------------------------------------------------------- +// +void Ctest_plugin::CreateMessageL(const TMsvId aFolderId, + TBool aUnReadFlag) + { + CCsConversationEntry *conversationEntry = CCsConversationEntry::NewL(); + CleanupStack::PushL(conversationEntry); + + //Create entry from this index entry + iSmsClientMtm->SwitchCurrentEntryL( aFolderId ); + iSmsClientMtm->CreateMessageL(KUidMsgTypeSMS.iUid); + + TMsvEntry indexEntry = iSmsClientMtm->Entry().Entry(); + + indexEntry.SetInPreparation(ETrue); + indexEntry.iMtm = KUidMsgTypeSMS; + indexEntry.iType = KUidMsvMessageEntry; + indexEntry.iServiceId = iSmsClientMtm->ServiceId(); + indexEntry.iDate.HomeTime(); + + //AddBody + _LIT( KSMSBody, " Hi,Hello Phone Owner !!!"); + TBuf<160> shortDescription; + shortDescription.Append(KSMSBody); + CRichText& body = iSmsClientMtm->Body(); + body.Reset(); + body.InsertL( 0, KSMSBody ); + indexEntry.iDescription.Set(KSMSBody); + + // Add addressee + _LIT(KPhoneNumberString,"234567"); + TBuf<15> phoneNumberString; + phoneNumberString.Copy(KPhoneNumberString); + + _LIT(KPhoneNumberString1,"mine<98450>"); + _LIT(KResultPhoneNumberString,"98450"); + + if( aFolderId == KMsvDraftEntryId ) + { + iSmsClientMtm->AddAddresseeL(KPhoneNumberString,TPtrC()); + iSmsClientMtm->AddAddresseeL(KPhoneNumberString1,TPtrC()); + + CCsConversationEntry *conversationEntry1 = CCsConversationEntry::NewL(); + conversationEntry->SetContactL(KPhoneNumberString); + conversationEntry->SetEntryId( indexEntry.Id()); + conversationEntry->SetTimeStampL( indexEntry.iDate.Int64()); + conversationEntry->SetDescriptionL(shortDescription); + conversationEntry->ChangeAttributes(ECsAttributeDraft, ECsAttributeNone); + conversationEntry->SetConversationDir(ECsDirectionOutgoing); + conversationEntry->SetSendState( ECsSendStateUnknown ); + conversationEntry->SetType( ECsSMS ); + + conversationEntry1->SetContactL(KResultPhoneNumberString); + conversationEntry1->SetEntryId( indexEntry.Id()); + conversationEntry1->SetTimeStampL( indexEntry.iDate.Int64()); + conversationEntry1->SetDescriptionL(shortDescription); + conversationEntry1->ChangeAttributes(ECsAttributeDraft, ECsAttributeNone); + conversationEntry1->SetConversationDir(ECsDirectionOutgoing); + conversationEntry1->SetSendState( ECsSendStateUnknown ); + conversationEntry1->SetType( ECsSMS ); + + CleanupStack::PushL(conversationEntry1); + iTestConversationEntryList.AppendL(conversationEntry); + iTestConversationEntryList.AppendL(conversationEntry1); + CleanupStack::Pop(conversationEntry1); + } + else if( aFolderId == KMsvGlobalOutBoxIndexEntryId ) + { + iSmsClientMtm->AddAddresseeL(KPhoneNumberString,TPtrC()); + indexEntry.SetSendingState( KMsvSendStateWaiting ); + + conversationEntry->SetContactL(KPhoneNumberString); + conversationEntry->SetEntryId( indexEntry.Id()); + conversationEntry->SetTimeStampL( indexEntry.iDate.Int64()); + conversationEntry->SetDescriptionL(shortDescription); + conversationEntry->SetConversationDir(ECsDirectionOutgoing); + conversationEntry->SetSendState( ECsSendStateWaiting ); + conversationEntry->SetType( ECsSMS ); + + iTestConversationEntryList.AppendL(conversationEntry); + } + else if( aFolderId == KMsvSentEntryId ) + { + CSmsHeader& smsHeader = iSmsClientMtm->SmsHeader(); + smsHeader.SetFromAddressL(KPhoneNumberString); + indexEntry.iDetails.Set( KPhoneNumberString ); + + conversationEntry->SetContactL(KPhoneNumberString); + conversationEntry->SetEntryId( indexEntry.Id()); + conversationEntry->SetTimeStampL( indexEntry.iDate.Int64()); + conversationEntry->SetDescriptionL(shortDescription); + conversationEntry->SetConversationDir(ECsDirectionOutgoing); + conversationEntry->SetSendState( ECsSendStateUnknown ); + conversationEntry->SetType( ECsSMS ); + + iTestConversationEntryList.AppendL(conversationEntry); + } + // final fine tuning + indexEntry.SetAttachment(EFalse); + + indexEntry.SetVisible(ETrue); + indexEntry.SetInPreparation(EFalse); + + if ( aFolderId == KMsvGlobalInBoxIndexEntryId ) + { + CSmsHeader& smsHeader = iSmsClientMtm->SmsHeader(); + smsHeader.SetFromAddressL(KPhoneNumberString); + indexEntry.iDetails.Set( KPhoneNumberString ); + + if( aUnReadFlag ) + { + indexEntry.SetUnread(ETrue); + conversationEntry->SetSendState( ECsSendStateUnknown ); + conversationEntry->ChangeAttributes( ECsAttributeUnread, ECsAttributeNone ); + } + else + { + conversationEntry->SetSendState( ECsSendStateUnknown ); + conversationEntry->ChangeAttributes( ECsAttributeNone, ECsAttributeUnread ); + } + conversationEntry->SetContactL(KPhoneNumberString); + conversationEntry->SetEntryId( indexEntry.Id()); + conversationEntry->SetTimeStampL( indexEntry.iDate.Int64()); + conversationEntry->SetDescriptionL(shortDescription); + conversationEntry->SetConversationDir(ECsDirectionIncoming); + conversationEntry->SetType( ECsSMS ); + + iTestConversationEntryList.AppendL(conversationEntry); + + indexEntry.SetNew(ETrue); + } + + indexEntry.SetComplete(ETrue); + iSmsClientMtm->Entry().ChangeL(indexEntry); + iSmsClientMtm->SaveMessageL(); + + if ( iTestConversationEntryList.Count() == 0 ) + { + CleanupStack::PopAndDestroy(conversationEntry); + } + else + { + CleanupStack::Pop(conversationEntry); + } + + } + + +// ----------------------------------------------------------------------------- +// Ctest_plugin::CacheFromCcsPluginValidationL +// Validates the initial Caching of sms plugin +// ----------------------------------------------------------------------------- +// +TInt Ctest_plugin::SmsMsgPluginValidationL( CStifItemParser& /*aItem*/ ) + { + // Print to UI + _LIT(Ktestplugin, "CacheFromCcsPluginValidationL" ); + _LIT( KFunction, "In CacheFromCcsPluginValidationL" ); + TestModuleIf().Printf( 0, Ktestplugin, KFunction ); + // Print to log file + iLog->Log( KFunction ); + + CleanAllFoldersL(); + CreateInitialCacheL(); + + iPlugin = CCsMsg::NewL(this); + iPlugin->GetConversationsL(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::MmsPluginValidationL +// Validates the initial Caching of sms plugin +// ----------------------------------------------------------------------------- +// +TInt Ctest_plugin::MmsMsgPluginValidationL( CStifItemParser& /*aItem*/ ) + { + // Print to UI + _LIT(Ktestplugin, "MmsPluginValidationL" ); + _LIT( KFunction, "In MmsPluginValidationL" ); + TestModuleIf().Printf( 0, Ktestplugin, KFunction ); + // Print to log file + iLog->Log( KFunction ); + + CleanAllFoldersL(); + + iTestConversationEntryList.ResetAndDestroy(); + iResultConversationEntryList.ResetAndDestroy(); + + CreateMmsMessageL(KMsvGlobalInBoxIndexEntryId); + CreateMmsMessageL(KMsvSentEntryId); + CreateMmsMessageL(KMsvDraftEntryId); + CreateMmsMessageL(KMsvGlobalOutBoxIndexEntryId);; + + iPlugin = CCsMsg::NewL(this); + iPlugin->GetConversationsL(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::BioMsgPluginValidationL +// Validates the initial Caching of sms plugin +// ----------------------------------------------------------------------------- +// +TInt Ctest_plugin::BioMsgPluginValidationL( CStifItemParser& /*aItem*/ ) + { + // Print to UI + _LIT(Ktestplugin, "BioMsgPluginValidationL" ); + _LIT( KFunction, "In BioMsgPluginValidationL" ); + TestModuleIf().Printf( 0, Ktestplugin, KFunction ); + // Print to log file + iLog->Log( KFunction ); + + CleanAllFoldersL(); + + iTestConversationEntryList.ResetAndDestroy(); + iResultConversationEntryList.ResetAndDestroy(); + + CreateSmartMessageL(KMsvGlobalOutBoxIndexEntryId); + CreateSmartMessageL(KMsvSentEntryId); + CreateSmartMessageL(KMsvDraftEntryId); + CreateSmartMessageL(KMsvGlobalOutBoxIndexEntryId); + + iPlugin = CCsMsg::NewL(this); + iPlugin->GetConversationsL(); + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::CleanAllFoldersL +// Cleans messages from all folders +// ----------------------------------------------------------------------------- +void Ctest_plugin::CleanAllFoldersL() + { + CleanMessagesInFolderL(KMsvGlobalInBoxIndexEntryId); + CleanMessagesInFolderL(KMsvGlobalOutBoxIndexEntryId); + CleanMessagesInFolderL(KMsvDraftEntryId); + // CleanMessagesInFolderL(KMsvSentEntryId); + } +// ----------------------------------------------------------------------------- +// Ctest_plugin::CreateInitialCacheL +// Populates the messages in different folders which are used +// to verify the caching logic of ccs plugin +// ----------------------------------------------------------------------------- +void Ctest_plugin::CreateInitialCacheL() + { + + iTestConversationEntryList.ResetAndDestroy(); + iResultConversationEntryList.ResetAndDestroy(); + + CreateMessageL(KMsvGlobalInBoxIndexEntryId); + CreateMessageL(KMsvSentEntryId); + CreateMessageL(KMsvDraftEntryId); + CreateMessageL(KMsvGlobalOutBoxIndexEntryId); + + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::CleanMessagesInFolderL +// Cleans messages from the specified folder +// ----------------------------------------------------------------------------- +void Ctest_plugin::CleanMessagesInFolderL(TMsvId aBoxId,TBool aDeleteOne) + { + iLog->Log(_L("In CleanMessagesInFolderL")); + TInt count; + CMsvEntry* cEntry = NULL; + // delete messages from the specified box + cEntry = iSession->GetEntryL(KMsvRootIndexEntryId); + CleanupStack::PushL(cEntry); + cEntry->SetEntryL(aBoxId); + // show invisible entries + cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) ); + CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeSMS); + CleanupStack::PushL(msvEntrySelection); + + if( aDeleteOne ) + { + count =1; + } + else + { + count = msvEntrySelection->Count(); + } + + for ( int i = 0; i < count ; i++ ) + { + CMsvEntry* entry = iSession->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); + iLog->Log(_L("End of CleanMessagesInFolderL")); + } + + + + +// ----------------------------------------------------------------------------- +// Ctest_plugin::CachingCompleted. +// Caching error event from Plugins +// ----------------------------------------------------------------------------- +// +void Ctest_plugin::CachingError(const TInt /*aError*/) + { + Signal(KErrGeneral); + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::CachingCompleted. +// Caching complete event from Plugins +// ----------------------------------------------------------------------------- +// +void Ctest_plugin::CachingCompleted() + { + if( iTestConversationEntryList.Count() == 0 ) + { + Signal(KErrNone); + return; + } + if( iResultConversationEntryList.Count() != iTestConversationEntryList.Count() ) + { + // Delete(); + Signal(KErrCancel); + } + else + { + TInt i; + for( i=0; i < iResultConversationEntryList.Count() ; i++ ) + { + if( Compare(iResultConversationEntryList[i],iTestConversationEntryList[i] )!=0 ) + { + break; + } + } + if( i == iResultConversationEntryList.Count() ) + { + iTestConversationEntryList.ResetAndDestroy(); + iResultConversationEntryList.ResetAndDestroy(); + Signal(KErrNone); + } + else + { + Signal(KErrNotFound); + } + } + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::Compare +// Compares the conversation entry stored conversation entry with +// the conversation entry returned from sms plugin +// ----------------------------------------------------------------------------- +TInt Ctest_plugin::Compare(CCsConversationEntry *aResult, CCsConversationEntry *aTest) + { + TInt comparison = 0; + + if( aResult->Contact()->Des().Compare(aTest->Contact()->Des()) ) + comparison++; + + if( aResult->EntryId() != aTest->EntryId() ) + comparison ++; + + if( aResult->TimeStamp() != aTest->TimeStamp() ) + comparison++; + + if( aResult->ConversationDir() != aTest->ConversationDir() ) + comparison++; + + if( aResult->GetSendState() != aTest->GetSendState() ) + comparison++; + + if( aResult->GetType() != aTest->GetType() ) + comparison++; + + return comparison; + } + + +// ----------------------------------------------------------------------------- +// Ctest_plugin::AddConversations. +// Handle Conversation event from Plugins +// ----------------------------------------------------------------------------- +// +void Ctest_plugin::AddConversations( + const RPointerArray& aConversationEntryLists) + { + CCsConversationEntry *conversationEntry ; + + for ( TInt i=0; i < aConversationEntryLists.Count(); i++ ) + { + TRAP_IGNORE( + conversationEntry = aConversationEntryLists[i]->CloneL(); + iResultConversationEntryList.AppendL(conversationEntry); + ); + } + + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::ModifyConversations. +// Update Conversation event from Plugins +// ----------------------------------------------------------------------------- +// +void Ctest_plugin::ModifyConversations( + const RPointerArray& aConversationEntryLists) + { + if( iTestConversationEntryList.Count() == 0 ) + { + Signal(KErrNone); + return; + } + //Expecting update for one entry at a time + TInt i; + for( i=0; i < aConversationEntryLists.Count() ; i++ ) + { + if( Compare(aConversationEntryLists[i],iTestConversationEntryList[i] )!=0 ) + { + break; + } + } + if( i == aConversationEntryLists.Count() ) + { + iTestConversationEntryList.ResetAndDestroy(); + iResultConversationEntryList.ResetAndDestroy(); + Signal(KErrNone); + } + else + { + Signal(KErrNotFound); + } + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::DeleteConversations. +// Delete Conversation event from Plugins +// ----------------------------------------------------------------------------- +// + +void Ctest_plugin::DeleteConversations( + const RPointerArray& aConversationEntryLists) + { + if( iTestConversationEntryList.Count() == 0 ) + { + Signal(KErrNone); + return; + } + //Expecting update for one entry at a time + TInt i; + for( i=0; i < aConversationEntryLists.Count() ; i++ ) + { + if( aConversationEntryLists[i]->EntryId() != iTestConversationEntryList[i]->EntryId() ) + { + break; + } + } + if( i == aConversationEntryLists.Count() ) + { + iTestConversationEntryList.ResetAndDestroy(); + iResultConversationEntryList.ResetAndDestroy(); + Signal(KErrNone); + } + else + { + Signal(KErrNotFound); + } + } + +// ----------------------------------------------------------------------------- +// Ctest_plugin::RefreshConversations +// Notify server to refresh conversations. +// ----------------------------------------------------------------------------- +// +void Ctest_plugin::RefreshConversations() + { + + } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/group/cspreviewplugin.mmp --- a/messagingapp/msgappfw/plugins/previewplugin/group/cspreviewplugin.mmp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/plugins/previewplugin/group/cspreviewplugin.mmp Thu Jul 22 16:32:06 2010 +0100 @@ -63,4 +63,6 @@ LIBRARY fbscli.lib LIBRARY estor.lib LIBRARY unidatamodel.lib -LIBRARY charconv.lib \ No newline at end of file +LIBRARY charconv.lib +LIBRARY centralrepository.lib +LIBRARY MsgMedia.lib \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/inc/ccspreviewpluginhandler.h --- a/messagingapp/msgappfw/plugins/previewplugin/inc/ccspreviewpluginhandler.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/plugins/previewplugin/inc/ccspreviewpluginhandler.h Thu Jul 22 16:32:06 2010 +0100 @@ -27,6 +27,7 @@ #include //USER INCLUDES +#include #include "ccspreviewplugin.h" #include "UniDataModel.h" @@ -39,6 +40,13 @@ class CCsPreviewPlugin; class CClientMtmRegistry; class CMmsClientMtm; +class CUniDataModel; +class MMsvAttachmentManager; + +enum MmsConformanceCheckErrors +{ + EInsertSuccess = 0, EInsertQueryAbort, EInsertNotSupported +}; /* * Thumbnail Request Data @@ -149,6 +157,55 @@ void HandleThumbnailReadyL(MThumbnailData& aThumbnail, TThumbnailRequestId aId); + /** + * Validates if message can be forwarded + * The validation checks include slide count check,MMS size check and + * media conformance checks and this fucntion should be called only for mms + * @param aUniDataModel, instance of unidatamodel + * @return true if message can be forwarded + * false if message cant be forwarded + */ + TBool ValidateMsgForForward(CUniDataModel* aUniDataModel); + + /** + * This shall return the particular slide attachments ids + * @param aSlideNum slide count + * @param aUniDataModel instance of unidatamodel + * @return array of attachment id's + */ + RArray* GetSlideAttachmentIds( + TInt aSlideNum, + CUniDataModel* aUniDataModel); + + /** + * This shall return list of attachment id's + * @param aUniDataModel instance of unidatamodel + * @return array of attachment id's + */ + RArray* GetAttachmentIdList( + CUniDataModel* aUniDataModel); + + /** + * This shall check the insert mode for the attachment file + * @param aFileHandle instance of file handle + * @return enum MmsConformanceCheckErrors + */ + TInt CheckModeForInsertL(RFile aFileHandle); + + /** + * Finds the message's processing state + * @param aMsgId, message id + * @return, TInt from TCsPreviewMsgProcessingState enum + */ + TInt msgProcessingState(TMsvId aMsgId); + + /** + * Sets message under processing to true + * @param aMsgId, message id + * @param aState, TInt from TCsPreviewMsgProcessingState enum + */ + void setMsgProcessingState(TMsvId aMsgId, TInt aState); + private: //Data @@ -198,6 +255,22 @@ * Sqlite DB Handle */ RSqlDatabase iSqlDb; - }; + + /** + * Max MMS Size + */ + TInt iMaxMmsSize; + + /* + * Mms creation mode + */ + TInt iCreationMode; + + /** + * Conformance status + */ + TUint32 iConfStatus; + +}; #endif // _C_CS_PREVIEW_PLUGIN_HANDLER_H_ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp --- a/messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -25,6 +25,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include //CONSTANTS //DB-file _LIT(KDbFileName, "c:[2002A542]conversations.db"); @@ -33,16 +40,25 @@ //Size _LIT(KCacheSizeStmnt,"PRAGMA default_cache_size = 1024"); // Create table query statement -_LIT(KSqlCreateStmt, "CREATE TABLE IF NOT EXISTS conversation_messages ( message_id INTEGER PRIMARY KEY, msg_parsed INTEGER DEFAULT 0, subject TEXT(100), body_text TEXT(160), preview_path TEXT, msg_property INTEGER, preview_icon BLOB DEFAULT NULL ) " ); +_LIT(KSqlCreateStmt, "CREATE TABLE IF NOT EXISTS conversation_messages ( message_id INTEGER PRIMARY KEY, msg_processingstate INTEGER DEFAULT 0, subject TEXT(100), body_text TEXT(160), preview_path TEXT, msg_property INTEGER, preview_icon BLOB DEFAULT NULL ) " ); +//Create an empty record for the given message id +_LIT(KSqlBasicInsertStmt, "INSERT OR REPLACE INTO conversation_messages ( message_id ) VALUES( :message_id )"); //Insert without bitmap query -_LIT(KSqlInsertStmt, "INSERT OR REPLACE INTO conversation_messages (message_id, msg_parsed, subject, body_text, preview_path, msg_property ) VALUES( :message_id, :msg_parsed, :subject, :body_text, :preview_path, :msg_property )"); +_LIT(KSqlInsertStmt, "INSERT OR REPLACE INTO conversation_messages ( message_id, msg_processingstate, subject, body_text, preview_path, msg_property ) VALUES( :message_id, :msg_processingstate, :subject, :body_text, :preview_path, :msg_property )"); +//update processing-state flag of a message +_LIT(KSqlUpdateProcessingStateStmt, "UPDATE conversation_messages SET msg_processingstate=:msg_processingstate WHERE message_id=:message_id " ); //update with bitmap query _LIT(KSqlUpdateBitmapStmt, "UPDATE conversation_messages SET preview_icon=:preview_icon WHERE message_id=:message_id " ); -// query to see if msg_parsed is set -_LIT(KSelectMsgParsedStmt, " SELECT message_id, msg_parsed FROM conversation_messages WHERE message_id=:message_id "); +// query to see if msg is under process at the moment +_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"); +const TInt KDefaultMaxSize = 300 * 1024; +//Preview thumbnail size +const TInt KWidth = 9.5 * 6.7; +const TInt KHeight = 9.5 * 6.7; + // NOTE:- DRAFTS ENTRIES ARE NOT HANDLED IN THE PLUGIN // ============================== MEMBER FUNCTIONS ============================ @@ -162,6 +178,23 @@ User::LeaveIfError(error); } + //get the max size of mms from the repository + TRAP_IGNORE( + CRepository* repository = CRepository::NewL(KCRUidMmsEngine); + CleanupStack::PushL(repository); + + //Fetch and set max mms composition size + TInt maxSize = KDefaultMaxSize; + repository->Get( KMmsEngineMaximumSendSize, maxSize ); + iMaxMmsSize = maxSize; + + //Fetch and set creation mode + TInt creationMode = EMmsCreationModeRestricted; + repository->Get(KMmsEngineCreationMode, creationMode); + iCreationMode = creationMode; + + CleanupStack::PopAndDestroy(repository); + ); PRINT ( _L("End CCsPreviewPluginHandler::ConstructL") ); } @@ -259,28 +292,17 @@ TInt msgId = entry.Id(); - //check if the message is already parsed - RSqlStatement sqlSelectStmt; - CleanupClosePushL(sqlSelectStmt); - sqlSelectStmt.PrepareL(iSqlDb,KSelectMsgParsedStmt); - TInt messageIdIndex = sqlSelectStmt.ParameterIndex( - _L(":message_id")); - - User::LeaveIfError(sqlSelectStmt.BindInt(messageIdIndex, msgId)); - - if (sqlSelectStmt.Next() == KSqlAtRow) + // check if the msg is already under processing Or processed + if( EPreviewMsgNotProcessed != msgProcessingState(msgId) ) { - TInt parsedColIndex = sqlSelectStmt.ColumnIndex( - _L("msg_parsed")); - TInt msgParsed = sqlSelectStmt.ColumnInt(parsedColIndex); - //if message alresdy parsed, move to next message. - if (msgParsed) - { - CleanupStack::PopAndDestroy(&sqlSelectStmt); - continue; - } + // skip processing this event for the given message + continue; } - CleanupStack::PopAndDestroy(&sqlSelectStmt); + else + { + // start processing message, set flag + setMsgProcessingState(msgId, EPreviewMsgProcessing); + } // update db with message preview data RSqlStatement sqlInsertStmt; @@ -303,6 +325,13 @@ 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; @@ -321,6 +350,7 @@ { CUniObject *obj = iUniDataModel->SmilModel(). GetObjectByIndex(i, j); + CMsgMediaInfo *mediaInfo = obj->MediaInfo(); TPtrC8 mimetype = obj->MimeType(); TMsvAttachmentId attachId = obj->AttachmentId(); @@ -335,31 +365,63 @@ } //image parsing - if (!isImageSet && (mimetype.Find(_L8("image")) + if (!isVideoSet && !isImageSet && (mimetype.Find(_L8("image")) != KErrNotFound)) { //get thumbnail for this image - GetThumbNailL(attachId, mimetype, msgId); isImageSet = ETrue; - imagePath.Set(obj->MediaInfo()->FullFilePath()); + 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 (!isAudioSet && (mimetype.Find(_L8("audio")) + 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 (!isVideoSet && (mimetype.Find(_L8("video")) + if (!( isImageSet || isAudioSet) && !isVideoSet && (mimetype.Find(_L8("video")) != KErrNotFound)) { - videoPath.Set(obj->MediaInfo()->FullFilePath()); + videoPath.Set(mediaInfo->FullFilePath()); isVideoSet = ETrue; msgProperty |= EPreviewVideo; + if (EFileProtNoProtection != mediaInfo->Protection()) + { + msgProperty |= EPreviewProtectedVideo; + } + if (mediaInfo->Corrupt()) + { + msgProperty |= EPreviewCorruptedVideo; + } } } } @@ -393,10 +455,9 @@ User::LeaveIfError(sqlInsertStmt.BindInt(msgPropertyIndex, msgProperty)); - //msg-parsed - TInt msgParsedIndex = sqlInsertStmt.ParameterIndex( - _L(":msg_parsed")); - User::LeaveIfError(sqlInsertStmt.BindInt(msgParsedIndex, 1)); // 1 as true + //msg_processingstate + TInt msgProcessingStateIndex = sqlInsertStmt.ParameterIndex(_L(":msg_processingstate")); + User::LeaveIfError(sqlInsertStmt.BindInt(msgProcessingStateIndex, EPreviewMsgProcessed)); //execute sql stament User::LeaveIfError(sqlInsertStmt.Exec()); @@ -505,6 +566,180 @@ CleanupStack::PopAndDestroy(2,&sqlInsertStmt);//sqlInsertStmt,previewIconStream } +TBool CCsPreviewPluginHandler::ValidateMsgForForward(CUniDataModel* aUniDataModel) +{ + TBool retValue = ETrue; + + //1. Check the slide count more than 1 + if (aUniDataModel->SmilModel().SlideCount() > 1) + { + retValue = EFalse; + return retValue; + } + + //2. message sixe check + //Fetch and set max mms composition size + if (iMmsMtm->MessageSize() > iMaxMmsSize) + { + retValue = EFalse; + return retValue; + } + + //3. If there is restricted content then return false + RArray* pathList = GetSlideAttachmentIds( + 0, + aUniDataModel); + + CleanupStack::PushL(pathList); + + for (int i = 0; i < pathList->Count(); i++) + { + TMsvAttachmentId aId = (*pathList)[i]; + CMsvStore * store = iMmsMtm->Entry().ReadStoreL(); + CleanupStack::PushL(store); + MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); + RFile fileHandle = attachMan.GetAttachmentFileL(aId); + //close the store + CleanupStack::PopAndDestroy(store); + + if (CheckModeForInsertL(fileHandle) != EInsertSuccess) + { + retValue = EFalse; + break; + } + } + + if (retValue == EFalse) + { + CleanupStack::PopAndDestroy(pathList); + return retValue; + } + + CleanupStack::Pop(pathList); + delete pathList; + pathList = NULL; + + //4. check the same case for all attachments + pathList = GetAttachmentIdList(aUniDataModel); + CleanupStack::PushL(pathList); + + for (int i = 0; i < pathList->Count(); i++) + { + TMsvAttachmentId aId = (*pathList)[i]; + CMsvStore * store = iMmsMtm->Entry().ReadStoreL(); + CleanupStack::PushL(store); + MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); + RFile fileHandle = attachMan.GetAttachmentFileL(aId); + //close the store + CleanupStack::PopAndDestroy(store); + + if (CheckModeForInsertL(fileHandle) != EInsertSuccess) + { + retValue = EFalse; + break; + } + } + + CleanupStack::PopAndDestroy(pathList); + return retValue; +} + +RArray* +CCsPreviewPluginHandler::GetSlideAttachmentIds(TInt aSlideNum, + CUniDataModel* aUniDataModel) +{ + TInt slideObjectCount = + aUniDataModel->SmilModel().SlideObjectCount(aSlideNum); + + RArray *attachmentIdList = new (ELeave) RArray< + TMsvAttachmentId> (); + for (TInt i = 0; i < slideObjectCount; i++) + { + CUniObject *obj = + aUniDataModel->SmilModel().GetObjectByIndex(aSlideNum, i); + attachmentIdList->Append(obj->AttachmentId()); + } + return attachmentIdList; +} + +RArray* +CCsPreviewPluginHandler::GetAttachmentIdList(CUniDataModel* aUniDataModel) +{ + TInt attcount = aUniDataModel->AttachmentList().Count(); + RArray *attachmentIdList = new (ELeave) RArray< + TMsvAttachmentId> (); + + for (TInt i = 0; i < attcount; i++) + { + CUniObject *obj = aUniDataModel->AttachmentList().GetByIndex(i); + + attachmentIdList->AppendL(obj->AttachmentId()); + } + return attachmentIdList; +} + +TInt CCsPreviewPluginHandler::CheckModeForInsertL(RFile aFileHandle) +{ + CleanupClosePushL(aFileHandle); + + CMmsConformance* mmsConformance = CMmsConformance::NewL(); + mmsConformance->CheckCharacterSet(EFalse); + + CleanupStack::PushL(mmsConformance); + + CMsgMediaResolver* mediaResolver = CMsgMediaResolver::NewL(); + mediaResolver->SetCharacterSetRecognition(EFalse); + + CleanupStack::PushL(mediaResolver); + + CMsgMediaInfo* info = mediaResolver->CreateMediaInfoL(aFileHandle); + mediaResolver->ParseInfoDetailsL(info, aFileHandle); + + TMmsConformance conformance = mmsConformance->MediaConformance(*info); + iConfStatus = conformance.iConfStatus; + + CleanupStack::PopAndDestroy(3); + + // In "free" mode user can insert images that are larger by dimensions than allowed by conformance + if (iCreationMode != EMmsCreationModeRestricted) + { + TInt i = EMmsConfNokFreeModeOnly | EMmsConfNokScalingNeeded + | EMmsConfNokTooBig; + TInt j = ~ (EMmsConfNokFreeModeOnly | EMmsConfNokScalingNeeded + | EMmsConfNokTooBig); + + // 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) + { + // SuperDistribution not checked here + // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode + iConfStatus &= ~EMmsConfNokFreeModeOnly; + iConfStatus &= ~EMmsConfNokScalingNeeded; + } + else + { + delete info; + //query not accepted. Stop insertion. + return EInsertQueryAbort; + } + } + } + else if (iConfStatus & EMmsConfNokDRM || iConfStatus + & EMmsConfNokNotEnoughInfo || iConfStatus & EMmsConfNokNotSupported + || iConfStatus & EMmsConfNokFreeModeOnly || iConfStatus + & EMmsConfNokCorrupt) + { + delete info; + return EInsertNotSupported; + } + + delete info; + return EInsertSuccess; +} + //----------------------------------------------------------------------------- // CCsPreviewPluginHandler::CompareByRequestId // Compare to conversation entry object based on Entry Ids @@ -562,8 +797,10 @@ { //Scale the image iThumbnailManager->SetFlagsL(CThumbnailManager::ECropToAspectRatio); - // Preferred size is 100x100 (or less) - iThumbnailManager->SetThumbnailSizeL(TSize(100, 100)); + + //TODO replace with hb-param-graphic-size-image-portrait * value of un in pixcels + iThumbnailManager->SetThumbnailSizeL(TSize(KWidth, KHeight)); + //optimize for performace iThumbnailManager->SetQualityPreferenceL( CThumbnailManager::EOptimizeForPerformance); @@ -592,5 +829,70 @@ CleanupStack::PopAndDestroy(4, mimeInfo);//mimeInfo,store,file,source } +// ----------------------------------------------------------------------------- +// CCsPreviewPluginHandler::msgProcessingState +// +// ----------------------------------------------------------------------------- +// +TInt CCsPreviewPluginHandler::msgProcessingState(TMsvId aMsgId) +{ + TInt retState = EPreviewMsgNotProcessed; + + // sql-statement to check if msg's under processing flag is set or not + RSqlStatement sqlSelectStmt; + CleanupClosePushL(sqlSelectStmt); + sqlSelectStmt.PrepareL(iSqlDb,KSelectProcessingStateStmt); + + TInt msgIdIndex = sqlSelectStmt.ParameterIndex(_L(":message_id")); + User::LeaveIfError(sqlSelectStmt.BindInt(msgIdIndex, aMsgId)); + + // read the flag + TInt msgProcessingStateIndex = sqlSelectStmt.ColumnIndex(_L("msg_processingstate")); + if (sqlSelectStmt.Next() == KSqlAtRow) + { + retState = static_cast(sqlSelectStmt.ColumnInt(msgProcessingStateIndex)); + } + else + { + // this is first event for this msgid, hence record doesn't exist + // create an empty record, so that we can set & use flags + RSqlStatement sqlBasicInsertStmt; + CleanupClosePushL(sqlBasicInsertStmt); + sqlBasicInsertStmt.PrepareL(iSqlDb, KSqlBasicInsertStmt); + TInt index_msgid = sqlBasicInsertStmt.ParameterIndex(_L(":message_id")); + User::LeaveIfError(sqlBasicInsertStmt.BindInt(index_msgid, aMsgId)); + User::LeaveIfError(sqlBasicInsertStmt.Exec()); + CleanupStack::PopAndDestroy(&sqlBasicInsertStmt); + } + // cleanup + CleanupStack::PopAndDestroy(&sqlSelectStmt); + return retState; +} + +// ----------------------------------------------------------------------------- +// CCsPreviewPluginHandler::setMsgProcessingState +// +// ----------------------------------------------------------------------------- +// +void CCsPreviewPluginHandler::setMsgProcessingState(TMsvId aMsgId, TInt aState) +{ + // sql-statment to set/reset msg's under processing flag + RSqlStatement sqlUpdateStmt; + CleanupClosePushL(sqlUpdateStmt); + sqlUpdateStmt.PrepareL(iSqlDb, KSqlUpdateProcessingStateStmt); + + TInt msgIdIndex = sqlUpdateStmt.ParameterIndex(_L(":message_id")); + User::LeaveIfError(sqlUpdateStmt.BindInt(msgIdIndex, aMsgId)); + + // bind data + TInt msgProcessingStateIndex = sqlUpdateStmt.ParameterIndex(_L(":msg_processingstate")); + User::LeaveIfError(sqlUpdateStmt.BindInt(msgProcessingStateIndex, aState)); + + // execute the statement + User::LeaveIfError(sqlUpdateStmt.Exec()); + // cleanup + CleanupStack::PopAndDestroy(&sqlUpdateStmt); +} + // End of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/tsrc/.cproject --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/.cproject Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/tsrc/.project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/.project Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,20 @@ + + + test_pluginpreview + + + + + + com.nokia.carbide.cdt.builder.carbideCPPBuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + com.nokia.carbide.cdt.builder.carbideCPPBuilderNature + com.nokia.carbide.cdt.builder.carbideSBSv2BuilderNature + + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/tsrc/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/Makefile Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,90 @@ +# ============================================================================== +# Generated by qmake (2.01a) (Qt 4.6.2) on: Fri Apr 16 15:48:22 2010 +# This file is generated by qmake and should not be modified by the +# user. +# Name : Makefile +# Description : Wrapper Makefile for calling Symbian build tools +# +# ============================================================================== + + +MAKEFILE = Makefile +QMAKE = r:\epoc32\tools\qt\qmake.exe +DEL_FILE = del +DEL_DIR = rmdir +MOVE = move +DEBUG_PLATFORMS = winscw armv5 +RELEASE_PLATFORMS = armv5 +MAKE = make +SBS = sbs + +DEFINES = -DSYMBIAN -DUNICODE -DQT_KEYPAD_NAVIGATION -DQT_SOFTKEYS_ENABLED -DQT_USE_MATH_H_FLOATS -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB +INCPATH = -I"R:/epoc32/include/mw/QtCore" -I"R:/epoc32/include/mw/QtGui" -I"R:/epoc32/include/mw" -I"R:/sf/mw/qt/mkspecs/common/symbian" -I"R:/epoc32/include" -I"R:/epoc32/include/stdapis" -I"R:/epoc32/include/stdapis/sys" -I"R:/epoc32/include/platform/mw" -I"R:/epoc32/include/platform" -I"R:/epoc32/include/platform/loc" -I"R:/epoc32/include/platform/mw/loc" -I"R:/epoc32/include/platform/loc/sc" -I"R:/epoc32/include/platform/mw/loc/sc" -I"R:/epoc32/include/app" -I"R:/epoc32/include/platform/app" -I"R:/epoc32/include/platform/app/loc" -I"R:/epoc32/include/platform/app/loc/sc" -I"R:/sf/app/messaging/messagingapp/msgappfw/plugin/tsrc" -I"R:/epoc32/include/stdapis/stlportv5" +first: default +default: debug-winscw +all: debug release + +qmake: + $(QMAKE) -spec symbian-sbsv2 -o "bld.inf" "R:/sf/app/messaging/messagingapp/msgappfw/plugin/tsrc/test_plugin.pro" + +bld.inf: + $(QMAKE) + +debug: bld.inf + $(SBS) -c winscw_udeb.mwccinc -c armv5_udeb +release: bld.inf + $(SBS) -c armv5_urel +debug-winscw: bld.inf + $(SBS) -c winscw_udeb.mwccinc +debug-armv5: bld.inf + $(SBS) -c armv5_udeb +release-armv5: bld.inf + $(SBS) -c armv5_urel + +export: bld.inf + $(SBS) export + +cleanexport: bld.inf + $(SBS) cleanexport + + + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all +FORCE: + +-include .make.cache + +sis: + $(if $(wildcard test_plugin_template.pkg),$(if $(wildcard .make.cache),$(MAKE) -s -f $(MAKEFILE) ok_sis,$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) ok_sis,$(MAKE) -s -f $(MAKEFILE) fail_sis_nocache)),$(MAKE) -s -f $(MAKEFILE) fail_sis_nopkg) + +ok_sis: + createpackage.bat $(QT_SIS_OPTIONS) test_plugin_template.pkg $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE) + +fail_sis_nopkg: + $(error PKG file does not exist, 'SIS' target is only supported for executables or projects with DEPLOYMENT statement) + +fail_sis_nocache: + $(error Project has to be built or QT_SIS_TARGET environment variable has to be set before calling 'SIS' target) + +dodistclean: + -@ if EXIST "r:\sf\app\messaging\messagingapp\msgappfw\plugin\tsrc\Makefile" $(DEL_FILE) "r:\sf\app\messaging\messagingapp\msgappfw\plugin\tsrc\Makefile" + -@ if EXIST "r:\sf\app\messaging\messagingapp\msgappfw\plugin\tsrc\bld.inf" $(DEL_FILE) "r:\sf\app\messaging\messagingapp\msgappfw\plugin\tsrc\bld.inf" + +distclean: clean dodistclean + +clean: bld.inf + -$(SBS) reallyclean + +clean-debug: bld.inf + $(SBS) reallyclean -c winscw_udeb -c armv5_udeb +clean-release: bld.inf + $(SBS) reallyclean -c armv5_urel +clean-debug-winscw: bld.inf + $(SBS) reallyclean -c winscw_udeb +clean-debug-armv5: bld.inf + $(SBS) reallyclean -c armv5_udeb +clean-release-armv5: bld.inf + $(SBS) reallyclean -c armv5_urel + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/tsrc/conf/test_pluginpreview.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/conf/test_pluginpreview.cfg Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,43 @@ +/* +* ============================================================================== +* Name : test_pluginpreview.cfg +* Part of : plugin / test_plugin +* Description : plugin related test cases +* Version: : % version:1 % +* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* ============================================================================ +*/ + +[Test] +title 1. CreateCCsPreviewPluginL +create test_pluginpreview testplugin +testplugin CreateCCsPreviewPluginL +delete testplugin +[Endtest] + + +[Test] +title 2. MmsMsgPluginValidationL +create test_pluginpreview testplugin +testplugin MmsMsgPluginValidationL +delete testplugin +[Endtest] + + +[Test] +title 3. SendMmsMessageL +create test_pluginpreview testplugin +testplugin SendMmsMessageL +delete testplugin +[Endtest] + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/bld.inf Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + +#define BLD_INF_GROUP_0496D339 + + +prj_platforms + +WINSCW GCCE ARMV5 ARMV6 + +prj_testmmpfiles + +test_pluginpreview.mmp + +prj_extensions + + +#if defined(WINSCW) +#else +#endif + + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.mmp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// To get the OSEXT_LAYER_SYSTEMINCLUDE-definition +#include +#include + + +TARGET test_pluginpreview.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3D3 + +CAPABILITY ALL -TCB + +//TARGETPATH ?target_path +DEFFILE test_plugin.def + +#ifdef SBSV2 + USERINCLUDE ../inc + + #if defined(__S60_) + + #else // __S60_ not defined + SYSTEMINCLUDE /epoc32/include + SYSTEMINCLUDE /epoc32/include/internal + #endif // __S60_ + + SOURCEPATH ../src +#else // SBSV2 not defined + USERINCLUDE ..\inc + + #if defined(__S60_) + OSEXT_LAYER_SYSTEMINCLUDE + #else // __S60_ not defined + SYSTEMINCLUDE \epoc32\include + SYSTEMINCLUDE \epoc32\include\internal + #endif // __S60_ + + SOURCEPATH ..\src +#endif // SBSV2 + +SOURCEPATH ../src +SOURCE test_pluginpreview.cpp +SOURCE test_pluginpreviewblocks.cpp +SOURCE ..\..\src\ccspreviewplugin.cpp +SOURCE ..\..\src\ccspreviewpluginhandler.cpp +SOURCE ..\..\src\proxy.cpp + +USERINCLUDE ..\inc +USERINCLUDE ..\..\inc +USERINCLUDE ..\..\..\..\..\msgutils\unidatautils\unidatamodel\inc +USERINCLUDE ..\..\..\..\..\..\messagingappbase\obexmtms\TObexMTM\INC + +APP_LAYER_SYSTEMINCLUDE +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY eCom.lib +LIBRARY csutils.lib +LIBRARY efsrv.lib + +DEBUGLIBRARY flogger.lib + +// Msg Server +LIBRARY Smcm.lib +LIBRARY gsmu.lib +LIBRARY etext.lib +LIBRARY msgs.lib +LIBRARY sqldb.lib +LIBRARY thumbnailmanager.lib +LIBRARY fbscli.lib +LIBRARY estor.lib +LIBRARY unidatamodel.lib +LIBRARY charconv.lib +LIBRARY sendas2.lib + +SYSTEMINCLUDE \epoc32\include\internal + +LIBRARY cone.lib +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY flogger.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY imcm.lib +LIBRARY msgs.lib +LIBRARY charconv.lib + +// Msg Server +LIBRARY Smcm.lib +LIBRARY gsmu.lib +LIBRARY etext.lib +LIBRARY msgs.lib +LIBRARY sqldb.lib +LIBRARY thumbnailmanager.lib +LIBRARY fbscli.lib +LIBRARY estor.lib +LIBRARY unidatamodel.lib +LIBRARY charconv.lib +LIBRARY centralrepository.lib +LIBRARY MsgMedia.lib + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.pkg Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,41 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Header +#{"Testcache"}, (0x101FB3E3), 1, 2, 3, TYPE=SP + +;Language - standard language definitions +&EN + +;Vendor ID +:"Nokia Corporation" + +;Localised vendor +%{"Vendor-EN"} + +;Supports Series 60 v 0.9 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +;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" + +;CFG FILES +"..\conf\test_plugin.cfg" -"c:\Testframework\test_plugin.cfg" + + +"\EPOC32\RELEASE\ARMV5\UREL\test_plugin.dll" -"!:\sys\bin\test_plugin.dll" + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/tsrc/inc/test_pluginpreview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/inc/test_pluginpreview.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,232 @@ + +/* +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies 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 header for CS Preview Plugin +#*/ + +#ifndef TEST_PLUGINPREVIEW_H_ +#define TEST_PLUGINPREVIEW_H_ + +// INCLUDES +#include +#include +#include +#include + +// USER INCLUDE +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include + +// Logging path +_LIT( KTestPluginLogPath, "\\logs\\testframework\\test_pluginpreview\\" ); +// Log file +_LIT( KTestPluginTestLogFile, "test_pluginpreview.txt" ); +_LIT( KTestPluginTestLogFileWithTitle, "test_pluginpreview_[%S].txt" ); + + +// FORWARD DECLARATION +class CCsPlugin; +class CMsvSession; +class MCsPluginEventObserver; +class MMsvSessionObserver; +class CCsConversationEntry; +class CCsPreviewPlugin; +class CClientMtmRegistry; +class CMmsClientMtm; +class MCsPluginEventObserver; +class CCsPreviewPluginHandler; + +/** + * Message plugin class + **/ + +NONSHARABLE_CLASS(Ctest_pluginpreview) : public CScriptBase,public MMsvSessionObserver,public MThumbnailManagerObserver,public MCsPluginEventObserver,public MUniDataModelObserver +{ + + private: + + /** + * C++ default constructor. + */ + Ctest_pluginpreview(CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt ExampleL( CStifItemParser& aItem ); + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Ctest_pluginpreview* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + * */ + + virtual TInt RunMethodL( CStifItemParser& aItem ); + /** + * Destructor. + */ + virtual ~Ctest_pluginpreview(); + + private: + + CCsPreviewPlugin* iPlugin; + + /** + * MsvServer session object + * Own + */ + CMsvSession* iSession; + + /** + * Mtm registry object + * Own + */ + CClientMtmRegistry* iMtmRegistry; + + /** + * Mms client mtm object + * Own. + */ + CMmsClientMtm* iMmsMtm; + CThumbnailManager* iThumbnailManager; + + public: + + /** + * HandleCachingCompleted + * Sends the cache completed status to server + */ + void HandleCachingCompleted(); + + /** + * HandleCachingError + * Sends the error occured during the caching to server + */ + void HandleCachingError(const TInt aError); + + public: + //MMsvSessionObserver + /** + * Handles the MsvServer updates. Implemented for MMsvSessionObserver + */ + void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, + TAny* aArg2, TAny* aArg3); + + public: + //MUniDataModelObserver + /** + */ + void RestoreReady(TInt aParseResult, TInt aError); + + public://Mcsplugineventobserver + /** + * AddConversations. + * Handle Conversation event from Plugins + * @param aConversationEntryLists List of conversation entries. + */ + void AddConversations(const RPointerArray& /*aConversationEntryLists*/){} + + /** + * ModifyConversations. + * Update Conversation event from Plugins + * @param aConversationEntryLists List of conversation entries. + */ + void ModifyConversations(const RPointerArray& /*aConversationEntryLists*/){} + + /** + * DeleteConversations. + * Delete Conversation event from Plugins + * @param aConversationEntryLists List of conversation entries. + */ + void DeleteConversations(const RPointerArray& /*aConversationEntryLists*/){} + /** + * CachingCompleted. + * Caching complete event from Plugins + */ + void CachingCompleted(){} + + /** + * CachingError. + * Caching error event from Plugins + * @param aError Caching Error infomation. + */ + void CachingError(const TInt /*aError*/) {} + + /** + * RefreshConversations + * Refresh all data from this plugin. + */ + void RefreshConversations(){} + + public: + // Callbacks from MThumbnailManagerObserver for getting thumbnails + void ThumbnailPreviewReady(MThumbnailData& aThumbnail, + TThumbnailRequestId aId); + + void ThumbnailReady(TInt aError, MThumbnailData& aThumbnail, + TThumbnailRequestId aId); + public: + + virtual TInt CreateCCsPreviewPluginL( CStifItemParser& /*aItem*/ ); + virtual TInt MmsMsgPluginValidationL( CStifItemParser& /*aItem*/ ); + virtual TInt SendMmsMessageL( CStifItemParser& /*aItem*/ ); + + void CleanAllFoldersL(); + void CreateMmsMessageL(const TMsvId aFolderId,TBool aUnReadFlag = EFalse); + void HandleAttachementL(CMsvStore* store,TFileName& sourceFileName ); + void CleanMessagesInFolderL(TMsvId aBoxId ,TBool aDeleteOne = EFalse); + // void CreateInitialCacheL(); + }; + +#endif /* test_pluginpreview_H_ */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/init/TestFramework.ini Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,44 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start + +[New_Module] +ModuleName= testscripter +TestCaseFile= C:\testframework\test_pluginpreview.cfg +[End_Module] + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/tsrc/src/test_pluginpreview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/src/test_pluginpreview.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,155 @@ +/* +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Test class for CS Preview Plugin +# +*/ + + +// INCLUDE FILES +#include +#include "test_pluginpreview.h" +#include + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::Ctest_pluginpreview +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- + +Ctest_pluginpreview::Ctest_pluginpreview( CTestModuleIf& aTestModuleIf ) : CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// + +void Ctest_pluginpreview::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KTestPluginTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KTestPluginTestLogFile); + } + + iLog = CStifLogger::NewL( KTestPluginLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + //create msv session + iSession = CMsvSession::OpenSyncL(*this); + + //create mtm registry + iMtmRegistry = CClientMtmRegistry::NewL(*iSession); + + //create mms client mtm + iMmsMtm = static_cast (iMtmRegistry-> NewMtmL(KSenduiMtmMmsUid)); + + //create thumbnail manager + // iThumbnailManager = CThumbnailManager::NewL(*this); + + + TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles ); + } + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Ctest_pluginpreview* Ctest_pluginpreview::NewL( CTestModuleIf& aTestModuleIf ) + { + Ctest_pluginpreview* self = new ( ELeave ) Ctest_pluginpreview( aTestModuleIf ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::~Ctest_pluginpreview +// Destructor +// ----------------------------------------------------------------------------- +// +Ctest_pluginpreview::~Ctest_pluginpreview() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +// ---------------------------------------------------------------------------- + // Ctest_pluginpreview::HandleSessionEventL + // Implemented for MMsvSessionObserver + // ---------------------------------------------------------------------------- + // +void Ctest_pluginpreview::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, + TAny */*aArg1*/, + TAny */*aArg2*/, + TAny */*aArg3*/) + { + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + return ( CScriptBase* ) Ctest_pluginpreview::NewL( aTestModuleIf ); + } + + +// End of File diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/plugins/previewplugin/tsrc/src/test_pluginpreviewblocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/src/test_pluginpreviewblocks.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,482 @@ +/* +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies 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 CS Preview Plugin +#*/ + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "test_pluginpreview.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::Delete +// +// ----------------------------------------------------------------------------- +// +void Ctest_pluginpreview::Delete() + { + + + } + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::RunMethodL +// +// ----------------------------------------------------------------------------- +// +TInt Ctest_pluginpreview::RunMethodL( CStifItemParser& aItem ) + { + TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + ENTRY( "Example", Ctest_pluginpreview::ExampleL ), + ENTRY( "CreateCCsPreviewPluginL",Ctest_pluginpreview::CreateCCsPreviewPluginL), + ENTRY( "MmsMsgPluginValidationL", Ctest_pluginpreview::MmsMsgPluginValidationL), + ENTRY( "SendMmsMessageL", Ctest_pluginpreview::SendMmsMessageL) + + }; + + const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); + return RunInternalL( KFunctions, count, aItem ); + } + +// ----------------------------------------------------------------------------- +// Ctestsmsplugin::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Ctest_pluginpreview::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( Ktestplugin, "testpluginpreview" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, Ktestplugin, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString ( string ) == KErrNone ) + { + TestModuleIf().Printf( i, Ktestplugin, + KParam, i, &string ); + i++; + } + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::CreateCCsPreviewPluginL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Ctest_pluginpreview::CreateCCsPreviewPluginL( CStifItemParser& /*aItem*/ ) + { + + // Print to UI + _LIT( Ktestplugin, "CreateCCsPreviewPlugin" ); + _LIT( KFunction, "In CreateCCsPreviewPlugin" ); + TestModuleIf().Printf( 0, Ktestplugin, KFunction ); + // Print to log file + iLog->Log( KFunction ); + iPlugin = CCsPreviewPlugin::NewL(this); + iPlugin->GetConversationsL(); + return KErrNone; + + } + + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::ThumbnailPreviewReady() +// callback +// ----------------------------------------------------------------------------- +// +void Ctest_pluginpreview::ThumbnailPreviewReady(MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/) + { + + } + + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::ThumbnailReady() +// +// ----------------------------------------------------------------------------- +// +void Ctest_pluginpreview::ThumbnailReady(TInt aError,MThumbnailData& aThumbnail, TThumbnailRequestId aId) + { + + } + + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::RestoreReady() +// +// ----------------------------------------------------------------------------- +// +void Ctest_pluginpreview::RestoreReady(TInt /*aParseResult*/, TInt /*aError*/) + { + + } + + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::HandleCachingError +// Caching error event from Plugins +// ----------------------------------------------------------------------------- +// + +void Ctest_pluginpreview::HandleCachingError(const TInt /*aError*/) + { + Signal(KErrGeneral); + } + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::HandleCachingCompleted +// Caching complete event from Plugins +// ----------------------------------------------------------------------------- +// + +void Ctest_pluginpreview::HandleCachingCompleted() + { + + + + } + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::MmsMsgPluginValidationL +// Validates the initial Caching of sms plugin +// ----------------------------------------------------------------------------- +// +TInt Ctest_pluginpreview::MmsMsgPluginValidationL( CStifItemParser& /*aItem*/ ) + { + // Print to UI + _LIT(Ktestplugin, "MmsPluginValidationL" ); + _LIT( KFunction, "In MmsPluginValidationL" ); + TestModuleIf().Printf( 0, Ktestplugin, KFunction ); + // Print to log file + iLog->Log( KFunction ); + + CleanAllFoldersL(); + CreateMmsMessageL(KMsvGlobalInBoxIndexEntryId); + CreateMmsMessageL(KMsvSentEntryId); + CreateMmsMessageL(KMsvDraftEntryId); + CreateMmsMessageL(KMsvGlobalOutBoxIndexEntryId);; + + iPlugin = CCsPreviewPlugin::NewL(this); + iPlugin->GetConversationsL(); + + return KErrNone; + + } + + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::CleanAllFoldersL +// Cleans messages from all folders +// ----------------------------------------------------------------------------- + +void Ctest_pluginpreview::CleanAllFoldersL() + { + CleanMessagesInFolderL(KMsvGlobalInBoxIndexEntryId); + CleanMessagesInFolderL(KMsvGlobalOutBoxIndexEntryId); + CleanMessagesInFolderL(KMsvDraftEntryId); + // CleanMessagesInFolderL(KMsvSentEntryId); + } + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::CreateMmsMessageL +// Creates message +// ----------------------------------------------------------------------------- +// + +void Ctest_pluginpreview::CreateMmsMessageL(const TMsvId aFolderId,TBool aUnReadFlag) + { + + // create a new object to access an existing entry + CMsvEntry* msvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); + CleanupStack::PushL(msvEntry); + + TMsvId defaultServiceId = 0; + defaultServiceId = iMmsMtm->DefaultServiceL(); + + _LIT( KMMSBody, " HELLO !!!"); + + CleanupStack::Pop(msvEntry); + iMmsMtm->SetCurrentEntryL(msvEntry); + iMmsMtm->CreateMessageL(defaultServiceId); + iMmsMtm->SetSubjectL(KMMSBody); + + // set some mms defaults + iMmsMtm->SetMessageClass(EMmsClassPersonal); + iMmsMtm->SetExpiryInterval(86400); + iMmsMtm->SetDeliveryTimeInterval(3600); + iMmsMtm->SetMessagePriority(EMmsPriorityLow); + iMmsMtm->SetSenderVisibility(EMmsMaximumSenderVisibility); + iMmsMtm->SetDeliveryReport(EMmsDeliveryReportYes); + iMmsMtm->SetReadReply(EMmsReadReplyYes); + + _LIT(KPhoneNumberString,"234567"); + TBuf<15> phoneNumberString; + phoneNumberString.Copy(KPhoneNumberString); + _LIT(KPhoneNumberString1,"mine<98450>"); + _LIT(KResultPhoneNumberString,"98450"); + + if (aFolderId == KMsvGlobalInBoxIndexEntryId) + { + iMmsMtm->SetSenderL(KResultPhoneNumberString); + } + + iMmsMtm->AddAddresseeL(KResultPhoneNumberString); + + CMsvStore* store = msvEntry->EditStoreL(); + CleanupStack::PushL(store); + + // set body as an attachment + CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL(); + CleanupStack::PushL(mimeHeaders); + mimeHeaders->SetContentTypeL( _L8("image/jpg") ); + mimeHeaders->SetContentSubTypeL( _L8("image/jpg") ); + mimeHeaders->SetMimeCharset( KMmsUtf8 ); + mimeHeaders->SetSuggestedFilenameL( _L("body.jpg") ); + + MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); + CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // ownership of attachmentInfo will be transferred + CleanupStack::PushL(attachmentInfo); + attachmentInfo->SetAttachmentNameL( _L("body.txt") ); + attachmentInfo->SetMimeTypeL( _L8("image/jpg") ); + mimeHeaders->StoreL( *attachmentInfo ); + + RFile textFile; + + CMsvOperationActiveSchedulerWait* waiter = CMsvOperationActiveSchedulerWait::NewLC(); + attachMan.CreateAttachmentL(_L("body.jpg"), textFile, attachmentInfo, waiter->iStatus ); + CleanupStack::Pop(); // waiter + CleanupStack::Pop(); // attachmentInfo + CleanupStack::PushL(waiter); + waiter->Start(); + CleanupStack::PopAndDestroy(waiter); + + HBufC8* tempBuf = HBufC8::NewLC( 10 ); + tempBuf->Des().Copy( KMMSBody ); + textFile.Write( tempBuf->Des() ); + textFile.Close(); + CleanupStack::PopAndDestroy(); //tempBuf + + CleanupStack::PopAndDestroy(); //mimeHeaders + + // get the entry of the message + TMsvEntry messageEntry = iMmsMtm->Entry().Entry(); + + // set the description field same as the message subject + messageEntry.iDescription.Set( KMMSBody ); + + // save the changes done above + iMmsMtm->Entry().ChangeL(messageEntry); + + TFileName attachmentFile( _L("c:\\pictures\\picture123.jpg") ); + HandleAttachementL(store,attachmentFile ); + + // save the changes made to the message store + store->CommitL(); + CleanupStack::PopAndDestroy(store); + + // save the message + iMmsMtm->SaveMessageL(); + + // final fine tuning + messageEntry.SetAttachment(ETrue); + messageEntry.iDate.HomeTime(); + messageEntry.SetVisible(ETrue); + messageEntry.SetInPreparation(EFalse); + + if( aUnReadFlag ) + { + messageEntry.SetUnread(ETrue); + messageEntry.SetNew(ETrue); + } + else + { + messageEntry.SetUnread(EFalse); + messageEntry.SetNew(EFalse); + } + messageEntry.SetComplete(ETrue); + messageEntry.iServiceId = defaultServiceId; + messageEntry.iRelatedId = 0; + + if (aFolderId == KMsvDraftEntryId) + messageEntry.SetReadOnly(EFalse); + else + messageEntry.SetReadOnly(ETrue); + + messageEntry.iMtmData1 = KMmsMessageMRetrieveConf | KMmsMessageMobileTerminated; + + iMmsMtm->Entry().ChangeL(messageEntry); + + } + + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::CreateMmsMessageL +// Creates message +// ----------------------------------------------------------------------------- +// + +void Ctest_pluginpreview:: HandleAttachementL(CMsvStore* store,TFileName& sourceFileName ) + { + + // attachment settings + MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); + CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // ownership of attachmentInfo will be transferred + CleanupStack::PushL(attachmentInfo); + attachmentInfo->SetAttachmentNameL( sourceFileName); + attachmentInfo->SetMimeTypeL(_L8("image/jpg") ); + + CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL(); + CleanupStack::PushL(mimeHeaders); + mimeHeaders->SetContentTypeL( _L8("image/jpg") ); + mimeHeaders->SetContentSubTypeL( _L8("image/jpg") ); + mimeHeaders->SetMimeCharset( KMmsUtf8 ); + mimeHeaders->StoreL( *attachmentInfo ); + CleanupStack::PopAndDestroy( mimeHeaders ); + + CMsvOperationActiveSchedulerWait* waiter = CMsvOperationActiveSchedulerWait::NewLC(); + TInt err; + TRAP(err, attachMan.AddAttachmentL(sourceFileName, attachmentInfo, waiter->iStatus )); + if (err == KErrNone) + { + waiter->Start(); + CleanupStack::PopAndDestroy(waiter); + CleanupStack::Pop(); // attachmentInfo, the ownership is transferred + } + else + { + CleanupStack::PopAndDestroy(waiter); + CleanupStack::PopAndDestroy(); // attachmentInfo, ownership is not transferred (leave occurs) + _LIT( Ktestplugin, "HandleAttachment" ); + _LIT( KFunction, "In HandleAttachment::Failed" ); + } + + } + +// ----------------------------------------------------------------------------- +// Ctestsmsplugin::SendMmsMessageL +// Send ccs message using RSendAs api +// ----------------------------------------------------------------------------- +// + +TInt Ctest_pluginpreview::SendMmsMessageL( CStifItemParser& /*aItem*/ ) + { + // Print to UI + _LIT( Ktestplugin, "SendCcsMessageL" ); + _LIT( KFunction, "In SendCcsMessageL" ); + TestModuleIf().Printf( 0, Ktestplugin, KFunction ); + // Print to log file + iLog->Log( KFunction ); + + RSendAs sendas; + CleanupClosePushL(sendas); + TInt res = sendas.Connect(); + User::LeaveIfError(res); + + RSendAsMessage message; + CleanupClosePushL(message); + TRAP(res, message.CreateL(sendas,KUidMsgTypeMultimedia)); + User::LeaveIfError(res); + + // TBuf<512> MsgText; + //MsgText.Copy(_L("Message being sent")); + //message.SetBodyTextL(MsgText); + TBuf<15> RecAdd; + RecAdd.Copy(_L("123456789")); + message.AddRecipientL(RecAdd,RSendAsMessage::ESendAsRecipientTo ); + + message.SendMessageAndCloseL(); + CleanupStack::Pop(1); // RMessage + CleanupStack::PopAndDestroy(1); // RSendAs + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Ctest_pluginpreview::CleanMessagesInFolderL +// Cleans messages from the specified folder +// ----------------------------------------------------------------------------- + +void Ctest_pluginpreview::CleanMessagesInFolderL(TMsvId aBoxId,TBool aDeleteOne) + { + + iLog->Log(_L("In CleanMessagesInFolderL")); + TInt count; + CMsvEntry* cEntry = NULL; + // delete messages from the specified box + cEntry = iSession->GetEntryL(KMsvRootIndexEntryId); + CleanupStack::PushL(cEntry); + cEntry->SetEntryL(aBoxId); + // show invisible entries + cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) ); + CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeSMS); + CleanupStack::PushL(msvEntrySelection); + + if( aDeleteOne ) + { + count =1; + } + else + { + count = msvEntrySelection->Count(); + } + + for ( int i = 0; i < count ; i++ ) + { + CMsvEntry* entry = iSession->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); + iLog->Log(_L("End of CleanMessagesInFolderL")); + + } + + + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/backup_registration.xml Binary file messagingapp/msgappfw/server/backup_registration.xml has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/inc/ccsbackuphandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/server/inc/ccsbackuphandler.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,41 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + +#include +#include + +class CCsServer; + +class CCsBackUpHandler: public CBase, public MBackupObserver +{ +public: + static CCsBackUpHandler* NewL(CCsServer& aServer); + ~CCsBackUpHandler(); + // from MBackupObserver + virtual void ChangeFileLockL(const TDesC& aFileAffected, TFileLockFlags aFlags); + +private: + void ConstructL(); + CCsBackUpHandler(CCsServer& aServer); + void CloseConversationsDbL(); + void OpenConversationsDbL(); + +private: + CBaBackupSessionWrapper* iBackup; + TFileName iFileName; + CCsServer& iServer; +}; + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/inc/ccscontactsmanager.h --- a/messagingapp/msgappfw/server/inc/ccscontactsmanager.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/inc/ccscontactsmanager.h Thu Jul 22 16:32:06 2010 +0100 @@ -19,6 +19,7 @@ // SYSTEM INCLUDES #include +#include #include "qtcontactsglobal.h" // USER INCLUDES #include "mcscontactsmanagerobserver.h" diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/inc/ccscontactsresolver.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/inc/ccsconversation.h --- a/messagingapp/msgappfw/server/inc/ccsconversation.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/inc/ccsconversation.h Thu Jul 22 16:32:06 2010 +0100 @@ -139,7 +139,7 @@ */ void AddContactDetailsL( TInt32 aContactId, - const TDesC& aDisplayName); + const HBufC* aDisplayName); /** * AddContactDetailsL diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/inc/ccsconversationcache.h --- a/messagingapp/msgappfw/server/inc/ccsconversationcache.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/inc/ccsconversationcache.h Thu Jul 22 16:32:06 2010 +0100 @@ -148,8 +148,9 @@ * * @param aConversationId Conversation Id. * @param aDeleted ETrue if conversation is being deleted else EFalse + * @param aCount = 0, count of messages in sending-state/not-deleted */ - void MarkConversationAsDeleted(TInt aConversationId, TBool aDeleted); + void MarkConversationAsDeleted(TInt aConversationId, TBool aDeleted, TInt aCount = 0); /** * IsDeleted @@ -188,6 +189,8 @@ */ TInt GetConversationIdFromAddressL(TDesC& aContactAddress); + CCsClientConversation* GetConversationFromConversationIdL(TInt aConversationId); + /** * Get conversation from message-id * @param aMessageId Message id diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/inc/ccsconversationcachehelper.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/inc/ccsconversationcontact.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/inc/ccsconversationdeletehandler.h --- a/messagingapp/msgappfw/server/inc/ccsconversationdeletehandler.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/inc/ccsconversationdeletehandler.h Thu Jul 22 16:32:06 2010 +0100 @@ -106,6 +106,13 @@ * Conversation Id currently being deleted. */ TInt iConversationId; + + /** + * Number of Messages in Sending state that are not deleted + */ + TInt iSendStateMsgs; + + }; #endif // __C_CS_CONVERSATION_DELETE_HANDLER_H__ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/inc/ccsconversationevent.h --- a/messagingapp/msgappfw/server/inc/ccsconversationevent.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/inc/ccsconversationevent.h Thu Jul 22 16:32:06 2010 +0100 @@ -115,6 +115,12 @@ */ TBool IsDeleteConversationListEventSet() const; + /** + * Is partial delete conversation event set in this object + * @ retrun TBool + */ + TBool IsPartialDeleteConversationListEventSet() const; + /** * Is new conversation event set in this object * diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/inc/ccsconversationmarkreadhandler.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/inc/ccsserver.h --- a/messagingapp/msgappfw/server/inc/ccsserver.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/inc/ccsserver.h Thu Jul 22 16:32:06 2010 +0100 @@ -30,6 +30,7 @@ class CCsSession; class CCsContactsManager; class CCsClientConversation; +class CCsBackUpHandler; // CLASS DECLARATION /** @@ -131,7 +132,18 @@ { } ; - + + /** + * Reload the plugins, once they are unloaded after a + * backup/ restore + */ + void LoadPlugins(); + + /** + * Unload the plugins, for backup/ restore + */ + void DeletePlugins(); + public: /** @@ -183,6 +195,11 @@ * Caching status */ TUint8 iCsCachingStatus; + + /** + * The backup handler class + */ + CCsBackUpHandler* iBackUpHandler; }; #endif // __C_CS_SERVER_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/inc/ccssession.h --- a/messagingapp/msgappfw/server/inc/ccssession.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/inc/ccssession.h Thu Jul 22 16:32:06 2010 +0100 @@ -92,6 +92,13 @@ void HandleModifyConversationListEventL( CCsClientConversation* aClientConversation); + /** + * HandlePartialDeleteConversationListEvent + * Handles the partial delete conversation event from cache + */ + void HandlePartialDeleteConversationListEvent( + CCsClientConversation* aClientConversation); + /** * HandleNewConversationEventL * Handles the new conversation event received from cache @@ -329,6 +336,8 @@ * @param aMessage RMessage instance */ void GetConversationIdfromAddressL(const RMessage2& aMessage); + + void GetConversationFromConversationIdL(const RMessage2& aMessage); /** * GetConversationFromMessageIdL @@ -358,7 +367,7 @@ * Buf for doing IPC * Own */ - HBufC8* des; + HBufC8* iDes; /** * iEventList diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/rom/csserver.iby --- a/messagingapp/msgappfw/server/rom/csserver.iby Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/rom/csserver.iby Thu Jul 22 16:32:06 2010 +0100 @@ -21,9 +21,6 @@ data=DATAZ_\system\install\csserver_stub.sis system\install\csserver_stub.sis file=ABI_DIR\BUILD_DIR\csserver.exe PROGRAMS_DIR\csserver.exe - -data=DATAZ_\RESOURCE_FILES_DIR\cscontacts.rsc RESOURCE_FILES_DIR\cscontacts.rsc - - +data=EPOCROOT##epoc32\data\Z\private\2002A542\backup_registration.xml private\2002A542\backup_registration.xml #endif // __CSSERVER_IBY__ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/server.pro --- a/messagingapp/msgappfw/server/server.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/server.pro Thu Jul 22 16:32:06 2010 +0100 @@ -23,10 +23,8 @@ INCLUDEPATH += ./inc \ ./../utils/inc \ - ./../../msgutils/s60qconversions/inc \ ./../../../mmsengine/inc -INCLUDEPATH += /ext/mw/qtextensions/qtmobileextensions/include INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE SYMBIAN_PLATFORMS = WINSCW ARMV5 @@ -34,9 +32,9 @@ symbian { TARGET.UID3 = 0x2002A542 TARGET.CAPABILITY = CAP_SERVER - TARGET.EPOCSTACKSIZE = 0x8000 + TARGET.EPOCSTACKSIZE = 0x14000 VENDORID = VID_DEFAULT - TARGET.EPOCHEAPSIZE = 0x100000 0x500000 + TARGET.EPOCHEAPSIZE = 0x100000 0x1000000 VERSION = 1.0 } @@ -51,7 +49,8 @@ ccsconversationevent.h \ ccsconversationcontact.h \ ccsconversationdeletehandler.h \ - ccsconversationmarkreadhandler.h + ccsconversationmarkreadhandler.h \ + ccsbackuphandler.h SOURCES += ccsstartup.cpp \ ccsserver.cpp \ @@ -65,14 +64,16 @@ ccsconversationevent.cpp \ ccsconversationcontact.cpp \ ccsconversationdeletehandler.cpp \ - ccsconversationmarkreadhandler.cpp + ccsconversationmarkreadhandler.cpp \ + ccsbackuphandler.cpp # Build.inf rules BLD_INF_RULES.prj_exports += \ "$${LITERAL_HASH}include " \ "$${LITERAL_HASH}include " \ "rom/csserver.iby CORE_APP_LAYER_IBY_EXPORT_PATH(csserver.iby)" \ - "stub_sis/csserver_stub.sis /epoc32/data/z/system/install/csserver_stub.sis" + "stub_sis/csserver_stub.sis /epoc32/data/z/system/install/csserver_stub.sis" \ + "backup_registration.xml z:/private/2002A542/backup_registration.xml" LIBS += -leuser \ -lcone \ @@ -88,6 +89,6 @@ -lcentralrepository \ -limcm \ -lQtContacts \ - -ls60qconversions + -lxqutils - \ No newline at end of file + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/src/ccsbackuphandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgappfw/server/src/ccsbackuphandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,123 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +#include "ccsbackuphandler.h" +#include +#include +#include +#include "ccsserver.h" +#include "ccsdebug.h" + +_LIT(KDbFileNamePath,"c:\\private\\10281e17\\[2002A542]conversations.db"); + + +// ========================== Member Functions =============================== + +// ---------------------------------------------------------------------------- +// CCsBackUpHandler::NewL +// ---------------------------------------------------------------------------- +CCsBackUpHandler* CCsBackUpHandler::NewL(CCsServer& aServer) +{ + PRINT ( _L("Enter CCsBackUpHandler::NewL") ); + CCsBackUpHandler* self = new (ELeave) CCsBackUpHandler(aServer); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + PRINT ( _L("Exit CCsBackUpHandler::NewL") ); + return (self); + +} + +// ---------------------------------------------------------------------------- +// CCsBackUpHandler::CCsBackUpHandler +// ---------------------------------------------------------------------------- +CCsBackUpHandler::CCsBackUpHandler(CCsServer& aServer): iServer(aServer) +{ +} + +// ---------------------------------------------------------------------------- +// CCsBackUpHandler::~CCsBackUpHandler +// destructor +// ---------------------------------------------------------------------------- +CCsBackUpHandler::~CCsBackUpHandler() +{ + // Unregister ourselves with backup server + if (iBackup) + { + iBackup->DeregisterFile(iFileName); + delete iBackup; + } +} + +// ---------------------------------------------------------------------------- +// CCsBackUpHandler::ConstructL +// The 2-phase constructor +// ---------------------------------------------------------------------------- +void CCsBackUpHandler::ConstructL() +{ + PRINT ( _L("Enter CCsBackUpHandler::ConstructL") ); + iFileName = KDbFileNamePath; + // Create backup session + iBackup = CBaBackupSessionWrapper::NewL(); + // Register with the backup server + iBackup->RegisterFileL(iFileName, *this); + PRINT ( _L("Exit CCsBackUpHandler::ConstructL 2") ); + PRINT1 ( _L("KDbFileNamePath: %S"), &iFileName); +} + +// ---------------------------------------------------------------------------- +// CCsBackUpHandler::ChangeFileLockL +// Call back from the backup engine observer when a backup/restore is taking place +// ---------------------------------------------------------------------------- +void CCsBackUpHandler::ChangeFileLockL(const TDesC& aFileAffected, TFileLockFlags aFlags) +{ + PRINT1 ( _L("ChangeFileLockL: %d"), aFlags); + PRINT1 ( _L("ChangeFileLockL affected file : %S"), &aFileAffected); + switch (aFlags) { + case ETakeLock: + { + OpenConversationsDbL(); + break; + } + case EReleaseLockNoAccess: + case EReleaseLockReadOnly: + { + CloseConversationsDbL(); + break; + } + default: + { + __ASSERT_DEBUG(EFalse,User::Invariant()); + break; + } + } +} + +// ---------------------------------------------------------------------------- +// CCsBackUpHandler::CloseConversationsDbL +// Unloads the plugins, so that the DB handle is closed +// ---------------------------------------------------------------------------- +void CCsBackUpHandler::CloseConversationsDbL() +{ + iServer.DeletePlugins(); +} + +// ---------------------------------------------------------------------------- +// CCsBackUpHandler::OpenConversationsDbL +// Loads the plugins, so that the DB handle is again opened +// ---------------------------------------------------------------------------- +void CCsBackUpHandler::OpenConversationsDbL() +{ + iServer.LoadPlugins(); +} diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/src/ccscontactsmanager.cpp --- a/messagingapp/msgappfw/server/src/ccscontactsmanager.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/src/ccscontactsmanager.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -16,7 +16,6 @@ */ // System includes -#include "qtcontacts.h" #include // User includes #include "ccscontactsmanager.h" diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/src/ccscontactsresolver.cpp --- a/messagingapp/msgappfw/server/src/ccscontactsresolver.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/src/ccscontactsresolver.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -16,7 +16,7 @@ */ // SYSTEM INCLUDES -#include "qtcontacts.h" +#include "qtcontacts.h" #include "qcontactdetailfilter.h" #include @@ -50,21 +50,37 @@ const QString &address, CCsContactDetail &contactDetail) { + // apply filter on phone number field QContactDetailFilter phoneFilter; phoneFilter.setDetailDefinitionName( - QContactPhoneNumber::DefinitionName, + QContactPhoneNumber::DefinitionName, QContactPhoneNumber::FieldNumber); - + phoneFilter.setValue(address); phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith); - QList matchingContacts = mPhonebookManager->contacts(phoneFilter); + if ( matchingContacts.count() > 0 ) { + QContact match = matchingContacts.at(0); + // Fill the contact details + contactDetail.contactId = match.localId(); + contactDetail.displayName = match.displayLabel(); + return true; + } - if ( matchingContacts.count() > 0 ) { + // apply filter on email address field + QContactDetailFilter emailFilter; + emailFilter.setDetailDefinitionName( + QContactEmailAddress::DefinitionName, + QContactEmailAddress::FieldEmailAddress); + + emailFilter.setValue(address); + emailFilter.setMatchFlags(QContactFilter::MatchExactly); + matchingContacts = mPhonebookManager->contacts(emailFilter); + if ( matchingContacts.count() > 0 ) { QContact match = matchingContacts.at(0); - // Fill the contact details + // Fill the contact details contactDetail.contactId = match.localId(); - contactDetail.displayName = match.displayLabel(); + contactDetail.displayName = match.displayLabel(); return true; } return false; @@ -76,14 +92,14 @@ // ---------------------------------------------------------------------------- void CCsContactsResolver::resolveContactId( const quint32 &contactId, - CCsContactDetail &contactDetail) + CCsContactDetail &contactDetail) { // Fetch back the persisted contact QContact contact = mPhonebookManager->contact(contactId); - contactDetail.contactId = contact.localId(); - + contactDetail.contactId = contact.localId(); + contactDetail.displayName = contact.displayLabel(); - + QList numbers = contact.details(); int numberCount = numbers.count(); @@ -91,7 +107,16 @@ { QString phoneNumber= numbers.at(a).number(); contactDetail.addressList.append(phoneNumber); - } + } + + QList emailAddresses = contact.details(); + int emailCount = emailAddresses.count(); + + for ( int a=0; aSetDisplayNameL(aDisplayName); + if(aDisplayName) + { + iContact->SetDisplayNameL(*aDisplayName); + } iContact->SetContactId (aContactId); } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/src/ccsconversationcache.cpp --- a/messagingapp/msgappfw/server/src/ccsconversationcache.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/src/ccsconversationcache.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -25,7 +25,7 @@ #include #include // KCRUidTelephonyConfiguration #include - +#include // USER INCLUDE FILES #include "ccsconversationcache.h" #include "ccsconversationcachehelper.h" @@ -35,7 +35,6 @@ #include "ccscontactsresolver.h" #include "ccsconversationevent.h" #include "ccsserver.h" -#include "s60qconversions.h" #include "ccsdebug.h" // ============================== MEMBER FUNCTIONS ============================ @@ -406,6 +405,20 @@ CleanupStack::PopAndDestroy(clientConv); } + // send all CV entry delete events, required in case CV is open + // Notify client of conversation change + TInt totalEntryCount = conversation->GetEntryCount(); + for (TInt entryCounter = totalEntryCount - 1; entryCounter >= 0; + entryCounter--) + { + CCsConversationEntry* entryInConversation = + conversation->GetEntryL(entryCounter); + CCsClientConversation * clientConv = + CreateClientConvLC(conversation, entryInConversation); + NotifyL(clientConv, KConversationEventDelete); + CleanupStack::PopAndDestroy(clientConv); + } + iConversationList->Remove(aIndex); entryList.ResetAndDestroy(); @@ -437,7 +450,7 @@ // CCsConversationCache::MarkConversationAsDeleted // ---------------------------------------------------------------------------- void CCsConversationCache::MarkConversationAsDeleted(TInt aConversationId, - TBool aDeleted) + TBool aDeleted, TInt aCount) { TInt conversationCount = iConversationList->Count(); @@ -450,6 +463,14 @@ if (id == aConversationId) { conversation->MarkDeleted(aDeleted); + if( aCount ) + { + CCsClientConversation* clientConversation = + CreateClientConvLC(conversation, + conversation->GetLatestEntryL()); + NotifyL(clientConversation, KConversationListEventPartialDelete); + CleanupStack::PopAndDestroy();// clientConversation + } break; } } @@ -513,7 +534,7 @@ { QString phoneNumber = phoneNumberList.at(i); HBufC* phoneNumber_s60 = - S60QConversions::qStringToS60Desc(phoneNumber); + XQConversions::qStringToS60Desc(phoneNumber); TInt cIndex = FindConversation(*phoneNumber_s60); if (cIndex != KErrNotFound) { @@ -553,7 +574,7 @@ { QString phoneNumber = phoneNumberList.at(i); HBufC* phoneNumber_s60 = - S60QConversions::qStringToS60Desc(phoneNumber); + XQConversions::qStringToS60Desc(phoneNumber); TInt cIndex = FindConversation(*phoneNumber_s60); if ( cIndex != KErrNotFound ) @@ -640,6 +661,29 @@ } // ---------------------------------------------------------------------------- +// CCsConversationCache::GetConversationFromConversationId +// ---------------------------------------------------------------------------- +CCsClientConversation* CCsConversationCache::GetConversationFromConversationIdL(TInt aConversationId) + { + + CCsClientConversation* clientConv = NULL; + + for ( TInt loop = 0; loop < iConversationList->Count(); ++loop ) + { + CCsConversation* conversation = + static_cast((*iConversationList)[loop]); + + if (aConversationId == conversation->GetConversationId()) + { + clientConv = CreateClientConvLC(conversation, conversation->GetLatestEntryL()); + CleanupStack::Pop(); + break; + } + } + return clientConv; + } + +// ---------------------------------------------------------------------------- // CCsConversationCache::GetConversationFromMessageIdL // --------------------------------------------------------------------------- CCsClientConversation* CCsConversationCache::GetConversationFromMessageIdL(TInt aMessageId) diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/src/ccsconversationcachehelper.cpp --- a/messagingapp/msgappfw/server/src/ccsconversationcachehelper.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/src/ccsconversationcachehelper.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -29,7 +29,7 @@ #include "ccsconversationevent.h" #include "ccscontactsmanager.h" #include "ccscontactsresolver.h" -#include "s60qconversions.h" +#include #include "ccsdebug.h" // ============================== MEMBER FUNCTIONS ============================ @@ -331,7 +331,7 @@ if (Contact) { QString contactAddress = - S60QConversions::s60DescToQString(Contact->Des()); + XQConversions::s60DescToQString(Contact->Des()); iConversationCache->ContactsManager()->resolver()->resolveContact(contactAddress, contactDetail); @@ -345,7 +345,7 @@ HBufC* displayName = NULL; if(!contactDetail.displayName.isEmpty()) { - displayName=S60QConversions::qStringToS60Desc(contactDetail.displayName); + displayName=XQConversions::qStringToS60Desc(contactDetail.displayName); } TRAPD(error, AddNewConversationL( aConverastionEvent-> ClientConversation()->GetConversationEntry(), @@ -539,10 +539,11 @@ if (conversation->GetEntryCount() == 0 && !conversation->IsSpecialConversation()) { - conversationList->Remove(loop); - delete conversation; - //reset the counters - loop -= 1; + + conversationList->Remove(loop); + delete conversation; + //reset the counters + loop -= 1; } // Stop searching @@ -572,8 +573,9 @@ conversation->AddEntryL(aConversationEntry); // fill firstname and lastname and contact Id - conversation->AddContactDetailsL(aContactId, - *aDisplayName); + if(aDisplayName) + conversation->AddContactDetailsL(aContactId, + aDisplayName); // fill the phone number if (aConversationEntry->Contact()) @@ -598,6 +600,9 @@ } iConversationCache->NotifyL(clientConv, KConversationListEventNew); + // send the new conversation event as well, so that if there are nay listeners for the cv + // then they will get the notification. + iConversationCache->NotifyL(clientConv, KConversationEventNew); CleanupStack::PopAndDestroy(clientConv); CleanupStack::Pop(conversation); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/src/ccsconversationcontact.cpp --- a/messagingapp/msgappfw/server/src/ccsconversationcontact.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/src/ccsconversationcontact.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -100,8 +100,6 @@ CCsConversationContact::SetDisplayNameL( const TDesC& aDisplayName) { - if( &aDisplayName ) - { TRAPD(error, iDisplayName = aDisplayName.AllocL()); if(error != KErrNone) { @@ -110,7 +108,7 @@ PRINT1 ( _L("CCsConversationContact::SetFirstNameL - Error:%d"), error ); } - } + } // ---------------------------------------------------------------------------- diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/src/ccsconversationdeletehandler.cpp --- a/messagingapp/msgappfw/server/src/ccsconversationdeletehandler.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/src/ccsconversationdeletehandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -39,7 +39,9 @@ // Constructor // ---------------------------------------------------------------------------- CCsConversationDeleteHandler::CCsConversationDeleteHandler(): - CActive(CActive::EPriorityLow) + CActive(CActive::EPriorityLow), + iState(EIdle), + iConversationEntryList(NULL) { CActiveScheduler::Add( this ); } @@ -50,9 +52,6 @@ void CCsConversationDeleteHandler::ConstructL(CCsConversationCache* aCache) { iCache = aCache; - iState = EIdle; - - iConversationEntryList = new (ELeave)RPointerArray (); iSession = CMsvSession::OpenSyncL(*this); } @@ -61,6 +60,15 @@ // ---------------------------------------------------------------------------- CCsConversationDeleteHandler::~CCsConversationDeleteHandler() { + // Make sure Aync request cancel. + Cancel(); + + if(iSession) + { + delete iSession; + iSession = NULL; + } + if (iConversationEntryList) { iConversationEntryList->ResetAndDestroy(); @@ -68,13 +76,7 @@ delete iConversationEntryList; iConversationEntryList = NULL; } - - if (iSession) - { - delete iSession; - iSession = NULL; - } - } +} // ---------------------------------------------------------------------------- // Delete set of messages @@ -96,12 +98,16 @@ CCsClientConversation* clientConversation = CCsClientConversation::NewL(); clientConversation->SetConversationEntryId(iConversationId); CleanupStack::PushL(clientConversation); - + + // Create entry list + iConversationEntryList = new (ELeave)RPointerArray (); + // Get conversationlist for given client conversation iCache->GetConversationsL (clientConversation, iConversationEntryList); iCache->MarkConversationAsDeleted(iConversationId, ETrue); iDeletedCount = 0; + iSendStateMsgs = 0; // Cleanup CleanupStack::PopAndDestroy(clientConversation); @@ -124,6 +130,10 @@ { iSession->RemoveEntry(id); } + else + { + iSendStateMsgs++; + } } // ---------------------------------------------------------------------------- @@ -163,10 +173,7 @@ break; case EDeleteComplete: - // Mark delete complete. - iCache->MarkConversationAsDeleted(iConversationId, EFalse); - // Done with the processing , cleanup the AO since this is the last - //call to the delete handler. + iCache->MarkConversationAsDeleted(iConversationId, EFalse, iSendStateMsgs ); delete this; break; } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/src/ccsconversationevent.cpp --- a/messagingapp/msgappfw/server/src/ccsconversationevent.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/src/ccsconversationevent.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -31,6 +31,8 @@ // Default constructor // ---------------------------------------------------------------------------- CCsConversationEvent::CCsConversationEvent() + :iClientConversation(NULL), + iEvent(KConversationEventNone) { } @@ -40,8 +42,6 @@ // ---------------------------------------------------------------------------- void CCsConversationEvent::ConstructL() { - iClientConversation = NULL; - iEvent = KConversationEventNone; } // ---------------------------------------------------------------------------- @@ -164,6 +164,13 @@ } // ---------------------------------------------------------------------------- +// CCsConversationEvent::IsPartialDeleteConversationListEventSet +// ---------------------------------------------------------------------------- +TBool CCsConversationEvent::IsPartialDeleteConversationListEventSet() const + { + return iEvent & KConversationListEventPartialDelete; + } +// ---------------------------------------------------------------------------- // CCsNotifyConversationEvent::IsNewConversationEventSet // ---------------------------------------------------------------------------- TBool CCsConversationEvent::IsNewConversationEventSet() const diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/src/ccsconversationmarkreadhandler.cpp --- a/messagingapp/msgappfw/server/src/ccsconversationmarkreadhandler.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/src/ccsconversationmarkreadhandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -177,7 +177,7 @@ } } -TInt CCsConversationMarkReadHandler::RunError(TInt aError) +TInt CCsConversationMarkReadHandler::RunError(TInt /*aError*/) { // RunL left so stop processing the AO and clean it. delete this; diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/src/ccsserver.cpp --- a/messagingapp/msgappfw/server/src/ccsserver.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/src/ccsserver.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -29,7 +29,7 @@ #include "ccsconversationevent.h" #include "ccsconversationcache.h" #include "ccscontactsmanager.h" - +#include "ccsbackuphandler.h" //Costant Declaration // ============================== MEMBER FUNCTIONS ============================ @@ -66,6 +66,33 @@ } // ---------------------------------------------------------------------------- +// CCsServer::DeletePlugins +// Unload the plugins for backup/restore +// ---------------------------------------------------------------------------- +void CCsServer::DeletePlugins() +{ + if (iConversationPlugin) { + delete iConversationPlugin; + iConversationPlugin = NULL; + } +} + +// ---------------------------------------------------------------------------- +// CCsServer::LoadPlugins +// Load the plugins after a backup/restore +// ---------------------------------------------------------------------------- + +void CCsServer::LoadPlugins() +{ + iConversationPlugin = CCsPluginInterface::NewL(); + // Create the plugin for the required entries + iConversationPlugin->InstantiatePluginL(this); + //fetch all initial set of messages + iConversationPlugin->GetConversationsL(); + RefreshConversations(); +} + +// ---------------------------------------------------------------------------- // CCsServer::ConstructL // Second phase constructor // ---------------------------------------------------------------------------- @@ -88,7 +115,9 @@ iConversationCache = CCsConversationCache::NewL(iContactsManager, this); iCsCachingStatus = KCachingStatusUnknown; - + + iBackUpHandler = CCsBackUpHandler::NewL(*this); + PRINT ( _L("End CCsServer::ConstructL") ); } @@ -121,6 +150,11 @@ iContactsManager = NULL; } + if(iBackUpHandler) + { + delete iBackUpHandler; + iBackUpHandler = NULL; + } REComSession::FinalClose(); PRINT ( _L("End CCsServer::~CCsServer") ); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/server/src/ccssession.cpp --- a/messagingapp/msgappfw/server/src/ccssession.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/server/src/ccssession.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -58,7 +58,16 @@ // Construtor // ---------------------------------------------------------------------------- CCsSession::CCsSession(CCsServer* aServer) : - iServer(aServer) + iServer(aServer), + iDes(NULL), + iMonitoredConversation(NULL), + iBufferOverflow(EFalse), + iGetConversationBufferOverflow( EFalse), + iNotifyHandling(EFalse), + iConversationListChangeObserver(EFalse), + iConversationChangeObserver(EFalse), + iCachingChangeObserver(EFalse), + iReqCnt(1) //Let's start the event ID from 1 { } @@ -70,21 +79,10 @@ { PRINT ( _L("Enter CCsSession::ConstructL") ); - iBufferOverflow = EFalse; - iGetConversationBufferOverflow = EFalse; - des = NULL; - - iNotifyHandling = EFalse; - iConversationListChangeObserver = EFalse; - iConversationChangeObserver = EFalse; - iCachingChangeObserver = EFalse; - iMonitoredConversation = NULL; // initialize the event List iEventList = new (ELeave) RPointerArray (); - iReqCnt = 1; //Let's start the event ID from 1 - PRINT ( _L("End CCsSession::ConstructL") ); } @@ -96,14 +94,14 @@ { PRINT ( _L("Enter CCsSession::~CCsSession") ); - if (des) - { - delete des; - des = NULL; - } - - if (iEventList) - { + if ( iDes ) + { + delete iDes; + iDes = NULL; + } + + if ( iEventList ) + { iEventList->ResetAndDestroy(); iEventList->Close(); delete iEventList; @@ -133,6 +131,12 @@ // Check the error status returned if (errStatus != KErrNone) { + // Free memory. + if(iDes) + { + delete iDes; + iDes=NULL; + } aMessage.Complete(errStatus); } } @@ -228,6 +232,11 @@ PRINT ( _L("Received function EGetConversationIdFromAddress") ) GetConversationIdfromAddressL(aMessage); break; + + case EGetConversationFromConversationId: + PRINT ( _L("Received function EGetConversationFromConversationId") ) + GetConversationFromConversationIdL(aMessage); + break; case EGetConversationFromMessageId: PRINT ( _L("Received function EGetConversationFromMessageId") ) @@ -249,6 +258,11 @@ // ---------------------------------------------------------------------------- void CCsSession::ServiceError(const RMessage2& aMessage, TInt aError) { + if(iDes) + { + delete iDes; + iDes=NULL; + } aMessage.Complete(aError); } @@ -267,14 +281,13 @@ { RPointerArray* ClientConversationList = new (ELeave) RPointerArray (); - + CleanupResetAndDestroyPushL(ClientConversationList); // get cache pointer CCsConversationCache* cache = iServer->ConversationCacheInterface(); // Call cache function to get recent conversation entry list // with dispaly name for all stored conversation entry ID cache->GetConversationListL(ClientConversationList); - CleanupStack::PushL(ClientConversationList); //write all list data into stream // create a new buffer for writing into stream @@ -309,24 +322,19 @@ // -------------------------------------------------------------- // Create a heap descriptor from the buffer - des = HBufC8::NewLC(buf->Size()); - CleanupStack::Pop(des); - TPtr8 ptr(des->Des()); + iDes = HBufC8::NewL(buf->Size()); + TPtr8 ptr(iDes->Des()); buf->Read(0, ptr, buf->Size()); - // cleanup + // Cleanup CleanupStack::PopAndDestroy(2, buf); // writestream, buf - CleanupStack::Pop(ClientConversationList); - - // destroy objects inside list - ClientConversationList->ResetAndDestroy(); - ClientConversationList->Close(); - delete ClientConversationList; - ClientConversationList = NULL; - } + + // Cleanup ClientConversationList + CleanupStack::PopAndDestroy(ClientConversationList); + } TInt rcevdBufferSize = aMessage.GetDesMaxLength(1); - TInt reqdBufferSize = des->Size(); + TInt reqdBufferSize = iDes->Size(); PRINT1 ( _L("Received buffer size = %d"), rcevdBufferSize ); PRINT1 ( _L("Required buffer size = %d"), reqdBufferSize ); @@ -349,13 +357,13 @@ PRINT ( _L("Adequate buffer received") ); PRINT ( _L("Packing the results in response") ) - aMessage.Write(1, *des); + aMessage.Write(1, *iDes); aMessage.Complete(EGetConversationListOperationComplete); iBufferOverflow = EFalse; - delete des; - des = NULL; - } - + delete iDes; + iDes = NULL; + } + PRINT_TIMESTAMP ("End CCsSession::GetConversationListL"); PRINT ( _L("End CCsSession::GetConversationListL") ); } @@ -375,7 +383,7 @@ { RPointerArray* ClientConversationList = new (ELeave) RPointerArray (); - + CleanupResetAndDestroyPushL(ClientConversationList); // get cache pointer CCsConversationCache* cache = iServer->ConversationCacheInterface(); @@ -383,8 +391,6 @@ // with dispaly name for all stored conversation entry ID cache->GetConversationUnreadListL(ClientConversationList); - CleanupStack::PushL(ClientConversationList); - //write all list data into stream // create a new buffer for writing into stream CBufFlat* buf = CBufFlat::NewL(KBigBuffer); @@ -417,24 +423,18 @@ // -------------------------------------------------------------- // Create a heap descriptor from the buffer - des = HBufC8::NewLC(buf->Size()); - CleanupStack::Pop(des); - TPtr8 ptr(des->Des()); + iDes = HBufC8::NewL(buf->Size()); + TPtr8 ptr(iDes->Des()); buf->Read(0, ptr, buf->Size()); // cleanup CleanupStack::PopAndDestroy(2, buf); // writestream, buf - CleanupStack::Pop(ClientConversationList); + CleanupStack::PopAndDestroy(ClientConversationList); - // destroy objects inside list - ClientConversationList->ResetAndDestroy(); - ClientConversationList->Close(); - delete ClientConversationList; - ClientConversationList = NULL; } TInt rcevdBufferSize = aMessage.GetDesMaxLength(1); - TInt reqdBufferSize = des->Size(); + TInt reqdBufferSize = iDes->Size(); PRINT1 ( _L("Received buffer size = %d"), rcevdBufferSize ); PRINT1 ( _L("Required buffer size = %d"), reqdBufferSize ); @@ -458,11 +458,11 @@ TPckgC overflowPackage(EFalse); aMessage.WriteL(0, overflowPackage); - aMessage.Write(1, *des); + aMessage.Write(1, *iDes); aMessage.Complete(KErrNone); iBufferOverflow = EFalse; - delete des; - des = NULL; + delete iDes; + iDes = NULL; } PRINT_TIMESTAMP ("End CCsSession::GetConversationUnreadListL"); @@ -502,9 +502,9 @@ CleanupStack::PopAndDestroy(2, buffer);//stream, buffer CleanupStack::PushL(ClientConversation); - RPointerArray* conversationEntryList = - new (ELeave) RPointerArray (); - CleanupStack::PushL(conversationEntryList); + RPointerArray* conversationEntryList= + new (ELeave) RPointerArray(10); + CleanupResetAndDestroyPushL(conversationEntryList); // get conversationlist for given ClientConversation cache->GetConversationsL(ClientConversation, conversationEntryList); @@ -535,24 +535,19 @@ // -------------------------------------------------------------- // Create a heap descriptor from the buffer - des = HBufC8::NewLC(buf->Size()); - CleanupStack::Pop(des); - TPtr8 ptr(des->Des()); + iDes = HBufC8::NewL(buf->Size()); + TPtr8 ptr(iDes->Des()); buf->Read(0, ptr, buf->Size()); CleanupStack::PopAndDestroy(2, buf); // writestream, buf - CleanupStack::Pop(conversationEntryList); - + // Cleanup - conversationEntryList->ResetAndDestroy(); - conversationEntryList->Close(); - delete conversationEntryList; - conversationEntryList = NULL; + CleanupStack::PopAndDestroy(conversationEntryList); CleanupStack::PopAndDestroy(ClientConversation); } TInt rcevdBufferSize = aMessage.GetDesMaxLength(1); - TInt reqdBufferSize = des->Size(); + TInt reqdBufferSize = iDes->Size(); PRINT1 ( _L("Received buffer size = %d"), rcevdBufferSize ); PRINT1 ( _L("Required buffer size = %d"), reqdBufferSize ); @@ -574,12 +569,12 @@ PRINT ( _L("Adequate buffer received") ); PRINT ( _L("Packing the results in response") ) - aMessage.Write(1, *des); + aMessage.Write(1, *iDes); aMessage.Complete(EGetConversationOperationComplete); iGetConversationBufferOverflow = EFalse; - delete des; - des = NULL; - } + delete iDes; + iDes = NULL; + } PRINT ( _L("End CCsSession::GetConversationsL") ); } @@ -701,6 +696,57 @@ } // ---------------------------------------------------------------------------- +// CCsSession::HandlePartialDeleteConversationListEventL +// Notify client about partial delete conversation event +// ---------------------------------------------------------------------------- + +void CCsSession::HandlePartialDeleteConversationListEvent( + CCsClientConversation* aClientConversation) +{ + PRINT ( _L("Enter CCsSession::HandlePartialDeleteConversationListEvent") ); + + if (!iConversationListChangeObserver) + return; + + if (! (iNotifyHandling)) + { + //append in notify list + CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL(); + conversationEvent->SetClientConversationL(*aClientConversation); + CleanupStack::PushL(conversationEvent); + conversationEvent->SetEvent(KConversationListEventPartialDelete); + iEventList->AppendL(conversationEvent); + CleanupStack::Pop(conversationEvent); + } + else + { + // create a new buffer for writing into stream + CBufFlat* buf = CBufFlat::NewL(KBigBuffer); + CleanupStack::PushL(buf); + + RBufWriteStream writeStream(*buf); + writeStream.PushL(); + + //externalize ClientConversation + aClientConversation->ExternalizeL(writeStream); + + // Results are already packed in the stream + writeStream.CommitL(); + + // -------------------------------------------------------------- + // Create a heap descriptor from the buffer + HBufC8* notifyDes = HBufC8::NewLC(buf->Size()); + TPtr8 ptr(notifyDes->Des()); + buf->Read(0, ptr, buf->Size()); + + iAsyncReqRMessage.Write(1, *notifyDes); + iAsyncReqRMessage.Complete(EPartialDeleteConversationListEvent); + CleanupStack::PopAndDestroy(3, buf); // notifyDes, writestream, buf + iNotifyHandling = EFalse; + } +} + +// ---------------------------------------------------------------------------- // CCsSession::HandleModifyConversationListEventL // Notify client about update conversation event // ---------------------------------------------------------------------------- @@ -865,8 +911,7 @@ // -------------------------------------------------------------- // Create a heap descriptor from the buffer - HBufC8* des = HBufC8::NewLC(buf->Size()); - CleanupStack::Pop(des); + HBufC8* des = HBufC8::NewL(buf->Size()); TPtr8 ptr(des->Des()); buf->Read(0, ptr, buf->Size()); @@ -904,8 +949,7 @@ // -------------------------------------------------------------- // Create a heap descriptor from the buffer - HBufC8* des = HBufC8::NewLC(buf->Size()); - CleanupStack::Pop(des); + HBufC8* des = HBufC8::NewL(buf->Size()); TPtr8 ptr(des->Des()); buf->Read(0, ptr, buf->Size()); @@ -1043,50 +1087,58 @@ if (!iConversationChangeObserver) return; - if (aClientConversation->GetConversationEntryId() - != iMonitoredConversation->GetConversationEntryId()) - return; - - if (! (iNotifyHandling)) + //this is check to send notif to clients for a new message + //1. if the client is subscribed with contact id ==> then send + //2. if the client is subscribed with conv id ---> then send + // else dont send + + if ((aClientConversation->GetContactId() == + iMonitoredConversation->GetContactId() && + aClientConversation->GetContactId() != -1) + ||(aClientConversation->GetConversationEntryId() == + iMonitoredConversation->GetConversationEntryId())) { - //append in notify list - CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL(); - CleanupStack::PushL(conversationEvent); - conversationEvent->SetClientConversationL(*aClientConversation); - conversationEvent->SetEvent(KConversationEventNew); - iEventList->AppendL(conversationEvent); - CleanupStack::Pop(conversationEvent); - } - else - { - // create a new buffer for writing into stream - CBufFlat* buf = CBufFlat::NewL(KBigBuffer); - CleanupStack::PushL(buf); - RBufWriteStream writeStream(*buf); - writeStream.PushL(); - - //externalize ClientConversation - aClientConversation->ExternalizeL(writeStream); - - // Results are already packed in the stream - writeStream.CommitL(); - // -------------------------------------------------------------- - - // Create a heap descriptor from the buffer - HBufC8* des = HBufC8::NewLC(buf->Size()); - CleanupStack::Pop(des); - TPtr8 ptr(des->Des()); - buf->Read(0, ptr, buf->Size()); - - CleanupStack::PopAndDestroy(2, buf); // writestream, buf - - iAsyncReqRMessage.Write(1, *des); - iAsyncReqRMessage.Complete(EAddConversationEvent); - delete des; - iNotifyHandling = EFalse; + if (! (iNotifyHandling)) + { + //append in notify list + CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL(); + CleanupStack::PushL(conversationEvent); + conversationEvent->SetClientConversationL(*aClientConversation); + conversationEvent->SetEvent(KConversationEventNew); + iEventList->AppendL(conversationEvent); + CleanupStack::Pop(conversationEvent); + } + else + { + // create a new buffer for writing into stream + CBufFlat* buf = CBufFlat::NewL(KBigBuffer); + CleanupStack::PushL(buf); + + RBufWriteStream writeStream(*buf); + writeStream.PushL(); + + //externalize ClientConversation + aClientConversation->ExternalizeL(writeStream); + + // Results are already packed in the stream + writeStream.CommitL(); + // -------------------------------------------------------------- + + // Create a heap descriptor from the buffer + HBufC8* des = HBufC8::NewLC(buf->Size()); + CleanupStack::Pop(des); + TPtr8 ptr(des->Des()); + buf->Read(0, ptr, buf->Size()); + + CleanupStack::PopAndDestroy(2, buf); // writestream, buf + + iAsyncReqRMessage.Write(1, *des); + iAsyncReqRMessage.Complete(EAddConversationEvent); + delete des; + iNotifyHandling = EFalse; + } } - PRINT ( _L("End CCsSession::HandleNewConversationEventL") ); } @@ -1103,8 +1155,11 @@ if (!iConversationChangeObserver) return; - if (aClientConversation->GetConversationEntryId() - != iMonitoredConversation->GetConversationEntryId()) + if ((aClientConversation->GetContactId() + != iMonitoredConversation->GetContactId()) && + (aClientConversation->GetConversationEntryId() + != iMonitoredConversation->GetConversationEntryId()) + ) return; if (! (iNotifyHandling)) @@ -1134,8 +1189,8 @@ // -------------------------------------------------------------- // Create a heap descriptor from the buffer - HBufC8* des = HBufC8::NewLC(buf->Size()); - CleanupStack::Pop(des); + HBufC8* des = HBufC8::NewL(buf->Size()); + TPtr8 ptr(des->Des()); buf->Read(0, ptr, buf->Size()); @@ -1163,50 +1218,57 @@ if (!iConversationChangeObserver) return; - if (aClientConversation->GetConversationEntryId() - != iMonitoredConversation->GetConversationEntryId()) - return; - - if (! (iNotifyHandling)) - { - //append in notify list - CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL(); - CleanupStack::PushL(conversationEvent); - conversationEvent->SetClientConversationL(*aClientConversation); - conversationEvent->SetEvent(KConversationEventUpdate); - iEventList->AppendL(conversationEvent); - CleanupStack::Pop(conversationEvent); - } - else + //this is check to send notif to clients for a new message + //1. if the client is subscribed with contact id ==> then send + //2. if the client is subscribed with conv id ---> then send + // else dont send + + if ((aClientConversation->GetContactId() == + iMonitoredConversation->GetContactId() && + aClientConversation->GetContactId() != -1) + ||(aClientConversation->GetConversationEntryId() == + iMonitoredConversation->GetConversationEntryId())) { - // create a new buffer for writing into stream - CBufFlat* buf = CBufFlat::NewL(KBigBuffer); - CleanupStack::PushL(buf); - - RBufWriteStream writeStream(*buf); - writeStream.PushL(); - - //externalize ClientConversation - aClientConversation->ExternalizeL(writeStream); - - // Results are already packed in the stream - writeStream.CommitL(); - // -------------------------------------------------------------- - - // Create a heap descriptor from the buffer - HBufC8* des = HBufC8::NewLC(buf->Size()); - CleanupStack::Pop(des); - TPtr8 ptr(des->Des()); - buf->Read(0, ptr, buf->Size()); - - CleanupStack::PopAndDestroy(2, buf); // writestream, buf - - iAsyncReqRMessage.Write(1, *des); - iAsyncReqRMessage.Complete(EModifyConversationEvent); - delete des; - iNotifyHandling = EFalse; + + if (! (iNotifyHandling)) + { + //append in notify list + CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL(); + CleanupStack::PushL(conversationEvent); + conversationEvent->SetClientConversationL(*aClientConversation); + conversationEvent->SetEvent(KConversationEventUpdate); + iEventList->AppendL(conversationEvent); + CleanupStack::Pop(conversationEvent); + } + else + { + // create a new buffer for writing into stream + CBufFlat* buf = CBufFlat::NewL(KBigBuffer); + CleanupStack::PushL(buf); + + RBufWriteStream writeStream(*buf); + writeStream.PushL(); + + //externalize ClientConversation + aClientConversation->ExternalizeL(writeStream); + + // Results are already packed in the stream + writeStream.CommitL(); + // -------------------------------------------------------------- + + // Create a heap descriptor from the buffer + HBufC8* des = HBufC8::NewL(buf->Size()); + TPtr8 ptr(des->Des()); + buf->Read(0, ptr, buf->Size()); + + CleanupStack::PopAndDestroy(2, buf); // writestream, buf + + iAsyncReqRMessage.Write(1, *des); + iAsyncReqRMessage.Complete(EModifyConversationEvent); + delete des; + iNotifyHandling = EFalse; + } } - PRINT ( _L("End CCsSession::HandleModifyConversationEventL") ); } @@ -1228,6 +1290,10 @@ { iAsyncReqRMessage.Complete(EModifyConversationListEvent); } + else if(aConversationEvent->IsPartialDeleteConversationListEventSet()) + { + iAsyncReqRMessage.Complete(EPartialDeleteConversationListEvent); + } else if (aConversationEvent->IsNewConversationEventSet()) { iAsyncReqRMessage.Complete(EAddConversationEvent); @@ -1269,6 +1335,10 @@ { HandleDeleteConversationListEventL(aConversation); } + else if(aEvent & KConversationListEventPartialDelete) + { + HandlePartialDeleteConversationListEvent(aConversation); + } else if (aEvent & KConversationEventNew) { HandleNewConversationEventL(aConversation); @@ -1383,8 +1453,7 @@ writeStream.CommitL(); // Create a heap descriptor from the buffer - HBufC8* des = HBufC8::NewLC(buf->Size()); - CleanupStack::Pop(des); + HBufC8* des = HBufC8::NewL(buf->Size()); TPtr8 ptr(des->Des()); buf->Read(0, ptr, buf->Size()); @@ -1395,6 +1464,57 @@ delete des; } +void CCsSession::GetConversationFromConversationIdL(const RMessage2& aMessage) +{ + // create a new buffer for writing into stream + CBufFlat* buf = CBufFlat::NewL(KBigBuffer); + CleanupStack::PushL(buf); + + RBufWriteStream writeStream(*buf); + writeStream.PushL(); + + // Get the conversation id + TInt conversationId = aMessage.Int0(); + CCsConversationCache* cache = iServer->ConversationCacheInterface(); + CCsClientConversation* clientConv = cache->GetConversationFromConversationIdL(conversationId); + + // if no conversation exists for given message-id, + // create a dummy conversation and complete response + if(clientConv == NULL) + { + //create dummy conversation + clientConv = CCsClientConversation::NewL(); + CleanupStack::PushL(clientConv); + clientConv->SetConversationEntryId(-1); + CCsConversationEntry* entry = CCsConversationEntry::NewL(); + CleanupStack::PushL(entry); + entry->SetEntryId(-1); + clientConv->SetConversationEntryL(entry); // clone + CleanupStack::PopAndDestroy(entry); + } + else + { + CleanupStack::PushL(clientConv); + } + + // Externalize + clientConv->ExternalizeL(writeStream); + + // Results are already packed in the stream + writeStream.CommitL(); + + // Create a heap descriptor from the buffer + HBufC8* des = HBufC8::NewL(buf->Size()); + TPtr8 ptr(des->Des()); + buf->Read(0, ptr, buf->Size()); + + CleanupStack::PopAndDestroy(3, buf); // clientConv, writestream, buf + + aMessage.Write(1, *des); + aMessage.Complete(EGetConversationFromConversationIdComplete); + delete des; +} + // ---------------------------------------------------------------------------- // GetConversationFromMessageIdL // ---------------------------------------------------------------------------- @@ -1438,8 +1558,7 @@ writeStream.CommitL(); // Create a heap descriptor from the buffer - HBufC8* des = HBufC8::NewLC(buf->Size()); - CleanupStack::Pop(des); + HBufC8* des = HBufC8::NewL(buf->Size()); TPtr8 ptr(des->Des()); buf->Read(0, ptr, buf->Size()); @@ -1481,8 +1600,7 @@ writeStream.CommitL(); // Create a heap descriptor from the buffer - HBufC8* des = HBufC8::NewLC(buf->Size()); - CleanupStack::Pop(des); + HBufC8* des = HBufC8::NewL(buf->Size()); TPtr8 ptr(des->Des()); buf->Read(0, ptr, buf->Size()); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/sis/conversation_server.pkg --- a/messagingapp/msgappfw/sis/conversation_server.pkg Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/sis/conversation_server.pkg Thu Jul 22 16:32:06 2010 +0100 @@ -20,7 +20,6 @@ ; Conversation Server "\epoc32\release\armv5\urel\csserver.exe" - "!:\sys\bin\csserver.exe" -"\epoc32\data\z\resource\cscontacts.rsc" - "!:\resource\cscontacts.rsc" "\epoc32\release\armv5\urel\csserverclientapi.dll" - "!:\sys\bin\csserverclientapi.dll" "\epoc32\release\armv5\urel\csutils.dll" - "!:\sys\bin\csutils.dll" diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/sis/messaging_armv5_udeb.pkg --- a/messagingapp/msgappfw/sis/messaging_armv5_udeb.pkg Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/sis/messaging_armv5_udeb.pkg Thu Jul 22 16:32:06 2010 +0100 @@ -49,6 +49,5 @@ ; Conversation Server "\epoc32\release\armv5\udeb\csserver.exe" - "!:\sys\bin\csserver.exe" -"\epoc32\data\z\resource\cscontacts.rsc" - "!:\resource\cscontacts.rsc" "\epoc32\release\armv5\udeb\csserverclientapi.dll" - "!:\sys\bin\csserverclientapi.dll" "\epoc32\release\armv5\udeb\csutils.dll" - "!:\sys\bin\csutils.dll" diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/sis/messaging_armv5_urel.pkg --- a/messagingapp/msgappfw/sis/messaging_armv5_urel.pkg Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/sis/messaging_armv5_urel.pkg Thu Jul 22 16:32:06 2010 +0100 @@ -18,7 +18,6 @@ ; Conversation Server "\epoc32\release\armv5\urel\csserver.exe" - "!:\sys\bin\csserver.exe" -"\epoc32\data\z\resource\cscontacts.rsc" - "!:\resource\cscontacts.rsc" "\epoc32\release\armv5\urel\csserverclientapi.dll" - "!:\sys\bin\csserverclientapi.dll" "\epoc32\release\armv5\urel\csutils.dll" - "!:\sys\bin\csutils.dll" diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/utils/bwins/csutilsu.def diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/utils/eabi/csutilsu.def diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/utils/src/ccsclientconversation.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/utils/src/ccsconversationentry.cpp --- a/messagingapp/msgappfw/utils/src/ccsconversationentry.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/utils/src/ccsconversationentry.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -135,12 +135,9 @@ // Sets the Conversation contact of this object // ---------------------------------------------------------------------------- EXPORT_C void CCsConversationEntry::SetContactL(const TDesC& aContact) - { - if((&aContact)) - { - iContact = aContact.AllocL(); - } - } +{ + iContact = aContact.AllocL(); +} // ---------------------------------------------------------------------------- // CCsConversationEntry::ConversationDir @@ -211,17 +208,15 @@ // Sets the Conversation description of this object // ---------------------------------------------------------------------------- EXPORT_C void CCsConversationEntry::SetDescriptionL(const TDesC& aDescription) - { - if((&aDescription)) - { - TInt descrLength = aDescription.Length(); - if ( descrLength > KMaxDescrSize ) - descrLength = KMaxDescrSize; - - iDescription = HBufC::NewL(descrLength); - iDescription->Des().Copy(aDescription.Left(descrLength)); - } - } +{ + + TInt descrLength = aDescription.Length(); + if (descrLength > KMaxDescrSize) + descrLength = KMaxDescrSize; + iDescription = HBufC::NewL(descrLength); + iDescription->Des().Copy(aDescription.Left(descrLength)); + +} // ---------------------------------------------------------------------------- // CCsConversationEntry::ChangeAttributes @@ -255,13 +250,16 @@ CCsConversationEntry* cloneObject = CCsConversationEntry::NewL(); CleanupStack::PushL(cloneObject); - cloneObject->SetContactL(*iContact); + if (iContact) + cloneObject->SetContactL(*iContact); + cloneObject->SetConversationDir(iConversationDir); cloneObject->SetType(iConversationType); cloneObject->SetEntryId(iEntryID); cloneObject->SetSendState(iConversationStatus); cloneObject->ChangeAttributes(iConversationAttrib, ECsAttributeNone); - cloneObject->SetDescriptionL(*iDescription); + if(iDescription) + cloneObject->SetDescriptionL(*iDescription); cloneObject->SetTimeStampL(iTimeStamp); CleanupStack::Pop(cloneObject); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgappfw/utils/src/ccsdebug.cpp --- a/messagingapp/msgappfw/utils/src/ccsdebug.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgappfw/utils/src/ccsdebug.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -69,19 +69,14 @@ dbgArr = static_cast( Dll::Tls() ); } - if ( dbgArr->IsEmpty() ) - { - delete dbgArr; - Dll::SetTls( NULL ); - } - else + if ( dbgArr && !(dbgArr->IsEmpty()) ) { CCsDebug* dbg = dbgArr->Pop(); dbg->UnMark(str); delete dbg; } - if ( !dbgArr && dbgArr->IsEmpty() ) + if ( dbgArr && dbgArr->IsEmpty() ) { delete dbgArr; Dll::SetTls( NULL ); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgerrornotifier/inc/msgerrornotifiersvc.h --- a/messagingapp/msgnotifications/msgerrornotifier/inc/msgerrornotifiersvc.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgerrornotifier/inc/msgerrornotifiersvc.h Thu Jul 22 16:32:06 2010 +0100 @@ -21,6 +21,9 @@ #include #include +//Forward Declaration +class XQSystemToneService; + class MsgErrorNotifierSvc: public XQServiceProvider { @@ -46,6 +49,12 @@ */ void displayErrorNote(QVariantList displayParams); +private: + + /** + * Object to handle audio alerts + */ + XQSystemToneService* mSts; }; #endif /* MSGERRORNOTIFIERSVC_H_ */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgerrornotifier/msgerrornotifier.pro --- a/messagingapp/msgnotifications/msgerrornotifier/msgerrornotifier.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgerrornotifier/msgerrornotifier.pro Thu Jul 22 16:32:06 2010 +0100 @@ -25,7 +25,8 @@ src/msgerrornotifiersvc.cpp LIBS += -lxqservice \ - -lxqserviceutil + -lxqserviceutil \ + -lxqsystemtoneservice SERVICE.FILE = service_conf.xml SERVICE.OPTIONS = embeddable @@ -33,6 +34,7 @@ symbian:TARGET.UID3 = 0x2001FE74 +TRANSLATIONS = messaging.ts BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " \ ".\rom\msgerrornotifier.iby CORE_APP_LAYER_IBY_EXPORT_PATH(msgerrornotifier.iby)" diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgerrornotifier/src/main.cpp --- a/messagingapp/msgnotifications/msgerrornotifier/src/main.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgerrornotifier/src/main.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -14,14 +14,30 @@ * Description: * */ +#include +#include +#include +#include #include "msgerrornotifier.h" -#include +#define LOC_TITLE hbTrId("") int main(int argc, char *argv[]) { - HbApplication a(argc, argv); + HbApplication app(argc, argv); + 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); + MsgErrorNotifier w; - return a.exec(); + return app.exec(); } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgerrornotifier/src/msgerrornotifiersvc.cpp --- a/messagingapp/msgnotifications/msgerrornotifier/src/msgerrornotifiersvc.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgerrornotifier/src/msgerrornotifiersvc.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -26,17 +26,19 @@ #include #include #include +#include #define LOC_VIEW hbTrId("txt_messaging_button_view") #define LOC_CANCEL hbTrId("txt_common_button_cancel") #define LOC_SEND_FAILURE hbTrId("txt_messaging_list_message_sending_failed") - +#define LOC_MMS_RETRIEVAL_FAILED hbTrId("txt_messaging_dialog_mms_retrieval_failed") //--------------------------------------------------------- // Constructor //--------------------------------------------------------- MsgErrorNotifierSvc::MsgErrorNotifierSvc(QObject* parent) : XQServiceProvider(QLatin1String("messaging.com.nokia.symbian.MsgErrorNotifier"), parent) { + mSts = new XQSystemToneService(); publishAll(); } @@ -45,7 +47,11 @@ //--------------------------------------------------------- MsgErrorNotifierSvc::~MsgErrorNotifierSvc() { - + if(mSts) + { + delete mSts; + mSts = NULL; + } } //--------------------------------------------------------- @@ -67,7 +73,7 @@ int msgType = third.toInt(); if (msgType == ECsMmsNotification) { - errorNote.append("Message Retrieval Failed!");//TODO: use logical str name + errorNote.append(LOC_MMS_RETRIEVAL_FAILED); } else { @@ -84,15 +90,18 @@ messageBox.setAction(actionView,HbDeviceMessageBox::AcceptButtonRole); QAction* actionQuit = new QAction(LOC_CANCEL,this); - actionQuit->setMenuRole(QAction::QuitRole); - messageBox.setAction(actionView,HbDeviceMessageBox::RejectButtonRole); + messageBox.setAction(actionQuit,HbDeviceMessageBox::RejectButtonRole); setCurrentRequestAsync(); + //Play audio alert when error notification is shown + mSts->playTone(XQSystemToneService::MessageSendFailureTone); + + // launch Messagebox const QAction* result = messageBox.exec(); - - // TODO: use XQAiwrequest - if (result->menuRole() != QAction::QuitRole) { + + // if accepted launch view else quit + if (messageBox.isAcceptAction(result)) { QList args; QString serviceName("com.nokia.services.hbserviceprovider"); QString operation("open(qint64)"); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicator.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicator_p.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicatorplugin.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgindicatorplugin/msgindicatorplugin.pro --- a/messagingapp/msgnotifications/msgindicatorplugin/msgindicatorplugin.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgindicatorplugin/msgindicatorplugin.pro Thu Jul 22 16:32:06 2010 +0100 @@ -24,7 +24,7 @@ DEPENDPATH += . INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE INCLUDEPATH += ../../../inc -INCLUDEPATH += ../../msgutils/s60qconversions/inc + HEADERS += inc/msgindicatorplugin.h \ @@ -53,5 +53,5 @@ LIBS += -lxqservice \ -lcsserverclientapi \ - -ls60qconversions \ - -lcsutils + -lcsutils \ + -lxqutils diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator.cpp --- a/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -41,7 +41,8 @@ #define LOC_FAILED_MULTIPLE_MESSAGES hbTrId("Failed Messages") #define LOC_OUTGOING_SINGLE_MESSAGE hbTrId("Outgoing Message") #define LOC_OUTGOING_MULTIPLE_MESSAGES hbTrId("Outgoing Messages") - +#define STATUS_MONO_NEW_MESSAGE QString("qtg_status_new_message") +#define LOC_BUSINESSCARD hbTrId("Business card") /** * The number of indicators. */ @@ -170,7 +171,7 @@ case MonoDecorationNameRole: { if (NewIndicatorPlugin == mIndicatorType) { - return IndicatorInfo[mIndicatorType].icon; + return STATUS_MONO_NEW_MESSAGE; } else { // Don't show status-bar icons for indications other @@ -319,6 +320,9 @@ QFileInfo fname(secondaryText); secondaryText = fname.fileName(); } + else if(ECsBioMsg_VCard == info.mMessageType) { + secondaryText = LOC_BUSINESSCARD; + } } else { info.mConversationId = -100; diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator_p.cpp --- a/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator_p.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator_p.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -22,7 +22,7 @@ #include "msgindicator_p.h" #include "msgindicator.h" #include "debugtraces.h" -#include "s60qconversions.h" +#include #define LOC_RECEIVED_FILES hbTrId("Received Files") @@ -98,7 +98,7 @@ // Only take the description from convEntry when there is one entry. // description will contain the name list when there are more entries. QString descText; - descText = S60QConversions::s60DescToQString(*description); + descText = XQConversions::s60DescToQString(*description); descText.replace(QChar::ParagraphSeparator, QChar::LineSeparator); descText.replace('\r', QChar::LineSeparator); indicatorData.mDescription = descText; @@ -116,10 +116,10 @@ HBufC* number = convEntry->Contact(); if (displayName) { - nameList.append(S60QConversions::s60DescToQString(*displayName)); + nameList.append(XQConversions::s60DescToQString(*displayName)); } else if (number) { - nameList.append(S60QConversions::s60DescToQString(*number)); + nameList.append(XQConversions::s60DescToQString(*number)); } } } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgindicatorplugin/src/msgindicatorplugin.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotificationdialogplugin/inc/msgnotificationdialogwidget.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotificationdialogplugin/msgnotificationdialogplugin.pro --- a/messagingapp/msgnotifications/msgnotificationdialogplugin/msgnotificationdialogplugin.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgnotificationdialogplugin/msgnotificationdialogplugin.pro Thu Jul 22 16:32:06 2010 +0100 @@ -32,8 +32,6 @@ SOURCES += src/msgnotificationdialogplugin.cpp SOURCES += src/msgnotificationdialogwidget.cpp -RESOURCES += msgnotificationdialogplugin.qrc - symbian: { TARGET.EPOCALLOWDLLDATA = 1 TARGET.CAPABILITY = CAP_GENERAL_DLL diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotificationdialogplugin/msgnotificationdialogplugin.qrc --- a/messagingapp/msgnotifications/msgnotificationdialogplugin/msgnotificationdialogplugin.qrc Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - resources/sms.svg - resources/mms.svg - resources/ringingtone.svg - - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotificationdialogplugin/resources/mms.svg --- a/messagingapp/msgnotifications/msgnotificationdialogplugin/resources/mms.svg Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotificationdialogplugin/resources/ringingtone.svg --- a/messagingapp/msgnotifications/msgnotificationdialogplugin/resources/ringingtone.svg Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotificationdialogplugin/resources/sms.svg --- a/messagingapp/msgnotifications/msgnotificationdialogplugin/resources/sms.svg Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogplugin.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp --- a/messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -39,7 +39,7 @@ 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_tone"); +const QString RINGTONE_ICON("qtg_large_new_message"); const QString VCARD_ICON("qtg_large_new_message"); // ---------------------------------------------------------------------------- // ServiceRequestSenderTask::ServiceRequestSenderTask diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifications.pro diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/inc/msgnotifier.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/inc/msgnotifier_p.h --- a/messagingapp/msgnotifications/msgnotifier/inc/msgnotifier_p.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgnotifier/inc/msgnotifier_p.h Thu Jul 22 16:32:06 2010 +0100 @@ -27,6 +27,7 @@ class MsgStoreHandler; class XQSettingsManager; class XQPublishAndSubscribeUtils; +class XQSystemToneService; /** * @class MsgNotifierPrivate @@ -65,6 +66,16 @@ */ void DeleteConversationList( const CCsClientConversation& aClientConversation); + + /** + * PartialDeleteConversationList + * This is for handling partial delete of conversation event + * Asynchronous + * @param aClientConversation CCsClientConversation - The conversation object + */ + void PartialDeleteConversationList( + const CCsClientConversation& aClientConversation); + /** * ModifyConversationList @@ -162,6 +173,11 @@ * Owned. */ XQPublishAndSubscribeUtils* mPSUtils; + + /** + * Object to handle audio alert when new message is received + */ + XQSystemToneService* mSts; }; #endif // MSGNOTIFIER_PRIVATE_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/inc/msgstorehandler.h --- a/messagingapp/msgnotifications/msgnotifier/inc/msgstorehandler.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgnotifier/inc/msgstorehandler.h Thu Jul 22 16:32:06 2010 +0100 @@ -140,12 +140,8 @@ /** * List of messages in Fialed states */ - CMsvEntrySelection* iFailedMessages; - - /** - * List of messages for which failed note shown - */ - CMsvEntrySelection* iFailedNotes; + CMsvEntrySelection* iFailedMessages; + }; #endif // MSG_STORE_HANDLER_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/msgnotifier.pro --- a/messagingapp/msgnotifications/msgnotifier/msgnotifier.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgnotifier/msgnotifier.pro Thu Jul 22 16:32:06 2010 +0100 @@ -21,7 +21,6 @@ DEPENDPATH += . src HEADERS += $$PUBLIC_HEADERS INCLUDEPATH += . inc ../../../inc -INCLUDEPATH +=../../msgutils/s60qconversions/inc INCLUDEPATH += ../../msgsettings/msginit/inc INCLUDEPATH += ../inc INCLUDEPATH += $$APP_LAYER_INCLUDEPATH @@ -42,6 +41,7 @@ QT -= gui CONFIG += NO_ICON hb +TRANSLATIONS = messaging.ts # Input SOURCES += src/main.cpp \ src/msgnotifier.cpp \ @@ -53,13 +53,11 @@ inc/msgstorehandler.h LIBS += -lcsserverclientapi \ - -ls60qconversions \ -lcsutils \ -lmsginit \ -lmsgs \ -letext \ -lsmcm \ - -ls60qconversions \ -lmmsmessage \ -lmmsserversettings \ -lmmscli \ @@ -68,5 +66,9 @@ -lQtVersit \ -lunidatamodelloader \ -lxqsettingsmanager \ - -apgrfx.lib + -apgrfx.lib \ + -lxqutils \ + -lws32 \ + -lapgrfx \ + -lxqsystemtoneservice diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/src/main.cpp --- a/messagingapp/msgnotifications/msgnotifier/src/main.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgnotifier/src/main.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -17,6 +17,8 @@ //SYSTEM INCLUDES #include +#include +#include #include #include #include @@ -70,7 +72,15 @@ int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); - + 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); + #ifdef _DEBUG_TRACES_ //Debug Logs QFile ofile; diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp --- a/messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -24,20 +24,20 @@ #include #include #include -#include +#include #include #include +#include +#include //USER INCLUDES #include "msgnotifier.h" #include "msgnotifier_p.h" -#include "s60qconversions.h" #include "msgstorehandler.h" #include "msginfodefs.h" #include "conversationidpsconsts.h" #include "debugtraces.h" - // ---------------------------------------------------------------------------- // MsgNotifierPrivate::MsgNotifierPrivate // @see MsgNotifierPrivate.h @@ -80,6 +80,12 @@ delete mSettingsManager; } + if(mSts) + { + delete mSts; + mSts = NULL; + } + QDEBUG_WRITE("MsgNotifierPrivate::~MsgNotifierPrivate : Exit") } @@ -115,6 +121,8 @@ QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL " "writing ret value",success) + mSts = new XQSystemToneService(); + QDEBUG_WRITE("MsgNotifierPrivate::initL : Exit") } @@ -205,17 +213,20 @@ if(displayName) { notifData.mDisplayName = - S60QConversions::s60DescToQString(*displayName); + XQConversions::s60DescToQString(*displayName); } if(number) { - notifData.mContactNum = S60QConversions::s60DescToQString(*number); + notifData.mContactNum = XQConversions::s60DescToQString(*number); } if(descrp) { - notifData.mDescription = S60QConversions::s60DescToQString(*descrp); + notifData.mDescription = XQConversions::s60DescToQString(*descrp); } + //Play new message alert tone. + mSts->playTone(XQSystemToneService::SmsAlertTone); + // check whether opened cv id and received // cv id are same and show notification if( showNotification(notifData.mConversationId )) @@ -289,39 +300,44 @@ // @see MsgNotifierPrivate.h // ---------------------------------------------------------------------------- void MsgNotifierPrivate::displayFailedNote(MsgInfo info) -{ - // TODO: use XQAiwRequest - QDEBUG_WRITE("[MsgNotifierPrivate::handleFailedState] : entered") - // change to com.nokia.symbian.messaging (servicename), IMsgErrorNotifier - // as the service name. - XQServiceRequest snd("messaging.com.nokia.symbian.MsgErrorNotifier", - "displayErrorNote(QVariantList)", false); + { + QDEBUG_WRITE("MsgNotifierPrivate::displayFailedNote start.") + + // check whether opened cv id and received + // cv id are same then dont show failed note + if (!showNotification(info.mConversationId)) + { + return; + } - QVariantList args; + //Even if name string is empty we shall add name into args + QString nameString; + info.mDisplayName.removeDuplicates(); info.mDisplayName.sort(); - - QString nameString; - + nameString.append(info.mDisplayName.at(0)); - for(int i = 1; i < info.mDisplayName.count(); ++i){ + for (int i = 1; i < info.mDisplayName.count(); ++i) + { nameString.append(", "); nameString.append(info.mDisplayName.at(i)); - } - - //Even if name string is empty we shall add name into args - QVariant nameV(nameString); - args << nameV; + } - QDEBUG_WRITE("[MsgNotifierPrivate::handleFailedState] : name and contactnumber") - + // create request arguments + QVariantList args; + args << QVariant(nameString); args << info.mConversationId; args << info.mMessageType; + + // TODO: use XQAiwRequest + XQServiceRequest snd("messaging.com.nokia.symbian.MsgErrorNotifier", + "displayErrorNote(QVariantList)", false); + snd << args; snd.send(); - QDEBUG_WRITE("[MsgNotifierPrivate::handleFailedState] : left") - -} + + QDEBUG_WRITE("MsgNotifierPrivate::displayFailedNote end.") + } // ---------------------------------------------------------------------------- // MsgNotifierPrivate::showNotification @@ -363,4 +379,11 @@ wsSession.Close(); return showNotification; } +// ---------------------------------------------------------------------------- +// MsgNotifierPrivate::PartialDeleteConversationList +// @see mcsconversationclientchangeobserver.h +// ---------------------------------------------------------------------------- +void MsgNotifierPrivate::PartialDeleteConversationList( + const CCsClientConversation& aClientConversation){/*empty implementation*/} + //EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp --- a/messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -16,7 +16,7 @@ */ #include "msgstorehandler.h" -#include "s60qconversions.h" +#include #include "msgnotifier_p.h" #include #include @@ -63,10 +63,6 @@ iFailedMessages = NULL; } - if (iFailedNotes) { - delete iFailedNotes; - iFailedNotes = NULL; - } } // --------------------------------------------------------- @@ -80,7 +76,6 @@ iMsvEntry->AddObserverL(*this); iFailedMessages = new (ELeave) CMsvEntrySelection; - iFailedNotes = new (ELeave) CMsvEntrySelection; } // --------------------------------------------------------- @@ -108,8 +103,7 @@ } //Handling for outbox entries - if( parent == KMsvGlobalOutBoxIndexEntryIdValue ) - { + if (parent == KMsvGlobalOutBoxIndexEntryIdValue) { CMsvEntry* rootEntry = iMsvSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId); for (TInt i = 0; i < selection->Count(); ++i) { @@ -120,45 +114,55 @@ TInt index = iFailedMessages->Find(entry.Id()); if (sendingState == KMsvSendStateFailed && KErrNotFound == index) { + iFailedMessages->AppendL(entry.Id()); - iFailedNotes->AppendL(entry.Id()); + MsgInfo aInfo; + ProcessIndicatorDataL(entry.Id(), aInfo); + iNotifier->displayFailedNote(aInfo); } else if (sendingState != KMsvSendStateFailed && KErrNotFound != index) { iFailedMessages->Delete(index); iFailedMessages->Compress(); } - if (iFailedNotes->Count()) { - MsgInfo aInfo; - ProcessIndicatorDataL(iFailedNotes->At(0), aInfo); - iNotifier->displayFailedNote(aInfo); - iFailedNotes->Delete(0); - iFailedNotes->Compress(); - } + } }//end for } - else - { + else { TMsvEntry entry; TMsvId service; - TInt error= KErrNone; - for (TInt i = 0; i < selection->Count(); ++i) - { + TInt error = KErrNone; + for (TInt i = 0; i < selection->Count(); ++i) { error = iMsvSession->GetEntry(selection->At(i), service, entry); - if (error == KErrNone && entry.iMtm == KUidMsgMMSNotification && MmsNotificationStatus( - entry) == EMsgStatusFailed) - { - MsgInfo aInfo; - - //Fill aInfo with appropriate data - aInfo.mMessageType = ECsMmsNotification; + if (error == KErrNone && entry.iMtm == KUidMsgMMSNotification && + MmsNotificationStatus(entry) == EMsgStatusFailed) { + + TInt index = iFailedMessages->Find(entry.Id()); + + if (KErrNotFound == index) { + iFailedMessages->AppendL(entry.Id()); + MsgInfo aInfo; + //Fill aInfo with appropriate data + aInfo.mMessageType = ECsMmsNotification; + ProcessIndicatorDataL(entry.Id(), aInfo); + iNotifier->displayFailedNote(aInfo); - ProcessIndicatorDataL(entry.Id(),aInfo); - iNotifier->displayFailedNote(aInfo); + }// end of if } - } + else if (error == KErrNone && entry.iMtm == KUidMsgMMSNotification + && MmsNotificationStatus(entry) == EMsgStatusRetrieving) { + + TInt index = iFailedMessages->Find(entry.Id()); + if (KErrNotFound != index) { + iFailedMessages->Delete(index); + iFailedMessages->Compress(); + }// end of KErrNotFound != index if block + + } // end of 2nd if + } // for loop } + } // --------------------------------------------------------- @@ -269,12 +273,12 @@ HBufC* displayName = conversation->GetDisplayName(); if (displayName) { - indicatorData.mDisplayName.append(S60QConversions::s60DescToQString(*displayName)); + indicatorData.mDisplayName.append(XQConversions::s60DescToQString(*displayName)); } else { HBufC* number = convEntry->Contact(); if (number) - indicatorData.mDisplayName.append(S60QConversions::s60DescToQString(*number)); + indicatorData.mDisplayName.append(XQConversions::s60DescToQString(*number)); } delete conversation; } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmsreadfile.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmsreadfile.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include +#include + +// 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 iValueBuffer; + CDesCArray* iAliasArray; // aliases + HBufC8* iByteBuffer; + TTime iDate; + CArrayPtrFlat* iAttaStructures; + TInt iAttaCount; + TInt iAttaRoot; + TInt iAliasCount; + TInt iNextMessageType; + TParse iParse; + TFileName iFilename; + + protected: // Data + private: // Data + + // CArrayFixFlat * 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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestbed.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestbed.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include + +#include //for consts like KMsvNullIndexEntryIdValue +#include +#include +#include +//#include + +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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestbed.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestbed.hrh Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#include + + +#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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmsteststaticutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmsteststaticutils.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include + +#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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestuitimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestuitimer.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 + +#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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/mmstestbed.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/mmstestbed.pro Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,84 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies 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 " + +LIBS += -lmsgs \ + -lmmsmessage \ + -lmmsconninit \ + -lmmscodec \ + -lmmsserversettings \ + -lcentralrepository \ + -lapparc \ + -lbafl \ + -lefsrv \ + -lesock \ + -lestor \ + -leuser \ + -llogcli \ + -llogwrap \ + -lapgrfx \ + -lapmime diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmsreadfile.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmsreadfile.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include +#include +#include +#include +//#include +#include +#include +#include + +#include +#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( 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 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 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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmstestbed.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmstestbed.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#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 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 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 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 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 + } + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmsteststaticutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmsteststaticutils.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include +#include +#include + +#include "mmsteststaticutils.h" +#include "mmsconst.h" +#include +#include "mmssettings.h" +#include +#include "mmsservercommon.h" +#include + + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +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 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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmstestuitimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmstestuitimer.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -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 ======== + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/group/testmmsplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/group/testmmsplugin.pro Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,110 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +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 + + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/inc/testmmsplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/inc/testmmsplugin.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include + +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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/inc/testmmsplugin.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/inc/testmmsplugin.ini Thu Jul 22 16:32:06 2010 +0100 @@ -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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/mms.rsc Binary file messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/mms.rsc has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/not.rsc Binary file messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/not.rsc has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/plugin_commonU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/plugin_commonU.def Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,31 @@ +; ============================================================================== +; 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) + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/src/testmmsplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/src/testmmsplugin.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 +#include "debugtraces.h" +#include +#include +#include "convergedmessage.h" +#include "convergedmessageid.h" +#include "unieditormmsplugin.h" +#include "mmstestbed.h" +#include "testmmsplugin.ini" +#include + + +//--------------------------------------------------------------- +// TestMmsPlugin::initTestCase +//--------------------------------------------------------------- + +void TestMmsPlugin::initTestCase() +{ + qRegisterMetaType ("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"); + 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(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(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; +} + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgservices/msgserviceapp/inc/msgsendinterface.h --- a/messagingapp/msgservices/msgserviceapp/inc/msgsendinterface.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgservices/msgserviceapp/inc/msgsendinterface.h Thu Jul 22 16:32:06 2010 +0100 @@ -60,6 +60,15 @@ void send(const QString phoneNumber, const QString alias, const QString bodyText); + /** + * Send message. + * @param addressList list of phone numbers and displaynames. + * key is the phone number and value is the display name. + * @param bodyText body text. + */ + void send(const QVariantMap addressList, + const QString bodyText = QString()); + private: /** diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h --- a/messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h Thu Jul 22 16:32:06 2010 +0100 @@ -65,7 +65,16 @@ void send(const QString phoneNumber, const QString alias, const QString bodyText); - + + /** + * Send message. + * @param addressList list of phone numbers and displaynames. + * key is the phone number and value is the display name. + * @param bodyText body text. + */ + void send(const QVariantMap addressList, + const QString bodyText = QString()); + /** * Send message. * @param data data to be sent. @@ -94,7 +103,7 @@ * Handle sms and mms messge * @param msgId message id */ - void handleSmsMmsMsg(int msgId); + void handleSmsMmsMsg(int msgId,int msgType); /** * Handle ringtone message diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgservices/msgserviceapp/inc/msgstorehandler.h --- a/messagingapp/msgservices/msgserviceapp/inc/msgstorehandler.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgservices/msgserviceapp/inc/msgstorehandler.h Thu Jul 22 16:32:06 2010 +0100 @@ -58,6 +58,13 @@ */ void deleteMessage(int msgId); + /** + * is draft message. + * @param msgId id of the message to be checked. + * @return true if it is a draft message,else false + */ + bool isDraftMessage(int msgId); + private: /** * Does all initilaizations diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgservices/msgserviceapp/msgserviceapp.pro --- a/messagingapp/msgservices/msgserviceapp/msgserviceapp.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgservices/msgserviceapp/msgserviceapp.pro Thu Jul 22 16:32:06 2010 +0100 @@ -21,7 +21,6 @@ INCLUDEPATH += inc INCLUDEPATH += ../../../inc -INCLUDEPATH += ../../msgutils/s60qconversions/inc INCLUDEPATH += ../../smartmessaging/ringbc/inc INCLUDEPATH += ../../msgutils/unidatamodelloader/inc INCLUDEPATH += ../../msgui/inc @@ -55,7 +54,6 @@ LIBS += -lxqservice \ -lxqserviceutil \ - -ls60qconversions \ -lconvergedmessageutils \ -lmsgs \ -lringbc \ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgservices/msgserviceapp/service_conf.xml --- a/messagingapp/msgservices/msgserviceapp/service_conf.xml Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgservices/msgserviceapp/service_conf.xml Thu Jul 22 16:32:06 2010 +0100 @@ -10,6 +10,7 @@ messaging txt_messaging_list_attach_to_new_message qtg_large_message + video/* com.nokia.symbian.IMessageSend diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgservices/msgserviceapp/src/main.cpp --- a/messagingapp/msgservices/msgserviceapp/src/main.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgservices/msgserviceapp/src/main.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -15,7 +15,7 @@ * */ -#include +#include #include #include #include diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgservices/msgserviceapp/src/msgsendinterface.cpp --- a/messagingapp/msgservices/msgserviceapp/src/msgsendinterface.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgservices/msgserviceapp/src/msgsendinterface.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -61,5 +61,14 @@ mViewManager->send(phoneNumber, alias, bodyText); } +//---------------------------------------------------------------------------- +// MsgSendInterface::send +// @see header +//---------------------------------------------------------------------------- +void MsgSendInterface::send(const QVariantMap addressList, + const QString bodyText) + { + mViewManager->send(addressList,bodyText); + } //EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgservices/msgserviceapp/src/msgserviceviewmanager.cpp --- a/messagingapp/msgservices/msgserviceapp/src/msgserviceviewmanager.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgservices/msgserviceapp/src/msgserviceviewmanager.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include @@ -36,11 +36,8 @@ #include "unidatamodelplugininterface.h" // LOCALIZATION -#define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete") -#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") #define LOC_DLG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone") -#define LOC_BUTTON_SAVE hbTrId("txt_common_menu_save") //---------------------------------------------------------------------------- // MsgViewInterface::MsgViewInterface @@ -215,6 +212,43 @@ // MsgServiceViewManager::send // @see header //---------------------------------------------------------------------------- +void MsgServiceViewManager::send(const QVariantMap addressList, + const QString bodyText) + { + QStringList phoneNumList = addressList.keys(); + + ConvergedMessageAddressList addrList; + + int count = phoneNumList.count(); + for( int i = 0; i < count; ++ i ) + { + QString phNum = phoneNumList[i]; + ConvergedMessageAddress* address = new ConvergedMessageAddress(phNum, + addressList.value(phNum).toString()); + addrList.append(address); + } + + ConvergedMessage message; + message.addToRecipients(addrList); + message.setBodyText(bodyText); + + QVariantList param; + QByteArray dataArray; + QDataStream messageStream(&dataArray, + QIODevice::WriteOnly | QIODevice::Append); + message.serialize(messageStream); + param << dataArray; + + // switch to editor + switchToUniEditor(param); + + XQServiceUtil::toBackground(false); + } + +//---------------------------------------------------------------------------- +// MsgServiceViewManager::send +// @see header +//---------------------------------------------------------------------------- void MsgServiceViewManager::send(QVariant data) { ConvergedMessage message; @@ -310,7 +344,7 @@ case ConvergedMessage::Mms: case ConvergedMessage::MmsNotification: { - handleSmsMmsMsg(msgId); + handleSmsMmsMsg(msgId,msgType); break; } case ConvergedMessage::BioMsg: @@ -332,9 +366,8 @@ { // for un supported message show delete option HbMessageBox::question(LOC_DELETE_MESSAGE, - this,SLOT(onDialogDeleteMsg(HbAction*)), - LOC_BUTTON_DELETE, - LOC_BUTTON_CANCEL); + this,SLOT(onDialogDeleteMsg(HbAction*)), + HbMessageBox::Delete | HbMessageBox::Cancel); break; } } @@ -344,22 +377,64 @@ // MsgServiceViewManager::handleSmsMmsMsg // @see header // ---------------------------------------------------------------------------- -void MsgServiceViewManager::handleSmsMmsMsg(int msgId) +void MsgServiceViewManager::handleSmsMmsMsg(int msgId,int msgType) +{ + if(mStoreHandler->isDraftMessage(msgId)) { - if (!mUniViewer) { - mUniViewer = new UnifiedViewer(msgId); - mUniViewer->setNavigationAction(mBackAction); - mMainWindow->addView(mUniViewer); - connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this, - SLOT(switchView(const QVariantList&))); + ConvergedMessageId convergedMsgId = ConvergedMessageId(msgId); + ConvergedMessage message; + message.setMessageType((ConvergedMessage::MessageType) msgType); + message.setMessageId(convergedMsgId); + + // Launch uni-editor view + QByteArray dataArray; + QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append); + message.serialize(messageStream); + + QVariantList params; + params << MsgBaseView::UNIEDITOR; // target view + params << MsgBaseView::SERVICE; // source view + + params << dataArray; + + // except first 2 parameters pass other parameters + QVariantList editorData; + for(int a = 2; a < params.length(); ++a) + { + editorData << params.at(a); + } + // construct + if (!mUniEditor) { + mUniEditor = new MsgUnifiedEditorView(); + mMainWindow->addView(mUniEditor); + mUniEditor->setNavigationAction(mBackAction); + connect(mUniEditor, SIGNAL(switchView(const QVariantList&)), this, + SLOT(switchView(const QVariantList&))); + } + + // check if additional data for unieditor's consumption is available + mUniEditor->openDraftsMessage(editorData); + + mMainWindow->setCurrentView(mUniEditor); + mCurrentView = MsgBaseView::UNIEDITOR; } - mUniViewer->populateContent(msgId, true, 1); + else + { + if (!mUniViewer) { + mUniViewer = new UnifiedViewer(msgId); + mUniViewer->setNavigationAction(mBackAction); + mMainWindow->addView(mUniViewer); + connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this, + SLOT(switchView(const QVariantList&))); + } + mUniViewer->populateContent(msgId, true, 1); - mMainWindow->setCurrentView(mUniViewer); - - // set current view as viewer - mCurrentView = MsgBaseView::UNIVIEWER; + mMainWindow->setCurrentView(mUniViewer); + + // set current view as viewer + mCurrentView = MsgBaseView::UNIVIEWER; } +} // ---------------------------------------------------------------------------- // MsgServiceViewManager::handleRingtoneMsg @@ -369,7 +444,8 @@ { mMessageId = msgId; HbMessageBox::question(LOC_DLG_SAVE_RINGTONE, this, - SLOT(onDialogSaveTone(HbAction*)), LOC_BUTTON_SAVE, LOC_BUTTON_CANCEL); + SLOT(onDialogSaveTone(HbAction*)), + HbMessageBox::Save | HbMessageBox::Cancel); } // ---------------------------------------------------------------------------- diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgservices/msgserviceapp/src/msgstorehandler.cpp --- a/messagingapp/msgservices/msgserviceapp/src/msgstorehandler.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgservices/msgserviceapp/src/msgstorehandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -20,7 +20,7 @@ #include #include "msgstorehandler.h" -#include "MsgBioUids.h" +#include "msgbiouids.h" #include "convergedmessage.h" //---------------------------------------------------------------------------- @@ -155,4 +155,27 @@ { iMsvSession->RemoveEntry(msgId); } + +//---------------------------------------------------------------------------- +// MsgStoreHandler::isDraftMessage +// @see header +//---------------------------------------------------------------------------- +bool MsgStoreHandler::isDraftMessage(int msgId) +{ + bool draftmsg = false; + CMsvEntry* cEntry = NULL; + TRAPD(err, cEntry = iMsvSession->GetEntryL(msgId)); + if ( err == KErrNone) + { + TMsvEntry msvEntry = cEntry->Entry(); + TMsvId parent = msvEntry.Parent(); + if(parent == KMsvDraftEntryIdValue) + { + draftmsg = true; + } + } + + delete cEntry; + return draftmsg; +} // End of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/bwins/settingsviewu.def diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/eabi/settingsviewu.def diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/msginit/msginit.pro --- a/messagingapp/msgsettings/msginit/msginit.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgsettings/msginit/msginit.pro Thu Jul 22 16:32:06 2010 +0100 @@ -48,6 +48,15 @@ } +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/msginit.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/msginit.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + HEADERS += inc/startupmonitor.h \ inc/simscnumberdetector.h \ inc/msgsimnumberdetector.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/msginit/src/simscnumberdetector.cpp --- a/messagingapp/msgsettings/msginit/src/simscnumberdetector.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgsettings/msginit/src/simscnumberdetector.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -256,6 +256,13 @@ } aServiceSettings->SetSmsBearer((CSmsSettings::TMobileSmsBearer) readedSetting); + // Check if we need to store SMSC time stamp OR device Time stamp + if (iCenRepSession->Get(KSmumShowSMSCTimeStamp, readedSetting) != KErrNone) + { + readedSetting = 0; + } + aServiceSettings->SetUseServiceCenterTimeStampForDate(readedSetting); + // Reply via same centre if (iCenRepSession->Get(KSmumRemoveReplyViaSameCentre, readedSetting) != KErrNone) @@ -308,22 +315,15 @@ { if ( HasSIMChanged() || HasNoSmscSettings() ) { - QDEBUG_WRITE("CMsgSimOperation::StartL Reading sim settings") + QDEBUG_WRITE("CMsgSimOperation::StartL Reading sim settings start") - CMsvOperationWait* wait = CMsvOperationWait::NewLC(); + CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC(); iSimOperation = iSmsClientMtm->ReadSimParamsL(wait->iStatus); wait->Start(); - - QDEBUG_WRITE("CMsgSimOperation::StartL Before CActiveScheduler::Start") - - CActiveScheduler::Start(); - - QDEBUG_WRITE("CMsgSimOperation::StartL After CActiveScheduler::Start") - - TInt err = wait->iStatus.Int(); + TInt err = wait->iStatus.Int(); StartRunL(err); CleanupStack::PopAndDestroy(); - + QDEBUG_WRITE("CMsgSimOperation::StartL Reading sim settings end") } } CompleteClientRequest(0); @@ -510,8 +510,7 @@ TInt status = KErrNone; TInt value = 0; - - status = RProperty::Get(KPSUidStartup, KPSSimStatus, value); + status = RProperty::Get(KPSUidStartup, KPSSimStatus, value); if (status == KErrNone && value != ESimNotPresent) { @@ -519,14 +518,9 @@ return ETrue; } - else - { - QDEBUG_WRITE("CMsgSimOperation::IsSIMPresent returned False") - - return EFalse; - } - - + + QDEBUG_WRITE("CMsgSimOperation::IsSIMPresent returned False") + return EFalse; } TBool CMsgSimOperation::HasSIMChanged() diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/msgsettings.pro diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/inc/msgsettingengine.h --- a/messagingapp/msgsettings/settingsview/inc/msgsettingengine.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgsettings/settingsview/inc/msgsettingengine.h Thu Jul 22 16:32:06 2010 +0100 @@ -18,7 +18,7 @@ #ifndef MSGSETTINGENGINE_H_ #define MSGSETTINGENGINE_H_ -#include +#include //FORWARD DECLARATION class SmsSettingsPrivate; @@ -46,7 +46,7 @@ */ enum MmsRetrieval { - AlwaysAutomatic, AutomInHomeNetwork, Maual, Off, No + AlwaysAutomatic, AutomInHomeNetwork, Manual, Off, No }; public: diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/inc/msgsettingsform.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/inc/msgsettingsview.h --- a/messagingapp/msgsettings/settingsview/inc/msgsettingsview.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgsettings/settingsview/inc/msgsettingsview.h Thu Jul 22 16:32:06 2010 +0100 @@ -53,12 +53,13 @@ void onNewSMSCCenterClicked(int index); void onSmsCenterEditViewClosed(); -private: +private: + //Sms Center View + MsgSMSCenterView* mSMSCenterView; + //Settings Form MsgSettingsForm* mSettingsForm; - //Sms Center View - MsgSMSCenterView* mSMSCenterView; HbMainWindow* mMainWindow; }; #endif // MSGSETTINGSVIEW_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/inc/msgsmscentersettingsform.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/inc/msgsmscenterview.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/rom/settingsview.iby --- a/messagingapp/msgsettings/settingsview/rom/settingsview.iby Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgsettings/settingsview/rom/settingsview.iby Thu Jul 22 16:32:06 2010 +0100 @@ -21,5 +21,6 @@ REM DLL file=ABI_DIR\UREL\settingsview.dll SHARED_LIB_DIR\settingsview.dll +data=ZSYSTEM\install\settingsview_stub.sis System\Install\settingsview_stub.sis #endif diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/settingsview.pro --- a/messagingapp/msgsettings/settingsview/settingsview.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgsettings/settingsview/settingsview.pro Thu Jul 22 16:32:06 2010 +0100 @@ -10,7 +10,6 @@ INCLUDEPATH += . INCLUDEPATH += ../../../inc INCLUDEPATH += ../../msgui/inc -INCLUDEPATH += ../../msgutils/s60qconversions/inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE CONFIG += hb @@ -51,10 +50,19 @@ TARGET.CAPABILITY = All -TCB +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/settingsview.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/settingsview.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + LIBS += -lSmcm \ -lmsgs \ - -ls60qconversions \ -lcommdb \ -lmmsserversettings \ - -lmmsgenericsettings + -lmmsgenericsettings \ + -lxqutils \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/src/mmssettingsprivate.cpp --- a/messagingapp/msgsettings/settingsview/src/mmssettingsprivate.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgsettings/settingsview/src/mmssettingsprivate.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -149,26 +149,42 @@ mMmsClient->RestoreSettingsL(); mMmsSetting->CopyL( mMmsClient->MmsSettings() ); - //do your operation - TMmsReceivingMode receveMode = EMmsReceivingAutomatic; - - if (aRetrieval == MsgSettingEngine::Maual) - receveMode = EMmsReceivingManual; - else if (aRetrieval == MsgSettingEngine::Off) - receveMode = EMmsReceivingPostpone; - else if (aRetrieval == MsgSettingEngine::No) - receveMode = EMmsReceivingReject; - - if (aRetrieval == MsgSettingEngine::AlwaysAutomatic) - { - mMmsSetting->SetReceivingModeForeign(receveMode); - } - else - { - mMmsSetting->SetReceivingModeForeign(EMmsReceivingManual); - } - - mMmsSetting->SetReceivingModeHome(receveMode); + switch ( aRetrieval ) + { + case MsgSettingEngine::AutomInHomeNetwork: + { + mMmsSetting->SetReceivingModeHome( EMmsReceivingAutomatic ); + mMmsSetting->SetReceivingModeForeign( EMmsReceivingManual ); + break; + } + case MsgSettingEngine::AlwaysAutomatic: + { + mMmsSetting->SetReceivingModeHome( EMmsReceivingAutomatic ); + mMmsSetting->SetReceivingModeForeign( EMmsReceivingAutomatic ); + break; + } + case MsgSettingEngine::Manual: + { + mMmsSetting->SetReceivingModeHome( EMmsReceivingManual ); + mMmsSetting->SetReceivingModeForeign( EMmsReceivingManual ); + break; + } + case MsgSettingEngine::Off: + { + mMmsSetting->SetReceivingModeHome( EMmsReceivingPostpone ); + mMmsSetting->SetReceivingModeForeign( EMmsReceivingPostpone ); + break; + } + case MsgSettingEngine::No: + { + mMmsSetting->SetReceivingModeHome( EMmsReceivingReject ); + mMmsSetting->SetReceivingModeForeign( EMmsReceivingReject ); + break; + } + default: + break; + } + //save the settings mMmsClient->SetSettingsL( *mMmsSetting ); @@ -229,21 +245,36 @@ mMmsAccount->LoadSettingsL(*mMmsSetting); - TMmsReceivingMode receveMode = mMmsSetting->ReceivingModeHome(); + TMmsReceivingMode receveModeHome = mMmsSetting->ReceivingModeHome(); + TMmsReceivingMode receveModeForeign = mMmsSetting->ReceivingModeForeign(); + - if (receveMode == EMmsReceivingManual) - aRetrieval = MsgSettingEngine::Maual; - else if (receveMode == EMmsReceivingPostpone) - aRetrieval = MsgSettingEngine::Off; - else if (receveMode == EMmsReceivingReject) - aRetrieval = MsgSettingEngine::No; - - receveMode = mMmsSetting->ReceivingModeForeign(); - if (receveMode == EMmsReceivingAutomatic) - { - aRetrieval = MsgSettingEngine::AlwaysAutomatic; - } - + // if default value is not acceptable, choose next by keeping costs low + if ( receveModeHome == EMmsReceivingAutomatic && + receveModeForeign == EMmsReceivingAutomatic ) + { + aRetrieval = MsgSettingEngine::AlwaysAutomatic; + } + else if ( receveModeHome == EMmsReceivingManual && + receveModeForeign == EMmsReceivingManual ) + { + aRetrieval = MsgSettingEngine::Manual; + } + else if ( receveModeHome == EMmsReceivingReject && + receveModeForeign == EMmsReceivingReject ) + { + aRetrieval = MsgSettingEngine::No; + } + else if ( receveModeHome == EMmsReceivingPostpone && + receveModeForeign == EMmsReceivingPostpone ) + { + aRetrieval = MsgSettingEngine::Off; + } + // Should always be automatic@home & manaul@roam + else + { + aRetrieval = MsgSettingEngine::AutomInHomeNetwork; + } aAnonymousStatus = mMmsSetting->AcceptAnonymousMessages(); aMmsAdvertsStatus = mMmsSetting->AcceptAdvertisementMessages(); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/src/msgsettingengine.cpp --- a/messagingapp/msgsettings/settingsview/src/msgsettingengine.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgsettings/settingsview/src/msgsettingengine.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -22,7 +22,7 @@ #include "msgsettingengine.h" #include "smssettingsprivate.h" #include "mmssettingprivate.h" -#include "s60qconversions.h" +#include //Constructor MsgSettingEngine::MsgSettingEngine() @@ -237,7 +237,7 @@ for (int i = 0; i < accessPoints.Count(); i++) { HBufC* name = static_cast (accessPoints[i]); - QString qName = S60QConversions::s60DescToQString(name->Des()); + QString qName = XQConversions::s60DescToQString(name->Des()); nameList.append(qName); #ifdef _DEBUG_TRACES_ qDebug() << "\n " << qName; @@ -292,7 +292,7 @@ for (int i = 0; i < accessPoints.Count(); i++) { HBufC* name = accessPoints[i]; - QString qName = S60QConversions::s60DescToQString(name->Des()); + QString qName = XQConversions::s60DescToQString(name->Des()); nameList.append(qName); #ifdef _DEBUG_TRACES_ qDebug() << "\n qName"; @@ -341,8 +341,8 @@ << centreName << " " << centreNumber; #endif - HBufC* d_addr = S60QConversions::qStringToS60Desc(centreNumber); - HBufC* d_name = S60QConversions::qStringToS60Desc(centreName); + HBufC* d_addr = XQConversions::qStringToS60Desc(centreNumber); + HBufC* d_name = XQConversions::qStringToS60Desc(centreName); dptr_smsSettings->editSMSServiceCentre(d_addr, d_name, index); delete d_addr; @@ -368,8 +368,8 @@ #endif - HBufC* d_addr = S60QConversions::qStringToS60Desc(centreNumber); - HBufC* d_name = S60QConversions::qStringToS60Desc(centreName); + HBufC* d_addr = XQConversions::qStringToS60Desc(centreNumber); + HBufC* d_name = XQConversions::qStringToS60Desc(centreName); dptr_smsSettings->addSmsMessageCenter(d_addr, d_name); delete d_addr; @@ -409,8 +409,8 @@ dptr_smsSettings->smsCenterNameAndNumber(index, &d_addr, &d_name); - centreNumber = S60QConversions::s60DescToQString(d_addr->Des()); - centreName = S60QConversions::s60DescToQString(d_name->Des()); + centreNumber = XQConversions::s60DescToQString(d_addr->Des()); + centreName = XQConversions::s60DescToQString(d_name->Des()); #ifdef _DEBUG_TRACES_ qDebug() << "Exit smsCenterNameAndNumber " << centreNumber << " " diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/src/msgsettingsdataformcustomitem.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp --- a/messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -45,7 +45,7 @@ #define LOC_ADD_NEW hbTrId("txt_messaging_button_add_new") #define LOC_ALWAYS_AUTOMATIC hbTrId("txt_messaging_setlabel_val_always_automatic") #define LOC_AUTO_HOME_NETWORK hbTrId("txt_messaging_setlabel_val_auto_home_network") -#define LOC_MANUAL hbTrId("txt_messaging_setlabel_val_mannual") +#define LOC_MANUAL hbTrId("txt_messaging_setlabel_val_manual") #define LOC_MMS_YES hbTrId("txt_messaging_setlabel_allow_anonymous_mms_val_yes") #define LOC_MMS_NO hbTrId("txt_messaging_setlabel_allow_anonymous_mms_val_no") diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/src/msgsettingsview.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/src/msgsmscentersettingsform.cpp --- a/messagingapp/msgsettings/settingsview/src/msgsmscentersettingsform.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgsettings/settingsview/src/msgsmscentersettingsform.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -34,8 +34,6 @@ #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_BUTTON_DELETE hbTrId("txt_common_button_delete") -#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") MsgSMSCenterSettingsForm::MsgSMSCenterSettingsForm(int view, QGraphicsItem *parent) : @@ -191,7 +189,9 @@ void MsgSMSCenterSettingsForm::onPressedCustomButton() { - HbMessageBox::question(LOC_SMS_CENTRE_DELETE, this, SLOT(onDialogDeleteMsgCentre(HbAction*)), LOC_BUTTON_DELETE, LOC_BUTTON_CANCEL); + HbMessageBox::question(LOC_SMS_CENTRE_DELETE, this, + SLOT(onDialogDeleteMsgCentre(HbAction*)), + HbMessageBox::Delete | HbMessageBox::Cancel); } void MsgSMSCenterSettingsForm::onDialogDeleteMsgCentre(HbAction* action) diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/src/msgsmscenterview.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/stub_sis/settingsview_stub.pkg --- a/messagingapp/msgsettings/settingsview/stub_sis/settingsview_stub.pkg Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgsettings/settingsview/stub_sis/settingsview_stub.pkg Thu Jul 22 16:32:06 2010 +0100 @@ -23,4 +23,7 @@ %{"Nokia"} ; Unique Vendor name -:"Nokia" \ No newline at end of file +:"Nokia" + +;Files +""-"z:\sys\bin\settingsview.dll" diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgsettings/settingsview/stub_sis/settingsview_stub.sis Binary file messagingapp/msgsettings/settingsview/stub_sis/settingsview_stub.sis has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/appengine.pro --- a/messagingapp/msgui/appengine/appengine.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/appengine.pro Thu Jul 22 16:32:06 2010 +0100 @@ -20,10 +20,10 @@ DEPENDPATH += . src INCLUDEPATH += ../../../inc +INCLUDEPATH += ../msguiutils/inc INCLUDEPATH += ../../msgutils/unieditorutils/editorgenutils/inc -INCLUDEPATH += ../../msgutils/s60qconversions/inc INCLUDEPATH += ../../smartmessaging/ringbc/inc -INCLUDEPATH += /ext/mw/qtextensions/qtmobileextensions/include + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE DEFINES += BUILD_DLL @@ -46,6 +46,15 @@ "$${LITERAL_HASH}include " \ "rom/appengine.iby CORE_APP_LAYER_IBY_EXPORT_PATH(appengine.iby)" +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/appengine.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/appengine.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + # Input HEADERS += inc/conversationsengine.h \ inc/conversationmsgstorehandler.h \ @@ -69,7 +78,6 @@ LIBS += -lcsserverclientapi \ -lcsutils \ - -ls60qconversions \ -lconvergedmessageutils \ -lmsgs \ -lInetProtUtil \ @@ -88,6 +96,8 @@ -lsqldb \ -lestor \ -lFeatMgr \ - -lringbc + -lfbscli \ + -lringbc \ + -lmsguiutils diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/inc/conversationlistchangehandler.h --- a/messagingapp/msgui/appengine/inc/conversationlistchangehandler.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/inc/conversationlistchangehandler.h Thu Jul 22 16:32:06 2010 +0100 @@ -110,7 +110,14 @@ void ModifyConversationList( const CCsClientConversation& aClientConversation); - + + /** + * PartialDeleteConversationList + * This is for handling the partial delete of conversation event from server + * @param aClientConversation CCsClientConversation& - reference to client conversation + */ + void PartialDeleteConversationList( + const CCsClientConversation& aClientConversation); /** * RefreshConversationList * This is for handling refresh asynchronusly from the server. @@ -129,7 +136,18 @@ * Handles Conversation List received from server and updates into model */ void HandleConversationListL(); - + + /** + * CompareByConvTimeStamp + * Helper method to compare conversations by timestamp + * + * @param aObj1 CCsConversation object + * @param aObj2 CCsConversation object + * @return value based of timestamp comparison + */ + static TInt CompareByConvTimeStamp(const CCsClientConversation& aObj1, + const CCsClientConversation& aObj2); + private: // data diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/inc/conversationmsgstorehandler.h --- a/messagingapp/msgui/appengine/inc/conversationmsgstorehandler.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/inc/conversationmsgstorehandler.h Thu Jul 22 16:32:06 2010 +0100 @@ -184,6 +184,11 @@ * KErrGeneral for other cases */ TInt DownloadMessageL(TMsvId aId); + + /** + * Returns the Bio Type of a message + */ + int getMsgSubType(int msgId); private: diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/inc/conversationsengine.h --- a/messagingapp/msgui/appengine/inc/conversationsengine.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/inc/conversationsengine.h Thu Jul 22 16:32:06 2010 +0100 @@ -161,11 +161,23 @@ void emitConversationModelUpdated(); /** + * Updates the new conversation id for list view + */ + void emitOpenConversationViewIdUpdate(int newConversationId); + + void disableRegisterationForCVEvents(); + + /** * Emits conversationListModelPopulated signal */ void emitConversationListModelPopulated(); /** + * Emits conversationListModelEntryDeleted + */ + void emitConversationListModelEntryDeleted( int conversationId ); + + /** * Starts fetching remaing conversations */ void fetchMoreConversations(); @@ -210,6 +222,12 @@ */ RSqlDatabase& getDBHandle(TBool& isOpen); + /** + * Get the biotype of a message + * @param messageId + */ + int getMsgSubType(int messageId); + private: /** @@ -237,6 +255,17 @@ */ void conversationListModelPopulated(); + /** + * Signal to indicate the completion of conversation delete + * operation. + */ + void conversationListEntryDeleted( int conversationId ); + + /** + * Signal to specify the CV model empty now + */ + void conversationViewEmpty(); + private: /** diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/inc/conversationsengine_p.h --- a/messagingapp/msgui/appengine/inc/conversationsengine_p.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/inc/conversationsengine_p.h Thu Jul 22 16:32:06 2010 +0100 @@ -119,6 +119,18 @@ void registerForConversationUpdatesL(); /** + * Remove the CV notifs temporary for some time + * does not destroy the model as such + */ + void deRegisterCVUpdatesTemporary(); + + /** + * Register again after temporary de-register + * just need to set the new conversation id + */ + void registerAgainForConversationUpdatesL(int newConversationId); + + /** * Fetch ConversationId from contactId * @param contactId , contactId * @return conversationId @@ -133,6 +145,12 @@ TInt getConversationIdFromAddressL(TDesC& contactAddress); /** + * Get the latest conversation from the conversation cache by Id + * @param aConversationId for conversation is required + */ + CCsClientConversation* getConversationFromConversationIdL(TInt aConversationId); + + /** * Starts fetching remaing conversations */ void fetchMoreConversations(); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/inc/conversationsenginedefines.h --- a/messagingapp/msgui/appengine/inc/conversationsenginedefines.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/inc/conversationsenginedefines.h Thu Jul 22 16:32:06 2010 +0100 @@ -42,7 +42,8 @@ MessageLocation, MessageStore, ConversationAlias, - NotificationStatus + NotificationStatus, + PreviewIcon }; #endif /* CONVERSATIONS_ENGINE_DEFINES_H */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/inc/conversationsengineutility.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/inc/conversationsmodel.h --- a/messagingapp/msgui/appengine/inc/conversationsmodel.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/inc/conversationsmodel.h Thu Jul 22 16:32:06 2010 +0100 @@ -23,6 +23,8 @@ #include #include #include +#include +#include // FORWARD DECLARATIONS class CCsConversationEntry; @@ -83,6 +85,29 @@ */ RSqlDatabase& getDBHandle(TBool& isOpen); + /* + * Clears the pixmap cache & model + */ + void clearModel(); + + void emitConversationViewEmpty(); + +signals: + + /* + * Signal emitted to retrieve the pixmap icon + */ + void retrievePreviewIcon(int msgId, QString& filepath) const; + + void conversationViewEmpty(); + +private slots: + + /* + * Slot which handles retrievePreviewIcon signal + */ + void updatePreviewIcon(int msgId, QString& filePath); + private: /** @@ -123,6 +148,31 @@ void handleBioMessages(QStandardItem& item, const CCsConversationEntry& entry); + /** + * Populates preview icon into the previewicon cache + * @param pixmap, QPixmap + * @param filePath, filepath to be used if icon is not in Db + * @param msgId, key to pixmap in previewicon cache + * @param inDb, indicates if icon was available in Db (or) not + */ + void setPreviewIcon(QPixmap& pixmap, QString& filePath, int msgId, + bool inDb); + + /** + * Get the preview icon item if available in pixmap cache / create + * and return the preview icon + * @param msgId, key to pixmap in previewicon cache + * @param filePath, filepath to be used if icon is not in cache + */ + HbIcon* getPreviewIconItem(int msgId, QString& filepath) const; + + /** + * Check if a MMS is forwardable or not + * @param messageId, message id + * @return true/false + */ + bool validateMsgForForward(qint32 messageId); + private: /** @@ -158,6 +208,11 @@ * DB open. */ TBool iSqlDbOpen; + + /* + * preview-icon cache + */ + QCache previewIconCache; }; #endif // CONVERSATIONS_MODEL_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/inc/conversationssummarymodel.h --- a/messagingapp/msgui/appengine/inc/conversationssummarymodel.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/inc/conversationssummarymodel.h Thu Jul 22 16:32:06 2010 +0100 @@ -66,9 +66,10 @@ * Add a new row to the conversation summary model. * Overwrite the row if the message already exists. * @param conversation, CCsClientConversation + * @param caching, initial caching flag * */ - void addRow(const CCsClientConversation& conversation); + void addRow(const CCsClientConversation& conversation, bool caching = false); /** * Delete a row from conversation summary model. diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/src/conversationchangehandler.cpp --- a/messagingapp/msgui/appengine/src/conversationchangehandler.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/src/conversationchangehandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -104,7 +104,6 @@ const CCsConversationEntry& aConvEntry) { mConversationsModel->addRow(aConvEntry, true); - ConversationsEngine::instance()->emitConversationModelUpdated(); } // --------------------------------------------------------------------------- @@ -115,7 +114,13 @@ const CCsConversationEntry& aConvEntry) { mConversationsModel->deleteRow(aConvEntry.EntryId()); - ConversationsEngine::instance()->emitConversationModelUpdated(); + + //check if the CV model row count has become zero + // then needs to emit signal + if (mConversationsModel->rowCount() == 0) + { + mConversationsModel->emitConversationViewEmpty(); + } } //----------------------------------------------------------------------- diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/src/conversationlistchangehandler.cpp --- a/messagingapp/msgui/appengine/src/conversationlistchangehandler.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/src/conversationlistchangehandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -99,7 +99,8 @@ for (TInt i = 0; i < aClientConversationList.Count(); ++i) { CCsClientConversation *entry = aClientConversationList[i]->CloneL(); - mClientConversationList.AppendL(entry); + mClientConversationList.InsertInOrderAllowRepeats( entry, + ConversationsListChangeHandler::CompareByConvTimeStamp ); } if (aClientConversationList.Count() > 0) @@ -137,6 +138,17 @@ } //----------------------------------------------------------------------- +// This is for handling partial delete conversation event asynchronusly from the server +//----------------------------------------------------------------------- +// + +void ConversationsListChangeHandler::PartialDeleteConversationList( + const CCsClientConversation& aClientConversation) +{ + ConversationsEngine::instance()->emitConversationListModelEntryDeleted( aClientConversation.GetConversationEntryId() ); +} + +//----------------------------------------------------------------------- // This is for handling modify conversation event asynchronusly from the server //----------------------------------------------------------------------- // @@ -180,7 +192,7 @@ if (mCurrentIndex < mClientConversationList.Count()) { mConvSummaryModel->addRow( - * (mClientConversationList[mCurrentIndex])); + * (mClientConversationList[mCurrentIndex]),true); mCurrentIndex++; } else @@ -213,4 +225,24 @@ } +// ---------------------------------------------------------------------------- +// ConversationsListChangeHandler::CompareByConvTimeStamp +// --------------------------------------------------------------------------- +TInt ConversationsListChangeHandler::CompareByConvTimeStamp(const CCsClientConversation& aObj1, + const CCsClientConversation& aObj2) + { + TInt64 timestamp1 = aObj1.GetConversationEntry()->TimeStamp(); + TInt64 timestamp2 = aObj2.GetConversationEntry()->TimeStamp(); + + if (timestamp1 == timestamp2) + { + return 0; + } + else if (timestamp1 < timestamp2) + { + return 1; + } + return -1; + } + // EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/src/conversationmsgstorehandler.cpp --- a/messagingapp/msgui/appengine/src/conversationmsgstorehandler.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/src/conversationmsgstorehandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -26,7 +26,7 @@ #include "conversationmsgstorehandler.h" #include "draftsmodel.h" #include "MuiuOperationWait.h" -#include "MsgBioUids.h" +#include "msgbiouids.h" #include "UniEditorGenUtils.h" // SYSTEM INCLUDES @@ -952,6 +952,9 @@ { case KSenduiMtmSmsUidValue: msgType = ConvergedMessage::Sms; + if (entry.iBioType == KMsgBioNokiaServiceSentMessage.iUid) { + msgSubType = ConvergedMessage::NokiaService; + } break; case KSenduiMtmBtUidValue: msgType = ConvergedMessage::BT; @@ -982,12 +985,29 @@ else if (entry.iBioType == KMsgBioUidVCalendar.iUid) { msgSubType = ConvergedMessage::VCal; - } + } + else if (entry.iBioType == KMsgBioNokiaServiceSentMessage.iUid) { + msgSubType = ConvergedMessage::NokiaService; + } } - break; - default: - msgType = ConvergedMessage::None; - break; - } + break; + default: + msgType = ConvergedMessage::None; + break; } +} + +int ConversationMsgStoreHandler::getMsgSubType(int msgId) +{ + int msgType = ConvergedMessage::None; + int msgSubType = ConvergedMessage::None; + CMsvEntry* cEntry = NULL; + TRAPD(err, cEntry = iMsvSession->GetEntryL(msgId)); + if (err == KErrNone) { + TMsvEntry entry = cEntry->Entry(); + extractMsgType(entry, msgType, msgSubType); + } + return msgSubType; +} + // End of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/src/conversationsengine.cpp --- a/messagingapp/msgui/appengine/src/conversationsengine.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/src/conversationsengine.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -16,6 +16,9 @@ */ #include "conversationsengine.h" +#include +#include + #include "conversationsenginedefines.h" #include "convergedmessage.h" #include "conversationmsgstorehandler.h" @@ -24,7 +27,7 @@ #include "draftsmodel.h" #include "conversationsengine_p.h" #include "debugtraces.h" -#include "s60qconversions.h" +#include //--------------------------------------------------------------- // ConversationsEngine::instance @@ -52,6 +55,12 @@ d_ptr = new ConversationsEnginePrivate(mConversationMsgStoreHandler, mConversationsSummaryModel, mConversationsModel); + + connect (mConversationsModel, + SIGNAL(conversationViewEmpty()), + this, + SIGNAL(conversationViewEmpty())); + } //--------------------------------------------------------------- @@ -212,7 +221,27 @@ { displayName = indexList[0].data(DisplayName).toString(); address = indexList[0].data(ConversationAddress).toString(); - } + } + else + { + int error; + CCsClientConversation* clientConv = NULL; + TRAP(error, clientConv = d_ptr->getConversationFromConversationIdL(conversationId)); + + HBufC *name = clientConv->GetDisplayName(); + if (name && name->Length()) + { + displayName = XQConversions::s60DescToQString(*name); + } + + HBufC *addr = clientConv->GetConversationEntry()->Contact(); + if (addr && addr->Length()) + { + address = XQConversions::s60DescToQString(*addr); + } + + delete clientConv; + } } //--------------------------------------------------------------- @@ -224,7 +253,7 @@ qint64 conversationId = -1; int error; - HBufC* number = S60QConversions::qStringToS60Desc(address); + HBufC* number = XQConversions::qStringToS60Desc(address); TRAP(error,conversationId = d_ptr->getConversationIdFromAddressL(*number)); @@ -284,6 +313,35 @@ } //--------------------------------------------------------------- +// ConversationsEngine::emitConversationListModelEntryDeleted +// @see header +//--------------------------------------------------------------- +void ConversationsEngine::emitConversationListModelEntryDeleted( int conversationId ) +{ + emit conversationListEntryDeleted( conversationId ); +} + +//--------------------------------------------------------------- +// ConversationsEngine::emitOpenConversationViewIdUpdate +// @see header +//--------------------------------------------------------------- +void ConversationsEngine::emitOpenConversationViewIdUpdate( + int newConversationId) +{ + //also register for subscription now + d_ptr->registerAgainForConversationUpdatesL(newConversationId); +} + +//--------------------------------------------------------------- +// ConversationsEngine::disableRegisterationForCVEvents +// @see header +//--------------------------------------------------------------- +void ConversationsEngine::disableRegisterationForCVEvents() +{ + d_ptr->deRegisterCVUpdatesTemporary(); +} + +//--------------------------------------------------------------- // ConversationsEngine::fetchMoreConversations // @see header //--------------------------------------------------------------- @@ -344,5 +402,16 @@ return mConversationsModel->getDBHandle(isOpen); } + +//--------------------------------------------------------------- +// ConversationsEngine::getMsgSubType() +// @see header +//--------------------------------------------------------------- +int ConversationsEngine::getMsgSubType(int messageId) +{ + return mConversationMsgStoreHandler->getMsgSubType(messageId); +} + + //EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/src/conversationsengine_p.cpp --- a/messagingapp/msgui/appengine/src/conversationsengine_p.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/src/conversationsengine_p.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -51,13 +51,10 @@ //--------------------------------------------------------------- ConversationsEnginePrivate::~ConversationsEnginePrivate() { - delete mConvChangeHandler; - - delete mConvListChangeHandler; - + if( mClientConv ) { - if(mServer) + if(mServer && mConvChangeHandler) { TRAP_IGNORE(mServer->RemoveConversationChangeEventL( mConvChangeHandler,mClientConv)); @@ -65,7 +62,7 @@ delete mClientConv; mClientConv = NULL; } - if(mServer) + if(mServer && mConvListChangeHandler) { TRAP_IGNORE(mServer->RemoveConversationListChangeEventL( mConvListChangeHandler)); @@ -74,6 +71,11 @@ delete mServer; mServer = NULL; } + + delete mConvChangeHandler; + + delete mConvListChangeHandler; + } //--------------------------------------------------------------- @@ -219,6 +221,14 @@ return convId; } +//--------------------------------------------------------------- +// ConversationsEnginePrivate::getConversationFromConversationId +// @see header +//--------------------------------------------------------------- +CCsClientConversation* ConversationsEnginePrivate::getConversationFromConversationIdL(TInt aConversationId) +{ + return mServer->GetConversationFromConversationIdL(aConversationId); +} //--------------------------------------------------------------- // ConversationsEnginePrivate::clearConversationsL @@ -230,15 +240,17 @@ mConvChangeHandler->Cancel(); //Clear conversations model before populating with new data - mConversationsModel->clear(); + mConversationsModel->clearModel(); // Delete old CCsClientConversation object // Remove the old Conversation change observer if(mClientConv) - { - mServer->RemoveConversationChangeEventL (mConvChangeHandler ,mClientConv); + { + int error = KErrNone; + TRAP(error, mServer->RemoveConversationChangeEventL (mConvChangeHandler ,mClientConv)); delete mClientConv; mClientConv = NULL; + User::LeaveIfError(error); } QCRITICAL_WRITE("ConversationsEnginePrivate::clearConversationsL end."); @@ -258,6 +270,30 @@ } //--------------------------------------------------------------- +// ConversationsEnginePrivate::deRegisterCVUpdatesTemporary +// @see header +//--------------------------------------------------------------- +void ConversationsEnginePrivate::deRegisterCVUpdatesTemporary() +{ + mServer->RemoveConversationChangeEventL (mConvChangeHandler ,mClientConv); +} + +//--------------------------------------------------------------- +// ConversationsEnginePrivate::registerAgainForConversationUpdatesL +// @see header +//--------------------------------------------------------------- +void ConversationsEnginePrivate::registerAgainForConversationUpdatesL( + int newConversationId) +{ + //Add the Conversation Change for new conversationId + if(mClientConv) + { + mClientConv->SetConversationEntryId(newConversationId); + mServer->RequestConversationChangeEventL (mConvChangeHandler ,mClientConv); + } +} + +//--------------------------------------------------------------- // ConversationsEnginePrivate::ConversationList // @see header //--------------------------------------------------------------- diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/src/conversationsengineutility.cpp --- a/messagingapp/msgui/appengine/src/conversationsengineutility.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/src/conversationsengineutility.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include "conversationsengineutility.h" #include "convergedmessage.h" @@ -47,6 +47,7 @@ case ECsProvisioning: case ECsBioMsg_VCard: case ECsBioMsg_VCal: + case ECsBioMgs_NokiaService: mMessageType = ConvergedMessage::BioMsg; break; case ECsBlueTooth: @@ -112,6 +113,9 @@ case ECsAudio: messageSubType = ConvergedMessage::Audio; break; + case ECsBioMgs_NokiaService: + messageSubType = ConvergedMessage::NokiaService; + break; default: messageSubType = ConvergedMessage::None; break; diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/src/conversationsmodel.cpp --- a/messagingapp/msgui/appengine/src/conversationsmodel.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/src/conversationsmodel.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -19,26 +19,39 @@ #include "conversationsenginedefines.h" #include "conversationmsgstorehandler.h" #include "convergedmessage.h" -#include "s60qconversions.h" +#include #include "conversationsengineutility.h" #include "unidatamodelloader.h" #include "unidatamodelplugininterface.h" #include "ringbc.h" #include "msgcontacthandler.h" +#include "mmsconformancecheck.h" #include +#include #include "debugtraces.h" #include #include #include +#include +#include #include //CONSTANTS _LIT(KDbFileName, "c:[2002A542]conversations.db"); + // preview sql query -_LIT(KSelectConvMsgsStmt, "SELECT message_id, subject, body_text, preview_path, msg_property FROM conversation_messages WHERE message_id=:message_id "); +_LIT(KSelectConvMsgsStmt, "SELECT message_id, msg_processingstate, subject, body_text, preview_path, msg_property, preview_icon FROM conversation_messages WHERE message_id=:message_id "); + +//selecet preview-icon query +_LIT(KSelectPreviewIconStmt,"SELECT message_id, preview_icon FROM conversation_messages WHERE message_id = :message_id "); +// preview-cache max cost (items) +const int CACHE_COST = 50; +//Preview thumbnail size +const int KWidth = 9.5 * 6.7; +const int KHeight = 9.5 * 6.7; //--------------------------------------------------------------- // ConversationsModel::ConversationsModel // Constructor @@ -52,6 +65,11 @@ { iSqlDbOpen = ETrue; } + previewIconCache.setMaxCost(CACHE_COST); + + int err = connect(this, SIGNAL(retrievePreviewIcon(int, QString&)), this, + SLOT(updatePreviewIcon(int, QString&))); + QCRITICAL_WRITE_FORMAT("Error from connect()", err) iDataModelPluginLoader = new UniDataModelLoader; iMmsDataPlugin = iDataModelPluginLoader->getDataModelPlugin(ConvergedMessage::Mms); iBioMsgPlugin = iDataModelPluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg); @@ -66,6 +84,9 @@ //Close SQL-DB iSqlDb.Close(); + //clear preview-cache + previewIconCache.clear(); + if (iDataModelPluginLoader) { delete iDataModelPluginLoader; iDataModelPluginLoader = NULL; @@ -146,6 +167,13 @@ value = item->data(SendingState); break; } + case PreviewIcon: + { + QString filepath(item->data(Attachments).toString()); + int msgId = item->data(ConvergedMsgId).toInt(); + HbIcon *icon = getPreviewIconItem(msgId, filepath); + return *icon; + } case MessagePriority: { value = item->data(MessagePriority); @@ -178,7 +206,7 @@ } case DisplayName: // Fall through start value = item->data(DisplayName); - break; + break; case Avatar: // Fall througn end value = item->data(Avatar); break; @@ -272,10 +300,10 @@ HBufC* description = entry.Description(); QString subject(""); if (description && description->Length()) { - subject = (S60QConversions::s60DescToQString(*description)); + subject = (XQConversions::s60DescToQString(*description)); } - // time stamp + // time stamp TTime unixEpoch(KUnixEpoch); TTimeIntervalSeconds seconds; TTime timeStamp(entry.TimeStamp()); @@ -285,7 +313,7 @@ //contact details HBufC* contact = entry.Contact(); if (contact && contact->Length()) { - item.setData(S60QConversions::s60DescToQString(*contact), ConversationAddress); + item.setData(XQConversions::s60DescToQString(*contact), ConversationAddress); } // message type. @@ -322,7 +350,7 @@ item.setData(ConvergedMessage::Outbox, MessageLocation); } - //message specific handling + //message specific handling if (msgType == ConvergedMessage::Mms) { QCRITICAL_WRITE("ConversationsModel::populateItem MMS start.") handleMMS(item, entry); @@ -347,6 +375,22 @@ } //--------------------------------------------------------------- +// ConversationsModel::validateMsgForForward +// @see header file +//--------------------------------------------------------------- +bool ConversationsModel::validateMsgForForward(qint32 messageId) +{ + bool retValue = true; + //Validate if the mms msg can be forwarded or not + MmsConformanceCheck* mmsConformanceCheck = new MmsConformanceCheck; + retValue = mmsConformanceCheck->validateMsgForForward(messageId); + + delete mmsConformanceCheck; + return retValue; +} + + +//--------------------------------------------------------------- // ConversationsModel::handleMMS // @see header //--------------------------------------------------------------- @@ -357,7 +401,7 @@ bool isEntryInDb = false; TInt err = KErrNone; - + //check if db is open and query db if (iSqlDbOpen) { @@ -368,51 +412,100 @@ if (KErrNone == err) { TInt msgIdIndex = sqlSelectStmt.ParameterIndex(_L(":message_id")); + TInt msgProcessingStateIndex = sqlSelectStmt.ColumnIndex(_L("msg_processingstate")); TInt subjectIndex = sqlSelectStmt.ColumnIndex(_L("subject")); TInt bodyIndex = sqlSelectStmt.ColumnIndex(_L("body_text")); TInt previewPathIndex = sqlSelectStmt.ColumnIndex( _L("preview_path")); TInt msgpropertyIndex = sqlSelectStmt.ColumnIndex( - _L("msg_property")); + _L("msg_property")); + TInt previewIconIndex = sqlSelectStmt.ColumnIndex( + _L("preview_icon")); err = sqlSelectStmt.BindInt(msgIdIndex, msgId); - + // populate item if ((KErrNone == err) && (sqlSelectStmt.Next() == KSqlAtRow)) { - RBuf subjectBuffer; - subjectBuffer.Create(sqlSelectStmt.ColumnSize(subjectIndex)); - sqlSelectStmt.ColumnText(subjectIndex, subjectBuffer); + int msgProcessingState = 0; + msgProcessingState = sqlSelectStmt.ColumnInt( + msgProcessingStateIndex); + if (msgProcessingState == EPreviewMsgProcessed) + { + // 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(); - item.setData( - S60QConversions::s60DescToQString(subjectBuffer), - Subject); - subjectBuffer.Close(); + RBuf bodyBuffer; + bodyBuffer.Create(sqlSelectStmt.ColumnSize(bodyIndex)); + sqlSelectStmt.ColumnText(bodyIndex, bodyBuffer); + + item.setData( + XQConversions::s60DescToQString(bodyBuffer), + BodyText); + bodyBuffer.Close(); - RBuf bodyBuffer; - bodyBuffer.Create(sqlSelectStmt.ColumnSize(bodyIndex)); - sqlSelectStmt.ColumnText(bodyIndex, bodyBuffer); + RBuf previewPathBuffer; + previewPathBuffer.Create(sqlSelectStmt.ColumnSize( + previewPathIndex)); + sqlSelectStmt.ColumnText(previewPathIndex, + previewPathBuffer); - item.setData(S60QConversions::s60DescToQString(bodyBuffer), - BodyText); - bodyBuffer.Close(); + //Rightnow set inside attachments + QString attachmentPath(XQConversions::s60DescToQString( + previewPathBuffer)); + + item.setData(attachmentPath, Attachments); + previewPathBuffer.Close(); - RBuf previewPathBuffer; - previewPathBuffer.Create(sqlSelectStmt.ColumnSize( - previewPathIndex)); - sqlSelectStmt.ColumnText(previewPathIndex, previewPathBuffer); + int msgProperty = 0; + msgProperty = sqlSelectStmt.ColumnInt(msgpropertyIndex); + item.setData(msgProperty, MessageProperty); + + RSqlColumnReadStream stream; + //Get data from binary column BLOB + TInt err = stream.ColumnBinary(sqlSelectStmt, + previewIconIndex); + + QCRITICAL_WRITE_FORMAT("Error from ColumnBinary()", err) + + if (err == KErrNone) + { + CFbsBitmap *bitmap = new CFbsBitmap; + TRAPD(err,bitmap->InternalizeL(stream)); + QCRITICAL_WRITE_FORMAT("Error from bitmap InternalizeL()", err) - //Rightnow set inside attachments - item.setData(S60QConversions::s60DescToQString( - previewPathBuffer), Attachments); - previewPathBuffer.Close(); + //convert bitmap to pixmap + if (err == KErrNone) + { + TSize size = bitmap->SizeInPixels(); + int bytesPerLine = bitmap->ScanLineLength( + size.iWidth, bitmap->DisplayMode()); + const uchar* dataPtr = + (const uchar*) bitmap->DataAddress(); - int msgProperty = 0; - msgProperty = sqlSelectStmt.ColumnInt(msgpropertyIndex); - item.setData(msgProperty, MessageProperty); + QPixmap pixmap = QPixmap::fromImage(QImage( + dataPtr, size.iWidth, size.iHeight, + bytesPerLine, QImage::Format_RGB16)); + + setPreviewIcon(pixmap, attachmentPath, msgId, + true); - //set flag to disable fallback option - isEntryInDb = true; + } + //remove bitmap + delete bitmap; + } + + //set flag to disable fallback option + isEntryInDb = true; + } } } sqlSelectStmt.Close(); @@ -422,7 +515,12 @@ //populate from data plugins if (!isEntryInDb || err != KErrNone) { - iMmsDataPlugin->setMessageId(entry.EntryId()); + int error = iMmsDataPlugin->setMessageId(entry.EntryId()); + if(error != KErrNone) + { + // skip all + return; + } int msgProperty = 0; if (iMmsDataPlugin->attachmentCount() > 0) @@ -430,6 +528,11 @@ msgProperty |= EPreviewAttachment; } + if(validateMsgForForward(entry.EntryId())) + { + msgProperty |= EPreviewForward; + } + //subject item.setData(iMmsDataPlugin->subject(), Subject); @@ -457,24 +560,48 @@ isBodyTextSet = true; file.close(); } - if (!isImageSet && objectList[index]->mimetype().contains( + if (!isVideoSet && !isImageSet && objectList[index]->mimetype().contains( "image")) { isImageSet = true; msgProperty |= EPreviewImage; + if (objectList[index]->isProtected()) + { + msgProperty |= EPreviewProtectedImage; + } + if (objectList[index]->isCorrupted()) + { + msgProperty |= EPreviewCorruptedImage; + } imagePath = objectList[index]->path(); } - if (!isAudioSet && objectList[index]->mimetype().contains( + if (!isVideoSet && !isAudioSet && objectList[index]->mimetype().contains( "audio")) { msgProperty |= EPreviewAudio; + if (objectList[index]->isProtected()) + { + msgProperty |= EPreviewProtectedAudio; + } + if (objectList[index]->isCorrupted()) + { + msgProperty |= EPreviewCorruptedAudio; + } isAudioSet = true; } - if (!isVideoSet && objectList[index]->mimetype().contains( + if (!( isImageSet || isAudioSet) && !isVideoSet && objectList[index]->mimetype().contains( "video")) { isVideoSet = true; msgProperty |= EPreviewVideo; + if (objectList[index]->isProtected()) + { + msgProperty |= EPreviewProtectedVideo; + } + if (objectList[index]->isCorrupted()) + { + msgProperty |= EPreviewCorruptedVideo; + } videoPath = objectList[index]->path(); } } @@ -483,14 +610,28 @@ delete slide; } } + QPixmap pixmap; //populate item with the attachment list + //TODO: This code is not required bcoz video icon is show and not preview if (isVideoSet) { item.setData(videoPath, Attachments); + // Store thumbnail only for non protected, non corrupted content. + if (!(EPreviewProtectedVideo & msgProperty) && + !(EPreviewCorruptedVideo & msgProperty)) + { + setPreviewIcon(pixmap, videoPath, msgId, false); + } } else if (isImageSet) { item.setData(imagePath, Attachments); + // Store thumbnail only for non protected, non corrupted content. + if (!(EPreviewProtectedImage & msgProperty) && + !(EPreviewCorruptedImage & msgProperty)) + { + setPreviewIcon(pixmap, imagePath, msgId, false); + } } //populate msgProperty item.setData(msgProperty, MessageProperty); @@ -520,28 +661,28 @@ { return; } - + // fetch relevent info to show in CV // msg size QString estimatedMsgSizeStr = QString("%1").arg(0); estimatedMsgSizeStr.append(" Kb"); - TRAP_IGNORE(estimatedMsgSizeStr = + 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; mMsgStoreHandler->NotificationStatus(status, statusStr); - + // create data for bodytext role QString dataText; dataText.append("Size: "); // TODO: use logical str name @@ -580,7 +721,7 @@ { //TODO, needs to be revisited again, once BT team provides the solution for //BT received as Biomsg issue. - QString description = S60QConversions::s60DescToQString(*(entry.Description())); + QString description = XQConversions::s60DescToQString(*(entry.Description())); if (description.contains(".vcf") || description.contains(".ics")) // "vCard" { @@ -591,8 +732,8 @@ QString displayName = MsgContactHandler::getVCardDisplayName( description); item.setData(displayName, BodyText); - } - else + } + else { if (description.contains(".vcs")) // "vCalendar" { @@ -626,10 +767,11 @@ QString attachmentPath = attList[0]->path(); //get display-name and set as bodytext - QString displayName = + QString displayName = MsgContactHandler::getVCardDisplayName( attachmentPath); item.setData(displayName, BodyText); + item.setData(attachmentPath, Attachments); // clear attachement list : its allocated at data model while (!attList.isEmpty()) { @@ -659,7 +801,7 @@ HBufC* description = entry.Description(); QString subject(""); if (description && description->Length()) { - subject = (S60QConversions::s60DescToQString(*description)); + subject = (XQConversions::s60DescToQString(*description)); item.setData(subject, BodyText); } } @@ -674,4 +816,164 @@ isOpen = iSqlDbOpen; return iSqlDb; } + +//--------------------------------------------------------------- +// ConversationsModel::setPreviewIcon() +// @see header +//--------------------------------------------------------------- +void ConversationsModel::setPreviewIcon(QPixmap& pixmap, QString& filePath, + int msgId, bool inDb) +{ + + //Since the population happens in reverse this check is needed so that + //most recent items have their icons present in cache + if (previewIconCache.totalCost() >= previewIconCache.maxCost()) + return; + + // if not found in db, set from file path + if (!inDb) + { + QPixmap pixmap(filePath); + QPixmap scaledPixmap = pixmap.scaled(KWidth, KHeight, Qt::IgnoreAspectRatio); + HbIcon *previewIcon = new HbIcon(scaledPixmap); + + previewIconCache.insert(msgId, previewIcon); + + } + else + { + HbIcon *previewIcon = new HbIcon(pixmap); + previewIconCache.insert(msgId, previewIcon); + } +} + +//--------------------------------------------------------------- +// ConversationsModel::getPreviewIconItem() +// @see header +//--------------------------------------------------------------- +HbIcon* ConversationsModel::getPreviewIconItem(int msgId, + QString& filepath) const +{ + QCRITICAL_WRITE("ConversationsModel::getPreviewIconItem start.") + + //Initialize icon from the Cache will be NULL if Item not present + HbIcon* previewIcon = previewIconCache[msgId]; + if (!previewIcon) + { + //This is done in this way as non-const function call cant be done here + emit retrievePreviewIcon(msgId, filepath); + + previewIcon = previewIconCache[msgId]; + } + + QCRITICAL_WRITE("ConversationsModel::getPreviewIconItem start.") + + return previewIcon; +} + +//--------------------------------------------------------------- +// ConversationsModel::updatePreviewIcon() +// @see header +//--------------------------------------------------------------- +void ConversationsModel::updatePreviewIcon(int msgId, QString& filePath) +{ + QCRITICAL_WRITE("ConversationsModel::updatePreviewIcon start.") + + //sql query to get preview-icon from DB + bool imagePreviewed = false; + QPixmap pixmap; + + if (iSqlDbOpen) + { + RSqlStatement sqlSelectPreviewIconStmt; + TInt err = sqlSelectPreviewIconStmt.Prepare(iSqlDb, + KSelectPreviewIconStmt); + + QCRITICAL_WRITE_FORMAT("Error from Prepare()", err) + + if (err == KErrNone) + { + //msg_id + TInt msgIdIndex = sqlSelectPreviewIconStmt.ParameterIndex( + _L(":message_id")); + sqlSelectPreviewIconStmt.BindInt(msgIdIndex, msgId); + + // get preview-icon from DB + err = sqlSelectPreviewIconStmt.Next(); + QCRITICAL_WRITE_FORMAT("Error from Next()", err) + + if (err == KSqlAtRow) + { + TInt previewIconIndex = sqlSelectPreviewIconStmt.ColumnIndex( + _L("preview_icon")); + + RSqlColumnReadStream stream; + + //Get data from binary column BLOB + err = stream.ColumnBinary(sqlSelectPreviewIconStmt, + previewIconIndex); + + QCRITICAL_WRITE_FORMAT("Error from ColumnBinary()", err) + + if (err == KErrNone) + { + CFbsBitmap *bitmap = new CFbsBitmap; + TRAPD(err,bitmap->InternalizeL(stream)); + QCRITICAL_WRITE_FORMAT("Error from bitmap InternalizeL()", err) + + //convert bitmap to pixmap + if (err == KErrNone) + { + TSize size = bitmap->SizeInPixels(); + int bytesPerLine = bitmap->ScanLineLength(size.iWidth, + bitmap->DisplayMode()); + const uchar* dataPtr = + (const uchar*) bitmap->DataAddress(); + + pixmap = QPixmap::fromImage(QImage(dataPtr, + size.iWidth, size.iHeight, bytesPerLine, + QImage::Format_RGB16)); + + imagePreviewed = true; + + QCRITICAL_WRITE("Bitmap Conversion completed") + } + //remove bitmap + delete bitmap; + } + //close stream + stream.Close(); + } + } + sqlSelectPreviewIconStmt.Close(); + } + + // if not found in db, set from file path + if (!imagePreviewed) + { + QPixmap orgPixmap(filePath); + pixmap = orgPixmap.scaled(63.65, 63.65, Qt::IgnoreAspectRatio); + } + HbIcon * previewIcon = new HbIcon(pixmap); + + previewIconCache.insert(msgId, previewIcon); + + QCRITICAL_WRITE("ConversationsModel::updatePreviewIcon end.") + +} + +//--------------------------------------------------------------- +// ConversationsModel::clearModel() +// @see header +//--------------------------------------------------------------- +void ConversationsModel::clearModel() +{ + clear(); + previewIconCache.clear(); +} + +void ConversationsModel:: emitConversationViewEmpty() +{ + emit conversationViewEmpty(); +} //EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/src/conversationssummarymodel.cpp --- a/messagingapp/msgui/appengine/src/conversationssummarymodel.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/src/conversationssummarymodel.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -18,12 +18,14 @@ #include "conversationssummarymodel.h" #include "conversationsenginedefines.h" #include "conversationsengineutility.h" -#include "s60qconversions.h" +#include #include "convergedmessage.h" #include "unidatamodelloader.h" #include "unidatamodelplugininterface.h" #include "ringbc.h" #include "msgcontacthandler.h" +#include "debugtraces.h" + #include #include #include @@ -36,6 +38,8 @@ ConversationsSummaryModel::ConversationsSummaryModel(QObject* parent) :QStandardItemModel(parent) { + QStandardItemModel::setSortRole(TimeStamp); + QStandardItemModel::sort(0, Qt::DescendingOrder); } //--------------------------------------------------------------- @@ -154,7 +158,7 @@ // @see header //--------------------------------------------------------------- void ConversationsSummaryModel::addRow( - const CCsClientConversation& conversation) + const CCsClientConversation& conversation, bool caching) { int convId = conversation.GetConversationEntryId(); @@ -176,7 +180,12 @@ QModelIndex index = indexList[0]; QStandardItem* item = this->item(index.row(), 0); populateItem(*item,conversation); - } + } + // no need to sort if it is initial caching, as sorting is already done + if (!caching) + { + QStandardItemModel::sort(0, Qt::DescendingOrder); + } } //--------------------------------------------------------------- @@ -204,6 +213,8 @@ void ConversationsSummaryModel::populateItem(QStandardItem& item, const CCsClientConversation& conversation) { + QCRITICAL_WRITE("ConversationsSummaryModel::populateItem start."); + //get entry CCsConversationEntry* conEntry = conversation.GetConversationEntry(); //error scenario @@ -240,7 +251,7 @@ HBufC* body = conEntry->Description(); if( body && body->Length()) { - QString bodytext(S60QConversions::s60DescToQString(*body)); + QString bodytext(XQConversions::s60DescToQString(*body)); item.setData(bodytext, BodyText); item.setData(bodytext, Subject ); } @@ -263,7 +274,7 @@ //display name if(disName && disName->Length()) { - displayName = S60QConversions::s60DescToQString(*disName); + displayName = XQConversions::s60DescToQString(*disName); item.setData(displayName,DisplayName); } @@ -272,7 +283,7 @@ QString contactNumber(""); if ( contactno && contactno->Length() ) { - contactNumber = S60QConversions::s60DescToQString(*contactno); + contactNumber = XQConversions::s60DescToQString(*contactno); } item.setData(contactNumber, ConversationAddress); @@ -281,7 +292,9 @@ item.setData(contactId, ContactId); // unread status - item.setData(conEntry->IsAttributeSet(ECsAttributeUnread),UnReadStatus); + item.setData(conEntry->IsAttributeSet(ECsAttributeUnread),UnReadStatus); + + QCRITICAL_WRITE("ConversationsSummaryModel::populateItem start."); } @@ -294,7 +307,7 @@ { //TODO, needs to be revisited again, once BT team provides the solution for //BT received as Biomsg issue. - QString description = S60QConversions::s60DescToQString(*(entry.Description())); + QString description = XQConversions::s60DescToQString(*(entry.Description())); if (description.contains(".vcf") || description.contains(".ics")) // "vCard" { @@ -369,12 +382,30 @@ } } } - else { + + else if(ConvergedMessage::NokiaService == msgSubType){ + // This is a bio message so lets parse it and see if it has a associated attachment .. + if (bioMsgPlugin->attachmentCount() > 0) { + // TODO : need to confirm if we need to read from attachment + } + else {// description + HBufC* description = entry.Description(); + QString subject(""); + if (description && description->Length()) { + subject = (XQConversions::s60DescToQString(*description)); + item.setData(subject, BodyText); + } + + } + + } + + else { // description HBufC* description = entry.Description(); QString subject(""); if (description && description->Length()) { - subject = (S60QConversions::s60DescToQString(*description)); + subject = (XQConversions::s60DescToQString(*description)); item.setData(subject, BodyText); } } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/src/draftsmodel.cpp --- a/messagingapp/msgui/appengine/src/draftsmodel.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/src/draftsmodel.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -18,7 +18,6 @@ #include "draftsmodel.h" #include "conversationsenginedefines.h" #include "conversationsengineutility.h" -#include "s60qconversions.h" #include "conversationsengineutility.h" #include @@ -26,7 +25,7 @@ #include #include #include - +#include //CONSTANTS const QString DATE_FORMAT("dd/MM"); //Date format. const QString TIME_FORMAT("hh:mm"); //Time format. @@ -223,7 +222,7 @@ item.setData(ConversationsEngineUtility::messageType(entry.iMtm.iUid), MessageType); // description - QString Description(S60QConversions::s60DescToQString(entry.iDescription)); + QString Description(XQConversions::s60DescToQString(entry.iDescription)); item.setData(Description, Subject); // time stamp @@ -234,7 +233,7 @@ item.setData(seconds.Int(), TimeStamp); // contact details - QString contact(S60QConversions::s60DescToQString(entry.iDetails)); + QString contact(XQConversions::s60DescToQString(entry.iDetails)); item.setData(contact, DisplayName); // Attachments diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/tsrc/bwins/testconversationengineu.def --- a/messagingapp/msgui/appengine/tsrc/bwins/testconversationengineu.def Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -EXPORTS - ?trUtf8@TConversationEngine@@SA?AVQString@@PBD0H@Z @ 1 NONAME ; class QString TConversationEngine::trUtf8(char const *, char const *, int) - ?tr@TConversationEngine@@SA?AVQString@@PBD0H@Z @ 2 NONAME ; class QString TConversationEngine::tr(char const *, char const *, int) - ?fetchMoreConversations@ConversationsEngine@@QAEXXZ @ 3 NONAME ; void ConversationsEngine::fetchMoreConversations(void) - ?NotifyNewConversationClientAndUpdateCLV@TConversationEngine@@AAEXXZ @ 4 NONAME ; void TConversationEngine::NotifyNewConversationClientAndUpdateCLV(void) - ?FetchMoreConversations@TConversationEngine@@AAEXXZ @ 5 NONAME ; void TConversationEngine::FetchMoreConversations(void) - ?tr@TConversationEngine@@SA?AVQString@@PBD0@Z @ 6 NONAME ; class QString TConversationEngine::tr(char const *, char const *) - ?FetchConversationsAndUpdateCV@TConversationEngine@@AAEXXZ @ 7 NONAME ; void TConversationEngine::FetchConversationsAndUpdateCV(void) - ?deleteConversations@ConversationsEngine@@QAE_N_J@Z @ 8 NONAME ; bool ConversationsEngine::deleteConversations(long long) - ?staticMetaObject@TConversationEngine@@2UQMetaObject@@B @ 9 NONAME ; struct QMetaObject const TConversationEngine::staticMetaObject - ?DeleteConversationL@CCSRequestHandler@@QAEXH@Z @ 10 NONAME ; void CCSRequestHandler::DeleteConversationL(int) - ?trUtf8@ConversationsEngine@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString ConversationsEngine::trUtf8(char const *, char const *) - ?emitConversationListModelPopulated@ConversationsEngine@@QAEXXZ @ 12 NONAME ; void ConversationsEngine::emitConversationListModelPopulated(void) - ?GetConversationsFromServer@TConversationEngine@@AAEXXZ @ 13 NONAME ; void TConversationEngine::GetConversationsFromServer(void) - ?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) - ?qt_metacast@TConversationEngine@@UAEPAXPBD@Z @ 16 NONAME ; void * TConversationEngine::qt_metacast(char const *) - ?GetMessagingHistoryL@CCSRequestHandler@@QAEXH@Z @ 17 NONAME ; void CCSRequestHandler::GetMessagingHistoryL(int) - ?downloadOperationSupported@ConversationsEngine@@QAE_NH@Z @ 18 NONAME ; bool ConversationsEngine::downloadOperationSupported(int) - ?RemoveConversationListChangeEventL@CCSRequestHandler@@QAEXPAVMCsConversationListChangeObserver@@@Z @ 19 NONAME ; void CCSRequestHandler::RemoveConversationListChangeEventL(class MCsConversationListChangeObserver *) - ?GetConversationIdL@CCSRequestHandler@@QAEHH@Z @ 20 NONAME ; int CCSRequestHandler::GetConversationIdL(int) - ?getConversationsModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 21 NONAME ; class QStandardItemModel * ConversationsEngine::getConversationsModel(void) - ?getStaticMetaObject@TConversationEngine@@SAABUQMetaObject@@XZ @ 22 NONAME ; struct QMetaObject const & TConversationEngine::getStaticMetaObject(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) - ?ClearConversations@TConversationEngine@@AAEXXZ @ 25 NONAME ; void TConversationEngine::ClearConversations(void) - ?GetConversationIDFromContatcID@TConversationEngine@@AAEXXZ @ 26 NONAME ; void TConversationEngine::GetConversationIDFromContatcID(void) - ?CheckCurrentConversationID@TConversationEngine@@AAEXXZ @ 27 NONAME ; void TConversationEngine::CheckCurrentConversationID(void) - ?getConversationsSummaryModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 28 NONAME ; class QStandardItemModel * ConversationsEngine::getConversationsSummaryModel(void) - ?RequestConversationListChangeEventL@CCSRequestHandler@@QAEXPAVMCsConversationListChangeObserver@@@Z @ 29 NONAME ; void CCSRequestHandler::RequestConversationListChangeEventL(class MCsConversationListChangeObserver *) - ?conversationListModelPopulated@ConversationsEngine@@IAEXXZ @ 30 NONAME ; void ConversationsEngine::conversationListModelPopulated(void) - ?ShutdownServerL@CCSRequestHandler@@QAEXXZ @ 31 NONAME ; void CCSRequestHandler::ShutdownServerL(void) - ?GetTotalUnreadCountL@CCSRequestHandler@@QAEKXZ @ 32 NONAME ; unsigned long CCSRequestHandler::GetTotalUnreadCountL(void) - ??0ConversationsEngine@@AAE@PAVQObject@@@Z @ 33 NONAME ; ConversationsEngine::ConversationsEngine(class QObject *) - ?getContactDetails@ConversationsEngine@@QAEX_JAAVQString@@1@Z @ 34 NONAME ; void ConversationsEngine::getContactDetails(long long, class QString &, class QString &) - ?RemoveCachingStatusEventL@CCSRequestHandler@@QAEXPAVMCsCachingStatusObserver@@@Z @ 35 NONAME ; void CCSRequestHandler::RemoveCachingStatusEventL(class MCsCachingStatusObserver *) - ?tr@ConversationsEngine@@SA?AVQString@@PBD0@Z @ 36 NONAME ; class QString ConversationsEngine::tr(char const *, char const *) - ?GetConversationListL@CCSRequestHandler@@QAEXXZ @ 37 NONAME ; void CCSRequestHandler::GetConversationListL(void) - ?getConversations@ConversationsEngine@@QAE_N_J@Z @ 38 NONAME ; bool ConversationsEngine::getConversations(long long) - ?metaObject@TConversationEngine@@UBEPBUQMetaObject@@XZ @ 39 NONAME ; struct QMetaObject const * TConversationEngine::metaObject(void) const - ?GetCachingStatusL@CCSRequestHandler@@QAEEXZ @ 40 NONAME ; unsigned char CCSRequestHandler::GetCachingStatusL(void) - ?RequestCachingStatusEventL@CCSRequestHandler@@QAEXPAVMCsCachingStatusObserver@@@Z @ 41 NONAME ; void CCSRequestHandler::RequestCachingStatusEventL(class MCsCachingStatusObserver *) - ?initTestCase@TConversationEngine@@AAEXXZ @ 42 NONAME ; void TConversationEngine::initTestCase(void) - ?GetConversationIDFromAddress@TConversationEngine@@AAEXXZ @ 43 NONAME ; void TConversationEngine::GetConversationIDFromAddress(void) - ?ClearMessagingHistoryL@CCSRequestHandler@@QAEXH@Z @ 44 NONAME ; void CCSRequestHandler::ClearMessagingHistoryL(int) - ?GetConversationsL@CCSRequestHandler@@QAEXPAVCCsClientConversation@@@Z @ 45 NONAME ; void CCSRequestHandler::GetConversationsL(class CCsClientConversation *) - ?NotifyModifyConversationClientAndUpdateCLV@TConversationEngine@@AAEXXZ @ 46 NONAME ; void TConversationEngine::NotifyModifyConversationClientAndUpdateCLV(void) - ?emitConversationModelPopulated@ConversationsEngine@@QAEXXZ @ 47 NONAME ; void ConversationsEngine::emitConversationModelPopulated(void) - ?qt_metacall@ConversationsEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 48 NONAME ; int ConversationsEngine::qt_metacall(enum QMetaObject::Call, int, void * *) - ?NotifyNewConversationEntryAndUpdateCV@TConversationEngine@@AAEXXZ @ 49 NONAME ; void TConversationEngine::NotifyNewConversationEntryAndUpdateCV(void) - ?deleteAllDraftMessages@ConversationsEngine@@QAEXXZ @ 50 NONAME ; void ConversationsEngine::deleteAllDraftMessages(void) - ?getConversationIdFromAddress@ConversationsEngine@@QAE_JVQString@@@Z @ 51 NONAME ; long long ConversationsEngine::getConversationIdFromAddress(class QString) - ?metaObject@ConversationsEngine@@UBEPBUQMetaObject@@XZ @ 52 NONAME ; struct QMetaObject const * ConversationsEngine::metaObject(void) const - ??1ConversationsEngine@@UAE@XZ @ 53 NONAME ; ConversationsEngine::~ConversationsEngine(void) - ?GetConversationIdFromAddressL@CCSRequestHandler@@QAEHAAVTDesC16@@@Z @ 54 NONAME ; int CCSRequestHandler::GetConversationIdFromAddressL(class TDesC16 &) - ?markAsReadAndGetType@ConversationsEngine@@QAEXHAAH0@Z @ 55 NONAME ; void ConversationsEngine::markAsReadAndGetType(int, int &, int &) - ?qt_metacast@ConversationsEngine@@UAEPAXPBD@Z @ 56 NONAME ; void * ConversationsEngine::qt_metacast(char const *) - ?getDraftsModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 57 NONAME ; class QStandardItemModel * ConversationsEngine::getDraftsModel(void) - ?MarkMessagingHistoryReadL@CCSRequestHandler@@QAEXH@Z @ 58 NONAME ; void CCSRequestHandler::MarkMessagingHistoryReadL(int) - ?conversationModelUpdated@ConversationsEngine@@IAEXXZ @ 59 NONAME ; void ConversationsEngine::conversationModelUpdated(void) - ?NewLC@CCSRequestHandler@@SAPAV1@XZ @ 60 NONAME ; class CCSRequestHandler * CCSRequestHandler::NewLC(void) - ?getStaticMetaObject@ConversationsEngine@@SAABUQMetaObject@@XZ @ 61 NONAME ; struct QMetaObject const & ConversationsEngine::getStaticMetaObject(void) - ?DeleteConversationAndUpdateCV@TConversationEngine@@AAEXXZ @ 62 NONAME ; void TConversationEngine::DeleteConversationAndUpdateCV(void) - ?markMessagesRead@ConversationsEngine@@QAE_NAAV?$QList@H@@@Z @ 63 NONAME ; bool ConversationsEngine::markMessagesRead(class QList &) - ?cleanupTestCase@TConversationEngine@@AAEXXZ @ 64 NONAME ; void TConversationEngine::cleanupTestCase(void) - ?conversationModelPopulated@ConversationsEngine@@IAEXXZ @ 65 NONAME ; void ConversationsEngine::conversationModelPopulated(void) - ?downloadMessage@ConversationsEngine@@QAEHH@Z @ 66 NONAME ; int ConversationsEngine::downloadMessage(int) - ?MarkConversationReadL@CCSRequestHandler@@QAEXH@Z @ 67 NONAME ; void CCSRequestHandler::MarkConversationReadL(int) - ?trUtf8@TConversationEngine@@SA?AVQString@@PBD0@Z @ 68 NONAME ; class QString TConversationEngine::trUtf8(char const *, char const *) - ?qt_metacall@TConversationEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 69 NONAME ; int TConversationEngine::qt_metacall(enum QMetaObject::Call, int, void * *) - ?GetDraftsModelFromConversationEngine@TConversationEngine@@AAEXXZ @ 70 NONAME ; void TConversationEngine::GetDraftsModelFromConversationEngine(void) - ?MarkConversationReadAndUpdateCV@TConversationEngine@@AAEXXZ @ 71 NONAME ; void TConversationEngine::MarkConversationReadAndUpdateCV(void) - ?init@TConversationEngine@@AAEXXZ @ 72 NONAME ; void TConversationEngine::init(void) - ?RemoveConversationChangeEventL@CCSRequestHandler@@QAEXPAVMCsConversationChangeObserver@@PAVCCsClientConversation@@@Z @ 73 NONAME ; void CCSRequestHandler::RemoveConversationChangeEventL(class MCsConversationChangeObserver *, class CCsClientConversation *) - ?cleanup@TConversationEngine@@AAEXXZ @ 74 NONAME ; void TConversationEngine::cleanup(void) - ??_EConversationsEngine@@UAE@I@Z @ 75 NONAME ; ConversationsEngine::~ConversationsEngine(unsigned int) - ?GetContactDetailsFromConversationID@TConversationEngine@@AAEXXZ @ 76 NONAME ; void TConversationEngine::GetContactDetailsFromConversationID(void) - ?RemoveResultsEventL@CCSRequestHandler@@QAEXPAVMCsResultsObserver@@@Z @ 77 NONAME ; void CCSRequestHandler::RemoveResultsEventL(class MCsResultsObserver *) - ?NotifyDeleteConversationClientAndUpdateCLV@TConversationEngine@@AAEXXZ @ 78 NONAME ; void TConversationEngine::NotifyDeleteConversationClientAndUpdateCLV(void) - ?instance@ConversationsEngine@@SAPAV1@XZ @ 79 NONAME ; class ConversationsEngine * ConversationsEngine::instance(void) - ?GetConversationUnreadListL@CCSRequestHandler@@QAEXPAV?$RPointerArray@VCCsClientConversation@@@@@Z @ 80 NONAME ; void CCSRequestHandler::GetConversationUnreadListL(class RPointerArray *) - ?RequestResultsEventL@CCSRequestHandler@@QAEXPAVMCsResultsObserver@@@Z @ 81 NONAME ; void CCSRequestHandler::RequestResultsEventL(class MCsResultsObserver *) - ?resendMessage@ConversationsEngine@@QAE_NH@Z @ 82 NONAME ; bool ConversationsEngine::resendMessage(int) - ?emitConversationModelUpdated@ConversationsEngine@@QAEXXZ @ 83 NONAME ; void ConversationsEngine::emitConversationModelUpdated(void) - ?clearConversations@ConversationsEngine@@QAE_NXZ @ 84 NONAME ; bool ConversationsEngine::clearConversations(void) - ?Version@CCSRequestHandler@@QBE?AVTVersion@@XZ @ 85 NONAME ; class TVersion CCSRequestHandler::Version(void) const - ?NotifyConversationClientListAndUpdateCLV@TConversationEngine@@AAEXXZ @ 86 NONAME ; void TConversationEngine::NotifyConversationClientListAndUpdateCLV(void) - ?RequestConversationChangeEventL@CCSRequestHandler@@QAEXPAVMCsConversationChangeObserver@@PAVCCsClientConversation@@@Z @ 87 NONAME ; void CCSRequestHandler::RequestConversationChangeEventL(class MCsConversationChangeObserver *, class CCsClientConversation *) - ?getConversationIdFromContactId@ConversationsEngine@@QAE_JH@Z @ 88 NONAME ; long long ConversationsEngine::getConversationIdFromContactId(int) - ?staticMetaObject@ConversationsEngine@@2UQMetaObject@@B @ 89 NONAME ; struct QMetaObject const ConversationsEngine::staticMetaObject - ?deleteMessages@ConversationsEngine@@QAEXAAV?$QList@H@@@Z @ 90 NONAME ; void ConversationsEngine::deleteMessages(class QList &) - ?NewL@CCSRequestHandler@@SAPAV1@XZ @ 91 NONAME ; class CCSRequestHandler * CCSRequestHandler::NewL(void) - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/tsrc/eabi/testconversationengineu.def --- a/messagingapp/msgui/appengine/tsrc/eabi/testconversationengineu.def Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -EXPORTS - _ZN17CCSRequestHandler15ShutdownServerLEv @ 1 NONAME - _ZN17CCSRequestHandler17GetCachingStatusLEv @ 2 NONAME - _ZN17CCSRequestHandler17GetConversationsLEP21CCsClientConversation @ 3 NONAME - _ZN17CCSRequestHandler18GetConversationIdLEi @ 4 NONAME - _ZN17CCSRequestHandler19DeleteConversationLEi @ 5 NONAME - _ZN17CCSRequestHandler19RemoveResultsEventLEP18MCsResultsObserver @ 6 NONAME - _ZN17CCSRequestHandler20GetConversationListLEv @ 7 NONAME - _ZN17CCSRequestHandler20GetMessagingHistoryLEi @ 8 NONAME - _ZN17CCSRequestHandler20GetTotalUnreadCountLEv @ 9 NONAME - _ZN17CCSRequestHandler20RequestResultsEventLEP18MCsResultsObserver @ 10 NONAME - _ZN17CCSRequestHandler21MarkConversationReadLEi @ 11 NONAME - _ZN17CCSRequestHandler22ClearMessagingHistoryLEi @ 12 NONAME - _ZN17CCSRequestHandler25MarkMessagingHistoryReadLEi @ 13 NONAME - _ZN17CCSRequestHandler25RemoveCachingStatusEventLEP24MCsCachingStatusObserver @ 14 NONAME - _ZN17CCSRequestHandler26GetConversationUnreadListLEP13RPointerArrayI21CCsClientConversationE @ 15 NONAME - _ZN17CCSRequestHandler26RequestCachingStatusEventLEP24MCsCachingStatusObserver @ 16 NONAME - _ZN17CCSRequestHandler29GetConversationIdFromAddressLER7TDesC16 @ 17 NONAME - _ZN17CCSRequestHandler30RemoveConversationChangeEventLEP29MCsConversationChangeObserverP21CCsClientConversation @ 18 NONAME - _ZN17CCSRequestHandler31RequestConversationChangeEventLEP29MCsConversationChangeObserverP21CCsClientConversation @ 19 NONAME - _ZN17CCSRequestHandler34RemoveConversationListChangeEventLEP33MCsConversationListChangeObserver @ 20 NONAME - _ZN17CCSRequestHandler35RequestConversationListChangeEventLEP33MCsConversationListChangeObserver @ 21 NONAME - _ZN17CCSRequestHandler4NewLEv @ 22 NONAME - _ZN17CCSRequestHandler5NewLCEv @ 23 NONAME - _ZN19ConversationsEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 24 NONAME - _ZN19ConversationsEngine11qt_metacastEPKc @ 25 NONAME - _ZN19ConversationsEngine13resendMessageEi @ 26 NONAME - _ZN19ConversationsEngine14deleteMessagesER5QListIiE @ 27 NONAME - _ZN19ConversationsEngine14getDraftsModelEv @ 28 NONAME - _ZN19ConversationsEngine15downloadMessageEi @ 29 NONAME - _ZN19ConversationsEngine16getConversationsEx @ 30 NONAME - _ZN19ConversationsEngine16markMessagesReadER5QListIiE @ 31 NONAME - _ZN19ConversationsEngine16staticMetaObjectE @ 32 NONAME DATA 16 - _ZN19ConversationsEngine17getContactDetailsExR7QStringS1_ @ 33 NONAME - _ZN19ConversationsEngine18clearConversationsEv @ 34 NONAME - _ZN19ConversationsEngine19deleteConversationsEx @ 35 NONAME - _ZN19ConversationsEngine19getStaticMetaObjectEv @ 36 NONAME - _ZN19ConversationsEngine20markAsReadAndGetTypeEiRiS0_ @ 37 NONAME - _ZN19ConversationsEngine20markConversationReadEx @ 38 NONAME - _ZN19ConversationsEngine21getConversationsModelEv @ 39 NONAME - _ZN19ConversationsEngine22deleteAllDraftMessagesEv @ 40 NONAME - _ZN19ConversationsEngine22fetchMoreConversationsEv @ 41 NONAME - _ZN19ConversationsEngine24conversationModelUpdatedEv @ 42 NONAME - _ZN19ConversationsEngine24getCurrentConversationIdEv @ 43 NONAME - _ZN19ConversationsEngine26conversationModelPopulatedEv @ 44 NONAME - _ZN19ConversationsEngine26downloadOperationSupportedEi @ 45 NONAME - _ZN19ConversationsEngine28emitConversationModelUpdatedEv @ 46 NONAME - _ZN19ConversationsEngine28getConversationIdFromAddressE7QString @ 47 NONAME - _ZN19ConversationsEngine28getConversationsSummaryModelEv @ 48 NONAME - _ZN19ConversationsEngine30conversationListModelPopulatedEv @ 49 NONAME - _ZN19ConversationsEngine30emitConversationModelPopulatedEv @ 50 NONAME - _ZN19ConversationsEngine30getConversationIdFromContactIdEi @ 51 NONAME - _ZN19ConversationsEngine34emitConversationListModelPopulatedEv @ 52 NONAME - _ZN19ConversationsEngine8instanceEv @ 53 NONAME - _ZN19ConversationsEngineC1EP7QObject @ 54 NONAME - _ZN19ConversationsEngineC2EP7QObject @ 55 NONAME - _ZN19ConversationsEngineD0Ev @ 56 NONAME - _ZN19ConversationsEngineD1Ev @ 57 NONAME - _ZN19ConversationsEngineD2Ev @ 58 NONAME - _ZN19TConversationEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 59 NONAME - _ZN19TConversationEngine11qt_metacastEPKc @ 60 NONAME - _ZN19TConversationEngine12initTestCaseEv @ 61 NONAME - _ZN19TConversationEngine15cleanupTestCaseEv @ 62 NONAME - _ZN19TConversationEngine16staticMetaObjectE @ 63 NONAME DATA 16 - _ZN19TConversationEngine18ClearConversationsEv @ 64 NONAME - _ZN19TConversationEngine19getStaticMetaObjectEv @ 65 NONAME - _ZN19TConversationEngine22FetchMoreConversationsEv @ 66 NONAME - _ZN19TConversationEngine26CheckCurrentConversationIDEv @ 67 NONAME - _ZN19TConversationEngine26GetConversationsFromServerEv @ 68 NONAME - _ZN19TConversationEngine28GetConversationIDFromAddressEv @ 69 NONAME - _ZN19TConversationEngine29DeleteConversationAndUpdateCVEv @ 70 NONAME - _ZN19TConversationEngine29FetchConversationsAndUpdateCVEv @ 71 NONAME - _ZN19TConversationEngine30GetConversationIDFromContatcIDEv @ 72 NONAME - _ZN19TConversationEngine31MarkConversationReadAndUpdateCVEv @ 73 NONAME - _ZN19TConversationEngine35GetContactDetailsFromConversationIDEv @ 74 NONAME - _ZN19TConversationEngine36GetDraftsModelFromConversationEngineEv @ 75 NONAME - _ZN19TConversationEngine37NotifyNewConversationEntryAndUpdateCVEv @ 76 NONAME - _ZN19TConversationEngine39NotifyNewConversationClientAndUpdateCLVEv @ 77 NONAME - _ZN19TConversationEngine40NotifyConversationClientListAndUpdateCLVEv @ 78 NONAME - _ZN19TConversationEngine42NotifyDeleteConversationClientAndUpdateCLVEv @ 79 NONAME - _ZN19TConversationEngine42NotifyModifyConversationClientAndUpdateCLVEv @ 80 NONAME - _ZN19TConversationEngine4initEv @ 81 NONAME - _ZN19TConversationEngine7cleanupEv @ 82 NONAME - _ZNK17CCSRequestHandler7VersionEv @ 83 NONAME - _ZNK19ConversationsEngine10metaObjectEv @ 84 NONAME - _ZNK19TConversationEngine10metaObjectEv @ 85 NONAME - _ZTI19ConversationsEngine @ 86 NONAME - _ZTI19TConversationEngine @ 87 NONAME - _ZTV19ConversationsEngine @ 88 NONAME - _ZTV19TConversationEngine @ 89 NONAME - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationengine.h --- a/messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationengine.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationengine.h Thu Jul 22 16:32:06 2010 +0100 @@ -20,7 +20,7 @@ #ifdef BUILD_TEST_DLL #define TEST_EXPORT Q_DECL_EXPORT #else -#define TEST_EXPORT Q_DECL_IMPORT +#define TEST_EXPORT #endif // INCLUDES diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/tsrc/testconversationengine/src/testccsrequesthandler.cpp --- a/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testccsrequesthandler.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testccsrequesthandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -53,12 +53,12 @@ // CCSRequestHandler::NewLC() // Two-phased constructor. // ----------------------------------------------------------------------------- -EXPORT_C CCSRequestHandler* CCSRequestHandler::NewLC(/*CVPbkContactManager* aVPbkContactManager*/) +EXPORT_C CCSRequestHandler* CCSRequestHandler::NewLC() { CCSRequestHandler* self = new ( ELeave ) CCSRequestHandler(); CleanupStack::PushL( self ); - self->ConstructL(/*aVPbkContactManager*/); + self->ConstructL(); return self; } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationengine.cpp --- a/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationengine.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationengine.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -23,7 +23,7 @@ #include "testconversationupdatehandler.h" #include #include -#include +#include #include @@ -103,6 +103,8 @@ UpdateConvEntry(TestConversationEngineStub::Instance()-> GetConversationID()); + ConversationsEngine::instance()->emitConversationModelUpdated(); + //conversation engine should have emitted signal QCOMPARE( convModify.count(), 1 ); } @@ -125,6 +127,8 @@ // update the conversation view with deleted entry TestConversationEngineStub::Instance()->UpdateDeletedConvEntry(); + ConversationsEngine::instance()->emitConversationModelUpdated(); + //conversation engine should have emitted signal QCOMPARE( convDelete.count(), 1 ); } @@ -191,11 +195,11 @@ //check the bunch of converation client details QCOMPARE(fname, - S60QConversions::s60DescToQString( + XQConversions::s60DescToQString( *(clientConv->GetDisplayName()))); QCOMPARE(address, - S60QConversions::s60DescToQString( + XQConversions::s60DescToQString( *(clientConv->GetConversationEntry()->Contact()))); } } @@ -320,3 +324,16 @@ //delete the stub data delete TestConversationEngineStub::Instance(); } + + +//main entry point +int main(int argc, char *argv[]) + { + int ret = -1; + QCoreApplication app(argc, argv); + QObject* tc = new TConversationEngine(); + ret = QTest::qExec(tc, argc, argv); + delete tc; + return ret; + } + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationupdatehandler.cpp --- a/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationupdatehandler.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationupdatehandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -20,7 +20,7 @@ #include "conversationsengine.h" #include #include -#include +#include #include #include @@ -66,7 +66,7 @@ //as this is common for all the conversation entries QModelIndexList indexList = convModel->match(convModel->index(0, 0), ConversationAddress, - S60QConversions::s60DescToQString(TestConversationEngineStub::Instance()->GetContactID()), + XQConversions::s60DescToQString(TestConversationEngineStub::Instance()->GetContactID()), -1, // One match Qt::MatchExactly); entryCount = indexList.count(); @@ -86,7 +86,7 @@ //compare the message description QCOMPARE(convModel->data(indexList[loop], BodyText).toString(), - S60QConversions::s60DescToQString( + XQConversions::s60DescToQString( TestConversationEngineStub::Instance()-> GetDescription())); @@ -144,7 +144,7 @@ TDesC* dispName = clientConv->GetDisplayName(); QCOMPARE(convModel->data(indexList[0], DisplayName).toString(), - S60QConversions::s60DescToQString(*dispName)); + XQConversions::s60DescToQString(*dispName)); int contactId = clientConv->GetContactId(); QCOMPARE(convModel->data(indexList[0], ContactId).toInt(), contactId); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/appengine/tsrc/testconversationengine/testconversationengine.pro --- a/messagingapp/msgui/appengine/tsrc/testconversationengine/testconversationengine.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/testconversationengine.pro Thu Jul 22 16:32:06 2010 +0100 @@ -14,10 +14,11 @@ # Description: # QT += testlib +QT -= gui CONFIG += hb CONFIG += symbian_test -TEMPLATE = lib +TEMPLATE = app TARGET = testconversationengine DEPENDPATH += . inc DEPENDPATH += . src @@ -29,15 +30,12 @@ INCLUDEPATH += ../../../../../inc INCLUDEPATH += ../../../appengine/inc INCLUDEPATH += ../../../../msgappfw/client/inc -INCLUDEPATH += ../../../../msgutils/s60qconversions/inc INCLUDEPATH += ../../../../smartmessaging/ringbc/inc -INCLUDEPATH += /ext/mw/qtextensions/qtmobileextensions/include INCLUDEPATH += ../../../../msgutils/unieditorutils/editorgenutils/inc + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE - -DEFINES += BUILD_TEST_DLL -DEFINES += BUILD_DLL +DEFINES += BUILD_DLL HEADERS += \ testconversationengine.h \ @@ -72,17 +70,17 @@ src/draftsmodel.cpp SYMBIAN_PLATFORMS = WINSCW ARMV5 -symbian { - TARGET.CAPABILITY = CAP_GENERAL_DLL +symbian*:{ + TARGET.CAPABILITY = CAP_APPLICATION + TARGET.UID3 = 0x2001FE76 TARGET.EPOCSTACKSIZE = 0x8000 TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000 - TARGET.EPOCALLOWDLLDATA = 1 } LIBS += -euser \ -ecom \ -lcsutils \ - -ls60qconversions \ + -lxqutils \ -lconvergedmessageutils \ -lmsgs \ -lInetProtUtil \ @@ -98,5 +96,8 @@ -lmmscli \ -lcommonengine \ -lmmsserversettings \ + -lsqldb \ + -lestor \ -lFeatMgr \ + -lfbscli \ -lringbc diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/bwins/appengineu.def --- a/messagingapp/msgui/bwins/appengineu.def Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/bwins/appengineu.def Thu Jul 22 16:32:06 2010 +0100 @@ -1,41 +1,45 @@ EXPORTS ?fetchMoreConversations@ConversationsEngine@@QAEXXZ @ 1 NONAME ; void ConversationsEngine::fetchMoreConversations(void) - ?getConversationIdFromAddress@ConversationsEngine@@QAE_JVQString@@@Z @ 2 NONAME ; long long ConversationsEngine::getConversationIdFromAddress(class QString) - ?deleteAllDraftMessages@ConversationsEngine@@QAEXXZ @ 3 NONAME ; void ConversationsEngine::deleteAllDraftMessages(void) - ?metaObject@ConversationsEngine@@UBEPBUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const * ConversationsEngine::metaObject(void) const - ??1ConversationsEngine@@UAE@XZ @ 5 NONAME ; ConversationsEngine::~ConversationsEngine(void) - ?markAsReadAndGetType@ConversationsEngine@@QAEXHAAH0@Z @ 6 NONAME ; void ConversationsEngine::markAsReadAndGetType(int, int &, int &) - ?deleteConversations@ConversationsEngine@@QAE_N_J@Z @ 7 NONAME ; bool ConversationsEngine::deleteConversations(long long) - ?trUtf8@ConversationsEngine@@SA?AVQString@@PBD0@Z @ 8 NONAME ; class QString ConversationsEngine::trUtf8(char const *, char const *) - ?qt_metacast@ConversationsEngine@@UAEPAXPBD@Z @ 9 NONAME ; void * ConversationsEngine::qt_metacast(char const *) - ?emitConversationListModelPopulated@ConversationsEngine@@QAEXXZ @ 10 NONAME ; void ConversationsEngine::emitConversationListModelPopulated(void) - ?getDraftsModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 11 NONAME ; class QStandardItemModel * ConversationsEngine::getDraftsModel(void) - ?trUtf8@ConversationsEngine@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString ConversationsEngine::trUtf8(char const *, char const *, int) - ?tr@ConversationsEngine@@SA?AVQString@@PBD0H@Z @ 13 NONAME ; class QString ConversationsEngine::tr(char const *, char const *, int) - ?conversationModelUpdated@ConversationsEngine@@IAEXXZ @ 14 NONAME ; void ConversationsEngine::conversationModelUpdated(void) - ?getStaticMetaObject@ConversationsEngine@@SAABUQMetaObject@@XZ @ 15 NONAME ; struct QMetaObject const & ConversationsEngine::getStaticMetaObject(void) - ?downloadOperationSupported@ConversationsEngine@@QAE_NH@Z @ 16 NONAME ; bool ConversationsEngine::downloadOperationSupported(int) - ?markMessagesRead@ConversationsEngine@@QAE_NAAV?$QList@H@@@Z @ 17 NONAME ; bool ConversationsEngine::markMessagesRead(class QList &) - ?conversationModelPopulated@ConversationsEngine@@IAEXXZ @ 18 NONAME ; void ConversationsEngine::conversationModelPopulated(void) - ?downloadMessage@ConversationsEngine@@QAEHH@Z @ 19 NONAME ; int ConversationsEngine::downloadMessage(int) - ?getConversationsModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 20 NONAME ; class QStandardItemModel * ConversationsEngine::getConversationsModel(void) - ?getCurrentConversationId@ConversationsEngine@@QAE_JXZ @ 21 NONAME ; long long ConversationsEngine::getCurrentConversationId(void) - ?markConversationRead@ConversationsEngine@@QAE_N_J@Z @ 22 NONAME ; bool ConversationsEngine::markConversationRead(long long) - ??_EConversationsEngine@@UAE@I@Z @ 23 NONAME ; ConversationsEngine::~ConversationsEngine(unsigned int) - ?getConversationsSummaryModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 24 NONAME ; class QStandardItemModel * ConversationsEngine::getConversationsSummaryModel(void) - ?conversationListModelPopulated@ConversationsEngine@@IAEXXZ @ 25 NONAME ; void ConversationsEngine::conversationListModelPopulated(void) - ??0ConversationsEngine@@AAE@PAVQObject@@@Z @ 26 NONAME ; ConversationsEngine::ConversationsEngine(class QObject *) - ?getContactDetails@ConversationsEngine@@QAEX_JAAVQString@@1@Z @ 27 NONAME ; void ConversationsEngine::getContactDetails(long long, class QString &, class QString &) - ?instance@ConversationsEngine@@SAPAV1@XZ @ 28 NONAME ; class ConversationsEngine * ConversationsEngine::instance(void) - ?tr@ConversationsEngine@@SA?AVQString@@PBD0@Z @ 29 NONAME ; class QString ConversationsEngine::tr(char const *, char const *) - ?resendMessage@ConversationsEngine@@QAE_NH@Z @ 30 NONAME ; bool ConversationsEngine::resendMessage(int) - ?emitConversationModelUpdated@ConversationsEngine@@QAEXXZ @ 31 NONAME ; void ConversationsEngine::emitConversationModelUpdated(void) - ?getConversations@ConversationsEngine@@QAE_N_J@Z @ 32 NONAME ; bool ConversationsEngine::getConversations(long long) - ?clearConversations@ConversationsEngine@@QAE_NXZ @ 33 NONAME ; bool ConversationsEngine::clearConversations(void) - ?getDBHandle@ConversationsEngine@@QAEAAVRSqlDatabase@@AAH@Z @ 34 NONAME ; class RSqlDatabase & ConversationsEngine::getDBHandle(int &) - ?getConversationIdFromContactId@ConversationsEngine@@QAE_JH@Z @ 35 NONAME ; long long ConversationsEngine::getConversationIdFromContactId(int) - ?staticMetaObject@ConversationsEngine@@2UQMetaObject@@B @ 36 NONAME ; struct QMetaObject const ConversationsEngine::staticMetaObject - ?deleteMessages@ConversationsEngine@@QAEXAAV?$QList@H@@@Z @ 37 NONAME ; void ConversationsEngine::deleteMessages(class QList &) - ?emitConversationModelPopulated@ConversationsEngine@@QAEXXZ @ 38 NONAME ; void ConversationsEngine::emitConversationModelPopulated(void) - ?qt_metacall@ConversationsEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 39 NONAME ; int ConversationsEngine::qt_metacall(enum QMetaObject::Call, int, 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 &) + ?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 &) + ?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 * *) diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/bwins/conversationviewu.def --- a/messagingapp/msgui/bwins/conversationviewu.def Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/bwins/conversationviewu.def Thu Jul 22 16:32:06 2010 +0100 @@ -1,7 +1,7 @@ EXPORTS ?qt_metacast@MsgConversationBaseView@@UAEPAXPBD@Z @ 1 NONAME ; void * MsgConversationBaseView::qt_metacast(char const *) ?metaObject@MsgConversationBaseView@@UBEPBUQMetaObject@@XZ @ 2 NONAME ; struct QMetaObject const * MsgConversationBaseView::metaObject(void) const - ?saveContentToDrafts@MsgConversationBaseView@@QAEXXZ @ 3 NONAME ; void MsgConversationBaseView::saveContentToDrafts(void) + ?handleConversationIdChange@MsgConversationBaseView@@AAEX_J@Z @ 3 NONAME ; void MsgConversationBaseView::handleConversationIdChange(long long) ?closeConversationView@MsgConversationBaseView@@QAEXXZ @ 4 NONAME ; void MsgConversationBaseView::closeConversationView(void) ?trUtf8@MsgConversationBaseView@@SA?AVQString@@PBD0H@Z @ 5 NONAME ; class QString MsgConversationBaseView::trUtf8(char const *, char const *, int) ?handleError@MsgConversationBaseView@@AAEXHABVQString@@@Z @ 6 NONAME ; void MsgConversationBaseView::handleError(int, class QString const &) @@ -10,19 +10,20 @@ ??0MsgConversationBaseView@@QAE@PAVQGraphicsItem@@@Z @ 9 NONAME ; MsgConversationBaseView::MsgConversationBaseView(class QGraphicsItem *) ?handleOk@MsgConversationBaseView@@AAEXABVQVariant@@@Z @ 10 NONAME ; void MsgConversationBaseView::handleOk(class QVariant const &) ?trUtf8@MsgConversationBaseView@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString MsgConversationBaseView::trUtf8(char const *, char const *) - ?setPSCVId@MsgConversationBaseView@@QAEX_N@Z @ 12 NONAME ; void MsgConversationBaseView::setPSCVId(bool) - ?doDelayedConstruction@MsgConversationBaseView@@AAEXXZ @ 13 NONAME ; void MsgConversationBaseView::doDelayedConstruction(void) - ?openConversation@MsgConversationBaseView@@QAEX_J@Z @ 14 NONAME ; void MsgConversationBaseView::openConversation(long long) - ?conversationId@MsgConversationBaseView@@QAE_JXZ @ 15 NONAME ; long long MsgConversationBaseView::conversationId(void) - ?staticMetaObject@MsgConversationBaseView@@2UQMetaObject@@B @ 16 NONAME ; struct QMetaObject const MsgConversationBaseView::staticMetaObject - ?conversationViewClosed@MsgConversationBaseView@@IAEXXZ @ 17 NONAME ; void MsgConversationBaseView::conversationViewClosed(void) - ?initView@MsgConversationBaseView@@AAEXXZ @ 18 NONAME ; void MsgConversationBaseView::initView(void) - ?markMessagesAsRead@MsgConversationBaseView@@QAEXXZ @ 19 NONAME ; void MsgConversationBaseView::markMessagesAsRead(void) - ?tr@MsgConversationBaseView@@SA?AVQString@@PBD0@Z @ 20 NONAME ; class QString MsgConversationBaseView::tr(char const *, char const *) - ?qt_metacall@MsgConversationBaseView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 21 NONAME ; int MsgConversationBaseView::qt_metacall(enum QMetaObject::Call, int, void * *) - ?getStaticMetaObject@MsgConversationBaseView@@SAABUQMetaObject@@XZ @ 22 NONAME ; struct QMetaObject const & MsgConversationBaseView::getStaticMetaObject(void) - ??1MsgConversationBaseView@@UAE@XZ @ 23 NONAME ; MsgConversationBaseView::~MsgConversationBaseView(void) - ?handleViewReady@MsgConversationBaseView@@AAEXXZ @ 24 NONAME ; void MsgConversationBaseView::handleViewReady(void) - ??_EMsgConversationBaseView@@UAE@I@Z @ 25 NONAME ; MsgConversationBaseView::~MsgConversationBaseView(unsigned int) - ?clearContent@MsgConversationBaseView@@QAEXXZ @ 26 NONAME ; void MsgConversationBaseView::clearContent(void) + ?saveContentToDrafts@MsgConversationBaseView@@QAEHXZ @ 12 NONAME ; int MsgConversationBaseView::saveContentToDrafts(void) + ?setPSCVId@MsgConversationBaseView@@QAEX_N@Z @ 13 NONAME ; void MsgConversationBaseView::setPSCVId(bool) + ?doDelayedConstruction@MsgConversationBaseView@@AAEXXZ @ 14 NONAME ; void MsgConversationBaseView::doDelayedConstruction(void) + ?openConversation@MsgConversationBaseView@@QAEX_J@Z @ 15 NONAME ; void MsgConversationBaseView::openConversation(long long) + ?conversationId@MsgConversationBaseView@@QAE_JXZ @ 16 NONAME ; long long MsgConversationBaseView::conversationId(void) + ?staticMetaObject@MsgConversationBaseView@@2UQMetaObject@@B @ 17 NONAME ; struct QMetaObject const MsgConversationBaseView::staticMetaObject + ?conversationViewClosed@MsgConversationBaseView@@IAEXXZ @ 18 NONAME ; void MsgConversationBaseView::conversationViewClosed(void) + ?initView@MsgConversationBaseView@@AAEXXZ @ 19 NONAME ; void MsgConversationBaseView::initView(void) + ?markMessagesAsRead@MsgConversationBaseView@@QAEXXZ @ 20 NONAME ; void MsgConversationBaseView::markMessagesAsRead(void) + ?tr@MsgConversationBaseView@@SA?AVQString@@PBD0@Z @ 21 NONAME ; class QString MsgConversationBaseView::tr(char const *, char const *) + ?qt_metacall@MsgConversationBaseView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 22 NONAME ; int MsgConversationBaseView::qt_metacall(enum QMetaObject::Call, int, void * *) + ?getStaticMetaObject@MsgConversationBaseView@@SAABUQMetaObject@@XZ @ 23 NONAME ; struct QMetaObject const & MsgConversationBaseView::getStaticMetaObject(void) + ??1MsgConversationBaseView@@UAE@XZ @ 24 NONAME ; MsgConversationBaseView::~MsgConversationBaseView(void) + ?handleViewReady@MsgConversationBaseView@@AAEXXZ @ 25 NONAME ; void MsgConversationBaseView::handleViewReady(void) + ??_EMsgConversationBaseView@@UAE@I@Z @ 26 NONAME ; MsgConversationBaseView::~MsgConversationBaseView(unsigned int) + ?clearContent@MsgConversationBaseView@@QAEXXZ @ 27 NONAME ; void MsgConversationBaseView::clearContent(void) diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/bwins/msgaudiofetcheru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/bwins/msgaudiofetcheru.def Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,20 @@ +EXPORTS + ?metaObject@MsgAudioFetcherView@@UBEPBUQMetaObject@@XZ @ 1 NONAME ; struct QMetaObject const * MsgAudioFetcherView::metaObject(void) const + ?enableToolBar@MsgAudioFetcherView@@AAEX_N@Z @ 2 NONAME ; void MsgAudioFetcherView::enableToolBar(bool) + ??1MsgAudioFetcherView@@UAE@XZ @ 3 NONAME ; MsgAudioFetcherView::~MsgAudioFetcherView(void) + ?staticMetaObject@MsgAudioFetcherView@@2UQMetaObject@@B @ 4 NONAME ; struct QMetaObject const MsgAudioFetcherView::staticMetaObject + ??_EMsgAudioFetcherView@@UAE@I@Z @ 5 NONAME ; MsgAudioFetcherView::~MsgAudioFetcherView(unsigned int) + ?trUtf8@MsgAudioFetcherView@@SA?AVQString@@PBD0@Z @ 6 NONAME ; class QString MsgAudioFetcherView::trUtf8(char const *, char const *) + ?removeToolBarAction@MsgAudioFetcherView@@AAEXXZ @ 7 NONAME ; void MsgAudioFetcherView::removeToolBarAction(void) + ?qt_metacall@MsgAudioFetcherView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 8 NONAME ; int MsgAudioFetcherView::qt_metacall(enum QMetaObject::Call, int, void * *) + ?initMainWidget@MsgAudioFetcherView@@AAEXXZ @ 9 NONAME ; void MsgAudioFetcherView::initMainWidget(void) + ?trUtf8@MsgAudioFetcherView@@SA?AVQString@@PBD0H@Z @ 10 NONAME ; class QString MsgAudioFetcherView::trUtf8(char const *, char const *, int) + ?tr@MsgAudioFetcherView@@SA?AVQString@@PBD0H@Z @ 11 NONAME ; class QString MsgAudioFetcherView::tr(char const *, char const *, int) + ?on_rightAction_triggered@MsgAudioFetcherView@@AAEXXZ @ 12 NONAME ; void MsgAudioFetcherView::on_rightAction_triggered(void) + ??0MsgAudioFetcherView@@QAE@ABV?$QList@VQVariant@@@@@Z @ 13 NONAME ; MsgAudioFetcherView::MsgAudioFetcherView(class QList const &) + ?initToolBar@MsgAudioFetcherView@@AAEXXZ @ 14 NONAME ; void MsgAudioFetcherView::initToolBar(void) + ?tr@MsgAudioFetcherView@@SA?AVQString@@PBD0@Z @ 15 NONAME ; class QString MsgAudioFetcherView::tr(char const *, char const *) + ?qt_metacast@MsgAudioFetcherView@@UAEPAXPBD@Z @ 16 NONAME ; void * MsgAudioFetcherView::qt_metacast(char const *) + ?getStaticMetaObject@MsgAudioFetcherView@@SAABUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const & MsgAudioFetcherView::getStaticMetaObject(void) + ?on_leftAction_triggered@MsgAudioFetcherView@@AAEXXZ @ 18 NONAME ; void MsgAudioFetcherView::on_leftAction_triggered(void) + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/bwins/msgsettingsu.def --- a/messagingapp/msgui/bwins/msgsettingsu.def Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -EXPORTS - ?createMmsView@SettingsViewer@@QAEXXZ @ 1 NONAME ; void SettingsViewer::createMmsView(void) - ??0SettingsViewer@@QAE@PAVQGraphicsItem@@@Z @ 2 NONAME ; SettingsViewer::SettingsViewer(class QGraphicsItem *) - ?openMmsSettings@SettingsViewer@@QAEXXZ @ 3 NONAME ; void SettingsViewer::openMmsSettings(void) - ??1SettingsViewer@@UAE@XZ @ 4 NONAME ; SettingsViewer::~SettingsViewer(void) - ?staticMetaObject@SettingsViewer@@2UQMetaObject@@B @ 5 NONAME ; struct QMetaObject const SettingsViewer::staticMetaObject - ??_ESettingsViewer@@UAE@I@Z @ 6 NONAME ; SettingsViewer::~SettingsViewer(unsigned int) - ?qt_metacast@SettingsViewer@@UAEPAXPBD@Z @ 7 NONAME ; void * SettingsViewer::qt_metacast(char const *) - ?initView@SettingsViewer@@QAEXXZ @ 8 NONAME ; void SettingsViewer::initView(void) - ?softkeyClicked@SettingsViewer@@QAEXXZ @ 9 NONAME ; void SettingsViewer::softkeyClicked(void) - ?changeAccessPoint@SettingsViewer@@QAEXH@Z @ 10 NONAME ; void SettingsViewer::changeAccessPoint(int) - ?trUtf8@SettingsViewer@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString SettingsViewer::trUtf8(char const *, char const *) - ?trUtf8@SettingsViewer@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString SettingsViewer::trUtf8(char const *, char const *, int) - ?metaObject@SettingsViewer@@UBEPBUQMetaObject@@XZ @ 13 NONAME ; struct QMetaObject const * SettingsViewer::metaObject(void) const - ?openSmsSettings@SettingsViewer@@QAEXXZ @ 14 NONAME ; void SettingsViewer::openSmsSettings(void) - ?tr@SettingsViewer@@SA?AVQString@@PBD0H@Z @ 15 NONAME ; class QString SettingsViewer::tr(char const *, char const *, int) - ?iAPSelector@SettingsViewer@@QAEXPAVQStringList@@@Z @ 16 NONAME ; void SettingsViewer::iAPSelector(class QStringList *) - ?closeSettings@SettingsViewer@@QAEXXZ @ 17 NONAME ; void SettingsViewer::closeSettings(void) - ?qt_metacall@SettingsViewer@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 18 NONAME ; int SettingsViewer::qt_metacall(enum QMetaObject::Call, int, void * *) - ?changeService@SettingsViewer@@QAEXXZ @ 19 NONAME ; void SettingsViewer::changeService(void) - ?createSmsView@SettingsViewer@@QAEXXZ @ 20 NONAME ; void SettingsViewer::createSmsView(void) - ?settingsViewerClosed@SettingsViewer@@IAEXXZ @ 21 NONAME ; void SettingsViewer::settingsViewerClosed(void) - ?tr@SettingsViewer@@SA?AVQString@@PBD0@Z @ 22 NONAME ; class QString SettingsViewer::tr(char const *, char const *) - ?getStaticMetaObject@SettingsViewer@@SAABUQMetaObject@@XZ @ 23 NONAME ; struct QMetaObject const & SettingsViewer::getStaticMetaObject(void) - ?settingListClosed@SettingsViewer@@QAEXXZ @ 24 NONAME ; void SettingsViewer::settingListClosed(void) - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/bwins/msguiutilsu.def --- a/messagingapp/msgui/bwins/msguiutilsu.def Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/bwins/msguiutilsu.def Thu Jul 22 16:32:06 2010 +0100 @@ -1,43 +1,46 @@ EXPORTS ?checkEmailOverSms@MsgSendUtil@@AAE_NAAVConvergedMessage@@AA_N@Z @ 1 NONAME ; bool MsgSendUtil::checkEmailOverSms(class ConvergedMessage &, bool &) - ??1MmsConformanceCheck@@UAE@XZ @ 2 NONAME ; MmsConformanceCheck::~MmsConformanceCheck(void) - ?mediaDurationL@MsgMediaUtil@@AAEHABVTDesC16@@@Z @ 3 NONAME ; int MsgMediaUtil::mediaDurationL(class TDesC16 const &) - ??0MsgMediaUtil@@QAE@XZ @ 4 NONAME ; MsgMediaUtil::MsgMediaUtil(void) - ?trUtf8@MmsConformanceCheck@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString MmsConformanceCheck::trUtf8(char const *, char const *) - ?qt_metacast@MsgSendUtil@@UAEPAXPBD@Z @ 6 NONAME ; void * MsgSendUtil::qt_metacast(char const *) - ?validateService@MsgSendUtil@@AAE_NPAVUniEditorPluginInterface@@_N@Z @ 7 NONAME ; bool MsgSendUtil::validateService(class UniEditorPluginInterface *, bool) - ?showPopup@MmsConformanceCheck@@AAEXABVQString@@@Z @ 8 NONAME ; void MmsConformanceCheck::showPopup(class QString const &) - ??0MsgSendUtil@@QAE@PAVQObject@@@Z @ 9 NONAME ; MsgSendUtil::MsgSendUtil(class QObject *) - ?metaObject@MsgSendUtil@@UBEPBUQMetaObject@@XZ @ 10 NONAME ; struct QMetaObject const * MsgSendUtil::metaObject(void) const - ?longestEmailAddressSize@MsgSendUtil@@AAEHV?$QList@PAVConvergedMessageAddress@@@@@Z @ 11 NONAME ; int MsgSendUtil::longestEmailAddressSize(class QList) - ?getStaticMetaObject@MmsConformanceCheck@@SAABUQMetaObject@@XZ @ 12 NONAME ; struct QMetaObject const & MmsConformanceCheck::getStaticMetaObject(void) - ??_EMsgSendUtil@@UAE@I@Z @ 13 NONAME ; MsgSendUtil::~MsgSendUtil(unsigned int) - ?staticMetaObject@MsgSendUtil@@2UQMetaObject@@B @ 14 NONAME ; struct QMetaObject const MsgSendUtil::staticMetaObject - ??0MmsConformanceCheck@@QAE@XZ @ 15 NONAME ; MmsConformanceCheck::MmsConformanceCheck(void) - ?metaObject@MmsConformanceCheck@@UBEPBUQMetaObject@@XZ @ 16 NONAME ; struct QMetaObject const * MmsConformanceCheck::metaObject(void) const - ?trUtf8@MsgSendUtil@@SA?AVQString@@PBD0@Z @ 17 NONAME ; class QString MsgSendUtil::trUtf8(char const *, char const *) - ?getStaticMetaObject@MsgSendUtil@@SAABUQMetaObject@@XZ @ 18 NONAME ; struct QMetaObject const & MsgSendUtil::getStaticMetaObject(void) - ?qt_metacall@MmsConformanceCheck@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 19 NONAME ; int MmsConformanceCheck::qt_metacall(enum QMetaObject::Call, int, void * *) - ?getSmsMsgSize@MsgSendUtil@@AAEHAAVConvergedMessage@@@Z @ 20 NONAME ; int MsgSendUtil::getSmsMsgSize(class ConvergedMessage &) - ?tr@MsgSendUtil@@SA?AVQString@@PBD0H@Z @ 21 NONAME ; class QString MsgSendUtil::tr(char const *, char const *, int) - ?validateMsgForForward@MmsConformanceCheck@@QAE_NH@Z @ 22 NONAME ; bool MmsConformanceCheck::validateMsgForForward(int) - ?checkMaxMsgSizeLimit@MsgSendUtil@@AAE_NAAVConvergedMessage@@@Z @ 23 NONAME ; bool MsgSendUtil::checkMaxMsgSizeLimit(class ConvergedMessage &) - ?trUtf8@MmsConformanceCheck@@SA?AVQString@@PBD0H@Z @ 24 NONAME ; class QString MmsConformanceCheck::trUtf8(char const *, char const *, int) - ?tr@MmsConformanceCheck@@SA?AVQString@@PBD0H@Z @ 25 NONAME ; class QString MmsConformanceCheck::tr(char const *, char const *, int) - ??1MsgMediaUtil@@QAE@XZ @ 26 NONAME ; MsgMediaUtil::~MsgMediaUtil(void) - ?send@MsgSendUtil@@QAEHAAVConvergedMessage@@@Z @ 27 NONAME ; int MsgSendUtil::send(class ConvergedMessage &) - ?trUtf8@MsgSendUtil@@SA?AVQString@@PBD0H@Z @ 28 NONAME ; class QString MsgSendUtil::trUtf8(char const *, char const *, int) - ?checkMaxRecipientCount@MsgSendUtil@@AAE_NAAVConvergedMessage@@@Z @ 29 NONAME ; bool MsgSendUtil::checkMaxRecipientCount(class ConvergedMessage &) - ?getMmsMsgSize@MsgSendUtil@@AAEHAAVConvergedMessage@@@Z @ 30 NONAME ; int MsgSendUtil::getMmsMsgSize(class ConvergedMessage &) - ?onDialogInsertMedia@MmsConformanceCheck@@AAEXPAVHbAction@@@Z @ 31 NONAME ; void MmsConformanceCheck::onDialogInsertMedia(class HbAction *) - ?checkModeForInsert@MmsConformanceCheck@@QAEHABVQString@@_N@Z @ 32 NONAME ; int MmsConformanceCheck::checkModeForInsert(class QString const &, bool) - ?qt_metacast@MmsConformanceCheck@@UAEPAXPBD@Z @ 33 NONAME ; void * MmsConformanceCheck::qt_metacast(char const *) - ?tr@MmsConformanceCheck@@SA?AVQString@@PBD0@Z @ 34 NONAME ; class QString MmsConformanceCheck::tr(char const *, char const *) - ?staticMetaObject@MmsConformanceCheck@@2UQMetaObject@@B @ 35 NONAME ; struct QMetaObject const MmsConformanceCheck::staticMetaObject - ?saveToDrafts@MsgSendUtil@@QAEJAAVConvergedMessage@@@Z @ 36 NONAME ; long MsgSendUtil::saveToDrafts(class ConvergedMessage &) - ?tr@MsgSendUtil@@SA?AVQString@@PBD0@Z @ 37 NONAME ; class QString MsgSendUtil::tr(char const *, char const *) - ?mediaDuration@MsgMediaUtil@@QAE?AVQString@@ABV2@@Z @ 38 NONAME ; class QString MsgMediaUtil::mediaDuration(class QString const &) - ??_EMmsConformanceCheck@@UAE@I@Z @ 39 NONAME ; MmsConformanceCheck::~MmsConformanceCheck(unsigned int) - ??1MsgSendUtil@@UAE@XZ @ 40 NONAME ; MsgSendUtil::~MsgSendUtil(void) - ?qt_metacall@MsgSendUtil@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 41 NONAME ; int MsgSendUtil::qt_metacall(enum QMetaObject::Call, int, void * *) + ?deleteVCardFromTemp@MsgContactsUtil@@CAXABVQString@@@Z @ 2 NONAME ; void MsgContactsUtil::deleteVCardFromTemp(class QString const &) + ??1MmsConformanceCheck@@UAE@XZ @ 3 NONAME ; MmsConformanceCheck::~MmsConformanceCheck(void) + ?mediaDurationL@MsgMediaUtil@@AAEHABVTDesC16@@@Z @ 4 NONAME ; int MsgMediaUtil::mediaDurationL(class TDesC16 const &) + ??0MsgMediaUtil@@QAE@XZ @ 5 NONAME ; MsgMediaUtil::MsgMediaUtil(void) + ?trUtf8@MmsConformanceCheck@@SA?AVQString@@PBD0@Z @ 6 NONAME ; class QString MmsConformanceCheck::trUtf8(char const *, char const *) + ?qt_metacast@MsgSendUtil@@UAEPAXPBD@Z @ 7 NONAME ; void * MsgSendUtil::qt_metacast(char const *) + ?validateService@MsgSendUtil@@AAE_NPAVUniEditorPluginInterface@@_N@Z @ 8 NONAME ; bool MsgSendUtil::validateService(class UniEditorPluginInterface *, bool) + ?showPopup@MmsConformanceCheck@@AAEXABVQString@@@Z @ 9 NONAME ; void MmsConformanceCheck::showPopup(class QString const &) + ??0MsgSendUtil@@QAE@PAVQObject@@@Z @ 10 NONAME ; MsgSendUtil::MsgSendUtil(class QObject *) + ?metaObject@MsgSendUtil@@UBEPBUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const * MsgSendUtil::metaObject(void) const + ?longestEmailAddressSize@MsgSendUtil@@AAEHV?$QList@PAVConvergedMessageAddress@@@@@Z @ 12 NONAME ; int MsgSendUtil::longestEmailAddressSize(class QList) + ?getStaticMetaObject@MmsConformanceCheck@@SAABUQMetaObject@@XZ @ 13 NONAME ; struct QMetaObject const & MmsConformanceCheck::getStaticMetaObject(void) + ??_EMsgSendUtil@@UAE@I@Z @ 14 NONAME ; MsgSendUtil::~MsgSendUtil(unsigned int) + ?staticMetaObject@MsgSendUtil@@2UQMetaObject@@B @ 15 NONAME ; struct QMetaObject const MsgSendUtil::staticMetaObject + ??0MmsConformanceCheck@@QAE@XZ @ 16 NONAME ; MmsConformanceCheck::MmsConformanceCheck(void) + ?metaObject@MmsConformanceCheck@@UBEPBUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const * MmsConformanceCheck::metaObject(void) const + ?trUtf8@MsgSendUtil@@SA?AVQString@@PBD0@Z @ 18 NONAME ; class QString MsgSendUtil::trUtf8(char const *, char const *) + ?getStaticMetaObject@MsgSendUtil@@SAABUQMetaObject@@XZ @ 19 NONAME ; struct QMetaObject const & MsgSendUtil::getStaticMetaObject(void) + ?qt_metacall@MmsConformanceCheck@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 20 NONAME ; int MmsConformanceCheck::qt_metacall(enum QMetaObject::Call, int, void * *) + ?getSmsMsgSize@MsgSendUtil@@AAEHAAVConvergedMessage@@@Z @ 21 NONAME ; int MsgSendUtil::getSmsMsgSize(class ConvergedMessage &) + ?tr@MsgSendUtil@@SA?AVQString@@PBD0H@Z @ 22 NONAME ; class QString MsgSendUtil::tr(char const *, char const *, int) + ?validateMsgForForward@MmsConformanceCheck@@QAE_NH@Z @ 23 NONAME ; bool MmsConformanceCheck::validateMsgForForward(int) + ?checkMaxMsgSizeLimit@MsgSendUtil@@AAE_NAAVConvergedMessage@@@Z @ 24 NONAME ; bool MsgSendUtil::checkMaxMsgSizeLimit(class ConvergedMessage &) + ?trUtf8@MmsConformanceCheck@@SA?AVQString@@PBD0H@Z @ 25 NONAME ; class QString MmsConformanceCheck::trUtf8(char const *, char const *, int) + ?tr@MmsConformanceCheck@@SA?AVQString@@PBD0H@Z @ 26 NONAME ; class QString MmsConformanceCheck::tr(char const *, char const *, int) + ??1MsgMediaUtil@@QAE@XZ @ 27 NONAME ; MsgMediaUtil::~MsgMediaUtil(void) + ?send@MsgSendUtil@@QAEHAAVConvergedMessage@@@Z @ 28 NONAME ; int MsgSendUtil::send(class ConvergedMessage &) + ?trUtf8@MsgSendUtil@@SA?AVQString@@PBD0H@Z @ 29 NONAME ; class QString MsgSendUtil::trUtf8(char const *, char const *, int) + ?checkMaxRecipientCount@MsgSendUtil@@AAE_NAAVConvergedMessage@@@Z @ 30 NONAME ; bool MsgSendUtil::checkMaxRecipientCount(class ConvergedMessage &) + ?copyVCardToTemp@MsgContactsUtil@@CA?AVQString@@ABV2@@Z @ 31 NONAME ; class QString MsgContactsUtil::copyVCardToTemp(class QString const &) + ?getMmsMsgSize@MsgSendUtil@@AAEHAAVConvergedMessage@@@Z @ 32 NONAME ; int MsgSendUtil::getMmsMsgSize(class ConvergedMessage &) + ?onDialogInsertMedia@MmsConformanceCheck@@AAEXPAVHbAction@@@Z @ 33 NONAME ; void MmsConformanceCheck::onDialogInsertMedia(class HbAction *) + ?checkModeForInsert@MmsConformanceCheck@@QAEHABVQString@@_N@Z @ 34 NONAME ; int MmsConformanceCheck::checkModeForInsert(class QString const &, bool) + ?qt_metacast@MmsConformanceCheck@@UAEPAXPBD@Z @ 35 NONAME ; void * MmsConformanceCheck::qt_metacast(char const *) + ?tr@MmsConformanceCheck@@SA?AVQString@@PBD0@Z @ 36 NONAME ; class QString MmsConformanceCheck::tr(char const *, char const *) + ?staticMetaObject@MmsConformanceCheck@@2UQMetaObject@@B @ 37 NONAME ; struct QMetaObject const MmsConformanceCheck::staticMetaObject + ?tr@MsgSendUtil@@SA?AVQString@@PBD0@Z @ 38 NONAME ; class QString MsgSendUtil::tr(char const *, char const *) + ?saveToDrafts@MsgSendUtil@@QAEJAAVConvergedMessage@@@Z @ 39 NONAME ; long MsgSendUtil::saveToDrafts(class ConvergedMessage &) + ?launchVCardViewer@MsgContactsUtil@@SA_NABVQString@@@Z @ 40 NONAME ; bool MsgContactsUtil::launchVCardViewer(class QString const &) + ?mediaDuration@MsgMediaUtil@@QAE?AVQString@@ABV2@@Z @ 41 NONAME ; class QString MsgMediaUtil::mediaDuration(class QString const &) + ??_EMmsConformanceCheck@@UAE@I@Z @ 42 NONAME ; MmsConformanceCheck::~MmsConformanceCheck(unsigned int) + ??1MsgSendUtil@@UAE@XZ @ 43 NONAME ; MsgSendUtil::~MsgSendUtil(void) + ?qt_metacall@MsgSendUtil@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 44 NONAME ; int MsgSendUtil::qt_metacall(enum QMetaObject::Call, int, void * *) diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/bwins/unifiededitoru.def --- a/messagingapp/msgui/bwins/unifiededitoru.def Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/bwins/unifiededitoru.def Thu Jul 22 16:32:06 2010 +0100 @@ -8,56 +8,56 @@ ?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 *) - ?sendingOptions@MsgUnifiedEditorView@@AAEXXZ @ 10 NONAME ; void MsgUnifiedEditorView::sendingOptions(void) - ?saveContentToDrafts@MsgUnifiedEditorView@@QAEXXZ @ 11 NONAME ; void MsgUnifiedEditorView::saveContentToDrafts(void) - ?addAttachment@MsgUnifiedEditorView@@AAEHABVQString@@@Z @ 12 NONAME ; int MsgUnifiedEditorView::addAttachment(class QString const &) - ?doDelayedConstruction@MsgUnifiedEditorView@@AAEXXZ @ 13 NONAME ; void MsgUnifiedEditorView::doDelayedConstruction(void) - ?onContentChanged@MsgUnifiedEditorView@@AAEXXZ @ 14 NONAME ; void MsgUnifiedEditorView::onContentChanged(void) - ?staticMetaObject@MsgUnifiedEditorView@@2UQMetaObject@@B @ 15 NONAME ; struct QMetaObject const MsgUnifiedEditorView::staticMetaObject - ?activateInputBlocker@MsgUnifiedEditorView@@AAEXXZ @ 16 NONAME ; void MsgUnifiedEditorView::activateInputBlocker(void) - ?resizeEvent@MsgUnifiedEditorView@@MAEXPAVQGraphicsSceneResizeEvent@@@Z @ 17 NONAME ; void MsgUnifiedEditorView::resizeEvent(class QGraphicsSceneResizeEvent *) - ?ScaleImageL@CUniImageProcessor@@QAEXPAVCFbsBitmap@@0H@Z @ 18 NONAME ; void CUniImageProcessor::ScaleImageL(class CFbsBitmap *, class CFbsBitmap *, int) - ?onDialogSmsSettings@MsgUnifiedEditorView@@AAEXPAVHbAction@@@Z @ 19 NONAME ; void MsgUnifiedEditorView::onDialogSmsSettings(class HbAction *) - ?populateContent@MsgUnifiedEditorView@@QAEXABV?$QList@VQVariant@@@@@Z @ 20 NONAME ; void MsgUnifiedEditorView::populateContent(class QList const &) - ?onDialogMmsSettings@MsgUnifiedEditorView@@AAEXPAVHbAction@@@Z @ 21 NONAME ; void MsgUnifiedEditorView::onDialogMmsSettings(class HbAction *) - ?addCcBcc@MsgUnifiedEditorView@@AAEXXZ @ 22 NONAME ; void MsgUnifiedEditorView::addCcBcc(void) - ?ProcessImageL@CUniImageProcessor@@QAEXAAVRFile@@0AAVTSize@@ABVTDesC8@@HH@Z @ 23 NONAME ; void CUniImageProcessor::ProcessImageL(class RFile &, class RFile &, class TSize &, class TDesC8 const &, int, int) - ?generateFileName@MsgUnifiedEditorView@@AAE?AVQString@@AAV2@@Z @ 24 NONAME ; class QString MsgUnifiedEditorView::generateFileName(class QString &) - ?metaObject@MsgUnifiedEditorView@@UBEPBUQMetaObject@@XZ @ 25 NONAME ; struct QMetaObject const * MsgUnifiedEditorView::metaObject(void) const - ?createVCards@MsgUnifiedEditorView@@AAEHABVQVariant@@AAVQStringList@@@Z @ 26 NONAME ; int MsgUnifiedEditorView::createVCards(class QVariant const &, class QStringList &) - ?audiosFetched@MsgUnifiedEditorView@@AAEXABVQVariant@@@Z @ 27 NONAME ; void MsgUnifiedEditorView::audiosFetched(class QVariant const &) - ?addSubject@MsgUnifiedEditorView@@AAEXXZ @ 28 NONAME ; void MsgUnifiedEditorView::addSubject(void) - ?createTempFolder@MsgUnifiedEditorView@@AAE_NXZ @ 29 NONAME ; bool MsgUnifiedEditorView::createTempFolder(void) - ?imagesFetched@MsgUnifiedEditorView@@AAEXABVQVariant@@@Z @ 30 NONAME ; void MsgUnifiedEditorView::imagesFetched(class QVariant const &) - ?setFocus@MsgUnifiedEditorView@@AAEXPAVMsgUnifiedEditorBaseWidget@@@Z @ 31 NONAME ; void MsgUnifiedEditorView::setFocus(class MsgUnifiedEditorBaseWidget *) - ?vkbClosed@MsgUnifiedEditorView@@AAEXXZ @ 32 NONAME ; void MsgUnifiedEditorView::vkbClosed(void) - ?serviceRequestError@MsgUnifiedEditorView@@AAEXHABVQString@@@Z @ 33 NONAME ; void MsgUnifiedEditorView::serviceRequestError(int, class QString const &) - ?qt_metacast@MsgUnifiedEditorView@@UAEPAXPBD@Z @ 34 NONAME ; void * MsgUnifiedEditorView::qt_metacast(char const *) - ?removeTempFolder@MsgUnifiedEditorView@@AAEXXZ @ 35 NONAME ; void MsgUnifiedEditorView::removeTempFolder(void) - ?vkbOpened@MsgUnifiedEditorView@@AAEXXZ @ 36 NONAME ; void MsgUnifiedEditorView::vkbOpened(void) - ?ScaleImageL@CUniImageProcessor@@QAEXAAVRFile@@AAPAVCFbsBitmap@@1AAVTSize@@H@Z @ 37 NONAME ; void CUniImageProcessor::ScaleImageL(class RFile &, class CFbsBitmap * &, class CFbsBitmap * &, class TSize &, int) - ?addMenu@MsgUnifiedEditorView@@AAEXXZ @ 38 NONAME ; void MsgUnifiedEditorView::addMenu(void) - ?initView@MsgUnifiedEditorView@@AAEXXZ @ 39 NONAME ; void MsgUnifiedEditorView::initView(void) - ??_EMsgUnifiedEditorView@@UAE@I@Z @ 40 NONAME ; MsgUnifiedEditorView::~MsgUnifiedEditorView(unsigned int) - ??1MsgUnifiedEditorView@@UAE@XZ @ 41 NONAME ; MsgUnifiedEditorView::~MsgUnifiedEditorView(void) - ?setAttachOptionEnabled@MsgUnifiedEditorView@@AAEXW4TBE_AttachOption@1@_N@Z @ 42 NONAME ; void MsgUnifiedEditorView::setAttachOptionEnabled(enum MsgUnifiedEditorView::TBE_AttachOption, bool) - ?hideChrome@MsgUnifiedEditorView@@AAEX_N@Z @ 43 NONAME ; void MsgUnifiedEditorView::hideChrome(bool) - ?trUtf8@MsgUnifiedEditorView@@SA?AVQString@@PBD0@Z @ 44 NONAME ; class QString MsgUnifiedEditorView::trUtf8(char const *, char const *) - ?tr@MsgUnifiedEditorView@@SA?AVQString@@PBD0@Z @ 45 NONAME ; class QString MsgUnifiedEditorView::tr(char const *, char const *) - ?ScaleImageL@CUniImageProcessor@@QAEXPAVCFbsBitmap@@AAVRFile@@ABVTSize@@ABVTDesC8@@H@Z @ 46 NONAME ; void CUniImageProcessor::ScaleImageL(class CFbsBitmap *, class RFile &, class TSize const &, class TDesC8 const &, int) - ?getStaticMetaObject@MsgUnifiedEditorView@@SAABUQMetaObject@@XZ @ 47 NONAME ; struct QMetaObject const & MsgUnifiedEditorView::getStaticMetaObject(void) - ?tr@MsgUnifiedEditorView@@SA?AVQString@@PBD0H@Z @ 48 NONAME ; class QString MsgUnifiedEditorView::tr(char const *, char const *, int) - ?populateContentIntoEditor@MsgUnifiedEditorView@@AAEXABVConvergedMessage@@@Z @ 49 NONAME ; void MsgUnifiedEditorView::populateContentIntoEditor(class ConvergedMessage const &) - ?send@MsgUnifiedEditorView@@AAEXXZ @ 50 NONAME ; void MsgUnifiedEditorView::send(void) - ?Reset@CUniImageProcessor@@QAEXXZ @ 51 NONAME ; void CUniImageProcessor::Reset(void) - ?openDraftsMessage@MsgUnifiedEditorView@@QAEXABV?$QList@VQVariant@@@@@Z @ 52 NONAME ; void MsgUnifiedEditorView::openDraftsMessage(class QList const &) - ?addToolBar@MsgUnifiedEditorView@@AAEXXZ @ 53 NONAME ; void MsgUnifiedEditorView::addToolBar(void) - ?contactsFetched@MsgUnifiedEditorView@@AAEXABVQVariant@@@Z @ 54 NONAME ; void MsgUnifiedEditorView::contactsFetched(class QVariant const &) - ?removeAttachmentContainer@MsgUnifiedEditorView@@AAEXXZ @ 55 NONAME ; void MsgUnifiedEditorView::removeAttachmentContainer(void) - ?trUtf8@MsgUnifiedEditorView@@SA?AVQString@@PBD0H@Z @ 56 NONAME ; class QString MsgUnifiedEditorView::trUtf8(char const *, char const *, int) - ?onDialogDeleteMsg@MsgUnifiedEditorView@@AAEXPAVHbAction@@@Z @ 57 NONAME ; void MsgUnifiedEditorView::onDialogDeleteMsg(class HbAction *) - ??0MsgUnifiedEditorView@@QAE@PAVQGraphicsItem@@@Z @ 58 NONAME ; MsgUnifiedEditorView::MsgUnifiedEditorView(class QGraphicsItem *) - ?fetchContacts@MsgUnifiedEditorView@@AAEXXZ @ 59 NONAME ; void MsgUnifiedEditorView::fetchContacts(void) + ?addAttachment@MsgUnifiedEditorView@@AAEHABVQString@@@Z @ 10 NONAME ; int MsgUnifiedEditorView::addAttachment(class QString const &) + ?doDelayedConstruction@MsgUnifiedEditorView@@AAEXXZ @ 11 NONAME ; void MsgUnifiedEditorView::doDelayedConstruction(void) + ?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) + ?resizeEvent@MsgUnifiedEditorView@@MAEXPAVQGraphicsSceneResizeEvent@@@Z @ 15 NONAME ; void MsgUnifiedEditorView::resizeEvent(class QGraphicsSceneResizeEvent *) + ?ScaleImageL@CUniImageProcessor@@QAEXPAVCFbsBitmap@@0H@Z @ 16 NONAME ; void CUniImageProcessor::ScaleImageL(class CFbsBitmap *, class CFbsBitmap *, int) + ?onDialogSmsSettings@MsgUnifiedEditorView@@AAEXPAVHbAction@@@Z @ 17 NONAME ; void MsgUnifiedEditorView::onDialogSmsSettings(class HbAction *) + ?populateContent@MsgUnifiedEditorView@@QAEXABV?$QList@VQVariant@@@@@Z @ 18 NONAME ; void MsgUnifiedEditorView::populateContent(class QList const &) + ?onDialogMmsSettings@MsgUnifiedEditorView@@AAEXPAVHbAction@@@Z @ 19 NONAME ; void MsgUnifiedEditorView::onDialogMmsSettings(class HbAction *) + ?addCcBcc@MsgUnifiedEditorView@@AAEXXZ @ 20 NONAME ; void MsgUnifiedEditorView::addCcBcc(void) + ?saveContentToDrafts@MsgUnifiedEditorView@@QAEHXZ @ 21 NONAME ; int MsgUnifiedEditorView::saveContentToDrafts(void) + ?ProcessImageL@CUniImageProcessor@@QAEXAAVRFile@@0AAVTSize@@ABVTDesC8@@HH@Z @ 22 NONAME ; void CUniImageProcessor::ProcessImageL(class RFile &, class RFile &, class TSize &, class TDesC8 const &, int, int) + ?generateFileName@MsgUnifiedEditorView@@AAE?AVQString@@AAV2@@Z @ 23 NONAME ; class QString MsgUnifiedEditorView::generateFileName(class QString &) + ?metaObject@MsgUnifiedEditorView@@UBEPBUQMetaObject@@XZ @ 24 NONAME ; struct QMetaObject const * MsgUnifiedEditorView::metaObject(void) const + ?createVCards@MsgUnifiedEditorView@@AAEHABVQVariant@@AAVQStringList@@@Z @ 25 NONAME ; int MsgUnifiedEditorView::createVCards(class QVariant const &, class QStringList &) + ?addSubject@MsgUnifiedEditorView@@AAEXXZ @ 26 NONAME ; void MsgUnifiedEditorView::addSubject(void) + ?createTempFolder@MsgUnifiedEditorView@@AAE_NXZ @ 27 NONAME ; bool MsgUnifiedEditorView::createTempFolder(void) + ?imagesFetched@MsgUnifiedEditorView@@AAEXABVQVariant@@@Z @ 28 NONAME ; void MsgUnifiedEditorView::imagesFetched(class QVariant const &) + ?setFocus@MsgUnifiedEditorView@@AAEXPAVMsgUnifiedEditorBaseWidget@@@Z @ 29 NONAME ; void MsgUnifiedEditorView::setFocus(class MsgUnifiedEditorBaseWidget *) + ?vkbClosed@MsgUnifiedEditorView@@AAEXXZ @ 30 NONAME ; void MsgUnifiedEditorView::vkbClosed(void) + ?serviceRequestError@MsgUnifiedEditorView@@AAEXHABVQString@@@Z @ 31 NONAME ; void MsgUnifiedEditorView::serviceRequestError(int, class QString const &) + ?qt_metacast@MsgUnifiedEditorView@@UAEPAXPBD@Z @ 32 NONAME ; void * MsgUnifiedEditorView::qt_metacast(char const *) + ?removeTempFolder@MsgUnifiedEditorView@@AAEXXZ @ 33 NONAME ; void MsgUnifiedEditorView::removeTempFolder(void) + ?vkbOpened@MsgUnifiedEditorView@@AAEXXZ @ 34 NONAME ; void MsgUnifiedEditorView::vkbOpened(void) + ?ScaleImageL@CUniImageProcessor@@QAEXAAVRFile@@AAPAVCFbsBitmap@@1AAVTSize@@H@Z @ 35 NONAME ; void CUniImageProcessor::ScaleImageL(class RFile &, class CFbsBitmap * &, class CFbsBitmap * &, class TSize &, int) + ?addMenu@MsgUnifiedEditorView@@AAEXXZ @ 36 NONAME ; void MsgUnifiedEditorView::addMenu(void) + ?enableSendButton@MsgUnifiedEditorView@@AAEX_N@Z @ 37 NONAME ; void MsgUnifiedEditorView::enableSendButton(bool) + ?initView@MsgUnifiedEditorView@@AAEXXZ @ 38 NONAME ; void MsgUnifiedEditorView::initView(void) + ??_EMsgUnifiedEditorView@@UAE@I@Z @ 39 NONAME ; MsgUnifiedEditorView::~MsgUnifiedEditorView(unsigned int) + ??1MsgUnifiedEditorView@@UAE@XZ @ 40 NONAME ; MsgUnifiedEditorView::~MsgUnifiedEditorView(void) + ?setAttachOptionEnabled@MsgUnifiedEditorView@@AAEXW4TBE_AttachOption@1@_N@Z @ 41 NONAME ; void MsgUnifiedEditorView::setAttachOptionEnabled(enum MsgUnifiedEditorView::TBE_AttachOption, bool) + ?hideChrome@MsgUnifiedEditorView@@AAEX_N@Z @ 42 NONAME ; void MsgUnifiedEditorView::hideChrome(bool) + ?trUtf8@MsgUnifiedEditorView@@SA?AVQString@@PBD0@Z @ 43 NONAME ; class QString MsgUnifiedEditorView::trUtf8(char const *, char const *) + ?tr@MsgUnifiedEditorView@@SA?AVQString@@PBD0@Z @ 44 NONAME ; class QString MsgUnifiedEditorView::tr(char const *, char const *) + ?ScaleImageL@CUniImageProcessor@@QAEXPAVCFbsBitmap@@AAVRFile@@ABVTSize@@ABVTDesC8@@H@Z @ 45 NONAME ; void CUniImageProcessor::ScaleImageL(class CFbsBitmap *, class RFile &, class TSize const &, class TDesC8 const &, int) + ?getStaticMetaObject@MsgUnifiedEditorView@@SAABUQMetaObject@@XZ @ 46 NONAME ; struct QMetaObject const & MsgUnifiedEditorView::getStaticMetaObject(void) + ?tr@MsgUnifiedEditorView@@SA?AVQString@@PBD0H@Z @ 47 NONAME ; class QString MsgUnifiedEditorView::tr(char const *, char const *, int) + ?send@MsgUnifiedEditorView@@AAEXXZ @ 48 NONAME ; void MsgUnifiedEditorView::send(void) + ?Reset@CUniImageProcessor@@QAEXXZ @ 49 NONAME ; void CUniImageProcessor::Reset(void) + ?populateContentIntoEditor@MsgUnifiedEditorView@@AAEXABVConvergedMessage@@_N@Z @ 50 NONAME ; void MsgUnifiedEditorView::populateContentIntoEditor(class ConvergedMessage const &, bool) + ?openDraftsMessage@MsgUnifiedEditorView@@QAEXABV?$QList@VQVariant@@@@@Z @ 51 NONAME ; void MsgUnifiedEditorView::openDraftsMessage(class QList const &) + ?addToolBar@MsgUnifiedEditorView@@AAEXXZ @ 52 NONAME ; void MsgUnifiedEditorView::addToolBar(void) + ?contactsFetched@MsgUnifiedEditorView@@AAEXABVQVariant@@@Z @ 53 NONAME ; void MsgUnifiedEditorView::contactsFetched(class QVariant const &) + ?removeAttachmentContainer@MsgUnifiedEditorView@@AAEXXZ @ 54 NONAME ; void MsgUnifiedEditorView::removeAttachmentContainer(void) + ?trUtf8@MsgUnifiedEditorView@@SA?AVQString@@PBD0H@Z @ 55 NONAME ; class QString MsgUnifiedEditorView::trUtf8(char const *, char const *, int) + ?onDialogDeleteMsg@MsgUnifiedEditorView@@AAEXPAVHbAction@@@Z @ 56 NONAME ; void MsgUnifiedEditorView::onDialogDeleteMsg(class HbAction *) + ??0MsgUnifiedEditorView@@QAE@PAVQGraphicsItem@@@Z @ 57 NONAME ; MsgUnifiedEditorView::MsgUnifiedEditorView(class QGraphicsItem *) + ?fetchContacts@MsgUnifiedEditorView@@AAEXXZ @ 58 NONAME ; void MsgUnifiedEditorView::fetchContacts(void) + ?formatAddresses@MsgUnifiedEditorView@@AAEXAAV?$QList@PAVConvergedMessageAddress@@@@@Z @ 59 NONAME ; void MsgUnifiedEditorView::formatAddresses(class QList &) ?deleteMessage@MsgUnifiedEditorView@@AAEXXZ @ 60 NONAME ; void MsgUnifiedEditorView::deleteMessage(void) ?addAttachments@MsgUnifiedEditorView@@AAEXVQStringList@@@Z @ 61 NONAME ; void MsgUnifiedEditorView::addAttachments(class QStringList) ?deactivateInputBlocker@MsgUnifiedEditorView@@AAEXXZ @ 62 NONAME ; void MsgUnifiedEditorView::deactivateInputBlocker(void) diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/bwins/unifiedvieweru.def --- a/messagingapp/msgui/bwins/unifiedvieweru.def Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/bwins/unifiedvieweru.def Thu Jul 22 16:32:06 2010 +0100 @@ -5,19 +5,18 @@ ?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 *) - ??0UnifiedViewer@@QAE@HPAVQGraphicsItem@@@Z @ 7 NONAME ; UnifiedViewer::UnifiedViewer(int, class QGraphicsItem *) - ?handleFwdAction@UnifiedViewer@@QAEXXZ @ 8 NONAME ; void UnifiedViewer::handleFwdAction(void) - ?qt_metacast@UnifiedViewer@@UAEPAXPBD@Z @ 9 NONAME ; void * UnifiedViewer::qt_metacast(char const *) - ?createToolBar@UnifiedViewer@@AAEXXZ @ 10 NONAME ; void UnifiedViewer::createToolBar(void) - ??1UnifiedViewer@@UAE@XZ @ 11 NONAME ; UnifiedViewer::~UnifiedViewer(void) + ?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 *) - ?validateMsgForForward@UnifiedViewer@@AAE_NXZ @ 15 NONAME ; bool UnifiedViewer::validateMsgForForward(void) - ?getStaticMetaObject@UnifiedViewer@@SAABUQMetaObject@@XZ @ 16 NONAME ; struct QMetaObject const & UnifiedViewer::getStaticMetaObject(void) + ?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) - ?onDialogDeleteMsg@UnifiedViewer@@AAEXPAVHbAction@@@Z @ 21 NONAME ; void UnifiedViewer::onDialogDeleteMsg(class HbAction *) diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/conversationview.pro --- a/messagingapp/msgui/conversationview/conversationview.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/conversationview.pro Thu Jul 22 16:32:06 2010 +0100 @@ -21,22 +21,21 @@ inc \ ../inc \ src - + INCLUDEPATH += . INCLUDEPATH += ../../../inc +INCLUDEPATH += ../msgaudiofetcher/inc INCLUDEPATH += ../msguiutils/inc -INCLUDEPATH += ../../msgutils/s60qconversions/inc INCLUDEPATH += ../../msgutils/unieditorutils/editorgenutils/inc INCLUDEPATH += ../appengine/inc INCLUDEPATH += ../../smartmessaging/ringbc/inc INCLUDEPATH += ../../msgsettings/settingsview/inc +INCLUDEPATH += ../../msgutils/unidatamodel/univcaldataplugin/inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE -INCLUDEPATH += /ext/mw/qthighway/inc -INCLUDEPATH += /ext/mw/qtextensions/qtmobileextensions/include -INCLUDEPATH += ../../msgutils/unidatamodel/univcaldataplugin/inc CONFIG += hb +HB += hbfeedback QT += sql TARGET.UID3 = 0x20024322 @@ -73,10 +72,17 @@ RESOURCES += conversationview.qrc +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/conversationview.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/conversationview.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock # Libs LIBS += -lappengine \ - -ls60qconversions \ -lconvergedmessageutils \ -lapgrfx \ -lefsrv \ @@ -95,9 +101,8 @@ -lgsmu \ -lsmcm \ -leditorgenutils \ - -lthumbnailmanagerqt \ - -lfbscli \ - -lestor \ - -lsqldb \ - -lxqsettingsmanager + -lthumbnailmanagerqt \ + -lxqsettingsmanager \ + -lxqutils \ + -lmsgaudiofetcher diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/conversationview.qrc diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h --- a/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h Thu Jul 22 16:32:06 2010 +0100 @@ -25,14 +25,13 @@ class HbIconItem; class HbTextItem; class HbIcon; -class QGraphicsSceneMouseEvent; -//class HbGestureSceneFilter; class ThumbnailManager; #include "convergedmessageaddress.h" /** - * This class is a custom layout widget for Contact Card layout. + * @class MsgContactCardWidget + * @brief This class is a custom layout widget for Contact Card layout. */ class MsgContactCardWidget: public HbWidget { @@ -85,27 +84,21 @@ */ void clearContent(); - /** - * for tactile feed back. - * Depricated - */ - // HbFeedback::InstantEffect overrideFeedback(Hb::InstantInteraction interaction) const; +signals: /** - * To connect/disconnect clicked signal + * */ - void connectSignals(bool yes); + void conversationIdChanged(qint64 convId); protected: - /** - * reimplemented from base class. - */ - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); /** - * reimplemented from base class. + * Event handler for gesture events. + * Reimplemented from HbWidgetBase. + * @see HbWidgetBase */ - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + virtual void gestureEvent(QGestureEvent *event); private: @@ -113,27 +106,28 @@ * Initialization function. */ void init(); - + /** Helper method to get contact id against phone number. * @param value phone number. */ int resolveContactId(const QString& value); /** - * Helper method to set back ground. + * Handles pressed state. */ - void setBackGround(const QString& bg); + void setPressed(bool pressed); private slots: - /** - * show longpress menu for attachment object - */ - void handleLongPress(QPointF position); /** - * Helper method to initialize gesture. + * show longp tap. */ - void initGesture(); + void handleLongTap(const QPointF &position); + + /** + * handles short tap. + */ + void handleShortTap(const QPointF &position); /** * Slot for handling valid returns from the framework. @@ -170,26 +164,29 @@ * Called after service request is completed. */ void onServiceRequestCompleted(); - + /** * Slot hit when the thumbnail is ready. */ void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error); -signals: /** - * Emitted when contact card is short tapped. + * Ignore gesture events. */ - void clicked(); + void ignoreSignals(bool yes); + + /** + * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture + * events back to back. + */ + void regrabGesture(); private: - // Data - /** - * To supress short tap if long tap triggered. + * Bool variable on which gesture events are accepted/ignored. */ - bool mMenuShown; + bool mIgnoreEvents; /** * Contact Number for the conversation @@ -220,11 +217,6 @@ HbTextItem *mAddressTextItem; /** - * gesture filter for long press. - */ - // HbGestureSceneFilter* mGestureFilter; - - /** * ThumbnailManager * Own. */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/inc/msgconversationbaseview.h --- a/messagingapp/msgui/conversationview/inc/msgconversationbaseview.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/inc/msgconversationbaseview.h Thu Jul 22 16:32:06 2010 +0100 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description:Conversation Base view. + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description:Conversation Base view. + * + */ #ifndef MSG_CONVERSATION_VIEW_INTERFACE_H #define MSG_CONVERSATION_VIEW_INTERFACE_H @@ -36,16 +35,16 @@ class XQSettingsManager; class XQPublishAndSubscribeUtils; -class CONVERSATION_VIEW_EXPORT MsgConversationBaseView : public MsgBaseView - { - Q_OBJECT +class CONVERSATION_VIEW_EXPORT MsgConversationBaseView: public MsgBaseView +{ +Q_OBJECT public: /** * Constructor */ - MsgConversationBaseView(QGraphicsItem* parent=0); + MsgConversationBaseView(QGraphicsItem* parent = 0); /** * Destructor @@ -70,53 +69,55 @@ /** * saveContentToDrafts * Saves the editors content in cv to drafts + * @return valid message id if save is success + * else invalid message id ( i.e. -1 ) */ - void saveContentToDrafts(); - + int saveContentToDrafts(); + /** * conversationId * Get the conversationId */ - qint64 conversationId(); + qint64 conversationId(); -public slots: +public slots: /** * Close the conversation view * This slot is triggered when user presses back(seconday sofykey) */ void closeConversationView(); - + /** * Mark messages as read * Slot is triiggered when replying started */ void markMessagesAsRead(); - + /** * Publish the conversation id based on the flag. * @param setId if true previous conversation id * will be published else -1 will be published. */ void setPSCVId(bool setId); - + private slots: - /** - * Slot for delayed construction - */ + /** + * Slot for delayed construction + */ void doDelayedConstruction(); - - /** - * Hides chrome when itu-t is up - */ + + /** + * Hides chrome when itu-t is up + */ void hideChrome(bool hide); - - /** + + /** * Slot for handling valid returns from the framework. * * @param result const QVariant& */ void handleOk(const QVariant& result); - + /** * Slot for handling errors. Error ids are provided as * 32-bit integers. @@ -126,58 +127,61 @@ /** * Slot for handling the timer expiry event fired from view reay indication - */ + */ void handleViewReady(); - - signals: - /** - * Signal emitted when the conversation view is closed. - */ - void conversationViewClosed(); - -private : + + /** + * + */ + void handleConversationIdChange(qint64 convId); + +signals: + /** + * Signal emitted when the conversation view is closed. + */ + void conversationViewClosed(); + +private: /** * Create and initialise the view */ void initView(); - + private: - - /** + + /** * Conversation ID */ qint64 mConversationId; - + /** * MsgConversationView, main view class * Owned */ - MsgConversationView *mConversationView; - + MsgConversationView *mConversationView; + /** * Contact card widget. */ MsgContactCardWidget* mContactCard; - + /** * Main layout. */ QGraphicsLinearLayout* mMainLayout; - - /** + + /** * Object of XQSettingsKey. - */ + */ XQSettingsKey mCVIdkey; /** * mSettingsManager * Instance of the XQSettingsManager * Own. - */ - XQSettingsManager* mSettingsManager; - - }; + */ + XQSettingsManager* mSettingsManager; +}; #endif // MSG_CONVERSATION_VIEW_INTERFACE_H - // EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/inc/msgconversationview.h --- a/messagingapp/msgui/conversationview/inc/msgconversationview.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/inc/msgconversationview.h Thu Jul 22 16:32:06 2010 +0100 @@ -66,9 +66,10 @@ /** * Save the content inside editor to drafts - * @return true if save is success else false. + * @return valid message id if save is success + * else invalid message id ( i.e. -1 ) */ - bool saveContentToDrafts(); + int saveContentToDrafts(); private slots: @@ -102,6 +103,17 @@ */ void onDialogSaveTone(HbAction* action); + /** + * This slot is called when the orientation is changed + * @param newOrientation orientation + */ + void onOrientationChanged(Qt::Orientation newOrientation); + + /** + * This slot is called when the orientation is about to bechanged + */ + void onOrientationAboutToBeChanged(); + private: /** @@ -115,6 +127,11 @@ void setupMenu(); /** + * Triggers model to fetch more conversations. + */ + void fetchMoreConversations(); + + /** * Populates ConvergedMessage for sending. * @param ConvergedMessage to be populated * @see ConvergedMessage::MessageType @@ -181,15 +198,6 @@ * @see ConvergedMessage::MessageType */ void addDownloadItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu); - - /** - * Validates if message can be forwarded - * @param messageType - * @param messageId - * @return true if message can be forwarded - * false if message cant be forwarded - */ - bool validateMsgForForward(int &messageType,qint32 &messageId); /** * Launches the BT message display service. @@ -203,6 +211,11 @@ * data */ void refreshView(); + + /** + * This slot is called when the view is successfully added to main window + */ + void onViewReady(); private slots: @@ -210,6 +223,8 @@ * Utility method to scroll the list to show the bottom most item */ void scrollToBottom(); + + void onConversationViewEmpty(); /** * Handler for long tap of a list item. @@ -257,11 +272,6 @@ */ void contactsFetched(const QVariant& value); - /* - * Get audio files from audio-fetcher and launch editor - */ - void audiosFetched(const QVariant& result ); - /** * slot to receive fetched contacts for vcard addition */ @@ -328,10 +338,11 @@ */ void replyStarted(); - /** - * This signal is emitted when vkb is open. - */ - void hideChrome(bool); + /** + * This signal is emitted when vkb is open/closed. + * @param state True if keypad is opened else false. + */ + void vkbOpened(bool state); private slots: /** @@ -410,21 +421,31 @@ */ QGraphicsLinearLayout *mMainLayout; - /** - * Flag to track if item has been long pressed. - * TODO: Remove it, once unique longpress and click event signal released in week16 - */ - bool mItemLongPressed; /* * Instance of VKB */ HbStaticVkbHost* mVkbHost; /** + * variable holding the visible model index + */ + QModelIndex mVisibleIndex; + + /** * Flag to check it vkb is open. */ bool mVkbopened; - + + /** + * Flag is set when model is populated. + * @see signal conversationModelPopulated() + */ + bool mModelPopulated; + + /** + * Flag is set when + */ + bool mViewReady; }; #endif // MSG_CONVERSATION_VIEW_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/inc/msgconversationviewitem.h --- a/messagingapp/msgui/conversationview/inc/msgconversationviewitem.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/inc/msgconversationviewitem.h Thu Jul 22 16:32:06 2010 +0100 @@ -94,13 +94,28 @@ /* * Update item with sms content */ - void updateSmsTypeItem(const QModelIndex& index,int messageSubType = ConvergedMessage::None); - + void updateSmsTypeItem(const QModelIndex& index, int messageSubType = + ConvergedMessage::None); + /* * Update item with mms type content */ - void updateMmsTypeItem(const QModelIndex& index, int messageType,int messageSubType); + void updateMmsTypeItem(const QModelIndex& index, int messageType, + int messageSubType); + + /* + * Initializes the msgconverstionviewitem + */ + void init(); +private slots: + + /* + * Handler for orientation changed + * @param orientation Qt::Orientation + */ + void orientationchanged(Qt::Orientation orientation); + protected: /** @@ -125,10 +140,17 @@ MsgConversationWidget *mConversation; /** + * Graphics Item to hold message incoming state. + * Applicable for notification + * Owned + */ + HbIconItem *mIncomingMsgStateIconItem; + + /** * Graphics Item to hold message sending state. * Owned */ - HbIconItem *mMessageStateIconItem; + HbIconItem *mOutgoingMsgStateIconItem; }; #endif // MSG_CONVERSATION_VIEW_ITEM_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/inc/msgconversationwidget.h --- a/messagingapp/msgui/conversationview/inc/msgconversationwidget.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/inc/msgconversationwidget.h Thu Jul 22 16:32:06 2010 +0100 @@ -20,6 +20,7 @@ // SYSTEM INCLUDES #include +#include // FORWORD DECLARATIONS class HbFrameItem; @@ -86,10 +87,10 @@ void setBodyText(const QString &bodyText); /** - * Set preview icon path for this widget - * @param QString + * Set preview icon for this widget + * @param HbIcon, preview-icon */ - void setPreviewIconPath(const QString& filePath,int msgId); + void setPreviewIcon(HbIcon& icon); /** * Set priority property @@ -277,11 +278,26 @@ */ void resetProperties(); - /** - * Function to repolish the widget + /** + * Function to repolish widget. */ void repolishWidget(); +protected: + + /* + * @see HbWidget + */ + virtual void polish(HbStyleParameters ¶ms); + +private slots: + + /* + * Handler for orientation changed + * @param orientation Qt::Orientation + */ + void orientationchanged(Qt::Orientation orientation); + private: /** diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/inc/msgeditorwidget.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget.css --- a/messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget.css Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget.css Thu Jul 22 16:32:06 2010 +0100 @@ -35,12 +35,3 @@ text-line-count-min:1; text-line-count-max:1; } - -MsgContactCardWidget::backgroundFrame -{ - zvalue:-1; - left:0un; - top:0un; - right:0un; - bottom:0un; -} diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget.widgetml --- a/messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget.widgetml Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget.widgetml Thu Jul 22 16:32:06 2010 +0100 @@ -10,6 +10,5 @@ - \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget_color.css --- a/messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget_color.css Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget_color.css Thu Jul 22 16:32:06 2010 +0100 @@ -1,5 +1,10 @@ -MsgContactCardWidget::addressText +MsgContactCardWidget[state="normal"]::addressText { color:var(qtc_groupbox_normal); } + +MsgContactCardWidget[state="pressed"]::addressText +{ + color:var(qtc_groupbox_pressed); +} diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/resources/layouts/msgconversationviewitem.css --- a/messagingapp/msgui/conversationview/resources/layouts/msgconversationviewitem.css Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/resources/layouts/msgconversationviewitem.css Thu Jul 22 16:32:06 2010 +0100 @@ -1,28 +1,20 @@ -MsgConversationViewItem[isIncoming="true"] +MsgConversationViewItem { - layout:layout-incoming; + layout:layout-conversation; pref-height:-1; pref-width:-1; size-policy-vertical:minimum-expanding; } -MsgConversationViewItem[isIncoming="false"] +MsgConversationViewItem::msgconvwidget { - layout:layout-outgoing; - pref-height:-1; - pref-width:-1; - size-policy-vertical:minimum-expanding; -} - -MsgConversationViewItem[isIncoming="true"]::msgconvwidget -{ - left:-var(hb-param-margin-gene-left); + left:-var(hb-param-margin-gene-middle-horizontal); top:0.0un; right:var(hb-param-margin-gene-middle-horizontal); bottom:0.0un; } -MsgConversationViewItem[isIncoming="true"]::msgStateIcon +MsgConversationViewItem::msgStateIconIncoming { right:var(hb-param-margin-gene-right); size-policy:fixed fixed; @@ -31,15 +23,7 @@ pref-width:var(hb-param-graphic-size-primary-small); } -MsgConversationViewItem[isIncoming="false"]::msgconvwidget -{ - top:0.0un; - right:var(hb-param-margin-gene-right); - bottom:0.0un; - left:-var(hb-param-margin-gene-middle-horizontal); -} - -MsgConversationViewItem[isIncoming="false"]::msgStateIcon +MsgConversationViewItem::msgStateIconOutgoing { left:-var(hb-param-margin-gene-left); size-policy:fixed fixed; diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/resources/layouts/msgconversationviewitem.widgetml --- a/messagingapp/msgui/conversationview/resources/layouts/msgconversationviewitem.widgetml Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/resources/layouts/msgconversationviewitem.widgetml Thu Jul 22 16:32:06 2010 +0100 @@ -1,24 +1,14 @@ - - - + + + + + + - + - + - - - - - - - - - - - - - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.css --- a/messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.css Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.css Thu Jul 22 16:32:06 2010 +0100 @@ -9,27 +9,12 @@ MsgConversationWidget:portrait { - layout:layout-mms-portrait; -} - -MsgConversationWidget[hasImage="true"]:landscape -{ - layout:layout-mms-image-landscape; + layout:layout-msg-portrait; } -MsgConversationWidget[hasImage="false"]:landscape -{ - layout:layout-mms-landscape; -} - -MsgConversationWidget[hasImage="false"][hasAudio="true"][hasVideo="false"]:portrait +MsgConversationWidget:landscape { - layout:layout-mms-audio-text-portrait; -} - -MsgConversationWidget[hasImage="false"][hasAudio="true"][hasVideo="false"]:landscape -{ - layout:layout-mms-audio-text-landscape; + layout:layout-msg-landscape; } /********************* UNREAD INDICATOR / NEW ITEM ICON ************************/ @@ -64,19 +49,23 @@ bottom:var(hb-param-margin-gene-middle-vertical); text-height:var(hb-param-text-height-secondary); font-variant:primary; - text-align:left; text-line-count-min:1; - text-line-count-max:100; + text-line-count-max:30; +} + +MsgConversationWidget[isMMS="true"]::bodyText +{ + top:-var(hb-param-margin-gene-middle-vertical); } MsgConversationWidget[hasImage="true"]::bodyText:landscape { - left:-var(hb-param-margin-gene-middle-horizontal); + left:-var(hb-param-margin-gene-middle-horizontal); } -MsgConversationWidget[hasImage="false"][hasAudio="true"]::bodyText:landscape +MsgConversationWidget[hasAudio="true"]::bodyText:landscape { - left:-var(hb-param-margin-gene-middle-horizontal); + left:-var(hb-param-margin-gene-middle-horizontal); } /********************************** SUBJECT ***********************************/ @@ -96,7 +85,7 @@ MsgConversationWidget[isMMS="false"]::subject { - text-line-count-max:100; + text-line-count-max:30; text-height:var(hb-param-text-height-secondary); } @@ -137,30 +126,20 @@ /******************************** IMAGE / PREVIEW *****************************/ -MsgConversationWidget[hasImage="true"]::preview:portrait +MsgConversationWidget::preview { left:-var(hb-param-margin-gene-left); - right:1.0un; - bottom:var(hb-param-margin-gene-middle-vertical); - aspect-ratio:keep; - /*max-width:var(bubble_width);*/ - max-width:41.36un; - max-height:31.02un; - /*max-height:var(bubble_height);*/ - min-width:16un; - min-height:12un; + size-policy:fixed fixed; + aspect-ratio:ignore; } -MsgConversationWidget[hasImage="true"]::preview:landscape +MsgConversationWidget::preview:landscape { left:-var(hb-param-margin-gene-left); top:-var(hb-param-margin-gene-top); bottom:var(hb-param-margin-gene-bottom); - aspect-ratio:keep; - max-width:41.36un; - max-height:31.02un; - min-width:16un; - min-height:12un; + size-policy:fixed fixed; + aspect-ratio:ignore; } /****************************** TIMESTAMP TEXT ********************************/ @@ -182,7 +161,7 @@ left:-var(hb-param-margin-gene-middle-horizontal); } -MsgConversationWidget[hasImage="false"][hasAudio="true"]::timeStamp:landscape +MsgConversationWidget[hasAudio="true"]::timeStamp:landscape { left:-var(hb-param-margin-gene-middle-horizontal); } @@ -192,23 +171,17 @@ MsgConversationWidget::playIcon { zvalue:1; + left:-var(hb-param-margin-gene-middle-horizontal); aspect-ratio:ignore; size-policy:fixed fixed; - pref-width:var(hb-param-graphic-size-primary-medium); - pref-height:var(hb-param-graphic-size-primary-medium); + pref-width:var(hb-param-graphic-size-primary-small); + pref-height:var(hb-param-graphic-size-primary-small); } -/******************************** AUDIO ICON **********************************/ - -MsgConversationWidget[hasAudio="true"]::audioIcon +MsgConversationWidget::playIcon:landscape { top:-var(hb-param-margin-gene-top); - left:-var(hb-param-margin-gene-left); - bottom:var(hb-param-margin-gene-middle-vertical); - aspect-ratio:ignore; - size-policy:fixed fixed; - pref-width:var(hb-param-graphic-size-primary-large); - pref-height:var(hb-param-graphic-size-primary-large); } + /* EOF */ \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.widgetml --- a/messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.widgetml Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.widgetml Thu Jul 22 16:32:06 2010 +0100 @@ -1,9 +1,8 @@ - + - - + @@ -13,14 +12,14 @@ - - + + - + @@ -34,19 +33,18 @@ - - + + - + - - - + + @@ -55,11 +53,12 @@ - + + - - - + + + @@ -72,110 +71,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp --- a/messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -21,27 +21,24 @@ #include #include #include -#include -//#include -//#include -#include +#include +#include #include #include #include #include #include -#include +#include #include #include #include -#include #include +#include #include // USER INCLUDES #include "conversationsenginedefines.h" -#include "debugtraces.h" #include "conversationsengine.h" #include "convergedmessage.h" #include "msgcontacthandler.h" @@ -49,13 +46,12 @@ // LOCAL CONSTANTS const QString DEFAULT_AVATAR_ICON("qtg_large_avatar"); const QString BT_ICON("qtg_large_bluetooth"); -const QString BACKGROUND_FRAME_NORMAL("qtg_fr_groupbox"); -const QString GROUPBOX_BG_FRAME_PRESSED("qtg_fr_groupbox_pressed"); - +const QString BG_FRAME_NORMAL("qtg_fr_groupbox_normal"); +const QString BG_FRAME_PRESSED("qtg_fr_groupbox_pressed"); // LOCALIZATION CONSTANTS #define LOC_RECEIVED_FILES hbTrId("txt_messaging_title_received_files") -#define LOC_MENU_CONTACT_INFO hbTrId("txt_messaging_menu_open_contact_info") +#define LOC_MENU_CONTACT_INFO hbTrId("txt_messaging_menu_contact_info") #define LOC_COMMON_MENU_CALL hbTrId("txt_common_menu_call_verb") #define LOC_SAVETO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts") @@ -66,14 +62,10 @@ // @see header //--------------------------------------------------------------- MsgContactCardWidget::MsgContactCardWidget(QGraphicsItem *parent) : - HbWidget(parent), mMenuShown(false), mAvatarIconItem(NULL), mPresenceIconItem(NULL), - mAddressTextItem(NULL),mThumbnailManager(NULL) + HbWidget(parent), mIgnoreEvents(false), mAvatarIconItem(NULL), mPresenceIconItem(NULL), + mAddressTextItem(NULL), mThumbnailManager(NULL) { init(); - setBackGround(BACKGROUND_FRAME_NORMAL); - connectSignals(true); - - connect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(initGesture())); } //--------------------------------------------------------------- @@ -82,9 +74,6 @@ //--------------------------------------------------------------- MsgContactCardWidget::~MsgContactCardWidget() { - /* if (mGestureFilter) { - removeSceneEventFilter(mGestureFilter); - }*/ } //--------------------------------------------------------------- @@ -93,6 +82,12 @@ //--------------------------------------------------------------- void MsgContactCardWidget::init() { + this->setProperty("state", "normal"); + this->grabGesture(Qt::TapGesture); + + HbFrameItem *frameItem = new HbFrameItem(BG_FRAME_NORMAL, HbFrameDrawer::NinePieces, this); + this->setBackgroundItem(frameItem); + mAvatarIconItem = new HbIconItem(this); HbStyle::setItemName(mAvatarIconItem, "avatar"); @@ -146,10 +141,18 @@ ConvergedMessageAddressList MsgContactCardWidget::address() { ConvergedMessageAddressList addresses; - QModelIndex index = ConversationsEngine::instance()->getConversationsModel()->index(0, 0); + 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()); - address->setAlias(mAddress); + QString displayname; + QString addr; + ConversationsEngine::instance()->getContactDetails( + ConversationsEngine::instance()->getCurrentConversationId(), + displayname, + addr); + address->setAlias(displayname); addresses.append(address); return addresses; } @@ -194,16 +197,13 @@ setAddress(contactName); // Set Avatar - QList contactList = - MsgContactHandler::findContactList(mContactNumber); - + QList contactList = MsgContactHandler::findContactList(mContactNumber); + if (!contactList.isEmpty()) { - QList avatarDetails = - contactList.at(0).details (); - + QList avatarDetails = contactList.at(0).details (); + if (!avatarDetails.isEmpty()) { - mThumbnailManager->getThumbnail( - avatarDetails.at(0).imageUrl().toString()); + mThumbnailManager->getThumbnail(avatarDetails.at(0).imageUrl().toString()); } } @@ -223,113 +223,129 @@ } //--------------------------------------------------------------- -// MsgContactCardWidget::initGesture +// MsgContactCardWidget::gestureEvent // @see header file //--------------------------------------------------------------- -void MsgContactCardWidget::initGesture() +void MsgContactCardWidget::gestureEvent(QGestureEvent *event) { - // Create gesture filter - /* QGraphicsScene* sc = this->scene(); - mGestureFilter = new HbGestureSceneFilter(Qt::LeftButton, this); - - // Add gestures for longpress - HbGesture* gestureLongpressed = new HbGesture(HbGesture::longpress, 5); - - mGestureFilter->addGesture(gestureLongpressed); - - connect(gestureLongpressed, SIGNAL(longPress(QPointF)), this, SLOT(handleLongPress(QPointF))); - - //install gesture filter. - this->installSceneEventFilter(mGestureFilter); - - disconnect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(initGesture()));*/ + HbTapGesture *tapGesture = qobject_cast (event->gesture(Qt::TapGesture)); + if (tapGesture) { + switch (tapGesture->state()) { + case Qt::GestureStarted: + { + // Trigger haptic feedback. + HbInstantFeedback::play(HbFeedback::Basic); + setPressed(true); + break; + } + case Qt::GestureUpdated: + { + if (HbTapGesture::TapAndHold == tapGesture->tapStyleHint()) { + // Handle longtap. + setPressed(false); + handleLongTap(tapGesture->scenePosition()); + } + break; + } + case Qt::GestureFinished: + { + HbInstantFeedback::play(HbFeedback::Basic); + if (HbTapGesture::Tap == tapGesture->tapStyleHint()) { + // Handle short tap. + setPressed(false); + handleShortTap(tapGesture->scenePosition()); + } + break; + } + case Qt::GestureCanceled: + { + HbInstantFeedback::play(HbFeedback::Basic); + setPressed(false); + break; + } + } + } + else { + HbWidget::gestureEvent(event); + } } //--------------------------------------------------------------- -// MsgContactCardWidget::mousePressEvent +// MsgContactCardWidget::setPressed // @see header file //--------------------------------------------------------------- -void MsgContactCardWidget::mousePressEvent(QGraphicsSceneMouseEvent *event) +void MsgContactCardWidget::setPressed(bool pressed) { - mMenuShown = false; - - HbWidgetFeedback::triggered(this, Hb::InstantPressed); - - setBackGround(GROUPBOX_BG_FRAME_PRESSED); - - event->accept(); + HbFrameItem *frameItem = static_cast (this->backgroundItem()); + if (pressed) { + this->setProperty("state", "pressed"); + frameItem->frameDrawer().setFrameGraphicsName(BG_FRAME_PRESSED); + } + else { + this->setProperty("state", "normal"); + frameItem->frameDrawer().setFrameGraphicsName(BG_FRAME_NORMAL); + } } //--------------------------------------------------------------- -// MsgContactCardWidget::mouseReleaseEvent +// MsgContactCardWidget::handleLongTap // @see header file //--------------------------------------------------------------- -void MsgContactCardWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +void MsgContactCardWidget::handleLongTap(const QPointF &position) { - setBackGround(BACKGROUND_FRAME_NORMAL); - - if (this->rect().contains(event->pos()) && !mMenuShown) { - HbWidgetFeedback::triggered(this, Hb::InstantClicked); - emit clicked(); + // Check if events need to be ignored/accepted + if (mIgnoreEvents) { + return; } - event->accept(); -} - -//--------------------------------------------------------------- -// MsgContactCardWidget::setBackGround -// @see header file -//--------------------------------------------------------------- -void MsgContactCardWidget::setBackGround(const QString& bg) -{ - HbFrameItem* backGround = new HbFrameItem(this); - backGround->frameDrawer().setFrameGraphicsName(bg); - backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); - this->setBackgroundItem(backGround); - this->repolish(); -} - -//--------------------------------------------------------------- -// MsgContactCardWidget::handleLongPress -// @see header file -//--------------------------------------------------------------- -void MsgContactCardWidget::handleLongPress(QPointF position) -{ if (KBluetoothMsgsConversationId != ConversationsEngine::instance()->getCurrentConversationId()) { HbMenu* contextMenu = new HbMenu(); contextMenu->setDismissPolicy(HbPopup::TapAnywhere); contextMenu->setAttribute(Qt::WA_DeleteOnClose, true); - contextMenu->setPreferredPos(position); - - contextMenu->addAction(LOC_MENU_CONTACT_INFO, this, SLOT(openContactInfo())); - contextMenu->addAction(LOC_COMMON_MENU_CALL, this, SLOT(call())); + contextMenu->setPreferredPos(position); //If contact doesn't exist in phonebook then add another menu item "Save to Contacts" int contactId = resolveContactId(mContactNumber); if (contactId < 0) { contextMenu->addAction(LOC_SAVETO_CONTACTS, this, SLOT(addToContacts())); } + else{ + contextMenu->addAction(LOC_MENU_CONTACT_INFO, this, SLOT(openContactInfo())); + } + contextMenu->addAction(LOC_COMMON_MENU_CALL, this, SLOT(call())); contextMenu->show(); - - mMenuShown = true; } } //--------------------------------------------------------------- -// MsgContactCardWidget::overrideFeedback -// @see header file +// MsgContactCardWidget::handleShortTap +// @see header //--------------------------------------------------------------- -/*HbFeedback::InstantEffect MsgContactCardWidget::overrideFeedback(Hb::InstantInteraction interaction) const +void MsgContactCardWidget::handleShortTap(const QPointF &position) { - switch (interaction) { - case Hb::InstantPressed: - case Hb::InstantClicked: - return HbFeedback::Basic; - default: - return HbFeedback::None; + this->ungrabGesture(Qt::TapGesture); + + // Check if events need to be ignored/accepted + if (mIgnoreEvents) { + return; } -}*/ + + int contactId = resolveContactId(mContactNumber); + if(contactId > 0) + { + //resolved contact open contact card. + openContactInfo(); + } + else + { + //unresolved contact show longpress options menu. + handleLongTap(position); + } + + //fire timer to regrab gesture after some delay. + QTimer::singleShot(300,this,SLOT(regrabGesture())); +} //--------------------------------------------------------------- // MsgContactCardWidget::openContactInfo @@ -369,6 +385,9 @@ connect(request, SIGNAL(requestError(const QVariant&)), this, SLOT(handleError(const QVariant&))); + //disbale subscritption for the CV events + ConversationsEngine::instance()->disableRegisterationForCVEvents(); + request->setArguments(args); request->send(); delete request; @@ -382,11 +401,9 @@ int MsgContactCardWidget::resolveContactId(const QString& value) { QString displayLabel; - - return MsgContactHandler::resolveContactDisplayName( - value, - displayLabel, - 0); + + int count; + return MsgContactHandler::resolveContactDisplayName(value, displayLabel, count); } //--------------------------------------------------------------- @@ -396,7 +413,7 @@ void MsgContactCardWidget::call() { //Launch dialer service - QString serviceName("com.nokia.services.telephony"); + QString serviceName("com.nokia.symbian.ICallDial"); QString operation("dial(QString)"); XQServiceRequest* serviceRequest = new XQServiceRequest(serviceName, operation, false); @@ -416,6 +433,7 @@ //--------------------------------------------------------------- void MsgContactCardWidget::addToContacts() { + openContactInfo(); } //--------------------------------------------------------------- @@ -426,20 +444,26 @@ { Q_UNUSED(result) - QList matchingContacts = - MsgContactHandler::findContactList(mContactNumber); + QList matchingContacts = MsgContactHandler::findContactList(mContactNumber); if (!matchingContacts.isEmpty()) { setAddress(matchingContacts.at(0).displayLabel()); - - QList avatarDetails = - matchingContacts.at(0).details (); - + + QList avatarDetails = matchingContacts.at(0).details (); + if (!avatarDetails.isEmpty()) { - mThumbnailManager->getThumbnail( - avatarDetails.at(0).imageUrl().toString()); + mThumbnailManager->getThumbnail(avatarDetails.at(0).imageUrl().toString()); } - } + } + + // Get the new conversation id. + qint64 convId = ConversationsEngine::instance()->getConversationIdFromAddress( + mContactNumber); + emit conversationIdChanged(convId); + + ConversationsEngine::instance( + )->emitOpenConversationViewIdUpdate(convId); + } //--------------------------------------------------------------- @@ -449,7 +473,14 @@ void MsgContactCardWidget::handleError(int errorCode, const QString& errorMessage) { Q_UNUSED(errorMessage) - Q_UNUSED(errorCode) + Q_UNUSED(errorCode) + + //unblock the cv events in case of contacts save error + ConversationsEngine::instance( + )->emitOpenConversationViewIdUpdate( + ConversationsEngine::instance( + )->getCurrentConversationId( + )); } //--------------------------------------------------------------- @@ -482,17 +513,22 @@ setAvatar(HbIcon(DEFAULT_AVATAR_ICON)); } } + //--------------------------------------------------------------- -// MsgContactCardWidget::connectSignals +// MsgContactCardWidget::ignoreSignals // @see header //--------------------------------------------------------------- -void MsgContactCardWidget::connectSignals(bool yes) +void MsgContactCardWidget::ignoreSignals(bool yes) { - if (yes) { - connect(this, SIGNAL(clicked()), this, SLOT(openContactInfo())); - } - else { - disconnect(this, SIGNAL(clicked()), this, SLOT(openContactInfo())); - } + mIgnoreEvents = yes; +} + +//--------------------------------------------------------------- +// MsgContactCardWidget::regrabGesture +// @see header file +//--------------------------------------------------------------- +void MsgContactCardWidget::regrabGesture() +{ + this->grabGesture(Qt::TapGesture); } // EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp --- a/messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -42,6 +42,9 @@ QTM_USE_NAMESPACE +const int INVALID_MSGID = -1; +const int INVALID_CONVID = -1; + // LOCALIZATION #define LOC_SAVED_TO_DRAFTS hbTrId("txt_messaging_dpopinfo_saved_to_drafts") @@ -50,12 +53,10 @@ // Constructor //--------------------------------------------------------------- MsgConversationBaseView::MsgConversationBaseView(QGraphicsItem* parent) : -MsgBaseView(parent), -mConversationId(-1), -mCVIdkey(XQSettingsKey::TargetPublishAndSubscribe,KMsgCVIdProperty, - KMsgCVIdKey) -{ - connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction())); + MsgBaseView(parent), mConversationId(-1), mCVIdkey(XQSettingsKey::TargetPublishAndSubscribe, + KMsgCVIdProperty, KMsgCVIdKey) +{ + connect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(doDelayedConstruction())); initView(); } @@ -64,7 +65,7 @@ // Destructor //--------------------------------------------------------------- MsgConversationBaseView::~MsgConversationBaseView() -{ +{ } //--------------------------------------------------------------- @@ -75,15 +76,14 @@ { ConversationsEngine::instance()->getConversations(convId); mConversationId = convId; - connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction())); - - // publsih conversation id - mSettingsManager->writeItemValue(mCVIdkey,(int)mConversationId); - - if(mConversationView) - { + connect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(doDelayedConstruction())); + + // publsih conversation id + mSettingsManager->writeItemValue(mCVIdkey, (int) mConversationId); + + if (mConversationView) { mConversationView->refreshView(); - } + } } //--------------------------------------------------------------- @@ -91,8 +91,8 @@ // create and initialise the conversationview //--------------------------------------------------------------- void MsgConversationBaseView::initView() - { - +{ + // Create header widget mContactCard = new MsgContactCardWidget(this); @@ -100,10 +100,11 @@ qreal spacing = HbDeviceProfile::profile(this).unitValue(); mMainLayout->setSpacing(spacing); - mMainLayout->setContentsMargins(CONTENT_MARGIN, CONTENT_MARGIN, - CONTENT_MARGIN, CONTENT_MARGIN); + mMainLayout->setContentsMargins(CONTENT_MARGIN, CONTENT_MARGIN, CONTENT_MARGIN, CONTENT_MARGIN); mMainLayout->addItem(mContactCard); + connect(mContactCard, SIGNAL(conversationIdChanged(qint64)), this, + SLOT(handleConversationIdChange(qint64))); /** * Create conversation view and connect to proper signals. @@ -114,25 +115,24 @@ mConversationView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - connect(mConversationView, SIGNAL(closeConversationView()), - this, SLOT(closeConversationView())); + connect(mConversationView, SIGNAL(closeConversationView()), this, SLOT(closeConversationView())); + + connect(mConversationView, SIGNAL(replyStarted()), this, SLOT(markMessagesAsRead())); - connect(mConversationView,SIGNAL(replyStarted()), - this,SLOT(markMessagesAsRead())); + connect(mConversationView, SIGNAL(switchView(const QVariantList&)), this, + SIGNAL(switchView(const QVariantList&))); - connect(mConversationView, SIGNAL(switchView(const QVariantList&)), - this, SIGNAL(switchView(const QVariantList&))); - - connect(mConversationView,SIGNAL(hideChrome(bool)),this,SLOT(hideChrome(bool))); + connect(mConversationView, SIGNAL(vkbOpened(bool)), this, SLOT(hideChrome(bool))); + connect(mConversationView, SIGNAL(vkbOpened(bool)), mContactCard, SLOT(ignoreSignals(bool))); this->setMenu(mConversationView->menu()); mMainLayout->addItem(mConversationView); this->setLayout(mMainLayout); - + mSettingsManager = new XQSettingsManager(this); - + } //--------------------------------------------------------------- @@ -141,7 +141,7 @@ //--------------------------------------------------------------- void MsgConversationBaseView::closeConversationView() { - markMessagesAsRead(); + markMessagesAsRead(); } //--------------------------------------------------------------- @@ -149,39 +149,38 @@ // Mark unread msgs in cv as read //--------------------------------------------------------------- void MsgConversationBaseView::markMessagesAsRead() - { - if( mConversationId >= 0) - { +{ + if (mConversationId >= 0) { ConversationsEngine::instance()->markConversationRead(mConversationId); - } } +} //--------------------------------------------------------------- // MsgConversationBaseView::saveContentToDrafts // saves the editors content to drafts //--------------------------------------------------------------- -void MsgConversationBaseView::saveContentToDrafts() - { +int MsgConversationBaseView::saveContentToDrafts() +{ + int msgId = INVALID_MSGID; bool result = false; - if( mConversationId >= 0) - { - result = mConversationView->saveContentToDrafts(); - } - - if(result) - { + if (mConversationId >= 0) { + msgId = mConversationView->saveContentToDrafts(); + } + + if (msgId != INVALID_MSGID) { HbNotificationDialog::launchDialog(LOC_SAVED_TO_DRAFTS); - } } + return msgId; +} //--------------------------------------------------------------- // MsgConversationBaseView::conversationId // get the conversation ID //--------------------------------------------------------------- -qint64 MsgConversationBaseView::conversationId() - { - return mConversationId; - } +qint64 MsgConversationBaseView::conversationId() +{ + return mConversationId; +} //--------------------------------------------------------------- // MsgConversationBaseView::clearContent @@ -198,19 +197,19 @@ // //--------------------------------------------------------------- void MsgConversationBaseView::handleOk(const QVariant& result) - { +{ Q_UNUSED(result) - } +} //--------------------------------------------------------------- // MsgConversationBaseView::handleError // //--------------------------------------------------------------- void MsgConversationBaseView::handleError(int errorCode, const QString& errorMessage) - { +{ Q_UNUSED(errorMessage) Q_UNUSED(errorCode) - } +} //--------------------------------------------------------------- // MsgConversationBaseView::doDelayedConstruction @@ -218,49 +217,58 @@ //--------------------------------------------------------------- void MsgConversationBaseView::doDelayedConstruction() { - disconnect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction())); - QTimer::singleShot(50,this,SLOT(handleViewReady())); + disconnect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(doDelayedConstruction())); + QTimer::singleShot(50, this, SLOT(handleViewReady())); } - //--------------------------------------------------------------- // MsgConversationBaseView::handleViewReady // //--------------------------------------------------------------- void MsgConversationBaseView::handleViewReady() - { - ConversationsEngine::instance()->fetchMoreConversations(); +{ + mConversationView->onViewReady(); +} + +//--------------------------------------------------------------- +// MsgConversationBaseView::handleConversationIdChange +// +//--------------------------------------------------------------- +void MsgConversationBaseView::handleConversationIdChange(qint64 convId) +{ + if (INVALID_CONVID != convId && mConversationId != convId) { + + mConversationId = convId; + // publsih conversation id + mSettingsManager->writeItemValue(mCVIdkey, (int) mConversationId); } +} //--------------------------------------------------------------- // MsgConversationBaseView::hideChrome // //--------------------------------------------------------------- void MsgConversationBaseView::hideChrome(bool hide) - { - if(hide) - { +{ + if (hide) { this->hideItems(Hb::StatusBarItem | Hb::TitleBarItem); this->setContentFullScreen(true); - - if(this->mainWindow()->orientation() == Qt::Horizontal) - { + + if (this->mainWindow()->orientation() == Qt::Horizontal) { mMainLayout->removeItem(mContactCard); mContactCard->hide(); - } } - else - { + } + else { this->showItems(Hb::StatusBarItem | Hb::TitleBarItem); this->setContentFullScreen(false); - - if(!mContactCard->isVisible()) - { - mMainLayout->insertItem(0,mContactCard); + + if (!mContactCard->isVisible()) { + mMainLayout->insertItem(0, mContactCard); mContactCard->show(); - } } } +} //--------------------------------------------------------------- // MsgConversationBaseView::setPSCVId @@ -268,11 +276,11 @@ //--------------------------------------------------------------- void MsgConversationBaseView::setPSCVId(bool setId) { - if(setId){ - mSettingsManager->writeItemValue(mCVIdkey,(int)mConversationId); + if (setId) { + mSettingsManager->writeItemValue(mCVIdkey, (int) mConversationId); } else { - mSettingsManager->writeItemValue(mCVIdkey,-1); + mSettingsManager->writeItemValue(mCVIdkey, -1); } } // EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/src/msgconversationview.cpp --- a/messagingapp/msgui/conversationview/src/msgconversationview.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/src/msgconversationview.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -24,11 +24,12 @@ #include #include #include -#include +#include #include #include #include #include +#include #include #include @@ -41,6 +42,7 @@ #include // USER INCLUDES +#include "msgcontactsutil.h" #include "msgsendutil.h" #include "msgconversationviewitem.h" #include "conversationsengine.h" @@ -55,6 +57,7 @@ #include "ringbc.h" #include "mmsconformancecheck.h" #include "msgsettingsview.h" +#include "msgaudiofetcherview.h" //Item specific menu. @@ -62,13 +65,11 @@ #define LOC_COMMON_DELETE hbTrId("txt_common_menu_delete") #define LOC_COMMON_FORWARD hbTrId("txt_common_menu_forward") #define LOC_COMMON_DOWNLOAD hbTrId("txt_messaging_menu_download") -#define LOC_COMMON_SEND hbTrId("txt_common_menu_send") +#define LOC_COMMON_SEND hbTrId("txt_common_button_send") #define LOC_COMMON_SAVE hbTrId("txt_common_menu_save") -#define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete") -#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") -#define LOC_BUTTON_OK hbTrId("txt_common_button_ok") #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") +#define LOC_SAVE_TO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts") //main menu #define LOC_ATTACH hbTrId("txt_messaging_opt_attach") @@ -78,13 +79,11 @@ #define LOC_ADD_RECIPIENTS hbTrId("txt_messaging_opt_add_recipients") #define LOC_ADD_SUBJECT hbTrId("txt_messaging_opt_add_subject") -#define LOC_MSG_SEND_FAILED hbTrId("txt_messaging_dpopinfo_sending_failed") - +#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_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone") - const int INVALID_MSGID = -1; const int INVALID_CONVID = -1; const int CONTACT_INSERTION_MODE = 1; @@ -102,15 +101,27 @@ mEditorWidget(NULL), mContactCardWidget(contactCardWidget), mSendUtil(NULL), - mItemLongPressed(false), mVkbHost(NULL), - mVkbopened(false) + mVisibleIndex(), + mVkbopened(false), + mModelPopulated(false), + mViewReady(false) { //create send utils mSendUtil = new MsgSendUtil(this); //initialize view setupView(); setupMenu(); + + connect(ConversationsEngine::instance(), + SIGNAL(conversationModelUpdated()), + this, + SLOT(scrollToBottom())); + + connect(ConversationsEngine::instance(), + SIGNAL(conversationViewEmpty()), + this, + SLOT(onConversationViewEmpty())); } //--------------------------------------------------------------- @@ -152,6 +163,11 @@ connect(mConversationList, SIGNAL(activated(QModelIndex)), this, SLOT(openItem(QModelIndex))); + connect(this->mainWindow(), SIGNAL(aboutToChangeOrientation()), + this, SLOT(onOrientationAboutToBeChanged())); + + connect(this->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), + this, SLOT(onOrientationChanged(Qt::Orientation))); // Long tap list item connect(mConversationList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF)), @@ -201,6 +217,18 @@ } //--------------------------------------------------------------- +// MsgConversationView::fetchMoreConversations +// @see header file +//--------------------------------------------------------------- +void MsgConversationView::fetchMoreConversations() +{ + if (mViewReady && mModelPopulated) { + ConversationsEngine::instance()->fetchMoreConversations(); + mViewReady = mModelPopulated = false; + } +} + +//--------------------------------------------------------------- // MsgConversationView::refreshView() // @see header file //--------------------------------------------------------------- @@ -234,6 +262,14 @@ mMessageModel->index(rowCnt - 1, 0)); } +void MsgConversationView::onConversationViewEmpty() +{ + QVariantList param; + param << MsgBaseView::CLV; // target view + param << MsgBaseView::CV; // source view + emit switchView(param); +} + //--------------------------------------------------------------- // MsgConversationView::longPressed // @see header file @@ -241,8 +277,6 @@ void MsgConversationView::longPressed(HbAbstractViewItem* viewItem, const QPointF& point) { - mItemLongPressed = true; - MsgConversationViewItem* item = qgraphicsitem_cast< MsgConversationViewItem *> (viewItem); @@ -266,11 +300,7 @@ contextMenu->show(); } - else - { - // For cases where the long tap check failed - mItemLongPressed = false; - } + } //--------------------------------------------------------------- @@ -296,6 +326,8 @@ void MsgConversationView::addSaveItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState) { + Q_UNUSED(sendingState) + int messageSubType = item->modelIndex().data(MessageSubType).toInt(); int direction = item->modelIndex().data(Direction).toInt(); if ((messageSubType == ConvergedMessage::RingingTone) && @@ -322,10 +354,14 @@ { return; } - + if ((messageSubType == ConvergedMessage::VCard) && + (direction == ConvergedMessage::Incoming)) + { + HbAction *contextItem = contextMenu->addAction(LOC_SAVE_TO_CONTACTS); + connect(contextItem, SIGNAL(triggered()),this, SLOT(openItem())); + return; + } if( (sendingState == ConvergedMessage::SentState ) || - (sendingState == ConvergedMessage::Resend ) || - (sendingState == ConvergedMessage::Failed ) || (direction == ConvergedMessage::Incoming)) { HbAction *contextItem = contextMenu->addAction(LOC_COMMON_OPEN); @@ -374,12 +410,18 @@ } qint32 messageId = item->modelIndex().data(ConvergedMsgId).toInt(); + qint32 messageProperty = item->modelIndex().data(MessageProperty).toInt(); + + bool canForwardMessage = true; + if (messageType == ConvergedMessage::Mms){ + canForwardMessage = (messageProperty & EPreviewForward)? true:false; + } if( ((sendingState == ConvergedMessage::SentState) || (sendingState == ConvergedMessage::Resend) || (sendingState == ConvergedMessage::Failed) || (direction == ConvergedMessage::Incoming) ) && - (validateMsgForForward(messageType,messageId)) ) + canForwardMessage) { HbAction *contextItem = contextMenu->addAction(LOC_COMMON_FORWARD); connect(contextItem, SIGNAL(triggered()),this, SLOT(forwardMessage())); @@ -462,7 +504,9 @@ deactivateInputBlocker(); if( sendResult == KErrNotFound) { - HbMessageBox::question(LOC_DIALOG_SMS_SETTINGS_INCOMPLETE, this, SLOT(onDialogSettingsLaunch(HbAction*)), LOC_BUTTON_OK, LOC_BUTTON_CANCEL); + HbMessageBox::question(LOC_DIALOG_SMS_SETTINGS_INCOMPLETE, this, + SLOT(onDialogSettingsLaunch(HbAction*)), + HbMessageBox::Ok | HbMessageBox::Cancel); } } @@ -536,11 +580,12 @@ //--------------------------------------------------------------- void MsgConversationView::fetchImages() { - QString interface("Image"); - QString operation("fetch(QVariantMap,QVariant)"); + QString service("photos"); + QString interface("com.nokia.symbian.IImageFetch"); + QString operation("fetch()"); XQAiwRequest* request = NULL; XQApplicationManager appManager; - request = appManager.create(interface, operation, true); // embedded + request = appManager.create(service,interface, operation, true); // embedded request->setSynchronous(true); // synchronous if(!request) { @@ -553,11 +598,6 @@ connect(request, SIGNAL(requestError(int,const QString&)), this, SLOT(serviceRequestError(int,const QString&))); - // Set arguments for request - QList args; - args << QVariantMap(); - args << QVariant(); - request->setArguments(args); // Make the request if (!request->send()) { @@ -572,30 +612,25 @@ //--------------------------------------------------------------- void MsgConversationView::fetchAudio() { - QString service("musicplayer"); - QString interface("com.nokia.symbian.IMusicFetch"); - QString operation("fetch()"); - XQAiwRequest* request = NULL; - XQApplicationManager appManager; - request = appManager.create(service, interface, operation, true); //embedded - request->setSynchronous(true); // synchronous - if(!request) - { - QDEBUG_WRITE("AIW-ERROR: NULL request"); - return; - } + // Launch Audio fetcher view + QVariantList params; + QByteArray dataArray; + QDataStream messageStream + (&dataArray, QIODevice::WriteOnly | QIODevice::Append); - connect(request, SIGNAL(requestOk(const QVariant&)), - this, SLOT(audiosFetched(const QVariant&))); - connect(request, SIGNAL(requestError(int,const QString&)), - this, SLOT(serviceRequestError(int,const QString&))); + ConvergedMessage message; + message.setBodyText(mEditorWidget->content()); + // add address from contact-card to to-field + ConvergedMessageAddress address; + address.setAlias(mContactCardWidget->address().at(0)->alias()); + address.setAddress(mContactCardWidget->address().at(0)->address()); + message.addToRecipient(address); + message.serialize(messageStream); - // Make the request - if (!request->send()) - { - QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed ",request->lastError()); - } - delete request; + params << MsgBaseView::AUDIOFETCHER; // target view + params << MsgBaseView::CV; // source view + params << dataArray; + emit switchView(params); } //--------------------------------------------------------------- @@ -637,26 +672,6 @@ } //--------------------------------------------------------------- -// MsgConversationView::audiosFetched() -// @see header file -//--------------------------------------------------------------- -void MsgConversationView::audiosFetched(const QVariant& result ) -{ - if(result.canConvert()) - { - QStringList fileList = result.value(); - if ( fileList.size()>0 && !fileList.at(0).isEmpty()) - { - QString filepath(QDir::toNativeSeparators(fileList.at(0))); - QVariantList params; - params << MsgBaseView::ADD_AUDIO; - params << filepath; - launchUniEditor(params); - } - } -} - -//--------------------------------------------------------------- // MsgConversationView::addSubject() // @see header file //--------------------------------------------------------------- @@ -738,8 +753,7 @@ void MsgConversationView::deleteItem() { HbMessageBox::question(LOC_DELETE_MESSAGE,this,SLOT(onDialogdeleteMsg(HbAction*)), - LOC_BUTTON_DELETE, - LOC_BUTTON_CANCEL); + HbMessageBox::Delete | HbMessageBox::Cancel); } //--------------------------------------------------------------- @@ -767,7 +781,7 @@ // MsgConversationView::saveContentToDrafts() // @See header //--------------------------------------------------------------- -bool MsgConversationView::saveContentToDrafts() +int MsgConversationView::saveContentToDrafts() { int msgId = INVALID_MSGID; if(!mEditorWidget->content().isEmpty()) @@ -790,7 +804,7 @@ } deactivateInputBlocker(); } - return ((msgId > INVALID_MSGID)? true : false); + return msgId; } //--------------------------------------------------------------- @@ -814,14 +828,24 @@ { qint32 messageId = index.data(ConvergedMsgId).toLongLong(); - QString interface("com.nokia.services.btmsgdispservices.displaymsg"); + QList args; + QString serviceName("com.nokia.services.btmsgdispservices"); QString operation("displaymsg(int)"); + XQAiwRequest* request; + XQApplicationManager appManager; + request = appManager.create(serviceName, "displaymsg", operation, false); // embedded + + if ( request == NULL ) + { + return; + } - XQServiceRequest request(interface, operation, false); - - request << messageId; - - bool result = request.send(); + args << QVariant(messageId); + request->setSynchronous(true); + + request->setArguments(args); + request->send(); + delete request; } //--------------------------------------------------------------- @@ -861,50 +885,72 @@ //@see header //--------------------------------------------------------------- void MsgConversationView::openItem(const QModelIndex & index) - { +{ // Return if invalid index. if (!index.isValid() || mVkbopened) - { + { return; - } - - if(mItemLongPressed) - { - //reset the flag - mItemLongPressed = false; - return; - } + } int messageType = index.data(MessageType).toInt(); int messageSubType = index.data(MessageSubType).toInt(); + int messageId = index.data(ConvergedMsgId).toInt(); - if (ConvergedMessage::BioMsg == messageType) { - if (ConvergedMessage::RingingTone == messageSubType) { + if (ConvergedMessage::BioMsg == messageType) + { + if (ConvergedMessage::RingingTone == messageSubType) + { HbMessageBox::question(LOC_DIALOG_SAVE_RINGTONE, this, - SLOT(onDialogSaveTone(HbAction*)), LOC_COMMON_SAVE, LOC_BUTTON_CANCEL); + SLOT(onDialogSaveTone(HbAction*)), + HbMessageBox::Save | HbMessageBox::Cancel); return; } else if(ConvergedMessage::Provisioning == messageSubType) - { + { int messageId = index.data(ConvergedMsgId).toInt(); handleProvisoningMsg(messageId); QList msgIdList; if(index.data(UnReadStatus).toInt()) - { + { msgIdList.clear(); msgIdList << messageId; ConversationsEngine::instance()->markMessagesRead(msgIdList); - } - return; } - // Unsupported messages - else if (ConvergedMessage::VCard == messageSubType - || ConvergedMessage::VCal == messageSubType) { + return; + } + 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 msgIdList; + if(index.data(UnReadStatus).toInt()) + { + msgIdList.clear(); + msgIdList << messageId; + ConversationsEngine::instance()->markMessagesRead(msgIdList); + } + } + return; + } + else if(ConvergedMessage::VCal == messageSubType) + { return; } } - else if (ConvergedMessage::BT == messageType) { + else if (ConvergedMessage::BT == messageType) + { launchBtDisplayService(index); + QList msgIdList; + if(index.data(UnReadStatus).toInt()) + { + msgIdList.clear(); + msgIdList << messageId; + ConversationsEngine::instance()->markMessagesRead(msgIdList); + } return; } else if(ConvergedMessage::MmsNotification == messageType) @@ -922,107 +968,72 @@ else { //TODO: use logical str name - HbMessageBox::question("Download Message?",this,SLOT(onDialogDownLoadMsg(HbAction*)), - LOC_COMMON_DOWNLOAD, - LOC_BUTTON_CANCEL); + HbMessageBox::question("Download Message?",this, + SLOT(onDialogDownLoadMsg(HbAction*)), + HbMessageBox::Yes | HbMessageBox::Cancel); return; } } - ConvergedMessage message; + int direction = index.data(Direction).toInt(); + + if (direction == ConvergedMessage::Outgoing && ConvergedMessage::Sms == messageType + && ConversationsEngine::instance()->getMsgSubType(messageId)== ConvergedMessage::NokiaService) + { + return; + } + // check whether message is in sending progress, then donot launch viewer. int location = index.data(MessageLocation).toInt(); int sendingState = index.data(SendingState).toInt(); - //If message is in Sending state or is Scheduled to be sent later, + //If message is in any other state other than 'Sent' //do not open the message - if(sendingState == ConvergedMessage::Suspended || - sendingState == ConvergedMessage::Scheduled || - sendingState == ConvergedMessage::Sending || - sendingState == ConvergedMessage::Waiting) + if(direction == ConvergedMessage::Outgoing + && sendingState != ConvergedMessage::SentState ) + { return; } - //TODO: sendingState check should be removed once msg - // movement lock issue is resolved from mw - if( !((location == ConvergedMessage::Inbox) || - (location == ConvergedMessage::Sent) || - (sendingState == ConvergedMessage::SentState)|| - (sendingState == ConvergedMessage::Failed) || - (sendingState == ConvergedMessage::Resend))) - {// do not launch viewer, show a note - HbNotificationDialog* dlg = new HbNotificationDialog(); - dlg->setFocusPolicy(Qt::NoFocus); - QString text(tr("Message Locked")); - dlg->setText(text); - dlg->setDismissPolicy(HbPopup::TapAnywhere); - dlg->setAttribute(Qt::WA_DeleteOnClose, true); - dlg->show(); - return; - } - - // message id - qint32 messageId = index.data(ConvergedMsgId).toLongLong(); - ConvergedMessageId msgId(messageId); - message.setMessageId(msgId); - - // contact Id - qint32 contactId = index.data(ContactId).toLongLong(); - - // message type - - message.setMessageType((ConvergedMessage::MessageType) messageType); - message.setMessageSubType((ConvergedMessage::MessageSubType) messageSubType); - - if (messageType == ConvergedMessage::Mms) - { - message.setSubject(index.data(Subject).toString()); - message.setPriority((ConvergedMessage::Priority) index.data( - MessagePriority).toInt()); - } - else if (messageType == ConvergedMessage::IM) - { - // add body text and send to the message for IM case - message.setBodyText(index.data(BodyText).toString()); - } - - // time stamp - message.setTimeStamp(index.data(TimeStamp).toLongLong()); - - //Message direction - message.setDirection((ConvergedMessage::Direction)index.data(Direction).toInt()); - - // conatct name as address - ConvergedMessageAddress address; - address.setAlias(mContactCardWidget->address().at(0)->alias()); - address.setAddress(mContactCardWidget->address().at(0)->address()); - message.addToRecipient(address); - - // Mark this message as read if its unread - QByteArray dataArray; - QDataStream messageStream - (&dataArray, QIODevice::WriteOnly | QIODevice::Append); - message.serialize(messageStream); - //if message unread, mark as read before opening view - QList msgIdList; - if(index.data(UnReadStatus).toInt()) - { + + + // contact Id + qint32 contactId = index.data(ContactId).toLongLong(); + + //if message unread, mark as read before opening view + QList msgIdList; + if(index.data(UnReadStatus).toInt()) + { msgIdList.clear(); msgIdList << messageId; ConversationsEngine::instance()->markMessagesRead(msgIdList); - } + } + + qint32 messageProperty = index.data(MessageProperty).toInt(); - //switch view - QVariantList param; - param << MsgBaseView::UNIVIEWER; // target view - param << MsgBaseView::CV; // source view + bool canForwardMessage = true; + if (messageType == ConvergedMessage::Mms){ + canForwardMessage = (messageProperty & EPreviewForward)? true:false; + } + + //switch view + QVariantList param; + param << MsgBaseView::UNIVIEWER; // target view + param << MsgBaseView::CV; // source view - param << contactId; - param << dataArray; - param << mMessageModel->rowCount(); - - emit switchView(param); + param << contactId; + param << messageId; + param << mMessageModel->rowCount(); + if (canForwardMessage == true) + { + param << 1; + } + else + { + param << 0; + } + emit switchView(param); } //--------------------------------------------------------------- @@ -1084,7 +1095,14 @@ { ConvergedMessageAddress* address = new ConvergedMessageAddress; address->setAlias(contactList[i].mDisplayName); - address->setAddress(contactList[i].mPhoneNumber); + if(!contactList[i].mPhoneNumber.isEmpty()) + { + address->setAddress(contactList[i].mPhoneNumber); + } + else + { + address->setAddress(contactList[i].mEmailAddress); + } addresses.append(address); } message.addToRecipients(addresses); @@ -1116,16 +1134,13 @@ // @see header file //--------------------------------------------------------------- void MsgConversationView::populateConversationsView() -{ - bool b = connect(ConversationsEngine::instance(), - SIGNAL(conversationModelUpdated()), - this, - SLOT(scrollToBottom())); - +{ + mModelPopulated = true; mConversationList->setModel(mMessageModel); refreshView(); scrollToBottom(); + fetchMoreConversations(); } //--------------------------------------------------------------- @@ -1174,26 +1189,6 @@ } //--------------------------------------------------------------- -// MsgConversationView::validateMsgForForward -// @see header file -//--------------------------------------------------------------- -bool MsgConversationView::validateMsgForForward(int &messageType, - qint32 &messageId) -{ - bool retValue = true; - if (messageType == ConvergedMessage::Mms) - { - //Validate if the mms msg can be forwarded or not - MmsConformanceCheck* mmsConformanceCheck = new MmsConformanceCheck; - retValue = mmsConformanceCheck->validateMsgForForward(messageId); - - delete mmsConformanceCheck; - } - - return retValue; -} - -//--------------------------------------------------------------- // MsgConversationView::vkbOpened // @see header file //--------------------------------------------------------------- @@ -1201,9 +1196,7 @@ { mVkbopened = true; - mContactCardWidget->connectSignals(false); - - emit hideChrome(true); + emit vkbOpened(true); QRectF appRect = mVkbHost->applicationArea(); qreal spacing = 0.0; @@ -1229,9 +1222,7 @@ { mVkbopened = false; - mContactCardWidget->connectSignals(true); - - emit hideChrome(false); + emit vkbOpened(false); this->setMaximumHeight(-1); connect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened())); @@ -1251,27 +1242,25 @@ //--------------------------------------------------------------- // MsgConversationView::activateInputBlocker // @see header file -//-------------------------------------------------------------- +//--------------------------------------------------------------- void MsgConversationView::activateInputBlocker() - { - this->grabMouse(); - this->grabKeyboard(); - } +{ + mainWindow()->setInteractive(false); +} //--------------------------------------------------------------- // MsgConversationView::deactivateInputBlocker // @see header file -//-------------------------------------------------------------- +//--------------------------------------------------------------- void MsgConversationView::deactivateInputBlocker() - { - this->ungrabKeyboard(); - this->ungrabMouse(); - } +{ + mainWindow()->setInteractive(true); +} //--------------------------------------------------------------- // MsgConversationView::handleProvisoningMsg // @see header file -//-------------------------------------------------------------- +//--------------------------------------------------------------- void MsgConversationView::handleProvisoningMsg(int msgId) { QString messageId; @@ -1301,7 +1290,7 @@ //--------------------------------------------------------------- // MsgConversationView::onDialogSettingsLaunch // @see header file -//-------------------------------------------------------------- +//--------------------------------------------------------------- void MsgConversationView::onDialogSettingsLaunch(HbAction* action) { HbMessageBox *dlg = qobject_cast (sender()); @@ -1319,7 +1308,7 @@ //--------------------------------------------------------------- // MsgConversationView::onDialogdeleteMsg // @see header file -//-------------------------------------------------------------- +//--------------------------------------------------------------- void MsgConversationView::onDialogdeleteMsg(HbAction* action) { HbMessageBox *dlg = qobject_cast (sender()); @@ -1371,4 +1360,46 @@ } } +//--------------------------------------------------------------- +// MsgConversationView::onOrientationChanged +// @see header file +//--------------------------------------------------------------- +void MsgConversationView::onOrientationChanged(Qt::Orientation newOrientation) +{ + Q_UNUSED(newOrientation) + + // On orientation change always make the preserved index(last visible item) to be visible + if(mVisibleIndex.isValid()) + { + mConversationList->scrollTo(mVisibleIndex, HbAbstractItemView::PositionAtBottom); + mVisibleIndex = QModelIndex(); + } +} + +//--------------------------------------------------------------- +// MsgConversationView::onOrientationAboutToBeChanged +// @see header file +//--------------------------------------------------------------- +void MsgConversationView::onOrientationAboutToBeChanged() +{ + // Preserve the model index of the last visible item to be scrolled on orientation change + QListitems = mConversationList->visibleItems(); + if (items.count() > 0) { + mVisibleIndex = items.last()->modelIndex(); + } +} + +//--------------------------------------------------------------- +// MsgConversationView::onViewReady +// @see header file +//--------------------------------------------------------------- +void MsgConversationView::onViewReady() +{ + mViewReady = true; + //Disconnect list View's signals, for avoiding execution of the default implementaion + disconnect(mainWindow(), SIGNAL(aboutToChangeOrientation()), mConversationList, 0); + disconnect(mainWindow(), SIGNAL(orientationChanged(Qt: rientation)), mConversationList, 0); + + fetchMoreConversations(); +} // EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp --- a/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -27,6 +27,7 @@ #include #include #include +#include // USER INCLUDES #include "msgconversationwidget.h" @@ -41,6 +42,9 @@ 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"); // LOCALIZATION #define LOC_RINGING_TONE hbTrId("txt_messaging_dpopinfo_ringing_tone") @@ -55,7 +59,7 @@ //--------------------------------------------------------------- MsgConversationViewItem::MsgConversationViewItem(QGraphicsItem* parent) : HbListViewItem(parent), mIncoming(false), mConversation(0), - mMessageStateIconItem(0) + mIncomingMsgStateIconItem(0), mOutgoingMsgStateIconItem(0) { } @@ -72,23 +76,18 @@ // Create a new decorator item. //--------------------------------------------------------------- MsgConversationViewItem* MsgConversationViewItem::createItem() - { - return new MsgConversationViewItem(*this); - } +{ + MsgConversationViewItem *item = new MsgConversationViewItem(*this); + item->init(); + return item; +} //--------------------------------------------------------------- // MsgConversationViewItem::updateChildItems // //--------------------------------------------------------------- void MsgConversationViewItem::updateChildItems() - { - - if (!mMessageStateIconItem) - { - mMessageStateIconItem = new HbIconItem(this); - HbStyle::setItemName(mMessageStateIconItem, "msgStateIcon"); - } - +{ QModelIndex index = modelIndex(); #ifdef _DEBUG_TRACES_ @@ -136,14 +135,10 @@ // MsgConversationViewItem::updateSmsTypeItem // @see header file //--------------------------------------------------------------- -void MsgConversationViewItem::updateSmsTypeItem(const QModelIndex& index, int messageSubType) - { - - if (!mConversation) - { - mConversation = new MsgConversationWidget(this); - HbStyle::setItemName(mConversation, "msgconvwidget"); - } +void MsgConversationViewItem::updateSmsTypeItem(const QModelIndex& index, + int messageSubType) +{ + mIncoming = false; mConversation->resetProperties(); @@ -154,8 +149,8 @@ setIncoming(true); mConversation->setIncoming(true); - mMessageStateIconItem->setVisible(false); - } + mIncomingMsgStateIconItem->setVisible(false); + } else if (direction == ConvergedMessage::Outgoing) { setIncoming(false); @@ -238,7 +233,7 @@ } else { - mMessageStateIconItem->setVisible(false); + mIncomingMsgStateIconItem->setVisible(false); } } else if (direction == ConvergedMessage::Outgoing) @@ -295,28 +290,63 @@ //preview image bool hasImage = (msgProperty & EPreviewImage) ? true : false; - if (hasImage) - { - int msgId = index.data(ConvergedMsgId).toInt(); - mConversation->setPreviewIconPath(previewPath, msgId); + { mConversation->setImage(true); - } + HbIcon previewIcon; + if (msgProperty & EPreviewProtectedImage) + { + previewIcon = HbIcon(IMAGE_ICON); + } + else if (msgProperty & EPreviewCorruptedImage) + { + // TODO: Change to official icon. + previewIcon = HbIcon(CORRUPTED_ICON); + } + else + { + QVariant previewData = index.data(PreviewIcon); + previewIcon = qvariant_cast (previewData); + } + mConversation->setPreviewIcon(previewIcon); + } bool hasVideo = (msgProperty & EPreviewVideo) ? true : false; - if (hasVideo) - { + { mConversation->setVideo(true); - } - + HbIcon videoPreviewIcon; + if (msgProperty & EPreviewProtectedVideo) + { + videoPreviewIcon = HbIcon(MSG_VIDEO_ICON); + } + else if (msgProperty & EPreviewCorruptedVideo) + { + videoPreviewIcon = HbIcon(CORRUPTED_ICON); + } + else + { + videoPreviewIcon = HbIcon(MSG_VIDEO_ICON); + } + mConversation->setPreviewIcon(videoPreviewIcon); + } bool hasAudio = (msgProperty & EPreviewAudio) ? true : false; if (hasAudio) - { + { mConversation->setAudio(true); - } - - mConversation->displayAudioIcon(); + if (msgProperty & EPreviewProtectedAudio) + { + mConversation->displayAudioIcon(); + } + else if (msgProperty & EPreviewCorruptedAudio) + { + mConversation->displayAudioIcon(CORRUPTED_ICON); + } + else + { + mConversation->displayAudioIcon(); + } + } int priority = index.data(MessagePriority).toInt(); mConversation->setPriority(priority); @@ -331,6 +361,7 @@ mConversation->setAudio(true); mConversation->displayAudioIcon(); mConversation->setSubject(LOC_RINGING_TONE); + mConversation->setBodyText(bodyText); } else if (messageSubType == ConvergedMessage::VCard) { @@ -380,8 +411,8 @@ //--------------------------------------------------------------- bool MsgConversationViewItem::containsPoint(const QPointF& point) { - return mConversation->boundingRect(). - contains(mConversation->mapFromScene(point)); + return mConversation->boundingRect(). contains(mConversation->mapFromScene( + point)); } //--------------------------------------------------------------- @@ -391,6 +422,23 @@ void MsgConversationViewItem::setIncoming(bool incoming) { mIncoming = incoming; + + if (mIncoming) + { + HbStyle::setItemName(mOutgoingMsgStateIconItem, ""); + mOutgoingMsgStateIconItem->setVisible(false); + HbStyle::setItemName(mIncomingMsgStateIconItem, "msgStateIconIncoming"); + mIncomingMsgStateIconItem->setIcon(HbIcon()); + mIncomingMsgStateIconItem->setVisible(false); + } + else + { + HbStyle::setItemName(mIncomingMsgStateIconItem, ""); + mIncomingMsgStateIconItem->setVisible(false); + HbStyle::setItemName(mOutgoingMsgStateIconItem, "msgStateIconOutgoing"); + mOutgoingMsgStateIconItem->setIcon(HbIcon()); + mOutgoingMsgStateIconItem->setVisible(false); + } } //--------------------------------------------------------------- @@ -408,51 +456,52 @@ //--------------------------------------------------------------- void MsgConversationViewItem::setMessageStateIcon(int messageState) { - HbIconAnimator& iconAnimator = mMessageStateIconItem->animator(); - HbIconAnimationManager* iconAnimationManager = HbIconAnimationManager::global(); + 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; + { + bool defined = iconAnimationManager->addDefinitionFile( + ANIMATION_FILE); + HbIcon animIcon; animIcon.setIconName(ANIMATION_ICON_NAME); - QSizeF size = mMessageStateIconItem->size(); - mMessageStateIconItem->setIcon(animIcon); - mMessageStateIconItem->setVisible(true); + QSizeF size = mOutgoingMsgStateIconItem->size(); + mOutgoingMsgStateIconItem->setIcon(animIcon); + mOutgoingMsgStateIconItem->setVisible(true); iconAnimator.startAnimation(); - repolish(); break; } case ConvergedMessage::Suspended: { - iconAnimator.stopAnimation(); - mMessageStateIconItem->setIcon(MSG_OUTBOX_ICON); - mMessageStateIconItem->setVisible(true); - break; - + iconAnimator.stopAnimation(); + mOutgoingMsgStateIconItem->setIcon(MSG_OUTBOX_ICON); + mOutgoingMsgStateIconItem->setVisible(true); + break; + } case ConvergedMessage::Resend: { iconAnimator.stopAnimation(); - mMessageStateIconItem->setIcon(MSG_OUTBOX_ICON); - mMessageStateIconItem->setVisible(true); + mOutgoingMsgStateIconItem->setIcon(MSG_OUTBOX_ICON); + mOutgoingMsgStateIconItem->setVisible(true); break; } case ConvergedMessage::Failed: { iconAnimator.stopAnimation(); - mMessageStateIconItem->setIcon(MSG_FAIL_ICON); - mMessageStateIconItem->setVisible(true); + mOutgoingMsgStateIconItem->setIcon(MSG_FAIL_ICON); + mOutgoingMsgStateIconItem->setVisible(true); break; } case ConvergedMessage::Unknown: default: { iconAnimator.stopAnimation(); - mMessageStateIconItem->setVisible(false); + mOutgoingMsgStateIconItem->setVisible(false); break; } } @@ -465,28 +514,29 @@ void MsgConversationViewItem::setNotificationStateIcon(int notificationState) { - HbIconAnimator& iconAnimator = mMessageStateIconItem->animator(); - HbIconAnimationManager* iconAnimationManager = HbIconAnimationManager::global(); + HbIconAnimator& iconAnimator = mIncomingMsgStateIconItem->animator(); + HbIconAnimationManager* iconAnimationManager = + HbIconAnimationManager::global(); switch (notificationState) { case ConvergedMessage::NotifRetrieving: case ConvergedMessage::NotifWaiting: { //TODO: Temp icon until official icons are received - bool defined = iconAnimationManager->addDefinitionFile(ANIMATION_FILE); + bool defined = iconAnimationManager->addDefinitionFile( + ANIMATION_FILE); HbIcon animIcon; animIcon.setIconName(ANIMATION_ICON_NAME); - QSizeF size = mMessageStateIconItem->size(); - mMessageStateIconItem->setIcon(animIcon); - mMessageStateIconItem->setVisible(true); + QSizeF size = mIncomingMsgStateIconItem->size(); + mIncomingMsgStateIconItem->setIcon(animIcon); + mIncomingMsgStateIconItem->setVisible(true); iconAnimator.startAnimation(); - repolish(); break; } default: { iconAnimator.stopAnimation(); - mMessageStateIconItem->setVisible(false); + mIncomingMsgStateIconItem->setVisible(false); break; } } @@ -501,4 +551,41 @@ mConversation->pressStateChanged(pressed, animate); } +//--------------------------------------------------------------- +// MsgConversationViewItem::init +// @see header file +//--------------------------------------------------------------- +void MsgConversationViewItem::init() +{ + mConversation = new MsgConversationWidget(this); + HbStyle::setItemName(mConversation, "msgconvwidget"); + + mIncomingMsgStateIconItem = new HbIconItem(this); + HbStyle::setItemName(mIncomingMsgStateIconItem, "msgStateIconIncoming"); + + mOutgoingMsgStateIconItem = new HbIconItem(this); + HbStyle::setItemName(mOutgoingMsgStateIconItem, "msgStateIconOutgoing"); + + HbMainWindow *mainWindow = hbInstance->allMainWindows()[0]; + + connect(mainWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, + SLOT(orientationchanged(Qt::Orientation)), Qt::UniqueConnection); + + // Force polish to get all the sub-item properties right. + polishEvent(); +} + +//--------------------------------------------------------------- +// MsgConversationViewItem::orientationchanged +// @see header file +//--------------------------------------------------------------- +void MsgConversationViewItem::orientationchanged(Qt::Orientation orientation) +{ + QDEBUG_WRITE("MsgConversationViewItem:orientationchanged start.") + + repolish(); + + QDEBUG_WRITE("MsgConversationViewItem:orientationchanged end.") +} + // EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/src/msgconversationwidget.cpp --- a/messagingapp/msgui/conversationview/src/msgconversationwidget.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/src/msgconversationwidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include "debugtraces.h" @@ -42,9 +44,7 @@ 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_ICON("qtg_large_music_player"); -const QString MSG_VIDEO_ICON("qtg_large_video_player"); -const QString MSG_AUDIO_PLAY_ICON("qtg_large_music_player"); +const QString MSG_AUDIO_PLAY_ICON("qtg_small_sound"); // Frames @@ -56,9 +56,6 @@ const QString CV_SENT_HIGHLIGHT_FR("qtg_fr_convlist_sent_highlight"); const QString NEW_ITEM_FRAME("qtg_fr_list_new_item"); -//selecet preview-icon query -_LIT(KSelectPreviewIconStmt,"SELECT message_id, preview_icon FROM conversation_messages WHERE message_id = :message_id "); - //--------------------------------------------------------------- // MsgConversationWidget::MsgConversationWidget // @see header file @@ -118,7 +115,27 @@ mNewFrameItem = new HbFrameItem(this); mNewFrameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); HbStyle::setItemName(mNewFrameItem, "newItemIcon"); + mSubjectTextItem = new HbTextItem(this); + mSubjectTextItem->setTextWrapping(Hb::TextWordWrap); + 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]; + connect(mainWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, + SLOT(orientationchanged(Qt::Orientation)),Qt::UniqueConnection); + polishEvent(); } //--------------------------------------------------------------- @@ -127,11 +144,6 @@ //--------------------------------------------------------------- void MsgConversationWidget::setSubject(const QString &subject) { - if (!mSubjectTextItem) - { - mSubjectTextItem = new HbTextItem(this); - mSubjectTextItem->setTextWrapping(Hb::TextWordWrap); - } HbStyle::setItemName(mSubjectTextItem, "subject"); mSubjectTextItem->setText(subject); mSubjectTextItem->show(); @@ -143,11 +155,6 @@ //--------------------------------------------------------------- void MsgConversationWidget::setBodyText(const QString &body) { - if (!mBodyTextItem) - { - mBodyTextItem = new HbTextItem(this); - mBodyTextItem->setTextWrapping(Hb::TextWordWrap); - } HbStyle::setItemName(mBodyTextItem, "bodyText"); mBodyTextItem->setText(body); @@ -155,107 +162,23 @@ } //--------------------------------------------------------------- -// MsgConversationWidget::setPreviewIconPath +// MsgConversationWidget::setPreviewIcon // @see header file //--------------------------------------------------------------- -void MsgConversationWidget::setPreviewIconPath(const QString &filePath,int msgId) +void MsgConversationWidget::setPreviewIcon(HbIcon& icon) { - if (!mPreviewIconItem) - { - mPreviewIconItem = new HbIconItem(this); - mPreviewIconItem->setAlignment(Qt::AlignHCenter | Qt::AlignTop); - } + QCRITICAL_WRITE("MsgConversationWidget::setPreviewIcon start.") + HbStyle::setItemName(mPreviewIconItem, "preview"); - //sql query to get preview-icon from DB - TBool isOpen = EFalse; - bool imagePreviewed = false; - - //get DB handle and check if it is open - RSqlDatabase& sqlDb = ConversationsEngine::instance()->getDBHandle(isOpen); - if (isOpen) - { - RSqlStatement sqlSelectPreviewIconStmt; - TInt err = sqlSelectPreviewIconStmt.Prepare(sqlDb, - KSelectPreviewIconStmt); - - QCRITICAL_WRITE_FORMAT("Error from Prepare()", err) - - if (err == KErrNone) - { - //msg_id - TInt msgIdIndex = sqlSelectPreviewIconStmt.ParameterIndex( - _L(":message_id")); - sqlSelectPreviewIconStmt.BindInt(msgIdIndex, msgId); - - // get preview-icon from DB - err = sqlSelectPreviewIconStmt.Next(); - QCRITICAL_WRITE_FORMAT("Error from Next()", err) - - if (err == KSqlAtRow) - { - TInt previewIconIndex = sqlSelectPreviewIconStmt.ColumnIndex( - _L("preview_icon")); - - RSqlColumnReadStream stream; - - //Get data from binary column BLOB - err = stream.ColumnBinary(sqlSelectPreviewIconStmt, - previewIconIndex); - - QCRITICAL_WRITE_FORMAT("Error from ColumnBinary()", err) - - if (err == KErrNone) - { - CFbsBitmap *bitmap = new CFbsBitmap; - TRAPD(err,bitmap->InternalizeL(stream)); - QCRITICAL_WRITE_FORMAT("Error from bitmap InternalizeL()", err) - //convert bitmap to pixmap - if (err == KErrNone) - { - TSize size = bitmap->SizeInPixels(); - int bytesPerLine = bitmap->ScanLineLength(size.iWidth, - bitmap->DisplayMode()); - const uchar* dataPtr = - (const uchar*) bitmap->DataAddress(); - - QPixmap pixmap = QPixmap::fromImage(QImage(dataPtr, - size.iWidth, size.iHeight, bytesPerLine, - QImage::Format_RGB16)); + mPreviewIconItem->setIcon(icon); + mPreviewIconItem->setPreferredSize(icon.size()); + mPreviewIconItem->show(); - mPreviewIconItem->setIcon(HbIcon(pixmap)); - mPreviewIconItem->setPreferredSize(pixmap.size()); - mPreviewIconItem->setEnabled(true); - mPreviewIconItem->show(); - imagePreviewed = true; - - QCRITICAL_WRITE("Bitmap Conversion completed") - } - //remove bitmap - delete bitmap; - } - //close stream - stream.Close(); - } - } - sqlSelectPreviewIconStmt.Close(); - } + QCRITICAL_WRITE("MsgConversationWidget::setPreviewIcon end.") +} - // if not found in db, set from file path - if(!imagePreviewed) - { - QPixmap pixmap(filePath); - QPixmap scaledPixmap =pixmap.scaled(100,100,Qt::IgnoreAspectRatio); - mPreviewIconItem->setIcon(HbIcon(scaledPixmap)); - mPreviewIconItem->setPreferredSize(scaledPixmap.size()); - mPreviewIconItem->setEnabled(true); - mPreviewIconItem->show(); - } - - QCRITICAL_WRITE("MsgConversationWidget::setPreviewIconPath end.") - -} //--------------------------------------------------------------- // MsgConversationWidget::setPriority @@ -267,10 +190,6 @@ if (priority) { - if (!mPriorityIconItem) - { - mPriorityIconItem = new HbIconItem(this); - } HbStyle::setItemName(mPriorityIconItem, "priority"); if (ConvergedMessage::Low == priority) { @@ -303,10 +222,6 @@ if (attachment) { - if (!mAttachmentIconItem) - { - mAttachmentIconItem = new HbIconItem(this); - } HbStyle::setItemName(mAttachmentIconItem, "attachment"); mAttachmentIconItem->setIcon(HbIcon(MSG_ATTACH_ICON)); mAttachmentIconItem->show(); @@ -366,27 +281,30 @@ { if (hasAudio()) { - if (hasImage()) + if (!hasImage()) { - if (!mPlayIconItem) + HbStyle::setItemName(mPreviewIconItem, "preview"); + if(iconPath.isEmpty()) { - mPlayIconItem = new HbIconItem(this); + 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); } - HbStyle::setItemName(mPlayIconItem, "playIcon"); - mPlayIconItem->setIconName(iconPath.isEmpty() ? MSG_AUDIO_PLAY_ICON : iconPath); - mPlayIconItem->show(); + else + { + mPreviewIconItem->setIconName(iconPath); + } + mPreviewIconItem->show(); } else { - if (!mAudioIconItem) - { - mAudioIconItem = new HbIconItem(this); - } - HbStyle::setItemName(mAudioIconItem, "audioIcon"); - mAudioIconItem->setIconName(iconPath.isEmpty() ? MSG_AUDIO_PLAY_ICON : iconPath); - mAudioIconItem->show(); - - } + HbStyle::setItemName(mPlayIconItem, "playIcon"); + mPlayIconItem->setIconName(iconPath.isEmpty() ? MSG_AUDIO_PLAY_ICON : iconPath); + mPlayIconItem->show(); + } } } @@ -397,18 +315,6 @@ void MsgConversationWidget::setVideo(bool video) { mHasVideo = video; - - if (video) - { - if (!mVideoIconItem) - { - mVideoIconItem = new HbIconItem(this); - } - HbStyle::setItemName(mVideoIconItem, "video"); - mVideoIconItem->setIcon(HbIcon(MSG_VIDEO_ICON)); - mVideoIconItem->show(); - - } } //--------------------------------------------------------------- @@ -463,6 +369,8 @@ void MsgConversationWidget::setUnread(bool unread) { mUnread = unread; + // Needed for colour group changes to be visible + QCoreApplication::postEvent(this, new HbEvent(HbEvent::ThemeChanged)); } //--------------------------------------------------------------- @@ -521,6 +429,8 @@ case ConvergedMessage::SentState: { mSendingState = Sent; + // Needed for colour group changes to be visible + QCoreApplication::postEvent(this, new HbEvent(HbEvent::ThemeChanged)); break; } case ConvergedMessage::Sending: @@ -608,10 +518,6 @@ //--------------------------------------------------------------- void MsgConversationWidget::setTimeStamp(const QString &timeStamp) { - if(!mTimeStampTextItem) - { - mTimeStampTextItem = new HbTextItem(this); - } HbStyle::setItemName(mTimeStampTextItem, "timeStamp"); mTimeStampTextItem->setText(timeStamp); @@ -657,15 +563,7 @@ } else { - if(mSendingState == Sending || mSendingState == Pending || - mSendingState == Unknown || mSendingState == Failed) - { - mBubbleFrameItem->frameDrawer().setFrameGraphicsName(CV_SENT_HIGHLIGHT_FR); - } - else - { mBubbleFrameItem->frameDrawer().setFrameGraphicsName(CV_SENT_NORMAL_FR); - } } } @@ -698,7 +596,11 @@ } } - void MsgConversationWidget::resetProperties() +//--------------------------------------------------------------- +// MsgConversationWidget::resetProperties +// @see header file +//--------------------------------------------------------------- +void MsgConversationWidget::resetProperties() { mHasAttachment = false; mHasImage = false; @@ -740,17 +642,7 @@ HbStyle::setItemName(mPriorityIconItem, ""); mPriorityIconItem->hide(); } - - if(mAudioIconItem){ - HbStyle::setItemName(mAudioIconItem, ""); - mAudioIconItem->hide(); - } - - if(mVideoIconItem){ - HbStyle::setItemName(mVideoIconItem, ""); - mVideoIconItem->hide(); - } - + if(mPlayIconItem){ HbStyle::setItemName(mPlayIconItem, ""); mPlayIconItem->hide(); @@ -761,11 +653,68 @@ mPreviewIconItem->hide(); } } + +//--------------------------------------------------------------- +// MsgConversationWidget::orientationchanged +// @see header file +//--------------------------------------------------------------- +void MsgConversationWidget::orientationchanged(Qt::Orientation orientation) +{ + QDEBUG_WRITE("MsgConversationWidget:orientationchanged start.") + + repolish(); - void MsgConversationWidget::repolishWidget() + QDEBUG_WRITE("MsgConversationWidget:orientationchanged end.") +} + +//--------------------------------------------------------------- +// MsgConversationWidget::polish +// @see header file +//--------------------------------------------------------------- +void MsgConversationWidget::polish(HbStyleParameters ¶ms) +{ + QString bubbleOrig = HbStyle::itemName(mBubbleFrameItem); + QString newItemIconOrig = HbStyle::itemName(mNewFrameItem); + QString subjectOrig = HbStyle::itemName(mSubjectTextItem); + QString bodyTextOrig = HbStyle::itemName(mBodyTextItem); + QString previewOrig = HbStyle::itemName(mPreviewIconItem); + QString priorityOrig = HbStyle::itemName(mPriorityIconItem); + QString attachmentOrig = HbStyle::itemName(mAttachmentIconItem); + QString timeStampOrig = HbStyle::itemName(mTimeStampTextItem); + QString playIconOrig = HbStyle::itemName(mPlayIconItem); + + // Make sure that all the sub-items are polished in every polish. + HbStyle::setItemName(mBubbleFrameItem, "bubble"); + HbStyle::setItemName(mNewFrameItem, "newItemIcon"); + HbStyle::setItemName(mSubjectTextItem, "subject"); + HbStyle::setItemName(mBodyTextItem, "bodyText"); + HbStyle::setItemName(mPreviewIconItem, "preview"); + HbStyle::setItemName(mPriorityIconItem, "priority"); + HbStyle::setItemName(mAttachmentIconItem, "attachment"); + HbStyle::setItemName(mTimeStampTextItem, "timeStamp"); + HbStyle::setItemName(mPlayIconItem, "playIcon"); + + HbWidget::polish(params); + + HbStyle::setItemName(mBubbleFrameItem, bubbleOrig); + HbStyle::setItemName(mNewFrameItem, newItemIconOrig); + HbStyle::setItemName(mSubjectTextItem, subjectOrig); + HbStyle::setItemName(mBodyTextItem, bodyTextOrig); + HbStyle::setItemName(mPreviewIconItem, previewOrig); + HbStyle::setItemName(mPriorityIconItem, priorityOrig); + HbStyle::setItemName(mAttachmentIconItem, attachmentOrig); + HbStyle::setItemName(mTimeStampTextItem, timeStampOrig); + HbStyle::setItemName(mPlayIconItem, playIconOrig); +} + +//--------------------------------------------------------------- +// MsgConversationWidget::repolishWidget +// @see header file +//--------------------------------------------------------------- +void MsgConversationWidget::repolishWidget() { - QCoreApplication::postEvent(this, new HbEvent(HbEvent::ThemeChanged)); repolish(); } - + + // EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/src/msgeditorwidget.cpp --- a/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -31,14 +31,14 @@ #include #include "unieditorpluginloader.h" #include "unieditorplugininterface.h" -#include "unisendingsettings.h" -#include "unieditorgenutils.h" +#include "UniSendingSettings.h" +#include "UniEditorGenUtils.h" #include "debugtraces.h" // LOCAL CONSTANTS const QString SEND_ICON("qtg_mono_send"); -const QString BACKGROUND("qtg_fr_input_bg"); +const QString BACKGROUND("qtg_fr_input_v_bg"); const QString BACKGROUND_FRAME("qtg_fr_btn_normal"); const QString SEND_BUTTON_NORMAL("qtg_fr_input_btn_function_normal"); @@ -46,8 +46,8 @@ const QString SEND_BUTTON_DISABLED("qtg_fr_input_btn_function_disabled"); #define LOC_SMS_CHAR_LIMIT_REACHED hbTrId("txt_messaging_dialog_sms_character_count_exceeded") -#define LOC_DIALOG_OK hbTrId("txt_common_button_ok") -#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") +#define LOC_HINT_TEXT hbTrId("txt_messaging_formlabel_enter_message_here") + const TInt KShowCounterLimit = 10; @@ -83,14 +83,15 @@ mMsgEditor->setMaxRows(3); // NOTE: Don't remove this line. HbStyle::setItemName(mMsgEditor, "msgEditor"); - mSendButton = new HbPushButton(this); - HbStyle::setItemName(mSendButton, "sendButton"); + mSendButton = new HbPushButton(this); + HbStyle::setItemName(mSendButton, "sendButton"); + mSendButton->setEnabled(false); + + HbFrameItem* backGround = new HbFrameItem(this); + backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); + mSendButton->setBackgroundItem(backGround); + updateButtonBackground(SEND_BUTTON_DISABLED); mSendButton->setIcon(HbIcon(SEND_ICON)); - mSendButton->setEnabled(false); - HbFrameDrawer* drawer = new HbFrameDrawer(this); - drawer->setFrameType(HbFrameDrawer::NinePieces); - mSendButton->setFrameBackground(drawer); - updateButtonBackground(SEND_BUTTON_DISABLED); mCharCounter = new HbTextItem(this); HbStyle::setItemName(mCharCounter, "charCounter"); @@ -252,9 +253,8 @@ mSmsCharLimitReached = false; HbMessageBox::question(LOC_SMS_CHAR_LIMIT_REACHED, - this,SLOT(onSmsCharLimitReached(HbAction*)), - LOC_DIALOG_OK, - LOC_BUTTON_CANCEL); + this,SLOT(onSmsCharLimitReached(HbAction*)), + HbMessageBox::Ok | HbMessageBox::Cancel); } @@ -282,14 +282,15 @@ // MsgEditor::updateButtonBackground // @see header //--------------------------------------------------------------- -void MsgEditorWidget::updateButtonBackground(const QString& bg) - { - HbFrameDrawer* drawer = mSendButton->frameBackground(); - if(drawer) - { - drawer->setFrameGraphicsName(bg); - } - } +void MsgEditorWidget::updateButtonBackground(const QString& bg) + { + HbFrameItem* drawer = static_cast(mSendButton->backgroundItem()); + if(drawer) + { + drawer->frameDrawer().setFrameGraphicsName(bg); + } + } + //--------------------------------------------------------------- // MsgEditor::onPressed @@ -356,7 +357,7 @@ MsgEditor::MsgEditor(QGraphicsItem *parent) :HbLineEdit(parent) { - + this->setPlaceholderText(LOC_HINT_TEXT); } //--------------------------------------------------------------- diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/src/msgviewutils.cpp --- a/messagingapp/msgui/conversationview/src/msgviewutils.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/conversationview/src/msgviewutils.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -16,7 +16,7 @@ */ #include "msgviewutils.h" -#include "s60qconversions.h" +#include // --------------------------------------------------------------------------- // Constructor @@ -44,7 +44,7 @@ RFs rfs; RFile file; - HBufC* fileName = S60QConversions::qStringToS60Desc(aFileName); + HBufC* fileName = XQConversions::qStringToS60Desc(aFileName); //TODO: The RFs and RApaLsSession has to be connected 1's, not for every mms @@ -69,7 +69,7 @@ rfs.Close(); apaSession.Close(); - return S60QConversions::s60Desc8ToQString(fileType); + return XQConversions::s60Desc8ToQString(fileType); } } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/conversationview/tsrc/tsrc.pro Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,19 @@ +# +# 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: +# +# + +SUBDIRS += unittests +TEMPLATE = subdirs diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/hbwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/hbwidget.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef T_MSGCONVERSATIONVIEW_HBWIDGET_H +#define T_MSGCONVERSATIONVIEW_HBWIDGET_H + +#include + +/* + Mocked HbWidget class' external variables. + */ +extern QGraphicsWidget *hbwidget_parent; + +/* + Mocked HbWidget class. + */ +class HbWidget : public QGraphicsWidget +{ + Q_OBJECT +public: + HbWidget(QGraphicsWidget *parent = NULL) + : QGraphicsWidget(hbwidget_parent = parent) + { + } + ~HbWidget() + { + } + + void repolish() {} + +private: + Q_DISABLE_COPY(HbWidget) +private: +}; + +#endif /* T_MSGCONVERSATIONVIEW_HBWIDGET_H */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/msgconversationwidgetheaders.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/msgconversationwidgetheaders.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,282 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef T_MSGCONVERSATIONWIDGET_HEADERS_H +#define T_MSGCONVERSATIONWIDGET_HEADERS_H + +#include + +#include "convergedmessage.h" +#include "debugtraces.h" + +#define QCoreApplication QCoreApplication2 + +/* + Mocked HbEvent class. + */ +class HbEvent : public QObject +{ + Q_OBJECT +public: + enum Flags{ + ThemeChanged + }; + + HbEvent(HbEvent::Flags flag) + { + } + ~HbEvent() + { + } + +private: + Q_DISABLE_COPY(HbEvent) +}; + +/* + Mocked QCoreApplication class. + */ + class MSG; + +class QCoreApplication2 : public QObject +{ + Q_OBJECT +public: + enum EventFilter + { + CodecForTr, UnicodeUTF8, DefaultCodec + }; + + QCoreApplication ( int & argc, char ** argv ) {} + ~QCoreApplication () {} + bool filterEvent ( void * message, long * result ) {} + virtual bool notify ( QObject * receiver, QEvent * event ) {} + EventFilter setEventFilter ( EventFilter filter ) {} + virtual bool winEventFilter ( MSG * msg, long * result ) {} + static void postEvent(QObject* ref, HbEvent* ob) {} + +private: + Q_DISABLE_COPY(QCoreApplication) +}; + +/* + Mocked Hb class. + */ +class Hb : public QObject +{ + Q_OBJECT +public: + enum Flags{ + TextCursorHidden + + }; + + Hb(QObject *parent = NULL) + { + } + ~Hb() + { + } + +private: + Q_DISABLE_COPY(Hb) +}; + +/* + Mocked HbIcon class. + */ +class HbIcon +{ + +public: + + HbIcon (const QString &iconName) {} + HbIcon (const QIcon &icon) {} + HbIcon (const HbIcon &other) {} + + QSizeF size() const {} +private: + //Q_DISABLE_COPY(HbIcon) +}; + +/* + Mocked HbIconItem class. + */ + +class HbIconItem : public QGraphicsWidget +{ + Q_OBJECT +public: + HbIconItem(QGraphicsWidget *parent = NULL) + { + } + ~HbIconItem() + { + } + void setAlignment(Qt::Alignment alignment) {} + void setIcon(const HbIcon &icon) {} + void setPreferredSize(QSizeF size) {} + void show(){} + void setIconName(const QString& name) {} +private: + Q_DISABLE_COPY(HbIconItem) +private: +}; + +/* + Mocked HbTextItem class. + */ +class HbTextItem : public QGraphicsWidget +{ + Q_OBJECT +public: + HbTextItem(QGraphicsWidget *parent = NULL) + { + } + ~HbTextItem() + { + } + void setText(const QString &timeStamp){} + void show(){} +private: + Q_DISABLE_COPY(HbTextItem) +private: +}; + +/* + Mocked HbIconItem class. + */ +extern int hbtextedit_setsmileysenabled_callcount; +extern int hbtextedit_setreadonly_callcount; + +class HbTextEdit : public QGraphicsWidget +{ + Q_OBJECT +public: + HbTextEdit(QGraphicsWidget *parent = NULL) + { + } + ~HbTextEdit() + { + } + void setReadOnly(bool status) { + hbtextedit_setreadonly_callcount++; + } + void setBackgroundItem(int back) {} + void setSmileysEnabled(bool status) { + hbtextedit_setsmileysenabled_callcount++; + } + void setFlag(QGraphicsWidget::GraphicsItemFlag flag,bool status) {} + void setPlainText(QString text) {} + void show() {} + void setCursorVisibility(Hb::Flags flag) {} +private: + Q_DISABLE_COPY(HbTextEdit) +private: +}; + +/* + Mocked HbStyle class. + */ +extern int hbstyle_setitemname_callcount; + +class HbStyle: public QObject +{ + Q_OBJECT +public: + enum{ + P_None + }; + HbStyle(QObject *parent = NULL) + { + } + + void static setItemName(QGraphicsWidget* bubbleFrameItem, QString type) + { + hbstyle_setitemname_callcount++; + } + +private: + Q_DISABLE_COPY(HbStyle) +}; + +/* + Mocked HbFrameDrawer class. + */ + extern int hbframedrawer_setframetype_callcount; + +class HbFrameDrawer: public QObject +{ + Q_OBJECT +public: + enum PieceSize{ + OnePieces, + TwoPieces, + ThreePiecesVertical, + FourPieces, + NinePieces + }; + HbFrameDrawer(QObject *parent = NULL) + { + } + void setFrameType(HbFrameDrawer::PieceSize piece) + { + hbframedrawer_setframetype_callcount++; + } + + void setFrameGraphicsName(const QString name) {} + +private: + Q_DISABLE_COPY(HbFrameDrawer) +}; + +/* + Mocked HbFrameItem class. + */ +extern int hbframeitem_framedrawer_callcount; + +class HbFrameItem : public QGraphicsWidget +{ + Q_OBJECT + +public: + + HbFrameItem(QGraphicsWidget *parent = NULL) + { + } + ~HbFrameItem() + { + } + +HbFrameDrawer& frameDrawer ( ) +{ + hbframeitem_framedrawer_callcount++; + return frameDraw; +} + +private: + Q_DISABLE_COPY(HbFrameItem) +private: + HbFrameDrawer frameDraw; +}; + +/* + Include the header file of the class under test. + */ +#include "../../../inc/msgconversationwidget.h" + +#endif /* T_MSGCONVERSATIONWIDGET_HEADERS_H */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/unittest_msgconversationwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/unittest_msgconversationwidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include + +#include "msgconversationwidgetheaders.h" + +/* + Global variables that are used to control the test environment and/or + observe the individual tests. The naming convention can be described with + a ternary template + + _[_], + + where is the name of a mocked class, is the name of a + variable, a function, or a property under consideration, and is + an optional description. For example, if we wish to observe the number of + A::B() calls, we declare a global integer a_b_callcount and increment it + every time A::B() is called. The variable is also declared in the header + file of the mocked class by using the extern keyword. Typically, these + global variables are defined and reset in the unit-test class' helper + functions. + + Mocked HbLabel class' global variables: + + • argument of setNumber() and/or setPlainText(), + • number of setNumber() calls, and + • number of setPlaintText() calls. + */ + +int hbframeitem_framedrawer_callcount; +int hbstyle_setitemname_callcount; +int hbframedrawer_setframetype_callcount; +int hbtextedit_setreadonly_callcount; +int hbtextedit_setsmileysenabled_callcount; +const QString SUBJECT = "Subject"; +const QString BODYTEXT = "Body Text"; + +QGraphicsWidget *hbwidget_parent; + +/* + The unit-test class. The class definition contains four helper functions + and a number of test functions. The helper functions are responsible for + the initialization and cleanup of the test environment, whereas the test + functions implement the actual testing. Although the test functions are + executed in the order they are defined, they should not depend on each + other in any way. In other words, one should be able to scramble the test + functions and still compile a working unit test. + */ +class TestMsgConversationWidget : public QObject +{ + Q_OBJECT +private slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + void testConstructor(); + void testSetSubject(); + void testSetBodyText(); +}; + +/* + Initializes the test environment. This function is automatically invoked + before the first test function. + */ +void TestMsgConversationWidget::initTestCase() +{ +} + +/* + Cleans up the test environment. This function is automatically invoked + after the last test function. + */ +void TestMsgConversationWidget::cleanupTestCase() +{ +} + +/* + Performs initialization for a single test function. This function is + automatically invoked before each test function. + */ +void TestMsgConversationWidget::init() +{ + hbframeitem_framedrawer_callcount = 0; + hbstyle_setitemname_callcount = 0; + hbframedrawer_setframetype_callcount = 0; + hbtextedit_setsmileysenabled_callcount = 0; + hbtextedit_setreadonly_callcount = 0; + hbwidget_parent = NULL; +} + +/* + Performs cleanup for a single test function. This function is auto- + matically invoked after each test function. + */ +void TestMsgConversationWidget::cleanup() +{ +} + +/* + Test the constructor with different parent arguments: + + 1. null parent (i.e. default parent argument) and + 2. non-null parent. + */ +void TestMsgConversationWidget::testConstructor() +{ + // 1. + MsgConversationWidget *widget = new MsgConversationWidget(); + QVERIFY(!hbwidget_parent); + delete widget; + + // 2. + MsgConversationWidget parent(NULL); + widget = new MsgConversationWidget(&parent); + QVERIFY(hbwidget_parent == &parent); + + QVERIFY(6 == hbframeitem_framedrawer_callcount); + QVERIFY(6 == hbframedrawer_setframetype_callcount); + QVERIFY(6 == hbstyle_setitemname_callcount); + + delete widget; +} + +void TestMsgConversationWidget::testSetSubject() +{ + // 1. + MsgConversationWidget* myWidget = new MsgConversationWidget(); + myWidget->setSubject(SUBJECT); + QVERIFY(1 == hbtextedit_setreadonly_callcount); + QVERIFY(1 == hbtextedit_setsmileysenabled_callcount); + + delete myWidget; +} + +void TestMsgConversationWidget::testSetBodyText() +{ + // 1. + MsgConversationWidget* myWidget = new MsgConversationWidget(); + myWidget->setBodyText(BODYTEXT); + QVERIFY(1 == hbtextedit_setreadonly_callcount); + QVERIFY(1 == hbtextedit_setsmileysenabled_callcount); + + delete myWidget; +} + +/* + Implement a main() function that initializes the test environment, + executes all tests in the order they were defined, and finally cleans up + the test environment. + */ +QTEST_APPLESS_MAIN(TestMsgConversationWidget) + +/* + Because both the declaration and the implementation of our test class are + in a single .cpp file, we also need to include the generated moc file to + make Qt's introspection work. + */ +#include "unittest_msgconversationwidget.moc" diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/unittest_msgconversationwidget.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/unittest_msgconversationwidget.pro Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,31 @@ +# +# 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: +# +# + +CONFIG += qtestlib symbian_test +INCLUDEPATH += . +MMP_RULES += "USERINCLUDE . ../../../../../../inc" +MOC_DIR = moc +TARGET = unittest_msgconversationwidget +TARGET.CAPABILITY = All -TCB +TEMPLATE = app + +HEADERS += hbwidget.h \ + msgconversationwidgetheaders.h \ + ../../../inc/msgconversationwidget.h + +SOURCES += unittest_msgconversationwidget.cpp \ + ../../../src/msgconversationwidget.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/conversationview/tsrc/unittests/unittests.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/conversationview/tsrc/unittests/unittests.pro Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,22 @@ +# +# 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: +# +# + +CONFIG += symbian_test +SUBDIRS += unittest_nmexampleadapterclass \ + unittest_nmexamplesymbianclass \ + unittest_nmexampleview +TEMPLATE = subdirs diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/eabi/appengineu.def --- a/messagingapp/msgui/eabi/appengineu.def Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/eabi/appengineu.def Thu Jul 22 16:32:06 2010 +0100 @@ -2,40 +2,46 @@ _ZN19ConversationsEngine11getDBHandleERi @ 1 NONAME _ZN19ConversationsEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME _ZN19ConversationsEngine11qt_metacastEPKc @ 3 NONAME - _ZN19ConversationsEngine13resendMessageEi @ 4 NONAME - _ZN19ConversationsEngine14deleteMessagesER5QListIiE @ 5 NONAME - _ZN19ConversationsEngine14getDraftsModelEv @ 6 NONAME - _ZN19ConversationsEngine15downloadMessageEi @ 7 NONAME - _ZN19ConversationsEngine16getConversationsEx @ 8 NONAME - _ZN19ConversationsEngine16markMessagesReadER5QListIiE @ 9 NONAME - _ZN19ConversationsEngine16staticMetaObjectE @ 10 NONAME DATA 16 - _ZN19ConversationsEngine17getContactDetailsExR7QStringS1_ @ 11 NONAME - _ZN19ConversationsEngine18clearConversationsEv @ 12 NONAME - _ZN19ConversationsEngine19deleteConversationsEx @ 13 NONAME - _ZN19ConversationsEngine19getStaticMetaObjectEv @ 14 NONAME - _ZN19ConversationsEngine20markAsReadAndGetTypeEiRiS0_ @ 15 NONAME - _ZN19ConversationsEngine20markConversationReadEx @ 16 NONAME - _ZN19ConversationsEngine21getConversationsModelEv @ 17 NONAME - _ZN19ConversationsEngine22deleteAllDraftMessagesEv @ 18 NONAME - _ZN19ConversationsEngine22fetchMoreConversationsEv @ 19 NONAME - _ZN19ConversationsEngine24conversationModelUpdatedEv @ 20 NONAME - _ZN19ConversationsEngine24getCurrentConversationIdEv @ 21 NONAME - _ZN19ConversationsEngine26conversationModelPopulatedEv @ 22 NONAME - _ZN19ConversationsEngine26downloadOperationSupportedEi @ 23 NONAME - _ZN19ConversationsEngine28emitConversationModelUpdatedEv @ 24 NONAME - _ZN19ConversationsEngine28getConversationIdFromAddressE7QString @ 25 NONAME - _ZN19ConversationsEngine28getConversationsSummaryModelEv @ 26 NONAME - _ZN19ConversationsEngine30conversationListModelPopulatedEv @ 27 NONAME - _ZN19ConversationsEngine30emitConversationModelPopulatedEv @ 28 NONAME - _ZN19ConversationsEngine30getConversationIdFromContactIdEi @ 29 NONAME - _ZN19ConversationsEngine34emitConversationListModelPopulatedEv @ 30 NONAME - _ZN19ConversationsEngine8instanceEv @ 31 NONAME - _ZN19ConversationsEngineC1EP7QObject @ 32 NONAME - _ZN19ConversationsEngineC2EP7QObject @ 33 NONAME - _ZN19ConversationsEngineD0Ev @ 34 NONAME - _ZN19ConversationsEngineD1Ev @ 35 NONAME - _ZN19ConversationsEngineD2Ev @ 36 NONAME - _ZNK19ConversationsEngine10metaObjectEv @ 37 NONAME - _ZTI19ConversationsEngine @ 38 NONAME - _ZTV19ConversationsEngine @ 39 NONAME + _ZN19ConversationsEngine13getMsgSubTypeEi @ 4 NONAME + _ZN19ConversationsEngine13resendMessageEi @ 5 NONAME + _ZN19ConversationsEngine14deleteMessagesER5QListIiE @ 6 NONAME + _ZN19ConversationsEngine14getDraftsModelEv @ 7 NONAME + _ZN19ConversationsEngine15downloadMessageEi @ 8 NONAME + _ZN19ConversationsEngine16getConversationsEx @ 9 NONAME + _ZN19ConversationsEngine16markMessagesReadER5QListIiE @ 10 NONAME + _ZN19ConversationsEngine16staticMetaObjectE @ 11 NONAME DATA 16 + _ZN19ConversationsEngine17getContactDetailsExR7QStringS1_ @ 12 NONAME + _ZN19ConversationsEngine18clearConversationsEv @ 13 NONAME + _ZN19ConversationsEngine19deleteConversationsEx @ 14 NONAME + _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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/eabi/conversationviewu.def --- a/messagingapp/msgui/eabi/conversationviewu.def Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/eabi/conversationviewu.def Thu Jul 22 16:32:06 2010 +0100 @@ -14,19 +14,20 @@ _ZN23MsgConversationBaseView21closeConversationViewEv @ 13 NONAME _ZN23MsgConversationBaseView21doDelayedConstructionEv @ 14 NONAME _ZN23MsgConversationBaseView22conversationViewClosedEv @ 15 NONAME - _ZN23MsgConversationBaseView8handleOkERK8QVariant @ 16 NONAME - _ZN23MsgConversationBaseView8initViewEv @ 17 NONAME - _ZN23MsgConversationBaseView9setPSCVIdEb @ 18 NONAME - _ZN23MsgConversationBaseViewC1EP13QGraphicsItem @ 19 NONAME - _ZN23MsgConversationBaseViewC2EP13QGraphicsItem @ 20 NONAME - _ZN23MsgConversationBaseViewD0Ev @ 21 NONAME - _ZN23MsgConversationBaseViewD1Ev @ 22 NONAME - _ZN23MsgConversationBaseViewD2Ev @ 23 NONAME - _ZNK23MsgConversationBaseView10metaObjectEv @ 24 NONAME - _ZTI23MsgConversationBaseView @ 25 NONAME - _ZTV23MsgConversationBaseView @ 26 NONAME - _ZThn16_N23MsgConversationBaseViewD0Ev @ 27 NONAME - _ZThn16_N23MsgConversationBaseViewD1Ev @ 28 NONAME - _ZThn8_N23MsgConversationBaseViewD0Ev @ 29 NONAME - _ZThn8_N23MsgConversationBaseViewD1Ev @ 30 NONAME + _ZN23MsgConversationBaseView26handleConversationIdChangeEx @ 16 NONAME + _ZN23MsgConversationBaseView8handleOkERK8QVariant @ 17 NONAME + _ZN23MsgConversationBaseView8initViewEv @ 18 NONAME + _ZN23MsgConversationBaseView9setPSCVIdEb @ 19 NONAME + _ZN23MsgConversationBaseViewC1EP13QGraphicsItem @ 20 NONAME + _ZN23MsgConversationBaseViewC2EP13QGraphicsItem @ 21 NONAME + _ZN23MsgConversationBaseViewD0Ev @ 22 NONAME + _ZN23MsgConversationBaseViewD1Ev @ 23 NONAME + _ZN23MsgConversationBaseViewD2Ev @ 24 NONAME + _ZNK23MsgConversationBaseView10metaObjectEv @ 25 NONAME + _ZTI23MsgConversationBaseView @ 26 NONAME + _ZTV23MsgConversationBaseView @ 27 NONAME + _ZThn16_N23MsgConversationBaseViewD0Ev @ 28 NONAME + _ZThn16_N23MsgConversationBaseViewD1Ev @ 29 NONAME + _ZThn8_N23MsgConversationBaseViewD0Ev @ 30 NONAME + _ZThn8_N23MsgConversationBaseViewD1Ev @ 31 NONAME diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/eabi/msgaudiofetcheru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/eabi/msgaudiofetcheru.def Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,24 @@ +EXPORTS + _ZN19MsgAudioFetcherView11initToolBarEv @ 1 NONAME + _ZN19MsgAudioFetcherView11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME + _ZN19MsgAudioFetcherView11qt_metacastEPKc @ 3 NONAME + _ZN19MsgAudioFetcherView13enableToolBarEb @ 4 NONAME + _ZN19MsgAudioFetcherView14initMainWidgetEv @ 5 NONAME + _ZN19MsgAudioFetcherView16staticMetaObjectE @ 6 NONAME DATA 16 + _ZN19MsgAudioFetcherView19getStaticMetaObjectEv @ 7 NONAME + _ZN19MsgAudioFetcherView19removeToolBarActionEv @ 8 NONAME + _ZN19MsgAudioFetcherView23on_leftAction_triggeredEv @ 9 NONAME + _ZN19MsgAudioFetcherView24on_rightAction_triggeredEv @ 10 NONAME + _ZN19MsgAudioFetcherViewC1ERK5QListI8QVariantE @ 11 NONAME + _ZN19MsgAudioFetcherViewC2ERK5QListI8QVariantE @ 12 NONAME + _ZN19MsgAudioFetcherViewD0Ev @ 13 NONAME + _ZN19MsgAudioFetcherViewD1Ev @ 14 NONAME + _ZN19MsgAudioFetcherViewD2Ev @ 15 NONAME + _ZNK19MsgAudioFetcherView10metaObjectEv @ 16 NONAME + _ZTI19MsgAudioFetcherView @ 17 NONAME + _ZTV19MsgAudioFetcherView @ 18 NONAME + _ZThn16_N19MsgAudioFetcherViewD0Ev @ 19 NONAME + _ZThn16_N19MsgAudioFetcherViewD1Ev @ 20 NONAME + _ZThn8_N19MsgAudioFetcherViewD0Ev @ 21 NONAME + _ZThn8_N19MsgAudioFetcherViewD1Ev @ 22 NONAME + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/eabi/msgsettingsu.def --- a/messagingapp/msgui/eabi/msgsettingsu.def Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -EXPORTS - _ZN14SettingsViewer11iAPSelectorEP11QStringList @ 1 NONAME - _ZN14SettingsViewer11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME - _ZN14SettingsViewer11qt_metacastEPKc @ 3 NONAME - _ZN14SettingsViewer13changeServiceEv @ 4 NONAME - _ZN14SettingsViewer13closeSettingsEv @ 5 NONAME - _ZN14SettingsViewer13createMmsViewEv @ 6 NONAME - _ZN14SettingsViewer13createSmsViewEv @ 7 NONAME - _ZN14SettingsViewer14softkeyClickedEv @ 8 NONAME - _ZN14SettingsViewer15openMmsSettingsEv @ 9 NONAME - _ZN14SettingsViewer15openSmsSettingsEv @ 10 NONAME - _ZN14SettingsViewer16staticMetaObjectE @ 11 NONAME DATA 16 - _ZN14SettingsViewer17changeAccessPointEi @ 12 NONAME - _ZN14SettingsViewer17settingListClosedEv @ 13 NONAME - _ZN14SettingsViewer19getStaticMetaObjectEv @ 14 NONAME - _ZN14SettingsViewer20settingsViewerClosedEv @ 15 NONAME - _ZN14SettingsViewer8initViewEv @ 16 NONAME - _ZN14SettingsViewerC1EP13QGraphicsItem @ 17 NONAME - _ZN14SettingsViewerC2EP13QGraphicsItem @ 18 NONAME - _ZN14SettingsViewerD0Ev @ 19 NONAME - _ZN14SettingsViewerD1Ev @ 20 NONAME - _ZN14SettingsViewerD2Ev @ 21 NONAME - _ZNK14SettingsViewer10metaObjectEv @ 22 NONAME - _ZTI14SettingsViewer @ 23 NONAME - _ZTV14SettingsViewer @ 24 NONAME - _ZThn16_N14SettingsViewerD0Ev @ 25 NONAME - _ZThn16_N14SettingsViewerD1Ev @ 26 NONAME - _ZThn8_N14SettingsViewerD0Ev @ 27 NONAME - _ZThn8_N14SettingsViewerD1Ev @ 28 NONAME - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/eabi/msguiutilsu.def --- a/messagingapp/msgui/eabi/msguiutilsu.def Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/eabi/msguiutilsu.def Thu Jul 22 16:32:06 2010 +0100 @@ -23,23 +23,26 @@ _ZN12MsgMediaUtilC2Ev @ 22 NONAME _ZN12MsgMediaUtilD1Ev @ 23 NONAME _ZN12MsgMediaUtilD2Ev @ 24 NONAME - _ZN19MmsConformanceCheck11qt_metacallEN11QMetaObject4CallEiPPv @ 25 NONAME - _ZN19MmsConformanceCheck11qt_metacastEPKc @ 26 NONAME - _ZN19MmsConformanceCheck16staticMetaObjectE @ 27 NONAME DATA 16 - _ZN19MmsConformanceCheck18checkModeForInsertERK7QStringb @ 28 NONAME - _ZN19MmsConformanceCheck19getStaticMetaObjectEv @ 29 NONAME - _ZN19MmsConformanceCheck19onDialogInsertMediaEP8HbAction @ 30 NONAME - _ZN19MmsConformanceCheck21validateMsgForForwardEi @ 31 NONAME - _ZN19MmsConformanceCheck9showPopupERK7QString @ 32 NONAME - _ZN19MmsConformanceCheckC1Ev @ 33 NONAME - _ZN19MmsConformanceCheckC2Ev @ 34 NONAME - _ZN19MmsConformanceCheckD0Ev @ 35 NONAME - _ZN19MmsConformanceCheckD1Ev @ 36 NONAME - _ZN19MmsConformanceCheckD2Ev @ 37 NONAME - _ZNK11MsgSendUtil10metaObjectEv @ 38 NONAME - _ZNK19MmsConformanceCheck10metaObjectEv @ 39 NONAME - _ZTI11MsgSendUtil @ 40 NONAME - _ZTI19MmsConformanceCheck @ 41 NONAME - _ZTV11MsgSendUtil @ 42 NONAME - _ZTV19MmsConformanceCheck @ 43 NONAME + _ZN15MsgContactsUtil15copyVCardToTempERK7QString @ 25 NONAME + _ZN15MsgContactsUtil17launchVCardViewerERK7QString @ 26 NONAME + _ZN15MsgContactsUtil19deleteVCardFromTempERK7QString @ 27 NONAME + _ZN19MmsConformanceCheck11qt_metacallEN11QMetaObject4CallEiPPv @ 28 NONAME + _ZN19MmsConformanceCheck11qt_metacastEPKc @ 29 NONAME + _ZN19MmsConformanceCheck16staticMetaObjectE @ 30 NONAME DATA 16 + _ZN19MmsConformanceCheck18checkModeForInsertERK7QStringb @ 31 NONAME + _ZN19MmsConformanceCheck19getStaticMetaObjectEv @ 32 NONAME + _ZN19MmsConformanceCheck19onDialogInsertMediaEP8HbAction @ 33 NONAME + _ZN19MmsConformanceCheck21validateMsgForForwardEi @ 34 NONAME + _ZN19MmsConformanceCheck9showPopupERK7QString @ 35 NONAME + _ZN19MmsConformanceCheckC1Ev @ 36 NONAME + _ZN19MmsConformanceCheckC2Ev @ 37 NONAME + _ZN19MmsConformanceCheckD0Ev @ 38 NONAME + _ZN19MmsConformanceCheckD1Ev @ 39 NONAME + _ZN19MmsConformanceCheckD2Ev @ 40 NONAME + _ZNK11MsgSendUtil10metaObjectEv @ 41 NONAME + _ZNK19MmsConformanceCheck10metaObjectEv @ 42 NONAME + _ZTI11MsgSendUtil @ 43 NONAME + _ZTI19MmsConformanceCheck @ 44 NONAME + _ZTV11MsgSendUtil @ 45 NONAME + _ZTV19MmsConformanceCheck @ 46 NONAME diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/eabi/unifiededitoru.def --- a/messagingapp/msgui/eabi/unifiededitoru.def Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/eabi/unifiededitoru.def Thu Jul 22 16:32:06 2010 +0100 @@ -17,17 +17,17 @@ _ZN20MsgUnifiedEditorView11resizeEventEP25QGraphicsSceneResizeEvent @ 16 NONAME _ZN20MsgUnifiedEditorView12createVCardsERK8QVariantR11QStringList @ 17 NONAME _ZN20MsgUnifiedEditorView13addAttachmentERK7QString @ 18 NONAME - _ZN20MsgUnifiedEditorView13audiosFetchedERK8QVariant @ 19 NONAME - _ZN20MsgUnifiedEditorView13deleteMessageEv @ 20 NONAME - _ZN20MsgUnifiedEditorView13fetchContactsEv @ 21 NONAME - _ZN20MsgUnifiedEditorView13imagesFetchedERK8QVariant @ 22 NONAME - _ZN20MsgUnifiedEditorView14addAttachmentsE11QStringList @ 23 NONAME - _ZN20MsgUnifiedEditorView14changePriorityEv @ 24 NONAME - _ZN20MsgUnifiedEditorView14forwardMessageER18ConvergedMessageIdN16ConvergedMessage11MessageTypeE @ 25 NONAME - _ZN20MsgUnifiedEditorView14sendingOptionsEv @ 26 NONAME - _ZN20MsgUnifiedEditorView15contactsFetchedERK8QVariant @ 27 NONAME - _ZN20MsgUnifiedEditorView15populateContentERK5QListI8QVariantE @ 28 NONAME - _ZN20MsgUnifiedEditorView16createTempFolderEv @ 29 NONAME + _ZN20MsgUnifiedEditorView13deleteMessageEv @ 19 NONAME + _ZN20MsgUnifiedEditorView13fetchContactsEv @ 20 NONAME + _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 @@ -44,7 +44,7 @@ _ZN20MsgUnifiedEditorView22deactivateInputBlockerEv @ 43 NONAME _ZN20MsgUnifiedEditorView22setAttachOptionEnabledENS_16TBE_AttachOptionEb @ 44 NONAME _ZN20MsgUnifiedEditorView23handleViewExtnActivatedEP16HbListWidgetItem @ 45 NONAME - _ZN20MsgUnifiedEditorView25populateContentIntoEditorERK16ConvergedMessage @ 46 NONAME + _ZN20MsgUnifiedEditorView25populateContentIntoEditorERK16ConvergedMessageb @ 46 NONAME _ZN20MsgUnifiedEditorView25removeAttachmentContainerEv @ 47 NONAME _ZN20MsgUnifiedEditorView25updateOtherRecipientCountEb @ 48 NONAME _ZN20MsgUnifiedEditorView4sendEv @ 49 NONAME diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/eabi/unifiedvieweru.def --- a/messagingapp/msgui/eabi/unifiedvieweru.def Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/eabi/unifiedvieweru.def Thu Jul 22 16:32:06 2010 +0100 @@ -8,11 +8,11 @@ _ZN13UnifiedViewer15handleFwdActionEv @ 7 NONAME _ZN13UnifiedViewer15populateContentEibi @ 8 NONAME _ZN13UnifiedViewer16staticMetaObjectE @ 9 NONAME DATA 16 - _ZN13UnifiedViewer18handleDeleteActionEv @ 10 NONAME - _ZN13UnifiedViewer19getStaticMetaObjectEv @ 11 NONAME - _ZN13UnifiedViewer21validateMsgForForwardEv @ 12 NONAME - _ZN13UnifiedViewerC1EiP13QGraphicsItem @ 13 NONAME - _ZN13UnifiedViewerC2EiP13QGraphicsItem @ 14 NONAME + _ZN13UnifiedViewer17onDialogDeleteMsgEP8HbAction @ 10 NONAME + _ZN13UnifiedViewer18handleDeleteActionEv @ 11 NONAME + _ZN13UnifiedViewer19getStaticMetaObjectEv @ 12 NONAME + _ZN13UnifiedViewerC1EiiP13QGraphicsItem @ 13 NONAME + _ZN13UnifiedViewerC2EiiP13QGraphicsItem @ 14 NONAME _ZN13UnifiedViewerD0Ev @ 15 NONAME _ZN13UnifiedViewerD1Ev @ 16 NONAME _ZN13UnifiedViewerD2Ev @ 17 NONAME @@ -23,5 +23,4 @@ _ZThn16_N13UnifiedViewerD1Ev @ 22 NONAME _ZThn8_N13UnifiedViewerD0Ev @ 23 NONAME _ZThn8_N13UnifiedViewerD1Ev @ 24 NONAME - _ZN13UnifiedViewer17onDialogDeleteMsgEP8HbAction @ 25 NONAME diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/inc/msgbaseview.h --- a/messagingapp/msgui/inc/msgbaseview.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/inc/msgbaseview.h Thu Jul 22 16:32:06 2010 +0100 @@ -45,7 +45,8 @@ UNIEDITOR, UNIVIEWER, MSGSETTINGS, - SERVICE + SERVICE, + AUDIOFETCHER }; /** @@ -69,6 +70,10 @@ */ void switchView(const QVariantList& data); + /** + * Forceful close of conversation view + */ + void closeOpenConversationView(); }; diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/inc/draftslistview.h --- a/messagingapp/msgui/msgapp/inc/draftslistview.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/inc/draftslistview.h Thu Jul 22 16:32:06 2010 +0100 @@ -153,11 +153,6 @@ DRAFTS_EXTN = 0x00, CONVERSATIONS_EXTN = 0x01 }; - /** - * Flag to track if item has been long pressed. - * TODO: Remove it, once unique longpress and click event signal released in week16 - */ - bool mItemLongPressed; }; #endif /* DRAFTS_LISTVIEW_H */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/inc/msgactivityhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgapp/inc/msgactivityhandler.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Handles saving and opening activites. + * + */ + +#ifndef MSGACTIVITYHANDLER_H_ +#define MSGACTIVITYHANDLER_H_ + +#include +#include + +class MsgMainWindow; +class MsgViewManager; + +class MsgActivityHandler: public QObject +{ +Q_OBJECT + +public: + /** + * Constructor + */ + MsgActivityHandler( QObject* parent = 0); + + /** + * Destructor. + */ + ~MsgActivityHandler(); + +public slots: + + /** + * Saves the current running activity. + */ + void saveActivity(); + +public: + /** + * Set the message main window pointer. + * @param mainWindow message main window. + */ + void setMainWindow(MsgMainWindow* mainWindow); + + /** + * Clears all saved messaging activities. + */ + void clearActivities(); + + /** + * Parses the activity data. + * @param activitry data. + * @return valid message Id if its editor activity + * else Invalid message id( i.e. -1) for list view activity + */ + int parseActivityData(const QVariant &activityData); + +private: + /** + * main window reference not owned. + */ + MsgMainWindow* mMainWindow; +}; + +#endif /* MSGACTIVITYHANDLER_H_ */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/inc/msglistview.h --- a/messagingapp/msgui/msgapp/inc/msglistview.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/inc/msglistview.h Thu Jul 22 16:32:06 2010 +0100 @@ -27,6 +27,8 @@ class HbListWidget; class HbListWidgetItem; class HbAction; +class QGraphicsLinearLayout; + /** * This class provides the message list view for the messaging application. * Data source for this view is the conversation list model. @@ -115,6 +117,13 @@ */ void onDialogDeleteMsg(HbAction* action); + /** + * This slot is called when appengine emits the partialdeleteconversationlist event. + * This performs grab of the HbAbstractviewitem on which delete was called. + * @param conversation id of the item. + */ + void enableListitem( int conversationId ); + private: /** @@ -154,10 +163,10 @@ }; /** - * Flag to track if item has been long pressed. - * TODO: Remove it, once unique longpress and click event signal released in week16 - */ - bool mItemLongPressed; + * Main layout + * Own + */ + QGraphicsLinearLayout *mMainLayout; }; #endif // MSG_LIST_VIEW_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/inc/msglistviewitem.h --- a/messagingapp/msgui/msgapp/inc/msglistviewitem.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/inc/msglistviewitem.h Thu Jul 22 16:32:06 2010 +0100 @@ -76,21 +76,26 @@ private: /** - * Returns the preview text based on message type, sub type and state. + * Create permanent items. + */ + void initItems(); + + /** + * Returns the preview text based on message type, sub type. + * Also sets the indicator icon. * @return QString */ - QString previewText(int msgType, int msgSubType, int msgState,int msgDirection); + QString defaultPreviewText(int msgType, int msgSubType); /** - * return the preview text based on state. - * @return bool + * Sets the preview text and timestamp. */ - QString textBySendState(int sendState,int msgDirection); - + void setTimestampAndPreviewText(); + private: /** - * Property to change the color of text - */ + * Property to change the color of text + */ bool mUnReadMsg; /** diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/inc/msgmainwindow.h --- a/messagingapp/msgui/msgapp/inc/msgmainwindow.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/inc/msgmainwindow.h Thu Jul 22 16:32:06 2010 +0100 @@ -40,18 +40,23 @@ /** * Constructor */ - MsgMainWindow(bool serviceRequest, QWidget *parent = 0); + MsgMainWindow(bool serviceRequest, + int activityMsgId = -1, + QWidget *parent = 0); /** * Destructor */ virtual ~MsgMainWindow(); - + /** + * Returns view manager. + */ + MsgViewManager* viewManager(); private: MsgServiceInterface* mMsgSI; MsgSendServiceInterface* mMsgSendSI; - + MsgViewManager* mViewManager; }; #endif // MSG_MAIN_WINDOW_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/inc/msgserviceinterface.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/inc/msgviewmanager.h --- a/messagingapp/msgui/msgapp/inc/msgviewmanager.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/inc/msgviewmanager.h Thu Jul 22 16:32:06 2010 +0100 @@ -20,6 +20,7 @@ #define MSGVIEWMANAGER_H_ #include +#include #include class HbMainWindow; @@ -32,6 +33,7 @@ class MsgSettingsView; class HbAction; class HbView; +class MsgAudioFetcherView; class MsgViewManager: public QObject { @@ -41,7 +43,8 @@ /** * constructor */ - MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent = 0); + MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, + QObject* parent = 0,int activityMsgId = -1); /** * Destructor. @@ -84,6 +87,15 @@ */ void view(int msgId); + /** + * Returns the current active view. + */ + int currentView(); + + /** + * Saves the content of editor or Cv to draft. + */ + int saveContentToDraft(); private: /** * swiches back to last view after service request is complete. @@ -158,6 +170,29 @@ * Appends the views to be deleted into a QList to be deleted when view is ready */ void appendViewToBeDeleted(HbView* view); + + /** + * Save the editor data to be populated + * @param editorData QVariantList + */ + void populateUniEditorAfterViewReady(const QVariantList& editorData); + + /** + * Launch Audio fetcher view + */ + void switchToAudioFetcher(const QVariantList& data); + + /** + * opens unieditor as activity. + * @param activityMsgId activity msg id. + */ + void openUniEditorActivity(int activityMsgId); + + /** + * find contact id corresponding to given phone no. + * @param phoneNum + */ + qint32 findContactId(const QString address); private slots: /** @@ -191,6 +226,11 @@ * @param action selected action (yes or no). */ void onDialogSaveTone(HbAction* action); + + /** + * When this slot is called the saved editor data is set to the editor + */ + void populateUniEditorView(); private: /** @@ -207,6 +247,7 @@ UnifiedViewer* mUniViewer; DraftsListView* mDraftsListView; MsgSettingsView* mSettingsView; + MsgAudioFetcherView* mAudioFetcherView; HbAction* mBackAction; int mPreviousView; @@ -218,6 +259,8 @@ QList mViewTobeDeleted; HbView* mDummyview; int mMessageId; + + QVariantList mEditorData; }; #endif /* MSGVIEWMANAGER_H_ */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/messaging_service.xml diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/msgapp.pro --- a/messagingapp/msgui/msgapp/msgapp.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/msgapp.pro Thu Jul 22 16:32:06 2010 +0100 @@ -17,28 +17,31 @@ TEMPLATE = app TARGET = messaging101 -ICON = resources/icons/qtg_large_message.svg - DEPENDPATH += . inc src ../inc INCLUDEPATH += . INCLUDEPATH += ../inc INCLUDEPATH += ../../../inc +INCLUDEPATH += ../msgaudiofetcher/inc INCLUDEPATH += ../unifiededitor/inc INCLUDEPATH += ../appengine/inc INCLUDEPATH += ../conversationview/inc INCLUDEPATH += ../unifiedviewer/inc INCLUDEPATH += ../../msgsettings/settingsview/inc +INCLUDEPATH += ../../smartmessaging/ringbc/inc + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE -INCLUDEPATH += /ext/mw/qtextensions/qtmobileextensions/include -INCLUDEPATH += ../../smartmessaging/ringbc/inc CONFIG += hb service QT += sql -TARGET.UID3 = 0x2001FE79 -TARGET.CAPABILITY = All -TCB -TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 +symbian { + TARGET.UID3 = 0x2001FE79 + TARGET.CAPABILITY = All -TCB + TARGET.EPOCSTACKSIZE = 0x14000 + TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 + SKINICON = qtg_large_message +} # Platforms SYMBIAN_PLATFORMS = WINSCW ARMV5 @@ -51,8 +54,12 @@ "sis/msgapp_stub.sis /epoc32/data/z/system/install/msgapp_stub.sis" \ "rom/messaging_uda.confml CONFML_EXPORT_PATH(messaging_uda.confml,uda_content)" \ "rom/messaging_uda_copy.implml CRML_EXPORT_PATH(messaging_uda_copy.implml,uda_content)" \ - "rom/private.zip CRML_EXPORT_PATH(../content/zip/,uda_content)" - + "rom/private.zip CRML_EXPORT_PATH(../content/zip/,uda_content)" \ + "resources/xml/messaging101.docml /epoc32/data/z/resource/hb/splashml/messaging101.docml" \ + "resources/xml/messaging101.splashml /epoc32/data/z/resource/hb/splashml/messaging101.splashml" \ + "resources/xml/messaging101_dummy.docml /epoc32/data/z/resource/hb/splashml/messaging101_dummy.docml" \ + "resources/xml/messaging101_dummy.splashml /epoc32/data/z/resource/hb/splashml/messaging101_dummy.splashml" + # Input HEADERS += msgmainwindow.h \ msglistview.h \ @@ -62,7 +69,8 @@ msgviewmanager.h \ msgbaseview.h \ msgsendserviceinterface.h \ - msgserviceinterface.h + msgserviceinterface.h \ + msgactivityhandler.h SOURCES += main.cpp \ msgmainwindow.cpp \ @@ -72,7 +80,8 @@ msgutils.cpp \ msgviewmanager.cpp \ msgsendserviceinterface.cpp \ - msgserviceinterface.cpp + msgserviceinterface.cpp \ + msgactivityhandler.cpp RESOURCES += msgapp.qrc @@ -93,6 +102,6 @@ -lQtContacts \ -lsettingsview \ -lringbc \ - -lunidatamodelloader - + -lunidatamodelloader \ + -lmsgaudiofetcher diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/msgapp.qrc diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/resources/icons/qtg_large_message.svg --- a/messagingapp/msgui/msgapp/resources/icons/qtg_large_message.svg Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/resources/xml/messaging101.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgapp/resources/xml/messaging101.docml Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/resources/xml/messaging101.splashml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgapp/resources/xml/messaging101.splashml Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,7 @@ + + clv + messaging101.docml + view + 0x2001FE79 + Messaging + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/resources/xml/messaging101_dummy.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgapp/resources/xml/messaging101_dummy.docml Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/resources/xml/messaging101_dummy.splashml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgapp/resources/xml/messaging101_dummy.splashml Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,7 @@ + + dummy + messaging101_dummy.docml + view + 0x2001FE79 + Messaging + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/resources/xml/msglistviewitem.css diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/resources/xml/msglistviewitem.widgetml diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/resources/xml/msglistviewitem_color.css --- a/messagingapp/msgui/msgapp/resources/xml/msglistviewitem_color.css Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/resources/xml/msglistviewitem_color.css Thu Jul 22 16:32:06 2010 +0100 @@ -7,6 +7,10 @@ color: var(qtc_list_item_content_normal); } +MsgListViewItem[state="pressed"]::addressLabel { + color: var(qtc_list_item_pressed); +} + MsgListViewItem[unReadMsg="true"]::previewLabel { color: var(qtc_list_item_title_normal); } @@ -15,6 +19,10 @@ color: var(qtc_list_item_content_normal); } +MsgListViewItem[state="pressed"]::previewLabel { + color: var(qtc_list_item_pressed); +} + MsgListViewItem[unReadMsg="true"]::unreadCount { color: var(qtc_list_item_title_normal); } @@ -23,6 +31,10 @@ color: var(qtc_list_item_content_normal); } +MsgListViewItem[state="pressed"]::unreadCount { + color: var(qtc_list_item_pressed); +} + MsgListViewItem[unReadMsg="true"]::timeLabel { color: var(qtc_list_item_title_normal); } @@ -31,3 +43,11 @@ color: var(qtc_list_item_content_normal); } +MsgListViewItem[state="pressed"]::timeLabel { + color: var(qtc_list_item_pressed); +} + +MsgListViewItem::presenceIndicator { + color: var(qtc_list_item_title_normal); +} + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/rom/msgapp.iby --- a/messagingapp/msgui/msgapp/rom/msgapp.iby Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/rom/msgapp.iby Thu Jul 22 16:32:06 2010 +0100 @@ -19,8 +19,15 @@ file=ABI_DIR\UREL\messaging101.exe SHARED_LIB_DIR\messaging101.exe data=DATAZ_\private\10003a3f\import\apps\messaging101_reg.rsc private\10003a3f\import\apps\messaging101_reg.rsc -data=DATAZ_\resource\apps\0x2001FE79.mif resource\apps\0x2001FE79.mif +data=DATAZ_\resource\apps\messaging101.mif resource\apps\messaging101.mif data=DATAZ_\system\install\msgapp_stub.sis system\install\msgapp_stub.sis + + data=ZRESOURCE\hb\splashml\messaging101.splashml RESOURCE_FILES_DIR\hb\splashml\messaging101.splashml + data=ZRESOURCE\hb\splashml\messaging101.docml RESOURCE_FILES_DIR\hb\splashml\messaging101.docml + data=ZRESOURCE\hb\splashml\messaging101_dummy.splashml RESOURCE_FILES_DIR\hb\splashml\messaging101_dummy.splashml + data=ZRESOURCE\hb\splashml\messaging101_dummy.docml RESOURCE_FILES_DIR\hb\splashml\messaging101_dummy.docml + + #endif // __MSGAPP_IBY__ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/src/draftslistview.cpp --- a/messagingapp/msgui/msgapp/src/draftslistview.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/src/draftslistview.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -66,8 +66,6 @@ // 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_BUTTON_DELETE hbTrId("txt_common_button_delete") -#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") //--------------------------------------------------------------- // DraftsListView::DraftsListView @@ -77,8 +75,7 @@ MsgBaseView(parent), mListView(0), mViewExtnList(0), - mToolBar(0), - mItemLongPressed(false) + mToolBar(0) { // Delayed loading. connect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(doDelayedLoading())); @@ -123,6 +120,7 @@ viewAction->setIcon(HbIcon(SORT_ICON)); mViewExtnList = new HbListWidget(); + mViewExtnList->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed); mViewExtnList->addItem(LOC_TB_EXTN_DRAFTS); mViewExtnList->addItem(LOC_TB_EXTN_CONVERSATIONS); @@ -231,8 +229,8 @@ } HbMessageBox::question(LOC_DELETE_MESSAGE, - this,SLOT(onDialogDeleteMsg(HbAction*)), - LOC_BUTTON_DELETE, LOC_BUTTON_CANCEL); + this,SLOT(onDialogDeleteMsg(HbAction*)), + HbMessageBox::Delete | HbMessageBox::Cancel); } @@ -243,9 +241,8 @@ void DraftsListView::deleteAllDraftMessage() { HbMessageBox::question(LOC_DELETE_ALL_DRAFTS, - this,SLOT(onDialogDeleteAllMessages(HbAction*)), - LOC_BUTTON_DELETE, - LOC_BUTTON_CANCEL); + this,SLOT(onDialogDeleteAllMessages(HbAction*)), + HbMessageBox::Delete | HbMessageBox::Cancel); } //------------------------------------------------------------------------------ @@ -267,12 +264,6 @@ //------------------------------------------------------------------------------ void DraftsListView::openDraftMessage(const QModelIndex &index) { - if(mItemLongPressed) - { - //reset the flag - mItemLongPressed = false; - return; - } QVariant msgId = index.data(ConvergedMsgId); QVariant msgType = index.data(MessageType); ConvergedMessageId convergedMsgId = ConvergedMessageId(msgId.toInt()); @@ -299,7 +290,6 @@ //------------------------------------------------------------------------------ void DraftsListView::handleLongPressed(HbAbstractViewItem *item, const QPointF &coords) { - mItemLongPressed = true; if (this->isVisible()) { // Set the current index as tapped items index. diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/src/main.cpp --- a/messagingapp/msgui/msgapp/src/main.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/src/main.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -22,13 +22,18 @@ #include "debugtraces.h" #include #include +#include #include "msgmainwindow.h" +#include "msgactivityhandler.h" //Localised constants #define LOC_TITLE hbTrId("txt_messaging_title_messaging") const QString debugFileName("c:/art2_app_log.txt"); +const QString activityParam("-activity"); +const int INVALID_MSGID = -1; + #ifdef _DEBUG_TRACES_ void debugInit(QtMsgType type, const char *msg) { @@ -74,6 +79,22 @@ #endif int main(int argc, char *argv[]) { + + QCRITICAL_WRITE("MsgApp start."); + + QString firstArg(argv[1]); + bool serviceRequest = false; + // check for argc is greater than 1 and its not from activity + if(argc >1 && firstArg != activityParam ) + { + serviceRequest = true; + HbSplashScreen::setScreenId("dummy"); + } + else + { + HbSplashScreen::setScreenId("clv"); + } + // Application HbApplication app(argc, argv); @@ -81,12 +102,11 @@ 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(path + QString("messaging_") + locale); + translator_comm.load(path + QString("common_") + locale); app.installTranslator(&translator); - //app.installTranslator(&translator_comm); + app.installTranslator(&translator_comm); app.setApplicationName(LOC_TITLE); @@ -99,20 +119,38 @@ } qInstallMsgHandler(debugInit); #endif - bool serviceRequest = false; - if(argc >1) - { - serviceRequest = true; + + + + MsgActivityHandler* activityHandler = new MsgActivityHandler(&app); + // connect to aboutToQuit signal to save activity + QObject::connect(&app, SIGNAL(aboutToQuit()), + activityHandler, SLOT(saveActivity())); + + int activityMsgId = INVALID_MSGID; + if(app.activateReason() == Hb::ActivationReasonActivity) { + // restoring an activity, not a fresh startup or a service + QVariant data = app.activateData(); + activityMsgId = activityHandler->parseActivityData(data); + // set service request to false , since its a activity launch + serviceRequest = false; } + // clear the old activities + activityHandler->clearActivities(); + // Main window - QPointer mainWindow = new MsgMainWindow(serviceRequest); + QPointer mainWindow = new MsgMainWindow(serviceRequest,activityMsgId); + // Set the main window pointer to activity handler. + activityHandler->setMainWindow(mainWindow); mainWindow->show(); // Event loop int error = app.exec(); - + HbApplication::processEvents(); + // delete main window and return error delete mainWindow; + return error; } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/src/msgactivityhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgapp/src/msgactivityhandler.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Handles saving and opening activites. + * + */ + +#include "msgactivityhandler.h" + +#include "msgviewmanager.h" +#include "msgbaseview.h" +#include "msgmainwindow.h" +#include +#include +#include + +const int INVALID_MSGID = -1; +// Activity Names +const QString ListViewActivityName("MsgConversationsList"); +const QString EditorActivityName("MsgCreate"); + +//----------------------------------------------------------------------------- +// MsgActivityHandler::MsgActivityHandler +// Constructor +//----------------------------------------------------------------------------- +MsgActivityHandler::MsgActivityHandler(QObject* parent): + QObject(parent) +{ + +} + +//----------------------------------------------------------------------------- +// MsgActivityHandler::MsgActivityHandler +// Destructor +//----------------------------------------------------------------------------- +MsgActivityHandler::~MsgActivityHandler() +{ + +} + +//----------------------------------------------------------------------------- +// MsgActivityHandler::saveActivity +// @see header +//----------------------------------------------------------------------------- +void MsgActivityHandler::saveActivity() +{ + HbActivityManager* activityManager = + qobject_cast(qApp)->activityManager(); + + int currentView = mMainWindow->viewManager()->currentView(); + int msgId = INVALID_MSGID; + if((currentView == MsgBaseView::CV) || (currentView== MsgBaseView::UNIEDITOR)) + { + msgId = mMainWindow->viewManager()->saveContentToDraft(); + } + + // get a screenshot for saving to the activity manager + QVariantHash metadata; + metadata.insert("screenshot", + QPixmap::grabWidget(mMainWindow, mMainWindow->rect())); + + // save any data necessary to save the state + QByteArray serializedActivity; + QDataStream stream(&serializedActivity, + QIODevice::WriteOnly | QIODevice::Append); + + if( msgId != INVALID_MSGID) + { + stream << EditorActivityName; + stream << msgId; + + // add the activity to the activity manager + bool ok = activityManager->addActivity(EditorActivityName, + serializedActivity, metadata); + } + else + { + stream << ListViewActivityName; + + // add the activity to the activity manager + bool ok = activityManager->addActivity(ListViewActivityName, + serializedActivity, metadata); + } +} + +//----------------------------------------------------------------------------- +// MsgActivityHandler::parseActivityData +// @see header +//----------------------------------------------------------------------------- +int MsgActivityHandler::parseActivityData(const QVariant &activityData) +{ + QByteArray serializedModel = activityData.toByteArray(); + QDataStream stream(&serializedModel, QIODevice::ReadOnly); + + QString activityName; + int msgId = INVALID_MSGID; + stream >> activityName; + if( activityName == EditorActivityName) + { + stream >> msgId; + } + return msgId; +} + +//----------------------------------------------------------------------------- +// MsgActivityHandler::clearActivities +// @see header +//----------------------------------------------------------------------------- +void MsgActivityHandler::clearActivities() +{ + HbActivityManager* activityManager = + qobject_cast(qApp)->activityManager(); + activityManager->removeActivity(ListViewActivityName); + activityManager->removeActivity(EditorActivityName); +} + +//----------------------------------------------------------------------------- +// MsgActivityHandler::setMainWindow +// @see header +//----------------------------------------------------------------------------- +void MsgActivityHandler::setMainWindow(MsgMainWindow* mainWindow) +{ + mMainWindow = mainWindow; +} diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/src/msglistview.cpp --- a/messagingapp/msgui/msgapp/src/msglistview.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/src/msglistview.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -60,10 +60,7 @@ #define LOC_OPEN hbTrId("txt_common_menu_open") #define LOC_SAVETO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts") #define LOC_DELETE_CONVERSATION hbTrId("txt_messaging_menu_delete_conversation") -#define LOC_OPEN_CONTACT_INFO hbTrId("txt_messaging_menu_open_contact_info") - -#define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete") -#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") +#define LOC_OPEN_CONTACT_INFO hbTrId("txt_messaging_menu_contact_info") //main menu #define LOC_SETTINGS hbTrId("txt_messaging_opt_settings") @@ -80,11 +77,29 @@ // @see header //--------------------------------------------------------------- MsgListView::MsgListView(QGraphicsItem *parent) : - MsgBaseView(parent), - mItemLongPressed(false) -{ - connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction())); -} + MsgBaseView(parent) + { + //These changes are needed for splash implementation to avoid flicker + setupToolBar(); + setupMenu(); + + // Create parent layout. + mMainLayout = new QGraphicsLinearLayout(Qt::Vertical); + mMainLayout->setContentsMargins(0, 0, 0, 0); + mMainLayout->setSpacing(0); + + // Create view heading. + HbGroupBox *viewHeading = new HbGroupBox(); + viewHeading->setHeading(LOC_VIEW_HEADING); + + // Add view heading widget to main layout. + mMainLayout->addItem(viewHeading); + + this->setLayout(mMainLayout); + + connect(this->mainWindow(), SIGNAL(viewReady()), this, + SLOT(doDelayedConstruction())); + } //--------------------------------------------------------------- // MsgListView::~MsgListView @@ -101,7 +116,6 @@ //--------------------------------------------------------------- void MsgListView::longPressed(HbAbstractViewItem* viewItem, const QPointF& point) { - mItemLongPressed = true; if (this->isVisible()) { // Set the current index as the present Item's index. // By default it will not be set. @@ -144,11 +158,6 @@ //--------------------------------------------------------------- void MsgListView::openConversation(const QModelIndex& index) { - if(mItemLongPressed) - { - mItemLongPressed = false; - return; - } //TODO: model populating possibilities. if (index.isValid()) { QVariant conversationId = index.data(ConversationId); @@ -219,8 +228,8 @@ #endif //confirmation dialog. HbMessageBox::question(LOC_DIALOG_DELETE_CONVERSATION, - this,SLOT(onDialogDeleteMsg(HbAction*)), - LOC_BUTTON_DELETE, LOC_BUTTON_CANCEL); + this,SLOT(onDialogDeleteMsg(HbAction*)), + HbMessageBox::Delete | HbMessageBox::Cancel); #ifdef _DEBUG_TRACES_ qDebug() << " Leaving MsgConversationView::deleteItem"; #endif @@ -231,16 +240,7 @@ // @see header //--------------------------------------------------------------- void MsgListView::setupListView() -{ - // Create parent layout. - QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical); - mainLayout->setContentsMargins(0, 0, 0, 0); - mainLayout->setSpacing(0); - - // Create view heading. - HbGroupBox *viewHeading = new HbGroupBox(); - viewHeading->setHeading(LOC_VIEW_HEADING); - + { // Register the custorm css path. HbStyleLoader::registerFilePath(":/clv"); @@ -250,37 +250,29 @@ mMsgList->setLayoutName("custom"); mMsgList->setItemRecycling(true); - mMsgList->setUniformItemSizes(true); + mMsgList->setUniformItemSizes(true); MsgListViewItem *prototype = new MsgListViewItem(this); mMsgList->setItemPrototype(prototype); - - // Set proxy model - QSortFilterProxyModel* proxyModel = new QSortFilterProxyModel(this); - proxyModel->setDynamicSortFilter(true); - proxyModel->setSourceModel(ConversationsEngine::instance()->getConversationsSummaryModel()); - proxyModel->setSortRole(TimeStamp); - proxyModel->sort(0, Qt::DescendingOrder); - - mMsgList->setModel(proxyModel); - - connect(ConversationsEngine::instance(), SIGNAL(conversationListModelPopulated()), - this, SLOT(populateListView())); - + mMsgList->setModel(ConversationsEngine::instance()->getConversationsSummaryModel()); + // Single tap list item - connect(mMsgList, SIGNAL(activated(const QModelIndex&)), - this, SLOT(openConversation(const QModelIndex&))); + connect(mMsgList, SIGNAL(activated(const QModelIndex&)), this, + SLOT(openConversation(const QModelIndex&))); // Long tap list item - connect(mMsgList, SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)), - this, SLOT(longPressed(HbAbstractViewItem*, const QPointF&))); + connect(mMsgList, + SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)), this, + SLOT(longPressed(HbAbstractViewItem*, const QPointF&))); - // Add all widgets to main layout. - mainLayout->addItem(viewHeading); - mainLayout->addItem(mMsgList); + // enable tap after delete is completed + connect(ConversationsEngine::instance(), + SIGNAL(conversationListEntryDeleted( int )), this, + SLOT(enableListitem( int ))); - this->setLayout(mainLayout); -} + // Add list view to main layout. + mMainLayout->addItem(mMsgList); + } //--------------------------------------------------------------- // MsgListView::addMenu @@ -309,6 +301,7 @@ viewAction->setIcon(HbIcon(SORT_ICON)); mViewExtnList = new HbListWidget(); + mViewExtnList->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed); mViewExtnList->addItem(LOC_TB_EXTN_DRAFTS); mViewExtnList->addItem(LOC_TB_EXTN_CONVERSATIONS); @@ -347,10 +340,8 @@ // @see header //--------------------------------------------------------------- void MsgListView::doDelayedConstruction() - { - setupToolBar(); + { setupListView(); - setupMenu(); disconnect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction())); } @@ -425,17 +416,46 @@ // @see header //--------------------------------------------------------------- void MsgListView::onDialogDeleteMsg(HbAction* action) -{ + { HbMessageBox *dlg = qobject_cast (sender()); - if (action == dlg->actions().at(0)) { - QModelIndex index = mMsgList->currentIndex(); - if(index.isValid()) + if (action == dlg->actions().at(0)) { + QModelIndex index = mMsgList->currentIndex(); + if (index.isValid()) + { + HbAbstractViewItem *item = mMsgList->currentViewItem(); + item->ungrabGesture(Qt::TapGesture); qint64 conversationId = index.data(ConversationId).toLongLong(); - ConversationsEngine::instance()->deleteConversations(conversationId); + + ConversationsEngine::instance()->deleteConversations( + conversationId); + + } + } - } -} + +//--------------------------------------------------------------- +// MsgListView::enableListitem +// @see header +//--------------------------------------------------------------- +void MsgListView::enableListitem(int conversationId) + { + QAbstractItemModel* proxyModel = mMsgList->model(); + QModelIndexList indexList = proxyModel->match(proxyModel->index(0, 0), + ConversationId, conversationId, 1, Qt::MatchExactly); + HbAbstractViewItem* item = NULL; + int count = indexList.count(); + // only item is expected to be the result of the above match function + if (1 == count) + { + item = mMsgList->itemByIndex(indexList[0]); + if (item) + { + item->grabGesture(Qt::TapGesture); + } + } + + } //EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/src/msglistviewitem.cpp --- a/messagingapp/msgui/msgapp/src/msglistviewitem.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/src/msglistviewitem.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include "msgcommondefines.h" #include "conversationsengine.h" @@ -78,49 +80,13 @@ //--------------------------------------------------------------- void MsgListViewItem::updateChildItems() { - if (!mAddressLabelItem) - { - mAddressLabelItem = new HbTextItem(this); - HbStyle::setItemName(mAddressLabelItem, "addressLabel"); - } - if (!mTimestampItem) - { - mTimestampItem = new HbTextItem(this); - HbStyle::setItemName(mTimestampItem, "timeLabel"); - } - if (!mPreviewLabelItem) - { - mPreviewLabelItem = new HbTextItem(this); - mPreviewLabelItem->setTextWrapping(Hb::TextWordWrap); - HbStyle::setItemName(mPreviewLabelItem, "previewLabel"); - } - if (!mUnreadCountItem) - { - mUnreadCountItem = new HbTextItem(this); - HbStyle::setItemName(mUnreadCountItem, "unreadCount"); - } - if (!mNewMsgIndicatorItem) - { - mNewMsgIndicatorItem = new HbFrameItem(this); - HbStyle::setItemName(mNewMsgIndicatorItem, "newMsgIndicator"); + initItems(); - mNewMsgIndicatorItem->frameDrawer().setFrameType( - HbFrameDrawer::ThreePiecesVertical); - } - - // Set the message text depending upon the message type - int messageType = modelIndex().data(MessageType).toInt(); - int messageSubType = modelIndex().data(MessageSubType).toInt(); - int messageState = modelIndex().data(SendingState).toInt(); - int messageDirection = modelIndex().data(Direction).toInt(); - QString prevText; - prevText = previewText(messageType, messageSubType, messageState,messageDirection); - prevText.replace(QChar::ParagraphSeparator, QChar::LineSeparator); - prevText.replace('\r', QChar::LineSeparator); - mPreviewLabelItem->setText(prevText); + setTimestampAndPreviewText(); // Address label QString contactName; + int messageType = modelIndex().data(MessageType).toInt(); if(messageType == ConvergedMessage::BT) { contactName = LOC_RECEIVED_FILES; @@ -129,15 +95,7 @@ { QString displayName = modelIndex().data(DisplayName).toString(); QString contactAddress = modelIndex().data(ConversationAddress).toString(); - - if (displayName.isEmpty()) - { - contactName.append(contactAddress); - } - else - { - contactName.append(displayName); - } + contactName.append(displayName); } mAddressLabelItem->setText(contactName); @@ -148,33 +106,76 @@ { QString unRead(tr("(%n)", "", unreadCount)); mUnreadCountItem->setText(unRead); - mUnReadMsg = true; - mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(NEW_ITEM_FRAME); + 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()); - mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(QString()); - mUnReadMsg = false; - repolish(); + 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(); } //--------------------------------------------------------------- -// MsgListViewItem::previewText +// MsgListViewItem::initItems // @see header //--------------------------------------------------------------- -QString MsgListViewItem::previewText(int msgType, - int msgSubType, - int msgState, - int msgDirection) +void MsgListViewItem::initItems() +{ + if (!mAddressLabelItem) { + mAddressLabelItem = new HbTextItem(this); + HbStyle::setItemName(mAddressLabelItem, "addressLabel"); + } + if (!mTimestampItem) { + mTimestampItem = new HbTextItem(this); + HbStyle::setItemName(mTimestampItem, "timeLabel"); + } + if (!mPreviewLabelItem) { + mPreviewLabelItem = new HbTextItem(this); + mPreviewLabelItem->setTextWrapping(Hb::TextWordWrap); + HbStyle::setItemName(mPreviewLabelItem, "previewLabel"); + } + if (!mUnreadCountItem) { + mUnreadCountItem = new HbTextItem(this); + HbStyle::setItemName(mUnreadCountItem, "unreadCount"); + } + if (!mNewMsgIndicatorItem) { + mNewMsgIndicatorItem = new HbFrameItem(this); + HbStyle::setItemName(mNewMsgIndicatorItem, "newMsgIndicator"); + + mNewMsgIndicatorItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); + } + if (!mPresenceIndicatorItem) { + mPresenceIndicatorItem = new HbIconItem(this); + HbStyle::setItemName(mPresenceIndicatorItem, "presenceIndicator"); + } +} +//--------------------------------------------------------------- +// MsgListViewItem::defaultPreviewText +// @see header +//--------------------------------------------------------------- +QString MsgListViewItem::defaultPreviewText(int msgType, int msgSubType) { QString bodyText(modelIndex().data(BodyText).toString()); QString previewText; // Set the message text & icons, depending upon the message type if (msgType == ConvergedMessage::BioMsg) { + if (msgSubType == ConvergedMessage::RingingTone) { previewText = LOC_RINGING_TONE; } @@ -184,14 +185,19 @@ previewText.append(bodyText); } else if (msgSubType == ConvergedMessage::Provisioning) { - previewText = bodyText; - } + previewText = bodyText; + } + else if (msgSubType == ConvergedMessage::NokiaService) { + previewText = bodyText; + } else { previewText = LOC_UNSUPPORTED_MSG_TYPE; } + + mPresenceIndicatorItem->setVisible(false); } else if (msgType == ConvergedMessage::BT) { - + if (msgSubType == ConvergedMessage::VCard) { previewText = LOC_BUSINESS_CARD; previewText.append(QChar::LineSeparator); @@ -200,26 +206,26 @@ else { previewText = bodyText; } - if (!mPresenceIndicatorItem) { - mPresenceIndicatorItem = new HbIconItem(this); - HbStyle::setItemName(mPresenceIndicatorItem, "presenceIndicator"); - mPresenceIndicatorItem->setIconName(BT_ICON); - } + + mPresenceIndicatorItem->setIconName(BT_ICON); + mPresenceIndicatorItem->setVisible(true); } else { - previewText = textBySendState(msgState,msgDirection); + // All message types except BIO & BT. + previewText = modelIndex().data(BodyText).toString(); + mPresenceIndicatorItem->setVisible(false); } return previewText; } //--------------------------------------------------------------- -// MsgListViewItem::textBySendState +// MsgListViewItem::setTimestampAndPreviewText // @see header //--------------------------------------------------------------- -QString MsgListViewItem::textBySendState(int sendState,int msgDirection) +void MsgListViewItem::setTimestampAndPreviewText() { - QString previewText; + // Get timestamp QDateTime dateTime; dateTime.setTime_t(modelIndex().data(TimeStamp).toUInt()); QString dateString; @@ -230,80 +236,55 @@ dateString = MsgUtils::dateTimeToString(dateTime, DATE_FORMAT); } - if (msgDirection == ConvergedMessage::Outgoing) - { - switch (sendState) - { - case ConvergedMessage::Resend: - { - - QString resendString = LOC_MSG_RESEND_AT + dateString; - previewText = resendString; - dateString = QString(""); - if (!mPresenceIndicatorItem) - { - mPresenceIndicatorItem = new HbIconItem(this); - } - HbStyle::setItemName(mPresenceIndicatorItem, - "presenceIndicator"); - mPresenceIndicatorItem->setIconName(MSG_OUTGOING_ICON); - mPresenceIndicatorItem->setVisible(true); - break; - } + // Set preview text & time based on direction + int msgType = modelIndex().data(MessageType).toInt(); + int msgSubType = modelIndex().data(MessageSubType).toInt(); + int sendState = modelIndex().data(SendingState).toInt(); + int msgDirection = modelIndex().data(Direction).toInt(); + QString previewText; + if (ConvergedMessage::Incoming == msgDirection) { + previewText = defaultPreviewText(msgType, msgSubType); + } + else if (msgDirection == ConvergedMessage::Outgoing) { - case ConvergedMessage::Sending: - case ConvergedMessage::Suspended: - case ConvergedMessage::Scheduled: - case ConvergedMessage::Waiting: - { - previewText = QString(LOC_MSG_OUTGOING); - if (!mPresenceIndicatorItem) - { - mPresenceIndicatorItem = new HbIconItem(this); - } - HbStyle::setItemName(mPresenceIndicatorItem, - "presenceIndicator"); - mPresenceIndicatorItem->setIconName(MSG_OUTGOING_ICON); - mPresenceIndicatorItem->setVisible(true); - break; - } - case ConvergedMessage::Failed: - { - previewText = QString(LOC_MSG_SEND_FAILED); - if (!mPresenceIndicatorItem) - { - mPresenceIndicatorItem = new HbIconItem(this); - } - HbStyle::setItemName(mPresenceIndicatorItem, - "presenceIndicator"); - mPresenceIndicatorItem->setIconName(MSG_FAILED_ICON); - mPresenceIndicatorItem->setVisible(true); - break; - } - default: - QString postFix = QString(""); - previewText = modelIndex().data(BodyText).toString(); - previewText += (QChar(QChar::LineSeparator) + postFix); - - if (!mPresenceIndicatorItem) - { - mPresenceIndicatorItem = new HbIconItem(this); - } - - HbStyle::setItemName(mPresenceIndicatorItem, - "presenceIndicator"); - mPresenceIndicatorItem->setIconName(MSG_FAILED_ICON); - mPresenceIndicatorItem->setVisible(false); - - break; + switch (sendState) { + case ConvergedMessage::Resend: + { + previewText = LOC_MSG_RESEND_AT + dateString; + dateString = QString(); + mPresenceIndicatorItem->setIconName(MSG_OUTGOING_ICON); + mPresenceIndicatorItem->setVisible(true); + break; + } + case ConvergedMessage::Sending: + case ConvergedMessage::Suspended: + case ConvergedMessage::Scheduled: + case ConvergedMessage::Waiting: + { + previewText = QString(LOC_MSG_OUTGOING); + mPresenceIndicatorItem->setIconName(MSG_OUTGOING_ICON); + mPresenceIndicatorItem->setVisible(true); + break; + } + case ConvergedMessage::Failed: + { + previewText = QString(LOC_MSG_SEND_FAILED); + mPresenceIndicatorItem->setIconName(MSG_FAILED_ICON); + mPresenceIndicatorItem->setVisible(true); + break; + } + default: + { + // Successful case + previewText = defaultPreviewText(msgType, msgSubType); + break; + } } } - else - { - previewText = modelIndex().data(BodyText).toString(); - } + previewText.replace(QChar::ParagraphSeparator, QChar::LineSeparator); + previewText.replace('\r', QChar::LineSeparator); + mPreviewLabelItem->setText(previewText); mTimestampItem->setText(dateString); - return previewText; } //--------------------------------------------------------------- diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/src/msgmainwindow.cpp --- a/messagingapp/msgui/msgapp/src/msgmainwindow.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/src/msgmainwindow.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -28,12 +28,12 @@ // MsgMainWindow::MsgMainWindow // Constructor //--------------------------------------------------------------- -MsgMainWindow::MsgMainWindow(bool serviceRequest, QWidget *parent) : +MsgMainWindow::MsgMainWindow(bool serviceRequest,int activityMsgId,QWidget *parent) : HbMainWindow(parent), mMsgSI(0), mMsgSendSI(0) { - MsgViewManager* viewManager = new MsgViewManager(serviceRequest,this,this); - mMsgSI = new MsgServiceInterface(NULL,viewManager); - mMsgSendSI = new MsgSendServiceInterface(NULL,viewManager); + mViewManager = new MsgViewManager(serviceRequest,this,this,activityMsgId); + mMsgSI = new MsgServiceInterface(NULL,mViewManager); + mMsgSendSI = new MsgSendServiceInterface(NULL,mViewManager); //Model creation ConversationsEngine::instance(); @@ -60,4 +60,12 @@ delete ConversationsEngine::instance(); } +//--------------------------------------------------------------- +// MsgMainWindow::viewManager +// Constructor +//--------------------------------------------------------------- +MsgViewManager* MsgMainWindow::viewManager() +{ + return mViewManager; +} // End of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/src/msgserviceinterface.cpp --- a/messagingapp/msgui/msgapp/src/msgserviceinterface.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/src/msgserviceinterface.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -91,10 +91,11 @@ ContactDetail &contactDetail) { QString displayLabel = QString(""); + int count; int localId = MsgContactHandler::resolveContactDisplayName(address.address(), displayLabel, - 0); + count); if (localId != -1) { @@ -104,5 +105,5 @@ } return false; - } +} diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgapp/src/msgviewmanager.cpp --- a/messagingapp/msgui/msgapp/src/msgviewmanager.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgapp/src/msgviewmanager.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include "conversationsengine.h" @@ -39,20 +39,20 @@ #include "ringbc.h" #include "unidatamodelloader.h" #include "unidatamodelplugininterface.h" +#include "msgcontacthandler.h" +#include "debugtraces.h" +#include "msgaudiofetcherview.h" // LOCALIZATION -#define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete") -#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") #define LOC_DIALOG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone") -#define LOC_COMMON_SAVE hbTrId("txt_common_menu_save") const qint64 NULL_CONVERSATIONID = -1; -MsgViewManager::MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent) : +MsgViewManager::MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent,int activityMsgId) : QObject(parent), mMainWindow(mainWindow), mUniEditor(0), mListView(0), mConversationView(0), - mUniViewer(0), mDraftsListView(0), mSettingsView(0), mBackAction(0), mServiceRequest( - serviceRequest), mConversationId(-1), mViewServiceRequest(false),mMessageId(-1) + mUniViewer(0), mDraftsListView(0), mSettingsView(0), mAudioFetcherView(0), mBackAction(0), + mServiceRequest(serviceRequest), mConversationId(-1), mViewServiceRequest(false),mMessageId(-1) { //creating back action. mBackAction = new HbAction(Hb::BackNaviAction, this); @@ -60,10 +60,18 @@ //create clv as first view if not a service request. if (!mServiceRequest) { + + if(activityMsgId == NULL_CONVERSATIONID) + { QVariantList param; param << MsgBaseView::CLV; param << MsgBaseView::CLV; switchView(param); + } + else + { + openUniEditorActivity(activityMsgId); + } } else { @@ -77,6 +85,7 @@ MsgViewManager::~MsgViewManager() { // TODO Auto-generated destructor stub + mEditorData.clear(); } void MsgViewManager::onBackAction() @@ -102,6 +111,8 @@ case MsgBaseView::CV: { + mConversationId = -1; //reset the conversation view id since its closed + //Save content to drafts before switching to clv mConversationView->saveContentToDrafts(); @@ -110,7 +121,7 @@ // reset the conversation id published mConversationView->setPSCVId(false); - + //clearing content of cv. mConversationView->clearContent(); @@ -186,9 +197,18 @@ } else { QVariantList param; - param << MsgBaseView::CV; - param << MsgBaseView::UNIVIEWER; - param << mConversationId; + if (mConversationId != -1) + { + //this means CV is till open then just open the fresh CV + param << MsgBaseView::CV; + param << MsgBaseView::UNIVIEWER; + param << mConversationView->conversationId(); + } + else + { + param << MsgBaseView::CLV; + param << MsgBaseView::UNIVIEWER; + } switchView(param); } @@ -202,6 +222,19 @@ switchView(param); break; } + case MsgBaseView::AUDIOFETCHER: + { + // switch back to previous view + QVariantList param; + param << mPreviousView; + param << MsgBaseView::AUDIOFETCHER; + if(mPreviousView == MsgBaseView::CV) + { + param << mConversationId; + } + switchView(param); + break; + } default: { break; @@ -211,12 +244,10 @@ void MsgViewManager::switchView(const QVariantList& data) { - - connect(mMainWindow, SIGNAL(viewReady()),this,SLOT(setViewInteractive())); - mMainWindow->setInteractive(false); + QCRITICAL_WRITE("MsgViewManager::switchView start."); int viewId = data.at(0).toInt(); - + switch (viewId) { case MsgBaseView::DEFAULT: { @@ -259,7 +290,13 @@ switchToMsgSettings(data); break; } + case MsgBaseView::AUDIOFETCHER: + { + switchToAudioFetcher(data); + break; } + } + QCRITICAL_WRITE("MsgViewManager::switchView end."); } void MsgViewManager::deletePreviousView() @@ -270,7 +307,6 @@ mMainWindow->removeView(v); delete v; } - disconnect(mMainWindow, SIGNAL(viewReady()), this, SLOT(deletePreviousView())); } @@ -369,7 +405,7 @@ if (conversationId < 0) { param << MsgBaseView::CLV; param << MsgBaseView::SERVICE; - + if( mCurrentView == MsgBaseView::CV && mConversationView) { mConversationView->setPSCVId(false); @@ -449,22 +485,53 @@ void MsgViewManager::switchToClv(const QVariantList& data) { - //switch to CLV. - mCurrentView = MsgBaseView::CLV; mPreviousView = data.at(1).toInt(); - // delete case from viewer service + // delete case from viewer service if (mViewServiceRequest && (mPreviousView == MsgBaseView::UNIVIEWER)) { - // quit the application + // quit the application HbApplication::quit(); } + // this is the case when viewer/editor is opened and contacts update takes + // place resulting in CV close, the view should directly come to CLV + // bypassing the CV + if ((mCurrentView == MsgBaseView::UNIVIEWER + && mPreviousView != MsgBaseView::UNIVIEWER) + || (mCurrentView == MsgBaseView::UNIEDITOR + && mPreviousView != MsgBaseView::UNIEDITOR)) + { + //dont do anything + //wait for the back from viewer/editor + //and reset the open CV id + mConversationId = -1; + return; + } + + //delete UniEditor + if (mUniEditor) + { + appendViewToBeDeleted(mUniEditor); + mUniEditor = NULL; + } + + //delete UniViewer + if (mUniViewer) + { + appendViewToBeDeleted(mUniViewer); + mUniViewer = NULL; + } + if (mConversationView) { mConversationView->saveContentToDrafts(); //clearing content of cv. mConversationView->clearContent(); + //reset the open CV id + mConversationId = -1; } - + + //switch to CLV. + mCurrentView = MsgBaseView::CLV; if (!mListView) { mListView = new MsgListView(); mListView->setNavigationAction(mBackAction); @@ -474,20 +541,6 @@ } mMainWindow->setCurrentView(mListView); - - //delete UniEditor - if (mUniEditor) - { - appendViewToBeDeleted(mUniEditor); - mUniEditor = NULL; - } - - //delete UniViewer - if (mUniViewer) - { - appendViewToBeDeleted(mUniViewer); - mUniViewer = NULL; - } } void MsgViewManager::switchToCv(const QVariantList& data) @@ -498,44 +551,64 @@ // delete case from viewer service if (mViewServiceRequest && (mPreviousView == MsgBaseView::UNIVIEWER)) { - // quit the application + // quit the application HbApplication::quit(); } + // delete Audio Fetcher view + if(mAudioFetcherView) + { + appendViewToBeDeleted(mAudioFetcherView); + mAudioFetcherView = NULL; + } + + //delete UniEditor + if (mUniEditor) + { + appendViewToBeDeleted(mUniEditor); + mUniEditor = NULL; + } + + //delete UniViewer + if (mUniViewer) + { + appendViewToBeDeleted(mUniViewer); + mUniViewer = NULL; + } + QVariant var = data.at(2); qint64 conversationId; if (var.type() == QVariant::String) { QString phoneNumber = var.toString(); - conversationId = findConversationId(phoneNumber); + qint32 contactId = findContactId(phoneNumber); + if (contactId != -1) { + conversationId = ConversationsEngine::instance()->getConversationIdFromContactId(contactId); + } + else { + conversationId = findConversationId(phoneNumber); + } if (conversationId == NULL_CONVERSATIONID) { QVariantList param; param << MsgBaseView::CLV; param << MsgBaseView::CV; - + if( mCurrentView == MsgBaseView::CV && mConversationView){ mConversationView->setPSCVId(false); } - + switchView(param); return; } } else if (var.type() == QVariant::Invalid) { - // this case comes when a message is deleted from - // Unified viewer set curent view as conversation view + // this case comes when a message is deleted from + // Unified viewer set curent view as conversation view // and return mMainWindow->setCurrentView(mConversationView); - + // publish already opened conversation's id mConversationView->setPSCVId(true); - - if (mUniViewer) - { - appendViewToBeDeleted(mUniViewer); - mUniViewer = NULL; - } - return; } else { @@ -557,30 +630,10 @@ mConversationView->saveContentToDrafts(); //clearing content of current cv. mConversationView->clearContent(); - } + } mConversationView->openConversation(conversationId); - - if (mServiceRequest) { - mMainWindow->setCurrentView(mConversationView); - } - else { - mMainWindow->setCurrentView(mConversationView); - } - - //delete UniEditor - if (mUniEditor) - { - appendViewToBeDeleted(mUniEditor); - mUniEditor = NULL; - } - - //delete UniViewer - if (mUniViewer) - { - appendViewToBeDeleted(mUniViewer); - mUniViewer = NULL; - } + mMainWindow->setCurrentView(mConversationView); } void MsgViewManager::switchToDlv(const QVariantList& data) @@ -606,24 +659,43 @@ * Editor is tried to open again before exiting the previously * opened editor. Multi taping in DLV or Forward. */ - if (mUniEditor) { + if (mUniEditor && !mAudioFetcherView) + { return; } mCurrentView = MsgBaseView::UNIEDITOR; - mPreviousView = data.at(1).toInt(); + if(MsgBaseView::AUDIOFETCHER != data.at(1).toInt()) + { + mPreviousView = data.at(1).toInt(); + } - if (mConversationView) { + // delete Audio Fetcher view + if(mAudioFetcherView) + { + appendViewToBeDeleted(mAudioFetcherView); + mAudioFetcherView = NULL; + } + + // delete UniViewer + if (mUniViewer ) + { + appendViewToBeDeleted(mUniViewer); + mUniViewer = NULL; + } + + if (mConversationView) + { //clearing content of cv. mConversationView->clearContent(); } - // reset conversation id published - if(mPreviousView == MsgBaseView::CV && mConversationView) - { - mConversationView->setPSCVId(false); - } - + // reset conversation id published + if(mPreviousView == MsgBaseView::CV && mConversationView) + { + mConversationView->setPSCVId(false); + } + //swich to unieditor. if (!mUniEditor) { mUniEditor = new MsgUnifiedEditorView(); @@ -642,25 +714,15 @@ } if (MsgBaseView::DLV == mPreviousView) { - mUniEditor->openDraftsMessage(editorData); + //Populate editor after view ready indication + populateUniEditorAfterViewReady(editorData); } else { mUniEditor->populateContent(editorData); } } - if (mServiceRequest) { - mMainWindow->setCurrentView(mUniEditor); - } - else { - mMainWindow->setCurrentView(mUniEditor); - } - //delete UniViewer - if (mUniViewer ) - { - appendViewToBeDeleted(mUniViewer); - mUniViewer = NULL; - } + mMainWindow->setCurrentView(mUniEditor); } void MsgViewManager::switchToUniViewer(const QVariantList& data) @@ -679,29 +741,25 @@ //switch to univiewer. if (data.length() > 2) { qint32 contactId = data.at(2).toLongLong(); - QByteArray dataArray = data.at(3).toByteArray(); + qint32 messageId = data.at(3).toInt(); int msgCount = data.at(4).toInt(); + int canForwardMessage = data.at(5).toInt(); - ConvergedMessage *message = new ConvergedMessage; - QDataStream stream(&dataArray, QIODevice::ReadOnly); - message->deserialize(stream); - qint32 messageId = message->id()->getId(); if (!mUniViewer) { - mUniViewer = new UnifiedViewer(messageId); + mUniViewer = new UnifiedViewer(messageId, canForwardMessage); mUniViewer->setNavigationAction(mBackAction); mMainWindow->addView(mUniViewer); connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this, SLOT(switchView(const QVariantList&))); } mUniViewer->populateContent(messageId, true, msgCount); - delete message; } - + if(mPreviousView==MsgBaseView::CV && mConversationView) { mConversationView->setPSCVId(false); } - + mMainWindow->setCurrentView(mUniViewer); } void MsgViewManager::switchToMsgSettings(const QVariantList& data) @@ -710,14 +768,14 @@ mPreviousView = data.at(1).toInt(); if (!mSettingsView) { - + MsgSettingsView::SettingsView view = MsgSettingsView::DefaultView; if (mPreviousView == MsgBaseView::UNIEDITOR || mPreviousView == MsgBaseView::CV) { - view = (MsgSettingsView::SettingsView)data.at(2).toInt(); + view = (MsgSettingsView::SettingsView)data.at(2).toInt(); } - + mSettingsView = new MsgSettingsView(view); mSettingsView->setNavigationAction(mBackAction); mMainWindow->addView(mSettingsView); @@ -809,9 +867,9 @@ default: { // for un supported message show delete option - HbMessageBox::question(LOC_DELETE_MESSAGE,this,SLOT(onDialogDeleteMsg(HbAction*)), - LOC_BUTTON_DELETE, - LOC_BUTTON_CANCEL); + HbMessageBox::question(LOC_DELETE_MESSAGE,this, + SLOT(onDialogDeleteMsg(HbAction*)), + HbMessageBox::Delete | HbMessageBox::Cancel); break; } } @@ -847,7 +905,8 @@ { mMessageId = msgId; HbMessageBox::question(LOC_DIALOG_SAVE_RINGTONE, this, - SLOT(onDialogSaveTone(HbAction*)), LOC_COMMON_SAVE, LOC_BUTTON_CANCEL); + SLOT(onDialogSaveTone(HbAction*)), + HbMessageBox::Save | HbMessageBox::Cancel); } // ---------------------------------------------------------------------------- @@ -888,7 +947,7 @@ { mMainWindow->setInteractive(true); } - + disconnect(mMainWindow, SIGNAL(viewReady()),this,SLOT(setViewInteractive())); } @@ -897,11 +956,38 @@ if (view) { mViewTobeDeleted << view; - connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(deletePreviousView())); + connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(deletePreviousView()), Qt::UniqueConnection); } } // ---------------------------------------------------------------------------- +// MsgViewManager::populateEditorAfterViewReady +// @see header +// ---------------------------------------------------------------------------- +void MsgViewManager::populateUniEditorAfterViewReady(const QVariantList& editorData) + { + //Save the editor data and use it in ViewReady handler + mEditorData = editorData; + connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(populateUniEditorView())); + } + +// ---------------------------------------------------------------------------- +// MsgViewManager::populateUniEditorView +// @see header +// ---------------------------------------------------------------------------- +void MsgViewManager::populateUniEditorView() + { + if (mUniEditor) + { + mUniEditor->openDraftsMessage(mEditorData); + } + mEditorData.clear(); + + disconnect(mMainWindow, SIGNAL(viewReady()), this, + SLOT(populateUniEditorView())); +} + +// ---------------------------------------------------------------------------- // MsgViewManager::onDialogDeleteMsg // @see header // ---------------------------------------------------------------------------- @@ -948,3 +1034,124 @@ HbApplication::quit(); } +// ---------------------------------------------------------------------------- +// MsgViewManager::currentView +// @see header +// ---------------------------------------------------------------------------- +int MsgViewManager::currentView() + { + return mCurrentView; + } + +// ---------------------------------------------------------------------------- +// MsgViewManager::switchToAudioFetcher +// @see header +// ---------------------------------------------------------------------------- +void MsgViewManager::switchToAudioFetcher(const QVariantList& data) + { + /** + * Audio Fetcher is tried to open again + */ + if(mAudioFetcherView) + { + return; + } + + //switch to Audio Fetcher view + mCurrentView = MsgBaseView::AUDIOFETCHER; + mPreviousView = data.at(1).toInt(); + QVariantList editorData; + // i=2 because view manager consumed first two args + for (int i = 2; i < data.length(); i++) { + editorData << data.at(i); + } + mAudioFetcherView = new MsgAudioFetcherView(editorData); + mAudioFetcherView->setNavigationAction(mBackAction); + connect(mAudioFetcherView, SIGNAL(switchView(const QVariantList&)), this, + SLOT(switchView(const QVariantList&))); + + if(mPreviousView==MsgBaseView::CV && mConversationView) + { + mConversationView->setPSCVId(false); + } + + mMainWindow->addView(mAudioFetcherView); + mMainWindow->setCurrentView(mAudioFetcherView); + } + +// ---------------------------------------------------------------------------- +// MsgViewManager::saveContentToDraft +// @see header +// ---------------------------------------------------------------------------- +int MsgViewManager::saveContentToDraft() + { + int msgId = NULL_CONVERSATIONID; + if( mCurrentView == MsgBaseView::CV ) + { + msgId = mConversationView->saveContentToDrafts(); + } + else if( mCurrentView ==MsgBaseView::UNIEDITOR) + { + msgId = mUniEditor->saveContentToDrafts(); + } + return msgId; + } + +// ---------------------------------------------------------------------------- +// MsgViewManager::saveContentToDraft +// @see header +// ---------------------------------------------------------------------------- +void MsgViewManager::openUniEditorActivity(int activityMsgId) +{ + int msgType; + int msgSubType; + + qint32 messageId(activityMsgId); + // get the message type + ConversationsEngine::instance()->markAsReadAndGetType(messageId, msgType, msgSubType); + + if (!mUniEditor) { + mUniEditor = new MsgUnifiedEditorView(); + mMainWindow->addView(mUniEditor); + mUniEditor->setNavigationAction(mBackAction); + connect(mUniEditor, SIGNAL(switchView(const QVariantList&)), this, + SLOT(switchView(const QVariantList&))); + } + + // buffer data to open the draft message + ConvergedMessageId convergedMsgId(activityMsgId); + ConvergedMessage message; + message.setMessageType((ConvergedMessage::MessageType) msgType); + message.setMessageId(convergedMsgId); + + // Launch uni-editor view + QByteArray dataArray; + QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append); + message.serialize(messageStream); + + QVariantList editorData; + editorData << dataArray; + mUniEditor->openDraftsMessage(editorData); + + // set the current view + mCurrentView = MsgBaseView::UNIEDITOR; + mMainWindow->setCurrentView(mUniEditor); +} + +// ---------------------------------------------------------------------------- +// MsgViewManager::findContactId +// @see header +// ---------------------------------------------------------------------------- +qint32 MsgViewManager::findContactId(QString address) + { + QString displayLabel; + int count; + int localId = + MsgContactHandler::resolveContactDisplayName(address, + displayLabel, + count); + + return localId; + } + +//EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetchermodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetchermodel.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,127 @@ +/* + * 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 header file for messaging's audio fetcher model + * + */ + +#ifndef MSGAUDIOFETCHERMODEL_H +#define MSGAUDIOFETCHERMODEL_H + +// SYSTEM INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS +class MsgAudioSelectionEngine; + +/** + * @class MsgAudioFetcherModel + * @brief This class is messaging's audio fetcher model + */ +class MsgAudioFetcherModel : public QStandardItemModel +{ +Q_OBJECT + +public: + /** + * Constructor + */ + explicit MsgAudioFetcherModel(QObject *parent); + + /** + * Destructor + */ + virtual ~MsgAudioFetcherModel(); + + /** + * Clears model + */ + void clearAll(); + + /** + * adds a row into the model + */ + void addRow(QString filepath); + +public: //from QAbstractItemModel + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + +private: + /** + * binary search (ascendant) for the correct index to insert. + * @param low the start of search + * @param high the end of search. + * @return the correct index + */ + int insertIndex(int low, int high, QString variant); + + /** + * Add audio files into the model + * @param toneDir, Dir from which to get audio files to add to model + */ + void addToneFiles(QDir& toneDir); + + /** + * Finds and adds audio files into the model + */ + void getRomToneFiles(); + + /** + * Initialize the model + */ + void init(); + + /** + * checks if the given file is DRM protected + * @param filepath, path of audio file + */ + bool isDRM(QString filepath); + +private slots: + /** + * Handle MDS session open + */ + void mdeSessionOpened(); + + /** + * Handle MDS session open error + */ + void mdeSessionError(int error); + + /** + * Handle MDS query complete + */ + void queryComplete(const QStringList &nameList, + const QStringList &uriList); + + /** + * Handle MDS query error + */ + void queryError(int error); + + /** + * Handle object observer callback + */ + void onObjectChanged(); + +private: + /** + * audio selection engine + */ + MsgAudioSelectionEngine* mSelectionEngine; +}; + +#endif /* MsgAudioFetcherModel_H_ */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetcherview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetcherview.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,113 @@ +/* + * 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 header file for messaging's audio fetcher view. + * + */ + +#ifndef MSGAUDIOFETCHERVIEW_H +#define MSGAUDIOFETCHERVIEW_H + +#ifdef BUILD_MSGAUDIOFETCHER_DLL +#define MSGAUDIOFETCHER_DLL_EXPORT Q_DECL_EXPORT +#else +#define MSGAUDIOFETCHER_DLL_EXPORT Q_DECL_IMPORT +#endif + +// SYSTEM INCLUDES +#include +#include + +// USER INCLUDES +#include "msgbaseview.h" +#include "convergedmessage.h" + +// FORWARD DECLARATIONS +class MsgAudioFetcherWidget; +class HbAction; + +/** + * @class MsgAudioFetcherView + * @brief This class is messaging's audio fetcher view + */ +class MSGAUDIOFETCHER_DLL_EXPORT MsgAudioFetcherView : public MsgBaseView +{ +Q_OBJECT + +public: + /** + * Constructor + */ + explicit MsgAudioFetcherView(const QVariantList& data); + + /** + * Destructor + */ + ~MsgAudioFetcherView(); +private: + /** + * Creates a widget and sets it to the view + */ + void initMainWidget(); + + /** + * Initializes view's toolbar actions + */ + void initToolBar(); + + /** + * tool bar actions must to be removed in case the app crashes. + */ + void removeToolBarAction(); + +private slots: + /** + * Handles toolbar's leftaction (play/pause) + */ + void on_leftAction_triggered(); + + /** + * Handles toolbar's rightaction (select) + */ + void on_rightAction_triggered(); + + /** + * enable toolbar actions, only when an item is selected + */ + void enableToolBar(bool enable); + +private: + /** + * view's main widget + */ + MsgAudioFetcherWidget *mWidget; + + /** + * Toolbar's left action + */ + HbAction *mToolBarLeftAction; + + /** + * Toolbar's right action + */ + HbAction *mToolBarRightAction; + + /** + * Converged Message object + * owned + */ + ConvergedMessage* message; +}; + +#endif /* MSGAUDIOFETCHERVIEW_H */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetcherwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetcherwidget.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,120 @@ +/* + * 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 header file for messaging's audio fetcher widget. + * + */ +#ifndef MSGAUDIOFETCHERWIDGET_H +#define MSGAUDIOFETCHERWIDGET_H + +// SYSTEM INCLUDES +#include + +// USER INCLUDES +class HbListView; +class QGraphicsLinearLayout; +class MsgAudioFetcherView; +class MsgAudioFetcherModel; +class HbLabel; +class MsgAudioPreview; + +/** + * @class MsgAudioFetcherWidget + * @brief This class is messaging's audio fetcher view's mainwidget + */ +class MsgAudioFetcherWidget : public HbWidget +{ +Q_OBJECT + +public: + /** + * Constructor + */ + explicit MsgAudioFetcherWidget(); + + /** + * Destructor + */ + ~MsgAudioFetcherWidget(); + + /** + * Get the path of item selected in the list + */ + QString getCurrentItemPath(); + + /** + * Play or pause the audio file + */ + void playOrPause(); + +signals: + /** + * Signal to enable/disable the toolbar + */ + void triggerToolBar(bool enable); + +private slots: + /** + * Handles selection of a list item + */ + void on_list_activated(const QModelIndex &index); +private: + /** + * initializes widget + */ + void init(); + +private: + /** + * label of the list view + * owned + */ + HbLabel *mLabel; + + /** + * list view + * owned + */ + HbListView *mListView; + + /** + * list's layout + * owned + */ + QGraphicsLinearLayout *mLayout; + + /** + * populating model + * owned + */ + MsgAudioFetcherModel *mFetcherModel; + + /** + * For previewing audio files + * owned + */ + MsgAudioPreview* mAudioPreview; + + /** + * selection state + */ + bool mSelected; + + /** + * last selected item + */ + QModelIndex mOldSeletedItem; +}; + +#endif /* MSGAUDIOFETCHERWIDGET_H_ */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgaudiofetcher/inc/msgaudiopreview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/inc/msgaudiopreview.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,211 @@ +/* + * 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 header file for tone previewing. + * + */ + +#ifndef MSGAUDIOPPREVIEW_H +#define MSGAUDIOPPREVIEW_H + +#include +#include +#include +#include +#include +#include // for RApaLsSession +#include +#include + +class C3DRingingToneInterface; +class RWindow; + +/** + * CMFPreviewHandlerBase + * + * Base class for CMFAudioPreviewHandler. + */ +class CMFPreviewHandlerBase: public QObject, public CBase + +{ +Q_OBJECT +public: + + enum TMediaFileType + { + EMediaFileTypeAudio = 0, EMediaFileTypeVideo + }; + enum TPlayerStatus + { + EPlayerNotCreated, + EPlayerInitializing, + EPlayerReady, + EPlayerPlaying, + EPlayerInitialized, + EPlayerPlayingWith3DEffect + }; + + // these must match with the ones in Profile Engine + enum TRingingTypes + { + ERingingTypeRinging = 0, + ERingingTypeAscending, + ERingingTypeRingOnce, + ERingingTypeBeepOnce, + ERingingTypeSilent + }; + + enum TFLAllowScreenSaver + { + EFLScreenSaverAllowed = 0, EFLScreenSaverNotAllowed + }; + +protected: + + virtual ~CMFPreviewHandlerBase(); + +protected: + + /** + * C++ default constructor. + */ + CMFPreviewHandlerBase(QObject *parent); + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + +public: + void SetAttr(const QString &file); + TInt Attr(TInt aAttr); + virtual void Play() = 0; + virtual void Stop() = 0; + virtual TBool IsPlaying() = 0; + QString normalizeSeperator(const QString &path); +protected: + TInt ConvertVolume(TInt aVolume); + void ReadActiveProfileL(); + TInt GetDataType(const TDesC& aFileName, TDataType& aDataType); + void ReadDefaultToneL(); + + void DisableBackLight(); + + static TInt DoResetInactivityTimer(TAny* aObject); +protected: + TInt RingingVolume(); + TInt RingingType(); + TInt Vibra(); + TInt Echo3D(); + TInt Effect3D(); + +protected: + static TInt ConvertVolume(TInt aVolume, TInt aMaxVolume); + +protected: + TInt iRingingVolume; + TInt iRingingType; + TInt iVibra; + TInt i3DEffect; + TInt i3DEcho; + TInt iMediaType; + TInt iFileSize; + HBufC* iFullName; + + TBool iActiveProfileRead; + TInt iActiveProfileRingingVolume; + TInt iActiveProfileRingingType; + TInt iActiveProfileVibra; + TInt iActiveProfile3DEffect; + TInt iActiveProfile3DEcho; + + TInt iPlayerStatus; + + // handle to window + RWindow* iWindow; // does not own + + // for getting file MIME types + RApaLsSession iApaSession; + + // for setting screensaver on/off + RProperty iProperty; + + // default ringing tone + TFileName iDefaultTone; + + /** + * Timer for resetting the user inactivity timeout + */ + CPeriodic* iBacklightTimer; +}; + +// CLASS DECLARATION +/** + * This class is used for previewing the tones. + * + */ + +class MsgAudioPreview: public CMFPreviewHandlerBase, + public MDrmAudioPlayerCallback, + public MMdaAudioToneObserver + +{ +Q_OBJECT +public: + MsgAudioPreview(QObject *parent); + virtual ~MsgAudioPreview(); +signals: + // void notifyPreviewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId); + +public: + void Play(); + void Stop(); + TBool IsPlaying(); + +private: + void Cancel(); + void SetAudioRingingType(TInt aRingingType); + void SetToneRingingType(TInt aRingingType); + TInt ConvertVolume(TInt aVolume); + void PlayL(); + +private: + // from MMdaAudioToneObserver + virtual void MatoPrepareComplete(TInt aError); + virtual void MatoPlayComplete(TInt aError); + +private: + // from MDrmAudioPlayerCallback + void MdapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); + void MdapcPlayComplete(TInt aError); + +private: + // audio player + CDrmPlayerUtility* iAudioPlayer; + + /// Audioplayer status + TPlayerStatus iAudioPlayerStatus; + + /// toneplayer + CMdaAudioToneUtility* iTonePlayer; + + /// Toneplayer status + TPlayerStatus iTonePlayerStatus; + + // plugin for playing 3D effects + C3DRingingToneInterface* i3dRingingTonePlugin; + +}; + +#endif /* MSGAUDIOPPREVIEW_H */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgaudiofetcher/inc/msgaudioselectionengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/inc/msgaudioselectionengine.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,138 @@ +/* + * 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 header file for mde tone fetcher. + * + */ +#ifndef MSGAUDIOSELECTIONENGINE_H +#define MSGAUDIOSELECTIONENGINE_H + +// SYSTEM INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// FORWARD DECLARATIONS + +/** + * This class is used for quering tones from mde. + */ +class MsgAudioSelectionEngine : public QObject, + public CBase, + public MMdESessionObserver, + public MMdEQueryObserver, + public MMdEObjectObserver, + public MMdEObjectPresentObserver +{ +Q_OBJECT + +public: + + enum TStorageType + { + EPhoneMemory = 0, ERomStorage, EMassStorage, EMemoryCard + }; + + enum TQueryAttribute + { + EAttrMediaType = 20, // integer + EAttrFileSize, // integer + EAttrStorageType, // integer + EAttrMediaFileId, // integer + EAttrFileName, // string + EAttrFullName, // string + EAttrSongName, // string + EAttrArtist, // string + EAttrAlbum, // string + EAttrGenre, // string + EAttrComposer + // string + }; + +public: + MsgAudioSelectionEngine(); + virtual ~MsgAudioSelectionEngine(); + void CreateMetaDataSession(); +signals: + void mdeSessionOpened(); + void mdeSessionError(int error); + void queryComplete(QStringList nameList, QStringList uriList); + void queryError(int error); + void notifyObjectChanged(); + +public: + static CMdEPropertyDef& PropertyDefL(CMdESession* aSession, TInt aAttr); + void QueryTones(); + void SetAttr(int attr, int value); + +private: + void LeaveIfSessionClosedL(); + CMdEPropertyDef& PropertyDefL(TInt aAttr); + void QueryTonesL(); + void HandleQueryCompletedL(CMdEQuery& aQuery, TInt aError); + +private: + // from MMdESessionObserver + void HandleSessionOpened(CMdESession& aSession, TInt aError); + void HandleSessionError(CMdESession& aSession, TInt aError); + +private: + // from MMdEQueryObserver (mdequery.h) + void HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex, + TInt aNewItemCount); + void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); +private: + // from MMdEObjectObserver + void HandleObjectNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray); + +private: + // from MMdEObjectPresentObserver + void HandleObjectPresentNotification(CMdESession& aSession, + TBool aPresent, const RArray& aObjectIdArray); + void AddObjectObserverL(); +private: + + + // session to metadata engine + CMdESession* iSession; + + // metadata query + CMdEObjectQuery* iQuery; + + // used for saving the quering result. + //both name and uri. + QStringList iNameList; + QStringList iUriList; + + // is metadata session open + TBool iSessionOpen; + + // max audio file file size + TInt iMaxFileSize; + + // query error + TInt iQueryError; +}; +#endif /* MSGAUDIOSELECTIONENGINE_H */ + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgaudiofetcher/msgaudiofetcher.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/msgaudiofetcher.pro Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,81 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = msgaudiofetcher +DEFINES += BUILD_MSGAUDIOFETCHER_DLL + +DEPENDPATH += . \ + inc \ + src + +INCLUDEPATH += ../inc +INCLUDEPATH += ../../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +CONFIG += hb + +TARGET.UID3 = 0x2001FE67 +TARGET.CAPABILITY = All -TCB +TARGET.EPOCALLOWDLLDATA = 1 + +# Platforms +SYMBIAN_PLATFORMS = WINSCW \ + ARMV5 + +# Build.inf rules +BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " \ + "rom/msgaudiofetcher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(msgaudiofetcher.iby)" + +# Input +HEADERS += msgaudioselectionengine.h \ + msgaudiofetchermodel.h \ + msgaudiofetcherwidget.h \ + msgaudiofetcherview.h \ + msgaudiopreview.h \ + ../inc/msgbaseview.h + +SOURCES += msgaudioselectionengine.cpp \ + msgaudiofetchermodel.cpp \ + msgaudiofetcherwidget.cpp \ + msgaudiofetcherview.cpp \ + msgaudiopreview.cpp + +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/msgaudiofetcher.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/msgaudiofetcher.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + +# Libs +LIBS += -lconvergedmessageutils \ + -lxqutils \ + -lmdeclient \ + -lcentralrepository \ + -lProfileEng \ + -lmediaclientaudio \ + -lDrmAudioPlayUtility \ + -lDRMCommon \ + -lDrmRights \ + -lDrmHelper \ + -ldrmutility \ + -lapmime \ + -lecom \ + -lxqservice \ + -lapgrfx diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgaudiofetcher/rom/msgaudiofetcher.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/rom/msgaudiofetcher.iby Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __MSGAUDIOFETCHER_IBY__ +#define __MSGAUDIOFETCHER_IBY__ + +REM DLL +file=ABI_DIR\UREL\msgaudiofetcher.dll SHARED_LIB_DIR\msgaudiofetcher.dll + +#endif // __MSGAUDIOFETCHER_IBY__ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgaudiofetcher/src/msgaudiofetchermodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetchermodel.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,192 @@ +/* + * 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 source file for messaging's audio fetcher model + */ + +// SYSTEM INCLUDES +#include +#include + +// USER INCLUDES +#include "msgaudiofetchermodel.h" +#include "msgaudioselectionengine.h" + +MsgAudioFetcherModel::MsgAudioFetcherModel(QObject *parent) : + QStandardItemModel(parent), mSelectionEngine(0) +{ + init(); +} + +MsgAudioFetcherModel::~MsgAudioFetcherModel() +{ + delete mSelectionEngine; +} + +void MsgAudioFetcherModel::init() +{ + mSelectionEngine = new MsgAudioSelectionEngine(); + + connect(mSelectionEngine, SIGNAL(mdeSessionOpened()), this, SLOT(mdeSessionOpened())); + connect(mSelectionEngine, SIGNAL(mdeSessionError(int)), this, SLOT(mdeSessionError(int))); + connect(mSelectionEngine, SIGNAL(queryComplete(QStringList, QStringList)), this, + SLOT(queryComplete(QStringList, QStringList))); + connect(mSelectionEngine, SIGNAL(queryError(int)), this, SLOT(queryError(int))); + + connect(mSelectionEngine, SIGNAL(notifyObjectChanged()), this, SLOT(onObjectChanged())); + mSelectionEngine->CreateMetaDataSession(); +} + +void MsgAudioFetcherModel::getRomToneFiles() +{ + // z:\data\sounds\digital + QDir digitalsoundPath(XQUtils::romRootPath() + XQUtils::digitalSoundsPath()); + addToneFiles(digitalsoundPath); + + //z:\data\sounds\simple + QDir simpleSoundPath(XQUtils::romRootPath() + XQUtils::simpleSoundsPath()); + addToneFiles(simpleSoundPath); + + //z:\data\sounds + QDir soundPath(XQUtils::romRootPath() + XQUtils::soundsPath()); + addToneFiles(soundPath); +} + +void MsgAudioFetcherModel::addToneFiles(QDir& toneDir) +{ + // List only xx.amr files + QStringList filters; + filters << "*.amr"; + toneDir.setNameFilters(filters); + + QStringList soundList = toneDir.entryList(); + for (int i = 0; i < soundList.size(); ++i) { + QString fullPath = QDir::toNativeSeparators(toneDir.absolutePath()); + fullPath.append(QDir::separator()); + fullPath.append(soundList.at(i)); + addRow(fullPath); + } +} + +QVariant MsgAudioFetcherModel::data(const QModelIndex &index, int role) const +{ + return QStandardItemModel::data(index, role); +} + +void MsgAudioFetcherModel::addRow(QString filepath) +{ + if(isDRM(filepath)) + { + // don't insert DRM protected files, as sending itself + // is not allowed in 'Restricted Mode' + return; + } + + QFileInfo fInfo(filepath); + QStandardItem* item = new QStandardItem(); + QString filename = fInfo.baseName(); + item->setData(filename, Qt::DisplayRole); + item->setData(filepath, Qt::UserRole); + + // get insert index + int index = this->insertIndex(0, rowCount(), filename); + insertRow(index, item); +} + +int MsgAudioFetcherModel::insertIndex(int low, int high, QString value) +{ + if (low == high) { + return low; + } + int middle = (low + high - 1) / 2; + QModelIndex lowItemIndex = ((QStandardItemModel *) this)->index(low, 0); + QModelIndex highItemIndex = ((QStandardItemModel *) this)->index(high - 1, 0); + QModelIndex middleItemIndex = ((QStandardItemModel *) this)->index(middle, 0); + QString lowString = data(lowItemIndex).toString(); + QString highString = data(highItemIndex).toString(); + QString middleString = data(middleItemIndex).toString(); + + if (value >= highString) { + return high; + } + if (value < lowString) { + return low; + } + high = high - 1; + while (low < high) { + middle = (low + high) / 2; + middleItemIndex = ((QStandardItemModel *) this)->index(middle, 0); + middleString = data(middleItemIndex).toString(); + if (value >= middleString) { + low = middle + 1; + } + else { + high = middle; + } + } + return low; +} + +void MsgAudioFetcherModel::clearAll() +{ + QStandardItemModel::clear(); +} + +void MsgAudioFetcherModel::mdeSessionOpened() +{ + mSelectionEngine->QueryTones(); + getRomToneFiles(); +} + +void MsgAudioFetcherModel::queryComplete(const QStringList &nameList, const QStringList &uriList) +{ + for (int i = 0; i < nameList.size(); ++i) { + addRow(uriList.at(i)); + } +} + +void MsgAudioFetcherModel::queryError(int error) +{ + Q_UNUSED(error); +} + +void MsgAudioFetcherModel::mdeSessionError(int error) +{ + Q_UNUSED(error); +} + +void MsgAudioFetcherModel::onObjectChanged() +{ + clearAll(); + getRomToneFiles(); + mSelectionEngine->QueryTones(); +} + +bool MsgAudioFetcherModel::isDRM(QString filepath) +{ + QList attrNames; + attrNames.append(XQApplicationManager::IsProtected); + + QFile file(filepath); + QVariantList attrValues; + XQApplicationManager appmgr; + bool ok = appmgr.getDrmAttributes(file, attrNames, attrValues); + if(!ok) + { + return true; + } + return (0 < attrValues.at(0).toInt()); +} + +//End of File diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherview.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,122 @@ +/* + * 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 source file for messaging's audio fetcher view. + * + */ + +// SYSTEM INCLUDES +#include +#include + +// USER INCLUDES +#include "msgaudiofetcherview.h" +#include "msgaudiofetcherwidget.h" +#include "convergedmessage.h" + +MsgAudioFetcherView::MsgAudioFetcherView(const QVariantList& data) : +message(NULL) +{ + message = new ConvergedMessage; + if(data.length() > 0) + { + QByteArray dataArray = data.at(0).toByteArray(); + QDataStream stream(&dataArray, QIODevice::ReadOnly); + message->deserialize(stream); + } + initToolBar(); + initMainWidget(); + QMetaObject::connectSlotsByName(this); +} + +MsgAudioFetcherView::~MsgAudioFetcherView() +{ + if(message != NULL) + { + delete message; + message = NULL; + } + removeToolBarAction(); +} + +void MsgAudioFetcherView::initMainWidget() +{ + mWidget = new MsgAudioFetcherWidget(); + Q_ASSERT(mWidget); + setWidget(mWidget); + connect(mWidget, SIGNAL(triggerToolBar(bool)), this, SLOT(enableToolBar(bool))); +} + +void MsgAudioFetcherView::initToolBar() +{ + mToolBarLeftAction = new HbAction(this); + mToolBarLeftAction->setObjectName("leftAction"); + //TODO: need localized string + mToolBarLeftAction->setText(hbTrId("Play/Pause")); + toolBar()->addAction(mToolBarLeftAction); + mToolBarLeftAction->setEnabled(false); + + mToolBarRightAction = new HbAction(this); + mToolBarRightAction->setObjectName("rightAction"); + //TODO: need localized string + mToolBarRightAction->setText(hbTrId("Select")); + mToolBarRightAction->setEnabled(false); + toolBar()->addAction(mToolBarRightAction); + + toolBar()->setOrientation(Qt::Horizontal); + toolBar()->setEnabled(false); +} + +void MsgAudioFetcherView::removeToolBarAction() +{ + toolBar()->removeAction(mToolBarRightAction); + toolBar()->removeAction(mToolBarLeftAction); +} + +void MsgAudioFetcherView::on_leftAction_triggered() +{ + mWidget->playOrPause(); +} + +void MsgAudioFetcherView::on_rightAction_triggered() +{ + // param list for switching to editor view + QVariantList params; + QByteArray dataArray; + QDataStream messageStream + (&dataArray, QIODevice::WriteOnly | QIODevice::Append); + + QString filepath(mWidget->getCurrentItemPath()); + ConvergedMessageAttachment* attachment = + new ConvergedMessageAttachment(filepath); + ConvergedMessageAttachmentList attachmentList; + attachmentList.append(attachment); + message->addAttachments(attachmentList); + + message->serialize(messageStream); + params << MsgBaseView::UNIEDITOR; + params << MsgBaseView::AUDIOFETCHER; + params << dataArray; + params << MsgBaseView::ADD_AUDIO; + emit switchView(params); +} + +void MsgAudioFetcherView::enableToolBar(bool enable) +{ + mToolBarRightAction->setEnabled(enable); + mToolBarLeftAction->setEnabled(enable); + toolBar()->setEnabled(enable); +} + +//End of File diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherwidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The source file for messaging's audio fetcher widget. + * + */ + +// SYSTEM INCLUDES +#include +#include +#include +#include +#include + +// USER INCLUDES +#include "msgaudiofetcherwidget.h" +#include "msgaudiofetchermodel.h" +#include "msgaudiopreview.h" + +// LOCALIZED CONSTANTS +#define LOC_SELECT_SOUND hbTrId("txt_messaging_title_select_a_sound") + + +MsgAudioFetcherWidget::MsgAudioFetcherWidget() + : HbWidget(this), + mLabel(0), + mListView(0), + mLayout(0), + mFetcherModel(0), + mAudioPreview(0), + mSelected(false) +{ + init(); +} + +MsgAudioFetcherWidget::~MsgAudioFetcherWidget() +{ +} + +QString MsgAudioFetcherWidget::getCurrentItemPath() +{ + QModelIndexList modelIndexList = mListView->selectionModel()->selectedIndexes(); + if(modelIndexList.count() > 0) + { + QModelIndex index = modelIndexList.at(0); + QString temppath = + mFetcherModel->data(index, Qt::UserRole).toString(); + return QDir::toNativeSeparators(temppath); + } + return QString(); +} + +void MsgAudioFetcherWidget::playOrPause() +{ + mAudioPreview->SetAttr(getCurrentItemPath()); + mAudioPreview->Play(); +} + +void MsgAudioFetcherWidget::on_list_activated(const QModelIndex &index) +{ + QModelIndexList modelIndexList = mListView->selectionModel()->selectedIndexes(); + + //stop previewing when clicking another item. + if (mAudioPreview->IsPlaying()) { + mAudioPreview->SetAttr(getCurrentItemPath()); + mAudioPreview->Play(); + + } + + /* + * when one item is selected, reselecting it will deselect it. selecting another + * will also deselect it, while the other is selected. + */ + if(mSelected) + { + if(mOldSeletedItem != index) + { + mListView->selectionModel()->select(index, QItemSelectionModel::Select); + mOldSeletedItem = index; + emit triggerToolBar(true); + } + else + { + mListView->selectionModel()->select(index, QItemSelectionModel::Deselect); + mSelected = false; + emit triggerToolBar(false); + } + return; + } + + if(modelIndexList.count() > 0) + { + QModelIndexList::const_iterator it; + for(it=modelIndexList.begin(); it!=modelIndexList.end(); ++it) + { + if((*it) == index) + { + mSelected = true; + mOldSeletedItem = index; + emit triggerToolBar(true); + } + } + } +} + +void MsgAudioFetcherWidget::init() +{ + mLayout = new QGraphicsLinearLayout(this); + mLayout->setOrientation(Qt::Vertical); + setLayout(mLayout); + + mLabel = new HbLabel(this); + // TODO: need localized string + mLabel->setPlainText(LOC_SELECT_SOUND); + mLayout->addItem(mLabel); + + mListView = new HbListView(this); + mListView->setObjectName("list"); + mLayout->addItem(mListView); + mListView->setSelectionMode(HbAbstractItemView::SingleSelection); + + mFetcherModel = new MsgAudioFetcherModel(this); + mListView->setModel(mFetcherModel); + connect(mListView, SIGNAL(activated(QModelIndex)), + this, SLOT(on_list_activated(QModelIndex))); + mAudioPreview = new MsgAudioPreview(this); +} + +//End of File diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgaudiofetcher/src/msgaudiopreview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudiopreview.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,629 @@ +/* + * 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 source file for tone previewing. + * + */ +#include "msgaudiopreview.h" +#include // KAudioPriorityPreview +#include // C3DRingingToneInterface +#include // for phone call states +#include +#include +#include +#include "TProfileToneSettings.h" +#include +#include +#include +#include // KProEngDefaultRingingTone +#include +#include +#include + + +CMFPreviewHandlerBase::CMFPreviewHandlerBase( QObject *parent ) : QObject( parent ) + { + iMediaType = KErrNotFound; + iRingingVolume = KErrNotFound; + iRingingType = KErrNotFound; + iVibra = KErrNotFound; + i3DEffect = KErrNotFound; + i3DEcho = KErrNotFound; + iFileSize = KErrNotFound; + iFullName = 0; + iActiveProfileRead = EFalse; + iPlayerStatus = EPlayerNotCreated; + + } + +void CMFPreviewHandlerBase::ConstructL() + { + // To allow/not allow screensaver + // Errors ignored, no actions needed if API is not available + //iProperty.Attach( KPSUidScreenSaver, KScreenSaverAllowScreenSaver ); + TRAP_IGNORE(User::LeaveIfError( iApaSession.Connect() ) ); + + TRAP_IGNORE( ReadDefaultToneL() ); + // To keep backlight on while a video is being previewed + iBacklightTimer = CPeriodic::NewL( EPriorityLow ); + } + +CMFPreviewHandlerBase::~CMFPreviewHandlerBase() + { + delete iFullName; + iProperty.Close(); + iApaSession.Close(); + } + +void CMFPreviewHandlerBase::SetAttr(const QString &file ) + { + if ( !file.isNull() ) + { + QString path = normalizeSeperator(file); + delete iFullName; + iFullName = 0; + iFullName = XQConversions::qStringToS60Desc( path ); + } + } + +TInt CMFPreviewHandlerBase::RingingVolume() + { + const TInt KDefaultVolumeLevel = 7; // see profile.hrh for volume levels + + if ( iRingingVolume != KErrNotFound ) + { + return iRingingVolume; + } + + if ( iActiveProfileRead ) + { + return iActiveProfileRingingVolume; + } + + return KDefaultVolumeLevel; + } + +TInt CMFPreviewHandlerBase::RingingType() + { + if ( iRingingType != KErrNotFound ) + { + return iRingingType; + } + + if ( iActiveProfileRead ) + { + return iActiveProfileRingingType; + } + + return ERingingTypeRinging; + } + +TInt CMFPreviewHandlerBase::Vibra() + { + if ( iVibra != KErrNotFound ) + { + return iVibra; + } + + if ( iActiveProfileRead ) + { + return iActiveProfileVibra; + } + + return 0; // in case of error vibra is off + } + +TInt CMFPreviewHandlerBase::Echo3D() + { + if ( i3DEcho != KErrNotFound ) + { + return i3DEcho; + } + + if ( iActiveProfileRead ) + { + return iActiveProfile3DEcho; + } + + return EProfile3DEchoOff; // from ProfileInternal.hrh + } + +TInt CMFPreviewHandlerBase::Effect3D() + { + if ( i3DEffect != KErrNotFound ) + { + return i3DEffect; + } + + if ( iActiveProfileRead ) + { + return iActiveProfile3DEffect; + } + + return EProfile3DEffectOff; + } + +TInt CMFPreviewHandlerBase::ConvertVolume( TInt aVolume, TInt aMaxVolume ) + { + const TInt KMinVolumeLevel = 1; + const TInt KMaxVolumeLevel = 10; + + TInt result = aMaxVolume * aVolume / KMaxVolumeLevel; + + // if user has selected minimum volume level set HW volume 1 + if ( aVolume == KMinVolumeLevel && result == 0 ) + { + result = 1; + } + + return result; + } + +void CMFPreviewHandlerBase::ReadActiveProfileL() + { + iActiveProfileRead = EFalse; + + MProfileEngine* profileEngine = CreateProfileEngineL(); + CleanupReleasePushL( *profileEngine ); + + MProfile* activeProfile = profileEngine->ActiveProfileL(); + CleanupReleasePushL( *activeProfile ); + + const MProfileTones& profileTones = activeProfile->ProfileTones(); + + const TProfileToneSettings& toneSettings = profileTones.ToneSettings(); + iActiveProfileVibra = toneSettings.iVibratingAlert; + iActiveProfileRingingVolume = toneSettings.iRingingVolume; + iActiveProfileRingingType = toneSettings.iRingingType; + + const MProfileExtraSettings& extra = activeProfile->ProfileExtraSettings(); + const MProfile3DToneSettings& threeD = extra.Profile3DToneSettings(); + + iActiveProfile3DEffect = threeD.Effect(); + iActiveProfile3DEcho = threeD.Echo(); + + CleanupStack::PopAndDestroy( activeProfile ); + CleanupStack::PopAndDestroy( profileEngine ); + + iActiveProfileRead = ETrue; + } + +void CMFPreviewHandlerBase::ReadDefaultToneL() + { + CRepository* cenrep = CRepository::NewLC( KCRUidProfileEngine ); + + User::LeaveIfError( cenrep->Get( KProEngDefaultRingingTone, iDefaultTone ) ); + CleanupStack::PopAndDestroy( cenrep ); + } + +TInt CMFPreviewHandlerBase::GetDataType( const TDesC& aFileName, TDataType& aDataType ) + { + TUid dummyUid( KNullUid ); + return iApaSession.AppForDocument( aFileName, dummyUid, aDataType ); + } + +TInt CMFPreviewHandlerBase::DoResetInactivityTimer( TAny* /*aObject*/ ) + { + User::ResetInactivityTime(); + return KErrNone; + } + +void CMFPreviewHandlerBase::DisableBackLight() + { + const TInt KResetInactivityTimerDelay = 2000000; + iBacklightTimer->Cancel(); // Just in case + // Disable backlight turn off during video preview + iBacklightTimer->Start( KResetInactivityTimerDelay, + KResetInactivityTimerDelay, + TCallBack( DoResetInactivityTimer, 0 ) ); + + } + + + +MsgAudioPreview::MsgAudioPreview( QObject *parent ) : CMFPreviewHandlerBase( parent ) + { + iAudioPlayerStatus = EPlayerNotCreated; + TRAP_IGNORE(CMFPreviewHandlerBase::ConstructL()); + iTonePlayerStatus = EPlayerNotCreated; + } + +MsgAudioPreview::~MsgAudioPreview() + { + Cancel(); + + delete iAudioPlayer; + delete iTonePlayer; + delete i3dRingingTonePlugin; + } + +TBool MsgAudioPreview::IsPlaying() + { + if ( iAudioPlayerStatus != EPlayerNotCreated ) + { + return ETrue; + } + + if ( iTonePlayerStatus != EPlayerNotCreated ) + { + return ETrue; + } + + return EFalse; + } + +void MsgAudioPreview::Play() + { + TRAP_IGNORE(PlayL()); + } + +void MsgAudioPreview::PlayL() + { + if( IsPlaying() ) + { + Stop(); + return; + } + //sequence for playing a beep once sound + _LIT8( KFileListBeepSequence, "\x00\x11\x06\x0A\x08\x73\x0A\x40\x28\x0A\xF7\ + \x05\xFC\x40\x64\x0A\x08\x40\x32\x0A\xF7\x06\x0B" ); + + // rng mime type + _LIT( KFileListRngMimeType, "application/vnd.nokia.ringing-tone" ); + + Cancel(); // stop previous play + + if ( !iFullName || iFullName->Des().Length() == 0 ) + { + User::Leave( KErrNotFound ); + } + + TRAP_IGNORE( ReadActiveProfileL() ); + + TPtrC fileName( iFullName->Des() ); + TDataType dataType; + TInt err = GetDataType( fileName, dataType ); + if ( err == KErrNotFound ) + { + fileName.Set( iDefaultTone ); + if ( fileName.Length() == 0 ) + { + User::Leave( KErrNotFound ); + } + } + else if ( err != KErrNone ) + { + User::Leave( err ); + } + + TBool mimeTypeRng = EFalse; + + if ( err == KErrNone ) + { + if( dataType.Des().CompareF( KFileListRngMimeType ) == 0 ) + { + mimeTypeRng = ETrue; + } + } + + TInt ringingType = RingingType(); + if ( ringingType == ERingingTypeBeepOnce ) + { + // Active profile ringing tone is set to Beep Once + // Don't initialize a FileSequence but use DesSequence instead + iTonePlayer = CMdaAudioToneUtility::NewL( *this ); + iTonePlayer->PrepareToPlayDesSequence( KFileListBeepSequence() ); + iTonePlayerStatus = EPlayerInitializing; + } + else + { + if( mimeTypeRng ) + { + //Ringingtone is a RNG-file + iTonePlayer = CMdaAudioToneUtility::NewL( *this ); + iTonePlayer->PrepareToPlayFileSequence( fileName ); + iTonePlayerStatus = EPlayerInitializing; + } + else + { + delete iAudioPlayer; + iAudioPlayer = 0; + + iAudioPlayer = CDrmPlayerUtility::NewFilePlayerL( + fileName, *this, KAudioPriorityRingingTonePreview, + ( TMdaPriorityPreference )KAudioPrefRingFilePreview ); + + iAudioPlayerStatus = EPlayerInitializing; + } + } + DisableBackLight(); + } + +void MsgAudioPreview::Stop() + { + Cancel(); + } + +TInt MsgAudioPreview::ConvertVolume( TInt aVolume ) + { + TInt result = 0; + if ( iAudioPlayer ) + { + result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iAudioPlayer->MaxVolume() ); + } + else if ( iTonePlayer ) + { + result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iTonePlayer->MaxVolume() ); + } + + //if user has selected silent ringing type, set volume off + TInt ringingType = RingingType(); + if( ringingType == ERingingTypeSilent ) + { + result = 0; + } + + return result; + } + +void MsgAudioPreview::SetToneRingingType( TInt aRingingType ) + { + const TInt KToneInterval = 1000000; // 1 second pause between tones + const TInt KAscendingVolumeInterval = 3000000; // 3 seconds + + if ( !iTonePlayer ) + { + return; + } + + + TInt ringingVolume = RingingVolume(); + + switch( aRingingType ) + { + case ERingingTypeRinging: + case ERingingTypeSilent: + { + iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + case ERingingTypeAscending: + { + iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + + TInt volRamp = KAscendingVolumeInterval * ringingVolume; + iTonePlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) ); + break; + } + case ERingingTypeRingOnce: + case ERingingTypeBeepOnce: + { + iTonePlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + default: + { + break; + } + } + } + +void MsgAudioPreview::SetAudioRingingType( TInt aRingingType ) + { + const TInt KToneInterval = 1000000; // 1 second pause between tones + const TInt KAscendingVolumeInterval = 3000000; // 3 seconds + + if ( !iAudioPlayer ) + { + return; + } + + TInt ringingVolume = RingingVolume(); + + switch( aRingingType ) + { + case ERingingTypeRinging: + case ERingingTypeSilent: + { + iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + case ERingingTypeAscending: + { + iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + TInt volRamp = KAscendingVolumeInterval * ringingVolume; + iAudioPlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) ); + break; + } + case ERingingTypeRingOnce: + { + iAudioPlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + + default: + { + break; + } + } + } + +void MsgAudioPreview::Cancel() + { + TBool isPlaying = EFalse; + + if ( iAudioPlayer ) + { + isPlaying = ETrue; + if ( iAudioPlayerStatus == EPlayerPlayingWith3DEffect ) + { + i3dRingingTonePlugin->Stop(); + // plugin calls AudioPlayer->Stop() + iAudioPlayer->Close(); + } + if ( iAudioPlayerStatus == EPlayerPlaying ) + { + iAudioPlayer->Stop(); + iAudioPlayer->Close(); + } + + delete iAudioPlayer; + iAudioPlayer = 0; + iAudioPlayerStatus = EPlayerNotCreated; + } + + if ( iTonePlayer ) + { + isPlaying = ETrue; + if ( iTonePlayerStatus == EPlayerPlaying ) + { + iTonePlayer->CancelPlay(); + } + + delete iTonePlayer; + iTonePlayer = 0; + iTonePlayerStatus = EPlayerNotCreated; + } + + + if ( isPlaying ) + { + //User::InfoPrint(_L("cancel")); +// EnableScreenSaver( ETrue ); + iBacklightTimer->Cancel(); + } + } + +void MsgAudioPreview::MatoPlayComplete( TInt aError ) + { + Q_UNUSED(aError); + Cancel(); + // emit notifyPreviewEvent( ToneFetcherEngine::EAudioPreviewComplete, aError ); + } + +void MsgAudioPreview::MatoPrepareComplete( TInt aError ) + { + if ( aError != KErrNone ) + { + Cancel(); + + // emit notifyPreviewEvent( ToneFetcherEngine::EPreviewError, aError ); + return; + } + + TInt ringingVolume = RingingVolume(); + TInt ringingType = RingingType(); + TInt vibra = Vibra(); + + iTonePlayerStatus = EPlayerInitialized; + SetToneRingingType( ringingType ); + iTonePlayer->SetVolume( ConvertVolume( ringingVolume ) ); + + TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview; + if ( vibra ) + { + pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra; + } + iTonePlayer->SetPriority( KAudioPriorityPreview, pref ); + + iTonePlayer->Play(); + iTonePlayerStatus = EPlayerPlaying; + } + +void MsgAudioPreview::MdapcInitComplete( TInt aError, + const TTimeIntervalMicroSeconds& /* aDuration */ ) + { + if ( aError != KErrNone ) + { + Cancel(); + // emit notifyPreviewEvent( ToneFetcherEngine::EPreviewError, aError ); + return; + } + + + TInt ringingVolume = RingingVolume(); + TInt ringingType = RingingType(); + TInt vibra = Vibra(); + TInt echo3D = Echo3D(); + TInt effect3D = Effect3D(); + + + + iAudioPlayerStatus = EPlayerInitialized; + SetAudioRingingType( ringingType ); + iAudioPlayer->SetVolume( ConvertVolume( ringingVolume ) ); + + TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview; + if ( vibra ) + { + pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra; + } + iAudioPlayer->SetPriority( KAudioPriorityPreview, pref ); + + iAudioPlayerStatus = EPlayerPlaying; + + if ( effect3D == EProfile3DEffectOff ) + { + iAudioPlayer->Play(); // 3D not used + return; + } + + if ( !i3dRingingTonePlugin ) + { + TUid emptyUid = { 0 }; + TRAPD( err, i3dRingingTonePlugin = C3DRingingToneInterface::NewL( emptyUid ) ); + if ( err != KErrNone || !i3dRingingTonePlugin ) + { + iAudioPlayer->Play(); + return; + } + } + + i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEffect, effect3D ); + i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEcho, echo3D ); + i3dRingingTonePlugin->SetAttr( E3DRTIAttrDrmPlayerUtility, iAudioPlayer ); + TRAP_IGNORE( i3dRingingTonePlugin->PlayL() ); + + iAudioPlayerStatus = EPlayerPlayingWith3DEffect; + } + +void MsgAudioPreview::MdapcPlayComplete( TInt aError ) + { + Q_UNUSED(aError); + Cancel(); + // emit notifyPreviewEvent( ToneFetcherEngine::EAudioPreviewComplete, aError ); + + + } + + +QString CMFPreviewHandlerBase::normalizeSeperator(const QString &path) +{ + QString standardpath( path ); + QChar c('/'); + QChar c1('\\'); + if (standardpath.contains(c, Qt::CaseSensitive)) { + standardpath.replace(c, QDir::separator()); + } + if (standardpath.contains(c1, Qt::CaseSensitive)) { + standardpath.replace(c1, QDir::separator()); + } + return standardpath; +} + + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgaudiofetcher/src/msgaudioselectionengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudioselectionengine.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,279 @@ +/* + * 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 source file for mde tone fetcher. + * + */ + +// SYSTEM INCLUDES +#include +#include +#include +#include +#include + +// USER INCLUDES +#include "msgaudioselectionengine.h" + +// CONSTANTS +_LIT( KAmrMime, "audio/amr" ); + +MsgAudioSelectionEngine::MsgAudioSelectionEngine() + { + + } + +MsgAudioSelectionEngine::~MsgAudioSelectionEngine() + { + delete iQuery; + delete iSession; + } + + +void MsgAudioSelectionEngine::CreateMetaDataSession() +{ + TRAP_IGNORE(iSession = CMdESession::NewL(*this)); +} + + +void MsgAudioSelectionEngine::HandleSessionOpened(CMdESession& /*aSession*/, + TInt aError) + { + if (aError != KErrNone) + { + delete iSession; + iSession = 0; + iSessionOpen = EFalse; + emit mdeSessionError(aError); + } + else + { + iSessionOpen = ETrue; + TRAP_IGNORE( AddObjectObserverL() ); + emit mdeSessionOpened(); + } + } + +void MsgAudioSelectionEngine::HandleSessionError(CMdESession& /*aSession*/, + TInt aError) + { + if (aError == KErrNone) + { + return; + } + + delete iSession; + iSession = 0; + iSessionOpen = EFalse; + emit mdeSessionError(aError); + } + +void MsgAudioSelectionEngine::HandleQueryNewResults(CMdEQuery& /*aQuery*/, + TInt /*aFirstNewItemIndex*/, TInt /*aNewItemCount*/) + { + } + +void MsgAudioSelectionEngine::HandleObjectNotification( + CMdESession& /*aSession*/, TObserverNotificationType aType, + const RArray& /*aObjectIdArray*/) + { + if (aType == ENotifyAdd || aType == ENotifyModify || aType + == ENotifyRemove) + { + emit notifyObjectChanged(); + } + } + +void MsgAudioSelectionEngine::AddObjectObserverL() + { + if (iSessionOpen) + { + TUint32 notificationType = ENotifyAdd | ENotifyModify | ENotifyRemove; + User::LeaveIfNull(iSession); + CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL(); + iSession->AddObjectObserverL(*this, 0, notificationType, &defNS); + iSession->AddObjectPresentObserverL(*this); + } + } + +void MsgAudioSelectionEngine::HandleObjectPresentNotification( + CMdESession& /*aSession*/, TBool /*aPresent*/, + const RArray& aObjectIdArray) + { + if (aObjectIdArray.Count() > 0) + { + emit notifyObjectChanged(); + } + } + +void MsgAudioSelectionEngine::HandleQueryCompleted(CMdEQuery& aQuery, + TInt aError) + { + TRAP_IGNORE(HandleQueryCompletedL(aQuery, aError)); + } + +void MsgAudioSelectionEngine::HandleQueryCompletedL(CMdEQuery& aQuery, + TInt aError) + { + iNameList.clear(); + iUriList.clear(); + if (aError == KErrCancel) + { + emit queryError(aError); + return; + } + else + { + CMdEObjectQuery* query = static_cast (&aQuery); + TInt count = query->Count(); + for (TInt i = 0; i < count; ++i) + { + CMdEObject* object = + (CMdEObject*) query->TakeOwnershipOfResult(i); + CleanupStack::PushL(object); + CMdEPropertyDef& propDef = MsgAudioSelectionEngine::PropertyDefL( + iSession, MsgAudioSelectionEngine::EAttrFileName); + + CMdEProperty* property = 0; + TInt err = object->Property(propDef, property, 0); + if (err != KErrNotFound && property) + { + QString songName(XQConversions::s60DescToQString( + property->TextValueL())); + QString uriValue(XQConversions::s60DescToQString( + object->Uri())); + iNameList.append(songName); + iUriList.append(uriValue); + } + CleanupStack::PopAndDestroy(object); + } + emit queryComplete(iNameList, iUriList); + } + } + +void MsgAudioSelectionEngine::QueryTones() + { + TRAP_IGNORE(QueryTonesL()); + } + +void MsgAudioSelectionEngine::QueryTonesL() + { + LeaveIfSessionClosedL(); + CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& musicObjectDef = defNS.GetObjectDefL( + MdeConstants::Audio::KAudioObject); + + delete iQuery; + iQuery = 0; + iQuery = iSession->NewObjectQueryL(defNS, musicObjectDef, this); + CMdEPropertyDef& titlePropertyDef = musicObjectDef.GetPropertyDefL( + MdeConstants::Object::KTitleProperty); + CMdEPropertyDef& typePropertyDef = musicObjectDef.GetPropertyDefL( + MdeConstants::Object::KItemTypeProperty); + + // set attributes that are included in query result + iQuery->AddPropertyFilterL(&titlePropertyDef); + iQuery->AddPropertyFilterL(&typePropertyDef); + + iQuery->SetResultMode(EQueryResultModeItem); + + + // get root condition + CMdELogicCondition& conditions = iQuery->Conditions(); + conditions.AddPropertyConditionL(typePropertyDef, + ETextPropertyConditionCompareEquals, KAmrMime); + + iQuery->FindL(); + } + +void MsgAudioSelectionEngine::LeaveIfSessionClosedL() + { + if (!iSession || !iSessionOpen) + { + User::Leave(KErrDisconnected); + } + } + +CMdEPropertyDef& MsgAudioSelectionEngine::PropertyDefL(TInt aAttr) + { + User::LeaveIfNull(iSession); + return PropertyDefL(iSession, aAttr); + } + +CMdEPropertyDef& MsgAudioSelectionEngine::PropertyDefL(CMdESession* aSession, + TInt aAttr) + { + CMdENamespaceDef& defNS = aSession->GetDefaultNamespaceDefL(); + + CMdEObjectDef& objectDef = defNS.GetObjectDefL( + MdeConstants::Audio::KAudioObject); + + if (aAttr == EAttrFileSize) + { + return objectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty); + } + else if (aAttr == EAttrMediaType) + { + return objectDef.GetPropertyDefL( + MdeConstants::Object::KItemTypeProperty); + } + else if (aAttr == EAttrSongName || aAttr == EAttrFileName) + { + return objectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty); + } + else if (aAttr == EAttrArtist) + { + return objectDef.GetPropertyDefL( + MdeConstants::MediaObject::KArtistProperty); + } + else if (aAttr == EAttrAlbum) + { + return objectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumProperty); + } + else if (aAttr == EAttrGenre) + { + return objectDef.GetPropertyDefL( + MdeConstants::MediaObject::KGenreProperty); + } + else if (aAttr == EAttrComposer) + { + return objectDef.GetPropertyDefL( + MdeConstants::Audio::KComposerProperty); + } + else + { + User::Leave(KErrNotSupported); + } + + return objectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty); + } + + +void MsgAudioSelectionEngine::SetAttr(int attr, int value) + { + switch (attr) + { + case MsgAudioSelectionEngine::EAttrFileSize: + { + iMaxFileSize = value; + break; + } + default: + { + break; + } + } +} +// End of File + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msgui.pro --- a/messagingapp/msgui/msgui.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msgui.pro Thu Jul 22 16:32:06 2010 +0100 @@ -19,6 +19,7 @@ SYMBIAN_PLATFORMS = WINSCW ARMV5 # DLLs +SUBDIRS += msgaudiofetcher/msgaudiofetcher.pro SUBDIRS += msguiutils/msguiutils.pro SUBDIRS += appengine/appengine.pro SUBDIRS += conversationview/conversationview.pro diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msguiutils/inc/mmsconformancecheck.h --- a/messagingapp/msgui/msguiutils/inc/mmsconformancecheck.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msguiutils/inc/mmsconformancecheck.h Thu Jul 22 16:32:06 2010 +0100 @@ -20,7 +20,7 @@ #include -#include +#include #include #ifdef BUILD_MSGUI_UTILS_DLL diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msguiutils/inc/msgcontactsutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msguiutils/inc/msgcontactsutil.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: This static utility class handles all contacts & phbk + * services related common functions for UI modules. + * + */ + +#ifndef MSGCONTACTSUTIL_H_ +#define MSGCONTACTSUTIL_H_ + +#ifdef BUILD_MSGUI_UTILS_DLL +#define MSGUI_UTILS_DLL_EXPORT Q_DECL_EXPORT +#else +#define MSGUI_UTILS_DLL_EXPORT Q_DECL_IMPORT +#endif + +/** + * static utility class to handle contacts related common functionality + * for UI modules + */ +class MSGUI_UTILS_DLL_EXPORT MsgContactsUtil +{ + +public: + static bool launchVCardViewer(const QString& filepath); + +private: + static QString copyVCardToTemp(const QString& filepath); + static void deleteVCardFromTemp(const QString& filepath); +}; + +#endif /* MSGCONTACTSUTIL_H_ */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msguiutils/inc/msgsendutil.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msguiutils/msguiutils.pro --- a/messagingapp/msgui/msguiutils/msguiutils.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msguiutils/msguiutils.pro Thu Jul 22 16:32:06 2010 +0100 @@ -24,7 +24,6 @@ INCLUDEPATH += ../../../inc INCLUDEPATH += ../../msgutils/unieditorutils/editorgenutils/inc -INCLUDEPATH += ../../msgutils/s60qconversions/inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE CONFIG += hb @@ -43,14 +42,26 @@ BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " \ "rom/msguiutils.iby CORE_APP_LAYER_IBY_EXPORT_PATH(msguiutils.iby)" + +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/msguiutils.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/msguiutils.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + # Input HEADERS += msgsendutil.h \ mmsconformancecheck.h \ - msgmediautil.h + msgmediautil.h \ + msgcontactsutil.h SOURCES += msgsendutil.cpp \ mmsconformancecheck.cpp \ - msgmediautil.cpp + msgmediautil.cpp \ + msgcontactsutil.cpp # Libs LIBS += -lxqservice \ @@ -58,11 +69,11 @@ -leditorgenutils \ -lconvergedmessageutils \ -lcentralrepository \ - -ls60qconversions \ -lDRMHelper \ -lmsgmedia \ -lapmime \ -lunidatamodelloader \ - -lxqutils + -lxqutils \ + -lefsrv + - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp --- a/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -21,25 +21,26 @@ #include #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include "unidatamodelloader.h" #include "unidatamodelplugininterface.h" -#include "unieditorgenutils.h" // This is needed for KDefaultMaxSize -#include "s60qconversions.h" +#include "UniEditorGenUtils.h" // This is needed for KDefaultMaxSize +#include #include "debugtraces.h" //DEFINES #define RMODE_INSERT_ERROR hbTrId("Unable to insert. Object format not supported in restricted creation mode.") #define INSERT_ERROR hbTrId("txt_messaging_dpopinfo_unable_to_attach_item_file") +#define INSERT_PROTECTED_ERROR hbTrId("txt_messaging_dpopinfo_unable_to_attach_protected") #define INSERT_QUERY_CONFRM hbTrId("The receiving phone may not support this object. Continue?") // ----------------------------------------------------------------------------- // MmsConformanceCheck::MmsConformanceCheck @@ -49,7 +50,7 @@ { QDEBUG_WRITE("MmsConformanceCheck::MmsConformanceCheck start"); - TRAP_IGNORE( + TRAP_IGNORE( CRepository* repository = CRepository::NewL(KCRUidMmsEngine); CleanupStack::PushL(repository); @@ -63,7 +64,7 @@ repository->Get( KMmsEngineMaximumSendSize, maxSize ); iMaxMmsSize = maxSize; - CleanupStack::PopAndDestroy(repository); + CleanupStack::PopAndDestroy(repository); ); QDEBUG_WRITE("MmsConformanceCheck::MmsConformanceCheck end"); @@ -86,33 +87,33 @@ bool showNote) { QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert start"); - HBufC* filePath = S60QConversions::qStringToS60Desc(file); + HBufC* filePath = XQConversions::qStringToS60Desc(file); if (filePath) { CleanupStack::PushL(filePath); CMmsConformance* mmsConformance = CMmsConformance::NewL(); mmsConformance->CheckCharacterSet(EFalse); - + CleanupStack::PushL(mmsConformance); - - CMsgMediaResolver* mediaResolver = CMsgMediaResolver::NewL(); + + CMsgMediaResolver* mediaResolver = CMsgMediaResolver::NewL(); mediaResolver->SetCharacterSetRecognition(EFalse); - + CleanupStack::PushL(mediaResolver); - + RFile fileHandle = mediaResolver->FileHandleL(*filePath); CleanupClosePushL(fileHandle); CMsgMediaInfo* info = mediaResolver->CreateMediaInfoL(fileHandle); mediaResolver->ParseInfoDetailsL(info,fileHandle); - + TMmsConformance conformance = mmsConformance->MediaConformance(*info); iConfStatus = conformance.iConfStatus; CleanupStack::PopAndDestroy(4); - + // In "free" mode user can insert images that are larger by dimensions than allowed by conformance if (iCreationMode != EMmsCreationModeRestricted) { @@ -134,7 +135,9 @@ } else if (showNote) { - HbMessageBox::question(INSERT_QUERY_CONFRM, this, SLOT(onDialogInsertMedia(HbAction*))); + HbMessageBox::question(INSERT_QUERY_CONFRM, this, + SLOT(onDialogInsertMedia(HbAction*)), + HbMessageBox::Yes | HbMessageBox::No); } else { @@ -152,7 +155,15 @@ // "Not conformant" assumed if check fails. if(showNote) { - showPopup(INSERT_ERROR); + // For protected objects. + if (EFileProtNoProtection != info->Protection()) + { + showPopup(INSERT_PROTECTED_ERROR); + } + else + { + showPopup(INSERT_ERROR); + } } return EInsertNotSupported; @@ -172,18 +183,19 @@ UniDataModelLoader* pluginLoader = new UniDataModelLoader(); UniDataModelPluginInterface* pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Mms); - pluginInterface->setMessageId(messageId); + int error = pluginInterface->setMessageId(messageId); - //Check if slide count is greater than 1 - if (pluginInterface->slideCount() > 1) + //Check if invalid id and slide count is greater than 1 + if ( (error != KErrNone) || pluginInterface->slideCount() > 1) { delete pluginLoader; return false; } - //Check if message size is inside max mms composition limits + //Check if message size is inside max mms composition limits if (pluginInterface->messageSize() > iMaxMmsSize) { + delete pluginLoader; return false; } @@ -209,7 +221,6 @@ if (!retValue) { delete pluginLoader; - return false; } @@ -231,7 +242,6 @@ } delete pluginLoader; - return retValue; } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msguiutils/src/msgcontactsutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msguiutils/src/msgcontactsutil.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,84 @@ +/* + * 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 static utility class handles all contacts & phbk services related + * common functions for UI modules. + * + */ + +#include +#include +#include +#include +#include "msgcontactsutil.h" + + +//--------------------------------------------------------------- +// MsgContactsUtil::copyVCardToTemp +// @see header file +//--------------------------------------------------------------- +QString MsgContactsUtil::copyVCardToTemp(const QString& filepath) +{ + QDir tempDir; + QString tempFilePath(QDir::toNativeSeparators(tempDir.tempPath())); + tempFilePath.append(QDir::separator()); + QFileInfo fInfo(filepath); + tempFilePath.append(fInfo.fileName()); + QFile::copy(filepath, tempFilePath); + return tempFilePath; +} + +//--------------------------------------------------------------- +// MsgContactsUtil::deleteVCardFromTemp +// @see header file +//--------------------------------------------------------------- +void MsgContactsUtil::deleteVCardFromTemp(const QString& filepath) +{ + QFile::remove(filepath); +} + +//--------------------------------------------------------------- +// MsgContactsUtil::launchVCardViewer +// @see header file +//--------------------------------------------------------------- +bool MsgContactsUtil::launchVCardViewer(const QString& filepath) +{ + //TODO: remove copyVcsFile after capabilities fix from Contacts + QString newfilepath = copyVCardToTemp(filepath); + + QString service("com.nokia.services.phonebookservices"); + QString interface("Fetch"); + QString operation("editCreateNew(QString)"); + XQApplicationManager appManager; + XQAiwRequest* request = appManager.create(service, interface, operation, true); //embedded + if(request) + { + QList args; + args << newfilepath; + request->setArguments(args); + QVariant retValue; + bool res = request->send(retValue); + delete request; + } + else + { + return false; + } + //TODO: remove deleteVcsFile after capabilities fix from Contacts + deleteVCardFromTemp(newfilepath); + return true; +} + + +// EOF + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msguiutils/src/msgmediautil.cpp --- a/messagingapp/msgui/msguiutils/src/msgmediautil.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/msguiutils/src/msgmediautil.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -15,7 +15,7 @@ * */ #include -#include +#include #include "msgmediautil.h" diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/msguiutils/src/msgsendutil.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/mmssettingsdefs.h --- a/messagingapp/msgui/unifiededitor/inc/mmssettingsdefs.h Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +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: MMS settings specific enumerations, constants, declaration. - * - */ - -#ifndef MMSSETTINGSDEFS_H -#define MMSSETTINGSDEFS_H - -// INCLUDES - -// CONSTANTS -// Following definitions are applicable when the Unified SMS and MMS editor is in the build. -// (Naming like KMmsImageSmallWidth cannot be used, because it is defined in mmsconst.h) -// Small image: 640*480 -const TInt KMmsUniImageSmallWidth = 640; -const TInt KMmsUniImageSmallHeight = 480; -// Large image: 1600*1200 -const TInt KMmsUniImageLargeWidth = 1600; -const TInt KMmsUniImageLargeHeight = 1200; - -#endif // MMSSETTINGSDEFS_H - -// End of File diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgattachmentcontainer.h --- a/messagingapp/msgui/unifiededitor/inc/msgattachmentcontainer.h Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +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: Container class for msg attachments - * - */ -#ifndef MSGATTACHMENTCONTAINER_H -#define MSGATTACHMENTCONTAINER_H - -#include -#include "msgunieditorattachment.h" - -class QGraphicsLinearLayout; -class MmsConformanceCheck; - -class MsgAttachmentContainer : public HbWidget - { - Q_OBJECT - -public: - /** - * Add Attachment success/failure states - */ - enum AddAttachmentStatus - { - EAddSuccess = 0, EAddNotSupported, EAddSizeExceed - }; - - /** - * Constructor - */ - MsgAttachmentContainer( QGraphicsItem *parent = 0); - - /** - * Destructor - */ - ~MsgAttachmentContainer(); - - /** - * add attachment to the container - * @param filepath of the attachment - * @return add operation status - */ - MsgAttachmentContainer::AddAttachmentStatus addAttachment( - const QString& filepath); - - /** - * count of attachments in the container - * @return count - */ - int count(); - - /** - * List of attachments in the container - * @return attachments list - */ - MsgUnifiedEditorAttachmentList attachmentList(); - - /** - * Check if the container hold multimedia content - * @return true, if multimedia content is present - * false, otherwise. - */ - bool hasMMContent(); - - /** - * Size of the attachment container - * @return size - */ - int containerSize(); - -signals: - /** - * emit when container content changes - */ - void contentChanged(); - - /** - * emit to indicate view that container is now empty - * View deletes the container if it becomes empty - */ - void emptyAttachmentContainer(); - -private slots: - /** - * delete attachment from the container - */ - void deleteAttachment(MsgUnifiedEditorAttachment* attachment); - -private: - /** - * size of the msg - */ - int messageSize(); - -private: - - /** - * container's layout - */ - QGraphicsLinearLayout* mLayout; - - /** - * MMS conformance check utility class - */ - MmsConformanceCheck* mMmsConformanceCheck; - - /** - * attachment list - */ - MsgUnifiedEditorAttachmentList mAttachmentList; - - /** - * flag to tell, if container is holding MM content - */ - bool mIsMMContent; - }; - -#endif // MSGATTACHMENTCONTAINER_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgmonitor.h --- a/messagingapp/msgui/unifiededitor/inc/msgmonitor.h Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,217 +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: Helper class to monitor msg construction in unified editor - * - */ - -#ifndef MSG_MONITOR_H -#define MSG_MONITOR_H - -#include -#include "convergedmessage.h" -class MsgUnifiedEditorView; -class HbWidget; -class UniEditorGenUtils; - -/** - * Helper class to monitor message's contruction in unified editor. - * This class is for only reading editor's content to run its logic. - * This class is NOT a place for content editing inside editor. - */ -class MsgMonitor : public QObject - { - Q_OBJECT - -public: - /** - * Constructor - */ - MsgMonitor(QObject* parent=0); - - /** - * Destructor - */ - ~MsgMonitor(); - - /** - * Set to skip showing note for first time - * @param skip true/false - */ - inline void setSkipNote(bool skip = true); - - /** - * Seeker method to access current message type - */ - static inline ConvergedMessage::MessageType messageType(); - - /** - * seeker function to get current msg size in bytes - */ - static inline int messageSize(); - - /** - * seeker function to get current msg's body size - * in bytes - */ - static inline int bodySize(); - - /** - * seeker function to get current msg's attachment - * container size in bytes - */ - static inline int containerSize(); - - /** - * seeker function to get current msg's subject - * size in bytes - */ - static inline int subjectSize(); - - /** - * seeker function to get max possible mms size - * in bytes - */ - static inline int maxMmsSize(); - - /** - * seeker funtion to get max recipient count for sms - */ - static inline int maxSmsRecipients(); - - /** - * seeker funtion to get max recipient count for mms - */ - static inline int maxMmsRecipients(); - - /** - * get total address count in To, Cc & Bcc fields - */ - static inline int msgAddressCount(); - -public slots: - /** - * slot to handle content change in any editor component - */ - void handleContentChange(); - -private: - /** - * setter method to initialize content - */ - void init(); - - /** - * Determine the projected msg type due to change in editor content - */ - ConvergedMessage::MessageType projectedMsgType(); - - /** - * update various msg info changes during editing - * @param senderWidget, Editor widget which triggered - * content change slot - */ - void updateMsgInfo(HbWidget* senderWidget); - - /** - * show type change discreet note - */ - void showPopup(const QString& text); - - /** - * accessor for view - */ - MsgUnifiedEditorView* view(); - - /** - * check editor body for MMS content - * @return true if MMS content is present - */ - bool bodyHasMMSContent(); - - /** - * check editor subject for MMS content - * @return true if MMS content is present - */ - bool subjectHasMMSContent(); - - /** - * check editor attachment container for MMS content - * @return true if MMS content is present - */ - bool containerHasMMSContent(); - - /** - * check for other MMS content criteria - * @return true if MMS criteria is met - */ - bool otherMMSCriteriaMet(); - -private: - - /** - * Flag to skip showing the type change popup. - * Note need to be skipped when an mms is opened from draft. - */ - bool mSkipNote; - - /** - * Type of msg under composition in the editor - */ - static ConvergedMessage::MessageType mMessageType; - - /** - * msg body size in bytes - */ - static int mBodySize; - - /** - * msg container size in bytes - */ - static int mContainerSize; - - /** - * msg subject size in bytes - */ - static int mSubjectSize; - - /** - * max mms size in bytes - */ - static int mMaxMmsSize; - - /** - * max recipient count in an sms - */ - static int mMaxSmsRecipients; - - /** - * max recipient count in an sms - */ - static int mMaxMmsRecipients; - - /** - * current msg address count (to + cc + bcc) - */ - static int mMsgCurrAddressCount; - - /** - * UniEditorGenUtils object - * Owned - */ - UniEditorGenUtils* mUniEditorGenUtils; - }; - -#include "msgmonitor.inl" - -#endif //MSG_MONITOR_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgmonitor.inl --- a/messagingapp/msgui/unifiededitor/inc/msgmonitor.inl Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: msgmonitor.inl -*/ - - - -// ========== INLINE METHODS =============================== - -//--------------------------------------------------------------- -// MsgMonitor::setSkipNote -// @see header file -//--------------------------------------------------------------- -inline void MsgMonitor::setSkipNote(bool skip) -{ - mSkipNote = skip; -} - -//--------------------------------------------------------------- -// MsgMonitor::messageType -// @see header file -//--------------------------------------------------------------- -inline ConvergedMessage::MessageType MsgMonitor::messageType() -{ - return mMessageType; -} - -//--------------------------------------------------------------- -// MsgMonitor::messageSize -// @see header file -//--------------------------------------------------------------- -inline int MsgMonitor::messageSize() -{ - return mBodySize + mContainerSize + mSubjectSize; -} - -//--------------------------------------------------------------- -// MsgMonitor::bodySize -// @see header file -//--------------------------------------------------------------- -inline int MsgMonitor::bodySize() -{ - return mBodySize; -} - -//--------------------------------------------------------------- -// MsgMonitor::containerSize -// @see header file -//--------------------------------------------------------------- -inline int MsgMonitor::containerSize() -{ - return mContainerSize; -} - -//--------------------------------------------------------------- -// MsgMonitor::subjectSize -// @see header file -//--------------------------------------------------------------- -inline int MsgMonitor::subjectSize() -{ - return mSubjectSize; -} - -//--------------------------------------------------------------- -// MsgMonitor::maxMmsSize -// @see header file -//--------------------------------------------------------------- -inline int MsgMonitor::maxMmsSize() -{ - return mMaxMmsSize; -} - -//--------------------------------------------------------------- -// MsgMonitor::maxSmsRecipients -// @see header file -//--------------------------------------------------------------- -inline int MsgMonitor::maxSmsRecipients() -{ - return mMaxSmsRecipients; -} - -//--------------------------------------------------------------- -// MsgMonitor::maxMmsRecipients -// @see header file -//--------------------------------------------------------------- -inline int MsgMonitor::maxMmsRecipients() -{ - return mMaxMmsRecipients; -} - -//--------------------------------------------------------------- -// MsgMonitor::msgAddressCount -// @see header file -//--------------------------------------------------------------- -inline int MsgMonitor::msgAddressCount() -{ - return mMsgCurrAddressCount; -} - -// End of File diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditoraddress.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditoraddress.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditoraddress.h Thu Jul 22 16:32:06 2010 +0100 @@ -15,10 +15,10 @@ * */ -#ifndef UNIFIED_EDITOR_ADDRESS_H -#define UNIFIED_EDITOR_ADDRESS_H +#ifndef MSG_UNIFIED_EDITOR_ADDRESS_H +#define MSG_UNIFIED_EDITOR_ADDRESS_H -#include +#include #include #include @@ -132,6 +132,11 @@ * Handle invalid contact dialog useraction */ void handleInvalidContactDialog(HbAction* act); + + /** + * Unblocks signals for pbk buttion after some delay. + */ + void unblockSignals(); private: /** @@ -153,6 +158,13 @@ * Reset the addresslist to previous list */ void resetToPrevious(); + + /** + * checks if the passed sting is a valid address or not. + * @param addr + * @retunr true/false based on valid/invalid. + */ + bool checkValidAddress(const QString& addr); private: @@ -202,4 +214,4 @@ int mExceedsMaxMmsRecipientsBy; }; -#endif //UNIFIED_EDITOR_ADDRESS_H +#endif //MSG_UNIFIED_EDITOR_ADDRESS_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditorattachment.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditorattachment.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorattachment.h Thu Jul 22 16:32:06 2010 +0100 @@ -15,8 +15,8 @@ * */ -#ifndef UNIFIED_EDITOR_ATTACHMENT_H -#define UNIFIED_EDITOR_ATTACHMENT_H +#ifndef MSG_UNIFIED_EDITOR_ATTACHMENT_H +#define MSG_UNIFIED_EDITOR_ATTACHMENT_H #include #include @@ -24,6 +24,8 @@ class HbTextItem; class HbIconItem; class HbGestureSceneFilter; +class HbFrameItem; +class MsgUnifiedEditorUtils; class MsgUnifiedEditorAttachment : public HbWidget { @@ -67,24 +69,16 @@ */ bool isMultimediaContent(); - /* - * Depricated - */ - // HbFeedback::InstantEffect overrideFeedback(Hb::InstantInteraction interaction) const; - protected: /** * reimplemented from base class. */ - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + virtual void gestureEvent(QGestureEvent *event); private: - /** - * Helper method to initialize gesture. - */ - void initGesture(); + + void setPressed(bool pressed); signals: @@ -102,22 +96,33 @@ /** * show longpress menu for attachment object */ - void longPressed(QPointF position); + void handleLongTap(QPointF position); + + /** + * Handles short tap event. + */ + void handleShortTap(); /** * slot to remove attachment from msg editor */ - void removeAttachment(); + void handleRemove(); /** * slot to open attachment */ - void openAttachment(); + void handleOpen(); /** * slot to view details of the attachment file */ void viewDetails(); + + /** + * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture + * events back to back. + */ + void regrabGesture(); private: /** @@ -159,9 +164,21 @@ * Max limit on sms size. Store at class level for optimization */ int mMaxSmsSize; + + /** + * Background item + * Own + */ + HbFrameItem* mBackGround; + + /** + * MsgUnifiedEditorUtils object. + * Own + */ + MsgUnifiedEditorUtils *mEditorUtils; }; typedef QList MsgUnifiedEditorAttachmentList; -#endif //UNIFIED_EDITOR_ATTACHMENT_H +#endif //MSG_UNIFIED_EDITOR_ATTACHMENT_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditorattachmentcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorattachmentcontainer.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Container class for msg attachments + * + */ +#ifndef MSG_UNIFIED_EDITOR_ATTACHMENT_CONTAINER_H +#define MSG_UNIFIED_EDITOR_ATTACHMENT_CONTAINER_H + +#include +#include "msgunieditorattachment.h" + +class QGraphicsLinearLayout; +class MmsConformanceCheck; + +class MsgAttachmentContainer : public HbWidget + { + Q_OBJECT + +public: + /** + * Add Attachment success/failure states + */ + enum AddAttachmentStatus + { + EAddSuccess = 0, EAddNotSupported, EAddSizeExceed + }; + + /** + * Constructor + */ + MsgAttachmentContainer( QGraphicsItem *parent = 0); + + /** + * Destructor + */ + ~MsgAttachmentContainer(); + + /** + * add attachment to the container + * @param filepath of the attachment + * @return add operation status + */ + MsgAttachmentContainer::AddAttachmentStatus addAttachment( + const QString& filepath); + + /** + * count of attachments in the container + * @return count + */ + int count(); + + /** + * List of attachments in the container + * @return attachments list + */ + MsgUnifiedEditorAttachmentList attachmentList(); + + /** + * Check if the container hold multimedia content + * @return true, if multimedia content is present + * false, otherwise. + */ + bool hasMMContent(); + + /** + * Size of the attachment container + * @return size + */ + int containerSize(); + +signals: + /** + * emit when container content changes + */ + void contentChanged(); + + /** + * emit to indicate view that container is now empty + * View deletes the container if it becomes empty + */ + void emptyAttachmentContainer(); + +private slots: + /** + * delete attachment from the container + */ + void deleteAttachment(MsgUnifiedEditorAttachment* attachment); + +private: + /** + * size of the msg + */ + int messageSize(); + +private: + + /** + * container's layout + */ + QGraphicsLinearLayout* mLayout; + + /** + * MMS conformance check utility class + */ + MmsConformanceCheck* mMmsConformanceCheck; + + /** + * attachment list + */ + MsgUnifiedEditorAttachmentList mAttachmentList; + + /** + * flag to tell, if container is holding MM content + */ + bool mIsMMContent; + }; + +#endif // MSG_UNIFIED_EDITOR_ATTACHMENT_CONTAINER_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditoraudiowidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditoraudiowidget.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: This widget is used to display audio content. + * + */ + +#ifndef MSG_UNIFIED_EDITOR_AUDIO_WIDGET_H +#define MSG_UNIFIED_EDITOR_AUDIO_WIDGET_H + +// FORWARD DECLARATIONS +class MsgUnifiedEditorUtils; + +#include + +/** + * @class MsgUniFiedEditorAudioWidget + * @brief This widget is used to display audio content in univiewer. + */ +class MsgUniFiedEditorAudioWidget: public HbPushButton +{ +Q_OBJECT + +public: + + /** + * Constructor + */ + explicit MsgUniFiedEditorAudioWidget(QGraphicsItem *parent = 0); + + /** + * Destructor + */ + ~MsgUniFiedEditorAudioWidget(); + + /** + * Populates the widget contents. + * @param mimeType Mime type of media. + * @param filePath File path of media. + */ + void populate(const QString &filePath); + +signals: + + /** + * Signal emitted when widget is clicked. + * @param mediaPath File path of the media. + */ + void shortTap(const QString &mediaPath); + + /** + * Signal emitted when widget is long tapped. + * @param position Scene coordinates of tap. + */ + void longTap(const QPointF &position); + + /** + * Emitted when remove action is triggered. + */ + void remove(); + +private slots: + + /** + * Handles short tap event. + */ + void handleShortTap(); + + /** + * Handles long tap event. + * @param position Scene coordinates of tap. + */ + void handleLongTap(const QPointF &position); + + /** + * Handles opening of media. + */ + void handleOpen(); + + /** + * Handles removing of media. + */ + void handleRemove(); + + /** + * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture + * events back to back. + */ + void regrabGesture(); + +private: + + /** + * MsgUnifiedEditorUtils object. + * Own + */ + MsgUnifiedEditorUtils *mEditorUtils; + + /** + * Media file path. + */ + QString mMediaPath; +}; + +#endif //MSG_UNIFIED_EDITOR_AUDIO_WIDGET_H +// EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditorbasewidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorbasewidget.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description:common base class for editor fields(address field,subject field, + * and body field. + * + */ + +#include + +#ifndef MSG_UNIFIED_EDITOR_BASEWIDGET_H +#define MSG_UNIFIED_EDITOR_BASEWIDGET_H + +class MsgUnifiedEditorBaseWidget: public HbWidget +{ + Q_OBJECT + +public: + MsgUnifiedEditorBaseWidget(QGraphicsItem *parent = 0):HbWidget(parent){} + virtual void setFocus(){} + +}; + + +#endif /* MSG_UNIFIED_EDITOR_BASEWIDGET_H */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h Thu Jul 22 16:32:06 2010 +0100 @@ -15,24 +15,23 @@ * */ -#ifndef UNIFIED_EDITOR_BODY_H -#define UNIFIED_EDITOR_BODY_H +#ifndef MSG_UNIFIED_EDITOR_BODY_H +#define MSG_UNIFIED_EDITOR_BODY_H -#include +#include #include #include "msgunieditorprocessimageoperation.h" class HbTextEdit; class HbTextItem; class HbFrameItem; -class HbIconItem; -class HbPushButton; -//class HbGestureSceneFilter; class CMsgMediaResolver; class CMsgImageInfo; class MmsConformanceCheck; class UniEditorPluginInterface; class UniEditorPluginLoader; +class MsgUnifiedEditorPixmapWidget; +class MsgUniFiedEditorAudioWidget; class MsgUnifiedEditorBody : public MsgUnifiedEditorBaseWidget, @@ -97,13 +96,28 @@ * @return bool */ bool hasAudio(); + + /** + * from MUniEditorProcessImageOperationObserver + * @see MUniEditorProcessImageOperationObserver + */ + void EditorOperationEvent( TUniEditorProcessImageOperationEvent aEvent, + TFileName aFileName ); + /** + * Function which tells whether the image resize process is in progress + */ + bool isImageResizing() + { + return mIsImageResizing; + } public slots: /** * Called to insert image content in editor. * @param medialist list of absolute paths of media. + * @param draftMessage specifies draft message */ - void setImage(QString& imagefile); + void setImage(QString& imagefile, bool draftMessage = false); /** * Called to insert audio content in editor. @@ -127,14 +141,14 @@ * Emitted when msg-body content changes */ void contentChanged(); + + /** + * Emitted when image is being processed. + * @param enable, true to enable/ false to disable. + */ + void enableSendButton(bool enable) const; -public: // from MUniEditorProcessImageOperationObserver - - /* - * @see MUniEditorProcessImageOperationObserver - */ - void EditorOperationEvent( TUniEditorProcessImageOperationEvent aEvent, - TFileName aFileName ); + protected: // from HbWidget @@ -145,41 +159,17 @@ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const; private slots: - /** - * called on long press on the media objects - */ - void longPressed(QPointF position); /** * called from the media object's item specific menu */ void removeMedia(); - - /** - * called from the media object's item specific menu - */ - void openMedia(); - - /** - * called from the media object's item specific menu - */ - void viewDetails(); /** * handle text changes in body field */ void onTextChanged(); - /** - * Service launch complete. - */ - void handleOk(const QVariant& result); - - /** - * Service launch errors. - */ - void handleError(int errorCode, const QString& errorMessage); - private: /** @@ -192,12 +182,6 @@ * Set that body now contains an audio */ void setAudio(bool audio = false); - - /** - * Get the region (image/audio/video) where longpress happened - * @return region - */ - QString getHitRegion(QPointF position); /** * size of the msg @@ -238,19 +222,14 @@ HbTextEdit* mTextEdit; /** - * frame for editor. - */ - HbFrameItem* mEditorFrame; - - /** * icon item to preview images. */ - HbIconItem* mIconItem; + MsgUnifiedEditorPixmapWidget* mPixmapItem; /** * inline audio item */ - HbPushButton* mAudioItem; + MsgUniFiedEditorAudioWidget* mAudioItem; /** * Image file contained inside body @@ -271,11 +250,6 @@ * Video file contained inside body */ QString mVideoFile; - - /** - * To setup longpress gesture on media objects - */ - //HbGestureSceneFilter* mGestureFilter; /** * MMs conformance check utility class @@ -359,6 +333,17 @@ * Content widget for processing animation. */ HbWidget* mProcessingWidget; + + /** + * boolean specifying a draft message + */ + bool mDraftMessage ; + + /* + * Flag to indicate the state of image resizing process. + * true - resize in progress. false - resize is not underway. + */ + bool mIsImageResizing; }; -#endif //UNIFIED_EDITOR_BODY_H +#endif //MSG_UNIFIED_EDITOR_BODY_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditorimageprocessor.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditorimageprocessor.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorimageprocessor.h Thu Jul 22 16:32:06 2010 +0100 @@ -18,8 +18,8 @@ -#ifndef C_UNIIMAGEPROCESSOR_H -#define C_UNIIMAGEPROCESSOR_H +#ifndef MSG_UNIFIED_EDITOR_IMAGE_PROCESSOR_H +#define MSG_UNIFIED_EDITOR_IMAGE_PROCESSOR_H // INCLUDES #include @@ -412,4 +412,4 @@ #include -#endif // C_UNIIMAGEPROCESSOR_H +#endif // MSG_UNIFIED_EDITOR_IMAGE_PROCESSOR_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditorlineedit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorlineedit.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Derieved HbLineEdit class for custom address editor +* +*/ + +#ifndef MSG_UNIFIED_EDITOR_LINEEDIT_H +#define MSG_UNIFIED_EDITOR_LINEEDIT_H + +#include +#include + + +class MsgUnifiedEditorLineEdit : public HbLineEdit +{ + Q_OBJECT + +public: + /** + * Constructor + */ + MsgUnifiedEditorLineEdit(const QString& label, QGraphicsItem* parent=0); + + /** + * Destructor + */ + ~MsgUnifiedEditorLineEdit(); + + /** + * seeker method for getting address list + */ + QStringList addresses(); + + /** + * Flag to retain or override base-class behaviour + * Needed because address & subject field classes derieve + * from this class, but have different behaviour + */ + void setDefaultBehaviour(bool defaultBehaviour = false); + + /** + * seeker method for getting the text content held by editing field + */ + QString content() const; + + /** + * setter method to clear text content of the editing field + */ + void clearContent(); + + /** + * set highlight on invalid contact + * @param invalidStr, String to be highlighted + */ + void highlightInvalidString(QString invalidStr); + +signals: + void contentsChanged(const QString& text); + +public slots: + void setText(const QString &text, bool underlined = true); + +private slots: + void selectionChanged(const QTextCursor &oldCursor, const QTextCursor& newCursor); + void onContentsChanged(); + void aboutToShowContextMenu(HbMenu *contextMenu, const QPointF &pos); + +protected: // from HbLineEdit + void inputMethodEvent(QInputMethodEvent *event); + void keyPressEvent(QKeyEvent *event); + void gestureEvent(QGestureEvent* event); + void focusInEvent(QFocusEvent* event); + void focusOutEvent(QFocusEvent *event); + void timerEvent (QTimerEvent *event); + + +private: + void setHighlight(int currentPos); + QString text() const; + void handleTap(); + +private: + QRegExp mLabelExpr; + QString mLabel; + QBasicTimer mSelectionSnapTimer; + + int mSelectionStart; + int mSelectionEnd; + bool mDefaultBehaviour; +}; + +#endif // MSG_UNIFIED_EDITOR_LINEEDIT_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditormmssettingsdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditormmssettingsdefs.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: MMS settings specific enumerations, constants, declaration. + * + */ + +#ifndef MSG_UNIFIED_EDITOR_MMS_SETTINGSDEFS_H +#define MSG_UNIFIED_EDITOR_MMS_SETTINGSDEFS_H + +// INCLUDES + +// CONSTANTS +// Following definitions are applicable when the Unified SMS and MMS editor is in the build. +// (Naming like KMmsImageSmallWidth cannot be used, because it is defined in mmsconst.h) +// Small image: 640*480 +const TInt KMmsUniImageSmallWidth = 640; +const TInt KMmsUniImageSmallHeight = 480; +// Large image: 1600*1200 +const TInt KMmsUniImageLargeWidth = 1600; +const TInt KMmsUniImageLargeHeight = 1200; + +#endif // MSG_UNIFIED_EDITOR_MMS_SETTINGSDEFS_H + +// End of File diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditormonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditormonitor.h Thu Jul 22 16:32:06 2010 +0100 @@ -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: Helper class to monitor msg construction in unified editor + * + */ + +#ifndef MSG_UNIFIED_EDITOR_MONITOR_H +#define MSG_UNIFIED_EDITOR_MONITOR_H + +#include +#include "convergedmessage.h" +class MsgUnifiedEditorView; +class HbWidget; +class UniEditorGenUtils; + +/** + * Helper class to monitor message's contruction in unified editor. + * This class is for only reading editor's content to run its logic. + * This class is NOT a place for content editing inside editor. + */ +class MsgUnifiedEditorMonitor : public QObject + { + Q_OBJECT + +public: + /** + * Constructor + */ + MsgUnifiedEditorMonitor(QObject* parent=0); + + /** + * Destructor + */ + ~MsgUnifiedEditorMonitor(); + + /** + * Set to skip showing note for first time + * @param skip true/false + */ + inline void setSkipNote(bool skip = true); + + /** + * Seeker method to access current message type + */ + static inline ConvergedMessage::MessageType messageType(); + + /** + * seeker function to get current msg size in bytes + */ + static inline int messageSize(); + + /** + * seeker function to get current msg's body size + * in bytes + */ + static inline int bodySize(); + + /** + * seeker function to get current msg's attachment + * container size in bytes + */ + static inline int containerSize(); + + /** + * seeker function to get current msg's subject + * size in bytes + */ + static inline int subjectSize(); + + /** + * seeker function to get max possible mms size + * in bytes + */ + static inline int maxMmsSize(); + + /** + * seeker funtion to get max recipient count for sms + */ + static inline int maxSmsRecipients(); + + /** + * seeker funtion to get max recipient count for mms + */ + static inline int maxMmsRecipients(); + + /** + * get total address count in To, Cc & Bcc fields + */ + static inline int msgAddressCount(); + +public slots: + /** + * slot to handle content change in any editor component + */ + void handleContentChange(); + +signals: + /** + * Emitted when composed message can be sent. + * @param enable true if send is possible else false. + */ + void enableSend(bool enable); + +private: + /** + * setter method to initialize content + */ + void init(); + + /** + * Determine the projected msg type due to change in editor content + */ + ConvergedMessage::MessageType projectedMsgType(); + + /** + * update various msg info changes during editing + * @param senderWidget, Editor widget which triggered + * content change slot + */ + void updateMsgInfo(HbWidget* senderWidget); + + /** + * show type change discreet note + */ + void showPopup(const QString& text); + + /** + * accessor for view + */ + MsgUnifiedEditorView* view(); + + /** + * check editor body for MMS content + * @return true if MMS content is present + */ + bool bodyHasMMSContent(); + + /** + * check editor subject for MMS content + * @return true if MMS content is present + */ + bool subjectHasMMSContent(); + + /** + * check editor attachment container for MMS content + * @return true if MMS content is present + */ + bool containerHasMMSContent(); + + /** + * check for other MMS content criteria + * @return true if MMS criteria is met + */ + bool otherMMSCriteriaMet(); + + /** + * Checks if composed message can be sent and emits a signal. + */ + void updateSend(); + +private: + + /** + * Flag to skip showing the type change popup. + * Note need to be skipped when an mms is opened from draft. + */ + bool mSkipNote; + + /** + * Type of msg under composition in the editor + */ + static ConvergedMessage::MessageType mMessageType; + + /** + * msg body size in bytes + */ + static int mBodySize; + + /** + * msg container size in bytes + */ + static int mContainerSize; + + /** + * msg subject size in bytes + */ + static int mSubjectSize; + + /** + * max mms size in bytes + */ + static int mMaxMmsSize; + + /** + * max recipient count in an sms + */ + static int mMaxSmsRecipients; + + /** + * max recipient count in an sms + */ + static int mMaxMmsRecipients; + + /** + * current msg address count (to + cc + bcc) + */ + static int mMsgCurrAddressCount; + + /** + * UniEditorGenUtils object + * Owned + */ + UniEditorGenUtils* mUniEditorGenUtils; + }; + +#include "msgunieditormonitor.inl" + +#endif //MSG_UNIFIED_EDITOR_MONITOR_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditormonitor.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditormonitor.inl Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: msgmonitor.inl +*/ + + + +// ========== INLINE METHODS =============================== + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::setSkipNote +// @see header file +//--------------------------------------------------------------- +inline void MsgUnifiedEditorMonitor::setSkipNote(bool skip) +{ + mSkipNote = skip; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::messageType +// @see header file +//--------------------------------------------------------------- +inline ConvergedMessage::MessageType MsgUnifiedEditorMonitor::messageType() +{ + return mMessageType; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::messageSize +// @see header file +//--------------------------------------------------------------- +inline int MsgUnifiedEditorMonitor::messageSize() +{ + return mBodySize + mContainerSize + mSubjectSize; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::bodySize +// @see header file +//--------------------------------------------------------------- +inline int MsgUnifiedEditorMonitor::bodySize() +{ + return mBodySize; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::containerSize +// @see header file +//--------------------------------------------------------------- +inline int MsgUnifiedEditorMonitor::containerSize() +{ + return mContainerSize; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::subjectSize +// @see header file +//--------------------------------------------------------------- +inline int MsgUnifiedEditorMonitor::subjectSize() +{ + return mSubjectSize; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::maxMmsSize +// @see header file +//--------------------------------------------------------------- +inline int MsgUnifiedEditorMonitor::maxMmsSize() +{ + return mMaxMmsSize; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::maxSmsRecipients +// @see header file +//--------------------------------------------------------------- +inline int MsgUnifiedEditorMonitor::maxSmsRecipients() +{ + return mMaxSmsRecipients; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::maxMmsRecipients +// @see header file +//--------------------------------------------------------------- +inline int MsgUnifiedEditorMonitor::maxMmsRecipients() +{ + return mMaxMmsRecipients; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::msgAddressCount +// @see header file +//--------------------------------------------------------------- +inline int MsgUnifiedEditorMonitor::msgAddressCount() +{ + return mMsgCurrAddressCount; +} + +// End of File diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditorpixmapwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorpixmapwidget.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: This widget displays the pixmap content. + * + */ + +#ifndef MSG_UNIFIED_EDITOR_PIXMAP_WIDGET_H +#define MSG_UNIFIED_EDITOR_PIXMAP_WIDGET_H + +#include + +// FORWARD DECLARATIONS +class MsgUnifiedEditorUtils; + +/** + * This widget displays the pixmap content. + */ +class MsgUnifiedEditorPixmapWidget: public HbIconItem +{ +Q_OBJECT + +public: + + /** + * Constructor + */ + MsgUnifiedEditorPixmapWidget(QGraphicsItem *parent = 0); + + /** + * Destructor + */ + ~MsgUnifiedEditorPixmapWidget(); + + /** + * Sets the pixmap content to be displayed. + * @param imagePath File path of the image. + */ + void populate(const QString &imagePath); + +signals: + + /** + * Signal emitted when widget is clicked. + * @param mediaPath File path of the media. + */ + void shortTap(const QString &mediaPath); + + /** + * Signal emitted when widget is long tapped. + * @param position Scene coordinates of tap. + */ + void longTap(const QPointF &position); + + /** + * Emitted when remove action is triggered. + */ + void remove(); + +protected: + + /** + * Event handler for gesture events. + * Reimplemented from HbWidgetBase. + * @see HbWidgetBase + */ + virtual void gestureEvent(QGestureEvent *event); + +private slots: + + /** + * Handles opening of media. + */ + void handleOpen(); + + /** + * Handles removing of media. + */ + void handleRemove(); + + /** + * Handles opening of details view. + */ + void viewDetails(); + + /** + * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture + * events back to back. + */ + void regrabGesture(); + +private: + + /** + * Handles short tap event. + */ + void handleShortTap(); + + /** + * Handles long tap event. + * @param position Scene coordinates of tap. + */ + void handleLongTap(const QPointF &position); + +private: + + /** + * MsgUnifiedEditorUtils object. + * Own + */ + MsgUnifiedEditorUtils *mEditorUtils; + + /** + * Pixmap file path being set. + */ + QString mPixmapPath; +}; + +#endif /* MSG_UNIFIED_EDITOR_PIXMAP_WIDGET_H */ + +// EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditorprocessimageoperation.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditorprocessimageoperation.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorprocessimageoperation.h Thu Jul 22 16:32:06 2010 +0100 @@ -17,8 +17,8 @@ -#ifndef __UNIEDITORPROCESSIMAGEOPERATION_H -#define __UNIEDITORPROCESSIMAGEOPERATION_H +#ifndef MSG_UNIFIED_EDITOR_PROCESS_IMAGEOPERATION_H +#define MSG_UNIFIED_EDITOR_PROCESS_IMAGEOPERATION_H // INCLUDES @@ -262,4 +262,4 @@ TBool largeImageQuery; }; -#endif //__UNIEDITORPROCESSIMAGEOPERATION_H +#endif //MSG_UNIFIED_EDITOR_PROCESS_IMAGEOPERATION_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditorsubject.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditorsubject.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorsubject.h Thu Jul 22 16:32:06 2010 +0100 @@ -14,10 +14,10 @@ * Description: */ -#ifndef UNIFIED_EDITOR_SUBJECT_H -#define UNIFIED_EDITOR_SUBJECT_H +#ifndef MSG_UNIFIED_EDITOR_SUBJECT_H +#define MSG_UNIFIED_EDITOR_SUBJECT_H -#include +#include #include "convergedmessage.h" @@ -120,4 +120,4 @@ QString mPrevBuffer; }; -#endif //UNIFIED_EDITOR_SUBJECT_H +#endif //MSG_UNIFIED_EDITOR_SUBJECT_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditorutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorutils.h Thu Jul 22 16:32:06 2010 +0100 @@ -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: Utility class for unieditor. + * + */ + +#ifndef MSG_UNIFIED_EDITOR_UTILS_H +#define MSG_UNIFIED_EDITOR_UTILS_H + +// SYSTEM INCLUDES +#include + +// FORWARD DECLARATIONS + +/** + * @class MsgUnifiedEditorUtils + * @brief Utility class for univiewer. Contains common functionality required + * for widgets. + */ + +class MsgUnifiedEditorUtils: public QObject +{ +Q_OBJECT + +public: + + /** + * Constructor + */ + explicit MsgUnifiedEditorUtils(QObject *parent = 0); + + /** + * Destructor + */ + virtual ~MsgUnifiedEditorUtils(); + + /** + * Utility function to launch different content viewers. + * @param mimeType Mime type of the content. + * @param filePath Absolute file path of content. + */ + void launchContentViewer(const QString &mimeType, const QString &filePath); + +signals: + + /** + * Service launch complete. + */ + void requestOk(const QVariant& result); + + /** + * Service launch errors. + */ + void requestError(int errorCode, const QString& errorMessage); + +private slots: + + /** + * Service launch complete. + */ + void handleOk(const QVariant& result); + + /** + * Service launch errors. + */ + void handleError(int errorCode, const QString& errorMessage); + +private: + + /** + * Launch content viewer using XQSharableFile. + * @param filePath Absolute path of content. + */ + void launchViaSharableFile(const QString &filePath); + +}; + +#endif // MSG_UNIFIED_EDITOR_UTILS_H +//eof diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunieditorview.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditorview.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorview.h Thu Jul 22 16:32:06 2010 +0100 @@ -15,8 +15,8 @@ * */ -#ifndef UNIFIED_EDITOR_VIEW_H -#define UNIFIED_EDITOR_VIEW_H +#ifndef MSG_UNIFIED_EDITOR_VIEW_H +#define MSG_UNIFIED_EDITOR_VIEW_H #ifdef UNIFIEDEDITOR_DLL #define UNIFIEDEDITOR_EXPORT Q_DECL_EXPORT @@ -35,7 +35,7 @@ class MsgUnifiedEditorSubject; class MsgUnifiedEditorAddress; class MsgUnifiedEditorBody; -class MsgMonitor; +class MsgUnifiedEditorMonitor; class MsgAttachmentContainer; class UniEditorPluginLoader; class HbListWidgetItem; @@ -75,7 +75,7 @@ /** * Saves the content inside editor to save */ - void saveContentToDrafts(); + int saveContentToDrafts(); protected: /** @@ -105,9 +105,11 @@ /** * Populate editor with prepopulated msg content + * @param messageDetails message details + * @param draftMessage boolean for specifying draft message */ void populateContentIntoEditor( - const ConvergedMessage& messageDetails); + const ConvergedMessage& messageDetails, bool draftMessage = false); /** * Populate the editor with the forwarded message's content @@ -182,6 +184,13 @@ void setAttachOptionEnabled(MsgUnifiedEditorView::TBE_AttachOption opt, bool enable); + /** + * Addresses are all ok. Now parse not allowed chars away + * before giving it to MTM + * @param addresses, list of ConvergedMessageAddress + */ + void formatAddresses(ConvergedMessageAddressList& addresses); + private slots: /** @@ -205,11 +214,6 @@ void changePriority(); /** - * slot for different sending options. - */ - void sendingOptions(); - - /** * slot to current delete message. */ void deleteMessage(); @@ -220,11 +224,6 @@ void imagesFetched(const QVariant& result ); /** - * slot to fetch audio files - */ - void audiosFetched(const QVariant& result ); - - /** * slot to receive fetched contacts */ void contactsFetched(const QVariant& value); @@ -317,10 +316,17 @@ * @param action selected action (yes or no). */ void onDialogMmsSettings(HbAction* action); + + /** + * Enable/Disable send tool button. + * @param true/false to enable/disable. + */ + void enableSendButton(bool enable); private: HbAction* mSubjectAction; HbAction* mCcBccAction; + HbAction* mSendAction; QGraphicsLinearLayout* mMainLayout; MsgUnifiedEditorSubject* mSubjectField; MsgUnifiedEditorAddress* mToField; @@ -330,7 +336,7 @@ HbWidget* mContentWidget; - MsgMonitor* mMsgMonitor; + MsgUnifiedEditorMonitor* mMsgMonitor; MsgAttachmentContainer* mAttachmentContainer; UniEditorPluginLoader* mPluginLoader; ConvergedMessageId mOpenedMessageId; @@ -347,7 +353,7 @@ */ HbAbstractVkbHost* mVkbHost; - friend class MsgMonitor; + friend class MsgUnifiedEditorMonitor; }; -#endif //UNIFIED_EDITOR_VIEW_H +#endif //MSG_UNIFIED_EDITOR_VIEW_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunifiededitorbasewidget.h --- a/messagingapp/msgui/unifiededitor/inc/msgunifiededitorbasewidget.h Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +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:common base class for editor fields(address field,subject field, - * and body field. - * - */ - -#include - -#ifndef MSGUNIFIEDEDITORBASEWIDGET_H_ -#define MSGUNIFIEDEDITORBASEWIDGET_H_ - -class MsgUnifiedEditorBaseWidget: public HbWidget -{ - Q_OBJECT - -public: - MsgUnifiedEditorBaseWidget(QGraphicsItem *parent = 0):HbWidget(parent){} - virtual void setFocus(){} - -}; - - -#endif /* MSGUNIFIEDEDITORBASEWIDGET_H_ */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/inc/msgunifiededitorlineedit.h --- a/messagingapp/msgui/unifiededitor/inc/msgunifiededitorlineedit.h Thu Jun 17 09:57:06 2010 +0100 +++ /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: Derieved HbLineEdit class for custom address editor -* -*/ - -#ifndef MSGUNIFIEDEDITORLINEEDIT_H -#define MSGUNIFIEDEDITORLINEEDIT_H - -#include -#include - - -class MsgUnifiedEditorLineEdit : public HbLineEdit -{ - Q_OBJECT - -public: - /** - * Constructor - */ - MsgUnifiedEditorLineEdit(const QString& label, QGraphicsItem* parent=0); - - /** - * Destructor - */ - ~MsgUnifiedEditorLineEdit(); - - /** - * seeker method for getting address list - */ - QStringList addresses(); - - /** - * Flag to retain or override base-class behaviour - * Needed because address & subject field classes derieve - * from this class, but have different behaviour - */ - void setDefaultBehaviour(bool defaultBehaviour = false); - - /** - * seeker method for getting the text content held by editing field - */ - QString content() const; - - /** - * setter method to clear text content of the editing field - */ - void clearContent(); - - /** - * set highlight on invalid contact - * @param invalidStr, String to be highlighted - */ - void highlightInvalidString(QString invalidStr); - -signals: - void contentsChanged(const QString& text); - -public slots: - void setText(const QString &text, bool underlined = true); - void cut(); - void selectAll(); - -private slots: - void selectionChanged(const QTextCursor &oldCursor, const QTextCursor& newCursor); - void onContentsChanged(); - -protected: // from HbLineEdit - void inputMethodEvent(QInputMethodEvent *event); - void keyPressEvent(QKeyEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); - void focusInEvent(QFocusEvent* event); - void focusOutEvent(QFocusEvent *event); - void timerEvent (QTimerEvent *event); - - -private: - void setHighlight(int currentPos); - QString text() const; - -private: - QRegExp mLabelExpr; - QString mLabel; - QBasicTimer mSelectionSnapTimer; - - int mSelectionStart; - int mSelectionEnd; - bool mDefaultBehaviour; -}; - -#endif // MSGUNIFIEDEDITORLINEEDIT_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment.css --- a/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment.css Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment.css Thu Jul 22 16:32:06 2010 +0100 @@ -33,12 +33,7 @@ text-height:var(hb-param-text-height-tiny); text-line-count-min:1; text-line-count-max:1; - fixed-width: 13.0un; + size-policy:fixed fixed; text-align:right; } -MsgUnifiedEditorAttachment::bgFrame -{ - zvalue:-1; -} - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment.widgetml --- a/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment.widgetml Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment.widgetml Thu Jul 22 16:32:06 2010 +0100 @@ -11,11 +11,6 @@ - - - - - \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment_color.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment_color.css Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,20 @@ + +MsgUnifiedEditorAttachment[state="normal"]::attachmentDetails +{ + color:var(qtc_list_item_title_normal); +} + +MsgUnifiedEditorAttachment[state="pressed"]::attachmentDetails +{ + color:var(qtc_list_item_pressed); +} + +MsgUnifiedEditorAttachment[state="normal"]::attachmentName +{ + color:var(qtc_list_item_title_normal); +} + +MsgUnifiedEditorAttachment[state="pressed"]::attachmentName +{ + color:var(qtc_list_item_pressed); +} diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorbody.widgetml --- a/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorbody.widgetml Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorbody.widgetml Thu Jul 22 16:32:06 2010 +0100 @@ -15,11 +15,6 @@ - - - - - @@ -41,11 +36,6 @@ - - - - - @@ -67,11 +57,6 @@ - - - - - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgattachmentcontainer.cpp --- a/messagingapp/msgui/unifiededitor/src/msgattachmentcontainer.cpp Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +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: attachment container class - * - */ - - -// INCLUDES -#include -#include -#include -#include - -// USER INCLUDES -#include "msgattachmentcontainer.h" -#include "unieditorgenutils.h" -#include "msgmonitor.h" -#include "mmsconformancecheck.h" - -// Constants - -//--------------------------------------------------------------- -// MsgAttachmentContainer::MsgAttachmentContainer -// @see header file -//--------------------------------------------------------------- -MsgAttachmentContainer::MsgAttachmentContainer( QGraphicsItem *parent ) : -HbWidget(parent), -mIsMMContent(false) -{ - mLayout = new QGraphicsLinearLayout(Qt::Vertical, this); - mLayout->setContentsMargins(0,0,0,0); - mLayout->setSpacing(0); - mMmsConformanceCheck = new MmsConformanceCheck; -} - -//--------------------------------------------------------------- -// MsgAttachmentContainer::~MsgAttachmentContainer -// @see header file -//--------------------------------------------------------------- -MsgAttachmentContainer::~MsgAttachmentContainer() -{ - delete mMmsConformanceCheck; -} - -//--------------------------------------------------------------- -// MsgAttachmentContainer::addAttachment -// @see header file -//--------------------------------------------------------------- -MsgAttachmentContainer::AddAttachmentStatus - MsgAttachmentContainer::addAttachment(const QString& filepath) -{ - //check for insert conformance - if(EInsertSuccess != mMmsConformanceCheck->checkModeForInsert(filepath)) - return EAddNotSupported; - - int msgSize = messageSize(); - QFileInfo fileinfo(filepath); - int fileSize = fileinfo.size() + KEstimatedMimeHeaderSize; - - if( (fileSize + msgSize) <= MsgMonitor::maxMmsSize()) - { - MsgUnifiedEditorAttachment* att = new MsgUnifiedEditorAttachment( - filepath, fileSize, this); - if( ((mAttachmentList.count() == 0) && att->isMultimediaContent()) || - ((mAttachmentList.count() == 1) && !mIsMMContent) ) - { - mIsMMContent = true; - } - mAttachmentList << att; - int index = mLayout->count(); - mLayout->insertItem(index,att); - connect(att, SIGNAL(deleteMe(MsgUnifiedEditorAttachment*)), - this, SLOT(deleteAttachment(MsgUnifiedEditorAttachment*))); - - // emit to signal that container content & size changed - emit contentChanged(); - } - else - { - return EAddSizeExceed; - } - return EAddSuccess; -} - -//--------------------------------------------------------------- -// MsgAttachmentContainer::deleteAttachment -// @see header file -//--------------------------------------------------------------- -void MsgAttachmentContainer::deleteAttachment(MsgUnifiedEditorAttachment* attachment) -{ - mAttachmentList.removeOne(attachment); - mLayout->removeItem(attachment); - attachment->setParent(NULL); - delete attachment; - - if( ((mAttachmentList.count() == 1) && !mAttachmentList.first()->isMultimediaContent()) || - ((mAttachmentList.count() == 0) && mIsMMContent) ) - { - mIsMMContent = false; - } - - // emit to indicate change in container content & size - emit contentChanged(); - if(mAttachmentList.count() == 0) - { - emit emptyAttachmentContainer(); - } -} - -//--------------------------------------------------------------- -// MsgAttachmentContainer::count -// @see header file -//--------------------------------------------------------------- -int MsgAttachmentContainer::count() -{ - return mAttachmentList.count(); -} - -//--------------------------------------------------------------- -// MsgAttachmentContainer::attachmentList -// @see header file -//--------------------------------------------------------------- -MsgUnifiedEditorAttachmentList MsgAttachmentContainer::attachmentList() -{ - return mAttachmentList; -} - -//--------------------------------------------------------------- -// MsgAttachmentContainer::containerSize -// @see header file -//--------------------------------------------------------------- -int MsgAttachmentContainer::containerSize() -{ - int attCount = count(); - int containerSize = 0; - - for(int i=0; isize(); - } - return containerSize; -} - -//--------------------------------------------------------------- -// MsgAttachmentContainer::messageSize -// @see header file -//--------------------------------------------------------------- -int MsgAttachmentContainer::messageSize() -{ - return containerSize() + MsgMonitor::bodySize() + MsgMonitor::subjectSize(); -} - -//--------------------------------------------------------------- -// MsgAttachmentContainer::hasMMContent -// @see header file -//--------------------------------------------------------------- -bool MsgAttachmentContainer::hasMMContent() -{ - return mIsMMContent; -} - -//EOF - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgmonitor.cpp --- a/messagingapp/msgui/unifiededitor/src/msgmonitor.cpp Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,332 +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: Helper class to monitor msg construction in unified editor - * - */ - -// INCLUDES -#include "debugtraces.h" -#include -#include - -// USER INCLUDES -#include "msgmonitor.h" -#include "msgunieditorview.h" -#include "msgunieditoraddress.h" -#include "msgunieditorsubject.h" -#include "msgunieditorbody.h" -#include "msgattachmentcontainer.h" -#include "UniEditorGenUtils.h" - -// Constants - -// Define static -ConvergedMessage::MessageType MsgMonitor::mMessageType; -int MsgMonitor::mBodySize; -int MsgMonitor::mContainerSize; -int MsgMonitor::mSubjectSize; -int MsgMonitor::mMaxMmsSize; -int MsgMonitor::mMaxSmsRecipients; -int MsgMonitor::mMaxMmsRecipients; -int MsgMonitor::mMsgCurrAddressCount; - -//Localized strings -#define LOC_POP_MESSAGE_CHANGE_MUL hbTrId("txt_messaging_dpopinfo_message_type_changed_to_mul") -#define LOC_POP_MESSAGE_CHANGE_TEXT hbTrId("txt_messaging_dpopinfo_message_type_changed_to_tex") - -//--------------------------------------------------------------- -// MsgMonitor::MsgMonitor -// @see header file -//--------------------------------------------------------------- -MsgMonitor::MsgMonitor(QObject* parent) : -QObject(parent), -mSkipNote(false) -{ - init(); - mUniEditorGenUtils = new UniEditorGenUtils; -} - -//--------------------------------------------------------------- -// MsgMonitor::~MsgMonitor -// @see header file -//--------------------------------------------------------------- -MsgMonitor::~MsgMonitor() -{ - delete mUniEditorGenUtils; -} - -//--------------------------------------------------------------- -// MsgMonitor::init -// @see header file -//--------------------------------------------------------------- -void MsgMonitor::init() -{ - mMessageType = ConvergedMessage::Sms; - mBodySize = 0; - mContainerSize = 0; - mSubjectSize = 0; - mMsgCurrAddressCount = 0; - - UniEditorGenUtils* uniEditorGenUtils = new UniEditorGenUtils; - - mMaxMmsSize = KDefaultMaxSize; - TRAP_IGNORE(mMaxMmsSize = uniEditorGenUtils->MaxMmsMsgSizeL()); - - mMaxSmsRecipients = KDefaultSmsRecipients; - TRAP_IGNORE(mMaxSmsRecipients = uniEditorGenUtils->MaxSmsRecipientsL()); - - mMaxMmsRecipients = KDefaultMmsRecipients; - TRAP_IGNORE(mMaxMmsRecipients = uniEditorGenUtils->MaxMmsRecipientsL()); - - delete uniEditorGenUtils; -} - -//--------------------------------------------------------------- -// MsgMonitor::handleContentChange -// @see header file -//--------------------------------------------------------------- -void MsgMonitor::handleContentChange() -{ - // get the projected message type & show the type change note - ConvergedMessage::MessageType newMsgType = projectedMsgType(); - if(mMessageType != newMsgType) - { - mMessageType = newMsgType; - QString noteStr; - if(newMsgType == ConvergedMessage::Sms) - { - noteStr = LOC_POP_MESSAGE_CHANGE_TEXT; - } - else - { - noteStr = LOC_POP_MESSAGE_CHANGE_MUL; - } - showPopup(noteStr); - } - - HbWidget* senderWidget = qobject_cast(sender()); - updateMsgInfo(senderWidget); -} - -//--------------------------------------------------------------- -// MsgMonitor::projectedMsgType -// @see header file -//--------------------------------------------------------------- -ConvergedMessage::MessageType MsgMonitor::projectedMsgType() -{ - ConvergedMessage::MessageType newMsgType = ConvergedMessage::Sms; - - // check if MMS content is present in any of the editor component - if( bodyHasMMSContent() || - subjectHasMMSContent() || - containerHasMMSContent() || - otherMMSCriteriaMet() ) - { - newMsgType = ConvergedMessage::Mms; - } - return newMsgType; -} - -//--------------------------------------------------------------- -// MsgMonitor::updateMsgInfo -// @see header file -//--------------------------------------------------------------- -void MsgMonitor::updateMsgInfo(HbWidget* senderWidget) -{ - if(mMessageType == ConvergedMessage::Mms) - { - //Disable char counter & add subject - view()->mBody->disableCharCounter(); - view()->addSubject(); - } - - // check if sent by body widget - MsgUnifiedEditorBody* body = NULL; - body = qobject_cast(senderWidget); - if(body) - { - mBodySize = view()->mBody->bodySize(); - view()->setAttachOptionEnabled( - MsgUnifiedEditorView::TBE_PHOTO, !view()->mBody->hasImage()); - view()->setAttachOptionEnabled( - MsgUnifiedEditorView::TBE_SOUND, !view()->mBody->hasAudio()); - return; - } - - // check if sent by subject widget - MsgUnifiedEditorSubject* subject = NULL; - subject = qobject_cast(senderWidget); - if(subject) - { - mSubjectSize = view()->mSubjectField->subjectSize(); - return; - } - - // check if sent by attachment container widget - MsgAttachmentContainer* container = NULL; - container = qobject_cast(senderWidget); - if(container) - { - mContainerSize = view()->mAttachmentContainer->containerSize(); - return; - } - - // handle content change from other widgets e.g. To, Cc, Bcc address field - int totalAddressCount = view()->mToField->addressCount(); - if(view()->mCcField && view()->mBccField) - { - totalAddressCount += view()->mCcField->addressCount() + - view()->mBccField->addressCount(); - } - mMsgCurrAddressCount = totalAddressCount; - return; -} - -//--------------------------------------------------------------- -// MsgMonitor::showPopup -// @see header file -//--------------------------------------------------------------- -void MsgMonitor::showPopup(const QString& text) -{ - if(!mSkipNote) - { - HbNotificationDialog* dlg = new HbNotificationDialog(); - dlg->setFocusPolicy(Qt::NoFocus); - dlg->setDismissPolicy(HbPopup::TapAnywhere); - dlg->setAttribute(Qt::WA_DeleteOnClose, true); - dlg->setText(text); - dlg->show(); - } - // reset skip note flag - mSkipNote = false; -} - -//--------------------------------------------------------------- -// MsgMonitor::view -// @see header file -//--------------------------------------------------------------- -MsgUnifiedEditorView* MsgMonitor::view() -{ - return static_cast(this->parent()); -} - -//--------------------------------------------------------------- -// MsgMonitor::bodyHasMMSContent -// @see header file -//--------------------------------------------------------------- -bool MsgMonitor::bodyHasMMSContent() -{ - MsgUnifiedEditorBody* edBody = view()->mBody; - // If any media-object is present inside body - if(!edBody->mediaContent().isEmpty()) - { - return true; - } - - int bodyTextSize = mUniEditorGenUtils->UTF8Size(edBody->text()); - int maxSmsSize = 0; - TRAP_IGNORE(maxSmsSize = - mUniEditorGenUtils->MaxSmsMsgSizeL(edBody->isUnicode())); - // If body text size exceeds sms text-size limit - if(bodyTextSize > maxSmsSize) - { - return true; - } - return false; -} - -//--------------------------------------------------------------- -// MsgMonitor::subjectHasMMSContent -// @see header file -//--------------------------------------------------------------- -bool MsgMonitor::subjectHasMMSContent() -{ - MsgUnifiedEditorSubject* edSubject = view()->mSubjectField; - ConvergedMessage::Priority priority = ConvergedMessage::Normal; - QString subjectText; - if(edSubject) - { - priority = edSubject->priority(); - subjectText = edSubject->text(); - } - // If priority is set to other than Normal or - // If subject has some content - if( (priority != ConvergedMessage::Normal) || - !subjectText.isEmpty() ) - { - return true; - } - return false; -} - -//--------------------------------------------------------------- -// MsgMonitor::containerHasMMSContent -// @see header file -//--------------------------------------------------------------- -bool MsgMonitor::containerHasMMSContent() -{ - QString bodyText = view()->mBody->text(); - MsgAttachmentContainer* edContainer = view()->mAttachmentContainer; - bool hasMMAttachmentContent = false; - int attachmentCount = 0; - if(edContainer) - { - hasMMAttachmentContent = edContainer->hasMMContent(); - attachmentCount = edContainer->count(); - } - // If MM attachments are present or - // If only one non-MM attachment is present e.g. vcf along with body text - if( hasMMAttachmentContent || - ((attachmentCount == 1) && !bodyText.isEmpty()) ) - { - return true; - } - return false; -} - -//--------------------------------------------------------------- -// MsgMonitor::otherMMSCriteriaMet -// @see header file -//--------------------------------------------------------------- -bool MsgMonitor::otherMMSCriteriaMet() -{ - MsgUnifiedEditorAddress* edCc = view()->mCcField; - MsgUnifiedEditorAddress* edBcc = view()->mBccField; - int ccCount = 0; - int bccCount = 0; - if(edCc && edBcc) - { - ccCount = edCc->addressCount(); - bccCount = edBcc->addressCount(); - } - // If CC/BCC has some content or - // If to-recipients count exceeds max sms recipient count - if( ccCount || bccCount || - (view()->mToField->addressCount() > mMaxSmsRecipients) ) - { - return true; - } - - // If to-field contains an email address - bool isEmailPresent = false; - ConvergedMessageAddressList addrList = view()->mToField->addresses(); - TRAP_IGNORE(isEmailPresent = mUniEditorGenUtils->VerifyEmailAddressesL(addrList)); - if(isEmailPresent) - { - return true; - } - return false; -} - -//EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp --- a/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -34,13 +33,13 @@ // USER INCLUDES #include "debugtraces.h" #include "msgunieditoraddress.h" -#include "msgunifiededitorlineedit.h" -#include "msgmonitor.h" -#include "unieditorgenutils.h" +#include "msgunieditorlineedit.h" +#include "msgunieditormonitor.h" +#include "UniEditorGenUtils.h" const QString PBK_ICON("qtg_mono_contacts"); -const QString SEND_ICON("qtg_mono_send"); -const QString replacementStr("; "); +const QString REPLACEMENT_STR("; "); +const QString COMMA_SEPERATOR(","); // Constants const int KDefaultGsmNumberMatchLength = 7; //matching unique ph numbers @@ -49,6 +48,12 @@ #define LOC_DIALOG_OK hbTrId("txt_common_button_ok") #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") #define LOC_INVALID_RECIPIENT hbTrId("txt_messaging_dialog_invalid_recipient_found") +#define LOC_INVALID_RECIPIENT_NOT_ADDED hbTrId("txt_messaging_dialog_invalid_recipient_not_added") +#define LOC_INVALID_RECIPIENTS_NOT_ADDED hbTrId("txt_messaging_dialog_invalid_recipients_not_added") + + + + MsgUnifiedEditorAddress::MsgUnifiedEditorAddress( const QString& label, QGraphicsItem *parent ) : @@ -73,13 +78,8 @@ connect(mAddressEdit, SIGNAL(contentsChanged(const QString&)), this, SLOT(onContentsChanged(const QString&))); - // add "Send" action in VKB - HbEditorInterface editorInterface(mAddressEdit); mAddressEdit->setInputMethodHints(Qt::ImhPreferNumbers); - HbAction *sendAction = new HbAction(HbIcon(SEND_ICON), QString(),this); - connect(sendAction, SIGNAL(triggered()),this, SIGNAL(sendMessage())); - editorInterface.addAction(sendAction); - } +} MsgUnifiedEditorAddress::~MsgUnifiedEditorAddress() { @@ -90,6 +90,8 @@ void MsgUnifiedEditorAddress::fetchContacts() { + mLaunchBtn->blockSignals(true); + QList args; QString serviceName("com.nokia.services.phonebookservices"); QString operation("fetch(QString,QString,QString)"); @@ -112,6 +114,9 @@ request->setArguments(args); request->send(); delete request; + + //unblock click signal after some delay. + QTimer::singleShot(250,this,SLOT(unblockSignals())); } void MsgUnifiedEditorAddress::handleOk(const QVariant& value) @@ -125,7 +130,14 @@ { ConvergedMessageAddress* address = new ConvergedMessageAddress(); - address->setAddress(contactList[i].mPhoneNumber); + if(!contactList[i].mPhoneNumber.isEmpty()) + { + address->setAddress(contactList[i].mPhoneNumber); + } + else + { + address->setAddress(contactList[i].mEmailAddress); + } address->setAlias(contactList[i].mDisplayName); addrlist << address; } @@ -190,6 +202,12 @@ void MsgUnifiedEditorAddress::setAddresses(ConvergedMessageAddressList addrlist) { + // avoid processing if no info available + if(addrlist.count() == 0) + { + return; + } + // ensure flags are reset before starting the addr addition mAboutToExceedMaxSmsRecipients = false; mAboutToExceedMaxMmsRecipients = false; @@ -197,37 +215,63 @@ // first, we check if MMS max-recipient count will exceed int count = addrlist.count(); - int futureCount = count + MsgMonitor::msgAddressCount(); - if(futureCount > MsgMonitor::maxMmsRecipients()) + int futureCount = count + MsgUnifiedEditorMonitor::msgAddressCount(); + if(futureCount > MsgUnifiedEditorMonitor::maxMmsRecipients()) { mAboutToExceedMaxMmsRecipients = true; mExceedsMaxMmsRecipientsBy = - futureCount - MsgMonitor::maxMmsRecipients(); + futureCount - MsgUnifiedEditorMonitor::maxMmsRecipients(); } // else, check if SMS max-recipient count will exceed else if(!mSkipMaxRecipientQuery) { futureCount = count + addressCount(); - if( (addressCount() <= MsgMonitor::maxSmsRecipients()) && - (futureCount > MsgMonitor::maxSmsRecipients()) ) + if( (addressCount() <= MsgUnifiedEditorMonitor::maxSmsRecipients()) && + (futureCount > MsgUnifiedEditorMonitor::maxSmsRecipients()) ) { mAboutToExceedMaxSmsRecipients = true; } } - + int invalidCount= 0; + QString invalidContacts; for(int i = 0; i < count; i++ ) - { - mAddressMap.insertMulti(addrlist[i]->address(), addrlist[i]->alias()); - if(!addrlist[i]->alias().isEmpty()) { - mAddressEdit->setText(addrlist[i]->alias()); - } - else + bool isValid = false; + isValid = checkValidAddress(addrlist.at(i)->address()); + if(!isValid) + { + invalidCount ++; + // append the comma till last but one contact. + // add the invalid ocntacts to the " , " seperated string. + if(invalidCount > 1) + { + invalidContacts.append(COMMA_SEPERATOR); + } + invalidContacts.append(addrlist.at(i)->alias()); + } + else + { + mAddressMap.insertMulti(addrlist[i]->address(), addrlist[i]->alias()); + if(!addrlist[i]->alias().isEmpty()) + { + mAddressEdit->setText(addrlist[i]->alias()); + } + else + { + mAddressEdit->setText(addrlist[i]->address(), false); + } + } + } + if(invalidCount) { - mAddressEdit->setText(addrlist[i]->address(), false); + QString invalidStr; + (invalidCount == 1)?(invalidStr = QString(LOC_INVALID_RECIPIENT_NOT_ADDED)) :(invalidStr = QString(LOC_INVALID_RECIPIENTS_NOT_ADDED)); + // append line seperator + invalidStr.append("
"); + invalidStr.append(invalidContacts); + HbMessageBox::information(invalidStr); } - } // addition operation complete, reset flags mAboutToExceedMaxSmsRecipients = false; @@ -256,7 +300,7 @@ { // Max MMS recipient count check if( mAboutToExceedMaxMmsRecipients || - (MsgMonitor::msgAddressCount() >= MsgMonitor::maxMmsRecipients()) ) + (MsgUnifiedEditorMonitor::msgAddressCount() >= MsgUnifiedEditorMonitor::maxMmsRecipients()) ) { if(mAboutToExceedMaxMmsRecipients) {// show discreet note only once @@ -272,7 +316,7 @@ { // update monitor data emit contentChanged(); - if(MsgMonitor::msgAddressCount() > MsgMonitor::maxMmsRecipients()) + if(MsgUnifiedEditorMonitor::msgAddressCount() > MsgUnifiedEditorMonitor::maxMmsRecipients()) { HbNotificationDialog::launchDialog( LOC_MMS_RECIPIENT_LIMIT_REACHED); @@ -290,8 +334,8 @@ // Max SMS recipient count check if( !mSkipMaxRecipientQuery && - (MsgMonitor::messageType() == ConvergedMessage::Sms) && - (mAddressEdit->addresses().count() > MsgMonitor::maxSmsRecipients()) ) + (MsgUnifiedEditorMonitor::messageType() == ConvergedMessage::Sms) && + (mAddressEdit->addresses().count() > MsgUnifiedEditorMonitor::maxSmsRecipients()) ) { // when we show this dialog, we don't want the intermediate states // to be signalled to us @@ -317,7 +361,8 @@ dlg->setTimeout(HbPopup::NoTimeout); dlg->setText(LOC_SMS_RECIPIENT_LIMIT_REACHED); - + + dlg->clearActions(); HbAction* okAction = new HbAction(LOC_DIALOG_OK,dlg); dlg->addAction(okAction); @@ -328,7 +373,6 @@ // reconnect to get back updates connect(mAddressEdit, SIGNAL(contentsChanged(const QString&)), this, SLOT(onContentsChanged(const QString&))); - emit contentChanged(); } void MsgUnifiedEditorAddress::syncDeletionsToMap() @@ -347,6 +391,18 @@ } else { + // ensure that the matched contact is removed from the + // address's list + int matchedIndex = addrList.indexOf(i.value()); + if(matchedIndex == -1) + { + matchedIndex = addrList.indexOf(i.key()); + } + if(matchedIndex != -1) + { + addrList.removeAt(matchedIndex); + } + // now go to next index in map ++i; } } @@ -414,7 +470,7 @@ this, SLOT(onContentsChanged(const QString&))); mAddressEdit->clearContent(); - QStringList list = mPrevBuffer.split(replacementStr, + QStringList list = mPrevBuffer.split(REPLACEMENT_STR, QString::SkipEmptyParts); int count = list.count(); QStringList valList = mAddressMap.values(); @@ -444,6 +500,7 @@ HbMessageBox *dlg = qobject_cast (sender()); if (action == dlg->actions().at(0)) { // accept new content, update prev-buffer + emit contentChanged(); mPrevBuffer = mAddressEdit->content(); } else { @@ -467,27 +524,15 @@ // get the list of contacts in address-field QStringList fieldAddresses(mAddressEdit->addresses()); - bool allValid = true; + bool isValid = true; foreach(QString addr, fieldAddresses) { // run address validation only if address is unmapped // (i.e. user-inserted) if(mAddressMap.contains(addr)) { - // 1. perform number validation - allValid = CommonPhoneParser::IsValidPhoneNumber( - *XQConversions::qStringToS60Desc(addr), - CommonPhoneParser::ESMSNumber ); - - // 2. if number validity fails, then perform email addr validation - if( !allValid && - (MsgMonitor::messageType() == ConvergedMessage::Mms) ) - { // additional check for MMS only - allValid = genUtils->IsValidEmailAddress( - *XQConversions::qStringToS60Desc(addr) ); - } - - if(!allValid) + isValid = checkValidAddress(addr); + if(!isValid) { mAddressEdit->highlightInvalidString(addr); QString invalidAddrStr = @@ -502,9 +547,35 @@ } } } + + return isValid; +} +// ---------------------------------------------------------------------------- +// MsgUnifiedEditorAddress::checkValidAddress +// @see header +// ---------------------------------------------------------------------------- +bool MsgUnifiedEditorAddress::checkValidAddress(const QString& addr) + { + bool isValid = false; + + HBufC *tempAddr = XQConversions::qStringToS60Desc(addr); + + // 1. perform number validation + isValid = CommonPhoneParser::IsValidPhoneNumber( + *tempAddr, + CommonPhoneParser::ESMSNumber ); + + // 2. if number validity fails, then perform email addr validation + UniEditorGenUtils* genUtils = new UniEditorGenUtils; + if(!isValid) + { // additional check for MMS only + isValid = genUtils->IsValidEmailAddress( + *tempAddr ); + } delete genUtils; - return allValid; -} + delete tempAddr; + return isValid; + } void MsgUnifiedEditorAddress::handleInvalidContactDialog( HbAction* act) @@ -513,6 +584,11 @@ QTimer::singleShot(250, this, SLOT(setFocus())); } +void MsgUnifiedEditorAddress::unblockSignals() +{ + mLaunchBtn->blockSignals(false); +} + Q_IMPLEMENT_USER_METATYPE(CntServicesContact) Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(CntServicesContactList) diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgunieditorattachment.cpp --- a/messagingapp/msgui/unifiededitor/src/msgunieditorattachment.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorattachment.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -25,15 +25,19 @@ #include #include #include -//#include -//#include +#include +#include #include #include +#include +#include // USER INCLUDES +#include "msgcontactsutil.h" #include "msgunieditorattachment.h" -#include "unieditorgenutils.h" -#include "s60qconversions.h" +#include "UniEditorGenUtils.h" +#include +#include "msgunieditorutils.h" // Constants #define BYTES_TO_KBYTES_FACTOR 1024 @@ -57,63 +61,63 @@ mSize(filesize), mAttachmentIcon(0), mAttachmentName(0), -//mGestureFilter(0), -mMaxSmsSize(KFirstNormalSmsLength) +mMaxSmsSize(KFirstNormalSmsLength), +mEditorUtils(0) { - //back ground - HbFrameItem* backGround = new HbFrameItem(this); - backGround->frameDrawer().setFrameGraphicsName(LIST_ITEM_BG_FRAME_NORMAL); - backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); - this->setBackgroundItem(backGround); + this->grabGesture(Qt::TapGesture); + setProperty("state", "normal"); + + //back ground + mBackGround = new HbFrameItem(this); + mBackGround->frameDrawer().setFrameGraphicsName(LIST_ITEM_BG_FRAME_NORMAL); + mBackGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); + this->setBackgroundItem(mBackGround); - mAttachmentIcon = new HbIconItem(ATTACHMENT_ICON, this); - HbStyle::setItemName(mAttachmentIcon,"attachmentIcon"); + mAttachmentIcon = new HbIconItem(ATTACHMENT_ICON, this); + HbStyle::setItemName(mAttachmentIcon,"attachmentIcon"); - int at_size = 0; - TMsgMediaType mediaType = EMsgMediaUnknown; - UniEditorGenUtils* genUtils = new UniEditorGenUtils; - TRAP_IGNORE(genUtils->getFileInfoL(mPath,at_size, - mMimeType,mediaType)); - TRAP_IGNORE(mMaxSmsSize = genUtils->MaxSmsMsgSizeL()); - delete genUtils; - QFileInfo fileinfo(attachmentpath); - QString filename = fileinfo.fileName(); - mAttachmentName = new HbTextItem(filename,this); - HbStyle::setItemName(mAttachmentName,"attachmentName"); - mAttachmentName->setElideMode(Qt::ElideRight); - - // for sms, pure size should be shown - // for mms, additional mimeheader size must be included - qreal displaySize = mSize; - if(!isMultimediaContent()) - { - displaySize = fileinfo.size(); - } - int sizeInKb = displaySize/BYTES_TO_KBYTES_FACTOR; - QString fileDetails; - // if size exceeds 1kb, then show kb or else only bytes - if(sizeInKb >= 1) - { - fileDetails = QString().append(QString("(%1 Kb)").arg(sizeInKb)); - } - else - { - fileDetails = QString().append(QString("(%1 B)").arg(displaySize)); - } + int at_size = 0; + TMsgMediaType mediaType = EMsgMediaUnknown; + UniEditorGenUtils* genUtils = new UniEditorGenUtils; + TRAP_IGNORE(genUtils->getFileInfoL(mPath,at_size, + mMimeType,mediaType)); + TRAP_IGNORE(mMaxSmsSize = genUtils->MaxSmsMsgSizeL()); + delete genUtils; + QFileInfo fileinfo(attachmentpath); + QString filename = fileinfo.fileName(); + mAttachmentName = new HbTextItem(filename,this); + HbStyle::setItemName(mAttachmentName,"attachmentName"); + mAttachmentName->setElideMode(Qt::ElideRight); - mAttachmentDetails = new HbTextItem(fileDetails, this); - HbStyle::setItemName(mAttachmentDetails,"attachmentDetails"); - mAttachmentDetails->setElideMode(Qt::ElideNone); - - initGesture(); + // for sms, pure size should be shown + // for mms, additional mimeheader size must be included + qreal displaySize = mSize; + if(!isMultimediaContent()) + { + displaySize = fileinfo.size(); + } + int sizeInKb = displaySize/BYTES_TO_KBYTES_FACTOR; + QString fileDetails; + // if size exceeds 1kb, then show kb or else only bytes + if(sizeInKb >= 1) + { + fileDetails = QString().append(QString("(%1 Kb)").arg(sizeInKb)); + } + else + { + fileDetails = QString().append(QString("(%1 B)").arg(displaySize)); + } + + mAttachmentDetails = new HbTextItem(fileDetails, this); + HbStyle::setItemName(mAttachmentDetails,"attachmentDetails"); + mAttachmentDetails->setElideMode(Qt::ElideNone); + + HbEffect::add("attachmentWidget", "listviewitem_press", "pressed"); + HbEffect::add("attachmentWidget", "listviewitem_release", "released"); } MsgUnifiedEditorAttachment::~MsgUnifiedEditorAttachment() { - /* if(mGestureFilter) - { - removeSceneEventFilter(mGestureFilter); - }*/ } const QString& MsgUnifiedEditorAttachment::path() @@ -131,11 +135,11 @@ return mMimeType; } -void MsgUnifiedEditorAttachment::longPressed(QPointF position) +void MsgUnifiedEditorAttachment::handleLongTap(QPointF position) { HbMenu* menu = new HbMenu; - menu->addAction(LOC_OPEN, this, SLOT(openAttachment())); - menu->addAction(LOC_REMOVE, this, SLOT(removeAttachment())); + menu->addAction(LOC_OPEN, this, SLOT(handleOpen())); + menu->addAction(LOC_REMOVE, this, SLOT(handleRemove())); menu->addAction(LOC_DETAILS, this, SLOT(viewDetails())); menu->setDismissPolicy(HbPopup::TapAnywhere); menu->setAttribute(Qt::WA_DeleteOnClose, true); @@ -143,14 +147,25 @@ menu->show(); } -void MsgUnifiedEditorAttachment::removeAttachment() +void MsgUnifiedEditorAttachment::handleRemove() { emit deleteMe(this); } -void MsgUnifiedEditorAttachment::openAttachment() +void MsgUnifiedEditorAttachment::handleOpen() { - //open corresponding viewer app. + this->ungrabGesture(Qt::TapGesture); + + //open corresponding viewer app + + if (!mEditorUtils) + { + mEditorUtils = new MsgUnifiedEditorUtils(this); + } + mEditorUtils->launchContentViewer(mMimeType, mPath); + + //fire timer to regrab gesture after some delay. + QTimer::singleShot(300,this,SLOT(regrabGesture())); } void MsgUnifiedEditorAttachment::viewDetails() @@ -161,9 +176,9 @@ bool MsgUnifiedEditorAttachment::isMultimediaContent() { bool ret = true; - QString vcard = S60QConversions::s60Desc8ToQString(KMsgMimeVCard()); - QString vcal = S60QConversions::s60Desc8ToQString(KMsgMimeVCal()); - QString ical = S60QConversions::s60Desc8ToQString(KMsgMimeICal()); + QString vcard = XQConversions::s60Desc8ToQString(KMsgMimeVCard()); + QString vcal = XQConversions::s60Desc8ToQString(KMsgMimeVCal()); + QString ical = XQConversions::s60Desc8ToQString(KMsgMimeICal()); if( !QString::compare(mMimeType, vcard, Qt::CaseInsensitive) || !QString::compare(mMimeType, vcal, Qt::CaseInsensitive) || !QString::compare(mMimeType, ical, Qt::CaseInsensitive) ) @@ -181,61 +196,76 @@ return ret; } -void MsgUnifiedEditorAttachment::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - HbWidgetFeedback::triggered(this, Hb::InstantPressed); - - HbFrameItem* backGround = new HbFrameItem(this); - backGround->frameDrawer().setFrameGraphicsName(LIST_ITEM_BG_FRAME_PRESSED); - backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); - this->setBackgroundItem(backGround); - - event->accept(); -} - -void MsgUnifiedEditorAttachment::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +void MsgUnifiedEditorAttachment::gestureEvent(QGestureEvent *event) { - HbFrameItem* backGround = new HbFrameItem(this); - backGround->frameDrawer().setFrameGraphicsName(LIST_ITEM_BG_FRAME_NORMAL); - backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); - this->setBackgroundItem(backGround); - - if(this->rect().contains(event->pos())) + HbTapGesture *tapGesture = qobject_cast (event->gesture(Qt::TapGesture)); + if (tapGesture) { + switch (tapGesture->state()) { + case Qt::GestureStarted: + { + // Trigger haptic feedback. + HbInstantFeedback::play(HbFeedback::Basic); + setPressed(true); + break; + } + case Qt::GestureUpdated: { - HbWidgetFeedback::triggered(this, Hb::InstantClicked); - emit clicked(); + if (HbTapGesture::TapAndHold == tapGesture->tapStyleHint()) { + // Handle longtap. + setPressed(false); + handleLongTap(tapGesture->scenePosition()); + } + break; } - - event->accept(); + case Qt::GestureFinished: + { + HbInstantFeedback::play(HbFeedback::Basic); + if (HbTapGesture::Tap == tapGesture->tapStyleHint()) { + // Handle short tap. + setPressed(false); + handleShortTap(); + } + break; + } + case Qt::GestureCanceled: + { + HbInstantFeedback::play(HbFeedback::Basic); + setPressed(false); + break; + } + } + } + else { + HbWidget::gestureEvent(event); + } } -void MsgUnifiedEditorAttachment::initGesture() +void MsgUnifiedEditorAttachment::handleShortTap() { - // Create gesture filter - /* mGestureFilter = new HbGestureSceneFilter( Qt::LeftButton, this ); - - // Add gestures for longpress - HbGesture* gestureLongpressed = new HbGesture( HbGesture::longpress,5 ); - - mGestureFilter->addGesture( gestureLongpressed ); - - connect( gestureLongpressed, SIGNAL(longPress(QPointF)), - this, SLOT(longPressed(QPointF)) ); - - //install gesture filter. - this->installSceneEventFilter(mGestureFilter);*/ + handleOpen(); } -/*HbFeedback::InstantEffect MsgUnifiedEditorAttachment::overrideFeedback(Hb::InstantInteraction interaction) const - { - switch(interaction) - { - case Hb::InstantPressed: - case Hb::InstantClicked: - return HbFeedback::Basic; - default: - return HbFeedback::None; - } - }*/ +void MsgUnifiedEditorAttachment::setPressed(bool pressed) +{ + if (pressed) + { + setProperty("state", "pressed"); + mBackGround->frameDrawer().setFrameGraphicsName(LIST_ITEM_BG_FRAME_PRESSED); + HbEffect::cancel(mBackGround, "released"); + HbEffect::start(mBackGround, "attachmentWidget", "pressed"); + } + else + { + setProperty("state", "normal"); + mBackGround->frameDrawer().setFrameGraphicsName(LIST_ITEM_BG_FRAME_NORMAL); + HbEffect::cancel(mBackGround, "pressed"); + HbEffect::start(mBackGround, "attachmentWidget", "released"); + } +} + +void MsgUnifiedEditorAttachment::regrabGesture() +{ + this->grabGesture(Qt::TapGesture); +} // EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgunieditorattachmentcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorattachmentcontainer.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: attachment container class + * + */ + + +// INCLUDES +#include +#include +#include +#include + +// USER INCLUDES +#include "msgunieditorattachmentcontainer.h" +#include "UniEditorGenUtils.h" +#include "msgunieditormonitor.h" +#include "mmsconformancecheck.h" + +// Constants + +//--------------------------------------------------------------- +// MsgAttachmentContainer::MsgAttachmentContainer +// @see header file +//--------------------------------------------------------------- +MsgAttachmentContainer::MsgAttachmentContainer( QGraphicsItem *parent ) : +HbWidget(parent), +mIsMMContent(false) +{ + mLayout = new QGraphicsLinearLayout(Qt::Vertical, this); + mLayout->setContentsMargins(0,0,0,0); + mLayout->setSpacing(0); + mMmsConformanceCheck = new MmsConformanceCheck; +} + +//--------------------------------------------------------------- +// MsgAttachmentContainer::~MsgAttachmentContainer +// @see header file +//--------------------------------------------------------------- +MsgAttachmentContainer::~MsgAttachmentContainer() +{ + delete mMmsConformanceCheck; +} + +//--------------------------------------------------------------- +// MsgAttachmentContainer::addAttachment +// @see header file +//--------------------------------------------------------------- +MsgAttachmentContainer::AddAttachmentStatus + MsgAttachmentContainer::addAttachment(const QString& filepath) +{ + //check for insert conformance + if(EInsertSuccess != mMmsConformanceCheck->checkModeForInsert(filepath)) + return EAddNotSupported; + + int msgSize = messageSize(); + QFileInfo fileinfo(filepath); + int fileSize = fileinfo.size() + KEstimatedMimeHeaderSize; + + if( (fileSize + msgSize) <= MsgUnifiedEditorMonitor::maxMmsSize()) + { + MsgUnifiedEditorAttachment* att = new MsgUnifiedEditorAttachment( + filepath, fileSize, this); + if( ((mAttachmentList.count() == 0) && att->isMultimediaContent()) || + ((mAttachmentList.count() == 1) && !mIsMMContent) ) + { + mIsMMContent = true; + } + mAttachmentList << att; + int index = mLayout->count(); + mLayout->insertItem(index,att); + connect(att, SIGNAL(deleteMe(MsgUnifiedEditorAttachment*)), + this, SLOT(deleteAttachment(MsgUnifiedEditorAttachment*))); + + // emit to signal that container content & size changed + emit contentChanged(); + } + else + { + return EAddSizeExceed; + } + return EAddSuccess; +} + +//--------------------------------------------------------------- +// MsgAttachmentContainer::deleteAttachment +// @see header file +//--------------------------------------------------------------- +void MsgAttachmentContainer::deleteAttachment(MsgUnifiedEditorAttachment* attachment) +{ + mAttachmentList.removeOne(attachment); + mLayout->removeItem(attachment); + attachment->setParent(NULL); + delete attachment; + + if( ((mAttachmentList.count() == 1) && !mAttachmentList.first()->isMultimediaContent()) || + ((mAttachmentList.count() == 0) && mIsMMContent) ) + { + mIsMMContent = false; + } + + // emit to indicate change in container content & size + emit contentChanged(); + if(mAttachmentList.count() == 0) + { + emit emptyAttachmentContainer(); + } +} + +//--------------------------------------------------------------- +// MsgAttachmentContainer::count +// @see header file +//--------------------------------------------------------------- +int MsgAttachmentContainer::count() +{ + return mAttachmentList.count(); +} + +//--------------------------------------------------------------- +// MsgAttachmentContainer::attachmentList +// @see header file +//--------------------------------------------------------------- +MsgUnifiedEditorAttachmentList MsgAttachmentContainer::attachmentList() +{ + return mAttachmentList; +} + +//--------------------------------------------------------------- +// MsgAttachmentContainer::containerSize +// @see header file +//--------------------------------------------------------------- +int MsgAttachmentContainer::containerSize() +{ + int attCount = count(); + int containerSize = 0; + + for(int i=0; isize(); + } + return containerSize; +} + +//--------------------------------------------------------------- +// MsgAttachmentContainer::messageSize +// @see header file +//--------------------------------------------------------------- +int MsgAttachmentContainer::messageSize() +{ + return containerSize() + MsgUnifiedEditorMonitor::bodySize() + MsgUnifiedEditorMonitor::subjectSize(); +} + +//--------------------------------------------------------------- +// MsgAttachmentContainer::hasMMContent +// @see header file +//--------------------------------------------------------------- +bool MsgAttachmentContainer::hasMMContent() +{ + return mIsMMContent; +} + +//EOF + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgunieditoraudiowidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditoraudiowidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: This widget is used to display audio content in univiewer. + * + */ +#include "msgunieditoraudiowidget.h" + +// SYSTEM INCLUDES +#include +#include +#include + +// USER INCLUDES +#include "msgmediautil.h" +#include "msgunieditorutils.h" + +// LOCAL CONSTANTS +#define LOC_OPEN hbTrId("txt_common_menu_open") +#define LOC_REMOVE hbTrId("txt_common_menu_remove") + +const QString AUDIO_ICON("qtg_mono_audio"); +const QString AUDIO_MIMETYPE("audio"); + +//---------------------------------------------------------------------------- +// MsgUniFiedEditorAudioWidget::MsgUniFiedEditorAudioWidget +// @see header file +//---------------------------------------------------------------------------- +MsgUniFiedEditorAudioWidget::MsgUniFiedEditorAudioWidget(QGraphicsItem *parent) : +HbPushButton(parent), +mEditorUtils(0) +{ + connect(this, SIGNAL(clicked()), this, SLOT(handleShortTap())); + connect(this, SIGNAL(longPress(QPointF)), this, SLOT(handleLongTap(QPointF))); +} + +//---------------------------------------------------------------------------- +// MsgUniFiedEditorAudioWidget::~MsgUniFiedEditorAudioWidget +// @see header file +//---------------------------------------------------------------------------- +MsgUniFiedEditorAudioWidget::~MsgUniFiedEditorAudioWidget() +{ +} + +//---------------------------------------------------------------------------- +// MsgUniFiedEditorAudioWidget::~MsgUniFiedEditorAudioWidget +// @see header file +//---------------------------------------------------------------------------- +void MsgUniFiedEditorAudioWidget::populate(const QString &filePath) +{ + mMediaPath = filePath; + + this->setIcon(HbIcon(AUDIO_ICON)); + QFileInfo fileInfo(mMediaPath); + this->setText(fileInfo.baseName()); + MsgMediaUtil mediaUtil; + this->setAdditionalText(mediaUtil.mediaDuration(mMediaPath)); + this->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); +} + +//---------------------------------------------------------------------------- +// MsgUniFiedEditorAudioWidget::handleShortTap +// @see header file +//---------------------------------------------------------------------------- +void MsgUniFiedEditorAudioWidget::handleShortTap() +{ + emit shortTap(mMediaPath); + + // Open the media. + handleOpen(); +} + +//---------------------------------------------------------------------------- +// MsgUniFiedEditorAudioWidget::handleLongTap +// @see header file +//---------------------------------------------------------------------------- +void MsgUniFiedEditorAudioWidget::handleLongTap(const QPointF &position) +{ + emit longTap(position); + + // Display context sensitive menu. + HbMenu* menu = new HbMenu; + menu->setAttribute(Qt::WA_DeleteOnClose); + menu->setDismissPolicy(HbPopup::TapAnywhere); + + menu->addAction(LOC_OPEN, this, SLOT(handleOpen())); + menu->addAction(LOC_REMOVE, this, SLOT(handleRemove())); + menu->setPreferredPos(position); + menu->show(); +} + +//---------------------------------------------------------------------------- +// MsgUniFiedEditorAudioWidget::handleOpen +// @see header file +//---------------------------------------------------------------------------- +void MsgUniFiedEditorAudioWidget::handleOpen() +{ + this->ungrabGesture(Qt::TapGesture); + + if (!mEditorUtils) + { + mEditorUtils = new MsgUnifiedEditorUtils(this); + } + mEditorUtils->launchContentViewer(AUDIO_MIMETYPE, mMediaPath); + + //fire timer to regrab gesture after some delay. + QTimer::singleShot(300,this,SLOT(regrabGesture())); +} + +//---------------------------------------------------------------------------- +// MsgUniFiedEditorAudioWidget::handleRemove +// @see header file +//---------------------------------------------------------------------------- +void MsgUniFiedEditorAudioWidget::handleRemove() +{ + emit remove(); +} + +//--------------------------------------------------------------- +// MsgUniFiedEditorAudioWidget::regrabGesture +// @see header file +//--------------------------------------------------------------- +void MsgUniFiedEditorAudioWidget::regrabGesture() +{ + this->grabGesture(Qt::TapGesture); +} +// EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp --- a/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -21,12 +21,7 @@ #include #include #include -#include #include -#include -//#include -//#include -#include #include #include #include @@ -45,40 +40,34 @@ #include #include #include - +#include // USER INCLUDES #include "msgunieditorbody.h" #include "UniEditorGenUtils.h" -#include "unisendingsettings.h" -#include "msgmonitor.h" -#include "s60qconversions.h" +#include "UniSendingSettings.h" +#include "msgunieditormonitor.h" + #include "mmsconformancecheck.h" #include "unieditorpluginloader.h" #include "unieditorplugininterface.h" #include "convergedmessage.h" #include "msgmediautil.h" +#include "msgunieditorpixmapwidget.h" +#include "msgunieditoraudiowidget.h" // Constants -const QString EDITOR_FRAME("qtg_fr_lineedit_normal"); const QString BACKGROUND_FRAME("qtg_fr_btn_normal"); -const QString AUDIO_REGION("AudioRegion"); -const QString VIDEO_REGION("VideoRegion"); -const QString IMAGE_REGION("ImageRegion"); -const QString INVALID_REGION("InvalidRegion"); -const QString SEND_ICON("qtg_mono_send"); + const int KShowCounterLimit = 10; const int BYTES_TO_KBYTES_FACTOR = 1024; //Localized Constants for item specific menu -#define LOC_OPEN hbTrId("txt_common_menu_open") -#define LOC_REMOVE hbTrId("txt_common_menu_remove") -#define LOC_DETAILS hbTrId("txt_common_menu_details") #define LOC_TITLE hbTrId("txt_messaging_title_messaging") #define LOC_UNABLE_TO_ADD_CONTENT hbTrId("txt_messaging_dpopinfo_unable_to_add_more_content") #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") -const QString AUDIO_ICON("qtg_mono_audio"); const QString ANIMATION_ICON("qtg_anim_loading"); const QString ANIMATION_FILE(":/qtg_anim_loading.axml"); // LOCAL FUNCTIONS @@ -90,7 +79,7 @@ void showInsertFailureNote() { int availableSize = - (MsgMonitor::maxMmsSize() - MsgMonitor::messageSize()) + (MsgUnifiedEditorMonitor::maxMmsSize() - MsgUnifiedEditorMonitor::messageSize()) /BYTES_TO_KBYTES_FACTOR; QString displayStr = QString(LOC_UNABLE_TO_ATTACH_ITEM) .arg(availableSize); @@ -108,8 +97,7 @@ mHasImage(false), mHasAudio(false), mTextEdit(0), -mEditorFrame(0), -mIconItem(0), +mPixmapItem(0), mAudioItem(0), mImageSize(0), mAudioSize(0), @@ -117,29 +105,13 @@ mProcessImageOperation(0), mMediaResolver(0), mImageInfo(0), -mProcessingWidget(0) +mProcessingWidget(0), +mDraftMessage(false), +mIsImageResizing(false) { mTextEdit = new HbTextEdit(this); + mTextEdit->setPlaceholderText(LOC_HINT_TEXT); HbStyle::setItemName(mTextEdit,"textEdit"); - - HbFrameDrawer* frameDrawer = new HbFrameDrawer(EDITOR_FRAME, - HbFrameDrawer::NinePieces); - - mEditorFrame = new HbFrameItem(frameDrawer,this); - HbStyle::setItemName(mEditorFrame,"textEditFrame"); - mEditorFrame->setZValue(-1); - - // add "Send" action in VKB - HbEditorInterface editorInterface(mTextEdit); - HbAction *sendAction = new HbAction(HbIcon(SEND_ICON), QString(),this); - connect(sendAction, SIGNAL(triggered()),this, SIGNAL(sendMessage())); - editorInterface.addAction(sendAction); - - /* mGestureFilter = new HbGestureSceneFilter(Qt::LeftButton, this); - mGestureFilter->setLongpressAnimation(true); - HbGesture *gesture = new HbGesture(HbGesture::longpress, 5); - mGestureFilter->addGesture(gesture); - connect(gesture, SIGNAL(longPress(QPointF)), this, SLOT(longPressed(QPointF)));*/ connect(mTextEdit, SIGNAL(contentsChanged()), this, SLOT(onTextChanged())); mMmsConformanceCheck = new MmsConformanceCheck; @@ -198,67 +170,82 @@ return mTextEdit->toPlainText(); } -void MsgUnifiedEditorBody::setImage(QString& imagefile) -{ - if (!mImageInfo) - { - setImage(true); - - mImageFile = imagefile; - if (mIconItem) +void MsgUnifiedEditorBody::setImage(QString& imagefile, bool draftMessage) + { + // do nothing if filepath is empty + if (imagefile.isEmpty()) { - delete mIconItem; - mIconItem = NULL; - mImageSize = 0; - } - - int error = KErrNone; - - if( !mProcessImageOperation ) - { - TRAP(error,mProcessImageOperation = - CUniEditorProcessImageOperation::NewL(*this)); - } - if( !mMediaResolver && error == KErrNone ) - { - TRAP(error,mMediaResolver = CMsgMediaResolver::NewL()); + return; } - if( error == KErrNone) + mDraftMessage = draftMessage; + if (!mImageInfo) { - mMediaResolver->SetCharacterSetRecognition(EFalse); - HBufC *name = S60QConversions::qStringToS60Desc(imagefile); - RFile file; - TRAP(error, file = mMediaResolver->FileHandleL(*name)); - if(error == KErrNone) + setImage(true); + + mImageFile = imagefile; + if (mPixmapItem) + { + mPixmapItem->setParent(NULL); + delete mPixmapItem; + mPixmapItem = NULL; + mImageSize = 0; + } + + int error = KErrNone; + if (!mDraftMessage) { - TRAP(error,mImageInfo = static_cast - (mMediaResolver->CreateMediaInfoL(file))); + // if image is in draft, no need to resize it because it is resized already + if (!mProcessImageOperation) + { + TRAP(error,mProcessImageOperation = + CUniEditorProcessImageOperation::NewL(*this)); + } + if (!mMediaResolver && error == KErrNone) + { + TRAP(error,mMediaResolver = CMsgMediaResolver::NewL()); + } + + if (error == KErrNone) + { + mMediaResolver->SetCharacterSetRecognition(EFalse); + HBufC *name = XQConversions::qStringToS60Desc(imagefile); + RFile file; + TRAP(error, file = mMediaResolver->FileHandleL(*name)); if (error == KErrNone) - { - TRAP(error, mMediaResolver->ParseInfoDetailsL( - mImageInfo, file)); + { + TRAP(error,mImageInfo = static_cast + (mMediaResolver->CreateMediaInfoL(file))); + if (error == KErrNone) + { + TRAP(error, mMediaResolver->ParseInfoDetailsL( + mImageInfo, file)); + } + file.Close(); + } + delete name; } - file.Close(); } - delete name; - } - - if (error == KErrNone) - { + if (error == KErrNone && !mDraftMessage) + { mSavedImageFile = imagefile; startResizeAnimation(); + mIsImageResizing = true; mProcessImageOperation->Process(mImageInfo); - } + } else - { - delete mImageInfo; - mImageInfo = NULL; + { + if (mImageInfo) + { + delete mImageInfo; + mImageInfo = NULL; + } mSavedImageFile.clear(); handleSetImage(); + } + } } -} void MsgUnifiedEditorBody::handleSetImage() { @@ -269,7 +256,7 @@ int msgSize = messageSize(); QFileInfo fileinfo(mImageFile); int imageSize = fileinfo.size() + KEstimatedMimeHeaderSize; - if ( (imageSize + msgSize) <= MsgMonitor::maxMmsSize()) + if ( (imageSize + msgSize) <= MsgUnifiedEditorMonitor::maxMmsSize()) { mImageSize = imageSize; } @@ -282,16 +269,13 @@ return; } - mIconItem = new HbIconItem(this); - mIconItem->hide(); - //mIconItem->setIconName(mImageFile); - QPixmap pixmap(mImageFile); - mIconItem->setIcon(HbIcon(pixmap)); - - HbStyle::setItemName(mIconItem, "pixmap"); - mIconItem->setAlignment(Qt::AlignHCenter | Qt::AlignTop); - // mIconItem->installSceneEventFilter(mGestureFilter); - + mPixmapItem = new MsgUnifiedEditorPixmapWidget(this); + mPixmapItem->hide(); + HbStyle::setItemName(mPixmapItem, "pixmap"); + mPixmapItem->setAlignment(Qt::AlignHCenter | Qt::AlignTop); + mPixmapItem->populate(mImageFile); + connect(mPixmapItem,SIGNAL(remove()),this,SLOT(removeMedia())); + // repolish the body widget this->repolish(); @@ -301,6 +285,12 @@ void MsgUnifiedEditorBody::setAudio(QString& audiofile) { + // do nothing if filepath is empty + if(audiofile.isEmpty()) + { + return; + } + //check for insert conformance if(EInsertSuccess != mMmsConformanceCheck->checkModeForInsert(audiofile)) return; @@ -309,6 +299,7 @@ mAudioFile = audiofile; if(mAudioItem) { + mAudioItem->setParent(NULL); delete mAudioItem; mAudioItem = NULL; mAudioSize = 0; @@ -317,7 +308,7 @@ int msgSize = messageSize(); QFileInfo fileinfo(mAudioFile); int audioSize = fileinfo.size() + KEstimatedMimeHeaderSize; - if((audioSize + msgSize) <= MsgMonitor::maxMmsSize() ) + if((audioSize + msgSize) <= MsgUnifiedEditorMonitor::maxMmsSize() ) { mAudioSize = audioSize; } @@ -330,16 +321,11 @@ return; } - HbIconItem* audioIcon = new HbIconItem(AUDIO_ICON); - mAudioItem = new HbPushButton(this); + mAudioItem = new MsgUniFiedEditorAudioWidget(this); mAudioItem->hide(); HbStyle::setItemName(mAudioItem,"audioItem"); - mAudioItem->setIcon(audioIcon->icon()); - mAudioItem->setText(fileinfo.baseName()); - MsgMediaUtil mediaUtil; - mAudioItem->setAdditionalText(mediaUtil.mediaDuration(mAudioFile)); - mAudioItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - connect(mAudioItem, SIGNAL(longPress(QPointF)), this, SLOT(longPressed(QPointF))); + mAudioItem->populate(mAudioFile); + connect(mAudioItem,SIGNAL(remove()),this,SLOT(removeMedia())); // repolish the body widget this->repolish(); @@ -350,7 +336,10 @@ void MsgUnifiedEditorBody::setText(QString& text) { - mTextEdit->setPlainText(text); + if(!text.isEmpty()) + { + mTextEdit->setPlainText(text); + } } const QStringList MsgUnifiedEditorBody::mediaContent() @@ -363,8 +352,6 @@ if(mHasAudio) mediaFiles << mAudioFile; - //TODO: append video content - return mediaFiles; } @@ -427,7 +414,7 @@ mAudioItem->show(); } - if(mIconItem || mProcessingWidget) + if(mPixmapItem || mProcessingWidget) { QSizeF imageSize(0.0,0.0); QSizeF defaultImageSize(QImageReader(mImageFile).size()); @@ -461,17 +448,17 @@ imageSize.setWidth(newWidth); } - if(mIconItem) + if(mPixmapItem) { - mIconItem->setPreferredSize(imageSize); - mIconItem->setSize(imageSize); + mPixmapItem->setPreferredSize(imageSize); + mPixmapItem->setSize(imageSize); if(mMainWindow->orientation() == Qt::Horizontal) { - QPointF currPos = mIconItem->pos(); + QPointF currPos = mPixmapItem->pos(); currPos.setX(leftMargin+((maxWidth-imageSize.width())/2)); - mIconItem->setPos(currPos); + mPixmapItem->setPos(currPos); } - mIconItem->show(); + mPixmapItem->show(); } if(mProcessingWidget) @@ -490,147 +477,46 @@ return szHint; } -void MsgUnifiedEditorBody::longPressed(QPointF position) -{ - HbMenu* menu = new HbMenu; - menu->addAction(LOC_OPEN, this, SLOT(openMedia())); - menu->addAction(LOC_REMOVE, this, SLOT(removeMedia())); - menu->addAction(LOC_DETAILS, this, SLOT(viewDetails())); - - menu->setDismissPolicy(HbPopup::TapAnywhere); - menu->setAttribute(Qt::WA_DeleteOnClose, true); - menu->setPreferredPos(position); - - menu->setObjectName(getHitRegion(position)); - menu->show(); -} - void MsgUnifiedEditorBody::removeMedia() { - HbAction* action = qobject_cast(sender()); - QString objName = action->parent()->objectName(); - if(objName == IMAGE_REGION) + QObject* senderObject = sender(); + + MsgUnifiedEditorPixmapWidget* pixmap = + qobject_cast(senderObject); + + MsgUniFiedEditorAudioWidget* audio = + qobject_cast(senderObject); + + if(pixmap) //remove image { mImageFile.clear(); - if(mIconItem) + if(mPixmapItem) { - // mIconItem->removeSceneEventFilter(mGestureFilter); - delete mIconItem; - mIconItem = NULL; + mPixmapItem->setParent(NULL); + delete mPixmapItem; + mPixmapItem = NULL; } setImage(false); mImageSize = 0; } - else if(objName == AUDIO_REGION) - { - mAudioFile.clear(); - if(mAudioItem) + else if(audio)//remove audio item { - delete mAudioItem; - mAudioItem = NULL; + mAudioFile.clear(); + if(mAudioItem) + { + mAudioItem->setParent(NULL); + delete mAudioItem; + mAudioItem = NULL; + } + setAudio(false); + mAudioSize = 0; } - setAudio(false); - mAudioSize = 0; - } - else if(objName == VIDEO_REGION) - { - //TODO: complete this with video handling story - } - else - { - // return without doing anything - return; - } this->repolish(); emit contentChanged(); } -//--------------------------------------------------------------- -// MsgUnifiedEditorBody :: openMedia -// @see header file -//--------------------------------------------------------------- -void MsgUnifiedEditorBody::openMedia() -{ - HbAction* action = qobject_cast(sender()); - QString objName = action->parent()->objectName(); - - QString fileName; - if ( objName == IMAGE_REGION ) - { - fileName = mImageFile; - } - else if ( objName == AUDIO_REGION ) - { - fileName = mAudioFile; - } - else - { - return; - } - - XQSharableFile sf; - XQAiwRequest* request = 0; - - if ( !sf.open(fileName) ) - { - return; - } - - // Get handlers - XQApplicationManager appManager; - QList fileHandlers = appManager.list(sf); - if (fileHandlers.count() > 0) - { - XQAiwInterfaceDescriptor d = fileHandlers.first(); - request = appManager.create(sf, d); - - if ( !request ) - { - sf.close(); - return ; - } - } - else - { - sf.close(); - return; - } - - // Result handlers - connect (request, SIGNAL(requestOk(const QVariant&)), - this, SLOT(handleOk(const QVariant&))); - connect (request, SIGNAL(requestError(const QVariant&)), - this, SLOT(handleError(const QVariant&))); - - request->setEmbedded(true); - request->setSynchronous(true); - - // Fill args - QList args; - args << qVariantFromValue(sf); - request->setArguments(args); - - // Fill headers - QString key("WindowTitle"); - QVariant value(QString(LOC_TITLE)); - XQRequestInfo info; - info.setInfo(key, value); - request->setInfo(info); - - request->send(); - - // Cleanup - sf.close(); - delete request; -} - -void MsgUnifiedEditorBody::viewDetails() -{ - //open details view. -} - bool MsgUnifiedEditorBody::hasImage() { return mHasImage; @@ -676,32 +562,7 @@ estimatedMediaSize = KEstimatedMmsSmilHeaderSize; } - return estimatedMediaSize + MsgMonitor::subjectSize() + MsgMonitor::containerSize(); -} - -QString MsgUnifiedEditorBody::getHitRegion(QPointF position) -{ - if(mIconItem) - { - QPolygonF imageHitRegion = mIconItem->mapToScene(mIconItem->boundingRect()); - if(imageHitRegion.containsPoint(position, Qt::OddEvenFill)) - { - return IMAGE_REGION; - } - } - - if(mAudioItem) - { - QPolygonF audioHitRegion = mAudioItem->mapToScene(mAudioItem->boundingRect()); - if(audioHitRegion.containsPoint(position, Qt::OddEvenFill)) - { - return AUDIO_REGION; - } - } - - //TODO : add hit test for video region with video userstory - - return INVALID_REGION; + return estimatedMediaSize + MsgUnifiedEditorMonitor::subjectSize() + MsgUnifiedEditorMonitor::containerSize(); } void MsgUnifiedEditorBody::onTextChanged() @@ -709,12 +570,12 @@ QString string = text(); if( string.size() > mPrevBuffer.size() && - MsgMonitor::messageType() == ConvergedMessage::Mms ) + MsgUnifiedEditorMonitor::messageType() == ConvergedMessage::Mms ) { // reject any text input if mms size limit is reached int futureSize = bodySize() + - MsgMonitor::containerSize() + MsgMonitor::subjectSize(); - if(futureSize > MsgMonitor::maxMmsSize()) + MsgUnifiedEditorMonitor::containerSize() + MsgUnifiedEditorMonitor::subjectSize(); + if(futureSize > MsgUnifiedEditorMonitor::maxMmsSize()) { mTextEdit->setPlainText(mPrevBuffer); HbNotificationDialog::launchDialog(LOC_UNABLE_TO_ADD_CONTENT); @@ -754,7 +615,7 @@ // emit signal to indicate change in content emit contentChanged(); - if(MsgMonitor::messageType() == ConvergedMessage::Sms) + if(MsgUnifiedEditorMonitor::messageType() == ConvergedMessage::Sms) { //Set char counter value QString display = QString("%1(%2)").arg(numOfRemainingChars).arg( @@ -777,27 +638,34 @@ void MsgUnifiedEditorBody::EditorOperationEvent( TUniEditorProcessImageOperationEvent aEvent, TFileName aFileName) { - stopResizeAnimation(); - delete mImageInfo; mImageInfo = NULL; if (aEvent == EUniEditorProcessImageOperationComplete && aFileName.Length() > 0) { - mImageFile = S60QConversions::s60DescToQString(aFileName); + mImageFile = XQConversions::s60DescToQString(aFileName); } else { mImageFile = mSavedImageFile; } mSavedImageFile.clear(); + + // image resize is complete. reset the image resize flag + mIsImageResizing = false; //handle the processed image from ProcessImage Operation handleSetImage(); + + stopResizeAnimation(); } void MsgUnifiedEditorBody::startResizeAnimation() { + // emit signal to indicate disable the send tool button. + emit enableSendButton(false); + + QGraphicsLinearLayout* processingLayout = new QGraphicsLinearLayout(Qt::Vertical); mProcessingWidget = new HbWidget(this); @@ -810,6 +678,7 @@ processingLayout->addItem(processingText); HbIconItem* animationItem = new HbIconItem(ANIMATION_ICON,mProcessingWidget); + animationItem->setAlignment(Qt::AlignHCenter); processingLayout->addItem(animationItem); HbIconAnimator& iconAnimator = animationItem->animator(); @@ -828,6 +697,7 @@ delete mProcessingWidget; mProcessingWidget = NULL; } + } // --------------------------------------------------------- @@ -850,26 +720,6 @@ } //--------------------------------------------------------------- -// MsgUnifiedEditorBody :: handleOk -// @see header file -//--------------------------------------------------------------- -void MsgUnifiedEditorBody::handleOk(const QVariant& result) -{ - Q_UNUSED(result) -} - -//--------------------------------------------------------------- -// MsgUnifiedEditorBody :: handleError -// @see header file -//--------------------------------------------------------------- -void MsgUnifiedEditorBody::handleError(int errorCode, - const QString& errorMessage) -{ - Q_UNUSED(errorMessage) - Q_UNUSED(errorCode) -} - -//--------------------------------------------------------------- // MsgUnifiedEditorBody :: setFocus // @see header file //--------------------------------------------------------------- diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgunieditorlineedit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorlineedit.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,640 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 "msgunieditorlineedit.h" +#include +#include +#include +#include + +const QRegExp expr("[,;\n]$"); +const QRegExp sepAtEnd("; $"); +const QRegExp sepAtMiddle("; "); + +const QString replacementStr("; "); +const QString labelSeperator(": "); + +const int fadedAlpha(125); +const int solidAlpha(255); + +const int SNAP_DELAY = 350; + +//Localization +#define LOC_PASTE hbTrId("txt_common_menu_paste") + +MsgUnifiedEditorLineEdit::MsgUnifiedEditorLineEdit(const QString& label,QGraphicsItem *parent): +HbLineEdit(parent), +mSelectionStart(-1), +mSelectionEnd(-1), +mDefaultBehaviour(false) +{ + QString labelStr = label.trimmed(); + + QTextCursor cursor(this->textCursor()); + QTextCharFormat colorFormat(cursor.charFormat()); + + QColor fgColor = this->palette().color(QPalette::Text); + fgColor.setAlpha(fadedAlpha); + colorFormat.setForeground(fgColor); + cursor.insertText(labelStr , colorFormat); + + fgColor.setAlpha(solidAlpha); + colorFormat.setForeground(fgColor); + + cursor.insertText(" ",colorFormat); + + mLabelExpr.setPattern(QString("^"+labelStr+" $")); + mLabel = labelStr+" "; + + moveCursor(QTextCursor::EndOfBlock); + + connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), + this,SLOT(selectionChanged(QTextCursor,QTextCursor))); + connect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged())); + + connect(this,SIGNAL(aboutToShowContextMenu(HbMenu*,const QPointF &)), + this,SLOT(aboutToShowContextMenu(HbMenu*,const QPointF &))); + +} + +MsgUnifiedEditorLineEdit::~MsgUnifiedEditorLineEdit() +{ +} + +void MsgUnifiedEditorLineEdit::inputMethodEvent(QInputMethodEvent *event) +{ + //let it go in default way. + if(mDefaultBehaviour) + { + HbAbstractEdit::inputMethodEvent(event); + event->accept(); + return; + } + + if (!event->commitString().isEmpty() || event->replacementLength()) + { + if (event->commitString().contains(expr)) + { + if(this->text().isEmpty() || this->text().contains(sepAtEnd) || this->text().contains(mLabelExpr)) + { + event->accept(); + return; + } + + this->setCursorPosition(this->text().length()); + + QString str = event->commitString(); + str.replace(expr, replacementStr); + + event->setCommitString(str, event->replacementStart(), event->replacementLength()); + } + else if(this->hasSelectedText()) + {// all user inputs get appended at the end + this->setCursorPosition(this->text().length()); + } + } + + HbAbstractEdit::inputMethodEvent(event); + event->accept(); +} + +void MsgUnifiedEditorLineEdit::keyPressEvent(QKeyEvent *event) +{ + QString str = event->text(); + + if(event->key()== Qt::Key_Enter || event->key()== Qt::Key_Return) + { + if(mDefaultBehaviour) + { + HbAbstractEdit::keyReleaseEvent(event); + event->accept(); + return; + } + if(this->text().isEmpty() || this->text().contains(sepAtEnd) || this->text().contains(mLabelExpr)) + { + event->accept(); + return; + } + this->setCursorPosition(this->text().length()); + str = replacementStr; + QKeyEvent eve(event->type(), Qt::Key_Any, event->modifiers(), str); + HbAbstractEdit::keyPressEvent(&eve); + event->accept(); + return; + } + + if(event->key() == Qt::Key_Backspace || event->key() == Qt::Key_Delete ) + { + int pos = this->cursorPosition(); + bool pbkContact = true; + + if(!this->hasSelectedText()) + { + this->setCursorPosition(pos-2); + pbkContact = this->textCursor().charFormat().fontUnderline(); + this->setCursorPosition(pos); + } + + QString text = this->text(); + text = text.left(pos); + + if(text.contains(mLabelExpr)) + { + event->accept(); + return; + } + + if(pbkContact) + { + //if already selected delete it. + if(this->hasSelectedText()) + { + // deleting phbkContact is an atomic operation + // ensure that the signal is emitted only once + disconnect(this, SIGNAL(contentsChanged()), + this, SLOT(onContentsChanged())); + HbLineEdit::keyPressEvent(event); + event->accept(); + //delete seperator (i.e."; "). + QKeyEvent eve(event->type(), Qt::Key_Delete, Qt::NoModifier); + HbLineEdit::keyPressEvent(&eve); + HbLineEdit::keyPressEvent(&eve); + connect(this, SIGNAL(contentsChanged()), + this, SLOT(onContentsChanged())); + onContentsChanged(); + } + else //make it selected + { + this->setCursorPosition(pos-3); + setHighlight(pos-3); + } + } + else + { + QString str = text.right(2); + if(str == replacementStr) + { + // deleting contact is an atomic operation + // ensure that the signal is emitted only once + disconnect(this, SIGNAL(contentsChanged()), + this, SLOT(onContentsChanged())); + //delete seperator (i.e."; "). + QKeyEvent eve(event->type(), Qt::Key_Backspace, Qt::NoModifier); + HbLineEdit::keyPressEvent(&eve); + HbLineEdit::keyPressEvent(&eve); + connect(this, SIGNAL(contentsChanged()), + this, SLOT(onContentsChanged())); + onContentsChanged(); + } + else + { + HbLineEdit::keyPressEvent(event); + } + event->accept(); + } + + event->accept(); + return; + } + + if (event->key() == Qt::Key_Left ) + { + bool selectedText = this->hasSelectedText(); + + //look ahead left. + int pos = this->cursorPosition(); + + QString text = this->text(); + text = text.left(pos); + + //no text other than label; + if(text.contains(mLabelExpr)) + { + event->accept(); + return; + } + + //look for next seperator while going left. + int newPos = text.lastIndexOf(sepAtMiddle); + + if(newPos < 0 && selectedText) + { + event->accept(); + return; + } + + bool pbkContact = true; + + if(!selectedText) + { + this->setCursorPosition(pos-2); + pbkContact = this->textCursor().charFormat().fontUnderline(); + this->setCursorPosition(pos); + } + else + { + this->setCursorPosition(newPos); + pbkContact = this->textCursor().charFormat().fontUnderline(); + this->setCursorPosition(pos); + } + + + if(pbkContact && newPos >0) + { + + setHighlight(newPos-1); + } + else + { + //move left, char by char. if seperator met jump over it. + if( (newPos > 0 && selectedText) || (pos-2 == newPos)) + { + this->setCursorPosition(newPos+1); + } + + HbLineEdit::keyPressEvent(event); + + } + event->accept(); + return; + } + + if (event->key() == Qt::Key_Right) + { + bool selectedText = this->hasSelectedText(); + + //look ahead. + int pos = this->cursorPosition(); + this->setCursorPosition(pos+3); + bool pbkContact = this->textCursor().charFormat().fontUnderline(); + this->setCursorPosition(pos); + + //look for next seperator. + QString text = this->text(); + int newPos = text.indexOf(sepAtMiddle,pos+2); + + if(pbkContact && newPos >0) + { + this->setCursorPosition(newPos-1); + setHighlight(newPos-1); + } + else + { + int seperatorPos = text.indexOf(sepAtMiddle,pos); + + if(selectedText || seperatorPos == pos) + { + this->setCursorPosition(pos+1); + this->deselect(); + } + HbAbstractEdit::keyPressEvent(event); + } + event->accept(); + return; + } + + if(!str.isEmpty()) + { + if(mDefaultBehaviour) + { + HbAbstractEdit::keyPressEvent(event); + event->accept(); + return; + } + if (str.contains(expr)) + { + if(this->text().isEmpty() || this->text().contains(sepAtEnd) || this->text().contains(mLabelExpr)) + { + event->accept(); + return; + } + + // auto-complete the last incomplete word + int contentLength = this->text().length(); + int pos = this->cursorPosition(); + QString incompleteWord(this->text().right(contentLength-(pos-1))); + if(!incompleteWord.contains(sepAtMiddle)) + { + this->setCursorPosition(this->text().length()); + } + + str.replace(expr, replacementStr); + QKeyEvent eve(event->type(), event->key(), event->modifiers(), str); + HbAbstractEdit::keyPressEvent(&eve); + } + else + { + HbAbstractEdit::keyPressEvent(event); + event->accept(); + return; + } + } +} + +void MsgUnifiedEditorLineEdit::handleTap() +{ + int currentPos = this->cursorPosition(); + + QString txt = this->text(); + + QString tempTxt = txt.left(currentPos+2); + int seperatorPos = tempTxt.lastIndexOf(sepAtMiddle,currentPos); + + txt = txt.right(txt.length() - currentPos); + int labelPos = txt.indexOf(labelSeperator); + + if(labelPos >= 0 )//pressed on label. + { + this->setCursorPosition(currentPos + labelPos + 2); + } + else if(seperatorPos == currentPos-1 || seperatorPos == currentPos)//pressed just on seperator. + { + this->setCursorPosition(seperatorPos+2); + } + else + { + this->setCursorPosition(currentPos+1); + bool pbkContact = this->textCursor().charFormat().fontUnderline(); + if(pbkContact) + { + setHighlight(currentPos); + } + } + + this->update(); +} + +void MsgUnifiedEditorLineEdit::gestureEvent(QGestureEvent* event) +{ + //passing gesture event to base class. + HbLineEdit::gestureEvent(event); + + + if(HbTapGesture *tap = qobject_cast(event->gesture(Qt::TapGesture))) + { + //capturing gesture position, and map to local co-ordinates. + QPointF pos = mapFromScene(tap->scenePosition()); + + switch (tap->state()) + { + case Qt::GestureFinished: + { + if (HbTapGesture::Tap == tap->tapStyleHint()) + { + handleTap(); + } + break; + } + default: + break; + } + event->accept(); + } + else + { + event->ignore(); + } +} + +void MsgUnifiedEditorLineEdit::setText(const QString& text, bool underlined) +{ + + if(!mDefaultBehaviour) + { + // atomic operation, ensure one signal only at the end + disconnect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged())); + + //make sure previous text is complete. + if(this->content().length() > 0) + { + QInputMethodEvent e; + e.setCommitString(";"); + this->inputMethodEvent(&e); + } + this->setCursorPosition(this->text().length()); + + QTextCursor cursor(this->textCursor()); + QTextCharFormat colorFormat(cursor.charFormat()); + if(underlined) + { + QColor fgColor = colorFormat.foreground().color(); + fgColor.setAlpha(fadedAlpha); + colorFormat.setUnderlineColor(fgColor); + colorFormat.setFontUnderline(true); + } + cursor.insertText(text , colorFormat); + colorFormat.setFontUnderline(false); + + cursor.insertText(replacementStr,colorFormat); + connect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged())); + onContentsChanged(); + } + else + { + this->setCursorPosition(this->text().length()); + QTextCursor cursor(this->textCursor()); + cursor.insertText(text); + } + + moveCursor(QTextCursor::EndOfBlock); +} + +QStringList MsgUnifiedEditorLineEdit::addresses() +{ + QString text = this->content(); + QStringList list = text.split(replacementStr,QString::SkipEmptyParts); + return list; +} + +void MsgUnifiedEditorLineEdit::focusInEvent(QFocusEvent* event) +{ + HbLineEdit::focusInEvent(event); + this->setCursorVisibility(Hb::TextCursorVisible); +} + +void MsgUnifiedEditorLineEdit::focusOutEvent(QFocusEvent* event) +{ + HbLineEdit::focusOutEvent(event); + this->setCursorVisibility(Hb::TextCursorHidden); +} + +void MsgUnifiedEditorLineEdit::setHighlight(int currentPos) +{ + QString txt = this->text(); + + int endPos = qMax(txt.indexOf(sepAtMiddle,currentPos), + txt.indexOf(labelSeperator,currentPos)); + + int startPos = qMax(txt.lastIndexOf(sepAtMiddle,currentPos), + txt.lastIndexOf(labelSeperator,currentPos)); + + disconnect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), + this,SLOT(selectionChanged(QTextCursor,QTextCursor))); + + //highlight if pbk contact. + if(startPos > 0 && endPos > 0 && startPos != endPos) + { + this->setSelection(startPos + 2, endPos - startPos - 2); + this->update(); + } + else + { + this->deselect(); + } + + this->update(); + + connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), + this,SLOT(selectionChanged(QTextCursor,QTextCursor))); +} + +void MsgUnifiedEditorLineEdit::selectionChanged(const QTextCursor &oldCursor, const QTextCursor& newCursor) +{ + + if(mSelectionSnapTimer.isActive()) + { + mSelectionSnapTimer.stop(); + } + + if(newCursor.selectionStart() < mLabel.length()) + { + this->setTextCursor(oldCursor); + return; + } + + if(!mDefaultBehaviour) + { + mSelectionStart = newCursor.selectionStart(); + mSelectionEnd = newCursor.selectionEnd(); + + if(mSelectionStart == mSelectionEnd ) + { + return; + } + + mSelectionSnapTimer.start(SNAP_DELAY,this); + } +} + +void MsgUnifiedEditorLineEdit::timerEvent(QTimerEvent *event) +{ + //passing event to base class. + HbLineEdit::timerEvent(event); + + if (event->timerId() == mSelectionSnapTimer.timerId()) + { + mSelectionSnapTimer.stop(); + + disconnect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), + this,SLOT(selectionChanged(QTextCursor,QTextCursor))); + + QString txt = this->text(); + + int startPos = qMax(txt.lastIndexOf(sepAtMiddle,mSelectionStart), + txt.lastIndexOf(labelSeperator,mSelectionStart)); + + int endPos = qMax(txt.indexOf(sepAtMiddle,mSelectionEnd), + txt.indexOf(labelSeperator,mSelectionEnd)); + + if(endPos < 0 ) + { + endPos = mSelectionEnd; + } + + this->setSelection(startPos + 2, endPos - startPos - 2); + + connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), + this,SLOT(selectionChanged(QTextCursor,QTextCursor))); + + event->accept(); + } +} + +void MsgUnifiedEditorLineEdit::setDefaultBehaviour(bool defaultBehaviour) +{ + mDefaultBehaviour = defaultBehaviour; +} + +QString MsgUnifiedEditorLineEdit::text() const +{ + return HbLineEdit::text(); +} + +QString MsgUnifiedEditorLineEdit::content() const +{ + QString text = this->text(); + text.remove(mLabel); + return text; +} + +void MsgUnifiedEditorLineEdit::clearContent() +{ + // avoid getting updates during local editing + disconnect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged())); + + int startPos = mLabel.length(); + this->setSelection(startPos, content().length()); + QKeyEvent eve(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier); + this->keyPressEvent(&eve); + this->deselect(); + + // re-connect signal to start getting updates + connect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged())); +} + +void MsgUnifiedEditorLineEdit::onContentsChanged() +{ + emit contentsChanged(content()); +} + +void MsgUnifiedEditorLineEdit::highlightInvalidString(QString invalidStr) +{ + // for only address editor + if(!mDefaultBehaviour) + { + QString txtContent = this->text(); + int searchStartPos = mLabel.length(); + int startPos = txtContent.indexOf(invalidStr, searchStartPos); + disconnect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), + this,SLOT(selectionChanged(QTextCursor,QTextCursor))); + // if invalidStr found + if(startPos > 0) + { + this->setSelection(startPos, invalidStr.length()); + } + connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), + this,SLOT(selectionChanged(QTextCursor,QTextCursor))); + } +} + +void MsgUnifiedEditorLineEdit::aboutToShowContextMenu(HbMenu *contextMenu, const QPointF &pos) +{ + Q_UNUSED(pos) + //clear all menu actions. + contextMenu->clearActions(); + + const QMimeData *mimedata = QApplication::clipboard()->mimeData(); + if(mimedata) + { + if(canInsertFromMimeData(mimedata)) + { + contextMenu->addAction(LOC_PASTE,this,SLOT(paste())); + } + } + +} +// eof diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgunieditormonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditormonitor.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,350 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Helper class to monitor msg construction in unified editor + * + */ + +// INCLUDES +#include "debugtraces.h" +#include +#include + +// USER INCLUDES +#include "msgunieditormonitor.h" +#include "msgunieditorview.h" +#include "msgunieditoraddress.h" +#include "msgunieditorsubject.h" +#include "msgunieditorbody.h" +#include "msgunieditorattachmentcontainer.h" +#include "UniEditorGenUtils.h" + +// Constants + +// Define static +ConvergedMessage::MessageType MsgUnifiedEditorMonitor::mMessageType; +int MsgUnifiedEditorMonitor::mBodySize; +int MsgUnifiedEditorMonitor::mContainerSize; +int MsgUnifiedEditorMonitor::mSubjectSize; +int MsgUnifiedEditorMonitor::mMaxMmsSize; +int MsgUnifiedEditorMonitor::mMaxSmsRecipients; +int MsgUnifiedEditorMonitor::mMaxMmsRecipients; +int MsgUnifiedEditorMonitor::mMsgCurrAddressCount; + +//Localized strings +#define LOC_POP_MESSAGE_CHANGE_MUL hbTrId("txt_messaging_dpopinfo_message_type_changed_to_mul") +#define LOC_POP_MESSAGE_CHANGE_TEXT hbTrId("txt_messaging_dpopinfo_message_type_changed_to_tex") + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::MsgUnifiedEditorMonitor +// @see header file +//--------------------------------------------------------------- +MsgUnifiedEditorMonitor::MsgUnifiedEditorMonitor(QObject* parent) : +QObject(parent), +mSkipNote(false) +{ + init(); + mUniEditorGenUtils = new UniEditorGenUtils; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::~MsgUnifiedEditorMonitor +// @see header file +//--------------------------------------------------------------- +MsgUnifiedEditorMonitor::~MsgUnifiedEditorMonitor() +{ + delete mUniEditorGenUtils; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::init +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorMonitor::init() +{ + mMessageType = ConvergedMessage::Sms; + mBodySize = 0; + mContainerSize = 0; + mSubjectSize = 0; + mMsgCurrAddressCount = 0; + + UniEditorGenUtils* uniEditorGenUtils = new UniEditorGenUtils; + + mMaxMmsSize = KDefaultMaxSize; + TRAP_IGNORE(mMaxMmsSize = uniEditorGenUtils->MaxMmsMsgSizeL()); + + mMaxSmsRecipients = KDefaultSmsRecipients; + TRAP_IGNORE(mMaxSmsRecipients = uniEditorGenUtils->MaxSmsRecipientsL()); + + mMaxMmsRecipients = KDefaultMmsRecipients; + TRAP_IGNORE(mMaxMmsRecipients = uniEditorGenUtils->MaxMmsRecipientsL()); + + delete uniEditorGenUtils; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::handleContentChange +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorMonitor::handleContentChange() +{ + // get the projected message type & show the type change note + ConvergedMessage::MessageType newMsgType = projectedMsgType(); + if(mMessageType != newMsgType) + { + mMessageType = newMsgType; + QString noteStr; + if(newMsgType == ConvergedMessage::Sms) + { + noteStr = LOC_POP_MESSAGE_CHANGE_TEXT; + } + else + { + noteStr = LOC_POP_MESSAGE_CHANGE_MUL; + } + showPopup(noteStr); + } + + HbWidget* senderWidget = qobject_cast(sender()); + updateMsgInfo(senderWidget); + updateSend(); +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::projectedMsgType +// @see header file +//--------------------------------------------------------------- +ConvergedMessage::MessageType MsgUnifiedEditorMonitor::projectedMsgType() +{ + ConvergedMessage::MessageType newMsgType = ConvergedMessage::Sms; + + // check if MMS content is present in any of the editor component + if( bodyHasMMSContent() || + subjectHasMMSContent() || + containerHasMMSContent() || + otherMMSCriteriaMet() ) + { + newMsgType = ConvergedMessage::Mms; + } + return newMsgType; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::updateMsgInfo +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorMonitor::updateMsgInfo(HbWidget* senderWidget) +{ + if(mMessageType == ConvergedMessage::Mms) + { + //Disable char counter & add subject + view()->mBody->disableCharCounter(); + view()->addSubject(); + } + + // check if sent by body widget + MsgUnifiedEditorBody* body = NULL; + body = qobject_cast(senderWidget); + if(body) + { + mBodySize = view()->mBody->bodySize(); + view()->setAttachOptionEnabled( + MsgUnifiedEditorView::TBE_PHOTO, !view()->mBody->hasImage()); + view()->setAttachOptionEnabled( + MsgUnifiedEditorView::TBE_SOUND, !view()->mBody->hasAudio()); + return; + } + + // check if sent by subject widget + MsgUnifiedEditorSubject* subject = NULL; + subject = qobject_cast(senderWidget); + if(subject) + { + mSubjectSize = view()->mSubjectField->subjectSize(); + return; + } + + // check if sent by attachment container widget + MsgAttachmentContainer* container = NULL; + container = qobject_cast(senderWidget); + if(container) + { + mContainerSize = view()->mAttachmentContainer->containerSize(); + return; + } + + // handle content change from other widgets e.g. To, Cc, Bcc address field + int totalAddressCount = view()->mToField->addressCount(); + if(view()->mCcField && view()->mBccField) + { + totalAddressCount += view()->mCcField->addressCount() + + view()->mBccField->addressCount(); + } + mMsgCurrAddressCount = totalAddressCount; + return; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::showPopup +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorMonitor::showPopup(const QString& text) +{ + if(!mSkipNote) + { + HbNotificationDialog* dlg = new HbNotificationDialog(); + dlg->setFocusPolicy(Qt::NoFocus); + dlg->setDismissPolicy(HbPopup::TapAnywhere); + dlg->setAttribute(Qt::WA_DeleteOnClose, true); + dlg->setText(text); + dlg->show(); + } + // reset skip note flag + mSkipNote = false; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::view +// @see header file +//--------------------------------------------------------------- +MsgUnifiedEditorView* MsgUnifiedEditorMonitor::view() +{ + return static_cast(this->parent()); +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::bodyHasMMSContent +// @see header file +//--------------------------------------------------------------- +bool MsgUnifiedEditorMonitor::bodyHasMMSContent() +{ + MsgUnifiedEditorBody* edBody = view()->mBody; + // If any media-object is present inside body + if(!edBody->mediaContent().isEmpty()) + { + return true; + } + + int bodyTextSize = mUniEditorGenUtils->UTF8Size(edBody->text()); + int maxSmsSize = 0; + TRAP_IGNORE(maxSmsSize = + mUniEditorGenUtils->MaxSmsMsgSizeL(edBody->isUnicode())); + // If body text size exceeds sms text-size limit + if(bodyTextSize > maxSmsSize) + { + return true; + } + return false; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::subjectHasMMSContent +// @see header file +//--------------------------------------------------------------- +bool MsgUnifiedEditorMonitor::subjectHasMMSContent() +{ + MsgUnifiedEditorSubject* edSubject = view()->mSubjectField; + ConvergedMessage::Priority priority = ConvergedMessage::Normal; + QString subjectText; + if(edSubject) + { + priority = edSubject->priority(); + subjectText = edSubject->text(); + } + // If priority is set to other than Normal or + // If subject has some content + if( (priority != ConvergedMessage::Normal) || + !subjectText.isEmpty() ) + { + return true; + } + return false; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::containerHasMMSContent +// @see header file +//--------------------------------------------------------------- +bool MsgUnifiedEditorMonitor::containerHasMMSContent() +{ + QString bodyText = view()->mBody->text(); + MsgAttachmentContainer* edContainer = view()->mAttachmentContainer; + bool hasMMAttachmentContent = false; + int attachmentCount = 0; + if(edContainer) + { + hasMMAttachmentContent = edContainer->hasMMContent(); + attachmentCount = edContainer->count(); + } + // If MM attachments are present or + // If only one non-MM attachment is present e.g. vcf along with body text + if( hasMMAttachmentContent || + ((attachmentCount == 1) && !bodyText.isEmpty()) ) + { + return true; + } + return false; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::otherMMSCriteriaMet +// @see header file +//--------------------------------------------------------------- +bool MsgUnifiedEditorMonitor::otherMMSCriteriaMet() +{ + MsgUnifiedEditorAddress* edCc = view()->mCcField; + MsgUnifiedEditorAddress* edBcc = view()->mBccField; + int ccCount = 0; + int bccCount = 0; + if(edCc && edBcc) + { + ccCount = edCc->addressCount(); + bccCount = edBcc->addressCount(); + } + // If CC/BCC has some content or + // If to-recipients count exceeds max sms recipient count + if( ccCount || bccCount || + (view()->mToField->addressCount() > mMaxSmsRecipients) ) + { + return true; + } + + // If to-field contains an email address + bool isEmailPresent = false; + ConvergedMessageAddressList addrList = view()->mToField->addresses(); + TRAP_IGNORE(isEmailPresent = mUniEditorGenUtils->VerifyEmailAddressesL(addrList)); + if(isEmailPresent) + { + return true; + } + return false; +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorMonitor::updateSend +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorMonitor::updateSend() +{ + if (mMsgCurrAddressCount > 0 && (mSubjectSize + mBodySize + mContainerSize) > 0 && !view()->mBody->isImageResizing()) + { + emit enableSend(true); + } + else + { + emit enableSend(false); + } +} + + +//EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgunieditorpixmapwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorpixmapwidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 widget displays the pixmap content. + * + */ + +#include "msgunieditorpixmapwidget.h" + +// SYSTEM INCLUDES +#include +#include +#include +#include +#include +#include + +// USER INCLUDES +#include "msgunieditorutils.h" + +// LOCAL CONSTANTS +#define LOC_OPEN hbTrId("txt_common_menu_open") +#define LOC_REMOVE hbTrId("txt_common_menu_remove") +#define LOC_DETAILS hbTrId("txt_common_menu_details") + +const QString IMAGE_MIMETYPE("image"); + +//--------------------------------------------------------------- +// MsgUnifiedEditorPixmapWidget::MsgUnifiedEditorPixmapWidget +// @see header file +//--------------------------------------------------------------- +MsgUnifiedEditorPixmapWidget::MsgUnifiedEditorPixmapWidget(QGraphicsItem *parent) : +HbIconItem(parent), +mEditorUtils(0) +{ + this->grabGesture(Qt::TapGesture); +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorPixmapWidget::~MsgUnifiedEditorPixmapWidget +// @see header file +//--------------------------------------------------------------- +MsgUnifiedEditorPixmapWidget::~MsgUnifiedEditorPixmapWidget() +{ +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorPixmapWidget::setPixmap +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorPixmapWidget::populate(const QString &pixmapPath) +{ + mPixmapPath = pixmapPath; + QPixmap pixmap(mPixmapPath); + this->setIcon(HbIcon(pixmap)); +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorPixmapWidget::gestureEvent +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorPixmapWidget::gestureEvent(QGestureEvent *event) +{ + HbTapGesture *tapGesture = qobject_cast (event->gesture(Qt::TapGesture)); + if (tapGesture) { + switch (tapGesture->state()) { + case Qt::GestureStarted: + { + // Trigger haptic feedback. + HbInstantFeedback::play(HbFeedback::Basic); + break; + } + case Qt::GestureUpdated: + { + if (HbTapGesture::TapAndHold == tapGesture->tapStyleHint()) { + // Handle longtap. + handleLongTap(tapGesture->scenePosition()); + } + break; + } + case Qt::GestureFinished: + { + HbInstantFeedback::play(HbFeedback::Basic); + if (HbTapGesture::Tap == tapGesture->tapStyleHint()) { + // Handle short tap + handleShortTap(); + } + break; + } + case Qt::GestureCanceled: + { + HbInstantFeedback::play(HbFeedback::Basic); + break; + } + } + } + else { + HbIconItem::gestureEvent(event); + } +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorPixmapWidget::handleOpen +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorPixmapWidget::handleOpen() +{ + this->ungrabGesture(Qt::TapGesture); + + if (!mEditorUtils) { + mEditorUtils = new MsgUnifiedEditorUtils(this); + } + mEditorUtils->launchContentViewer(IMAGE_MIMETYPE, mPixmapPath); + + //fire timer to regrab gesture after some delay. + QTimer::singleShot(300,this,SLOT(regrabGesture())); +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorPixmapWidget::handleSave +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorPixmapWidget::handleRemove() +{ + emit remove(); +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorPixmapWidget::handleSave +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorPixmapWidget::viewDetails() +{ + +} + +//---------------------------------------------------------------------------- +// MsgUnifiedEditorPixmapWidget::handleShortTap +// @see header file +//---------------------------------------------------------------------------- +void MsgUnifiedEditorPixmapWidget::handleShortTap() +{ + emit shortTap(mPixmapPath); + + // Open the media. + handleOpen(); +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorPixmapWidget::handleLongTap +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorPixmapWidget::handleLongTap(const QPointF &position) +{ + emit longTap(position); + + HbMenu* menu = new HbMenu; + menu->setAttribute(Qt::WA_DeleteOnClose); + menu->setDismissPolicy(HbPopup::TapAnywhere); + + menu->addAction(LOC_OPEN, this, SLOT(handleOpen())); + menu->addAction(LOC_REMOVE, this, SLOT(handleRemove())); + menu->addAction(LOC_DETAILS, this, SLOT(viewDetails())); + + menu->setPreferredPos(position); + menu->show(); +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorPixmapWidget::regrabGesture +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorPixmapWidget::regrabGesture() +{ + this->grabGesture(Qt::TapGesture); +} +// EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgunieditorprocessimageoperation.cpp --- a/messagingapp/msgui/unifiededitor/src/msgunieditorprocessimageoperation.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorprocessimageoperation.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -19,13 +19,13 @@ // ========== INCLUDE FILES ================================ -#include +#include #include #include -#include -#include // for Central Repository keys +#include +#include // for Central Repository keys #include #include @@ -43,12 +43,12 @@ #include #include -#include +#include #include #include #include -#include "msgmonitor.h" +#include "msgunieditormonitor.h" #include "msgunieditorprocessimageoperation.h" // ========== CONSTANTS ==================================== @@ -85,7 +85,7 @@ CleanupStack::PushL( self ); self->ConstructL(); - CleanupStack::Pop( self ); + CleanupStack::Pop(); return self; } @@ -149,7 +149,7 @@ delete repository; - iMaxMmsSize = MsgMonitor::maxMmsSize(); + iMaxMmsSize = MsgUnifiedEditorMonitor::maxMmsSize(); } // --------------------------------------------------------- @@ -476,9 +476,9 @@ if ( !( iProcessMethod & EUniProcessImgMethodScale ) && ( iImageInfo->FileSize() + - MsgMonitor::messageSize() ) > iMaxMmsSize && + MsgUnifiedEditorMonitor::messageSize() ) > iMaxMmsSize && iImageInfo->MimeType().CompareF( KMsgMimeImageJpeg ) == 0 && - (MsgMonitor::messageSize()) < KUniCompressionMargin ) + (MsgUnifiedEditorMonitor::messageSize()) < KUniCompressionMargin ) { // Only compression needed as image is JPEG that is larger than can be fitted // into the message and scaling is not performed. Also current message size @@ -493,7 +493,7 @@ // Image won't be processed if ( ( origSize.iWidth > KImageRichWidth || origSize.iHeight > KImageRichHeight ) && - ( iImageInfo->FileSize() + MsgMonitor::messageSize() ) < iMaxMmsSize ) + ( iImageInfo->FileSize() + MsgUnifiedEditorMonitor::messageSize() ) < iMaxMmsSize ) { // Original image width or height is "non-conformant" and original image would // fit to into the message without any processing. @@ -525,7 +525,8 @@ if( largeImageQuery && iMmsCreationMode == EMmsCreationModeWarning) { HbMessageBox::question(LOC_LARGE_IMAGE_NOTE, this, - SLOT(onDialogLargeImage(HbAction*))); + SLOT(onDialogLargeImage(HbAction*)), + HbMessageBox::Yes | HbMessageBox::No); } else { diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgunieditorsubject.cpp --- a/messagingapp/msgui/unifiededitor/src/msgunieditorsubject.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorsubject.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -23,8 +23,8 @@ // USER INCLUDES #include "msgunieditorsubject.h" #include "UniEditorGenUtils.h" -#include "msgunifiededitorlineedit.h" -#include "msgmonitor.h" +#include "msgunieditorlineedit.h" +#include "msgunieditormonitor.h" // Localized Constants #define LOC_SUBJECT hbTrId("txt_messaging_formlabel_subject") @@ -115,8 +115,8 @@ { // reject any text input if mms size limit is reached int futureSize = subjectSize() + - MsgMonitor::containerSize() + MsgMonitor::bodySize(); - if(futureSize > MsgMonitor::maxMmsSize()) + MsgUnifiedEditorMonitor::containerSize() + MsgUnifiedEditorMonitor::bodySize(); + if(futureSize > MsgUnifiedEditorMonitor::maxMmsSize()) { // atomic operation disconnect(mSubjectEdit, SIGNAL(contentsChanged(const QString&)), @@ -151,7 +151,10 @@ void MsgUnifiedEditorSubject::setText(const QString& text) { - mSubjectEdit->setText(text); + if(!text.isEmpty()) + { + mSubjectEdit->setText(text); + } } void MsgUnifiedEditorSubject::setFocus() diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgunieditorutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorutils.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Utility class for unieditor. + * + */ + +#include "msgunieditorutils.h" + +// SYSTEM INCLUDES +#include +#include +#include +#include + +// USER INCLUDES +#include "msgcontactsutil.h" + +// LOCAL CONSTANTS +#define LOC_TITLE hbTrId("txt_messaging_title_messaging") + +const QString IMAGE_MIMETYPE("image"); +const QString AUDIO_MIMETYPE("audio"); +const QString VCARD_MIMETYPE("text/X-vCard"); + +//--------------------------------------------------------------- +// MsgUnifiedEditorUtils::MsgUnifiedEditorUtils +// @see header file +//--------------------------------------------------------------- +MsgUnifiedEditorUtils::MsgUnifiedEditorUtils(QObject *parent) : +QObject(parent) +{ +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorUtils::~MsgUnifiedEditorUtils +// @see header file +//--------------------------------------------------------------- +MsgUnifiedEditorUtils::~MsgUnifiedEditorUtils() +{ +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorUtils::addAttachmentWidget +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorUtils::launchContentViewer(const QString &mimeType, const QString &filePath) +{ + if (mimeType.contains(IMAGE_MIMETYPE) || mimeType.contains(AUDIO_MIMETYPE)) { + launchViaSharableFile(filePath); + } + else if (mimeType.contains(VCARD_MIMETYPE, Qt::CaseInsensitive)) { + MsgContactsUtil::launchVCardViewer(filePath); + } +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorUtils::handleOk +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorUtils::handleOk(const QVariant& result) +{ + emit requestOk(result); +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorUtils::handleError +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorUtils::handleError(int errorCode, const QString& errorMessage) +{ + emit requestError(errorCode, errorMessage); +} + +//--------------------------------------------------------------- +// MsgUnifiedEditorUtils::launchViaSharableFile +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorUtils::launchViaSharableFile(const QString &filePath) +{ + XQSharableFile sf; + XQAiwRequest* request = 0; + + if (!sf.open(filePath)) { + return; + } + + // Get handlers + XQApplicationManager appManager; + QList fileHandlers = appManager.list(sf); + if (fileHandlers.count() > 0) { + XQAiwInterfaceDescriptor d = fileHandlers.first(); + request = appManager.create(sf, d); + + if (!request) { + sf.close(); + return; + } + } + else { + sf.close(); + return; + } + + // Result handlers + connect(request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&)), + Qt::UniqueConnection); + connect(request, SIGNAL(requestError(int,const QString&)), this, + SLOT(handleError(int,const QString&)), Qt::UniqueConnection); + + request->setEmbedded(true); + request->setSynchronous(true); + + // Fill args + QList args; + args << qVariantFromValue(sf); + request->setArguments(args); + + // Fill headers + QString key("WindowTitle"); + QVariant value(QString(LOC_TITLE)); + XQRequestInfo info; + info.setInfo(key, value); + request->setInfo(info); + + request->send(); + + // Cleanup + sf.close(); + delete request; +} + +//EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp --- a/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -49,7 +49,7 @@ #include #include #include - +#include // Common phone number validity checker // USER INCLUDES #include "debugtraces.h" @@ -57,11 +57,11 @@ #include "msgunieditoraddress.h" #include "msgunieditorsubject.h" #include "msgunieditorbody.h" -#include "msgmonitor.h" -#include "msgattachmentcontainer.h" +#include "msgunieditormonitor.h" +#include "msgunieditorattachmentcontainer.h" #include "msgsendutil.h" #include "convergedmessageaddress.h" -#include "unieditorgenutils.h" +#include "UniEditorGenUtils.h" #include "unieditorpluginloader.h" #include "unieditorplugininterface.h" #include "msgsettingsview.h" @@ -94,26 +94,23 @@ //options menu. #define LOC_ADD_SUBJECT hbTrId("txt_messaging_opt_add_subject") #define LOC_ADD_CC_BCC hbTrId("txt_messaging_opt_add_cc_bcc") -#define LOC_PRIORITY hbTrId("txt_messaging_setlabel_priority") -#define LOC_SENDING_OPTIONS hbTrId("txt_messaging_opt_sending_options") +#define LOC_PRIORITY hbTrId("txt_messaging_opt_priority") #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_opt_delete_message") //priority sub menu -#define LOC_HIGH hbTrId("txt_messaging_setlabel_priority_val_high") -#define LOC_NORMAL hbTrId("txt_messaging_setlabel_priority_val_normal") -#define LOC_LOW hbTrId("txt_messaging_setlabel_priority_val_low") +#define LOC_HIGH hbTrId("txt_messaging_opt_attach_sub_high") +#define LOC_NORMAL hbTrId("txt_messaging_opt_attach_sub_normal") +#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_EXPAND hbTrId("txt_messaging_title_other_recipients") //saved to draft note #define LOC_SAVED_TO_DRAFTS hbTrId("txt_messaging_dpopinfo_saved_to_drafts") //delete confermation #define LOC_NOTE_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") -#define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete") -#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") -#define LOC_DIALOG_OK hbTrId("txt_common_button_ok") // attachment addition failure note #define LOC_UNABLE_TO_ADD_ATTACHMENTS hbTrId("txt_messaging_dpopinfo_unable_to_attach_l1_of_l2") @@ -122,8 +119,8 @@ const QString POPUP_LIST_FRAME("qtg_fr_popup_list_normal"); //settings confirmation -#define LOC_DIALOG_SMS_SETTINGS_INCOMPLETE hbTrId("txt_messaging_dialog_sms_settings_incomplete") -#define LOC_DIALOG_MMS_SETTINGS_INCOMPLETE hbTrId("txt_messaging_dialog_mms_settings_incomplete") +#define LOC_DIALOG_SMS_SETTINGS_INCOMPLETE hbTrId("txt_messaging_dialog_sms_message_centre_does_not_e") +#define LOC_DIALOG_MMS_SETTINGS_INCOMPLETE hbTrId("txt_messaging_dialog_mms_access_point_not_defined") // LOCAL FUNCTIONS //--------------------------------------------------------------- @@ -148,6 +145,7 @@ MsgBaseView(parent), mSubjectAction(0), mCcBccAction(0), + mSendAction(0), mMainLayout(0), mSubjectField(0), mToField(0), @@ -201,7 +199,8 @@ mMainLayout->setContentsMargins(0,vTopSpacing,0,0); mMainLayout->setSpacing(vItemSpacing); - mMsgMonitor = new MsgMonitor(this); + mMsgMonitor = new MsgUnifiedEditorMonitor(this); + connect(mMsgMonitor, SIGNAL(enableSend(bool)), this, SLOT(enableSendButton(bool))); mToField = new MsgUnifiedEditorAddress( LOC_TO, mContentWidget ); @@ -222,6 +221,7 @@ connect(mBody, SIGNAL(contentChanged()),this,SLOT(onContentChanged())); connect(mBody, SIGNAL(contentChanged()), mMsgMonitor, SLOT(handleContentChange())); + connect(mBody, SIGNAL(enableSendButton(bool)), this, SLOT(enableSendButton(bool))); } @@ -253,7 +253,6 @@ HbAction* lowPriorityAction = prioritySubMenu->addAction(LOC_LOW); lowPriorityAction->setData(ConvergedMessage::Low); - HbAction* sendOptionsAction = mainMenu->addAction(LOC_SENDING_OPTIONS); HbAction* deleteMsgAction = mainMenu->addAction(LOC_DELETE_MESSAGE); connect(mSubjectAction,SIGNAL(triggered()),this, SLOT(addSubject())); @@ -261,7 +260,6 @@ connect(highPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority())); connect(normalPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority())); connect(lowPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority())); - connect(sendOptionsAction,SIGNAL(triggered()),this, SLOT(sendingOptions())); connect(deleteMsgAction,SIGNAL(triggered()),this, SLOT(deleteMessage())); setMenu(mainMenu); @@ -297,7 +295,7 @@ if( msg != NULL ) { //Populate the content inside editor - populateContentIntoEditor(*msg); + populateContentIntoEditor(*msg,true); // true as it is draft message delete msg; } @@ -450,7 +448,7 @@ } void MsgUnifiedEditorView::populateContentIntoEditor( - const ConvergedMessage& messageDetails) + const ConvergedMessage& messageDetails,bool draftMessage) { // skip first-time MMS type switch note for draft mMsgMonitor->setSkipNote(true); @@ -519,7 +517,7 @@ { case EMsgMediaImage: { - mBody->setImage(filePath); + mBody->setImage(filePath,draftMessage); break; } case EMsgMediaAudio: @@ -560,6 +558,7 @@ attachAction->setIcon(HbIcon(ATTACH_ICON)); mTBExtnContentWidget = new HbListWidget(); + mTBExtnContentWidget->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed); mTBExtnContentWidget->addItem(LOC_PHOTO); mTBExtnContentWidget->addItem(LOC_SOUND); mTBExtnContentWidget->addItem(LOC_BUSINESS_CARD); @@ -576,8 +575,8 @@ attachExtension->setContentWidget(mTBExtnContentWidget); //Add Action to the toolbar and show toolbar - toolBar->addAction(HbIcon(SEND_ICON),QString(),this,SLOT(send())); - + mSendAction = toolBar->addAction(HbIcon(SEND_ICON),QString(),this,SLOT(send())); + mSendAction->setDisabled(true); setToolBar(toolBar); } @@ -657,7 +656,7 @@ groupBox->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Preferred); groupBox->setContentWidget(groupWidget); - groupBox->setHeading(LOC_OTHER_RECIPIENTS(-1)); + groupBox->setHeading(LOC_OTHER_RECIPIENTS_EXPAND); mMainLayout->insertItem(1,groupBox); connect(groupBox, SIGNAL(toggled(bool)), this, SLOT(updateOtherRecipientCount(bool))); @@ -690,13 +689,16 @@ { if(!state) { - groupBox->setHeading(LOC_OTHER_RECIPIENTS(-1)); + groupBox->setHeading(LOC_OTHER_RECIPIENTS_EXPAND); } else { int addrCount = mCcField->addressCount(); addrCount += mBccField->addressCount(); - groupBox->setHeading(LOC_OTHER_RECIPIENTS(addrCount)); + if(addrCount > 0) + { + groupBox->setHeading(LOC_OTHER_RECIPIENTS(addrCount)); + } } } } @@ -716,14 +718,11 @@ mSubjectField->setPriority(priority); } -void MsgUnifiedEditorView::sendingOptions() -{ -} - void MsgUnifiedEditorView::deleteMessage() { - HbMessageBox::question(LOC_NOTE_DELETE_MESSAGE,this,SLOT(onDialogDeleteMsg(HbAction*)), - LOC_BUTTON_DELETE, LOC_BUTTON_CANCEL); + HbMessageBox::question(LOC_NOTE_DELETE_MESSAGE,this, + SLOT(onDialogDeleteMsg(HbAction*)), + HbMessageBox::Delete | HbMessageBox::Cancel); } void MsgUnifiedEditorView::removeAttachmentContainer() @@ -756,6 +755,12 @@ int MsgUnifiedEditorView::addAttachment(const QString& filepath) { + // do nothing if filepath is empty + if(filepath.isEmpty()) + { + return MsgAttachmentContainer::EAddSuccess; + } + if(!mAttachmentContainer) { mAttachmentContainer = new MsgAttachmentContainer( mContentWidget); @@ -797,7 +802,7 @@ // converged msg for sending ConvergedMessage msg; - ConvergedMessage::MessageType messageType = MsgMonitor::messageType(); + ConvergedMessage::MessageType messageType = MsgUnifiedEditorMonitor::messageType(); msg.setMessageType(messageType); // we need to remove duplicate addresses @@ -914,16 +919,14 @@ if (messageType == ConvergedMessage::Sms) { HbMessageBox::question(LOC_DIALOG_SMS_SETTINGS_INCOMPLETE, - this,SLOT(onDialogSmsSettings(HbAction*)), - LOC_DIALOG_OK, - LOC_BUTTON_CANCEL); + this,SLOT(onDialogSmsSettings(HbAction*)), + HbMessageBox::Ok | HbMessageBox::Cancel); } else { HbMessageBox::question(LOC_DIALOG_MMS_SETTINGS_INCOMPLETE, - this,SLOT(onDialogMmsSettings(HbAction*)), - LOC_DIALOG_OK, - LOC_BUTTON_CANCEL); + this,SLOT(onDialogMmsSettings(HbAction*)), + HbMessageBox::Ok | HbMessageBox::Cancel); } } } @@ -931,7 +934,7 @@ void MsgUnifiedEditorView::packMessage(ConvergedMessage &msg, bool isSave) { - ConvergedMessage::MessageType messageType = MsgMonitor::messageType(); + ConvergedMessage::MessageType messageType = MsgUnifiedEditorMonitor::messageType(); msg.setMessageType(messageType); // If isSave is true (save to draft usecase), then don't remove duplicates // If isSave is false (send usecase), then remove duplicates @@ -940,7 +943,13 @@ mToField->addresses(removeDuplicates); ConvergedMessageAddressList ccAddresses; ConvergedMessageAddressList bccAddresses; - + + //Don't format the addresses for save to drfats case + if(!isSave) + { + formatAddresses(addresses); + } + msg.addToRecipients(addresses); msg.setBodyText(mBody->text()); msg.setDirection(ConvergedMessage::Outgoing); @@ -999,10 +1008,20 @@ if(ccAddresses.count()>0) { + //Don't format the addresses for save to drfats case + if(!isSave) + { + formatAddresses(ccAddresses); + } msg.addCcRecipients(ccAddresses); } if(bccAddresses.count()>0) { + //Don't format the addresses for save to drfats case + if(!isSave) + { + formatAddresses(bccAddresses); + } msg.addBccRecipients(bccAddresses); } if(mSubjectField) @@ -1053,14 +1072,15 @@ } } -void MsgUnifiedEditorView::saveContentToDrafts() +int MsgUnifiedEditorView::saveContentToDrafts() { if(!mCanSaveToDrafts) { - return; + return mOpenedMessageId.getId(); // return currently opened message id } + activateInputBlocker(); - ConvergedMessage::MessageType messageType = MsgMonitor::messageType(); + ConvergedMessage::MessageType messageType = MsgUnifiedEditorMonitor::messageType(); ConvergedMessageAddressList addresses = mToField->addresses(); @@ -1079,8 +1099,8 @@ if(messageType == ConvergedMessage::Sms && addresses.isEmpty() && - MsgMonitor::bodySize() <= 0 && - MsgMonitor::containerSize() <= 0) + MsgUnifiedEditorMonitor::bodySize() <= 0 && + MsgUnifiedEditorMonitor::containerSize() <= 0) { if(mOpenedMessageId.getId() != -1) { @@ -1089,7 +1109,7 @@ // if empty msg, do not save deactivateInputBlocker(); - return; + return INVALID_MSGID; } ConvergedMessageAddressList ccAddresses; @@ -1113,8 +1133,8 @@ ccAddresses.isEmpty() && bccAddresses.isEmpty() && subectSize <= 0 && - MsgMonitor::bodySize() <= 0 && - MsgMonitor::containerSize() <= 0) + MsgUnifiedEditorMonitor::bodySize() <= 0 && + MsgUnifiedEditorMonitor::containerSize() <= 0) { if(mOpenedMessageId.getId() != -1) { @@ -1122,7 +1142,7 @@ } // if empty msg, do not send deactivateInputBlocker(); - return; + return INVALID_MSGID; } ConvergedMessage msg; packMessage(msg, true); @@ -1148,6 +1168,7 @@ { HbNotificationDialog::launchDialog(LOC_SAVED_TO_DRAFTS); } + return msgId; } void MsgUnifiedEditorView::resizeEvent( QGraphicsSceneResizeEvent * event ) @@ -1356,11 +1377,12 @@ //--------------------------------------------------------------- void MsgUnifiedEditorView::fetchImages() { - QString interface("Image"); - QString operation("fetch(QVariantMap,QVariant)"); + QString service("photos"); + QString interface("com.nokia.symbian.IImageFetch"); + QString operation("fetch()"); XQAiwRequest* request = NULL; XQApplicationManager appManager; - request = appManager.create(interface, operation, true);//embedded + request = appManager.create(service,interface, operation, true);//embedded request->setSynchronous(true); // synchronous if(!request) { @@ -1373,11 +1395,6 @@ connect(request, SIGNAL(requestError(int,const QString&)), this, SLOT(serviceRequestError(int,const QString&))); - // Set arguments for request - QList args; - args << QVariantMap(); - args << QVariant(); - request->setArguments(args); // Make the request if (!request->send()) { @@ -1392,30 +1409,11 @@ //--------------------------------------------------------------- void MsgUnifiedEditorView::fetchAudio() { - QString service("musicplayer"); - QString interface("com.nokia.symbian.IMusicFetch"); - QString operation("fetch()"); - XQAiwRequest* request = NULL; - XQApplicationManager appManager; - request = appManager.create(service, interface, operation, true); //embedded - request->setSynchronous(true); // synchronous - if(!request) - { - QCRITICAL_WRITE("AIW-ERROR: NULL request"); - return; - } - - connect(request, SIGNAL(requestOk(const QVariant&)), - this, SLOT(audiosFetched(const QVariant&))); - connect(request, SIGNAL(requestError(int,const QString&)), - this, SLOT(serviceRequestError(int,const QString&))); - - // Make the request - if (!request->send()) - { - QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed :",request->lastError()); - } - delete request; + // Launch Audio fetcher view + QVariantList params; + params << MsgBaseView::AUDIOFETCHER; // target view + params << MsgBaseView::UNIEDITOR; // source view + emit switchView(params); } //--------------------------------------------------------------- @@ -1450,24 +1448,6 @@ } //--------------------------------------------------------------- -// MsgUnifiedEditorView::audiosFetched -// @see header file -//--------------------------------------------------------------- -void MsgUnifiedEditorView::audiosFetched(const QVariant& result ) -{ - if(result.canConvert()) - { - QStringList fileList = result.value(); - if ( fileList.size()>0 && !fileList.at(0).isEmpty()) - { - QString filepath(QDir::toNativeSeparators(fileList.at(0))); - QDEBUG_WRITE_FORMAT("Received audio file path = ", fileList.at(0)); - mBody->setAudio(filepath); - } - } -} - -//--------------------------------------------------------------- // MsgUnifiedEditorView::serviceRequestError // @see header file //--------------------------------------------------------------- @@ -1482,8 +1462,7 @@ //-------------------------------------------------------------- void MsgUnifiedEditorView::activateInputBlocker() { - this->grabMouse(); - this->grabKeyboard(); + mainWindow()->setInteractive(false); } //--------------------------------------------------------------- @@ -1491,9 +1470,8 @@ // @see header file //-------------------------------------------------------------- void MsgUnifiedEditorView::deactivateInputBlocker() -{ - this->ungrabKeyboard(); - this->ungrabMouse(); +{ + mainWindow()->setInteractive(true); } //--------------------------------------------------------------- @@ -1637,7 +1615,7 @@ } UniEditorPluginInterface* pluginInterface = mPluginLoader->getUniEditorPlugin( - MsgMonitor::messageType()); + MsgUnifiedEditorMonitor::messageType()); pluginInterface->deleteDraftsEntry(mOpenedMessageId.getId()); } @@ -1684,4 +1662,47 @@ } } +//--------------------------------------------------------------- +// MsgUnifiedEditorView::enableSendButton +// @see header file +//-------------------------------------------------------------- +void MsgUnifiedEditorView::enableSendButton(bool enable) + { + if(mSendAction) + { + // enable/disable based on only if its disabled/enabled. + // this check is to avoid unnecessary calls to mSendAction->setEnabled(enable); + if(mSendAction->isEnabled() != enable ) + mSendAction->setEnabled(enable); + } + } + +// ---------------------------------------------------------------------------- +// MsgUnifiedEditorView::formatAddresses +// @see header +// ---------------------------------------------------------------------------- +void MsgUnifiedEditorView::formatAddresses( + ConvergedMessageAddressList& addresses) +{ + + for(int i=0; i < addresses.count() ;i++ ) + { + QString addr = addresses[i]->address(); + + HBufC *tempAddr = XQConversions::qStringToS60Desc(addr); + + TPtr ptr = tempAddr->Des(); + + // Note: This is just to parse spaces etc away from phonenumbers. + // Ignore EFalse returned for email addresses. + CommonPhoneParser::ParsePhoneNumber(ptr , + CommonPhoneParser::ESMSNumber ); + + addr = XQConversions::s60DescToQString(tempAddr->Des()); + + addresses[i]->setAddress(addr); + + delete tempAddr; + } +} //EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/src/msgunifiededitorlineedit.cpp --- a/messagingapp/msgui/unifiededitor/src/msgunifiededitorlineedit.cpp Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,596 +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 -#include "msgunifiededitorlineedit.h" - -const QRegExp expr("[,;\n]$"); -const QRegExp sepAtEnd("; $"); -const QRegExp sepAtMiddle("; "); - -const QString replacementStr("; "); -const QString labelSeperator(": "); - -const int fadedAlpha(125); -const int solidAlpha(255); - -const int SNAP_DELAY = 350; - -MsgUnifiedEditorLineEdit::MsgUnifiedEditorLineEdit(const QString& label,QGraphicsItem *parent): -HbLineEdit(parent), -mSelectionStart(-1), -mSelectionEnd(-1), -mDefaultBehaviour(false) -{ - QString labelStr = label.trimmed(); - - QTextCursor cursor(this->textCursor()); - QTextCharFormat colorFormat(cursor.charFormat()); - - QColor fgColor = this->palette().color(QPalette::Text); - fgColor.setAlpha(fadedAlpha); - colorFormat.setForeground(fgColor); - cursor.insertText(labelStr , colorFormat); - - fgColor.setAlpha(solidAlpha); - colorFormat.setForeground(fgColor); - - cursor.insertText(" ",colorFormat); - - mLabelExpr.setPattern(QString("^"+labelStr+" $")); - mLabel = labelStr+" "; - - connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), - this,SLOT(selectionChanged(QTextCursor,QTextCursor))); - connect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged())); -} - -MsgUnifiedEditorLineEdit::~MsgUnifiedEditorLineEdit() -{ -} - -void MsgUnifiedEditorLineEdit::inputMethodEvent(QInputMethodEvent *event) -{ - //let it go in default way. - if(mDefaultBehaviour) - { - HbAbstractEdit::inputMethodEvent(event); - event->accept(); - return; - } - - if (!event->commitString().isEmpty() || event->replacementLength()) - { - if (event->commitString().contains(expr)) - { - if(this->text().isEmpty() || this->text().contains(sepAtEnd) || this->text().contains(mLabelExpr)) - { - event->accept(); - return; - } - - this->setCursorPosition(this->text().length()); - - QString str = event->commitString(); - str.replace(expr, replacementStr); - - event->setCommitString(str, event->replacementStart(), event->replacementLength()); - } - else if(this->hasSelectedText()) - {// all user inputs get appended at the end - this->setCursorPosition(this->text().length()); - } - - HbAbstractEdit::inputMethodEvent(event); - event->accept(); - } -} - -void MsgUnifiedEditorLineEdit::keyPressEvent(QKeyEvent *event) -{ - QString str = event->text(); - - if(event->key()== Qt::Key_Enter || event->key()== Qt::Key_Return) - { - if(mDefaultBehaviour) - { - HbAbstractEdit::keyReleaseEvent(event); - event->accept(); - return; - } - if(this->text().isEmpty() || this->text().contains(sepAtEnd) || this->text().contains(mLabelExpr)) - { - event->accept(); - return; - } - this->setCursorPosition(this->text().length()); - str = replacementStr; - QKeyEvent eve(event->type(), Qt::Key_Any, event->modifiers(), str); - HbAbstractEdit::keyPressEvent(&eve); - event->accept(); - return; - } - - if(event->key() == Qt::Key_Backspace || event->key() == Qt::Key_Delete ) - { - int pos = this->cursorPosition(); - bool pbkContact = true; - - if(!this->hasSelectedText()) - { - this->setCursorPosition(pos-2); - pbkContact = this->textCursor().charFormat().fontUnderline(); - this->setCursorPosition(pos); - } - - QString text = this->text(); - text = text.left(pos); - - if(text.contains(mLabelExpr)) - { - event->accept(); - return; - } - - if(pbkContact) - { - //if already selected delete it. - if(this->hasSelectedText()) - { - // deleting phbkContact is an atomic operation - // ensure that the signal is emitted only once - disconnect(this, SIGNAL(contentsChanged()), - this, SLOT(onContentsChanged())); - HbLineEdit::keyPressEvent(event); - event->accept(); - //delete seperator (i.e."; "). - QKeyEvent eve(event->type(), Qt::Key_Delete, Qt::NoModifier); - HbLineEdit::keyPressEvent(&eve); - HbLineEdit::keyPressEvent(&eve); - connect(this, SIGNAL(contentsChanged()), - this, SLOT(onContentsChanged())); - onContentsChanged(); - } - else //make it selected - { - this->setCursorPosition(pos-3); - setHighlight(pos-3); - } - } - else - { - QString str = text.right(2); - if(str == replacementStr) - { - // deleting contact is an atomic operation - // ensure that the signal is emitted only once - disconnect(this, SIGNAL(contentsChanged()), - this, SLOT(onContentsChanged())); - //delete seperator (i.e."; "). - QKeyEvent eve(event->type(), Qt::Key_Backspace, Qt::NoModifier); - HbLineEdit::keyPressEvent(&eve); - HbLineEdit::keyPressEvent(&eve); - connect(this, SIGNAL(contentsChanged()), - this, SLOT(onContentsChanged())); - onContentsChanged(); - } - else - { - HbLineEdit::keyPressEvent(event); - } - event->accept(); - } - - event->accept(); - return; - } - - if (event->key() == Qt::Key_Left ) - { - bool selectedText = this->hasSelectedText(); - - //look ahead left. - int pos = this->cursorPosition(); - - QString text = this->text(); - text = text.left(pos); - - //no text other than label; - if(text.contains(mLabelExpr)) - { - event->accept(); - return; - } - - //look for next seperator while going left. - int newPos = text.lastIndexOf(sepAtMiddle); - - if(newPos < 0 && selectedText) - { - event->accept(); - return; - } - - bool pbkContact = true; - - if(!selectedText) - { - this->setCursorPosition(pos-2); - pbkContact = this->textCursor().charFormat().fontUnderline(); - this->setCursorPosition(pos); - } - else - { - this->setCursorPosition(newPos); - pbkContact = this->textCursor().charFormat().fontUnderline(); - this->setCursorPosition(pos); - } - - - if(pbkContact && newPos >0) - { - - setHighlight(newPos-1); - } - else - { - //move left, char by char. if seperator met jump over it. - if( (newPos > 0 && selectedText) || (pos-2 == newPos)) - { - this->setCursorPosition(newPos+1); - } - - HbLineEdit::keyPressEvent(event); - - } - event->accept(); - return; - } - - if (event->key() == Qt::Key_Right) - { - bool selectedText = this->hasSelectedText(); - - //look ahead. - int pos = this->cursorPosition(); - this->setCursorPosition(pos+3); - bool pbkContact = this->textCursor().charFormat().fontUnderline(); - this->setCursorPosition(pos); - - //look for next seperator. - QString text = this->text(); - int newPos = text.indexOf(sepAtMiddle,pos+2); - - if(pbkContact && newPos >0) - { - this->setCursorPosition(newPos-1); - setHighlight(newPos-1); - } - else - { - int seperatorPos = text.indexOf(sepAtMiddle,pos); - - if(selectedText || seperatorPos == pos) - { - this->setCursorPosition(pos+1); - this->deselect(); - } - HbAbstractEdit::keyPressEvent(event); - } - event->accept(); - return; - } - - if(!str.isEmpty()) - { - if(mDefaultBehaviour) - { - HbAbstractEdit::keyPressEvent(event); - event->accept(); - return; - } - if (str.contains(expr)) - { - if(this->text().isEmpty() || this->text().contains(sepAtEnd) || this->text().contains(mLabelExpr)) - { - event->accept(); - return; - } - - // auto-complete the last incomplete word - int contentLength = this->text().length(); - int pos = this->cursorPosition(); - QString incompleteWord(this->text().right(contentLength-(pos-1))); - if(!incompleteWord.contains(sepAtMiddle)) - { - this->setCursorPosition(this->text().length()); - } - - str.replace(expr, replacementStr); - QKeyEvent eve(event->type(), event->key(), event->modifiers(), str); - HbAbstractEdit::keyPressEvent(&eve); - } - else - { - HbAbstractEdit::keyPressEvent(event); - event->accept(); - return; - } - } -} - -void MsgUnifiedEditorLineEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) -{ - HbAbstractEdit::mouseReleaseEvent(event); - - int currentPos = this->cursorPosition(); - - QString txt = this->text(); - - QString tempTxt = txt.left(currentPos+2); - int seperatorPos = tempTxt.lastIndexOf(sepAtMiddle,currentPos); - - txt = txt.right(txt.length() - currentPos); - int labelPos = txt.indexOf(labelSeperator); - - if(labelPos >= 0 )//pressed on label. - { - this->setCursorPosition(currentPos + labelPos + 2); - } - else if(seperatorPos == currentPos-1 || seperatorPos == currentPos)//pressed just on seperator. - { - this->setCursorPosition(seperatorPos+2); - } - else - { - this->setCursorPosition(currentPos+1); - bool pbkContact = this->textCursor().charFormat().fontUnderline(); - if(pbkContact) - { - setHighlight(currentPos); - } - } - - this->update(); - event->accept(); -} - -void MsgUnifiedEditorLineEdit::setText(const QString& text, bool underlined) -{ - - if(!mDefaultBehaviour) - { - // atomic operation, ensure one signal only at the end - disconnect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged())); - - //make sure previous text is complete. - if(this->content().length() > 0) - { - QInputMethodEvent e; - e.setCommitString(";"); - this->inputMethodEvent(&e); - } - this->setCursorPosition(this->text().length()); - - QTextCursor cursor(this->textCursor()); - QTextCharFormat colorFormat(cursor.charFormat()); - if(underlined) - { - QColor fgColor = colorFormat.foreground().color(); - fgColor.setAlpha(fadedAlpha); - colorFormat.setUnderlineColor(fgColor); - colorFormat.setFontUnderline(true); - } - cursor.insertText(text , colorFormat); - colorFormat.setFontUnderline(false); - - cursor.insertText(replacementStr,colorFormat); - connect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged())); - onContentsChanged(); - } - else - { - this->setCursorPosition(this->text().length()); - QTextCursor cursor(this->textCursor()); - cursor.insertText(text); - } -} - -QStringList MsgUnifiedEditorLineEdit::addresses() -{ - QString text = this->content(); - QStringList list = text.split(replacementStr,QString::SkipEmptyParts); - return list; -} - -void MsgUnifiedEditorLineEdit::focusInEvent(QFocusEvent* event) -{ - HbLineEdit::focusInEvent(event); - this->setCursorVisibility(Hb::TextCursorVisible); -} - -void MsgUnifiedEditorLineEdit::focusOutEvent(QFocusEvent* event) -{ - HbLineEdit::focusOutEvent(event); - this->setCursorVisibility(Hb::TextCursorHidden); -} - -void MsgUnifiedEditorLineEdit::setHighlight(int currentPos) -{ - QString txt = this->text(); - - int endPos = qMax(txt.indexOf(sepAtMiddle,currentPos), - txt.indexOf(labelSeperator,currentPos)); - - int startPos = qMax(txt.lastIndexOf(sepAtMiddle,currentPos), - txt.lastIndexOf(labelSeperator,currentPos)); - - disconnect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), - this,SLOT(selectionChanged(QTextCursor,QTextCursor))); - - //highlight if pbk contact. - if(startPos > 0 && endPos > 0 && startPos != endPos) - { - this->setSelection(startPos + 2, endPos - startPos - 2); - this->update(); - } - else - { - this->deselect(); - } - - this->update(); - - connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), - this,SLOT(selectionChanged(QTextCursor,QTextCursor))); -} - -void MsgUnifiedEditorLineEdit::cut() -{ - HbLineEdit::cut(); - //after cut delete seperator (i.e."; "). - QKeyEvent eve(QEvent::KeyPress, Qt::Key_Delete, Qt::NoModifier); - HbLineEdit::keyPressEvent(&eve); - HbLineEdit::keyPressEvent(&eve); -} - -void MsgUnifiedEditorLineEdit::selectAll() -{ - //don't allow user to select every thing. - //do nothing. -} - -void MsgUnifiedEditorLineEdit::selectionChanged(const QTextCursor &oldCursor, const QTextCursor& newCursor) -{ - - if(mSelectionSnapTimer.isActive()) - { - mSelectionSnapTimer.stop(); - } - - if(newCursor.selectionStart() < mLabel.length()) - { - this->setTextCursor(oldCursor); - return; - } - - if(!mDefaultBehaviour) - { - mSelectionStart = newCursor.selectionStart(); - mSelectionEnd = newCursor.selectionEnd(); - - if(mSelectionStart == mSelectionEnd ) - { - return; - } - - mSelectionSnapTimer.start(SNAP_DELAY,this); - } -} - -void MsgUnifiedEditorLineEdit::timerEvent(QTimerEvent *event) -{ - //passing event to base class. - HbLineEdit::timerEvent(event); - - if (event->timerId() == mSelectionSnapTimer.timerId()) - { - mSelectionSnapTimer.stop(); - - disconnect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), - this,SLOT(selectionChanged(QTextCursor,QTextCursor))); - - QString txt = this->text(); - - int startPos = qMax(txt.lastIndexOf(sepAtMiddle,mSelectionStart), - txt.lastIndexOf(labelSeperator,mSelectionStart)); - - int endPos = qMax(txt.indexOf(sepAtMiddle,mSelectionEnd), - txt.indexOf(labelSeperator,mSelectionEnd)); - - if(endPos < 0 ) - { - endPos = mSelectionEnd; - } - - this->setSelection(startPos + 2, endPos - startPos - 2); - - connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), - this,SLOT(selectionChanged(QTextCursor,QTextCursor))); - - event->accept(); - } -} - -void MsgUnifiedEditorLineEdit::setDefaultBehaviour(bool defaultBehaviour) -{ - mDefaultBehaviour = defaultBehaviour; -} - -QString MsgUnifiedEditorLineEdit::text() const -{ - return HbLineEdit::text(); -} - -QString MsgUnifiedEditorLineEdit::content() const -{ - QString text = this->text(); - text.remove(mLabel); - return text; -} - -void MsgUnifiedEditorLineEdit::clearContent() -{ - // avoid getting updates during local editing - disconnect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged())); - - int startPos = mLabel.length(); - this->setSelection(startPos, content().length()); - QKeyEvent eve(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier); - this->keyPressEvent(&eve); - this->deselect(); - - // re-connect signal to start getting updates - connect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged())); -} - -void MsgUnifiedEditorLineEdit::onContentsChanged() -{ - emit contentsChanged(content()); -} - -void MsgUnifiedEditorLineEdit::highlightInvalidString(QString invalidStr) -{ - // for only address editor - if(!mDefaultBehaviour) - { - QString txtContent = this->text(); - int searchStartPos = mLabel.length(); - int startPos = txtContent.indexOf(invalidStr, searchStartPos); - disconnect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), - this,SLOT(selectionChanged(QTextCursor,QTextCursor))); - // if invalidStr found - if(startPos > 0) - { - this->setSelection(startPos, invalidStr.length()); - } - connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)), - this,SLOT(selectionChanged(QTextCursor,QTextCursor))); - } -} - -// eof diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/unifiededitor.pro --- a/messagingapp/msgui/unifiededitor/unifiededitor.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/unifiededitor.pro Thu Jul 22 16:32:06 2010 +0100 @@ -26,12 +26,12 @@ INCLUDEPATH += ../msguiutils/inc INCLUDEPATH += ../../msgutils/unieditorutils/editorgenutils/inc INCLUDEPATH += ../../msgutils/unidatautils/unidatamodelloader/inc -INCLUDEPATH += ../../msgutils/s60qconversions/inc INCLUDEPATH += ../../msgsettings/settingsview/inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE CONFIG += hb +HB += hbfeedback TARGET.EPOCALLOWDLLDATA = 1 TARGET.CAPABILITY = All -TCB @@ -44,38 +44,52 @@ BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " \ "rom/unifiededitor.iby CORE_APP_LAYER_IBY_EXPORT_PATH(unifiededitor.iby)" +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/unifiededitor.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/unifiededitor.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + # Input -HEADERS += msgmonitor.h \ +HEADERS += msgunieditormonitor.h \ msgunieditoraddress.h \ msgunieditorattachment.h \ msgunieditorbody.h \ msgunieditorsubject.h \ msgunieditorview.h \ - msgunifiededitorlineedit.h \ - msgattachmentcontainer.h \ + msgunieditorlineedit.h \ + msgunieditorattachmentcontainer.h \ msgbaseview.h \ msgunieditorimageprocessor.h \ msgunieditorprocessimageoperation.h \ - msgunifiededitorbasewidget.h + msgunieditorbasewidget.h \ + msgunieditorpixmapwidget.h \ + msgunieditorutils.h \ + msgunieditoraudiowidget.h -SOURCES += msgmonitor.inl \ - msgmonitor.cpp \ +SOURCES += msgunieditormonitor.inl \ + msgunieditormonitor.cpp \ msgunieditoraddress.cpp \ msgunieditorattachment.cpp \ msgunieditorbody.cpp \ msgunieditorsubject.cpp \ msgunieditorview.cpp \ - msgunifiededitorlineedit.cpp \ - msgattachmentcontainer.cpp \ + msgunieditorlineedit.cpp \ + msgunieditorattachmentcontainer.cpp \ msgunieditorimageprocessor.inl \ msgunieditorimageprocessor.cpp \ - msgunieditorprocessimageoperation.cpp + msgunieditorprocessimageoperation.cpp \ + msgunieditorpixmapwidget.cpp \ + msgunieditorutils.cpp \ + msgunieditoraudiowidget.cpp RESOURCES += unifiededitor.qrc # Libs -LIBS += -ls60qconversions \ - -lconvergedmessageutils \ +LIBS += -lconvergedmessageutils \ -lmsguiutils \ -lunieditorpluginloader \ -leditorgenutils \ @@ -94,7 +108,7 @@ -lgsmu \ -lsmcm \ -lxqserviceutil \ - -lcommonengine - + -lcommonengine \ + -lefsrv \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiededitor/unifiededitor.qrc --- a/messagingapp/msgui/unifiededitor/unifiededitor.qrc Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiededitor/unifiededitor.qrc Thu Jul 22 16:32:06 2010 +0100 @@ -11,5 +11,6 @@ resources/layouts/msgunifiededitorbody.widgetml resources/layouts/msgunifiededitorsubject.css resources/layouts/msgunifiededitorsubject.widgetml + resources/layouts/msgunifiededitorattachment_color.css diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/unicontentswidget.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/unifiedviewer.h --- a/messagingapp/msgui/unifiedviewer/inc/unifiedviewer.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/inc/unifiedviewer.h Thu Jul 22 16:32:06 2010 +0100 @@ -46,7 +46,9 @@ /** * Constructor */ - UnifiedViewer(const qint32 messageId, QGraphicsItem *parent = 0); + UnifiedViewer(const qint32 messageId, + int canForwardMessage = 0, + QGraphicsItem *parent = 0); /** * Destructor @@ -73,13 +75,7 @@ * @see HbView */ void createToolBar(); - - /** - * Validates if message can be forwarded - * @return true if message can be forwarded - * false if message cant be forwarded - */ - bool validateMsgForForward(); + public slots: @@ -143,6 +139,11 @@ * Message count */ int mMsgCount; + + /** + * Forward status of message + */ + bool mForwardMessage; }; #endif diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/unihighlighter.h --- a/messagingapp/msgui/unifiedviewer/inc/unihighlighter.h Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Enables parsing and change font parameters for email/url - * - */ - -#ifndef UNI_HIGHLIGHTER_H -#define UNI_HIGHLIGHTER_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE -class QTextDocument; -QT_END_NAMESPACE - -/** - * Enables parsing and change font parameters for email/url - */ -class UniHighlighter : public QSyntaxHighlighter -{ -Q_OBJECT - -public: - /* - * Constructor - */ - UniHighlighter(QTextDocument *parent = 0); - -protected: - /* - * highlightBlock - * @see QSyntaxHighlighter - */ - void highlightBlock(const QString &text); - -private: - - struct HighlightingRule - { - QRegExp pattern; - QTextCharFormat format; - }; - QVector highlightingRules; - - QTextCharFormat emailFormat; - QTextCharFormat urlFormat; -}; - -#endif //UNI_HIGHLIGHTER_H -// EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/uniscrollarea.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univieweraddresscontainer.h --- a/messagingapp/msgui/unifiedviewer/inc/univieweraddresscontainer.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/inc/univieweraddresscontainer.h Thu Jul 22 16:32:06 2010 +0100 @@ -66,6 +66,12 @@ void setCcField(ConvergedMessageAddressList ccRecipients); /** + * Sets Bcc recipients + * @param bccRecipients list of Bcc recipients + */ + void setBccField(ConvergedMessageAddressList bccRecipients); + + /** * Clears the content of the widget */ void clearContent(); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univieweraddresswidget.h --- a/messagingapp/msgui/unifiedviewer/inc/univieweraddresswidget.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/inc/univieweraddresswidget.h Thu Jul 22 16:32:06 2010 +0100 @@ -60,16 +60,10 @@ void clearContent(); protected: - /** - * called when mouse is pressed. + * Gesture event, overridden from base class. */ - void mousePressEvent(QGraphicsSceneMouseEvent *event); - - /** - * called when mouse is released. - */ - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void gestureEvent(QGestureEvent* event); private: /** @@ -106,14 +100,18 @@ */ void menuClosed(); - //handlers for phone number specific menu items. + /** + * handlers for phone number specific menu items. + */ void openContactInfo(); void call(); void saveToContacts(); void sendMessage(); void copyToClipboard(); - //called after service request is completed. + /** + * called after service request is completed. + */ void onServiceRequestCompleted(); /** diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univiewerattachmentcontainer.h --- a/messagingapp/msgui/unifiedviewer/inc/univiewerattachmentcontainer.h Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This holds all the attachments inside convergedmessage -* -*/ - -#ifndef UNIVIEWERATTACHMENTCONTAINER_H -#define UNIVIEWERATTACHMENTCONTAINER_H - -// SYSTEM INCLUDES -#include -#include - -// FORWARD DECLARATIONS -class QGraphicsLinearLayout; -class UniViewerMediaWidget; - -//const int MAX_ATTACHMENT = 10; - -/** - * Container widget for all attachment inside message - */ - -class UniViewerAttachmentContainer: public HbWidget -{ -Q_OBJECT - -public: - - /** - * Constructor - */ - explicit UniViewerAttachmentContainer(QGraphicsItem *parent = 0); - - /** - * Destructor - */ - virtual ~UniViewerAttachmentContainer(); - - /** - * Add one more attachment into the widget - */ - void addAttachmentWidget(QString type, QString fileName); - - /** - * Clears the content of the widget - */ - void clearContent(); - -private: - - /** - * This contains total number of attacmnets added - */ - int mTotalAttachment; - - /** - * Main layout reference. - * Own - */ - QGraphicsLinearLayout *mMainLayout; - - /** - * From widget reference. - * Own - */ - QList mUniViewerMediaWidgetList; - -}; - -#endif // UNIVIEWERATTACHMENTCONTAINER_H -//eof diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univiewerattachmentwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiedviewer/inc/univiewerattachmentwidget.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Widget for displaying attachment media objects. + * + */ + +#ifndef UNI_VIEWER_ATTACHMENT_WIDGET_H +#define UNI_VIEWER_ATTACHMENT_WIDGET_H + +// SYSTEM INCLUDES +#include + +// FORWARD DECLARATIONS +class HbTextItem; +class HbIconItem; +class HbIcon; +class HbFrameItem; +class UniViewerUtils; +class UniMessageInfo; + +/** + * @class UniViewerAttachmentWidget + * @brief Widget for displaying attachment media objects. + */ +class UniViewerAttachmentWidget: public HbWidget +{ +Q_OBJECT + +public: + + /** + * Constructor + */ + explicit UniViewerAttachmentWidget(QGraphicsItem *parent = 0); + + /** + * Destructor + */ + virtual ~UniViewerAttachmentWidget(); + + /** + * Populates the widget contents. + * @param info Object information. + */ + void populate(UniMessageInfo *info); + +signals: + + /** + * Signal emitted when widget is clicked. + * @param mediaPath File path of the media. + */ + void shortTap(const QString &mediaPath); + + /** + * Signal emitted when widget is long tapped. + * @param position Scene coordinates of tap. + */ + void longTap(const QPointF &position); + +protected: + + /** + * Event handler for gesture events. + * Reimplemented from HbWidgetBase. + * @see HbWidgetBase + */ + virtual void gestureEvent(QGestureEvent *event); + +private slots: + + /** + * Handles opening of media. + */ + void handleOpen(); + + /** + * Handles saving of media. + */ + void handleSave(); + + /** + * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture + * events back to back. + */ + void regrabGesture(); + +private: + + /** + * Handles short tap event. + */ + void handleShortTap(); + + /** + * Handles long tap event. + * @param position Scene coordinates of tap. + */ + void handleLongTap(const QPointF &position); + + /** + * Handles pressed state. + */ + void setPressed(bool pressed); + +private: + + /** + * Media icon item. + * Own + */ + HbIconItem *mMediaIcon; + + /** + * Media name text item. + * Own + */ + HbTextItem *mName; + + /** + * Media information text item. + * Own + */ + HbTextItem *mInfo; + + /** + * Background item of widget. + * Own + */ + HbFrameItem *mFrameItem; + + /** + * UniViewerUtils object. + * Own + */ + UniViewerUtils *mViewerUtils; + + /** + * Media file path. + */ + QString mMediaPath; + + /** + * Mime type of media. + */ + QString mMimeType; +}; + +#endif // UNI_VIEWER_ATTACHMENT_WIDGET_H +// EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univieweraudiowidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiedviewer/inc/univieweraudiowidget.h Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: This widget is used to display audio content in univiewer. + * + */ + +#ifndef UNI_VIEWER_AUDIO_WIDGET_H +#define UNI_VIEWER_AUDIO_WIDGET_H + +// FORWARD DECLARATIONS +class UniViewerUtils; +class UniMessageInfo; + +#include + +/** + * @class UniViewerAudioWidget + * @brief This widget is used to display audio content in univiewer. + */ +class UniViewerAudioWidget: public HbPushButton +{ +Q_OBJECT + +public: + + /** + * Constructor + */ + explicit UniViewerAudioWidget(QGraphicsItem *parent = 0); + + /** + * Destructor + */ + ~UniViewerAudioWidget(); + + /** + * Populates the widget contents. + * @param info Object information. + */ + void populate(UniMessageInfo *info); + +signals: + + /** + * Signal emitted when widget is clicked. + * @param mediaPath File path of the media. + */ + void shortTap(const QString &mediaPath); + + /** + * Signal emitted when widget is long tapped. + * @param position Scene coordinates of tap. + */ + void longTap(const QPointF &position); + +private slots: + + /** + * Handles short tap event. + */ + void handleShortTap(); + + /** + * Handles long tap event. + * @param position Scene coordinates of tap. + */ + void handleLongTap(const QPointF &position); + + /** + * Handles opening of media. + */ + void handleOpen(); + + /** + * Handles saving of media. + */ + void handleSave(); + + /** + * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture + * events back to back. + */ + void regrabGesture(); + +private: + + /** + * UniViewerUtils object. + * Own + */ + UniViewerUtils *mViewerUtils; + + /** + * Media file path. + */ + QString mMediaPath; + + /** + * Mime type of media. + */ + QString mMimeType; +}; + +#endif //UNI_VIEWER_AUDIO_WIDGET_H +// EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univiewerbodywidget.h --- a/messagingapp/msgui/unifiedviewer/inc/univiewerbodywidget.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/inc/univiewerbodywidget.h Thu Jul 22 16:32:06 2010 +0100 @@ -24,13 +24,12 @@ class UniViewerTextItem; class UniViewerPixmapWidget; +class UniViewerAudioWidget; class HbTextItem; -class HbPushButton; -//class HbGestureSceneFilter; -class QSignalMapper; /** - * This widget displays the body of the viewer + * @class UniViewerBodyWidget + * @brief This widget displays the body of the viewer. */ class UniViewerBodyWidget: public HbWidget { @@ -55,27 +54,27 @@ /** * Called to insert image content in viewer. - * @param medialist list of absolute paths of media. + * @param info Object information. */ - void setPixmap(QString pixmapFile); + void setPixmap(UniMessageInfo *info); /** * Called to insert audio content in viewer. - * @param medialist list of absolute paths of media. + * @param info Object information. */ - void setAudio(QString audiofile); + void setAudio(UniMessageInfo *info); /** * Called to insert video content in viewer. - * @param medialist list of absolute paths of media. + * @param info Object information. */ - void setVideo(QString videofile); + void setVideo(UniMessageInfo *info); /** * Called to insert text content in viewer. * @param text Body text to be set. */ - void setTextContent(QString text); + void setText(QString text); /** * Sets the slide counter. @@ -127,38 +126,6 @@ */ QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const; -private slots: - - /** - * called on long press on the media objects - */ - void longPressed(QPointF position); - - /** - * called from the media object's item specific menu - */ - void openMedia(); - - /** - * Open a specified media file - */ - void openMedia(const QString& fileName); - - /** - * called from the media object's item specific menu - */ - void saveMedia(); - - /** - * Service launch complete. - */ - void handleOk(const QVariant& result); - - /** - * Service launch errors. - */ - void handleError(int errorCode, const QString& errorMessage); - signals: /** * this signal is emitted when sendMessage is emitted from UniViewerTextItem. @@ -196,17 +163,7 @@ /** * Media widget for embedded audio content. */ - HbPushButton *mAudioItem; - - /** - * To setup longpress gesture on media objects - */ - // HbGestureSceneFilter* gestureFilter; - - /** - * File mapper for opening media - */ - QSignalMapper* mSignalMapper; + UniViewerAudioWidget *mAudioItem; }; #endif //UNIVIEWER_BODY_WIDGET_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univiewerdetailswidget.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univiewerfeeder.h --- a/messagingapp/msgui/unifiedviewer/inc/univiewerfeeder.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/inc/univiewerfeeder.h Thu Jul 22 16:32:06 2010 +0100 @@ -126,15 +126,25 @@ * toAddressList * @return list of to address list */ - ConvergedMessageAddressList toAddressList(); /** * ccAddressList * @return list of cc address list */ + ConvergedMessageAddressList ccAddressList(); - ConvergedMessageAddressList ccAddressList(); + /** + * bccAddressList + * @return list of Bcc address list + */ + ConvergedMessageAddressList bccAddressList(); + + /** + * recipientCount + * @return Total recipient count + */ + int recipientCount(); /** * messageSize diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univiewerfeeder_p.h --- a/messagingapp/msgui/unifiedviewer/inc/univiewerfeeder_p.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/inc/univiewerfeeder_p.h Thu Jul 22 16:32:06 2010 +0100 @@ -131,11 +131,23 @@ * @return list of cc address list */ ConvergedMessageAddressList ccAddressList(); + + /** + * bccAddressList + * @return list of Bcc address list + */ + ConvergedMessageAddressList bccAddressList(); + + /** + * Finds total recipient count + * @return total recipient count + */ + int recipientCount(); + /** * messageSize * @return int */ - int messageSize(); /** @@ -232,8 +244,13 @@ * owned. */ ConvergedMessageAddressList mCcAddressList; - - + + /** + * CC address list + * owned. + */ + ConvergedMessageAddressList mBccAddressList; + /** * Msv Session. * not Owned. diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univiewerheadercontainer.h --- a/messagingapp/msgui/unifiedviewer/inc/univiewerheadercontainer.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/inc/univiewerheadercontainer.h Thu Jul 22 16:32:06 2010 +0100 @@ -27,8 +27,8 @@ class HbGroupBox; class HbFrameItem; class UniViewerAddressContainer; -class UniViewerAttachmentContainer; class UniViewerFeeder; +class UniViewerAttachmentWidget; class UniViewerHeaderContainer: public HbWidget { @@ -136,10 +136,9 @@ UniViewerAddressContainer *mAddressContainer; /** - * UniViewerAttachmentContainer object - * owned. + * List of attachment widgets. */ - UniViewerAttachmentContainer *mAttachmentContainer; + QList mUniViewerAttachmentstList; }; #endif /* UNIVIEWER_HEADER_CONTAINER_H */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univiewermediawidget.h --- a/messagingapp/msgui/unifiedviewer/inc/univiewermediawidget.h Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef UNIVIEWERMEDIAWIDGET_H -#define UNIVIEWERMEDIAWIDGET_H - -// SYSTEM INCLUDES -#include - -// FORWARD DECLARATIONS -class HbTextItem; -class HbIconItem; -class HbIcon; -class HbPushButton; - -/** - * Widget for displaying inline media objects. - */ -class UniViewerMediaWidget : public HbWidget -{ - Q_OBJECT - -public: - - /** - * Constructor - */ - explicit UniViewerMediaWidget(QGraphicsItem *parent = 0); - - /** - * Destructor - */ - virtual ~UniViewerMediaWidget(); - - /** - * Initialize method - */ - void init(); - - /** - * Populates the widget contents. - * @param icon Media icon name. - * @param name Media file name. - * @param info Media information. - * @param bgFrame Background frame. - */ - void populate(const QString &icon, const QString &name, - const QString &info, const QString &bgFrame); - - /** - * Clears the contents of the widget. - */ - void clearContent(); - -signals: - - /** - * Signal emitted when widget is clicked. - */ - void clicked(); - -private: - - /** - * Media icon item. - * Own - */ - HbIconItem *mMediaIcon; - - /** - * Media name text item. - * Own - */ - HbTextItem *mName; - - /** - * Media information text item. - * Own - */ - HbTextItem *mInfo; - - /** - * Background item of widget. - * Own - */ - HbPushButton *mFrameItem; -}; - -#endif // UNIVIEWERMEDIAWIDGET_H -// EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univiewerpixmapwidget.h --- a/messagingapp/msgui/unifiedviewer/inc/univiewerpixmapwidget.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/inc/univiewerpixmapwidget.h Thu Jul 22 16:32:06 2010 +0100 @@ -20,6 +20,12 @@ #include +// FORWARD DECLARATIONS +class UniViewerUtils; +class UniMessageInfo; +class ThumbnailManager; + + /** * This widget displays the pixmap content in viewer. */ @@ -41,17 +47,23 @@ /** * Sets the pixmap content to be displayed. - * @param pixmapPath File path of the pixmap. + * @param info Object information. */ - void setPixmap(const QString &pixmapPath); + void populate(UniMessageInfo *info); signals: /** - * Signal emitted for short tap on pixmap. - * @param pixmapPath File path of the pixmap being clicked. + * Signal emitted when widget is clicked. + * @param mediaPath File path of the media. */ - void shortTap(const QString &pixmapPath); + void shortTap(const QString &mediaPath); + + /** + * Signal emitted when widget is long tapped. + * @param position Scene coordinates of tap. + */ + void longTap(const QPointF &position); protected: @@ -62,12 +74,70 @@ */ virtual void gestureEvent(QGestureEvent *event); +private slots: + + /** + * + */ + void handleOpen(); + + /** + * + */ + void handleSave(); + + /** + * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture + * events back to back. + */ + void regrabGesture(); + + /** + * Slot hit when the thumbnail is ready. + */ + void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error); + private: /** + * Initialization function. + */ + void init(); + + /** + * Handles short tap event. + */ + void handleShortTap(); + + /** + * Handles long tap event. + * @param position Scene coordinates of tap. + */ + void handleLongTap(const QPointF &position); + +private: + + /** + * UniViewerUtils object. + * Own + */ + UniViewerUtils *mViewerUtils; + + /** + * ThumbnailManager + * Own. + */ + ThumbnailManager *mThumbnailManager; + + /** + * Mime Type of pixmap. + */ + QString mMimeType; + + /** * Pixmap file path being set. */ - QString mPixmapFile; + QString mPixmapPath; }; #endif /* UNI_VIEWER_PIXMAP_WIDGET_H */ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univiewertextitem.h --- a/messagingapp/msgui/unifiedviewer/inc/univiewertextitem.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/inc/univiewertextitem.h Thu Jul 22 16:32:06 2010 +0100 @@ -32,8 +32,10 @@ void setText(const QString& text); protected: - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - void mousePressEvent(QGraphicsSceneMouseEvent *event); + /** + * Gesture event, overridden from base class. + */ + void gestureEvent(QGestureEvent* event); private: @@ -54,8 +56,9 @@ /** * short tap handler. * @param anchor anchor at cursor position. + * @param pos tapping position */ - void shortTapAction(QString anchor); + void handleShortTap(QString anchor,const QPointF& pos); /** * Helper method to highlight find item on tap. @@ -75,18 +78,26 @@ void menuClosed(); - //handlers for phone number specific menu items. + /** + * handlers for phone number specific menu items. + */ void call(); void sendMessage(); - //handlers for e-mail specific menu items. + /** + * handlers for e-mail specific menu items. + */ void createEmail(); - //handlers for url specific menu items. + /** + * handlers for url specific menu items. + */ void openLink(); void addToBookmarks(); - //common handlers. + /** + * common handlers. + */ void openContactInfo(); void saveToContacts(); void copyToClipboard(); @@ -105,7 +116,9 @@ */ void handleError(int errorCode, const QString& errorMessage); - //called after service request is completed. + /** + * called after service request is completed. + */ void onServiceRequestCompleted(); signals: diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univiewerutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiedviewer/inc/univiewerutils.h Thu Jul 22 16:32:06 2010 +0100 @@ -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: Utility class for univiewer. + * + */ + +#ifndef UNI_VIEWER_UTILS_H +#define UNI_VIEWER_UTILS_H + +// SYSTEM INCLUDES +#include + +// FORWARD DECLARATIONS + +/** + * @class UniViewerUtils + * @brief Utility class for univiewer. Contains common functionality required + * for widgets. + */ + +class UniViewerUtils: public QObject +{ +Q_OBJECT + +public: + + /** + * Constructor + */ + explicit UniViewerUtils(QObject *parent = 0); + + /** + * Destructor + */ + virtual ~UniViewerUtils(); + + /** + * Utility function to launch different content viewers. + * @param mimeType Mime type of the content. + * @param filePath Absolute file path of content. + */ + void launchContentViewer(const QString &mimeType, const QString &filePath); + +signals: + + /** + * Service launch complete. + */ + void requestOk(const QVariant& result); + + /** + * Service launch errors. + */ + void requestError(int errorCode, const QString& errorMessage); + +private slots: + + /** + * Service launch complete. + */ + void handleOk(const QVariant& result); + + /** + * Service launch errors. + */ + void handleError(int errorCode, const QString& errorMessage); + +private: + + /** + * Launch content viewer using XQSharableFile. + * @param filePath Absolute path of content. + */ + void launchViaSharableFile(const QString &filePath); + +}; + +#endif // UNI_VIEWER_UTILS_H +//eof diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/inc/univiewslidewidget.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/resources/layouts/univiewerattachmentwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerattachmentwidget.css Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,45 @@ + +UniViewerAttachmentWidget +{ + layout: layout-default; +} + +UniViewerAttachmentWidget::mediaIcon +{ + left:-var(hb-param-margin-gene-left); + top:-var(hb-param-margin-gene-top); + bottom:var(hb-param-margin-gene-bottom) ; + aspect-ratio:ignore; + size-policy:fixed fixed; + pref-width:var(hb-param-graphic-size-primary-small); + pref-height:var(hb-param-graphic-size-primary-small); +} + +UniViewerAttachmentWidget::text-1 +{ + left:-var(hb-param-margin-gene-middle-horizontal); + right:var(hb-param-margin-gene-middle-horizontal); + center-vertical:0un; + text-height:var(hb-param-text-height-secondary); + font-variant:secondary; + text-line-count-min:1; + text-line-count-max:1; +} + +UniViewerAttachmentWidget::text-2 +{ + left:-var(hb-param-margin-gene-middle-horizontal); + right:var(hb-param-margin-gene-right); + center-vertical:0un; + size-policy-horizontal:fixed; + font-variant:secondary; + text-height:var(hb-param-text-height-tiny); + text-line-count-min:1; + text-line-count-max:1; +} + +UniViewerAttachmentWidget::bgFrame +{ + zvalue:-1; +} + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/resources/layouts/univiewerattachmentwidget.widgetml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerattachmentwidget.widgetml Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/resources/layouts/univiewerattachmentwidget_color.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerattachmentwidget_color.css Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,20 @@ + +UniViewerAttachmentWidget[state="normal"]::text-1 +{ + color:var(qtc_list_item_title_normal); +} + +UniViewerAttachmentWidget[state="pressed"]::text-1 +{ + color:var(qtc_list_item_pressed); +} + +UniViewerAttachmentWidget[state="normal"]::text-2 +{ + color:var(qtc_list_item_title_normal); +} + +UniViewerAttachmentWidget[state="pressed"]::text-2 +{ + color:var(qtc_list_item_pressed); +} diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/resources/layouts/univiewerbodywidget.css diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/resources/layouts/univiewerbodywidget.widgetml diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/resources/layouts/univiewerdetailswidget.css diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/resources/layouts/univiewerdetailswidget_color.css diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/resources/layouts/univiewermediawidget.css --- a/messagingapp/msgui/unifiedviewer/resources/layouts/univiewermediawidget.css Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ - -UniViewerMediaWidget -{ - layout: layout-default; -} - -UniViewerMediaWidget::mediaIcon -{ - left:-var(hb-param-margin-gene-left); - top:-var(hb-param-margin-gene-top); - bottom:var(hb-param-margin-gene-bottom) ; - aspect-ratio:ignore; - size-policy:fixed fixed; - pref-width:var(hb-param-graphic-size-primary-small); - pref-height:var(hb-param-graphic-size-primary-small); -} - -UniViewerMediaWidget::text-1 -{ - left:-var(hb-param-margin-gene-middle-horizontal); - right:var(hb-param-margin-gene-middle-horizontal); - center-vertical:0un; - text-height:var(hb-param-text-height-secondary); - font-variant:secondary; - text-line-count-min:1; - text-line-count-max:1; -} - -UniViewerMediaWidget::text-2 -{ - left:-var(hb-param-margin-gene-middle-horizontal); - right:var(hb-param-margin-gene-right); - center-vertical:0un; - size-policy-horizontal:fixed; - font-variant:secondary; - text-height:var(hb-param-text-height-tiny); - text-line-count-min:1; - text-line-count-max:1; -} - -UniViewerMediaWidget::bgFrame -{ - zvalue:-1; -} - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/resources/layouts/univiewermediawidget.widgetml --- a/messagingapp/msgui/unifiedviewer/resources/layouts/univiewermediawidget.widgetml Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/resources/layouts/univiewermediawidget_color.css --- a/messagingapp/msgui/unifiedviewer/resources/layouts/univiewermediawidget_color.css Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - -UniViewerMediaWidget::text-1 -{ - color:var(qtc_list_item_title_normal); -} - -UniViewerMediaWidget::text-2 -{ - color:var(qtc_list_item_title_normal); -} \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/unicontentswidget.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp --- a/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -38,8 +38,6 @@ #include "conversationsengine.h" #include "debugtraces.h" #include "nativemessageconsts.h" -#include "mmsconformancecheck.h" -#include "UniEditorGenUtils.h" // This is needed for KDefaultMaxSize // LOCAL CONSTANTS const QString REPLY_ICON("qtg_mono_reply"); @@ -50,15 +48,15 @@ //LOCALIZED CONSTANTS #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") -#define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete") -#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") //---------------------------------------------------------------------------- // UnifiedViewer::UnifiedViewer // constructor //---------------------------------------------------------------------------- -UnifiedViewer::UnifiedViewer(const qint32 messageId, QGraphicsItem *parent) : - MsgBaseView(parent) +UnifiedViewer::UnifiedViewer(const qint32 messageId, + int canForwardMessage, + QGraphicsItem *parent) : + MsgBaseView(parent), mForwardMessage(false) { QDEBUG_WRITE("UnifiedViewer contruction start"); @@ -70,6 +68,8 @@ mMessageId = messageId; mViewFeeder = new UniViewerFeeder(mMessageId, this); + if (canForwardMessage > 0) mForwardMessage = true; + mScrollArea = new UniScrollArea(this); this->setWidget(mScrollArea); @@ -115,10 +115,14 @@ else { toolbar->addAction(HbIcon(REPLY_ICON), ""); - toolbar->addAction(HbIcon(REPLY_ALL_ICON), ""); + + if (mViewFeeder->recipientCount() > 1) + { + toolbar->addAction(HbIcon(REPLY_ALL_ICON), ""); + } } - if (validateMsgForForward()) + if (mForwardMessage) { toolbar->addAction(HbIcon(FORWARD_ICON), "", this, SLOT(handleFwdAction())); } @@ -232,9 +236,9 @@ //--------------------------------------------------------------- void UnifiedViewer::handleDeleteAction() { - HbMessageBox::question(LOC_DELETE_MESSAGE,this,SLOT(onDialogDeleteMsg(HbAction*)), - LOC_BUTTON_DELETE, - LOC_BUTTON_CANCEL); + HbMessageBox::question(LOC_DELETE_MESSAGE,this, + SLOT(onDialogDeleteMsg(HbAction*)), + HbMessageBox::Delete | HbMessageBox::Cancel); } //--------------------------------------------------------------- @@ -265,27 +269,6 @@ } //--------------------------------------------------------------- -// UnifiedViewer::validateMsgForForward -// @see header file -//--------------------------------------------------------------- -bool UnifiedViewer::validateMsgForForward() -{ - if (mViewFeeder->msgType() == KSenduiMtmMmsUidValue) - { - bool retValue = false; - - //Validate if the mms msg can be forwarded or not - MmsConformanceCheck* mmsConformanceCheck = new MmsConformanceCheck; - retValue = mmsConformanceCheck->validateMsgForForward(mMessageId); - - delete mmsConformanceCheck; - return retValue; - } - - return true; -} - -//--------------------------------------------------------------- // UnifiedViewer::onDialogDeleteMsg // @see header file //--------------------------------------------------------------- diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/unihighlighter.cpp --- a/messagingapp/msgui/unifiedviewer/src/unihighlighter.cpp Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Enables parsing and change font parameters for email/url - * - */ -#include "unihighlighter.h" - -#include - -//--------------------------------------------------------------- -//UniHighlighter :: UniHighlighter -// @see header file -//--------------------------------------------------------------- -UniHighlighter::UniHighlighter(QTextDocument *parent) : - QSyntaxHighlighter(parent) -{ - HighlightingRule rule; - - emailFormat.setFontWeight(QFont::Bold); - rule.pattern = QRegExp( - "\\b[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}\\b"); - rule.format = emailFormat; - highlightingRules.append(rule); - - urlFormat.setAnchor(true); - urlFormat.setFontUnderline(true); - rule.pattern - = QRegExp( - "\\b((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\\w\\d:#@%/;$()~_?\\+-=\\\\.&]*)\\b"); - rule.format = urlFormat; - highlightingRules.append(rule); -} - -//--------------------------------------------------------------- -//UniHighlighter :: highlightBlock -// @see header file -//--------------------------------------------------------------- -void UniHighlighter::highlightBlock(const QString &text) -{ - foreach (const HighlightingRule &rule, highlightingRules) - { - QRegExp expression(rule.pattern); - int index = text.indexOf(expression); - while (index >= 0) - { - int length = expression.matchedLength(); - setFormat(index, length, rule.format); - index = text.indexOf(expression, index + length); - } - } -} - -// EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/uniscrollarea.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univieweraddresscontainer.cpp --- a/messagingapp/msgui/unifiedviewer/src/univieweraddresscontainer.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/src/univieweraddresscontainer.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -99,4 +99,20 @@ ccWidget->populate(LOC_CC, ccRecipients); } +//--------------------------------------------------------------- +// UniViewerAddressContainer :: setBccField +// @see header file +//--------------------------------------------------------------- +void UniViewerAddressContainer::setBccField(ConvergedMessageAddressList bccRecipients) +{ + UniViewerAddressWidget* bccWidget = new UniViewerAddressWidget(); + + connect(bccWidget, SIGNAL(sendMessage(const QString&,const QString&)), this, + SIGNAL(sendMessage(const QString&,const QString&))); + + mMainLayout->addItem(bccWidget); + + bccWidget->populate(LOC_BCC, bccRecipients); +} + // EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univieweraddresswidget.cpp --- a/messagingapp/msgui/unifiedviewer/src/univieweraddresswidget.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/src/univieweraddresswidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -20,26 +20,22 @@ // SYSTEM INCLUDES #include -#include -#include -#include -#include #include #include -#include +#include + +#include +#include +#include + #include - #include #include #include -#include +#include #include #include "msgcontacthandler.h" - - - - // LOCAL CONSTANTS const QString ADDRESS_SEPARATOR("; "); const QString ADDRESS_OPEN(" ("); @@ -63,11 +59,11 @@ HbTextEdit(parent), mCursorPos(-1) { - this->setReadOnly(true); - this->setCursorVisibility(Hb::TextCursorHidden); + this->setReadOnly(true); this->setScrollable(false); - HbFrameItem *noBackground = new HbFrameItem(this); - this->setBackgroundItem(noBackground); + this->setFlag(QGraphicsItem::ItemIsFocusable,false); + this->setCursorVisibility(Hb::TextCursorHidden); + this->setBackgroundItem(0); HbFontSpec fontSpec(HbFontSpec::Secondary); QFont font = fontSpec.font(); @@ -92,37 +88,71 @@ } //--------------------------------------------------------------- -//UniViewerAddressWidget :: mousePressEvent +//UniViewerAddressWidget :: gestureEvent // @see header file //--------------------------------------------------------------- -void UniViewerAddressWidget::mousePressEvent(QGraphicsSceneMouseEvent *event) +void UniViewerAddressWidget::gestureEvent(QGestureEvent* event) { - HbTextEdit::mousePressEvent(event); - - QTextDocument* doc = this->document(); - - mCursorPos = doc->documentLayout()->hitTest(event->pos(), Qt::ExactHit); - - highlightText(true); + //handle gesture to highlight and dehighlight find item. + + if(HbTapGesture *tap = qobject_cast(event->gesture(Qt::TapGesture))) + { + //capturing gesture position, and map to local co-ordinates. + QPointF pos = mapFromScene(tap->scenePosition()); + + switch (tap->state()) + { + case Qt::GestureStarted: + { + //highlight find item. + QTextDocument* doc = this->document(); + mCursorPos = doc->documentLayout()->hitTest(pos, Qt::ExactHit); + highlightText(true); + break; + } + + case Qt::GestureFinished: + { + if (HbTapGesture::Tap == tap->tapStyleHint()) + { + //gesture is finshed dehighlight text. + highlightText(false); + + QString anchor = this->anchorAt(pos); + + //do short tap action. + if (!anchor.isEmpty() && !this->textCursor().hasSelection()) + { + shortTapAction(anchor); + } + } + break; + } + + case Qt::GestureCanceled: + { + //gesture is canceled due to pan or swipe, dehighlight text. + if (HbTapGesture::Tap == tap->tapStyleHint()) + { + highlightText(false); + break; + } + } + default: + break; + } + + event->accept(); + } + else + { + event->ignore(); + } + + //passing gesture event to base class. + HbTextEdit::gestureEvent(event); } -//--------------------------------------------------------------- -//UniViewerAddressWidget :: mouseReleaseEvent -// @see header file -//--------------------------------------------------------------- -void UniViewerAddressWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - HbTextEdit::mouseReleaseEvent(event); - - highlightText(false); - - QString anchor = this->anchorAt(event->pos()); - - if(!anchor.isEmpty() && !this->textCursor().hasSelection()) - { - shortTapAction(anchor); - } -} //---------------------------------------------------------------------------- // UniViewerAddressWidget::populate @@ -372,7 +402,7 @@ QString phoneNumber = action->data().toString(); //invoke dialer service and pass phoneNumber. - QString serviceName("com.nokia.services.telephony"); + QString serviceName("com.nokia.symbian.ICallDial"); QString operation("dial(QString)"); XQServiceRequest* serviceRequest = new XQServiceRequest(serviceName,operation,false); @@ -416,6 +446,16 @@ QContactPhoneNumber::DefinitionName, QContactPhoneNumber::FieldNumber); + // if contact is unresolved on phone number field + // then, try resolving it on email address field + if(contactId <= 0) + { + contactId = MsgContactHandler::resolveContactDisplayName( + data, + QContactEmailAddress::DefinitionName, + QContactEmailAddress::FieldEmailAddress); + } + if(contactId > 0) { //open contact card diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univiewerattachmentcontainer.cpp --- a/messagingapp/msgui/unifiedviewer/src/univiewerattachmentcontainer.cpp Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "univiewerattachmentcontainer.h" - -// SYSTEM INCLUDES -#include -#include - -// USER INCLUDES -#include "univiewermediawidget.h" -#include "debugtraces.h" - -// LOCAL CONSTANTS -const QString ATTACHMENT_FRAME("qtg_fr_groupbox"); -const QString ATTACHMENT_ICON("qtg_small_attachment.svg"); - -const int KILOBYTE = 1024; - -//--------------------------------------------------------------- -// UniViewerAttachmentContainer :: UniViewerAttachmentContainer -// @see header file -//--------------------------------------------------------------- -UniViewerAttachmentContainer::UniViewerAttachmentContainer(QGraphicsItem *parent) : - HbWidget(parent), mTotalAttachment(0), mMainLayout(NULL) -{ - QDEBUG_WRITE("AttachmentContainer Initialized.."); - mMainLayout = new QGraphicsLinearLayout(Qt::Vertical); - mMainLayout->setContentsMargins(0, 0, 0, 0); - mMainLayout->setSpacing(0); - setLayout(mMainLayout); -} - -//--------------------------------------------------------------- -// UniViewerAttachmentContainer :: ~UniViewerAttachmentContainer -// @see header file -//--------------------------------------------------------------- -UniViewerAttachmentContainer::~UniViewerAttachmentContainer() -{ - -} - -//--------------------------------------------------------------- -// UniViewerAttachmentContainer :: addAttachmentWidget -// @see header file -//--------------------------------------------------------------- -void UniViewerAttachmentContainer::addAttachmentWidget(QString type, QString fileName) -{ - Q_UNUSED(type) - - UniViewerMediaWidget *attachmentWidget = new UniViewerMediaWidget(this); - mUniViewerMediaWidgetList.append(attachmentWidget); - QFileInfo fileInfo(fileName); - - int fileSize = fileInfo.size(); - QString sizeString('B'); - if (fileSize > KILOBYTE) { - // Convert to Kilobytes. - fileSize /= KILOBYTE; - sizeString = "Kb"; - } - - QString fileDetails = "(" + QString::number(fileSize) + sizeString + ")"; - - attachmentWidget->populate(ATTACHMENT_ICON, fileInfo.fileName(), fileDetails, ATTACHMENT_FRAME); - - mMainLayout->addItem(attachmentWidget); - - mTotalAttachment++; -} - -//--------------------------------------------------------------- -// UniViewerAttachmentContainer :: clearContent -// @see header file -//--------------------------------------------------------------- -void UniViewerAttachmentContainer::clearContent() -{ - for (int i = 0; i < mUniViewerMediaWidgetList.count(); ++i) { - --mTotalAttachment; - mMainLayout->removeItem(mUniViewerMediaWidgetList[i]); - mUniViewerMediaWidgetList[i]->setParent(NULL); - delete mUniViewerMediaWidgetList[i]; - mUniViewerMediaWidgetList[i] = NULL; - } - mUniViewerMediaWidgetList.clear(); - resize(rect().width(), -1); -} - -//eof diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univiewerattachmentwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiedviewer/src/univiewerattachmentwidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,259 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Widget for displaying attachment media objects. + * + */ + +#include "univiewerattachmentwidget.h" + +// SYSTEM INCLUDES +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +// USER INCLUDES +#include "univiewerutils.h" +#include "unidatamodelplugininterface.h" + +// LOCAL CONSTANTS +#define LOC_OPEN hbTrId("txt_common_menu_open") +#define LOC_SAVE hbTrId("txt_common_menu_save") +#define LOC_SAVE_TO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts") + +const QString BG_FRAME_NORMAL("qtg_fr_list_normal"); +const QString BG_FRAME_PRESSED("qtg_fr_list_pressed"); +const QString ATTACHMENT_ICON("qtg_small_attachment"); +const QString CORRUPTED_ATTACH_ICON("qtg_small_corrupted"); +const QString VCARD_MIMETYPE("text/X-vCard"); + +const int KILOBYTE = 1024; + +//---------------------------------------------------------------------------- +// UniViewerAttachmentWidget::UniViewerAttachmentWidget +// @see header file +//---------------------------------------------------------------------------- +UniViewerAttachmentWidget::UniViewerAttachmentWidget(QGraphicsItem *parent) : + HbWidget(parent), mMediaIcon(0), mName(0), mInfo(0), mFrameItem(0), mViewerUtils(0) +{ + this->grabGesture(Qt::TapGesture); + + setProperty("state", "normal"); + + mMediaIcon = new HbIconItem(this); + HbStyle::setItemName(mMediaIcon, "mediaIcon"); + + mName = new HbTextItem(this); + HbStyle::setItemName(mName, "text-1"); + + mInfo = new HbTextItem(this); + HbStyle::setItemName(mInfo, "text-2"); + + mFrameItem = new HbFrameItem(BG_FRAME_NORMAL, HbFrameDrawer::NinePieces, this); + HbStyle::setItemName(mFrameItem, "bgFrame"); + + HbEffect::add("attachmentWidget", "listviewitem_press", "pressed"); + HbEffect::add("attachmentWidget", "listviewitem_release", "released"); +} + +//---------------------------------------------------------------------------- +// UniViewerAttachmentWidget::~UniViewerAttachmentWidget +// @see header file +//---------------------------------------------------------------------------- +UniViewerAttachmentWidget::~UniViewerAttachmentWidget() +{ +} + +//---------------------------------------------------------------------------- +// UniViewerAttachmentWidget::populate +// @see header file +//---------------------------------------------------------------------------- +void UniViewerAttachmentWidget::populate(UniMessageInfo *info) +{ + mMimeType = info->mimetype(); + mMediaPath = info->path(); + + QString attachIcon; + if (info->isProtected()) { + attachIcon = ATTACHMENT_ICON; + } + else if (info->isCorrupted()) { + attachIcon = CORRUPTED_ATTACH_ICON; + } + else { + attachIcon = ATTACHMENT_ICON; + } + + mMediaIcon->setIconName(attachIcon); + QFileInfo fileInfo(mMediaPath); + mName->setText(fileInfo.fileName()); + + QString sizeString('B'); + int fileSize = fileInfo.size(); + if (fileSize > KILOBYTE) { + // Convert to Kilobytes. + fileSize /= KILOBYTE; + sizeString = "Kb"; + } + QString fileDetails = "(" + QString::number(fileSize) + sizeString + ")"; + mInfo->setText(fileDetails); +} + +//---------------------------------------------------------------------------- +// UniViewerAttachmentWidget::resizeEvent +// @see header file +//---------------------------------------------------------------------------- +void UniViewerAttachmentWidget::gestureEvent(QGestureEvent *event) +{ + HbTapGesture *tapGesture = qobject_cast (event->gesture(Qt::TapGesture)); + if (tapGesture) { + switch (tapGesture->state()) { + case Qt::GestureStarted: + { + // Trigger haptic feedback. + HbInstantFeedback::play(HbFeedback::Basic); + setPressed(true); + break; + } + case Qt::GestureUpdated: + { + if (HbTapGesture::TapAndHold == tapGesture->tapStyleHint()) { + // Handle longtap. + setPressed(false); + handleLongTap(tapGesture->scenePosition()); + } + break; + } + case Qt::GestureFinished: + { + HbInstantFeedback::play(HbFeedback::Basic); + if (HbTapGesture::Tap == tapGesture->tapStyleHint()) { + // Handle short tap. + setPressed(false); + handleShortTap(); + } + break; + } + case Qt::GestureCanceled: + { + HbInstantFeedback::play(HbFeedback::Basic); + setPressed(false); + break; + } + } + } + else { + HbWidget::gestureEvent(event); + } +} + +//---------------------------------------------------------------------------- +// UniViewerAttachmentWidget::handleOpen +// @see header file +//---------------------------------------------------------------------------- +void UniViewerAttachmentWidget::handleOpen() +{ + this->ungrabGesture(Qt::TapGesture); + + if (!mViewerUtils) { + mViewerUtils = new UniViewerUtils(this); + } + mViewerUtils->launchContentViewer(mMimeType, mMediaPath); + + //fire timer to regrab gesture after some delay. + QTimer::singleShot(300,this,SLOT(regrabGesture())); +} + +//---------------------------------------------------------------------------- +// UniViewerAttachmentWidget::handleSave +// @see header file +//---------------------------------------------------------------------------- +void UniViewerAttachmentWidget::handleSave() +{ + +} + +//---------------------------------------------------------------------------- +// UniViewerAttachmentWidget::handleShortTap +// @see header file +//---------------------------------------------------------------------------- +void UniViewerAttachmentWidget::handleShortTap() +{ + emit shortTap(mMediaPath); + + // Open the media. + handleOpen(); +} + +//---------------------------------------------------------------------------- +// UniViewerAttachmentWidget::handleLongTap +// @see header file +//---------------------------------------------------------------------------- +void UniViewerAttachmentWidget::handleLongTap(const QPointF &position) +{ + emit longTap(position); + + // Display context sensitive menu. + HbMenu* menu = new HbMenu; + menu->setAttribute(Qt::WA_DeleteOnClose); + menu->setPreferredPos(position); + + if (mMimeType.contains(VCARD_MIMETYPE, Qt::CaseInsensitive)) { + // For vcard opening & saving is same. + menu->addAction(LOC_SAVE_TO_CONTACTS, this, SLOT(handleOpen())); + } + else { + menu->addAction(LOC_OPEN, this, SLOT(handleOpen())); + menu->addAction(LOC_SAVE, this, SLOT(handleSave())); + } + + menu->show(); +} + +//---------------------------------------------------------------------------- +// UniViewerAttachmentWidget::setPressed +// @see header file +//---------------------------------------------------------------------------- +void UniViewerAttachmentWidget::setPressed(bool pressed) +{ + if (pressed) { + setProperty("state", "pressed"); + mFrameItem->frameDrawer().setFrameGraphicsName(BG_FRAME_PRESSED); + HbEffect::cancel(mFrameItem, "released"); + HbEffect::start(mFrameItem, "attachmentWidget", "pressed"); + + } + else { + setProperty("state", "normal"); + mFrameItem->frameDrawer().setFrameGraphicsName(BG_FRAME_NORMAL); + HbEffect::cancel(mFrameItem, "pressed"); + HbEffect::start(mFrameItem, "attachmentWidget", "released"); + } +} + +//--------------------------------------------------------------- +// UniViewerAttachmentWidget::regrabGesture +// @see header file +//--------------------------------------------------------------- +void UniViewerAttachmentWidget::regrabGesture() +{ + this->grabGesture(Qt::TapGesture); +} +// EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univieweraudiowidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiedviewer/src/univieweraudiowidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: This widget is used to display audio content in univiewer. + * + */ +#include "univieweraudiowidget.h" + +// SYSTEM INCLUDES +#include +#include +#include + +// USER INCLUDES +#include "msgmediautil.h" +#include "univiewerutils.h" +#include "unidatamodelplugininterface.h" + +// LOCAL CONSTANTS +#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"); + +//---------------------------------------------------------------------------- +// UniViewerAudioWidget::UniViewerAudioWidget +// @see header file +//---------------------------------------------------------------------------- +UniViewerAudioWidget::UniViewerAudioWidget(QGraphicsItem *parent) : + HbPushButton(parent), mViewerUtils(0) +{ + connect(this, SIGNAL(clicked()), this, SLOT(handleShortTap())); + connect(this, SIGNAL(longPress(QPointF)), this, SLOT(handleLongTap(QPointF))); +} + +//---------------------------------------------------------------------------- +// UniViewerAudioWidget::~UniViewerAudioWidget +// @see header file +//---------------------------------------------------------------------------- +UniViewerAudioWidget::~UniViewerAudioWidget() +{ +} + +//---------------------------------------------------------------------------- +// UniViewerAudioWidget::~UniViewerAudioWidget +// @see header file +//---------------------------------------------------------------------------- +void UniViewerAudioWidget::populate(UniMessageInfo *info) +{ + mMimeType = info->mimetype(); + mMediaPath = info->path(); + + HbIcon audioIcon; + if (info->isProtected()) { + audioIcon.setIconName(AUDIO_ICON); + } + else if (info->isCorrupted()) { + audioIcon.setIconName(CORRUPTED_AUDIO_ICON); + } + else { + audioIcon.setIconName(AUDIO_ICON); + } + + this->setIcon(audioIcon); + QFileInfo fileInfo(mMediaPath); + this->setText(fileInfo.baseName()); + this->setTextAlignment(Qt::AlignLeft); + MsgMediaUtil mediaUtil; + this->setAdditionalText(mediaUtil.mediaDuration(mMediaPath)); +} + +//---------------------------------------------------------------------------- +// UniViewerAudioWidget::handleShortTap +// @see header file +//---------------------------------------------------------------------------- +void UniViewerAudioWidget::handleShortTap() +{ + emit shortTap(mMediaPath); + + // Open the media. + handleOpen(); +} + +//---------------------------------------------------------------------------- +// UniViewerAudioWidget::handleLongTap +// @see header file +//---------------------------------------------------------------------------- +void UniViewerAudioWidget::handleLongTap(const QPointF &position) +{ + emit longTap(position); + + // Display context sensitive menu. + HbMenu* menu = new HbMenu; + menu->setAttribute(Qt::WA_DeleteOnClose); + menu->addAction(LOC_OPEN, this, SLOT(handleOpen())); + menu->addAction(LOC_SAVE, this, SLOT(handleSave())); + menu->setPreferredPos(position); + menu->show(); +} + +//---------------------------------------------------------------------------- +// UniViewerAudioWidget::handleOpen +// @see header file +//---------------------------------------------------------------------------- +void UniViewerAudioWidget::handleOpen() +{ + this->ungrabGesture(Qt::TapGesture); + + if (!mViewerUtils) { + mViewerUtils = new UniViewerUtils(this); + } + mViewerUtils->launchContentViewer(mMimeType, mMediaPath); + + //fire timer to regrab gesture after some delay. + QTimer::singleShot(300,this,SLOT(regrabGesture())); +} + +//---------------------------------------------------------------------------- +// UniViewerAudioWidget::handleSave +// @see header file +//---------------------------------------------------------------------------- +void UniViewerAudioWidget::handleSave() +{ + +} + +//--------------------------------------------------------------- +// UniViewerAudioWidget::regrabGesture +// @see header file +//--------------------------------------------------------------- +void UniViewerAudioWidget::regrabGesture() +{ + this->grabGesture(Qt::TapGesture); +} +// EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp --- a/messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -17,30 +17,21 @@ #include "univiewerbodywidget.h" +// SYSTEM INCLUDES #include -#include -#include -#include - #include -#include -#include #include -#include -#include -#include - +// USER INCLUDES #include "univiewertextitem.h" #include "univiewerpixmapwidget.h" -#include "msgmediautil.h" -// LOCAL CONSTANTS -const QString AUDIO_ICON("qtg_mono_audio"); +#include "univieweraudiowidget.h" -// Localization -#define LOC_TITLE hbTrId("txt_messaging_title_messaging") -#define LOC_OPEN hbTrId("txt_common_menu_open") -#define LOC_SAVE hbTrId("txt_common_menu_save") +// LOCAL CONSTANTS +const QString IMAGE_MIMETYPE("image"); +const QString AUDIO_MIMETYPE("audio"); +const QString VIDEO_MIMETYPE("video"); +const QString TEXT_MIMETYPE("text"); //--------------------------------------------------------------- //UniViewerBodyWidget::UniViewerBodyWidget @@ -50,10 +41,7 @@ HbWidget(parent), mHasText(false), mHasPixmap(false), mTextItem(0), mSlideCounter(0), mPixmapItem(0), mAudioItem(0) { - this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); - // Signal mapper for opening media files - mSignalMapper = new QSignalMapper(this); - connect(mSignalMapper, SIGNAL(mapped(const QString &)), this, SLOT(openMedia(const QString &))); + this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); } //--------------------------------------------------------------- @@ -68,18 +56,16 @@ //UniViewerBodyWidget::setImage // @see header file //--------------------------------------------------------------- -void UniViewerBodyWidget::setPixmap(QString pixmapFile) +void UniViewerBodyWidget::setPixmap(UniMessageInfo *info) { setHasPixmap(true); //create image item instance if (!mPixmapItem) { mPixmapItem = new UniViewerPixmapWidget(this); HbStyle::setItemName(mPixmapItem, "pixmap"); - connect(mPixmapItem, SIGNAL(shortTap(QString)), this, SLOT(openMedia(QString))); } - mPixmapItem->hide(); - mPixmapItem->setPixmap(pixmapFile); + mPixmapItem->populate(info); this->repolish(); } @@ -88,23 +74,14 @@ //UniViewerBodyWidget::setAudio // @see header file //--------------------------------------------------------------- -void UniViewerBodyWidget::setAudio(QString audiofile) +void UniViewerBodyWidget::setAudio(UniMessageInfo *info) { if (!mAudioItem) { - mAudioItem = new HbPushButton(this); + mAudioItem = new UniViewerAudioWidget(this); HbStyle::setItemName(mAudioItem, "audioItem"); } mAudioItem->hide(); - QFileInfo fileInfo(audiofile); - mAudioItem->setIcon(HbIcon(AUDIO_ICON)); - mAudioItem->setText(fileInfo.baseName()); - MsgMediaUtil mediaUtil; - mAudioItem->setAdditionalText(mediaUtil.mediaDuration(audiofile)); - mAudioItem->setTextAlignment(Qt::AlignLeft); - - // Connect to signal mapper with file name - mSignalMapper->setMapping(mAudioItem, audiofile); - connect(mAudioItem, SIGNAL(clicked()), mSignalMapper, SLOT(map())); + mAudioItem->populate(info); this->repolish(); } @@ -113,16 +90,25 @@ //UniViewerBodyWidget::setVideo // @see header file //--------------------------------------------------------------- -void UniViewerBodyWidget::setVideo(QString videofile) +void UniViewerBodyWidget::setVideo(UniMessageInfo *info) { - Q_UNUSED(videofile) + setHasPixmap(true); + //create image item instance + if (!mPixmapItem) { + mPixmapItem = new UniViewerPixmapWidget(this); + HbStyle::setItemName(mPixmapItem, "pixmap"); + } + mPixmapItem->hide(); + mPixmapItem->populate(info); + + this->repolish(); } //--------------------------------------------------------------- -//UniViewerBodyWidget::setTextContent +//UniViewerBodyWidget::setText // @see header file //--------------------------------------------------------------- -void UniViewerBodyWidget::setTextContent(QString text) +void UniViewerBodyWidget::setText(QString text) { setHasText(true); @@ -140,7 +126,7 @@ } //--------------------------------------------------------------- -//UniViewerBodyWidget::setTextContent +// UniViewerBodyWidget::setSlideCounter // @see header file //--------------------------------------------------------------- void UniViewerBodyWidget::setSlideCounter(QString &slideCounter) @@ -204,23 +190,23 @@ int count = objList.count(); for (int a = 0; a < count; ++a) { UniMessageInfo* info = objList.at(a); - QString type = info->mimetype(); + QString mimeType = info->mimetype(); - if (type.contains("text")) { + if (mimeType.contains(TEXT_MIMETYPE)) { QFile file(info->path()); if (file.open(QIODevice::ReadOnly)) { QString textContent(file.readAll()); - setTextContent(textContent); + setText(textContent); } } - else if (type.contains("video")) { - setVideo(info->path()); + else if (mimeType.contains(AUDIO_MIMETYPE)) { + setAudio(info); } - else if (type.contains("audio")) { - setAudio(info->path()); + else if (mimeType.contains(VIDEO_MIMETYPE)) { + setVideo(info); } - else if (type.contains("image")) { - setPixmap(info->path()); + else if (mimeType.contains(IMAGE_MIMETYPE)) { + setPixmap(info); } delete info; @@ -403,110 +389,4 @@ return szHint; } -//--------------------------------------------------------------- -//UniViewerBodyWidget::longPressed -// @see header file -//--------------------------------------------------------------- -void UniViewerBodyWidget::longPressed(QPointF position) -{ - - HbMenu* menu = new HbMenu; - menu->setAttribute(Qt::WA_DeleteOnClose); - menu->addAction(LOC_OPEN, this, SLOT(openMedia())); - menu->addAction(LOC_SAVE, this, SLOT(saveMedia())); - menu->setPreferredPos(position); - menu->show(); -} - -//--------------------------------------------------------------- -//UniViewerBodyWidget::openMedia -// @see header file -//--------------------------------------------------------------- -void UniViewerBodyWidget::openMedia() -{ -} - -//--------------------------------------------------------------- -//UniViewerBodyWidget::openMedia -// @see header file -//--------------------------------------------------------------- -void UniViewerBodyWidget::openMedia(const QString& fileName) -{ - XQSharableFile sf; - XQAiwRequest* request = 0; - - if (!sf.open(fileName)) { - return; - } - - // Get handlers - XQApplicationManager appManager; - QList fileHandlers = appManager.list(sf); - if (fileHandlers.count() > 0) { - XQAiwInterfaceDescriptor d = fileHandlers.first(); - request = appManager.create(sf, d); - - if (!request) { - sf.close(); - return; - } - } - else { - sf.close(); - return; - } - - // Result handlers - connect(request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&))); - connect(request, SIGNAL(requestError(const QVariant&)), this, - SLOT(handleError(const QVariant&))); - - request->setEmbedded(true); - request->setSynchronous(true); - - // Fill args - QList args; - args << qVariantFromValue(sf); - request->setArguments(args); - - // Fill headers - QString key("WindowTitle"); - QVariant value(QString(LOC_TITLE)); - XQRequestInfo info; - info.setInfo(key, value); - request->setInfo(info); - - request->send(); - - // Cleanup - sf.close(); - delete request; -} - -//--------------------------------------------------------------- -//UniViewerBodyWidget::saveMedia -// @see header file -//--------------------------------------------------------------- -void UniViewerBodyWidget::saveMedia() -{ -} - -//--------------------------------------------------------------- -// UniViewerBodyWidget :: handleOk -// @see header file -//--------------------------------------------------------------- -void UniViewerBodyWidget::handleOk(const QVariant& result) -{ - Q_UNUSED(result) -} - -//--------------------------------------------------------------- -// UniViewerBodyWidget :: handleError -// @see header file -//--------------------------------------------------------------- -void UniViewerBodyWidget::handleError(int errorCode, const QString& errorMessage) -{ - Q_UNUSED(errorMessage) - Q_UNUSED(errorCode) -} // EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univiewerdetailswidget.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univiewerfeeder.cpp --- a/messagingapp/msgui/unifiedviewer/src/univiewerfeeder.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/src/univiewerfeeder.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -167,6 +167,24 @@ } // --------------------------------------------------------------------------- +// UniViewerFeeder::bccAddressList +// @see header file +// --------------------------------------------------------------------------- +ConvergedMessageAddressList UniViewerFeeder::bccAddressList() +{ + return d_ptr->bccAddressList(); +} + +// --------------------------------------------------------------------------- +// UniViewerFeeder::recipientCount +// @see header file +// --------------------------------------------------------------------------- +int UniViewerFeeder::recipientCount() +{ + return d_ptr->recipientCount(); +} + +// --------------------------------------------------------------------------- // UniViewerFeeder::messageSize // @see header file // --------------------------------------------------------------------------- diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp --- a/messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -18,7 +18,6 @@ #include "univiewerfeeder_p.h" // SYSTEM INCLUDES #include -#include #include // USER INCLUDES @@ -27,6 +26,7 @@ #include "unidatamodelloader.h" #include "msgcontacthandler.h" #include "debugtraces.h" +#include "msgbiouids.h" // --------------------------------------------------------------------------- // UniViewerFeederPrivate::UniViewerFeederPrivate @@ -156,8 +156,8 @@ void UniViewerFeederPrivate::fetchDetailsL() { QDEBUG_WRITE("UniViewerFeederPrivate fetchDetailsL : SMS start"); - if (msgType() == KSenduiMtmSmsUidValue) - { + if (msgType() == KSenduiMtmSmsUidValue || (msgType() == KSenduiMtmBioUidValue + && mEntry.iBioType == KMsgBioNokiaServiceMessage.iUid)) { QString body; mPluginInterface->body(body); q_ptr->emitMsgBody(body); @@ -248,14 +248,21 @@ mPluginInterface->setMessageId(msgId); } - if (msgType() == KSenduiMtmMmsUidValue) - { + else if (msgType() == KSenduiMtmMmsUidValue) { mPluginInterface = mPluginLoader->getDataModelPlugin(ConvergedMessage::Mms); mPluginInterface->setMessageId(msgId); mSlideCount = mPluginInterface->slideCount(); + } + else if (msgType() == KSenduiMtmBioUidValue && mEntry.iBioType + == KMsgBioNokiaServiceMessage.iUid) { + mPluginInterface = mPluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg); + mPluginInterface->setMessageId(msgId); + } + mPluginInterface->toRecipientList(mToAddressList); mPluginInterface->ccRecipientList(mCcAddressList); + mPluginInterface->bccRecipientList(mBccAddressList); } // --------------------------------------------------------------------------- @@ -265,12 +272,10 @@ ConvergedMessageAddressList UniViewerFeederPrivate::toAddressList() { QString alias = QString(); - for (int i = 0; i < mToAddressList.count(); ++i) - { + int count; + for (int i = 0; i < mToAddressList.count(); ++i) { MsgContactHandler::resolveContactDisplayName( - mToAddressList.at(i)->address(), - alias, - 0); + mToAddressList.at(i)->address(), alias, count); mToAddressList.at(i)->setAlias(alias); alias.clear(); } @@ -284,12 +289,10 @@ ConvergedMessageAddressList UniViewerFeederPrivate::ccAddressList() { QString alias = QString(); - for (int i = 0; i < mCcAddressList.count(); ++i) - { + int count; + for (int i = 0; i < mCcAddressList.count(); ++i) { MsgContactHandler::resolveContactDisplayName( - mToAddressList.at(i)->address(), - alias, - 0); + mToAddressList.at(i)->address(), alias, count); mCcAddressList.at(i)->setAlias(alias); alias.clear(); @@ -298,6 +301,35 @@ } // --------------------------------------------------------------------------- +// UniViewerFeederPrivate::bccAddressList +// @see header file +// --------------------------------------------------------------------------- +ConvergedMessageAddressList UniViewerFeederPrivate::bccAddressList() +{ + QString alias = QString(); + int count; + for (int i = 0; i < mBccAddressList.count(); ++i) + { + MsgContactHandler::resolveContactDisplayName( + mBccAddressList.at(i)->address(), + alias, + count); + mBccAddressList.at(i)->setAlias(alias); + alias.clear(); + } + return mBccAddressList; +} + +// --------------------------------------------------------------------------- +// UniViewerFeederPrivate::recipientCount +// @see header file +// --------------------------------------------------------------------------- +int UniViewerFeederPrivate::recipientCount() +{ + return mToAddressList.count() + mCcAddressList.count() + mBccAddressList.count(); +} + +// --------------------------------------------------------------------------- // UniViewerFeederPrivate::messageSize // @see header file // --------------------------------------------------------------------------- @@ -313,10 +345,8 @@ void UniViewerFeederPrivate::fromAddressAndAlias(QString& from, QString& alias) { mPluginInterface->fromAddress(from); - MsgContactHandler::resolveContactDisplayName( - from, - alias, - 0); + int count; + MsgContactHandler::resolveContactDisplayName(from, alias, count); } // --------------------------------------------------------------------------- @@ -335,8 +365,13 @@ { delete mCcAddressList.at(i); } + mCcAddressList.clear(); - mCcAddressList.clear(); + for (int i = 0; i < mBccAddressList.count(); ++i) + { + delete mBccAddressList.at(i); + } + mBccAddressList.clear(); } // EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univiewerheadercontainer.cpp --- a/messagingapp/msgui/unifiedviewer/src/univiewerheadercontainer.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/src/univiewerheadercontainer.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -24,9 +24,9 @@ // USER INCLUDES #include "univieweraddresscontainer.h" -#include "univiewerattachmentcontainer.h" #include "univiewerdetailswidget.h" #include "univiewerfeeder.h" +#include "univiewerattachmentwidget.h" #include "nativemessageconsts.h" @@ -44,13 +44,10 @@ //--------------------------------------------------------------- UniViewerHeaderContainer::UniViewerHeaderContainer(UniViewerFeeder* feeder, QGraphicsItem *parent) : HbWidget(parent), mViewFeeder(feeder), mViewerDetails(0), mHeaderGroupBox(0), mSeparator(0), - mAddressContainer(0), mAttachmentContainer(0) + mAddressContainer(0) { this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - HbFrameItem *bgItem = new HbFrameItem(BG_FRAME_GRAPHICS, HbFrameDrawer::NinePieces, this); - this->setBackgroundItem(bgItem); - mMainLayout = new QGraphicsLinearLayout(Qt::Vertical, this); mMainLayout->setSpacing(0); mMainLayout->setContentsMargins(0, 0, 0, 0); @@ -68,16 +65,31 @@ // Separator mSeparator = new HbFrameItem(DIVIDER_FRAME, HbFrameDrawer::OnePiece, this); - mSeparator->setMaximumHeight(1); + mSeparator->setMinimumHeight(2.0); + mSeparator->frameDrawer().fillWholeRect(); mSeparator->hide(); // Viewer Details widget mViewerDetails = new UniViewerDetailsWidget(this); + // This widget is created to apply background for header & details. + HbWidget *headerContainer = new HbWidget(this); + + QGraphicsLinearLayout *headerLayout = new QGraphicsLinearLayout(Qt::Vertical, headerContainer); + headerLayout->setSpacing(0); + headerLayout->setContentsMargins(0, 0, 0, 0); + + HbFrameItem *bgItem = new HbFrameItem(BG_FRAME_GRAPHICS, HbFrameDrawer::NinePieces, this); + headerContainer->setBackgroundItem(bgItem, -2.0); + //Add address group box and insert into layout - mMainLayout->addItem(mHeaderGroupBox); - mMainLayout->addItem(mSeparator); - mMainLayout->addItem(mViewerDetails); + headerLayout->addItem(mHeaderGroupBox); + headerLayout->addItem(mSeparator); + headerLayout->addItem(mViewerDetails); + + headerContainer->setLayout(headerLayout); + + mMainLayout->addItem(headerContainer); this->setLayout(mMainLayout); } @@ -117,9 +129,11 @@ // Expand address group box for outgoing messages. if (mViewFeeder->isIncoming()) { mHeaderGroupBox->setCollapsed(true); + addressBoxToggled(true); } else { mHeaderGroupBox->setCollapsed(false); + addressBoxToggled(false); } } @@ -132,9 +146,17 @@ if (mViewerDetails) { mViewerDetails->clearContent(); } - if (mAttachmentContainer) { - mAttachmentContainer->clearContent(); + + // Clear the attachments. + for (int i = 0; i < mUniViewerAttachmentstList.count(); ++i) { + mMainLayout->removeItem(mUniViewerAttachmentstList[i]); + mUniViewerAttachmentstList[i]->setParent(NULL); + delete mUniViewerAttachmentstList[i]; + mUniViewerAttachmentstList[i] = NULL; } + mUniViewerAttachmentstList.clear(); + + resize(rect().width(), -1); } //--------------------------------------------------------------- @@ -167,17 +189,14 @@ //--------------------------------------------------------------- void UniViewerHeaderContainer::populateAttachments() { - if (!mAttachmentContainer) { - // Attachment Container - mAttachmentContainer = new UniViewerAttachmentContainer(this); - mMainLayout->addItem(mAttachmentContainer); - } - UniMessageInfoList attachList = mViewFeeder->attachmentsList(); for (int a = 0; a < attachList.count(); ++a) { UniMessageInfo* info = attachList.at(a); - mAttachmentContainer->addAttachmentWidget(info->mimetype(), info->path()); + UniViewerAttachmentWidget *attachmentWidget = new UniViewerAttachmentWidget(this); + mUniViewerAttachmentstList.append(attachmentWidget); + attachmentWidget->populate(info); delete info; + mMainLayout->addItem(attachmentWidget); } } @@ -209,6 +228,10 @@ if (!ccList.isEmpty()) { mAddressContainer->setCcField(ccList); } + ConvergedMessageAddressList bccList = mViewFeeder->bccAddressList(); + if (!bccList.isEmpty()) { + mAddressContainer->setBccField(bccList); + } } } @@ -259,3 +282,5 @@ { (state) ? mSeparator->hide() : mSeparator->show(); } + +// EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univiewermediawidget.cpp --- a/messagingapp/msgui/unifiedviewer/src/univiewermediawidget.cpp Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +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 "univiewermediawidget.h" - -// SYSTEM INCLUDES -#include -#include -#include -#include - -// USER INCLUDES -#include "debugtraces.h" - -// LOCAL CONSTANTS - -//---------------------------------------------------------------------------- -// UniViewerMediaWidget::UniViewerMediaWidget -// @see header file -//---------------------------------------------------------------------------- -UniViewerMediaWidget::UniViewerMediaWidget(QGraphicsItem *parent): - HbWidget(parent), mMediaIcon(0), mName(0), mInfo(0), mFrameItem(0) -{ - init(); -} - -//---------------------------------------------------------------------------- -// UniViewerMediaWidget::~UniViewerMediaWidget -// @see header file -//---------------------------------------------------------------------------- -UniViewerMediaWidget::~UniViewerMediaWidget() -{ -} - -//---------------------------------------------------------------------------- -// UniViewerMediaWidget::init -// @see header file -//---------------------------------------------------------------------------- -void UniViewerMediaWidget::init() -{ - mMediaIcon = new HbIconItem(this); - HbStyle::setItemName(mMediaIcon, "mediaIcon"); - - mName = new HbTextItem(this); - HbStyle::setItemName(mName, "text-1"); - - mInfo = new HbTextItem(this); - HbStyle::setItemName(mInfo, "text-2"); - - mFrameItem = new HbPushButton(this); - HbStyle::setItemName(mFrameItem, "bgFrame"); - - connect(mFrameItem, SIGNAL(clicked(bool)), this, SIGNAL(clicked())); -} - -//---------------------------------------------------------------------------- -// UniViewerMediaWidget::populate -// @see header file -//---------------------------------------------------------------------------- -void UniViewerMediaWidget::populate(const QString &icon, const QString &name, - const QString &info, const QString &bgFrame) -{ - HbFrameDrawer *fd = new HbFrameDrawer(bgFrame, - HbFrameDrawer::NinePieces); - mFrameItem->setFrameBackground(fd); - - mMediaIcon->setIconName(icon); - mName->setText(name); - mInfo->setText(info); - -} - -//---------------------------------------------------------------------------- -// UniViewerMediaWidget::clearContent -// @see header file -//---------------------------------------------------------------------------- -void UniViewerMediaWidget::clearContent() -{ - mMediaIcon->setIconName(""); - mName->setText(""); - mInfo->setText(""); -} - -// EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univiewerpixmapwidget.cpp --- a/messagingapp/msgui/unifiedviewer/src/univiewerpixmapwidget.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/src/univiewerpixmapwidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -17,20 +17,53 @@ #include "univiewerpixmapwidget.h" +// SYSTEM INCLUDES #include #include #include +#include #include +#include +#include + +// USER INCLUDES +#include "univiewerutils.h" +#include "unidatamodelplugininterface.h" + +// LOCAL CONSTANTS +#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"); //--------------------------------------------------------------- // UniViewerPixmapWidget::UniViewerPixmapWidget // @see header file //--------------------------------------------------------------- UniViewerPixmapWidget::UniViewerPixmapWidget(QGraphicsItem *parent) : - HbIconItem(parent) + HbIconItem(parent), mViewerUtils(0), mThumbnailManager(0) { - mPixmapFile = QString(""); 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))); + } //--------------------------------------------------------------- @@ -45,11 +78,25 @@ // UniViewerPixmapWidget::setPixmap // @see header file //--------------------------------------------------------------- -void UniViewerPixmapWidget::setPixmap(const QString &pixmapPath) +void UniViewerPixmapWidget::populate(UniMessageInfo *info) { - mPixmapFile = pixmapPath; - QPixmap pixmap(pixmapPath); - this->setIcon(HbIcon(pixmap)); + mMimeType = info->mimetype(); + mPixmapPath = info->path(); + if (mMimeType.contains(VIDEO_MIMETYPE)) { + this->setIcon(MSG_VIDEO_ICON); + mThumbnailManager->getThumbnail(mPixmapPath); + this->ungrabGesture(Qt::TapGesture); + } + else if (info->isProtected()) { + this->setIconName(PIXMAP_ICON); + } + else if (info->isCorrupted()) { + this->setIconName(CORRUPTED_PIXMAP_ICON); + } + else { + QPixmap pixmap(mPixmapPath); + this->setIcon(HbIcon(pixmap)); + } } //--------------------------------------------------------------- @@ -70,24 +117,107 @@ case Qt::GestureUpdated: { if (HbTapGesture::TapAndHold == tapGesture->tapStyleHint()) { - // emit longtap + // Handle longtap. + handleLongTap(tapGesture->scenePosition()); } break; } case Qt::GestureFinished: { + HbInstantFeedback::play(HbFeedback::Basic); if (HbTapGesture::Tap == tapGesture->tapStyleHint()) { - // Emit short tap - emit shortTap(mPixmapFile); + // Handle short tap + handleShortTap(); } break; } case Qt::GestureCanceled: { + HbInstantFeedback::play(HbFeedback::Basic); break; } } } + else { + HbIconItem::gestureEvent(event); + } +} + +//--------------------------------------------------------------- +// UniViewerPixmapWidget::handleOpen +// @see header file +//--------------------------------------------------------------- +void UniViewerPixmapWidget::handleOpen() +{ + this->ungrabGesture(Qt::TapGesture); + + if (!mViewerUtils) { + mViewerUtils = new UniViewerUtils(this); + } + mViewerUtils->launchContentViewer(mMimeType, mPixmapPath); + + //fire timer to regrab gesture after some delay. + QTimer::singleShot(300,this,SLOT(regrabGesture())); +} + +//--------------------------------------------------------------- +// UniViewerPixmapWidget::handleSave +// @see header file +//--------------------------------------------------------------- +void UniViewerPixmapWidget::handleSave() +{ +} + +//---------------------------------------------------------------------------- +// UniViewerPixmapWidget::handleShortTap +// @see header file +//---------------------------------------------------------------------------- +void UniViewerPixmapWidget::handleShortTap() +{ + emit shortTap(mPixmapPath); + + // Open the media. + handleOpen(); } +//--------------------------------------------------------------- +// UniViewerPixmapWidget::handleLongTap +// @see header file +//--------------------------------------------------------------- +void UniViewerPixmapWidget::handleLongTap(const QPointF &position) +{ + emit longTap(position); + + HbMenu* menu = new HbMenu; + menu->setAttribute(Qt::WA_DeleteOnClose); + menu->addAction(LOC_OPEN, this, SLOT(handleOpen())); + menu->addAction(LOC_SAVE, this, SLOT(handleSave())); + menu->setPreferredPos(position); + menu->show(); +} + +//--------------------------------------------------------------- +// 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) { + this->setIcon(HbIcon(pixmap)); + this->hide(); + this->updateGeometry(); + } +} // EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univiewertextitem.cpp --- a/messagingapp/msgui/unifiedviewer/src/univiewertextitem.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/src/univiewertextitem.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -21,16 +21,16 @@ #include "msgcontacthandler.h" #include -#include #include #include #include - +#include +#include +#include #include #include -#include #include -#include +#include #include #include @@ -38,11 +38,11 @@ //consts //regexp -const QString NUMBER_PATTERN("(\\(|\\+|\\d)((?:\\d{2,})((?:[\\s-/.\\)\\()])*(?:(\\d+|\\))))*)|((\\*#)(?:\\d+(\\*|#)(?:\\d+#)?))"); +const QString NUMBER_PATTERN("(\\(?(\\+|\\d))((?:\\d)((?:[\\s-/.\\)\\(])*(?:(\\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\\-\\?\\,\'\\/\\\\+&%\\$#_=~]*))+"); +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"); @@ -50,7 +50,7 @@ const QString URL_RULE("URL_RULE"); //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") @@ -68,9 +68,9 @@ this->setReadOnly(true); this->setScrollable(false); this->setCursorVisibility(Hb::TextCursorHidden); + this->setFlag(QGraphicsItem::ItemIsFocusable,false); this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - HbFrameItem *noBackground = new HbFrameItem(this); - this->setBackgroundItem(noBackground); + this->setBackgroundItem(0); //inserting rules and patterns to map. mRules.insert(NUMBER_RULE,NUMBER_PATTERN); @@ -117,6 +117,7 @@ QString ruleName = i.key(); QString rule = i.value(); QRegExp ruleExp(rule); + ruleExp.setCaseSensitivity(Qt::CaseInsensitive); QTextCursor cursor = this->document()->find(ruleExp); @@ -177,38 +178,88 @@ } - -void UniViewerTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +void UniViewerTextItem::gestureEvent(QGestureEvent* event) { - HbTextEdit::mouseReleaseEvent(event); - - highlightText(false); - - QString anchor = this->anchorAt(event->pos()); - - if(!anchor.isEmpty() && !this->textCursor().hasSelection()) + //handle gesture to highlight and dehighlight find item. + + if(HbTapGesture *tap = qobject_cast(event->gesture(Qt::TapGesture))) { - shortTapAction(anchor); + //capturing gesture position, and map to local co-ordinates. + QPointF pos = mapFromScene(tap->scenePosition()); + + switch (tap->state()) + { + case Qt::GestureStarted: + { + //highlight find item. + QTextDocument* doc = this->document(); + mCursorPos = doc->documentLayout()->hitTest(pos, Qt::ExactHit); + highlightText(true); + break; + } + + case Qt::GestureFinished: + { + if (HbTapGesture::Tap == tap->tapStyleHint()) + { + //gesture is finshed dehighlight text. + highlightText(false); + + QString anchor = this->anchorAt(pos); + + //do short tap action. + if (!anchor.isEmpty() && !this->textCursor().hasSelection()) + { + handleShortTap(anchor,tap->scenePosition()); + } + } + break; + } + + case Qt::GestureCanceled: + { + //gesture is canceled due to pan or swipe, dehighlight text. + if (HbTapGesture::Tap == tap->tapStyleHint()) + { + highlightText(false); + break; + } + } + default: + break; + } + event->accept(); } -} - -void UniViewerTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - HbTextEdit::mousePressEvent(event); - - QTextDocument* doc = this->document(); - - mCursorPos = doc->documentLayout()->hitTest(event->pos(), Qt::ExactHit); - - highlightText(true); + else + { + event->ignore(); + } + + //passing gesture event to base class. + HbTextEdit::gestureEvent(event); } void UniViewerTextItem::addNumberMenu(HbMenu* contextMenu,const QString& data) { HbAction* action = NULL; - action = contextMenu->addAction(LOC_OPEN_CONTACT_INFO, this, SLOT(openContactInfo())); - action->setData(data); + QString number = data; + number.remove(NUMBER_RULE); + int contactId = MsgContactHandler::resolveContactDisplayName( + number, + 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(data); + } action = contextMenu->addAction(LOC_CALL, this, SLOT(call())); action->setData(data); @@ -216,9 +267,6 @@ action = contextMenu->addAction(LOC_SEND_MESSAGE, this, SLOT(sendMessage())); action->setData(data); - action = contextMenu->addAction(LOC_SAVE_TO_CONTACTS, this, SLOT(saveToContacts())); - action->setData(data); - action = contextMenu->addAction(LOC_COPY, this, SLOT(copyToClipboard())); action->setData(data); } @@ -230,7 +278,7 @@ action = contextMenu->addAction(LOC_CREATE_EMAIL, this, SLOT(createEmail())); action->setData(data); - action = contextMenu->addAction(LOC_OPEN_CONTACT_INFO, this, SLOT(openContactInfo())); + action = contextMenu->addAction(LOC_CONTACT_INFO, this, SLOT(openContactInfo())); action->setData(data); action = contextMenu->addAction(LOC_SAVE_TO_CONTACTS, this, SLOT(saveToContacts())); @@ -254,15 +302,40 @@ action->setData(data); } -void UniViewerTextItem::shortTapAction(QString anchor) +void UniViewerTextItem::handleShortTap(QString anchor,const QPointF& pos) { HbAction action; action.setData(anchor); if(anchor.contains(NUMBER_RULE)) { - //open vcard template. - connect(&action,SIGNAL(triggered()),this,SLOT(openContactInfo())); + QString data = anchor; + data.remove(NUMBER_RULE); + int contactId = MsgContactHandler::resolveContactDisplayName( + data, + 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); + connect(contextMenu,SIGNAL(aboutToClose()),this,SLOT(menuClosed())); + + addNumberMenu(contextMenu,anchor); + + contextMenu->show(); + } } else if(anchor.contains(EMAIL_RULE)) { @@ -308,7 +381,7 @@ phoneNumber.remove(NUMBER_RULE); //invoke dialer service and pass phoneNumber. - QString serviceName("com.nokia.services.telephony"); + QString serviceName("com.nokia.symbian.ICallDial"); QString operation("dial(QString)"); XQServiceRequest* serviceRequest = new XQServiceRequest(serviceName,operation,false); @@ -348,11 +421,10 @@ emailId.remove(EMAIL_RULE); // Launch email editor - QString serviceName("com.nokia.services.commonemail"); - QString interfaceName("imessage.send"); + QString interfaceName("com.nokia.symbian.IEmailMessageSend"); QString operation("send(QVariant)"); XQApplicationManager appManager; - XQAiwRequest* request = appManager.create(serviceName, interfaceName, + XQAiwRequest* request = appManager.create(interfaceName, operation, true); if ( request == NULL ) { @@ -390,6 +462,8 @@ QString url = action->data().toString(); url.remove(URL_RULE); //invoke browser service & pass url. + QUrl uri(url); + QDesktopServices::openUrl(uri); } } @@ -496,7 +570,7 @@ void UniViewerTextItem::saveToContacts() { - //handler for save to contacts. + openContactInfo(); } void UniViewerTextItem::onServiceRequestCompleted() diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univiewerutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/unifiedviewer/src/univiewerutils.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Utility class for univiewer. + * + */ + +#include "univiewerutils.h" + +// SYSTEM INCLUDES +#include +#include +#include +#include + +// USER INCLUDES +#include "msgcontactsutil.h" + +// LOCAL CONSTANTS +#define LOC_TITLE hbTrId("txt_messaging_title_messaging") + +const QString IMAGE_MIMETYPE("image"); +const QString AUDIO_MIMETYPE("audio"); +const QString VCARD_MIMETYPE("text/X-vCard"); +const QString VIDEO_MIMETYPE("video"); + +//--------------------------------------------------------------- +// UniViewerUtils::UniViewerUtils +// @see header file +//--------------------------------------------------------------- +UniViewerUtils::UniViewerUtils(QObject *parent) : + QObject(parent) +{ +} + +//--------------------------------------------------------------- +// UniViewerUtils::~UniViewerUtils +// @see header file +//--------------------------------------------------------------- +UniViewerUtils::~UniViewerUtils() +{ +} + +//--------------------------------------------------------------- +// UniViewerUtils::addAttachmentWidget +// @see header file +//--------------------------------------------------------------- +void UniViewerUtils::launchContentViewer(const QString &mimeType, const QString &filePath) +{ + if (mimeType.contains(IMAGE_MIMETYPE) || mimeType.contains(AUDIO_MIMETYPE) || + mimeType.contains(VIDEO_MIMETYPE)) { + launchViaSharableFile(filePath); + } + else if (mimeType.contains(VCARD_MIMETYPE, Qt::CaseInsensitive)) { + MsgContactsUtil::launchVCardViewer(filePath); + } +} + +//--------------------------------------------------------------- +// UniViewerUtils::handleOk +// @see header file +//--------------------------------------------------------------- +void UniViewerUtils::handleOk(const QVariant& result) +{ + emit requestOk(result); +} + +//--------------------------------------------------------------- +// UniViewerUtils::handleError +// @see header file +//--------------------------------------------------------------- +void UniViewerUtils::handleError(int errorCode, const QString& errorMessage) +{ + emit requestError(errorCode, errorMessage); +} + +//--------------------------------------------------------------- +// UniViewerUtils::launchViaSharableFile +// @see header file +//--------------------------------------------------------------- +void UniViewerUtils::launchViaSharableFile(const QString &filePath) +{ + XQSharableFile sf; + XQAiwRequest* request = 0; + + if (!sf.open(filePath)) { + return; + } + + // Get handlers + XQApplicationManager appManager; + QList fileHandlers = appManager.list(sf); + if (fileHandlers.count() > 0) { + XQAiwInterfaceDescriptor d = fileHandlers.first(); + request = appManager.create(sf, d); + + if (!request) { + sf.close(); + return; + } + } + else { + sf.close(); + return; + } + + // Result handlers + connect(request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&)), + Qt::UniqueConnection); + connect(request, SIGNAL(requestError(int,const QString&)), this, + SLOT(handleError(int,const QString&)), Qt::UniqueConnection); + + request->setEmbedded(true); + request->setSynchronous(true); + + // Fill args + QList args; + args << qVariantFromValue(sf); + request->setArguments(args); + + // Fill headers + QString key("WindowTitle"); + QVariant value(QString(LOC_TITLE)); + XQRequestInfo info; + info.setInfo(key, value); + request->setInfo(info); + + request->send(); + + // Cleanup + sf.close(); + delete request; +} + +//EOF diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/src/univiewslidewidget.cpp --- a/messagingapp/msgui/unifiedviewer/src/univiewslidewidget.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/src/univiewslidewidget.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -53,7 +53,7 @@ mHeaderContainer = new UniViewerHeaderContainer(mViewFeeder, this); // Always connect to populate sms content - connect(mViewFeeder, SIGNAL(msgBody(QString)), mBody, SLOT(setTextContent(QString))); + connect(mViewFeeder, SIGNAL(msgBody(QString)), mBody, SLOT(setText(QString))); connect(mHeaderContainer,SIGNAL(sendMessage(const QString&,const QString&)), this, SIGNAL(sendMessage(const QString&,const QString&))); @@ -105,8 +105,7 @@ if (mViewFeeder->msgType() == KSenduiMtmMmsUidValue) { QString slideString; if (mViewFeeder->slideCount() > 1) { - slideString = QString(LOC_SLIDE_COUNTER).arg(mSlideNumber + 1).arg( - mViewFeeder->slideCount()); + slideString = (LOC_SLIDE_COUNTER).arg(mSlideNumber + 1).arg(mViewFeeder->slideCount()); } mBody->setSlideContents(mViewFeeder->slideContent(mSlideNumber), slideString); } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/unifiedviewer.pro --- a/messagingapp/msgui/unifiedviewer/unifiedviewer.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/unifiedviewer.pro Thu Jul 22 16:32:06 2010 +0100 @@ -25,7 +25,6 @@ INCLUDEPATH += ../appengine/inc INCLUDEPATH += ../msguiutils/inc INCLUDEPATH += . ../../msgutils/unieditorutils/editorgenutils/inc -INCLUDEPATH += . ../../msgutils/s60qconversions/inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE #QMAKE_CXXFLAGS.ARMCC -= --no_hide_all @@ -49,47 +48,55 @@ "$${LITERAL_HASH}include " \ "rom/unifiedviewer.iby CORE_APP_LAYER_IBY_EXPORT_PATH(unifiedviewer.iby)" +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/unifiedviewer.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/unifiedviewer.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + # Input HEADERS += inc/unifiedviewer.h \ inc/unicontentswidget.h \ -# inc/unihighlighter.h \ inc/univiewerfeeder.h \ inc/univiewerfeeder_p.h \ inc/univiewslidewidget.h \ inc/uniscrollarea.h \ ../inc/msgbaseview.h \ + inc/univiewerutils.h \ inc/univiewerbodywidget.h \ inc/univiewerdetailswidget.h \ inc/univieweraddresswidget.h \ inc/univieweraddresscontainer.h \ - inc/univiewermediawidget.h \ - inc/univiewerattachmentcontainer.h \ + inc/univiewerattachmentwidget.h \ inc/univiewertextitem.h \ inc/univiewerheadercontainer.h \ - inc/univiewerpixmapwidget.h + inc/univiewerpixmapwidget.h \ + inc/univieweraudiowidget.h SOURCES += src/unifiedviewer.cpp \ src/unicontentswidget.cpp \ -# src/unihighlighter.cpp \ src/univiewerfeeder.cpp \ src/univiewerfeeder_p.cpp \ src/univiewslidewidget.cpp \ src/uniscrollarea.cpp \ + src/univiewerutils.cpp \ src/univiewerbodywidget.cpp \ src/univiewerdetailswidget.cpp \ src/univieweraddresswidget.cpp \ src/univieweraddresscontainer.cpp \ - src/univiewermediawidget.cpp \ - src/univiewerattachmentcontainer.cpp \ + src/univiewerattachmentwidget.cpp \ src/univiewertextitem.cpp \ src/univiewerheadercontainer.cpp \ - src/univiewerpixmapwidget.cpp + src/univiewerpixmapwidget.cpp \ + src/univieweraudiowidget.cpp RESOURCES += unifiedviewer.qrc # Libs -LIBS = -ls60qconversions \ - -letext \ +LIBS = -letext \ -lmsgs \ -lconvergedmessageutils \ -lappengine \ @@ -98,4 +105,5 @@ -lQtContacts \ -lmsguiutils \ -lcentralrepository \ + -lthumbnailmanagerqt \ -lxqserviceutil diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgui/unifiedviewer/unifiedviewer.qrc --- a/messagingapp/msgui/unifiedviewer/unifiedviewer.qrc Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgui/unifiedviewer/unifiedviewer.qrc Thu Jul 22 16:32:06 2010 +0100 @@ -6,8 +6,8 @@ resources/layouts/univiewerdetailswidget.css resources/layouts/univiewerdetailswidget_color.css resources/layouts/univiewerdetailswidget.widgetml - resources/layouts/univiewermediawidget.css - resources/layouts/univiewermediawidget_color.css - resources/layouts/univiewermediawidget.widgetml + resources/layouts/univiewerattachmentwidget.css + resources/layouts/univiewerattachmentwidget_color.css + resources/layouts/univiewerattachmentwidget.widgetml diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/bwins/convergedmessageutilsu.def diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/bwins/s60qconversionsu.def --- a/messagingapp/msgutils/bwins/s60qconversionsu.def Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -EXPORTS - ?qStringToS60Desc@S60QConversions@@SAPAVHBufC16@@ABVQString@@@Z @ 1 NONAME ; class HBufC16 * S60QConversions::qStringToS60Desc(class QString const &) - ?s60DescToQString@S60QConversions@@SA?AVQString@@ABVTDesC16@@@Z @ 2 NONAME ; class QString S60QConversions::s60DescToQString(class TDesC16 const &) - ?s60Desc8ToQString@S60QConversions@@SA?AVQString@@ABVTDesC8@@@Z @ 3 NONAME ; class QString S60QConversions::s60Desc8ToQString(class TDesC8 const &) - ?qStringToS60Desc8@S60QConversions@@SAPAVHBufC8@@ABVQString@@@Z @ 4 NONAME ; class HBufC8 * S60QConversions::qStringToS60Desc8(class QString const &) - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/convergedmessageutils.pro --- a/messagingapp/msgutils/convergedmessageutils/convergedmessageutils.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/convergedmessageutils/convergedmessageutils.pro Thu Jul 22 16:32:06 2010 +0100 @@ -47,6 +47,15 @@ "$${LITERAL_HASH}include " \ "rom/convergedmessageutils.iby CORE_APP_LAYER_IBY_EXPORT_PATH(convergedmessageutils.iby)" +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/convergedmessageutils.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/convergedmessageutils.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + symbian { TARGET.UID3 = 0x20024319 TARGET.CAPABILITY = CAP_GENERAL_DLL diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/inc/convergedmessageimpl.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/src/convergedmessage.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/src/convergedmessageimpl.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmsreadfile.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmsreadfile.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include +#include + +// 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 iValueBuffer; + CDesCArray* iAliasArray; // aliases + HBufC8* iByteBuffer; + TTime iDate; + CArrayPtrFlat* iAttaStructures; + TInt iAttaCount; + TInt iAttaRoot; + TInt iAliasCount; + TInt iNextMessageType; + TParse iParse; + TFileName iFilename; + + protected: // Data + private: // Data + + // CArrayFixFlat * 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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmstestbed.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmstestbed.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include + +#include //for consts like KMsvNullIndexEntryIdValue +#include +#include +#include +//#include + +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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmstestbed.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmstestbed.hrh Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#include + + +#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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmsteststaticutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmsteststaticutils.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include + +#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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmstestuitimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmstestuitimer.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 + +#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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/mmstestbed.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/mmstestbed.pro Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,76 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +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 " + +LIBS += -lmsgs \ + -lmmsmessage \ + -lmmsconninit \ + -lmmscodec \ + -lmmsserversettings \ + -lcentralrepository \ + -lapparc \ + -lbafl \ + -lefsrv \ + -lesock \ + -lestor \ + -leuser \ + -llogcli \ + -llogwrap \ + -lapgrfx \ + -lapmime diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmsreadfile.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmsreadfile.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include +#include +#include +#include +//#include +#include +#include +#include + +#include +#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( 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 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 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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmstestbed.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmstestbed.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#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 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 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 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 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 + } + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmsteststaticutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmsteststaticutils.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include +#include +#include + +#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 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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmstestuitimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmstestuitimer.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -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 ======== + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/inc/testconvergedmessageutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/inc/testconvergedmessageutils.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include + +//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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/inc/testconvergedmessageutils.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/inc/testconvergedmessageutils.ini Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: 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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/src/testconvergedmessageutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/src/testconvergedmessageutils.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,343 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 +#include +#include +#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"); + + //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(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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/testconvergedmessageutils.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/testconvergedmessageutils.cfg Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,1 @@ +TestConvergedMessageUtils \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/testconvergedmessageutils.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/testconvergedmessageutils.pl Thu Jul 22 16:32:06 2010 +0100 @@ -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: 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 "\n"; + printf MYFILE "$passed\n"; + printf MYFILE "\n"; + + if($failed > 0) + { + printf MYFILE "\n"; + printf MYFILE "$failed\n"; + printf MYFILE "\n"; + } + else + { + printf MYFILE "\n"; + printf MYFILE "$failed\n"; + printf MYFILE "\n"; + } + + printf MYFILE "\n"; + printf MYFILE "$skipped\n"; + printf MYFILE "\n"; + + printf MYFILE "\n"; + printf MYFILE "$total\n"; + printf MYFILE "\n"; + + printf MYFILE "\n"; + printf MYFILE ("$passrateround %%\n"); + printf MYFILE "\n"; + + printf MYFILE "\n"; + printf MYFILE "$runrateround %%\n"; + printf MYFILE "\n"; + + +} + +sub parse_file + { + my $pattern = "Totals"; + my $file = $_[0]; + open (FILE,$file); + + while (my $line= ) + { + 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 "\n"; + printf MYFILE "\n"; + printf MYFILE "\n"; + printf MYFILE "ConvergedMessageUtils Test Reports"; + printf MYFILE "\n"; + printf MYFILE "

ConvergedMessageUtils Test Report

\n"; + printf MYFILE "\n"; + printf MYFILE "\n"; + printf MYFILE "\n"; + printf MYFILE "\n"; + printf MYFILE "\n"; + printf MYFILE "\n"; + printf MYFILE "\n"; + printf MYFILE "\n"; + printf MYFILE "\n"; + printf MYFILE "\n"; + + + my @files = ; + 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 "\n"; + printf MYFILE "\n"; + + parse_file $file; + + printf MYFILE "\n"; + } + + printf MYFILE "\n"; + printf MYFILE "\n"; + + + printf MYFILE "\n"; + + printf MYFILE "\n"; + + printf MYFILE "\n"; + + printf MYFILE "\n"; + + my $passrate = $TOTALPASSED*100/$TOTALCASES; + my $passrateround = sprintf("%.0f",$passrate); + printf MYFILE "\n"; + + my $runrate = ($TOTALCASES - $TOTALSKIPPED)*100/$TOTALCASES; + my $runrateround = sprintf("%.0f",$runrate); + printf MYFILE "\n"; + + printf MYFILE "\n"; + + printf MYFILE "
ModulePassedFailedSkippedTotal CasesPass RateRun Rate
\n"; + printf MYFILE "$name\n"; + printf MYFILE "
\n"; + printf MYFILE "Overall\n"; + printf MYFILE "\n"; + printf MYFILE "$TOTALPASSED\n"; + printf MYFILE "\n"; + printf MYFILE "$TOTALFAILED\n"; + printf MYFILE "\n"; + printf MYFILE "$TOTALSKIPPED\n"; + printf MYFILE "\n"; + printf MYFILE "$TOTALCASES\n"; + printf MYFILE "\n"; + printf MYFILE "$passrateround%%\n"; + printf MYFILE "\n"; + printf MYFILE "$runrateround%%\n"; + printf MYFILE "
\n"; + printf MYFILE "\n"; + printf MYFILE "\n"; + + close (MYFILE); + } + + +generate_report; \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/testconvergedmessageutils.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/testconvergedmessageutils.pro Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,103 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: 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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/convergedmessageutils/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/tsrc.pro Thu Jul 22 16:32:06 2010 +0100 @@ -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 both MMSTestBed and TestConvergedMessageUtils +# + +TEMPLATE = subdirs + +SUBDIRS += mmstestbed/mmstestbed.pro +SUBDIRS += testconvergedmessageutils/testconvergedmessageutils.pro + +CONFIG += ordered \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/eabi/convergedmessageutilsu.def diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/eabi/s60qconversionsu.def --- a/messagingapp/msgutils/eabi/s60qconversionsu.def Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -EXPORTS - _ZN15S60QConversions16qStringToS60DescERK7QString @ 1 NONAME - _ZN15S60QConversions16s60DescToQStringERK7TDesC16 @ 2 NONAME - _ZN15S60QConversions17qStringToS60Desc8ERK7QString @ 3 NONAME - _ZN15S60QConversions17s60Desc8ToQStringERK6TDesC8 @ 4 NONAME - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/msgutils.pro --- a/messagingapp/msgutils/msgutils.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/msgutils.pro Thu Jul 22 16:32:06 2010 +0100 @@ -20,7 +20,6 @@ SYMBIAN_PLATFORMS = WINSCW ARMV5 -SUBDIRS += s60qconversions/s60qconversions.pro SUBDIRS += convergedmessageutils/convergedmessageutils.pro SUBDIRS += unieditorutils/unieditorutils.pro SUBDIRS += unidatautils/unidatautils.pro \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/s60qconversions/bwins/s60qconversionsu.def --- a/messagingapp/msgutils/s60qconversions/bwins/s60qconversionsu.def Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -EXPORTS - ?qStringToS60Desc8@S60QConversions@@SAPAVHBufC8@@ABVQString@@@Z @ 1 NONAME ; class HBufC8 * S60QConversions::qStringToS60Desc8(class QString const &) - ?qStringToS60Desc@S60QConversions@@SAPAVHBufC16@@ABVQString@@@Z @ 2 NONAME ; class HBufC16 * S60QConversions::qStringToS60Desc(class QString const &) - ?s60Desc8ToQString@S60QConversions@@SA?AVQString@@ABVTDesC8@@@Z @ 3 NONAME ; class QString S60QConversions::s60Desc8ToQString(class TDesC8 const &) - ?s60DescToQString@S60QConversions@@SA?AVQString@@ABVTDesC16@@@Z @ 4 NONAME ; class QString S60QConversions::s60DescToQString(class TDesC16 const &) - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/s60qconversions/inc/s60qconversiondefines.h --- a/messagingapp/msgutils/s60qconversions/inc/s60qconversiondefines.h Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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: Global DLL defines - * -*/ - - -#ifndef S60QCONV_DEFINES_H -#define S60QCONV_DEFINES_H - -#include - -#ifdef BUILD_S60QCONV_DLL -#define S60QCONV_EXPORT Q_DECL_EXPORT -#else -#define S60QCONV_EXPORT Q_DECL_IMPORT -#endif - -#endif // S60QCONV_DEFINES_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/s60qconversions/inc/s60qconversions.h --- a/messagingapp/msgutils/s60qconversions/inc/s60qconversions.h Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +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 S60QCONVERSIONS -#define S60QCONVERSIONS - -#include -#include -#include "s60qconversiondefines.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class S60QCONV_EXPORT S60QConversions - { - public: - static QString s60DescToQString(const TDesC& desc); - static HBufC* qStringToS60Desc(const QString& string); - static QString s60Desc8ToQString(const TDesC8& desc); - static HBufC8* qStringToS60Desc8(const QString& string); - }; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // S60QCONVERSIONS - -// End of file - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/s60qconversions/rom/s60qconversions.iby --- a/messagingapp/msgutils/s60qconversions/rom/s60qconversions.iby Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef __S60QCONVERSIONS_IBY__ -#define __S60QCONVERSIONS_IBY__ - -REM DLL -file=ABI_DIR\UREL\s60qconversions.dll SHARED_LIB_DIR\s60qconversions.dll - -#endif // __S60QCONVERSIONS_IBY__ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/s60qconversions/s60qconversions.pro --- a/messagingapp/msgutils/s60qconversions/s60qconversions.pro Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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: -# - -TEMPLATE = lib -TARGET = s60qconversions -DEPENDPATH += . inc src -INCLUDEPATH += . -INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE - -DEFINES += BUILD_S60QCONV_DLL -#QMAKE_CXXFLAGS.ARMCC -= --no_hide_all - -# UID3 -TARGET.UID3 = 0x2001FE7B - -# Capability -TARGET.CAPABILITY = CAP_GENERAL_DLL - -TARGET.EPOCALLOWDLLDATA = 1 - -# Platforms -SYMBIAN_PLATFORMS = WINSCW ARMV5 - -# Build.inf rules -BLD_INF_RULES.prj_exports += \ - "$${LITERAL_HASH}include " \ - "rom/s60qconversions.iby CORE_APP_LAYER_IBY_EXPORT_PATH(s60qconversions.iby)" - -# Input -HEADERS += inc/s60qconversions.h -SOURCES += src/s60qconversions.cpp - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/s60qconversions/src/s60qconversions.cpp --- a/messagingapp/msgutils/s60qconversions/src/s60qconversions.cpp Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +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 "s60qconversions.h" -#include "utf.h" - -/*! - \class S60QConversions - \brief S60QConversions class offers functions for converting Symbian/Series60 data types to Qt data types and vice versa. - */ - - -/*! - Converts Symbian/Series60 descriptor (string) to QString - - \param desc descriptor to be converted - \return QString containing converted string - */ -QString S60QConversions::s60DescToQString(const TDesC& desc) - { - return QString::fromUtf16(desc.Ptr(),desc.Length()); - } - -/*! - Converts QString to Symbian/Series60 descriptor (string). - Note: Ownership of returned descriptor (string) is transferred to caller - - \param string QString to be converted - \return pointer to Symbian/Series60 descriptor on success; - otherwise returns NULL pointer - */ -HBufC* S60QConversions::qStringToS60Desc(const QString& string) - { - TPtrC16 str(reinterpret_cast(string.utf16())); - return str.Alloc(); - } - -/*! - Converts Symbian/Series60 8 bit descriptor (UTF8 string) to QString - - \param desc 8 bit descriptor to be converted - \return QString on success; otherwise returns null QString - */ -QString S60QConversions::s60Desc8ToQString(const TDesC8& desc) - { - QString qtString; - HBufC* s60str = NULL; - TRAPD(error, s60str = CnvUtfConverter::ConvertToUnicodeFromUtf8L(desc)); - if (error == KErrNone) { - qtString = QString::fromUtf16(s60str->Ptr(),s60str->Length()); - delete s60str; - } - return qtString; - } - -/*! - Converts QString to Symbian/Series60 8 bit descriptor (UTF8 string). - Note: Ownership of returned descriptor (string) is transferred to caller - - \param string QString to be converted - \return pointer to UTF8 string in Symbian/Series60 descriptor on success; - otherwise returns NULL pointer - */ -HBufC8* S60QConversions::qStringToS60Desc8(const QString& string) - { - TPtrC16 str(reinterpret_cast(string.utf16())); - HBufC8* s60str = NULL; - TRAPD(error, s60str = CnvUtfConverter::ConvertFromUnicodeToUtf8L(str)); - if (error != KErrNone) { - return NULL; - } - return s60str; - } - -// End of file - - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/s60qconversions/tsrc/ut/bwins/t_s60qconversionsu.def --- a/messagingapp/msgutils/s60qconversions/tsrc/ut/bwins/t_s60qconversionsu.def Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -EXPORTS - ?Tests60DescToQString@TestS60QConversions@@AAEXXZ @ 1 NONAME ; void TestS60QConversions::Tests60DescToQString(void) - ?TestqStringToS60Desc@TestS60QConversions@@AAEXXZ @ 2 NONAME ; void TestS60QConversions::TestqStringToS60Desc(void) - ?staticMetaObject@TestS60QConversions@@2UQMetaObject@@B @ 3 NONAME ; struct QMetaObject const TestS60QConversions::staticMetaObject - ?tr@TestS60QConversions@@SA?AVQString@@PBD0@Z @ 4 NONAME ; class QString TestS60QConversions::tr(char const *, char const *) - ?qt_metacall@TestS60QConversions@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 5 NONAME ; int TestS60QConversions::qt_metacall(enum QMetaObject::Call, int, void * *) - ?getStaticMetaObject@TestS60QConversions@@SAABUQMetaObject@@XZ @ 6 NONAME ; struct QMetaObject const & TestS60QConversions::getStaticMetaObject(void) - ?metaObject@TestS60QConversions@@UBEPBUQMetaObject@@XZ @ 7 NONAME ; struct QMetaObject const * TestS60QConversions::metaObject(void) const - ?qt_metacast@TestS60QConversions@@UAEPAXPBD@Z @ 8 NONAME ; void * TestS60QConversions::qt_metacast(char const *) - ?initTestCase@TestS60QConversions@@AAEXXZ @ 9 NONAME ; void TestS60QConversions::initTestCase(void) - ?cleanupTestCase@TestS60QConversions@@AAEXXZ @ 10 NONAME ; void TestS60QConversions::cleanupTestCase(void) - ?Tests60Desc8ToQString@TestS60QConversions@@AAEXXZ @ 11 NONAME ; void TestS60QConversions::Tests60Desc8ToQString(void) - ?trUtf8@TestS60QConversions@@SA?AVQString@@PBD0@Z @ 12 NONAME ; class QString TestS60QConversions::trUtf8(char const *, char const *) - ?TestqStringToS60Desc8@TestS60QConversions@@AAEXXZ @ 13 NONAME ; void TestS60QConversions::TestqStringToS60Desc8(void) - ?trUtf8@TestS60QConversions@@SA?AVQString@@PBD0H@Z @ 14 NONAME ; class QString TestS60QConversions::trUtf8(char const *, char const *, int) - ?tr@TestS60QConversions@@SA?AVQString@@PBD0H@Z @ 15 NONAME ; class QString TestS60QConversions::tr(char const *, char const *, int) - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/s60qconversions/tsrc/ut/ut_s60qconversions/t_s60qconversions.cpp --- a/messagingapp/msgutils/s60qconversions/tsrc/ut/ut_s60qconversions/t_s60qconversions.cpp Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +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 -#include -#include -#include - - -void TestS60QConversions::initTestCase() -{ - - mS60QConversions=0; -} - - -void TestS60QConversions::Tests60DescToQString() -{ - HBufC* temp = HBufC::NewLC(10); - temp->Des().Copy(_L("Sometext")); - - QString text= S60QConversions::s60DescToQString(temp->Des()); - QVERIFY(text==QString("Sometext")); - CleanupStack::PopAndDestroy(temp); - -} - -void TestS60QConversions::TestqStringToS60Desc() -{ - QString str ="ExampleText"; - HBufC* s60text = S60QConversions::qStringToS60Desc(str); - QVERIFY(str==QString("ExampleText")); - -} - -void TestS60QConversions::Tests60Desc8ToQString() -{ - HBufC8* temp = HBufC8::NewLC(10); - temp->Des().Copy(_L("Sometext")); - - QString text= S60QConversions::s60Desc8ToQString(temp->Des() ); - QVERIFY(text==QString("Sometext")); - - CleanupStack::PopAndDestroy(temp); -} - -void TestS60QConversions::TestqStringToS60Desc8() -{ - QString str ="ExampleText"; - _LIT8(qStr8,"ExampleText"); - HBufC8* s60text = S60QConversions::qStringToS60Desc8(str); - QVERIFY(s60text->Des() == qStr8); - -} - -void TestS60QConversions::cleanupTestCase() -{ - delete mS60QConversions; -} - - - - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/s60qconversions/tsrc/ut/ut_s60qconversions/t_s60qconversions.h --- a/messagingapp/msgutils/s60qconversions/tsrc/ut/ut_s60qconversions/t_s60qconversions.h Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* 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: -* -*/ -#ifndef T_S60QCONVERSIONS_H -#define T_S60QCONVERSIONS_H - - -#ifdef BUILD_TEST_DLL -#define TEST_EXPORT Q_DECL_EXPORT -#else -#define TEST_EXPORT Q_DECL_IMPORT -#endif - - -#include -#include "s60qconversions.h" - - -class TEST_EXPORT TestS60QConversions: public QObject -{ - Q_OBJECT - -private slots: - - void initTestCase(); - - void Tests60DescToQString(); - - void TestqStringToS60Desc(); - - void Tests60Desc8ToQString(); - - void TestqStringToS60Desc8(); - - void cleanupTestCase(); - - -private: - - S60QConversions* mS60QConversions; -}; - -#endif //TEST_S60QCONVERSIONS_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/s60qconversions/tsrc/ut/ut_s60qconversions/t_s60qconversions.pro --- a/messagingapp/msgutils/s60qconversions/tsrc/ut/ut_s60qconversions/t_s60qconversions.pro Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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 - -TEMPLATE = lib -TARGET = - - -INCLUDEPATH += . - -INCLUDEPATH += ../../../../../inc -INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE -INCLUDEPATH += ../../../inc - - - -DEFINES += BUILD_TEST_DLL -HEADERS += \ - t_s60qconversions.h - -SOURCES += \ - t_s60qconversions.cpp - -SYMBIAN_PLATFORMS = WINSCW ARMV5 -symbian { - TARGET.CAPABILITY = CAP_GENERAL_DLL - TARGET.EPOCSTACKSIZE = 0x8000 - TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000 - TARGET.EPOCALLOWDLLDATA = 1 - } -LIBS+= -ls60qconversions - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodel/inc/UniDataModel.inl diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodel/inc/UniSmilModel.inl diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodel/src/UniDataModel.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodel/src/UniDataUtils.cpp --- a/messagingapp/msgutils/unidatautils/unidatamodel/src/UniDataUtils.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodel/src/UniDataUtils.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -36,7 +36,7 @@ #include // for StringLoader (load and foramt strings from resources) #include -#include // Viewer/Editor Mimetype strings +#include // Viewer/Editor Mimetype strings #include "UniModelConst.h" #include "UniDataUtils.h" diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodel/src/UniObjectList.cpp --- a/messagingapp/msgutils/unidatautils/unidatamodel/src/UniObjectList.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodel/src/UniObjectList.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -323,7 +323,7 @@ TUriParser8 parser; if( !url8bit ) { - return; + return NULL; } if( aUrl.MatchF( KContentIdString ) == 0 ) diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilModel.cpp --- a/messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilModel.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilModel.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -59,7 +59,7 @@ // MsgDataUTILS -#include // Viewer/Editor Mimetype strings +#include // Viewer/Editor Mimetype strings #include "UniModelConst.h" // Definitions and enums #include "UniDataUtils.h" #include "UniSmilSlide.h" diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilParams.cpp --- a/messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilParams.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilParams.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -25,7 +25,7 @@ #include #include -#include +#include #include "UniSmil.hrh" #include "UniSmilParams.h" diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodel/unidatamodel.pro --- a/messagingapp/msgutils/unidatautils/unidatamodel/unidatamodel.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodel/unidatamodel.pro Thu Jul 22 16:32:06 2010 +0100 @@ -32,7 +32,6 @@ INCLUDEPATH += inc INCLUDEPATH += ../../../../inc INCLUDEPATH += /s60/app/messaging/inc -INCLUDEPATH += ../s60qconversions/inc INCLUDEPATH += ../../unieditorutils/editorgenutils/inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE @@ -53,6 +52,15 @@ MMP_RULES += "TARGETPATH resource" MMP_RULES += "RESOURCE UniDataModel.rss" +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/unidatamodel.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/unidatamodel.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + SOURCES += inc/UniDataUtils.inl \ src/UniDataUtils.cpp \ inc/UniDataModel.inl \ @@ -116,7 +124,6 @@ -lcaf \ -lDrmServerInterfaces \ -lmsgcommonutils \ - -ls60qconversions \ -lQtCore \ -leditorgenutils diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelloader/unidatamodelloader.pro --- a/messagingapp/msgutils/unidatautils/unidatamodelloader/unidatamodelloader.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelloader/unidatamodelloader.pro Thu Jul 22 16:32:06 2010 +0100 @@ -50,6 +50,15 @@ MMP_RULES += "SOURCEPATH ." +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/unidatamodelloader.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/unidatamodelloader.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + SOURCES += src/unidatamodelloader.cpp LIBS += -lQtCore diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/rom/unibiomessagedataplugin.iby --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/rom/unibiomessagedataplugin.iby Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/rom/unibiomessagedataplugin.iby Thu Jul 22 16:32:06 2010 +0100 @@ -18,7 +18,6 @@ #define __UNI_BIO_MESSAGE_DATA_PLUGIN_IBY__ -# this is the plugin stub for QT plugin file=ABI_DIR\UREL\unibiomessagedataplugin.dll SHARED_LIB_DIR\unibiomessagedataplugin.dll data=\epoc32\data\z\resource\qt\plugins\messaging\datamodel\unibiomessagedataplugin.qtplugin \resource\qt\plugins\messaging\datamodel\unibiomessagedataplugin.qtplugin diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin.cpp --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -18,7 +18,7 @@ //SYSTEM INCLUDES #include #include -#include +#include //USER INCLUDES #include "unibiomessagedataplugin.h" @@ -122,6 +122,12 @@ { RFile file = d_ptr->attachmentL(); + if(attachmentCount() == 0) + { + file.Close(); + return QList (); + } + UniMessageInfoList attlist; QString path; @@ -132,7 +138,7 @@ User::LeaveIfError(file.FullName(fullName)); User::LeaveIfError(file.Size(size)); - path = S60QConversions::s60DescToQString(*fullName.AllocL()); + path = XQConversions::s60DescToQString(*fullName.AllocL()); UniMessageInfo *msgobj = new UniMessageInfo(path, size, mimetype); attlist << msgobj; @@ -170,7 +176,11 @@ //--------------------------------------------------------------- bool UniBioMessageDataPlugin::hasAttachment() { - return true; + if(attachmentCount() > 0) + return true; + else + return false; + } // UniBioMessageDataPlugin::objectCount() diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin_p.cpp --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin_p.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin_p.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -30,9 +30,9 @@ #include "debugtraces.h" #include -#include +#include #include - +#include #include "convergedmessage.h" #include "convergedmessageaddress.h" #include "unibiomessagedataplugin_p.h" @@ -49,8 +49,17 @@ UniBioMessageDataPluginPrivate::~UniBioMessageDataPluginPrivate() { q_ptr = NULL; - if (iMsvEntry) + + if(attachmentProcessed == EFalse && iAttachmentCount == 1) { + CMsvStore* store = iMsvEntry->EditStoreL(); + CleanupStack::PushL(store); + MMsvAttachmentManagerSync& attachMan = store->AttachmentManagerExtensionsL(); + attachMan.RemoveAttachmentL(0); + CleanupStack::PopAndDestroy(); + } + + if (iMsvEntry) { delete iMsvEntry; } @@ -141,7 +150,7 @@ HBufC* buf = HBufC::NewL(len); TPtr bufPtr = buf->Des(); textBody.ExtractSelectively(bufPtr, 0, len, CPlainText::EExtractAll); - aBodyText = S60QConversions::s60DescToQString(*buf); + aBodyText = XQConversions::s60DescToQString(*buf); delete buf; } @@ -183,8 +192,8 @@ ConvergedMessageAddress * messageAddress = - new ConvergedMessageAddress(S60QConversions::s60DescToQString(address), - S60QConversions::s60DescToQString(name)); + new ConvergedMessageAddress(XQConversions::s60DescToQString(address), + XQConversions::s60DescToQString(name)); mAddressList.append(messageAddress); } CleanupStack::PopAndDestroy(3, pText); @@ -209,7 +218,7 @@ smsHeader->RestoreL(*store); messageAddress - = S60QConversions::s60DescToQString(smsHeader->FromAddress()); + = XQConversions::s60DescToQString(smsHeader->FromAddress()); CleanupStack::PopAndDestroy(3, pText); } @@ -233,8 +242,7 @@ //--------------------------------------------------------------- RFile UniBioMessageDataPluginPrivate::attachmentL() { - if (attachmentProcessed) - { + if (attachmentProcessed) { CMsvStore* store1 = iMsvEntry->ReadStoreL(); CleanupStack::PushL(store1); @@ -244,33 +252,52 @@ return file; } - CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; - CleanupStack::PushL(selection); + RFile file; + + if (iMsvEntry->Entry().SendingState() != KMsvSendStateNotApplicable + || iMsvEntry->Entry().SendingState() != KMsvSendStateUnknown) { - selection->AppendL(iMessageId); + CMsvStore* store = iMsvEntry->ReadStoreL(); + CleanupStack::PushL(store); + MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); + + iAttachmentCount = attachMan.AttachmentCount(); - TBuf8<1> aParameter; - CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC(); - - CMsvOperation* operation = - iBioClientMtm->InvokeAsyncFunctionL(KBiosMtmParse, - *selection, - aParameter, - wait->iStatus); + if (iAttachmentCount > 0) { + file = attachMan.GetAttachmentFileL(0); + } + CleanupStack::PopAndDestroy(store); + + } + + if (iAttachmentCount == 0) { + CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; + CleanupStack::PushL(selection); - wait->Start(); + selection->AppendL(iMessageId); + + TBuf8<1> aParameter; + CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC(); - CMsvStore* store = iMsvEntry->ReadStoreL(); - CleanupStack::PushL(store); - MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); + CMsvOperation* operation = iBioClientMtm->InvokeAsyncFunctionL(KBiosMtmParse, *selection, + aParameter, wait->iStatus); + + wait->Start(); - iAttachmentCount = attachMan.AttachmentCount(); - - RFile file = attachMan.GetAttachmentFileL(0); + CMsvStore* store = iMsvEntry->ReadStoreL(); + CleanupStack::PushL(store); + MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); - delete operation; - CleanupStack::PopAndDestroy(3,selection); - attachmentProcessed = ETrue; + iAttachmentCount = attachMan.AttachmentCount(); + + if(iAttachmentCount) { + file = attachMan.GetAttachmentFileL(0); + } + + delete operation; + CleanupStack::PopAndDestroy(3, selection); + attachmentProcessed = ETrue; + } return file; } @@ -282,8 +309,7 @@ int UniBioMessageDataPluginPrivate::attachmentCount() { - if (!attachmentProcessed) - { + if (!attachmentProcessed) { RFile file = attachmentL(); file.Close(); } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.cpp --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include @@ -128,10 +128,10 @@ origFile.Read(readBuf); readBuf16->Des().Copy(readBuf); - QString orig = S60QConversions::s60DescToQString(*readBuf16); + QString orig = XQConversions::s60DescToQString(*readBuf16); origFile.Close(); - HBufC* filepath = S60QConversions::qStringToS60Desc(path); + HBufC* filepath = XQConversions::qStringToS60Desc(path); RFile file; op = file.Open(iFs, *filepath, EFileRead); @@ -139,7 +139,7 @@ file.Read(readBuf); readBuf16->Des().Copy(readBuf); - QString bod = S60QConversions::s60DescToQString(*readBuf16); + QString bod = XQConversions::s60DescToQString(*readBuf16); delete readBuf16; file.Close(); @@ -197,10 +197,10 @@ origFile.Read(readBuf); readBuf16->Des().Copy(readBuf); - QString orig = S60QConversions::s60DescToQString(*readBuf16); + QString orig = XQConversions::s60DescToQString(*readBuf16); origFile.Close(); - HBufC* filepath = S60QConversions::qStringToS60Desc(path); + HBufC* filepath = XQConversions::qStringToS60Desc(path); RFile file; op = file.Open(iFs, *filepath, EFileRead); @@ -210,7 +210,7 @@ readBuf16->Des().Copy(readBuf); - QString bod = S60QConversions::s60DescToQString(*readBuf16); + QString bod = XQConversions::s60DescToQString(*readBuf16); delete readBuf16; file.Close(); @@ -476,7 +476,7 @@ TBufC telNumber; QString recepient(TEST_MSG_FROM1); - tempNumber = S60QConversions::qStringToS60Desc(recepient); + tempNumber = XQConversions::qStringToS60Desc(recepient); telNumber = tempNumber->Des(); newBioEntry.iDetails.Set(telNumber); @@ -533,9 +533,9 @@ QString recepient2(TEST_MSG_FROM2); QString alias(TEST_MSG_ALIAS1); - HBufC* addr = S60QConversions::qStringToS60Desc(recepient); - HBufC* addr2 = S60QConversions::qStringToS60Desc(recepient2); - HBufC* alias1 = S60QConversions::qStringToS60Desc(alias); + 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); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro Thu Jul 22 16:32:06 2010 +0100 @@ -23,7 +23,6 @@ INCLUDEPATH += . INCLUDEPATH += ../../../../../../inc -INCLUDEPATH += ../../../../../msgutils/s60qconversions/inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE DEFINES += BUILD_TEST_DLL @@ -48,9 +47,17 @@ BLD_INF_RULES.prj_exports += "BioMtm.rsc /epoc32/winscw/c/resource/messaging/mtm/BioMtm.rsc" } +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 + LIBS += -leuser \ -lconvergedmessageutils\ - -ls60qconversions \ -lmsgs \ -lsmcm \ -lgsmu \ @@ -61,6 +68,7 @@ -lbioc \ -lefsrv \ -lbiodb \ - -lbifu + -lbifu \ + -lxqutils diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/unibiomessagedataplugin.pro --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/unibiomessagedataplugin.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/unibiomessagedataplugin.pro Thu Jul 22 16:32:06 2010 +0100 @@ -25,7 +25,6 @@ DEPENDPATH += . inc src INCLUDEPATH += ./inc -INCLUDEPATH += ../../../../msgutils/s60qconversions/inc INCLUDEPATH += ../../../../../inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE @@ -51,7 +50,6 @@ LIBS += -leuser \ -lconvergedmessageutils\ - -ls60qconversions \ -lmsgs \ -lSmcm \ -lgsmu \ @@ -59,7 +57,8 @@ -lQtCore \ -lefsrv \ -lbioc \ - -lbifu + -lbifu \ + -lxqutils # plugin stub deployment diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/rom/unimmsdataplugin.iby --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/rom/unimmsdataplugin.iby Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/rom/unimmsdataplugin.iby Thu Jul 22 16:32:06 2010 +0100 @@ -19,7 +19,6 @@ #define __UNI_MMS_DATA_PLUGIN_IBY__ -# this is the plugin stub for QT plugin file=ABI_DIR\UREL\unimmsdataplugin.dll SHARED_LIB_DIR\unimmsdataplugin.dll data=\epoc32\data\z\resource\qt\plugins\messaging\datamodel\unimmsdataplugin.qtplugin \resource\qt\plugins\messaging\datamodel\unimmsdataplugin.qtplugin diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin_p.cpp --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin_p.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin_p.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -30,10 +30,11 @@ #include #include #include +#include #include #include "convergedmessage.h" -#include "s60qconversions.h" +#include #include "convergedmessageaddress.h" #include "unimmsdataplugin_p.h" #include "debugtraces.h" @@ -117,7 +118,7 @@ TInt len = textBody.DocumentLength(); HBufC* buf = HBufC::NewL(len); TPtr bufPtr = buf->Des(); - aBodyText = S60QConversions::s60DescToQString(bufPtr); + aBodyText = XQConversions::s60DescToQString(bufPtr); } int UniMMSDataPluginPrivate::messageSize() @@ -129,7 +130,7 @@ QString UniMMSDataPluginPrivate::subject() { TPtrC sub = mMmsClient->SubjectL(); - return S60QConversions::s60DescToQString(sub); + return XQConversions::s60DescToQString(sub); } @@ -163,8 +164,8 @@ // populate address ConvergedMessageAddress * messageAddress = - new ConvergedMessageAddress(S60QConversions::s60DescToQString(address), - S60QConversions::s60DescToQString(name)); + new ConvergedMessageAddress(XQConversions::s60DescToQString(address), + XQConversions::s60DescToQString(name)); mAddressList.append(messageAddress); } @@ -203,8 +204,8 @@ // populate address ConvergedMessageAddress * messageAddress = - new ConvergedMessageAddress(S60QConversions::s60DescToQString(address), - S60QConversions::s60DescToQString(name)); + new ConvergedMessageAddress(XQConversions::s60DescToQString(address), + XQConversions::s60DescToQString(name)); mAddressList.append(messageAddress); } @@ -243,8 +244,8 @@ // populate address ConvergedMessageAddress * messageAddress = - new ConvergedMessageAddress(S60QConversions::s60DescToQString(address), - S60QConversions::s60DescToQString(name)); + new ConvergedMessageAddress(XQConversions::s60DescToQString(address), + XQConversions::s60DescToQString(name)); mAddressList.append(messageAddress); } @@ -257,7 +258,7 @@ { TPtrC sender = mMmsClient->Sender(); - messageAddress = S60QConversions::s60DescToQString(sender); + messageAddress = XQConversions::s60DescToQString(sender); } UniMessageInfoList UniMMSDataPluginPrivate::attachmentList() @@ -271,15 +272,17 @@ for (int i = 0; i < attcount; i++) { CUniObject *obj = mUniDataModel->AttachmentList().GetByIndex(i); + CMsgMediaInfo *mediaInfo = obj->MediaInfo(); - mimetype = S60QConversions::s60Desc8ToQString(obj->MimeType()); - path - = S60QConversions::s60DescToQString(obj->MediaInfo()->FullFilePath()); + mimetype = XQConversions::s60Desc8ToQString(obj->MimeType()); + path = XQConversions::s60DescToQString(mediaInfo->FullFilePath()); size = obj->Size(EFalse); UniMessageInfo *msgobj = new UniMessageInfo(path, size, mimetype); + msgobj->setProtected(EFileProtNoProtection != mediaInfo->Protection()); + msgobj->setCorrupted(mediaInfo->Corrupt()); attlist << msgobj; - } +} return attlist; } @@ -329,13 +332,15 @@ for (int i = 0; i < objcount; i++) { CUniObject *obj = mUniDataModel->ObjectList().GetByIndex(i); + CMsgMediaInfo *mediaInfo = obj->MediaInfo(); - mimetype = S60QConversions::s60Desc8ToQString(obj->MimeType()); - path - = S60QConversions::s60DescToQString(obj->MediaInfo()->FullFilePath()); + mimetype = XQConversions::s60Desc8ToQString(obj->MimeType()); + path = XQConversions::s60DescToQString(mediaInfo->FullFilePath()); size = obj->Size(EFalse); UniMessageInfo *msgobj = new UniMessageInfo(path, size, mimetype); + msgobj->setProtected(EFileProtNoProtection != mediaInfo->Protection()); + msgobj->setCorrupted(mediaInfo->Corrupt()); objlist << msgobj; } @@ -361,15 +366,16 @@ int size; for (int i = 0; i < slideobjcount; i++) { - CUniObject *obj = mUniDataModel->SmilModel().GetObjectByIndex(slidenum, - i); + CUniObject *obj = mUniDataModel->SmilModel().GetObjectByIndex(slidenum, i); + CMsgMediaInfo *mediaInfo = obj->MediaInfo(); - mimetype = S60QConversions::s60Desc8ToQString(obj->MimeType()); - path - = S60QConversions::s60DescToQString(obj->MediaInfo()->FullFilePath()); + mimetype = XQConversions::s60Desc8ToQString(obj->MimeType()); + path = XQConversions::s60DescToQString(mediaInfo->FullFilePath()); size = obj->Size(EFalse); UniMessageInfo *msgobj = new UniMessageInfo(path, size, mimetype); + msgobj->setProtected(EFileProtNoProtection != mediaInfo->Protection()); + msgobj->setCorrupted(mediaInfo->Corrupt()); slidecontent << msgobj; } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.cpp --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -20,7 +20,7 @@ #include #include #include "convergedmessage.h" -#include "s60qconversions.h" +#include #include "unidatamodelplugininterface.h" #include "unidatamodelloader.h" #include @@ -168,13 +168,13 @@ if(subjectField) { QString subject(TEST_MSG_SUBJECT); - HBufC* subj = S60QConversions::qStringToS60Desc(subject); + HBufC* subj = XQConversions::qStringToS60Desc(subject); iMmsClientMtm->SetSubjectL(*subj); } //Sender QString sender(TEST_MSG_FROM1); - HBufC* addr = S60QConversions::qStringToS60Desc(sender); + HBufC* addr = XQConversions::qStringToS60Desc(sender); if (addr) @@ -191,7 +191,7 @@ //Recipient QString recipient(TEST_MSG_RECIEPIENT1); - HBufC* addr2 = S60QConversions::qStringToS60Desc(recipient); + HBufC* addr2 = XQConversions::qStringToS60Desc(recipient); if (addr2) { CleanupStack::PushL(addr2); @@ -200,7 +200,7 @@ } QString recipient2(TEST_MSG_RECIEPIENT2); - HBufC* addr3 = S60QConversions::qStringToS60Desc(recipient2); + HBufC* addr3 = XQConversions::qStringToS60Desc(recipient2); if (addr3) { CleanupStack::PushL(addr3); @@ -209,7 +209,7 @@ } QString recipient3(TEST_MSG_RECIEPIENT3); - HBufC* addr4 = S60QConversions::qStringToS60Desc(recipient3); + HBufC* addr4 = XQConversions::qStringToS60Desc(recipient3); if (addr4) { CleanupStack::PushL(addr4); @@ -377,7 +377,7 @@ //Sender QString sender(TEST_MSG_FROM1); - HBufC* addr = S60QConversions::qStringToS60Desc(sender); + HBufC* addr = XQConversions::qStringToS60Desc(sender); if (addr) { @@ -393,7 +393,7 @@ //Recipient QString recipient(TEST_MSG_RECIEPIENT1); - HBufC* addr2 = S60QConversions::qStringToS60Desc(recipient); + HBufC* addr2 = XQConversions::qStringToS60Desc(recipient); if (addr2) { CleanupStack::PushL(addr2); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.pro --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.pro Thu Jul 22 16:32:06 2010 +0100 @@ -9,7 +9,6 @@ INCLUDEPATH += . -INCLUDEPATH += ../../../../../msgutils/s60qconversions/inc INCLUDEPATH += ../../../../../internal/sf/app/messaging/mmsengine/mmsmessage/inc INCLUDEPATH += ../../../../../internal/sf/app/messaging/mmsengine/inc INCLUDEPATH += ../../../../../../inc @@ -38,9 +37,18 @@ BLD_INF_RULES.prj_exports += "photo.jpg C:/pictures/photo.jpg" } +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/test_unidatamodel_mms_plugin.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/test_unidatamodel_mms_plugin.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + LIBS += -leuser \ -lconvergedmessageutils\ - -ls60qconversions \ + -lxqutils \ -lmsgs \ -lsmcm \ -lgsmu \ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/unimmsdataplugin.pro --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/unimmsdataplugin.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/unimmsdataplugin.pro Thu Jul 22 16:32:06 2010 +0100 @@ -26,7 +26,6 @@ DEPENDPATH += . inc src INCLUDEPATH += ./inc -INCLUDEPATH += ../../../../msgutils/s60qconversions/inc INCLUDEPATH += ../../../unieditorutils/unieditorutils/inc INCLUDEPATH += ../../../../../inc INCLUDEPATH += ../../../../mmsengine/mmsmessage/inc @@ -57,7 +56,6 @@ -lbafl \ -lestor \ -lconvergedmessageutils\ - -ls60qconversions \ -lmsgs \ -letext \ -lmmscli \ @@ -67,7 +65,8 @@ -lunidatamodel \ -lmmsserversettings \ -lmsgmedia \ - -leikctl + -leikctl \ + -lxqutils # plugin stub deployment plugin.sources = unimmsdataplugin.dll diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/rom/unismsdataplugin.iby --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/rom/unismsdataplugin.iby Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/rom/unismsdataplugin.iby Thu Jul 22 16:32:06 2010 +0100 @@ -18,7 +18,7 @@ #define __UNI_SMS_DATA_PLUGIN_IBY__ -# this is the plugin stub for QT plugin + file=ABI_DIR\UREL\unismsdataplugin.dll SHARED_LIB_DIR\unismsdataplugin.dll data=\epoc32\data\z\resource\qt\plugins\messaging\datamodel\unismsdataplugin.qtplugin \resource\qt\plugins\messaging\datamodel\unismsdataplugin.qtplugin diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/src/unismsdataplugin_p.cpp --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/src/unismsdataplugin_p.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/src/unismsdataplugin_p.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -31,7 +31,7 @@ #include //USER INCLUDES -#include "s60qconversions.h" +#include #include "convergedmessageaddress.h" #include "convergedmessage.h" @@ -149,7 +149,7 @@ HBufC* buf = HBufC::NewL(len); TPtr bufPtr = buf->Des(); textBody.ExtractSelectively(bufPtr, 0, len, CPlainText::EExtractAll); - aBodyText = S60QConversions::s60DescToQString(*buf); + aBodyText = XQConversions::s60DescToQString(*buf); delete buf; } @@ -180,8 +180,8 @@ // populate address ConvergedMessageAddress * messageAddress = - new ConvergedMessageAddress(S60QConversions::s60DescToQString(address), - S60QConversions::s60DescToQString(name)); + new ConvergedMessageAddress(XQConversions::s60DescToQString(address), + XQConversions::s60DescToQString(name)); mAddressList.append(messageAddress); } @@ -195,8 +195,8 @@ extractNameAndAddress(emailRecipients.MdcaPoint(id), name, address); ConvergedMessageAddress * messageAddress = - new ConvergedMessageAddress(S60QConversions::s60DescToQString(address), - S60QConversions::s60DescToQString(name)); + new ConvergedMessageAddress(XQConversions::s60DescToQString(address), + XQConversions::s60DescToQString(name)); mAddressList.append(messageAddress); } } @@ -226,7 +226,7 @@ smsHeader->RestoreL(*store); messageAddress - = S60QConversions::s60DescToQString(smsHeader->FromAddress()); + = XQConversions::s60DescToQString(smsHeader->FromAddress()); CleanupStack::PopAndDestroy(4, pText); } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.cpp --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -17,7 +17,7 @@ #include #include #include -#include "s60qconversions.h" +#include #include #include "convergedmessage.h" @@ -111,7 +111,7 @@ //AddBody QString body(TEST_MSG_BODY); - HBufC* bodyText = S60QConversions::qStringToS60Desc(body); + HBufC* bodyText = XQConversions::qStringToS60Desc(body); if (bodyText) { CleanupStack::PushL(bodyText); @@ -131,9 +131,9 @@ QString recepient2(TEST_MSG_FROM2); QString alias(TEST_MSG_ALIAS1); - HBufC* addr = S60QConversions::qStringToS60Desc(recepient); - HBufC* addr2 = S60QConversions::qStringToS60Desc(recepient2); - HBufC* alias1 = S60QConversions::qStringToS60Desc(alias); + HBufC* addr = XQConversions::qStringToS60Desc(recepient); + HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2); + HBufC* alias1 = XQConversions::qStringToS60Desc(alias); if (addr) { @@ -183,7 +183,7 @@ //AddBody QString body(TEST_MSG_BODY); - HBufC* bodyText = S60QConversions::qStringToS60Desc(body); + HBufC* bodyText = XQConversions::qStringToS60Desc(body); if (bodyText) { CleanupStack::PushL(bodyText); @@ -203,9 +203,9 @@ QString recepient2(TEST_MSG_FROM2); QString alias(TEST_MSG_ALIAS1); - HBufC* addr = S60QConversions::qStringToS60Desc(recepient); - HBufC* addr2 = S60QConversions::qStringToS60Desc(recepient2); - HBufC* alias1 = S60QConversions::qStringToS60Desc(alias); + HBufC* addr = XQConversions::qStringToS60Desc(recepient); + HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2); + HBufC* alias1 = XQConversions::qStringToS60Desc(alias); if (addr) { @@ -258,7 +258,7 @@ //AddBody QString body(TEST_MSG_BODY); - HBufC* bodyText = S60QConversions::qStringToS60Desc(body); + HBufC* bodyText = XQConversions::qStringToS60Desc(body); if (bodyText) { CleanupStack::PushL(bodyText); @@ -278,9 +278,9 @@ QString recepient2(TEST_MSG_FROM2); QString alias(TEST_MSG_ALIAS1); - HBufC* addr = S60QConversions::qStringToS60Desc(recepient); - HBufC* addr2 = S60QConversions::qStringToS60Desc(recepient2); - HBufC* alias1 = S60QConversions::qStringToS60Desc(alias); + HBufC* addr = XQConversions::qStringToS60Desc(recepient); + HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2); + HBufC* alias1 = XQConversions::qStringToS60Desc(alias); if (addr) { @@ -331,7 +331,7 @@ //AddBody QString body(TEST_MSG_BODY); - HBufC* bodyText = S60QConversions::qStringToS60Desc(body); + HBufC* bodyText = XQConversions::qStringToS60Desc(body); if (bodyText) { CleanupStack::PushL(bodyText); @@ -351,9 +351,9 @@ QString recipient2(TEST_MSG_FROM2); QString alias(TEST_MSG_ALIAS1); - HBufC* addr = S60QConversions::qStringToS60Desc(recipient); - HBufC* addr2 = S60QConversions::qStringToS60Desc(recipient2); - HBufC* alias1 = S60QConversions::qStringToS60Desc(alias); + HBufC* addr = XQConversions::qStringToS60Desc(recipient); + HBufC* addr2 = XQConversions::qStringToS60Desc(recipient2); + HBufC* alias1 = XQConversions::qStringToS60Desc(alias); if (addr) { @@ -396,7 +396,7 @@ //AddBody QString body(TEST_MSG_BODY); - HBufC* bodyText = S60QConversions::qStringToS60Desc(body); + HBufC* bodyText = XQConversions::qStringToS60Desc(body); if (bodyText) { CleanupStack::PushL(bodyText); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.pro --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.pro Thu Jul 22 16:32:06 2010 +0100 @@ -23,7 +23,6 @@ INCLUDEPATH += . INCLUDEPATH += ../../../../../../inc -INCLUDEPATH += ../../../../../msgutils/s60qconversions/inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE DEFINES += BUILD_TEST_DLL @@ -46,10 +45,19 @@ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000 TARGET.EPOCALLOWDLLDATA = 1 } + +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/test_unidatamodel_sms_plugin.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/test_unidatamodel_sms_plugin.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock LIBS += -leuser \ -lconvergedmessageutils\ - -ls60qconversions \ + -lxqutils \ -lmsgs \ -lsmcm \ -lgsmu \ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/unismsdataplugin.pro --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/unismsdataplugin.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/unismsdataplugin.pro Thu Jul 22 16:32:06 2010 +0100 @@ -26,7 +26,6 @@ DEPENDPATH += . inc src INCLUDEPATH += ./inc -INCLUDEPATH += ../../../../msgutils/s60qconversions/inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE INCLUDEPATH += ../../../../../inc @@ -49,12 +48,12 @@ LIBS += -leuser \ -lconvergedmessageutils\ - -ls60qconversions \ -lmsgs \ -lSmcm \ -lgsmu \ -letext \ - -lQtCore + -lQtCore \ + -lxqutils # plugin stub deployment plugin.sources = unismsdataplugin.dll diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/bwins/editorgenutilsu.def diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/eabi/editorgenutilsu.def diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/editorgenutils/editorgenutils.pro --- a/messagingapp/msgutils/unieditorutils/editorgenutils/editorgenutils.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/editorgenutils/editorgenutils.pro Thu Jul 22 16:32:06 2010 +0100 @@ -21,7 +21,6 @@ INCLUDEPATH += . INCLUDEPATH += ../../../../inc -INCLUDEPATH += ../../s60qconversions/inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE DEFINES += BUILD_MUIU_UITLS_DLL @@ -50,11 +49,22 @@ SOURCES += src/MuiuOperationWait.cpp \ src/UniEditorGenUtils.cpp +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/editorgenutils.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/editorgenutils.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + LIBS += -leuser \ -lCentralRepository \ -lconvergedmessageutils \ -lsssettings \ - -ls60qconversions \ -lMsgMedia \ - -lapmime + -lapmime \ + -lxqutils \ + -lavkon \ + -lefsrv diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/editorgenutils/inc/UniEditorGenUtils.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/editorgenutils/src/UniEditorGenUtils.cpp --- a/messagingapp/msgutils/unieditorutils/editorgenutils/src/UniEditorGenUtils.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/editorgenutils/src/UniEditorGenUtils.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -26,7 +26,7 @@ #include "MessagingVariant.hrh" #include "MessagingInternalCRKeys.h" // Keys #include "UniEditorGenUtils.h" -#include "s60qconversions.h" +#include // CONSTANTS const TInt KMuiuCharQuote = '\"'; @@ -204,7 +204,7 @@ // ---------------------------------------------------- TInt UniEditorGenUtils::UTF8Size( QString aText ) { - HBufC* text = S60QConversions::qStringToS60Desc(aText); + HBufC* text = XQConversions::qStringToS60Desc(aText); TPtrC ptr = text->Des(); TInt count = 0; @@ -301,7 +301,7 @@ QString& mimetype, TMsgMediaType& mediaType) { - HBufC* filepath = S60QConversions::qStringToS60Desc(filePath); + HBufC* filepath = XQConversions::qStringToS60Desc(filePath); int fileSize = 0; CMsgMediaResolver* mediaResolver; @@ -318,7 +318,7 @@ size = fileSize; TDataType datatype; mediaResolver->RecognizeL( file, datatype ); - mimetype = S60QConversions::s60Desc8ToQString(datatype.Des8()); + mimetype = XQConversions::s60Desc8ToQString(datatype.Des8()); mediaType = mediaResolver->MediaType(datatype.Des8()); CleanupStack::PopAndDestroy(mediaResolver); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorpluginloader/unieditorpluginloader.pro --- a/messagingapp/msgutils/unieditorutils/unieditorpluginloader/unieditorpluginloader.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/unieditorpluginloader/unieditorpluginloader.pro Thu Jul 22 16:32:06 2010 +0100 @@ -50,3 +50,11 @@ SOURCES += src/unieditorpluginloader.cpp +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/unieditorpluginloader.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/unieditorpluginloader.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h Thu Jul 22 16:32:06 2010 +0100 @@ -218,6 +218,9 @@ CMmsClientMtm* iMmsMtm; CMmsHeaders* iMmsHeader; + // Flag for forwarded messages + TBool iMessageForwarded; + // owned UniDataModelLoader* iDataModelPluginLoader; //Not owned diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/rom/unieditormmsplugin.iby --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/rom/unieditormmsplugin.iby Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/rom/unieditormmsplugin.iby Thu Jul 22 16:32:06 2010 +0100 @@ -19,7 +19,6 @@ #define __UNI_EDITOR_MMS_PLUGIN_IBY__ -# this is the plugin stub for QT plugin file=ABI_DIR\UREL\unieditormmsplugin.dll SHARED_LIB_DIR\unieditormmsplugin.dll data=\epoc32\data\z\resource\qt\plugins\messaging\editorplugins\unieditormmsplugin.qtplugin \resource\qt\plugins\messaging\editorplugins\unieditormmsplugin.qtplugin diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -43,7 +43,7 @@ #include "UniSendingSettings.h" #include "unidatamodelloader.h" #include "unidatamodelplugininterface.h" -#include "s60qconversions.h" +#include #include "debugtraces.h" #include "UniEditorGenUtils.h" @@ -167,7 +167,7 @@ populateRecipientsL(aMessage); //populate convergedmessage with the subject - aMessage.setSubject(S60QConversions::s60DescToQString( + aMessage.setSubject(XQConversions::s60DescToQString( MmsMtmL()->SubjectL())); // Priority @@ -204,12 +204,20 @@ ConvergedMessage &aMessage) { QDEBUG_WRITE("Enter convertFromForwardHandlerL"); - - TMsvEntry entry =MmsMtmL()->Entry().Entry(); + iMessageForwarded = EFalse; + TMsvEntry entry = MmsMtmL()->Entry().Entry(); //populate convergedmessage with the subject prepended with FW: - QString subject = LOC_FWD + S60QConversions::s60DescToQString( - MmsMtmL()->SubjectL()); + QString subject = + XQConversions::s60DescToQString(MmsMtmL()->SubjectL()); + + if (!(entry.Forwarded() || subject.startsWith(LOC_FWD, + Qt::CaseInsensitive))) + { + subject.insert(0, LOC_FWD); + iMessageForwarded = ETrue; + } + aMessage.setSubject(subject); // Priority @@ -268,10 +276,14 @@ { QString textContent; QFile file(slideContentList.at(i)->path()); - file.open(QIODevice::ReadOnly); - textContent = file.readAll(); - aMessage.setBodyText(textContent); - file.close(); + if (file.open(QIODevice::ReadOnly)) { + textContent = file.readAll(); + aMessage.setBodyText(textContent); + file.close(); + } + else { + return; + } } else { @@ -382,7 +394,13 @@ //There is no size check inside plugin as it assumes //we get proper data from editor - HBufC* sub = S60QConversions::qStringToS60Desc(aMessage->subject()); + entry = MmsMtmL()->Entry().Entry(); + if (iMessageForwarded) + { + entry.SetForwarded(ETrue); + iMessageForwarded = EFalse; + } + HBufC* sub = XQConversions::qStringToS60Desc(aMessage->subject()); if( sub ) { CleanupStack::PushL(sub); @@ -507,8 +525,8 @@ //Saving the changes MmsMtmL()->SaveMessageL(); + entry = MmsMtmL()->Entry().Entry(); - TBuf detailsBuf; MakeDetailsL( detailsBuf ); entry.iDetails.Set( detailsBuf ); @@ -708,7 +726,7 @@ continue; } // convert from QString to HBufC - HBufC* addr = S60QConversions::qStringToS60Desc(array[i]->address()); + HBufC* addr = XQConversions::qStringToS60Desc(array[i]->address()); CleanupStack::PushL(addr); @@ -719,7 +737,7 @@ } else { - HBufC* displayName = S60QConversions::qStringToS60Desc(array[i]->alias()); + HBufC* displayName = XQConversions::qStringToS60Desc(array[i]->alias()); if(displayName) { CleanupStack::PushL(displayName); @@ -757,10 +775,10 @@ for (TInt i = 0; i < count; ++i) { //Address - QString address = S60QConversions::s60DescToQString( + QString address = XQConversions::s60DescToQString( TMmsGenUtils::PureAddress(addresses[i])); //Alias - QString alias = S60QConversions::s60DescToQString( + QString alias = XQConversions::s60DescToQString( TMmsGenUtils::Alias(addresses[i])); //add recipient to convergedMessage @@ -808,7 +826,7 @@ void CUniEditorMmsPluginPrivate::addObjectL(int aSlideNum, const QString& aFilePath) { - HBufC* filePath = S60QConversions::qStringToS60Desc(aFilePath); + HBufC* filePath = XQConversions::qStringToS60Desc(aFilePath); if (filePath) { @@ -837,7 +855,7 @@ // void CUniEditorMmsPluginPrivate::addAttachmentL(const QString& aFilePath) { - HBufC * filePath = S60QConversions::qStringToS60Desc(aFilePath); + HBufC * filePath = XQConversions::qStringToS60Desc(aFilePath); if (filePath) { CleanupStack::PushL(filePath); @@ -872,7 +890,7 @@ delete iEditor; iEditor = NULL; - HBufC* textContent = S60QConversions::qStringToS60Desc(aBodyText); + HBufC* textContent = XQConversions::qStringToS60Desc(aBodyText); if (textContent) { CleanupStack::PushL(textContent); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/bwins/test_mms_pluginu.def --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/bwins/test_mms_pluginu.def Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -EXPORTS - qt_plugin_instance @ 1 NONAME - qt_plugin_query_verification_data @ 2 NONAME - ?createMMSMessageWithAttachmentAndSend@TestMmsPlugin@@AAEXH@Z @ 3 NONAME ; void TestMmsPlugin::createMMSMessageWithAttachmentAndSend(int) - ?validateMsg@TestMmsPlugin@@AAEXABVConvergedMessage@@ABVQString@@@Z @ 4 NONAME ; void TestMmsPlugin::validateMsg(class ConvergedMessage const &, class QString const &) - ?tr@TestMmsPlugin@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString TestMmsPlugin::tr(char const *, char const *) - ?getStaticMetaObject@TestMmsPlugin@@SAABUQMetaObject@@XZ @ 6 NONAME ; struct QMetaObject const & TestMmsPlugin::getStaticMetaObject(void) - ?cleanupTestCase@TestMmsPlugin@@AAEXXZ @ 7 NONAME ; void TestMmsPlugin::cleanupTestCase(void) - ?testReceived@TestMmsPlugin@@AAEXH@Z @ 8 NONAME ; void TestMmsPlugin::testReceived(int) - ?qt_metacast@TestMmsPlugin@@UAEPAXPBD@Z @ 9 NONAME ; void * TestMmsPlugin::qt_metacast(char const *) - ?qt_metacall@TestMmsPlugin@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int TestMmsPlugin::qt_metacall(enum QMetaObject::Call, int, void * *) - ?trUtf8@TestMmsPlugin@@SA?AVQString@@PBD0H@Z @ 11 NONAME ; class QString TestMmsPlugin::trUtf8(char const *, char const *, int) - ?staticMetaObject@TestMmsPlugin@@2UQMetaObject@@B @ 12 NONAME ; struct QMetaObject const TestMmsPlugin::staticMetaObject - ?init@TestMmsPlugin@@AAEXXZ @ 13 NONAME ; void TestMmsPlugin::init(void) - ?testSendMMS@TestMmsPlugin@@AAEXXZ @ 14 NONAME ; void TestMmsPlugin::testSendMMS(void) - ?trUtf8@TestMmsPlugin@@SA?AVQString@@PBD0@Z @ 15 NONAME ; class QString TestMmsPlugin::trUtf8(char const *, char const *) - ?tr@TestMmsPlugin@@SA?AVQString@@PBD0H@Z @ 16 NONAME ; class QString TestMmsPlugin::tr(char const *, char const *, int) - ?createMMSMessageWithSmilTextAndImageAttachmentAndSend@TestMmsPlugin@@AAEXXZ @ 17 NONAME ; void TestMmsPlugin::createMMSMessageWithSmilTextAndImageAttachmentAndSend(void) - ?cleanup@TestMmsPlugin@@AAEXXZ @ 18 NONAME ; void TestMmsPlugin::cleanup(void) - ?initTestCase@TestMmsPlugin@@AAEXXZ @ 19 NONAME ; void TestMmsPlugin::initTestCase(void) - ?testMmsReceived@TestMmsPlugin@@AAEXXZ @ 20 NONAME ; void TestMmsPlugin::testMmsReceived(void) - ?metaObject@TestMmsPlugin@@UBEPBUQMetaObject@@XZ @ 21 NONAME ; struct QMetaObject const * TestMmsPlugin::metaObject(void) const - diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmsreadfile.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmsreadfile.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include +#include + +// 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 iValueBuffer; + CDesCArray* iAliasArray; // aliases + HBufC8* iByteBuffer; + TTime iDate; + CArrayPtrFlat* iAttaStructures; + TInt iAttaCount; + TInt iAttaRoot; + TInt iAliasCount; + TInt iNextMessageType; + TParse iParse; + TFileName iFilename; + + protected: // Data + private: // Data + + // CArrayFixFlat * 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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestbed.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestbed.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include + +#include //for consts like KMsvNullIndexEntryIdValue +#include +#include +#include +//#include + +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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestbed.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestbed.hrh Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#include + + +#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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmsteststaticutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmsteststaticutils.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include + +#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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestuitimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestuitimer.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 + +#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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/mmstestbed.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/mmstestbed.pro Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,77 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +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 " + +LIBS += -lmsgs \ + -lmmsmessage \ + -lmmsconninit \ + -lmmscodec \ + -lmmsserversettings \ + -lcentralrepository \ + -lapparc \ + -lbafl \ + -lefsrv \ + -lesock \ + -lestor \ + -leuser \ + -llogcli \ + -llogwrap \ + -lapgrfx \ + -lapmime diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmsreadfile.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmsreadfile.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include +#include +#include +#include +//#include +#include +#include +#include + +#include +#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( 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 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 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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmstestbed.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmstestbed.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#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 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 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 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 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 + } + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmsteststaticutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmsteststaticutils.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include +#include +#include + +#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 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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmstestuitimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmstestuitimer.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -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 ======== + diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/inc/testmmsplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/inc/testmmsplugin.h Thu Jul 22 16:32:06 2010 +0100 @@ -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 +#include +#include + +//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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/inc/testmmsplugin.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/inc/testmmsplugin.ini Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,9 @@ +//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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/mms.rsc Binary file messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/mms.rsc has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/not.rsc Binary file messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/not.rsc has changed diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/src/testmmsplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/src/testmmsplugin.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -0,0 +1,415 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 +#include +#include +#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"); + + //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(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(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(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(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(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(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 diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.cpp --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.cpp Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,322 +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 "testmmsplugin.h" -#include -#include "debugtraces.h" - -#include -#include - -#include "convergedmessage.h" -#include "TestMsg.h" -#include "convergedmessageid.h" -#include "unieditormmsplugin.h" -#include "messageserviceaction.h" -//--------------------------------------------------------------- -// TestMmsPlugin::initTestCase -//--------------------------------------------------------------- -void TestMmsPlugin::initTestCase() -{ - msgPlugin = new UniEditorMmsPlugin(); - QVERIFY(msgPlugin != 0); - smsId = -1; - mmsId = -1; -} - -//--------------------------------------------------------------- -// TestMmsPlugin::cleanupTestCase -//--------------------------------------------------------------- -void TestMmsPlugin::cleanupTestCase() -{ - delete msgPlugin; -} - -//--------------------------------------------------------------- -// TestMmsPlugin::init -//--------------------------------------------------------------- - -void TestMmsPlugin::init() -{ -} - -//--------------------------------------------------------------- -// TestMmsPlugin::cleanup -//--------------------------------------------------------------- -void TestMmsPlugin::cleanup() -{ -} - -//--------------------------------------------------------------- -// TestMmsPlugin::testSendMMS -//--------------------------------------------------------------- - -void TestMmsPlugin::testSendMMS() -{ - - //register user defined object to meta system. - qRegisterMetaType ("ConvergedMessage*"); - - - createMMSMessageWithAttachmentAndSend(); - //wait for the response to complete - //as sending a message goes through different stages - - //Create a smil attachment with image and text - createMMSMessageWithSmilTextAndImageAttachmentAndSend(); - - //Create MMS with Normal priority - createMMSMessageWithAttachmentAndSend(ETrue); -} - - -void TestMmsPlugin::createMMSMessageWithSmilTextAndImageAttachmentAndSend() - { - QString service = TEST_SERVICE_NAME_MMS; - QString bodyText = TEST_MSG_BODY; - QString subject = TEST_MSG_SUBJECT; - qint64 timeStamp = QDateTime::currentDateTime().toTime_t(); - - QString sender(TEST_SENDER); - ConvergedMessageAddress address(sender); - ConvergedMessageAttachmentList attachmentList; - - ConvergedMessageAttachment* attachmentImage = - new ConvergedMessageAttachment(TEST_ATTACHMENT4, ConvergedMessageAttachment::EAttachment); - attachmentList.append(attachmentImage); - - ConvergedMessageAttachment* attachmenttext = - new ConvergedMessageAttachment(TEST_ATTACHMENT5, ConvergedMessageAttachment::EAttachment); - attachmentList.append(attachmenttext); - - ConvergedMessageAttachment* attachmentSmil = - new ConvergedMessageAttachment(TEST_ATTACHMENT3, ConvergedMessageAttachment::ESmil); - attachmentList.append(attachmentSmil); - - - - ConvergedMessage msg; - msg.setMessageType(ConvergedMessage::Mms); - msg.setSubject(subject); - msg.setTimeStamp(timeStamp); - msg.addToRecipient(address); - msg.addAttachments(attachmentList); - msg.setPriority(ConvergedMessage::Low); - - long int id = msgPlugin->convertTo(&msg); - msgPlugin->send(id); - - } - - -//--------------------------------------------------------------- -// TestMmsPlugin::testMmsReceived -//--------------------------------------------------------------- -void TestMmsPlugin::testMmsReceived() -{ - testReceived(msgPlugin->messageType()); - QTest::qWait(5000); -} - -/* - * Creates a Smil file with only a text document as attachment - */ - -void TestMmsPlugin::createMMSMessageWithAttachmentAndSend(TBool priority) - { - QString service = TEST_SERVICE_NAME_MMS; - QString bodyText = TEST_MSG_BODY; - QString subject = TEST_MSG_SUBJECT; - qint64 timeStamp = QDateTime::currentDateTime().toTime_t(); - - QString sender(TEST_SENDER); - ConvergedMessageAddress address(sender); - ConvergedMessageAttachmentList attachmentList; - - - ConvergedMessageAttachment* attachment2 = - new ConvergedMessageAttachment(TEST_ATTACHMENT2, ConvergedMessageAttachment::ESmil); - - ConvergedMessageAttachment* attachment = - new ConvergedMessageAttachment(TEST_ATTACHMENT, 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); - if(priority == EFalse) - { - msg.setPriority(ConvergedMessage::Normal); - } - else - { - msg.setPriority(ConvergedMessage::High); - } - - //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); - - long int id = msgPlugin->convertTo(&msg); - msgPlugin->send(id); - } - -//--------------------------------------------------------------- -// TestMmsPlugin::testReceived -//--------------------------------------------------------------- -void TestMmsPlugin::testReceived(int type) -{ -MessageServiceAction* messageAction = new MessageServiceAction(this); - QVERIFY(messageAction != 0); - - //register user defined object to meta system. - qRegisterMetaType("ConvergedMessage*"); - - //signal spy. - //listen to added event - QSignalSpy spyAdd( messageAction, - SIGNAL(messageAdded(ConvergedMessage*, QString))); - //signal spy. - //listen to updated event - QSignalSpy spyUpdate( messageAction, - SIGNAL(messageUpdated(ConvergedMessage*, QString))); - //will force stub_clientmanager to emit messageUpdated. - messageAction->registerForNotification(); - //register user defined object to meta system. - - // wait for the response to come - QTest::qWait(5000); - - //check signals - int countAdd = -1; - countAdd = spyAdd.count(); - - ConvergedMessage* message = 0; - QString serviceId(""); - - if (countAdd) - { - //verify added event - void * temp = const_cast (spyAdd.at(0).at(0).data()); - message = *reinterpret_cast (temp); - serviceId = spyAdd.at(0).at(1).toString(); - QVERIFY(message != 0); - validateMsg(*message, serviceId); - } - - int countUpdate = -1; - countUpdate = spyUpdate.count(); - message = 0; - - for (int i = countUpdate; i > 0; --i) - { - //verify updated event - void * temp = const_cast (spyUpdate.at(i-1).at(0).data()); - message = *reinterpret_cast (temp); - if (ConvergedMessage::Inbox == message->location()) - { - serviceId = spyUpdate.at(i-1).at(1).toString(); - break; - } - } - if (message) - { - validateMsg(*message, serviceId); - } - delete message; -} - -//--------------------------------------------------------------- -// TestMmsPlugin::validateMsg -//--------------------------------------------------------------- -void TestMmsPlugin::validateMsg(const ConvergedMessage& message, - const QString& serviceId) -{ -#ifdef _DEBUG_TRACES_ - qDebug() << "....message received....."; -#endif - - //process incoming messages - if (message.location() == ConvergedMessage::Inbox) - { - int msgId; - if (message.id()) - { - msgId = message.id()->getId(); - } - ConvergedMessageAddressList array = message.toAddressList(); - if (array.count() > 0) - { - if (array[0]) - QCOMPARE(array[0]->address(),QString(TEST_MSG_FROM1)); - } - ConvergedMessageAddress *fromAddr = message.fromAddress(); - if (fromAddr) - { - QCOMPARE(fromAddr->address(),QString(TEST_MSG_FROM1)); - } - - QCOMPARE(serviceId,QString(TEST_SERVICE_ID)); - - if (message.messageType() == ConvergedMessage::Mms) - { - mmsId = msgId; - QCOMPARE(message.subject(), QString(TEST_MSG_SUBJECT)); - } - else if (message.messageType() == ConvergedMessage::Sms) - { - smsId = msgId; - QCOMPARE(message.bodyText(), QString(TEST_MSG_BODY)); - } - } - else if (message.location() == ConvergedMessage::Sent) - { - ConvergedMessageAddressList array = message.toAddressList(); - if (array.count() > 0) - { - if (array[0]) - QCOMPARE(array[0]->address(),QString(TEST_SENDER)); - } - - // QCOMPARE(serviceId,QString(TEST_SERVICE_ID)); - - if (message.messageType() == ConvergedMessage::Mms) - { - QCOMPARE(message.subject(), QString(TEST_MSG_SUBJECT)); - } - else if (message.messageType() == ConvergedMessage::Sms) - { - QCOMPARE(message.bodyText(), QString(TEST_MSG_BODY)); - } - } -} diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.h --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.h Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -#ifndef 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 -#include - -class UniEditorMmsPlugin; -class ConvergedMessage; - -class TEST_EXPORT TestMmsPlugin: 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 testSendMMS(); //test sending mms - void testMmsReceived(); // test receiving mms - -private: - void testReceived(int type); - void validateMsg(const ConvergedMessage& message, const QString& serviceId); - void createMMSMessageWithAttachmentAndSend(TBool priority = EFalse); - void createMMSMessageWithSmilTextAndImageAttachmentAndSend(); -private: - UniEditorMmsPlugin* msgPlugin; - int smsId; - int mmsId; - }; -#endif //TEST_MMS_PLUGIN_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.ini --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.ini Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -//this file is used to provide predefined set of input data. - -//eg. -const char TEST_SERVICE_SMS[] = "SMS"; -const char TEST_SERVICE_ID[] = "messaging.mserver"; -const char TEST_SERVICE_SMS_ID[] = "messaging.mserver.sms"; -const char TEST_SERVICE_MMS_ID[] = "messaging.mserver.mms"; -const char TEST_SERVICE_MMS[] = "MMS"; -const char TEST_MSG_BODY[] = "TestTextE_1_2"; -const char TEST_MSG_RECIEPIENT[] = "Javaid Nabi<+919741596546>"; -const char TEST_MSG_FROM1[] = "+44111111111"; -const char SERVICE_CENTER_01[] = "+447802000332"; -const char SERVICE_CENTER_02[] = "+919845087001"; -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"; -const char TEST_SERVICE_NAME_MMS[] = "messaging.mserver.testservice.MMS"; -const char TEST_SENDER[] = "DummySender"; -const char TEST_ATTACHMENT[] = "c:/sample.txt"; -const char TEST_ATTACHMENT2[] = "c:/HelloWorld.smil"; -const char TEST_ATTACHMENT3[] = "c:/ImageFile.smil"; -const char TEST_ATTACHMENT4[] = "c:/SmileyFace.gif"; -const char TEST_ATTACHMENT5[] = "c:/testfile.txt"; -const char TEST_MSG_TO3[] = "SS<+44111111111>"; -const char TEST_CC[] = "DummyCCAddress"; -const char TEST_BCC[] = "DummyBCCAddress"; \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.pro --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.pro Thu Jul 22 16:32:06 2010 +0100 @@ -20,25 +20,31 @@ TEMPLATE = lib TARGET = test-mms-plugin - -INCLUDEPATH += . -INCLUDEPATH += ../../../../../../inc -INCLUDEPATH += ../../../../unieditorutils/inc -INCLUDEPATH += ../../../../s60qconversions/inc +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 += \ - testmmsplugin.cpp \ + ./src/testmmsplugin.cpp \ ../../src/unieditormmsplugin.cpp \ ../../src/unieditormmsplugin_p.cpp # Input HEADERS += \ - testmmsplugin.h \ - testmsg.h \ + ./inc/testmmsplugin.h \ ../../inc/unieditormmsplugin.h \ ../../inc/unieditormmsplugin_p.h @@ -84,6 +90,14 @@ -lcommdb \ -lcommsdat \ -letelmm \ - -lgenericclient \ - -lunidatamodelloader - + -lunidatamodelloader \ + -lunidatamodel \ + -lavkon \ + -leikcoctl \ + -leikctl \ + -lform \ + -luiklaf\ + -lmmstestbed \ + -lmmsmessage \ + -lmmsserversettings \ + -lxqutils diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmsg.h --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmsg.h Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,600 +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_MSG_H -#define TEST_MSG_H -//Headers -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include // CRichText -#include // for Message type IDs -#include // for CMmsClientMtm -#include //Attachemt mimeheader -#include //Attachment manager -#include -#include //parse -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "testmmsplugin.ini" - -using namespace CommsDat; - -const TInt KMsvTestUidPhonePwrValue = 0x100052C5; -enum TMsvTestPhoneStatus - { - EMsvTestPhoneOff = 0, - EMsvTestPhoneOn - }; - -class TestMsg : public MMsvSessionObserver -{ -public: - - TestMsg(); - ~TestMsg(); - - void createSCSettings(); - - void createSMS(); - void createMMS(); - - void deleteMessage(int msgId); - - void initSimTsyL(); - -public: //MMsvSessionObserver - - void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, - TAny* aArg3); - -private: - - void initL(); - void createSMSL(TMsvId aFolderId, TBool aUnReadFlag); - void createMMSL(TMsvId aFolderId, TBool aUnReadFlag); - void initializeSimTsyL(TInt aTestNumber, HBufC* aTsyName); - -private: - - CMsvSession* iSession; - CClientMtmRegistry* iMtmRegistry; - CSmsClientMtm *smsClientMtm; -}; - -//--------------------------------------------------------------- -// TestMsg::TestMsg -//--------------------------------------------------------------- -TestMsg::TestMsg() -{ - int err; - TRAP(err,initL()); - #ifdef _DEBUG_TRACES_ -qDebug() << "Error in initialization:" << err; -#endif - -} - -//--------------------------------------------------------------- -// TestMsg::TestMsg -//--------------------------------------------------------------- -TestMsg::~TestMsg() -{ - if(smsClientMtm) - { - delete smsClientMtm; - smsClientMtm = NULL; - } - - if (iMtmRegistry) - { - delete iMtmRegistry; - iMtmRegistry = NULL; - } - - if (iSession) - { - delete iSession; - iSession = NULL; - } -} - -//--------------------------------------------------------------- -// TestMsg::createSCSettings -//--------------------------------------------------------------- -void TestMsg::createSCSettings() -{ - smsClientMtm = static_cast (iMtmRegistry->NewMtmL(KUidMsgTypeSMS)); - - TMsvSelectionOrdering ordering; - - CMsvEntry* root = CMsvEntry::NewL(smsClientMtm->Session(), - KMsvRootIndexEntryId, - ordering); - - CSmsAccount* smsAccount = CSmsAccount::NewLC(); - - CSmsSettings* settings = CSmsSettings::NewL(); - CleanupStack::PushL(settings); - smsAccount->LoadSettingsL(*settings); - - TMsvEntry entry; - entry.iMtm = KUidMsgTypeSMS; - entry.iType = KUidMsvServiceEntry; - entry.SetReadOnly(EFalse); - entry.SetVisible(EFalse); - entry.iDate.UniversalTime(); - entry.iDetails.Set(_L("Nokiatest")); - - root->SetEntryL(KMsvRootIndexEntryId); - root->CreateL(entry); - - QString serviceCenter01(SERVICE_CENTER_01); - QString serviceCenter02(SERVICE_CENTER_02); - HBufC* sC01 = S60QConversions::qStringToS60Desc(serviceCenter01); - HBufC* sC02 = S60QConversions::qStringToS60Desc(serviceCenter02); - CleanupStack::PushL(sC01); - CleanupStack::PushL(sC02); - settings->AddServiceCenterL(_L("Nokia"), *sC01); - settings->AddServiceCenterL(_L("Nokia"), *sC02); - CleanupStack::PopAndDestroy(sC02); - CleanupStack::PopAndDestroy(sC01); - settings->SetDefaultServiceCenter(1); - settings->SetValidityPeriod(ESmsVPWeek); - settings->SetReplyQuoted(ETrue); - settings->SetRejectDuplicate(ETrue); - settings->SetDelivery(ESmsDeliveryImmediately); - settings->SetDeliveryReport(EFalse); - settings->SetReplyPath(EFalse); - settings->SetMessageConversion(ESmsConvPIDNone); - settings->SetCanConcatenate(ETrue); - settings->SetCharacterSet(TSmsDataCodingScheme::ESmsAlphabet7Bit); - settings->SetValidityPeriodFormat(TSmsFirstOctet::ESmsVPFInteger); - settings->SetStatusReportHandling(CSmsSettings::EMoveReportToInboxVisible); - settings->SetSpecialMessageHandling(CSmsSettings::EMoveReportToInboxVisible); - settings->SetSmsBearer(CSmsSettings::ESmsBearerCircuitPreferred); - settings->SetCommDbAction(CSmsSettings::ENone); - settings->SetSmsBearerAction(CSmsSettings::ENone); - smsAccount->SaveSettingsL(*settings); - - CleanupStack::PopAndDestroy(settings); - CleanupStack::PopAndDestroy(smsAccount); -} - -//--------------------------------------------------------------- -// TestMsg::createSMS -//--------------------------------------------------------------- -void TestMsg::createSMS() -{ - int err; - TRAP(err,createSMSL(KMsvGlobalInBoxIndexEntryId,ETrue)); - #ifdef _DEBUG_TRACES_ -qDebug() << "Error in creating SMS:" << err; -#endif - -} - -//--------------------------------------------------------------- -// TestMsg::createMMS -//--------------------------------------------------------------- -void TestMsg::createMMS() -{ - int err; - TRAP(err,createMMSL(KMsvGlobalInBoxIndexEntryId,ETrue)); - #ifdef _DEBUG_TRACES_ -qDebug() << "Error in creating MMS:" << err; -#endif - -} - -//--------------------------------------------------------------- -// TestMsg::initL -//--------------------------------------------------------------- -void TestMsg::initL() -{ - iSession = CMsvSession::OpenSyncL(*this); - iMtmRegistry = CClientMtmRegistry::NewL(*iSession); -} - -//--------------------------------------------------------------- -// TestMsg::createSMSL -//--------------------------------------------------------------- -void TestMsg::createSMSL(TMsvId aFolderId, TBool aUnReadFlag) -{ - CSmsClientMtm *smsClientMtm = - static_cast (iMtmRegistry->NewMtmL(KUidMsgTypeSMS)); - CleanupStack::PushL(smsClientMtm); - //Create entry from this index entry - - smsClientMtm->SwitchCurrentEntryL(aFolderId); - smsClientMtm->CreateMessageL(KUidMsgTypeSMS.iUid); - TMsvEntry indexEntry = smsClientMtm->Entry().Entry(); - indexEntry.SetInPreparation(ETrue); - indexEntry.iMtm = KUidMsgTypeSMS; - indexEntry.iType = KUidMsvMessageEntry; - indexEntry.iServiceId = smsClientMtm->ServiceId(); - indexEntry.iDate.HomeTime(); - //AddBody - QString body(TEST_MSG_BODY); - - HBufC* bodyText = S60QConversions::qStringToS60Desc(body); - if (bodyText) - { - CleanupStack::PushL(bodyText); - CRichText & body = smsClientMtm->Body(); - body.Reset(); - body.InsertL(0, *bodyText); - - TBuf<32> buf; - buf.Copy(bodyText->Left(32)); - indexEntry.iDescription.Set(buf); - - CleanupStack::PopAndDestroy(bodyText); - } - - // Add addressee - //Add Address - QString recipient(TEST_MSG_FROM1); - // convert from QString to HBufC - HBufC* addr = S60QConversions::qStringToS60Desc(recipient); - if (addr) - { - CleanupStack::PushL(addr); - TBuf<32> name; - name.Copy(addr->Left(32)); - indexEntry.iDetails.Set(name); - - if (aFolderId == KMsvDraftEntryId || aFolderId - == KMsvGlobalOutBoxIndexEntryId) - { - smsClientMtm->AddAddresseeL(*addr, TPtrC()); - indexEntry.SetSendingState(KMsvSendStateWaiting); - } - else if (aFolderId == KMsvSentEntryId || aFolderId - == KMsvGlobalInBoxIndexEntryId) - { - CSmsHeader& smsHeader = smsClientMtm->SmsHeader(); - smsHeader.SetFromAddressL(*addr); - } - CleanupStack::PopAndDestroy(addr); - } - - // final fine tuning - indexEntry.SetAttachment(EFalse); - indexEntry.SetVisible(ETrue); - indexEntry.SetInPreparation(EFalse); - - if (aFolderId == KMsvGlobalInBoxIndexEntryId) - { - if (aUnReadFlag) - { - indexEntry.SetUnread(ETrue); - } - indexEntry.SetNew(ETrue); - } - indexEntry.SetComplete(ETrue); - smsClientMtm->Entry().ChangeL(indexEntry); - smsClientMtm->SaveMessageL(); - - CleanupStack::PopAndDestroy(smsClientMtm); -} - -//--------------------------------------------------------------- -// TestMsg::createMMSL -//--------------------------------------------------------------- -void TestMsg::createMMSL(TMsvId aFolderId, TBool aUnReadFlag) -{ - CMmsClientMtm - *mmsClientMtm = - static_cast - (iMtmRegistry->NewMtmL(KUidMsgTypeMultimedia)); - CleanupStack::PushL(mmsClientMtm); - //Create entry from this index entry - - mmsClientMtm->SwitchCurrentEntryL(aFolderId); - mmsClientMtm->CreateMessageL(mmsClientMtm->DefaultServiceL()); - - TMsvEntry indexEntry = mmsClientMtm->Entry().Entry(); - indexEntry.SetInPreparation(ETrue); - indexEntry.iMtm = KUidMsgTypeMultimedia; - indexEntry.iType = KUidMsvMessageEntry; - indexEntry.iServiceId = mmsClientMtm->DefaultServiceL(); - indexEntry.iDate.HomeTime(); - - //Subject - QString subject(TEST_MSG_SUBJECT); - - HBufC* sub = S60QConversions::qStringToS60Desc(subject); - if (sub) - { - CleanupStack::PushL(sub); - - TBuf<32> buf; - buf.Copy(sub->Left(32)); - indexEntry.iDescription.Set(buf); - - mmsClientMtm->SetSubjectL(*sub); - CleanupStack::PopAndDestroy(sub); - } - - // Add addressee - //Add Address - QString recipient(TEST_MSG_FROM1); - // convert from QString to HBufC - HBufC* addr = S60QConversions::qStringToS60Desc(recipient); - if (addr) - { - CleanupStack::PushL(addr); - TBuf<32> name; - name.Copy(addr->Left(32)); - indexEntry.iDetails.Set(name); - - if (aFolderId == KMsvDraftEntryId || aFolderId - == KMsvGlobalOutBoxIndexEntryId) - { - mmsClientMtm->AddAddresseeL(*addr); - indexEntry.SetSendingState(KMsvSendStateWaiting); - } - else if (aFolderId == KMsvSentEntryId || aFolderId - == KMsvGlobalInBoxIndexEntryId) - { - mmsClientMtm->SetSenderL(*addr); - mmsClientMtm->AddAddresseeL(*addr); - } - CleanupStack::PopAndDestroy(addr); - } - - // final fine tuning - indexEntry.SetVisible(ETrue); - indexEntry.SetInPreparation(EFalse); - - if (aFolderId == KMsvGlobalInBoxIndexEntryId) - { - if (aUnReadFlag) - { - indexEntry.SetUnread(ETrue); - } - indexEntry.SetNew(ETrue); - } - - //body text - QString bodyText(TEST_MSG_BODY); - HBufC* text = S60QConversions::qStringToS60Desc(bodyText); - if (text) - { - CleanupStack::PushL(text); - - //we may need some conversion of text here - const TInt KMmsMaxBytesPerCharacter = 4; - HBufC8* buffer = HBufC8::NewL( text->Length() * KMmsMaxBytesPerCharacter ); - CleanupStack::PushL( buffer ); - TPtr8 buf8 = buffer->Des(); - - // get an access to the message store - CMsvStore* store = mmsClientMtm->Entry().EditStoreL(); - CleanupStack::PushL(store); - - CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL(); - CleanupStack::PushL( mimeHeaders ); - - CMsvAttachment* attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); - CleanupStack::PushL( attaInfo ); - - TPtrC8 contentType; - contentType.Set( KMmsTextPlain ); - - TInt position = contentType.Find( KMmsSlash8 ); - mimeHeaders->SetContentTypeL( contentType.Left( position ) ); - mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) ); - attaInfo->SetMimeTypeL( contentType ); - attaInfo->SetAttachmentNameL( _L("body.txt") ); - - mimeHeaders->SetMimeCharset( KMmsUtf8 ); - mimeHeaders->SetSuggestedFilenameL( _L("body.txt") ); - - // if conversion fails, something is really seriously wrong - TInt error = CnvUtfConverter::ConvertFromUnicodeToUtf8( buf8, *text ); - - attaInfo->SetSize( buf8.Length() ); - mimeHeaders->StoreL( *attaInfo ); // Mime headers are streamed into atta info - - MMsvAttachmentManagerSync& attaManSync = store->AttachmentManagerExtensionsL(); - RFile textFile; - - attaManSync.CreateAttachmentL( _L("body.txt"), textFile, attaInfo ); - CleanupStack::Pop( attaInfo ); //ownership was transferred. - - CleanupClosePushL( textFile ); - - //get attachement id, we need it incase of failure - TMsvAttachmentId attachmentId = attaInfo->Id(); - // Now our file handle is open for writing - if ( buf8.Length()> 0 ) - { - textFile.Write( buf8 ); - error = textFile.Flush(); - } - // we must always close - CleanupStack::PopAndDestroy( &textFile ); // close textFile - CleanupStack::PopAndDestroy( mimeHeaders ); - - store->CommitL(); - CleanupStack::PopAndDestroy(store); - CleanupStack::PopAndDestroy( buffer ); - CleanupStack::PopAndDestroy(text); - } - - indexEntry.SetComplete(ETrue); - mmsClientMtm->Entry().ChangeL(indexEntry); - mmsClientMtm->SaveMessageL(); - - // cleanup - CleanupStack::PopAndDestroy(mmsClientMtm); -} - -void TestMsg::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, - TAny* /*aArg2*/, TAny* /*aArg3*/) -{ -} - -void TestMsg::deleteMessage(int msgId) -{ - CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId); - CleanupStack::PushL(cEntry); - - CMsvEntry* entry = iSession->GetEntryL(msgId); - CleanupStack::PushL(entry); - - TMsvEntry tEntry = entry->Entry(); - tEntry.SetReadOnly(EFalse); - entry->ChangeL(tEntry); - - cEntry->DeleteL(msgId); - CleanupStack::PopAndDestroy(entry); - CleanupStack::PopAndDestroy(cEntry); - -} - -void TestMsg::initSimTsyL() -{ - _LIT(KDefaultTsyName, "SIM"); - TPtrC defaultTsyName(KDefaultTsyName); - HBufC* defaultTsyNameBuf = defaultTsyName.AllocLC(); - TInt testNumber = 0; - - initializeSimTsyL(testNumber, defaultTsyNameBuf); - - CMDBSession* dbSession = CMDBSession::NewL(CMDBSession::LatestVersion()); - CleanupStack::PushL(dbSession); - - CMDBRecordLink - *modemBearerRecordSet = new (ELeave) CMDBRecordLink< - CCDModemBearerRecord> (KCDTIdGlobalSettingsRecord - | KCDTIdModemPhoneServicesSMS); - CleanupStack::PushL(modemBearerRecordSet); - - modemBearerRecordSet->SetRecordId(1); - //Load field container with data from database - TRAPD(err, modemBearerRecordSet->LoadL(*dbSession)); - CCDModemBearerRecord - *modemRecord = - static_cast - (CCDRecordBase::RecordFactoryL(KCDTIdModemBearerRecord)); - CleanupStack::PushL(modemRecord); - - /*! - * Set the record ID to that previously read from - * CCDGlobalSettingsRecord.iModemForPhoneServicesAndSMS - */ - modemRecord->SetRecordId(*modemBearerRecordSet); - - //Load record container with data from database - modemRecord->LoadL(*dbSession); - - modemRecord->iTsyName.SetMaxLengthL(defaultTsyNameBuf->Des().Length()); - modemRecord->iTsyName = defaultTsyNameBuf->Des(); - modemRecord->ModifyL(*dbSession); - - CleanupStack::PopAndDestroy(4); -} - -void TestMsg::initializeSimTsyL(TInt aTestNumber, HBufC* aTsyName) -{ - //Initialize TSY using the System Agent - TInt testState; - if (KErrNone != RProperty::Get(KUidPSSimTsyCategory, - KPSSimTsyTestNumber, - testState)) - { - User::LeaveIfError(RProperty::Define(KUidPSSimTsyCategory, - KPSSimTsyTestNumber, - RProperty::EInt)); - } - - User::LeaveIfError(RProperty::Set(KUidPSSimTsyCategory, - KPSSimTsyTestNumber, - aTestNumber)); - if (KErrNone != RProperty::Get(KUidSystemCategory, - KMsvTestUidPhonePwrValue, - testState)) - { - User::LeaveIfError(RProperty::Define(KUidSystemCategory, - KMsvTestUidPhonePwrValue, - RProperty::EInt)); - } - User::LeaveIfError(RProperty::Set(KUidSystemCategory, - KMsvTestUidPhonePwrValue, - EMsvTestPhoneOn)); - - User::LeaveIfError(RProperty::Get(KUidPSSimTsyCategory, - KPSSimTsyTestNumber, - aTestNumber)); - - RTelServer etelServer; - TInt err = etelServer.Connect(); - - if (err != KErrNone) - { - return; - } - User::LeaveIfError(etelServer.LoadPhoneModule(aTsyName->Des())); - - /*! - * Find the phone corresponding to this TSY and open a number of - * handles on it - */ - TInt numPhones; - User::LeaveIfError(etelServer.EnumeratePhones(numPhones)); - TBool found = EFalse; - - RMobilePhone iPhone; - while (!found && numPhones--) - { - TName phoneTsy; - User::LeaveIfError(etelServer.GetTsyName(numPhones, phoneTsy)); - if (phoneTsy.CompareF(aTsyName->Des()) == KErrNone) - { - found = ETrue; - RTelServer::TPhoneInfo info; - User::LeaveIfError(etelServer.GetPhoneInfo(numPhones, info)); - CleanupClosePushL(iPhone); - User::LeaveIfError(iPhone.Open(etelServer, info.iName)); - User::LeaveIfError(iPhone.Initialise()); - CleanupStack::PopAndDestroy(&iPhone); - } - } -} - -#endif //TEST_MSG_H diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/tsrc.pro Thu Jul 22 16:32:06 2010 +0100 @@ -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: +# + +TEMPLATE = subdirs + +SUBDIRS += mmstestbed/mmstestbed.pro +SUBDIRS += testmmsgplugin/testmmsplugin.pro + +CONFIG += ordered \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/unieditormmsplugin.pro --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/unieditormmsplugin.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/unieditormmsplugin.pro Thu Jul 22 16:32:06 2010 +0100 @@ -25,7 +25,6 @@ -INCLUDEPATH += ../../../s60qconversions/inc INCLUDEPATH += ../../editorgenutils/inc INCLUDEPATH += ../../../../../inc INCLUDEPATH += ../../../../../mmsengine/mmsmessage/inc @@ -56,10 +55,10 @@ -leditorgenutils \ -lunidatamodelloader \ -lconvergedmessageutils \ - -ls60qconversions \ -lunidatamodel \ -lmsgmedia \ - -leikctl + -leikctl \ + -lxqutils # Build.inf rules diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/inc/unieditorsmsplugin_p.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/rom/unieditorsmsplugin.iby --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/rom/unieditorsmsplugin.iby Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/rom/unieditorsmsplugin.iby Thu Jul 22 16:32:06 2010 +0100 @@ -17,7 +17,7 @@ #ifndef __UNI_EDITOR_SMS_PLUGIN_IBY__ #define __UNI_EDITOR_SMS_PLUGIN_IBY__ -# this is the plugin stub for QT plugin + file=ABI_DIR\UREL\unieditorsmsplugin.dll SHARED_LIB_DIR\unieditorsmsplugin.dll data=\epoc32\data\z\resource\qt\plugins\messaging\editorplugins\unieditorsmsplugin.qtplugin \resource\qt\plugins\messaging\editorplugins\unieditorsmsplugin.qtplugin diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin.cpp --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -20,7 +20,7 @@ // USER INCLUDES #include "unieditorsmsplugin.h" #include "unieditorsmsplugin_p.h" -#include "s60qconversions.h" +#include // DEBUG #include "debugtraces.h" @@ -155,7 +155,7 @@ TSmsEncoding& aAlternativeEncodingType) { TBool ret = ETrue; - HBufC* buffer = S60QConversions::qStringToS60Desc(aBuf); + HBufC* buffer = XQConversions::qStringToS60Desc(aBuf); TRAPD(error,d_ptr->GetNumPDUsL(*buffer,aNumOfRemainingChars, aNumOfPDUs,aUnicodeMode,aAlternativeEncodingType)); delete buffer; diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -57,13 +57,13 @@ #include "convergedmessage.h" #include "convergedmessageid.h" #include "convergedmessageattachment.h" -#include "s60qconversions.h" + #include "MuiuOperationWait.h" #include "UniEditorGenUtils.h" #include "unidatamodelloader.h" #include "unidatamodelplugininterface.h" #include // for translation support - +#include // resources // CONSTANTS @@ -436,8 +436,8 @@ int addrCount = addrList.count(); for(int i=0; iaddress() ); - HBufC* alt_alias = S60QConversions::qStringToS60Desc( addrList.at(i)->alias() ); + HBufC* addr = XQConversions::qStringToS60Desc( addrList.at(i)->address() ); + HBufC* alt_alias = XQConversions::qStringToS60Desc( addrList.at(i)->alias() ); if(addr->Length() > 0) { CleanupStack::PushL(addr); @@ -505,14 +505,14 @@ CMsvEntry& entry = SmsMtmL()->Entry(); TMsvEntry msvEntry( entry.Entry() ); msvEntry.iDetails.Set( idetailsBuf ); + entry.ChangeL( msvEntry ); SmsMtmL()->SaveMessageL(); - entry.ChangeL( msvEntry ); } // set subject if ( !message->subject().isEmpty() ) { - HBufC* subj = S60QConversions::qStringToS60Desc( message->subject() ); + HBufC* subj = XQConversions::qStringToS60Desc( message->subject() ); if( subj ) { CleanupStack::PushL( subj ); @@ -531,7 +531,7 @@ // ----------------------------------------------------------------------------- void UniEditorSmsPluginPrivate::SetSmsBodyL(ConvergedMessage* message) { - HBufC8* bodytext = S60QConversions::qStringToS60Desc8( message->bodyText() ); + HBufC8* bodytext = XQConversions::qStringToS60Desc8( message->bodyText() ); if( bodytext->Length() > 0) { CleanupStack::PushL( bodytext ); @@ -585,7 +585,7 @@ { // create msv attachment in store CreateAttachmentL(store, - *S60QConversions::qStringToS60Desc(attachment->filePath())); + *XQConversions::qStringToS60Desc(attachment->filePath())); // check for mimetype of the attachment TPtrC8 mimetype; @@ -594,7 +594,7 @@ TMsgMediaType attMediaType = EMsgMediaUnknown; iGenUtils->getFileInfoL(attachment->filePath(), attSize, attMimeType, attMediaType); - mimetype.Set( *S60QConversions::qStringToS60Desc8(attMimeType) ); + mimetype.Set( *XQConversions::qStringToS60Desc8(attMimeType) ); if ( mimetype.CompareF( KMsgMimeTextPlain ) == 0 ) { @@ -634,7 +634,7 @@ } else if(!descr.isNull()) { - buf.Copy( *S60QConversions::qStringToS60Desc(descr) ); + buf.Copy( *XQConversions::qStringToS60Desc(descr) ); } tEntry.iDescription.Set( buf ); @@ -658,11 +658,11 @@ int attSize; QString mimeType; TMsgMediaType mediaType = EMsgMediaUnknown; - QString filepath = S60QConversions::s60DescToQString( aFilePath ); + QString filepath = XQConversions::s60DescToQString( aFilePath ); iGenUtils->getFileInfoL(filepath, attSize, mimeType, mediaType); attachment->SetSize( attSize ); - attachment->SetMimeTypeL( *S60QConversions::qStringToS60Desc8(mimeType) ); + attachment->SetMimeTypeL( *XQConversions::qStringToS60Desc8(mimeType) ); CMuiuOperationWait* wait = CMuiuOperationWait::NewLC(); attachmentManager->AddAttachmentL( aFilePath, attachment, wait->iStatus ); @@ -890,8 +890,7 @@ { CreateVCardSMSL(filehandle); CleanupStack::Pop(&filehandle); - filehandle.Close(); - managerSync.RemoveAttachmentL(0); + filehandle.Close(); } else if (mimetype.CompareF(KMsgMimeVCal) == 0 || mimetype.CompareF(KMsgMimeICal) == 0) @@ -1766,8 +1765,8 @@ HBufC* pureAddr = TMmsGenUtils::PureAddress( emailRecipients.MdcaPoint( id ) ).AllocLC(); HBufC* aliasAddr = TMmsGenUtils::Alias( emailRecipients.MdcaPoint( id ) ).AllocLC(); ConvergedMessageAddress messageAddress( - S60QConversions::s60DescToQString(*pureAddr), - S60QConversions::s60DescToQString(*aliasAddr)); + XQConversions::s60DescToQString(*pureAddr), + XQConversions::s60DescToQString(*aliasAddr)); CleanupStack::PopAndDestroy(2, pureAddr ); aMessage->addToRecipient(messageAddress); } @@ -1785,8 +1784,8 @@ HBufC* aliasAddr = TMmsGenUtils::Alias(smsRecipients[i]).AllocLC(); ConvergedMessageAddress messageAddress( - S60QConversions::s60DescToQString(*pureAddr), - S60QConversions::s60DescToQString(*aliasAddr)); + XQConversions::s60DescToQString(*pureAddr), + XQConversions::s60DescToQString(*aliasAddr)); CleanupStack::PopAndDestroy(2, pureAddr ); aMessage->addToRecipient(messageAddress); } @@ -1794,7 +1793,7 @@ if( emailFields.Subject( ).Length( ) ) { // If email subject exists -> copy it - aMessage->setSubject(S60QConversions::s60DescToQString( + aMessage->setSubject(XQConversions::s60DescToQString( emailFields.Subject())); } @@ -1821,7 +1820,7 @@ CleanupStack::PushL( store ); MMsvAttachmentManager& manager = store->AttachmentManagerL(); CMsvAttachment *attachment = manager.GetAttachmentInfoL(0); - QString filepath = S60QConversions::s60DescToQString(attachment->FilePath()); + QString filepath = XQConversions::s60DescToQString(attachment->FilePath()); ConvergedMessageAttachment* conv_attachment = new ConvergedMessageAttachment(filepath, ConvergedMessageAttachment::EAttachment); ConvergedMessageAttachmentList conv_attList; @@ -1862,7 +1861,7 @@ HBufC* bodyText = HBufC::NewLC ( totalLength ); TPtr bodyTextPtr ( bodyText->Des() ); SmsMtmL()->Body().Extract( bodyTextPtr, 0, totalLength ); - aMessage->setBodyText(S60QConversions::s60DescToQString( + aMessage->setBodyText(XQConversions::s60DescToQString( bodyTextPtr)); CleanupStack::PopAndDestroy( bodyText ); } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testsmsgplugin/testmsg.h --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testsmsgplugin/testmsg.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testsmsgplugin/testmsg.h Thu Jul 22 16:32:06 2010 +0100 @@ -47,7 +47,7 @@ #include #include -#include +#include #include "testsmsplugin.ini" using namespace CommsDat; @@ -163,8 +163,8 @@ QString serviceCenter01(SERVICE_CENTER_01); QString serviceCenter02(SERVICE_CENTER_02); - HBufC* sC01 = S60QConversions::qStringToS60Desc(serviceCenter01); - HBufC* sC02 = S60QConversions::qStringToS60Desc(serviceCenter02); + HBufC* sC01 = XQConversions::qStringToS60Desc(serviceCenter01); + HBufC* sC02 = XQConversions::qStringToS60Desc(serviceCenter02); CleanupStack::PushL(sC01); CleanupStack::PushL(sC02); settings->AddServiceCenterL(_L("Nokia"), *sC01); @@ -249,7 +249,7 @@ //AddBody QString body(TEST_MSG_BODY); - HBufC* bodyText = S60QConversions::qStringToS60Desc(body); + HBufC* bodyText = XQConversions::qStringToS60Desc(body); if (bodyText) { CleanupStack::PushL(bodyText); @@ -268,7 +268,7 @@ //Add Address QString recipient(TEST_MSG_FROM1); // convert from QString to HBufC - HBufC* addr = S60QConversions::qStringToS60Desc(recipient); + HBufC* addr = XQConversions::qStringToS60Desc(recipient); if (addr) { CleanupStack::PushL(addr); @@ -336,7 +336,7 @@ //Subject QString subject(TEST_MSG_SUBJECT); - HBufC* sub = S60QConversions::qStringToS60Desc(subject); + HBufC* sub = XQConversions::qStringToS60Desc(subject); if (sub) { CleanupStack::PushL(sub); @@ -353,7 +353,7 @@ //Add Address QString recipient(TEST_MSG_FROM1); // convert from QString to HBufC - HBufC* addr = S60QConversions::qStringToS60Desc(recipient); + HBufC* addr = XQConversions::qStringToS60Desc(recipient); if (addr) { CleanupStack::PushL(addr); @@ -391,7 +391,7 @@ //body text QString bodyText(TEST_MSG_BODY); - HBufC* text = S60QConversions::qStringToS60Desc(bodyText); + HBufC* text = XQConversions::qStringToS60Desc(bodyText); if (text) { CleanupStack::PushL(text); diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testsmsgplugin/testsmsplugin.pro --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testsmsgplugin/testsmsplugin.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testsmsgplugin/testsmsplugin.pro Thu Jul 22 16:32:06 2010 +0100 @@ -24,7 +24,6 @@ INCLUDEPATH += . INCLUDEPATH += ../../../../../../inc INCLUDEPATH += ../../../../unieditorutils/inc -INCLUDEPATH += ../../../../s60qconversions/inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE DEFINES += BUILD_TEST_DLL @@ -50,10 +49,19 @@ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000 TARGET.EPOCALLOWDLLDATA = 1 } + +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/test_sms_plugin.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/test_sms_plugin.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock LIBS += -leuser \ -lconvergedmessageutils \ - -ls60qconversions \ + -lxqutils \ -lMsgMedia \ -leditorgenutils \ -lcone \ diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/unieditorsmsplugin.pro --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/unieditorsmsplugin.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/unieditorsmsplugin.pro Thu Jul 22 16:32:06 2010 +0100 @@ -24,7 +24,6 @@ # UID 3 TARGET.UID3 = 0x102072DA -INCLUDEPATH += ../../../s60qconversions/inc INCLUDEPATH += ../../editorgenutils/inc INCLUDEPATH += ../../../../../inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE @@ -48,7 +47,6 @@ LIBS += -leuser \ -lconvergedmessageutils \ - -ls60qconversions \ -lMsgMedia \ -leditorgenutils \ -lcone \ @@ -67,7 +65,8 @@ -lCdlEngine \ -lFeatMgr \ -lapmime \ - -lunidatamodelloader + -lunidatamodelloader \ + -lxqutils # plugin stub deployment plugin.sources = unieditorsmsplugin.dll diff -r a32b19fb291e -r 5b14749788d7 messagingapp/msgutils/unieditorutils/unieditorutils.pro diff -r a32b19fb291e -r 5b14749788d7 messagingapp/shareui/inc/shareuiprivate.h --- a/messagingapp/shareui/inc/shareuiprivate.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/shareui/inc/shareuiprivate.h Thu Jul 22 16:32:06 2010 +0100 @@ -125,6 +125,11 @@ */ void itemActivated(QModelIndex index); + /** + * Reset internal data structures + */ + void reset(); + private: /** * Fetch the action associated with a specified interface descriptor. @@ -185,12 +190,7 @@ * Show notes */ void showNote(QString text); - - /** - * Reset internal data structures - */ - void reset(); - + private: /** * List of files to be sent. diff -r a32b19fb291e -r 5b14749788d7 messagingapp/shareui/rom/shareui.iby diff -r a32b19fb291e -r 5b14749788d7 messagingapp/shareui/shareui.pro --- a/messagingapp/shareui/shareui.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/shareui/shareui.pro Thu Jul 22 16:32:06 2010 +0100 @@ -17,7 +17,7 @@ TEMPLATE = lib TARGET = shareui DEFINES += BUILD_SHAREUI_DLL -#DEFINES += __SHAREUI_MIME_HANDLING__ +DEFINES += __SHAREUI_MIME_HANDLING__ DEPENDPATH += inc src INCLUDEPATH += inc @@ -42,6 +42,14 @@ "sis/shareui_stub.sis /epoc32/data/z/system/install/shareui_stub.sis" \ "rom/shareui.iby CORE_APP_LAYER_IBY_EXPORT_PATH(shareui.iby)" +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/shareui.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/shareui.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock HEADERS += shareuiprivate.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/shareui/sis/shareui.pkg diff -r a32b19fb291e -r 5b14749788d7 messagingapp/shareui/sis/shareui_stub.pkg diff -r a32b19fb291e -r 5b14749788d7 messagingapp/shareui/src/shareui.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingapp/shareui/src/shareuiprivate.cpp --- a/messagingapp/shareui/src/shareuiprivate.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/shareui/src/shareuiprivate.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -69,7 +69,6 @@ */ ShareUiPrivate::~ShareUiPrivate() { - reset(); } /** @@ -80,13 +79,12 @@ mFileList.clear(); mIndexActionMap.clear(); + foreach(XQAiwRequest* request,mAiwRequestList) + { + delete request; + } mAiwRequestList.clear(); - if ( mSharePopup ) - { - delete mSharePopup; - mSharePopup = 0; - } } /** @@ -99,7 +97,7 @@ bool ShareUiPrivate::init(QStringList& fileList, bool embedded) { reset(); - + mIsEmbedded = embedded; // No input files if ( fileList.count() == 0 ) { @@ -130,6 +128,7 @@ if ( fileList.count() != filteredFileList.count() ) { showNote(LOC_PROTECTED_CONTENT); + return true; } // Only protected content @@ -210,9 +209,10 @@ mSharePopup->setAttribute( Qt::WA_DeleteOnClose, true ); HbTextItem* heading = new HbTextItem(LOC_SEND_SELECTED_ITEM, mSharePopup); heading->setAlignment(Qt::AlignCenter); - mSharePopup->setDismissPolicy(HbDialog::NoDismiss); + mSharePopup->setDismissPolicy(HbDialog::TapAnywhere); mSharePopup->setHeadingWidget(heading); mSharePopup->setFrameType(HbDialog::Strong); + connect(mSharePopup, SIGNAL(aboutToClose()), this, SLOT(reset())); // Content widget mContentListView = new HbListView(mSharePopup); @@ -273,6 +273,7 @@ */ void ShareUiPrivate::onTriggered(void) { + XQAiwRequest* request = 0; request = qobject_cast(sender()); if(request) @@ -280,6 +281,7 @@ QList args; QVariant fileList(mFileList); args << fileList; + request->setEmbedded(mIsEmbedded); request->setArguments(args); } } @@ -288,9 +290,19 @@ * Slot for handling valid returns from the framework. */ void ShareUiPrivate::handleOk(const QVariant& result) - { +{ Q_UNUSED(result) + + XQAiwRequest* request = 0; + request = qobject_cast(sender()); + if(request) + { + disconnect(request, + SIGNAL(requestError(int,const QString&)), + this, + SLOT(handleError(int,const QString&))); } +} /** * Slot for handling errors from the framework. @@ -319,7 +331,8 @@ { action->setEnabled(true); action->activate(HbAction::Trigger); - } + } + mSharePopup->close(); } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/shareui/tsrc/testshareui/rom/testshareui.iby diff -r a32b19fb291e -r 5b14749788d7 messagingapp/shareui/tsrc/testshareui/sis/testshareui.pkg diff -r a32b19fb291e -r 5b14749788d7 messagingapp/shareui/tsrc/testshareui/sis/testshareui.sisx diff -r a32b19fb291e -r 5b14749788d7 messagingapp/shareui/tsrc/testshareui/testshareui.pro diff -r a32b19fb291e -r 5b14749788d7 messagingapp/smartmessaging/bwins/ringbcu.def diff -r a32b19fb291e -r 5b14749788d7 messagingapp/smartmessaging/eabi/ringbcu.def diff -r a32b19fb291e -r 5b14749788d7 messagingapp/smartmessaging/ringbc/inc/ringbc.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/smartmessaging/ringbc/inc/ringbc_p.h diff -r a32b19fb291e -r 5b14749788d7 messagingapp/smartmessaging/ringbc/inc/ringbctoneconverter.h --- a/messagingapp/smartmessaging/ringbc/inc/ringbctoneconverter.h Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/smartmessaging/ringbc/inc/ringbctoneconverter.h Thu Jul 22 16:32:06 2010 +0100 @@ -23,7 +23,7 @@ // INCLUDES #include -#include "NsmRingTone.h" +#include "nsmringtone.h" // FORWARD DECLARATIONS NONSHARABLE_STRUCT( TInstruction ) diff -r a32b19fb291e -r 5b14749788d7 messagingapp/smartmessaging/ringbc/ringbc.pro --- a/messagingapp/smartmessaging/ringbc/ringbc.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/smartmessaging/ringbc/ringbc.pro Thu Jul 22 16:32:06 2010 +0100 @@ -26,7 +26,7 @@ INCLUDEPATH += . INCLUDEPATH += ../../../inc -INCLUDEPATH += ../../msgutils/s60qconversions/inc + symbian: { @@ -48,6 +48,15 @@ } +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/ringbc.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/ringbc.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + HEADERS += inc/ringbc.h \ inc/ringbc_p.h \ inc/ringbctoneconverter.h @@ -56,6 +65,7 @@ src/ringbc_p.cpp \ src/ringbctoneconverter.cpp -LIBS += -ls60qconversions \ - -lplatformenv +LIBS += -lplatformenv \ + -lxqutils \ + -lefsrv diff -r a32b19fb291e -r 5b14749788d7 messagingapp/smartmessaging/ringbc/src/ringbc.cpp --- a/messagingapp/smartmessaging/ringbc/src/ringbc.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/smartmessaging/ringbc/src/ringbc.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -24,7 +24,6 @@ #include "ringbc.h" #include "ringbc_p.h" #include "ringbctoneconverter.h" -#include "s60qconversions.h" #include "debugtraces.h" // ================= MEMBER FUNCTIONS ======================= diff -r a32b19fb291e -r 5b14749788d7 messagingapp/smartmessaging/ringbc/src/ringbc_p.cpp --- a/messagingapp/smartmessaging/ringbc/src/ringbc_p.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/smartmessaging/ringbc/src/ringbc_p.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -25,7 +25,7 @@ // USER INCLUDES #include "ringbc_p.h" #include "ringbctoneconverter.h" -#include "s60qconversions.h" +#include #include "debugtraces.h" //CONSTANTS @@ -129,7 +129,7 @@ CleanupClosePushL(fsSession); - HBufC* fileName = S60QConversions::qStringToS60Desc(path); + HBufC* fileName = XQConversions::qStringToS60Desc(path); RFile file; User::LeaveIfError(file.Open(fsSession, fileName->Des(), @@ -142,7 +142,6 @@ HBufC8* dataBuf = HBufC8::NewLC(size); TPtr8 data(dataBuf->Des()); User::LeaveIfError(file.Read(data, size)); - CleanupStack::PopAndDestroy(&file); TBool valid = mConverter->IsRingToneMimeTypeL(data); @@ -152,7 +151,7 @@ TFileName path = PathInfo::PhoneMemoryRootPath(); path.Append(PathInfo::SimpleSoundsPath()); path.Append(*title); - HBufC* fileExtension = S60QConversions::qStringToS60Desc(extension); + HBufC* fileExtension = XQConversions::qStringToS60Desc(extension); path.Append(fileExtension->Des()); CFileMan* fileMan = CFileMan::NewL(fsSession); @@ -166,9 +165,9 @@ } CleanupStack::PopAndDestroy(); // dataBuf + CleanupStack::PopAndDestroy(); //file CleanupStack::PopAndDestroy(); //fsSession - QDEBUG_WRITE("RingBcPrivate::saveToneL : Exit") } @@ -184,7 +183,7 @@ QStringList pathList = path.split("."); QString extension = pathList.at(pathList.count() - 1); - HBufC* fileName = S60QConversions::qStringToS60Desc(path); + HBufC* fileName = XQConversions::qStringToS60Desc(path); TRAP_IGNORE( title = titleL(*fileName)); title.append(QChar('.')); @@ -227,7 +226,7 @@ if (valid) { HBufC* toneTitle = mConverter->TitleLC(data); - title = S60QConversions::s60DescToQString(*toneTitle); + title = XQConversions::s60DescToQString(*toneTitle); CleanupStack::PopAndDestroy(); //title } CleanupStack::PopAndDestroy(); //dataBuf diff -r a32b19fb291e -r 5b14749788d7 messagingapp/smartmessaging/ringbc/src/ringbctoneconverter.cpp --- a/messagingapp/smartmessaging/ringbc/src/ringbctoneconverter.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingapp/smartmessaging/ringbc/src/ringbctoneconverter.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -24,7 +24,7 @@ // USER INCLUDES #include "ringbctoneconverter.h" -#include "NsmRingTone.h" +#include "nsmringtone.h" #include "debugtraces.h" diff -r a32b19fb291e -r 5b14749788d7 messagingapp/tsrc/msgapptestsuite/msgapptestsuite.cfg --- a/messagingapp/tsrc/msgapptestsuite/msgapptestsuite.cfg Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -TConversationEngine \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/tsrc/msgapptestsuite/msgapptestsuite.pro --- a/messagingapp/tsrc/msgapptestsuite/msgapptestsuite.pro Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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 - -CONFIG += symbian_test - -TEMPLATE = app -TARGET = MsgAppTestSuite -TARGET.CAPABILITY = All -TCB -DRM -DEPENDPATH += . -INCLUDEPATH += . -INCLUDEPATH += ../../msgui/appengine/tsrc -INCLUDEPATH += ../../msgui/appengine/tsrc/testconversationengine/inc - - -# Input -SOURCES += src/main.cpp - -SYMBIAN_PLATFORMS = WINSCW ARMV5 -symbian { - TARGET.UID3 = 0x2001FE76 - TARGET.EPOCSTACKSIZE = 0x8000 - TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000 - BLD_INF_RULES.prj_testexports += "msgapptestsuite.cfg c:/msgapptestsuite.cfg" - BLD_INF_RULES.prj_testexports += "msgapptestsuitreport.pl c:/msgapptestsuitreport.pl" - - testdll.sources = testconversationengine.dll - testdll.path = /sys/bin - DEPLOYMENT += testdll - } - -LIBS += \ - -ltestconversationengine \ \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/tsrc/msgapptestsuite/msgapptestsuitreport.pl --- a/messagingapp/tsrc/msgapptestsuite/msgapptestsuitreport.pl Thu Jun 17 09:57:06 2010 +0100 +++ /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: -# -#!/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 "\n"; - printf MYFILE "$passed\n"; - printf MYFILE "\n"; - - if($failed > 0) - { - printf MYFILE "\n"; - printf MYFILE "$failed\n"; - printf MYFILE "\n"; - } - else - { - printf MYFILE "\n"; - printf MYFILE "$failed\n"; - printf MYFILE "\n"; - } - - printf MYFILE "\n"; - printf MYFILE "$skipped\n"; - printf MYFILE "\n"; - - printf MYFILE "\n"; - printf MYFILE "$total\n"; - printf MYFILE "\n"; - - printf MYFILE "\n"; - printf MYFILE ("$passrateround %%\n"); - printf MYFILE "\n"; - - printf MYFILE "\n"; - printf MYFILE "$runrateround %%\n"; - printf MYFILE "\n"; - - -} - -sub parse_file - { - my $pattern = "Totals"; - my $file = $_[0]; - open (FILE,$file); - - while (my $line= ) - { - 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 "\n"; - printf MYFILE "\n"; - printf MYFILE "\n"; - printf MYFILE "MsgApp Test Suite Reports"; - printf MYFILE "\n"; - printf MYFILE "

Messaging Test Suite Report

\n"; - printf MYFILE "\n"; - printf MYFILE "\n"; - printf MYFILE "\n"; - printf MYFILE "\n"; - printf MYFILE "\n"; - printf MYFILE "\n"; - printf MYFILE "\n"; - printf MYFILE "\n"; - printf MYFILE "\n"; - printf MYFILE "\n"; - - - my @files = ; - 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 "\n"; - printf MYFILE "\n"; - - parse_file $file; - - printf MYFILE "\n"; - } - - printf MYFILE "\n"; - printf MYFILE "\n"; - - - printf MYFILE "\n"; - - printf MYFILE "\n"; - - printf MYFILE "\n"; - - printf MYFILE "\n"; - - my $passrate = $TOTALPASSED*100/$TOTALCASES; - my $passrateround = sprintf("%.0f",$passrate); - printf MYFILE "\n"; - - my $runrate = ($TOTALCASES - $TOTALSKIPPED)*100/$TOTALCASES; - my $runrateround = sprintf("%.0f",$runrate); - printf MYFILE "\n"; - - printf MYFILE "\n"; - - printf MYFILE "
ModulePassedFailedSkippedTotal CasesPass RateRun Rate
\n"; - printf MYFILE "$name\n"; - printf MYFILE "
\n"; - printf MYFILE "Overall\n"; - printf MYFILE "\n"; - printf MYFILE "$TOTALPASSED\n"; - printf MYFILE "\n"; - printf MYFILE "$TOTALFAILED\n"; - printf MYFILE "\n"; - printf MYFILE "$TOTALSKIPPED\n"; - printf MYFILE "\n"; - printf MYFILE "$TOTALCASES\n"; - printf MYFILE "\n"; - printf MYFILE "$passrateround%%\n"; - printf MYFILE "\n"; - printf MYFILE "$runrateround%%\n"; - printf MYFILE "
\n"; - printf MYFILE "\n"; - printf MYFILE "\n"; - - close (MYFILE); - } - - -generate_report; \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/tsrc/msgapptestsuite/src/main.cpp --- a/messagingapp/tsrc/msgapptestsuite/src/main.cpp Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +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 class for msgapptestsuite. - */ - -#include -#include "testconversationengine.h" - -//out put directory for test results. -QString OUTPUTDIRECTORY = "c:/logs/messagingtestsuite"; -//o/p directory for data to be written on temp file. -QString TEMPDIR = "c:/logs/messagingtestsuite/testdata"; -//test result O/P file name. -QString RESULTFILE = "c:/logs/messagingtestsuite/result_%1.txt"; -// folder named UID3 of msgapptestsuite inside private folder. -const QString PRIVATE_DIR("C:/private/2001fe76"); - -//factory method to create objects. -QObject* getObject(QString className) -{ - if(className == "TConversationEngine" ) - { - return new TConversationEngine(); - } - else - { - return 0; - } -} - -//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 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:/msgapptestsuite.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; - } diff -r a32b19fb291e -r 5b14749788d7 messagingapp/tsrc/testapp.bat --- a/messagingapp/tsrc/testapp.bat Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -@rem -@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - -@ECHO off -CLS -ECHO ...Running Test cases -CALL /epoc32/RELEASE/WINSCW/udeb/MsgAppTestSuite.exe -dtextshell -- -ECHO ... - -ECHO ...Generating Report. -CALL perl /epoc32/winscw/c/msgapptestsuitreport.pl -ECHO ...Done - -CALL /epoc32/winscw/c/logs/messagingtestsuite/report.html \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingapp/tsrc/tsrc.pro --- a/messagingapp/tsrc/tsrc.pro Thu Jun 17 09:57:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +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: -# - -TEMPLATE = subdirs - -CONFIG += symbian_test - -SUBDIRS += ../msgui/appengine/tsrc/testconversationengine/testconversationengine.pro -SUBDIRS += msgapptestsuite/msgapptestsuite.pro - -CONFIG += ordered \ No newline at end of file diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/messagingappbase.pro diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/msgmedia/src/MmsConformance.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/msgmedia/src/MsgMediaInfo.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/msgmedia/src/MsgMediaResolver.cpp --- a/messagingappbase/msgmedia/src/MsgMediaResolver.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingappbase/msgmedia/src/MsgMediaResolver.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -43,7 +43,7 @@ #include // Resources -#include +#include #include "MsgMedia.hrh" #include "MsgMediaResolver.h" diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/msgmedia/src/MsgVideoInfo.cpp --- a/messagingappbase/msgmedia/src/MsgVideoInfo.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingappbase/msgmedia/src/MsgVideoInfo.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -122,11 +122,6 @@ // ----------------------------------------------------------------------------- void CMsgVideoInfo::ResolveVideoInfoL( RFile& aFile ) { - CCoeEnv* env = CCoeEnv::Static(); - if ( !env ) - { - User::Leave( KErrNotSupported ); - } CHXMetaDataUtility* dataUtil = CHXMetaDataUtility::NewL(); diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/Group/messaging_obex.history.xml diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/Group/messaging_obex.mrp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/Rom/obex.hby --- a/messagingappbase/obexmtms/Rom/obex.hby Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingappbase/obexmtms/Rom/obex.hby Thu Jul 22 16:32:06 2010 +0100 @@ -20,17 +20,17 @@ REM Messaging OBEX MTM is not included in this ROM, because it depends on excluded OBEX #else -#ifdef SYMBIAN_EXCLUDE_INFRARED +#ifndef __IRDA REM Infrared watcher is not included in this ROM, because it depends on excluded INFRARED #else data=MULTI_LINGUIFY(RSC ZSYSTEM\Data\irwatcher System\Data\irwatcher) -#endif // SYMBIAN_EXCLUDE_INFRARED +#endif // __IRDA -#ifdef SYMBIAN_EXCLUDE_BLUETOOTH +#ifndef __BT REM Bluetooth watcher is not included in this ROM, because it depends on excluded BLUETOOTH #else REM data=MULTI_LINGUIFY(RSC ZSYSTEM\Data\btwatcher System\Data\btwatcher) -#endif // SYMBIAN_EXCLUDE_BLUETOOTH +#endif // __BT #endif // SYMBIAN_EXCLUDE_OBEX diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/Rom/obex.iby --- a/messagingappbase/obexmtms/Rom/obex.iby Thu Jun 17 09:57:06 2010 +0100 +++ b/messagingappbase/obexmtms/Rom/obex.iby Thu Jul 22 16:32:06 2010 +0100 @@ -30,7 +30,7 @@ //file=ABI_DIR\BUILD_DIR\msgth.dll System\libs\msgth.dll -#ifdef SYMBIAN_EXCLUDE_INFRARED +#ifndef __IRDA REM Messaging infrared MTM is not included in this ROM, because it depends on excluded INFRARED #else //IR MTM Client @@ -41,10 +41,10 @@ //IR MTM Resources data=DATAZ_\resource\messaging\mtm\irmtm.rsc resource\messaging\mtm\irmtm.rsc -#endif // SYMBIAN_EXCLUDE_INFRARED +#endif // __IRDA -#ifdef SYMBIAN_EXCLUDE_BLUETOOTH +#ifndef __BT REM Messaging Bluetooth MTM is not included in this ROM, because it depends on excluded BLUETOOTH #else //BT MTM Client @@ -55,7 +55,7 @@ //BT MTM Resources data=DATAZ_\resource\messaging\mtm\btmtm.rsc resource\messaging\mtm\btmtm.rsc -#endif // SYMBIAN_EXCLUDE_BLUETOOTH +#endif // __BT //Test Harness Executable diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/TObexMTM/obexstub/BluetoothSdpStub/sdp/agent/SdpagentStub.mmp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/TObexMTM/obexstub/BluetoothSdpStub/sdp/bld.inf diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/TObexMTM/obexstub/IrobexStub/group/BLD.INF diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/TObexMTM/obexstub/IrobexStub/group/irobexstub.mmp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/TObexMTM/testutils/msgth/group/msgth.mmp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/btmtm/btclient/Include/btcmtm.h diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/btmtm/btclient/group/BLD.INF diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/btmtm/btclient/source/btcmtm.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/btmtm/btserver/group/BLD.INF diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/btmtm/btserver/source/btsendop.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/irmtm/irclient/group/BLD.INF diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/irmtm/irclient/include/IRCMTM.H diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/irmtm/irclient/source/Ircmtm.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/irmtm/irserver/group/BLD.INF diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/obexmtm/obexclient/group/BLD.INF diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/obexmtm/obexclient/include/obexClientMtm.h diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/obexmtm/obexserver/group/BLD.INF diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/obexmtm/obexserver/source/obexSendOp_normal.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/obexmtm/obexutil/group/BLD.INF diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/obexmtm/obexutil/source/ObexSdpUtils.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/obexmtm/obexutil/source/obexMtmUtil.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/obexmtms/obexmtm/obexutil/source/obexpasswordexternaliser.cpp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/smilparser/GROUP/messaging_gmxml.mrp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/smilparser/SMILdtd/GROUP/t_smil_dom.mmp diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/smilparser/SMILdtd/INC/SmilDtd.h diff -r a32b19fb291e -r 5b14749788d7 messagingappbase/smilparser/SMILdtd/SRC/Smildtd.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/clientmtm/inc/mmsnotificationclient.h diff -r a32b19fb291e -r 5b14749788d7 mmsengine/clientmtm/src/mmsclient.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/clientmtm/src/mmsnotificationclient.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/conf/mmsengine.confml Binary file mmsengine/conf/mmsengine.confml has changed diff -r a32b19fb291e -r 5b14749788d7 mmsengine/genutils/bld/mmsgenutils.mmp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/genutils/src/mmsgenutils.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/inc/mmsgenutils.h diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmscodec/bld/mmscodec.mmp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmscodec/src/mmsdecode.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmscodec/src/mmsencode.cpp --- a/mmsengine/mmscodec/src/mmsencode.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/mmsengine/mmscodec/src/mmsencode.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -22,6 +22,7 @@ // INCLUDE FILES #include +#include #include #include #include diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmscodecclient/src/mmscodecclient.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsconf/messaging_mmssettings-config.history.xml diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsconf/messaging_mmssettings-config.mrp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsconf/mmssettings_10202d4c.crml diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsconninit/src/mmsconninit.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsengine.pro --- a/mmsengine/mmsengine.pro Thu Jun 17 09:57:06 2010 +0100 +++ b/mmsengine/mmsengine.pro Thu Jul 22 16:32:06 2010 +0100 @@ -44,12 +44,12 @@ #### xml files containing backup_registration #### "./group/backup_registration.xml /epoc32/data/z/private/100058DB/backup_registration.xml" \ #### loc file needed for rsc generation - "./loc/mmsui.loc APP_LAYER_LOC_EXPORT_PATH(mmsui.loc)" \ + "./loc/MmsUi.loc APP_LAYER_LOC_EXPORT_PATH(mmsui.loc)" \ #### Export confml and crml files #### "./conf/mmsengine.confml APP_LAYER_CONFML(mmsengine.confml)" \ - "./conf/mmsengine_100058db.crml APP_LAYER_CRML(mmsengine_100058db.crml)" \ - "./conf/mmsengine_101fb0d5.crml APP_LAYER_CRML(mmsengine_101fb0d5.crml)" \ - "./conf/mmsengine_101fb0d9.crml APP_LAYER_CRML(mmsengine_101fb0d9.crml)" + "./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)" } symbian { @@ -65,4 +65,4 @@ "./mmspushhandler/bld/mmspushhandler.mmp" \ "./applicationadapter/bld/mmsapplicationadapter.mmp" \ "./mmscodecclient/bld/mmscodecclient.mmp" -} \ No newline at end of file +} diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmshttptransport/bld/mmstransport.mmp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmshttptransport/inc/mmssession.h diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmshttptransport/inc/mmstransaction.h diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmshttptransport/src/mmstransaction.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsmessage/bld/mmsmessage.mmp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsmessage/inc/mmsmessageoperation.h diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsmessage/inc/mmsownnumber.h diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsmessage/src/mmsheaders.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsmessage/src/mmsmessageoperation.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsmessage/src/mmsownnumber.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmspushhandler/bld/mmspushhandler.mmp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmspushhandler/inc/CMmsPushHandler.h diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmspushhandler/src/101F4693.rss diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmspushhandler/src/CMmsPushHandler.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/bld/mmsserver.mmp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/inc/mmsbaseoperation.h diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/inc/mmsdeleteoperation.h diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/inc/mmsforwardoperation.h diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/inc/mmslog.h diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/inc/mmsserver.h diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/src/mmsbaseoperation.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/src/mmsdeleteoperation.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/src/mmsforwardoperation.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/src/mmslog.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/src/mmsmmboxlist.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/src/mmsreadreport.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/src/mmsreceivemessage.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/src/mmssendoperation.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserver/src/mmsserver.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserversettings/bld/mmsserversettings.mmp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserversettings/src/mmsmessagestoreutils.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserversettings/src/mmsregisteredapplications.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserversettings/src/mmsschedulesettingsutils.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmsserversettings/src/mmssettings.cpp --- a/mmsengine/mmsserversettings/src/mmssettings.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/mmsengine/mmsserversettings/src/mmssettings.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -138,7 +138,7 @@ iApplicationFolderId = KMsvNullIndexEntryId; iAccesspointArray.Reset(); iReceivingModeHome = EMmsReceivingAutomatic; - iReceivingModeForeign = EMmsReceivingManual; + iReceivingModeForeign = EMmsReceivingAutomatic; iAcceptPersonal = ETrue; iAcceptAdvertisement = ETrue; iAcceptInformational = ETrue; diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmssettings/group/messaging_mmssettings.mrp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/mmswatcher/src/mmswatcher.cpp diff -r a32b19fb291e -r 5b14749788d7 mmsengine/rom/MmsEngine.iby diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/clientmtm/bwins/V2_SMCMU.DEF diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/clientmtm/eabi/v2_smcmu.def diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/clientmtm/group/smcm.mmp --- a/mobilemessaging/smsmtm/clientmtm/group/smcm.mmp Thu Jun 17 09:57:06 2010 +0100 +++ b/mobilemessaging/smsmtm/clientmtm/group/smcm.mmp Thu Jul 22 16:32:06 2010 +0100 @@ -45,7 +45,7 @@ APP_LAYER_SYSTEMINCLUDE_SYMBIAN LIBRARY euser.lib estor.lib bafl.lib etext.lib -LIBRARY gsmu.lib msgs.lib cntmodel.lib biodb.lib efsrv.lib +LIBRARY gsmu.lib msgs.lib biodb.lib efsrv.lib LIBRARY commsdat.lib LIBRARY etelmm.lib diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/clientmtm/inc/SMSCLNT.H diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/clientmtm/inc/smut.h --- a/mobilemessaging/smsmtm/clientmtm/inc/smut.h Thu Jun 17 09:57:06 2010 +0100 +++ b/mobilemessaging/smsmtm/clientmtm/inc/smut.h Thu Jul 22 16:32:06 2010 +0100 @@ -130,8 +130,6 @@ private: static void CompareEntryL(const TMsvEntry& aEntry, TUid aMtm, TMsvId& aFirstId, CMsvEntrySelection* aServiceIds); - static void GetName(CContactItemField& aField, TUid aFieldType, TDes& aName); - static void DoGetDetailsL(RFs& aFs, const TDesC& aFromAddress, TDes& aDetails, TInt aMaxLength); static void Replace(const TDesC& aOld, const TDesC& aNew, TDes& aString); static TBool DoGetDescriptionL(const CSmsMessage& aMessage, TDes& aDescription, TInt aMaxLength); diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/clientmtm/src/SMSCLNT.CPP diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/clientmtm/src/smut.cpp --- a/mobilemessaging/smsmtm/clientmtm/src/smut.cpp Thu Jun 17 09:57:06 2010 +0100 +++ b/mobilemessaging/smsmtm/clientmtm/src/smut.cpp Thu Jul 22 16:32:06 2010 +0100 @@ -373,7 +373,7 @@ KErrAlreadyExists if more than one contact entry found. KErrNone if details is obtained successfully. */ -EXPORT_C TInt TSmsUtilities::GetDetails(RFs& aFs, const TDesC& aFromAddress, TDes& aDetails, TInt aMaxLength) +EXPORT_C TInt TSmsUtilities::GetDetails(RFs& /*aFs*/, const TDesC& aFromAddress, TDes& aDetails, TInt aMaxLength) { __ASSERT_DEBUG( aMaxLength <= aDetails.MaxLength(), User::Invariant() ); @@ -382,9 +382,7 @@ aMaxLength = aDetails.MaxLength(); } - TRAPD(err, DoGetDetailsL(aFs, aFromAddress, aDetails, aMaxLength)); - - if ( (err != KErrNone) || (aDetails.Length() == 0) ) + if ( (aDetails.Length() == 0) ) { if (aFromAddress.Length() <= aMaxLength) { @@ -524,130 +522,6 @@ } } -void TSmsUtilities::DoGetDetailsL(RFs& aFs, const TDesC& aFromAddress, TDes& aDetails, TInt aMaxLength) - { - __UHEAP_MARK; - - // Check that aFromAddress is a valid GSM telephone number - if (!ValidGsmNumber(aFromAddress)) - User::Leave(KErrArgument); - - aDetails.Zero(); - - CContactDatabase* db = CContactDatabase::OpenL(); - CleanupStack::PushL(db); - - // Lookup the telephone number (aFromAddress) in the contact database - CContactIdArray* contactId = db->MatchPhoneNumberL(aFromAddress, KLowerSevenDigits); - CleanupStack::PushL(contactId); - - // Add the name if there is one and only one match in contacts. If there's more than - // one then wouldn't know which one to choose - if (contactId->Count() <= 0) - { - //The telephone number (aFromAddress) was not found in the contact database. - User::Leave(KErrNotFound); - } - else if (contactId->Count() > 1) - { - //There's more than one telephone number match in contacts. - User::Leave(KErrAlreadyExists); - } - - CContactItem* newContact = db->ReadMinimalContactL((*contactId)[0]); - CleanupStack::PushL(newContact); - - CContactItemFieldSet& fieldSet = newContact->CardFields(); - - TInt count = fieldSet.Count(); - - HBufC* family = HBufC::NewLC(aMaxLength); - HBufC* given = HBufC::NewLC(aMaxLength); - TPtr familyPtr(family->Des()); - TPtr givenPtr(given->Des()); - - // Find the Given and First Name of the contact - // Order important - for (TInt curField = 0; curField < count && !(familyPtr.Length() && givenPtr.Length()); curField++) - { - CContactItemField& field = fieldSet[curField]; - - if (!familyPtr.Length()) - GetName(field, KUidContactFieldFamilyName, familyPtr); - - if (!givenPtr.Length()) - GetName(field, KUidContactFieldGivenName, givenPtr); - } - - familyPtr.Trim(); - givenPtr.Trim(); - - TInt familyLen = familyPtr.Length(); - TInt givenLen = givenPtr.Length(); - - if (!familyLen && !givenLen) - { - //Leave if no family nor given name found - User::Leave(KErrNotFound); - } - else if (givenLen == 0) - { - // The maximum length of familyPtr may be greater than - // aMaxLength, so need to check its length before copying. - if (familyPtr.Length() > aMaxLength) - { - familyPtr.Set(familyPtr.LeftTPtr(aMaxLength)); - } - - aDetails = familyPtr; - } - else if (familyLen == 0) - { - // The maximum length of givenPtr may be greater than - // aMaxLength, so need to check its length before copying. - if (givenPtr.Length() > aMaxLength) - { - givenPtr.Set(givenPtr.LeftTPtr(aMaxLength)); - } - - aDetails = givenPtr; - } - else - { - RResourceFile resFile = OpenResourceFileL(aFs); - CleanupClosePushL(resFile); - ReadResourceStringL(resFile, R_SENDER_NAME_FORMAT, aDetails); - CleanupStack::PopAndDestroy(&resFile); - - TBuf<8> givenPlaceHolder = L_SMS_GIVEN_NAME; - TBuf<8> familyPlaceHolder = L_SMS_FAMILY_NAME; - TInt minLength = aDetails.Length() - givenPlaceHolder.Length() - familyPlaceHolder.Length(); - - if ((familyLen + givenLen + minLength) > aMaxLength) - { - // The maximum length of familyPtr may be greater than - // aMaxLength, so need to check its length before copying. - if (familyPtr.Length() > aMaxLength) - { - familyPtr.Set(familyPtr.LeftTPtr(aMaxLength)); - } - aDetails = familyPtr; - } - else - { - Replace(givenPlaceHolder, givenPtr, aDetails); - Replace(familyPlaceHolder, familyPtr, aDetails); - } - } - - //Remove leading and trailing spaces - aDetails.Trim(); - - CleanupStack::PopAndDestroy(5, db); - - __UHEAP_MARKEND; - } - TBool TSmsUtilities::ValidGsmNumber(const TDesC& aTelephone) { // Returns ETrue if @@ -705,17 +579,6 @@ return validTel && validCharsFound >= KSmsValidGsmNumberMinLength; } -void TSmsUtilities::GetName(CContactItemField& aField, TUid aFieldType, TDes& aName) - { - __UHEAP_MARK; - if (aField.ContentType().ContainsFieldType(aFieldType)) - { - TPtrC name = aField.TextStorage()->Text(); - aName = name.Left(Min(aName.MaxLength(), name.Length())); - } - __UHEAP_MARKEND; - } - TBool TSmsUtilities::DoGetDescriptionL(const CSmsMessage& aMessage, TDes& aDescription, TInt aMaxLength) // this function returns EFalse if aMessage has no special message indication data and is not an SMS_STATUS_REPORT, // i.e. more needs to be done to extract the description from the message diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/group/messaging_sms.history.xml diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/group/messaging_sms.mrp diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/servermtm/inc/SMSSERV.H diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/servermtm/src/SMSSERV.CPP diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/servermtm/src/SMSSOUTB.CPP diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/test/class0smsnotifier/group/class0smsUInotifier.mmp diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/test/group/T_CSmsSettings.mmp diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/test/group/T_SmsSendAs.mmp diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/test/group/t_SmsReplyToServer.mmp diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/test/group/t_SmsSpecialIndicationsServer.mmp diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/test/group/t_smsinit.mmp diff -r a32b19fb291e -r 5b14749788d7 mobilemessaging/smsmtm/test/testrom/bld.inf diff -r a32b19fb291e -r 5b14749788d7 msg_plat/conversation_services_client_api/inc/ccsrequesthandler.h --- a/msg_plat/conversation_services_client_api/inc/ccsrequesthandler.h Thu Jun 17 09:57:06 2010 +0100 +++ b/msg_plat/conversation_services_client_api/inc/ccsrequesthandler.h Thu Jul 22 16:32:06 2010 +0100 @@ -309,6 +309,8 @@ */ IMPORT_C CCsClientConversation* GetConversationFromMessageIdL ( TInt aMessageId ); + IMPORT_C CCsClientConversation* GetConversationFromConversationIdL( TInt aConversationId ); + protected: // Functions from base classes /** @@ -388,6 +390,12 @@ * Handles delete conversation list event. */ void HandleDeleteConversationList (HBufC8* aResultsBuffer); + + /** + * HandlePartialDeleteConversationList + * Handles partial delete of conversation event. + */ + void HandlePartialDeleteConversationList(HBufC8* aResultsBuffer); /** * HandleModifyConversationList. diff -r a32b19fb291e -r 5b14749788d7 msg_plat/conversation_services_client_api/inc/mcsconversationlistchangeobserver.h --- a/msg_plat/conversation_services_client_api/inc/mcsconversationlistchangeobserver.h Thu Jun 17 09:57:06 2010 +0100 +++ b/msg_plat/conversation_services_client_api/inc/mcsconversationlistchangeobserver.h Thu Jul 22 16:32:06 2010 +0100 @@ -59,6 +59,13 @@ virtual void DeleteConversationList( const CCsClientConversation& aClientConversation) = 0; + /** + * PartialDeleteConversationList + * This is for handling of partial delete of conversation event + * generated from the server + */ + virtual void PartialDeleteConversationList( + const CCsClientConversation& aClientConversation) = 0; /** * ModifyConversationList * This is for handling modify conversation asynchronusly diff -r a32b19fb291e -r 5b14749788d7 msg_plat/conversation_services_client_api/inc/rcssession.h --- a/msg_plat/conversation_services_client_api/inc/rcssession.h Thu Jun 17 09:57:06 2010 +0100 +++ b/msg_plat/conversation_services_client_api/inc/rcssession.h Thu Jul 22 16:32:06 2010 +0100 @@ -248,6 +248,8 @@ */ void GetConversationFromMessageIdL(TInt aMessageId, TPtr8 aResultsBuffer); + void GetConversationFromConversationIdL(TInt aConversationId, TPtr8 aResultsBuffer); + /** * MarkConversationReadL. * This function sends the request to conversation server diff -r a32b19fb291e -r 5b14749788d7 msg_plat/conversation_services_utilities_api/inc/ccsclientconversation.h diff -r a32b19fb291e -r 5b14749788d7 msg_plat/conversation_services_utilities_api/inc/ccsdefs.h --- a/msg_plat/conversation_services_utilities_api/inc/ccsdefs.h Thu Jun 17 09:57:06 2010 +0100 +++ b/msg_plat/conversation_services_utilities_api/inc/ccsdefs.h Thu Jul 22 16:32:06 2010 +0100 @@ -81,6 +81,7 @@ const TUint32 KConversationCachingEventError = 0x00000100; const TUint32 KConversationEventListRefresh = 0x00000200; const TUint32 KConversationEventRefresh = 0x00000400; +const TUint32 KConversationListEventPartialDelete = 0x00000800; //----------------------------------------------------------------------------- // Conversation Server caching status codes @@ -120,7 +121,9 @@ EGetConversationId, EGetConversationIdFromAddress, EGetConversationFromMessageId, - EUserMarkReadConversation + EUserMarkReadConversation, + EGetConversationFromConversationId, + EGetConversationFromConversationIdComplete }; //----------------------------------------------------------------------------- @@ -137,6 +140,7 @@ EModifyConversationListEvent, EAddConversationEvent, EDeleteConversationEvent, + EPartialDeleteConversationListEvent, EModifyConversationEvent, ECachingStartedEvent, ECachingCompletedEvent, @@ -194,6 +198,7 @@ ECsProvisioning, ECsBioMsg_VCard, ECsBioMsg_VCal, +ECsBioMgs_NokiaService, ECsUnknown }; @@ -289,15 +294,89 @@ enum { - EPreviewNone = 0x00, - EPreviewImage = 0x01, - EPreviewAudio = 0x02, - EPreviewVideo = 0x04, - EPreviewAttachment = 0x08 + EPreviewNone = 0x0000, + EPreviewImage = 0x0001, + EPreviewAudio = 0x0002, + EPreviewVideo = 0x0004, + EPreviewAttachment = 0x0008, + EPreviewForward = 0x0010, + EPreviewProtectedImage = 0x0020, + EPreviewProtectedAudio = 0x0040, + EPreviewProtectedVideo = 0x0080, + EPreviewCorruptedImage = 0x0100, + EPreviewCorruptedAudio = 0x0200, + EPreviewCorruptedVideo = 0x0400 +}; + +typedef TUint16 TCsMsgPreviewProperty; + +/** + * @typedef TCsPreviewMsgProcessingState + */ +enum +{ + EPreviewMsgNotProcessed = 0, + EPreviewMsgProcessing = 1, + EPreviewMsgProcessed = 2 }; -typedef TUint8 TCsMsgPreviewProperty; +/** +@publishedAll +@released + +Template class CleanupResetAndDestroy to clean up the array +of implementation information from the cleanup stack. +*/ + +template +class CleanupResetAndDestroy + { +public: + /** + Puts an item on the cleanup stack. + + @param aRef + The implementation information to be put on the cleanup stack. + */ + inline static void PushL(T& aRef); + inline static void PushL(T* aPointer); +private: + static void ResetAndDestroy(TAny *aPtr); + static void ResetAndDestroyDelete(TAny *aPtr); + }; +template +inline void CleanupResetAndDestroyPushL(T& aRef); +template +inline void CleanupResetAndDestroyPushL(T* aPointer); + +template +inline void CleanupResetAndDestroy::PushL(T& aRef) + {CleanupStack::PushL(TCleanupItem(&ResetAndDestroy,&aRef));} + +template +inline void CleanupResetAndDestroy::PushL(T* aPointer) + {CleanupStack::PushL(TCleanupItem(&ResetAndDestroyDelete,aPointer));} + +template +void CleanupResetAndDestroy::ResetAndDestroy(TAny *aPtr) + {(STATIC_CAST(T*,aPtr))->ResetAndDestroy();} + +template +void CleanupResetAndDestroy::ResetAndDestroyDelete(TAny *aPtr) + { + (STATIC_CAST(T*,aPtr))->ResetAndDestroy(); + delete (STATIC_CAST(T*,aPtr)); + } + +template +inline void CleanupResetAndDestroyPushL(T& aRef) + {CleanupResetAndDestroy::PushL(aRef);} + +template +inline void CleanupResetAndDestroyPushL(T* aPointer) + {CleanupResetAndDestroy::PushL(aPointer);} + #endif // __C_CSSERVER_DEFS_H__ // End of file diff -r a32b19fb291e -r 5b14749788d7 msg_plat/messaging_history_api/inc/msgitem.h diff -r a32b19fb291e -r 5b14749788d7 msg_plat/messaging_media_resolver_api/inc/MsgAudioInfo.h --- a/msg_plat/messaging_media_resolver_api/inc/MsgAudioInfo.h Thu Jun 17 09:57:06 2010 +0100 +++ b/msg_plat/messaging_media_resolver_api/inc/MsgAudioInfo.h Thu Jul 22 16:32:06 2010 +0100 @@ -25,7 +25,7 @@ #include -#include // MMdaAudioPlayerCallback & CMdaAudioPlayerUtility +#include // MMdaAudioPlayerCallback & CMdaAudioPlayerUtility #include // CONSTANTS diff -r a32b19fb291e -r 5b14749788d7 msg_plat/messaging_media_resolver_api/inc/MsgImageInfo.h diff -r a32b19fb291e -r 5b14749788d7 msg_plat/messaging_media_resolver_api/inc/MsgMediaInfo.h diff -r a32b19fb291e -r 5b14749788d7 msg_plat/messaging_media_resolver_api/inc/MsgMediaInfo.inl --- a/msg_plat/messaging_media_resolver_api/inc/MsgMediaInfo.inl Thu Jun 17 09:57:06 2010 +0100 +++ b/msg_plat/messaging_media_resolver_api/inc/MsgMediaInfo.inl Thu Jul 22 16:32:06 2010 +0100 @@ -23,9 +23,16 @@ // inline TPtrC CMsgMediaInfo::FullFilePath() const { - return iFullFilePath - ? iFullFilePath->Des() - : KNullDesC(); + + if(iFullFilePath) + { + return iFullFilePath->Des(); + } + else + { + return KNullDesC(); + } + } // ----------------------------------------------------------------------------- diff -r a32b19fb291e -r 5b14749788d7 msg_plat/messaging_media_resolver_api/inc/MsgMediaResolver.h diff -r a32b19fb291e -r 5b14749788d7 msg_plat/messaging_media_resolver_api/inc/MsgTextInfo.h diff -r a32b19fb291e -r 5b14749788d7 msg_plat/messaging_media_resolver_api/inc/MsgVideoInfo.h --- a/msg_plat/messaging_media_resolver_api/inc/MsgVideoInfo.h Thu Jun 17 09:57:06 2010 +0100 +++ b/msg_plat/messaging_media_resolver_api/inc/MsgVideoInfo.h Thu Jul 22 16:32:06 2010 +0100 @@ -27,7 +27,7 @@ #include // VideoPlayerUtility API -#include +#include // Base Class #include diff -r a32b19fb291e -r 5b14749788d7 msg_plat/mms_codec_client_api/inc/mmscodecclient.h diff -r a32b19fb291e -r 5b14749788d7 msg_plat/mms_codec_client_api/tsrc/src/MmsCodecClientApiTestBlocks.cpp diff -r a32b19fb291e -r 5b14749788d7 msg_plat/mms_conformance_api/inc/MmsConformance.h diff -r a32b19fb291e -r 5b14749788d7 msg_plat/mms_conformance_api/tsrc/inc/MMSConformanceAPITest.h diff -r a32b19fb291e -r 5b14749788d7 msg_plat/mms_engine_settings_api/inc/MmsEngineInternalCRKeys.h diff -r a32b19fb291e -r 5b14749788d7 msg_plat/shareui_api/inc/shareui.h diff -r a32b19fb291e -r 5b14749788d7 msg_plat/shareui_api/inc/shareuidialog.h diff -r a32b19fb291e -r 5b14749788d7 msg_pub/mms_client_mtm_api/inc/mmsclient.h diff -r a32b19fb291e -r 5b14749788d7 msg_pub/mms_client_mtm_api/tsrc/bc/src/MMSClientMTMBCTesterController.cpp diff -r a32b19fb291e -r 5b14749788d7 msg_pub/mms_client_mtm_api/tsrc/src/MmsClientMtmApiTest.cpp