# HG changeset patch # User hgs # Date 1283261018 -19800 # Node ID f42d9a78f43547bd582490d23e4ec609c77b57cd # Parent 5b3b2fa8c3eca2b9d0fe3aa8dac9e0df51a55bbd 201033_02 diff -r 5b3b2fa8c3ec -r f42d9a78f435 inc/convergedmessage.h --- a/inc/convergedmessage.h Wed Aug 18 00:46:12 2010 +0530 +++ b/inc/convergedmessage.h Tue Aug 31 18:53:38 2010 +0530 @@ -102,7 +102,9 @@ enum MessageProperty { Unread = 0x0001, - Attachment = 0x0002 + Attachment = 0x0002, + /** TP-RP (Reply Path) Found in first octet of Submit and Deliver. */ + ReplyPath = 0x0004 }; /** @@ -411,6 +413,33 @@ * @param stream data stream from which data is deserialized. */ void deserialize(QDataStream &stream); + + /** + * Sets the message property, if reply-path is present + * @param replypath, TP-RP (Reply Path) Found in first octet of + * Submit and Deliver PDU + */ + void setReplyPath(bool replypath = true); + + /** + * Tells if the reply-path is set for this message + * @return bool, if the reply-path exists + */ + bool replyPath(); + + /** + * Set originating service center address. This is used for reply + * purposes, if the reply-via-same-smsc flag is ON + * @param scaddress, service center address + */ + void setOriginatingSC(const QString& scaddress); + + /** + * Get originating service center address, + * if preserved for reply-via-same-smsc + * @return originating service center address + */ + const QString& originatingSC() const; private: /** diff -r 5b3b2fa8c3ec -r f42d9a78f435 inc/msgcontacthandler.h --- a/inc/msgcontacthandler.h Wed Aug 18 00:46:12 2010 +0530 +++ b/inc/msgcontacthandler.h Tue Aug 31 18:53:38 2010 +0530 @@ -28,6 +28,7 @@ #include #include #include +#include QTM_BEGIN_NAMESPACE class QContactManager; @@ -37,14 +38,14 @@ class MsgContactHandler { - + public: /** * This shall resolve contact number with display name * @param contactNumber number to resolve * @param displayName resolved name - * @param countPhoneNumber specifies number of contacts inside + * @param countPhoneNumber specifies number of contacts inside * the resolved contact ex mobile, home, office etc * @return contacts unique localId */ @@ -148,12 +149,12 @@ QContactPhoneNumber::FieldNumber); phoneFilter.setValue(phoneNumber); phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith); - + QList matchingContacts = phonebookManager.contacts(phoneFilter); return matchingContacts; } - + /** * Get display-name of a contact from VCard. * @param filePath, VCard file-path @@ -202,6 +203,46 @@ file.close(); return displayName; } + + /** + * Get list of self-addresses + * @return QStringList, list of self-addresses + */ + static QStringList selfAddresses() + { + QStringList selfAddrs; + QContactManager* contactManager = + new QContactManager("symbian"); + QContactLocalId selfId = contactManager->selfContactId(); + if( (selfId == 0) || + (contactManager->error() == QContactManager::DoesNotExistError) ) + { + // if no self-address exists + return selfAddrs; + } + + QContact selfContact = contactManager->contact(selfId); + + // append numbers to the list of self-addresses + QList selfPhoneNumbers = + selfContact.details(); + int selfNumCount = selfPhoneNumbers.count(); + for(int i=0; i< selfNumCount; i++) + { + selfAddrs << selfPhoneNumbers.at(i).number(); + } + + // append email-addresses to the list + QList selfEmailAddrs = + selfContact.details(); + int selfEmailAddrCount = selfEmailAddrs.count(); + for(int i=0; i< selfEmailAddrCount; i++) + { + selfAddrs << selfEmailAddrs.at(i).emailAddress(); + } + return selfAddrs; + } + }; #endif /* MSGCONTACTHANDLER_H_ */ diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgappfw/plugins/previewplugin/group/cspreviewplugin.mmp --- a/messagingapp/msgappfw/plugins/previewplugin/group/cspreviewplugin.mmp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgappfw/plugins/previewplugin/group/cspreviewplugin.mmp Tue Aug 31 18:53:38 2010 +0530 @@ -65,4 +65,5 @@ LIBRARY unidatamodel.lib LIBRARY charconv.lib LIBRARY centralrepository.lib -LIBRARY MsgMedia.lib \ No newline at end of file +LIBRARY MsgMedia.lib +LIBRARY imageconversion.lib \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp --- a/messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -35,6 +35,7 @@ #include #include #include +#include //CONSTANTS //DB-file _LIT(KDbFileName, "c:[2002A542]conversations.db"); @@ -61,8 +62,8 @@ const TInt KDefaultMaxSize = 300 * 1024; //Preview thumbnail size -const TInt KWidth = 9.5 * 6.7; -const TInt KHeight = 9.5 * 6.7; +const TInt KWidth = 24 * 6.7; +const TInt KHeight = 24 * 6.7; // NOTE:- DRAFTS ENTRIES ARE NOT HANDLED IN THE PLUGIN @@ -336,15 +337,18 @@ // skip processing this event for the given message return; } - + // start processing message, set flag setMsgProcessingState(msgId, EPreviewMsgProcessing); + + TRAPD( err, + { // update db with message preview data RSqlStatement sqlInsertStmt; CleanupClosePushL(sqlInsertStmt); sqlInsertStmt.PrepareL(iSqlDb, KSqlInsertStmt); - + // parse message iMmsMtm->SwitchCurrentEntryL(msgId); iMmsMtm->LoadMessageL(); @@ -352,7 +356,7 @@ CUniDataModel* iUniDataModel = CUniDataModel::NewL(ifsSession, *iMmsMtm); CleanupStack::PushL(iUniDataModel); iUniDataModel->RestoreL(*this, ETrue); - + //msg property TInt msgProperty = 0; if (iUniDataModel->AttachmentList().Count() > 0) @@ -499,6 +503,12 @@ //cleanup CleanupStack::PopAndDestroy(2, &sqlInsertStmt); + }); //TRAP + + if( err != KErrNone ) + { + setMsgProcessingState(msgId, EPreviewMsgNotProcessed); + } PRINT ( _L("Enter CCsPreviewPluginHandler::HandleMMSEntry end.") ); } @@ -897,15 +907,6 @@ void CCsPreviewPluginHandler::GetThumbNailL(TMsvAttachmentId attachmentId, TDesC8& mimeType, TMsvId msgId) { - //Scale the image - iThumbnailManager->SetFlagsL(CThumbnailManager::ECropToAspectRatio); - - //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); // Create Thumbnail object source representing a path to a file HBufC* mimeInfo = HBufC::NewLC(mimeType.Length()); @@ -919,6 +920,53 @@ RFile file = attachMan.GetAttachmentFileL(attachmentId); CleanupClosePushL(file); + //Find if the image is portrait image (or) landscape image + CImageDecoder *decoder = CImageDecoder::FileNewL(file,mimeType,ContentAccess::EUnknown); + CleanupStack::PushL(decoder); + TSize size(0,0); + + TFrameInfo info = decoder->FrameInfo(); + + size = info.iOverallSizeInPixels; + + CleanupStack::PopAndDestroy(decoder); + + TReal32 newLength = 0; + + if(size.iWidth >= size.iHeight) + { + //TODO replace with hb-param-graphic-size-image-portrait * value of un in pixcels + if(size.iWidth < KWidth) + { + iThumbnailManager->SetThumbnailSizeL(size); + } + else + { + newLength = (KWidth * size.iHeight) /size.iWidth; + iThumbnailManager->SetThumbnailSizeL(TSize(KWidth, newLength)); + } + } + else + { + //TODO replace with hb-param-graphic-size-image-portrait * value of un in pixcels + if(size.iHeight < KHeight) + { + iThumbnailManager->SetThumbnailSizeL(size); + } + else + { + newLength = (KHeight * size.iWidth) / size.iHeight; + iThumbnailManager->SetThumbnailSizeL(TSize(newLength, KHeight)); + } + } + + //Scale the image + iThumbnailManager->SetFlagsL(CThumbnailManager::ECropToAspectRatio); + + //optimize for performace + iThumbnailManager->SetQualityPreferenceL( + CThumbnailManager::EOptimizeForQuality); + CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( (RFile64&) file, mimeInfo->Des()); diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgappfw/server/inc/ccsconversation.h --- a/messagingapp/msgappfw/server/inc/ccsconversation.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgappfw/server/inc/ccsconversation.h Tue Aug 31 18:53:38 2010 +0530 @@ -160,8 +160,11 @@ * Add contact Number for the conversation * * @param aContactNumber Contact number + * @param aContactId Contact id */ - void AddContactDetailsL(TDesC& aContactNumber); + void AddContactDetailsL( + TDesC& aContactNumber, + TInt32 aContactID); /** * UpdateEntryL diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgappfw/server/src/ccsconversation.cpp --- a/messagingapp/msgappfw/server/src/ccsconversation.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgappfw/server/src/ccsconversation.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -295,9 +295,11 @@ // ---------------------------------------------------------------------------- void CCsConversation::AddContactDetailsL( - TDesC& aContactNumber) + TDesC& aContactNumber, + TInt32 aContactID) { iContact->AddPhoneNumberL(aContactNumber); + iContact->SetContactId(aContactID); } // ---------------------------------------------------------------------------- diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgappfw/server/src/ccsconversationcachehelper.cpp --- a/messagingapp/msgappfw/server/src/ccsconversationcachehelper.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgappfw/server/src/ccsconversationcachehelper.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -574,13 +574,15 @@ // fill firstname and lastname and contact Id if(aDisplayName) + { conversation->AddContactDetailsL(aContactId, aDisplayName); + } - // fill the phone number + // fill the phone number and contact Id if (aConversationEntry->Contact()) { - conversation->AddContactDetailsL(* (aConversationEntry->Contact())); + conversation->AddContactDetailsL(* (aConversationEntry->Contact()), aContactId); } // add into the list diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/bwins/msgerrorwatcheru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/bwins/msgerrorwatcheru.def Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,15 @@ +EXPORTS + ?trUtf8@MsgErrorWatcher@@SA?AVQString@@PBD0H@Z @ 1 NONAME ; class QString MsgErrorWatcher::trUtf8(char const *, char const *, int) + ?trUtf8@MsgErrorWatcher@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString MsgErrorWatcher::trUtf8(char const *, char const *) + ?qt_metacall@MsgErrorWatcher@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 3 NONAME ; int MsgErrorWatcher::qt_metacall(enum QMetaObject::Call, int, void * *) + ?ShowNote@MsgErrorWatcher@@QAEXW4TMsgErrorNoteIds@@@Z @ 4 NONAME ; void MsgErrorWatcher::ShowNote(enum TMsgErrorNoteIds) + ?staticMetaObject@MsgErrorWatcher@@2UQMetaObject@@B @ 5 NONAME ; struct QMetaObject const MsgErrorWatcher::staticMetaObject + ?metaObject@MsgErrorWatcher@@UBEPBUQMetaObject@@XZ @ 6 NONAME ; struct QMetaObject const * MsgErrorWatcher::metaObject(void) const + ?tr@MsgErrorWatcher@@SA?AVQString@@PBD0@Z @ 7 NONAME ; class QString MsgErrorWatcher::tr(char const *, char const *) + ??1MsgErrorWatcher@@UAE@XZ @ 8 NONAME ; MsgErrorWatcher::~MsgErrorWatcher(void) + ?getStaticMetaObject@MsgErrorWatcher@@SAABUQMetaObject@@XZ @ 9 NONAME ; struct QMetaObject const & MsgErrorWatcher::getStaticMetaObject(void) + ??_EMsgErrorWatcher@@UAE@I@Z @ 10 NONAME ; MsgErrorWatcher::~MsgErrorWatcher(unsigned int) + ??0MsgErrorWatcher@@QAE@PAVQObject@@@Z @ 11 NONAME ; MsgErrorWatcher::MsgErrorWatcher(class QObject *) + ?tr@MsgErrorWatcher@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString MsgErrorWatcher::tr(char const *, char const *, int) + ?qt_metacast@MsgErrorWatcher@@UAEPAXPBD@Z @ 13 NONAME ; void * MsgErrorWatcher::qt_metacast(char const *) + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/eabi/msgerrorwatcheru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/eabi/msgerrorwatcheru.def Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,15 @@ +EXPORTS + _ZN15MsgErrorWatcher11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN15MsgErrorWatcher11qt_metacastEPKc @ 2 NONAME + _ZN15MsgErrorWatcher16staticMetaObjectE @ 3 NONAME DATA 16 + _ZN15MsgErrorWatcher19getStaticMetaObjectEv @ 4 NONAME + _ZN15MsgErrorWatcher8ShowNoteE16TMsgErrorNoteIds @ 5 NONAME + _ZN15MsgErrorWatcherC1EP7QObject @ 6 NONAME + _ZN15MsgErrorWatcherC2EP7QObject @ 7 NONAME + _ZN15MsgErrorWatcherD0Ev @ 8 NONAME + _ZN15MsgErrorWatcherD1Ev @ 9 NONAME + _ZN15MsgErrorWatcherD2Ev @ 10 NONAME + _ZNK15MsgErrorWatcher10metaObjectEv @ 11 NONAME + _ZTI15MsgErrorWatcher @ 12 NONAME + _ZTV15MsgErrorWatcher @ 13 NONAME + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/inc/msgcenrepobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/inc/msgcenrepobserver.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,104 @@ +/* +* 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: +* CMsgCenRepObserver declaration file +* +*/ + + + +#ifndef CMSGCENREPOBSERVER_H +#define CMSGCENREPOBSERVER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CMsgErrorWatcherPrivate; +class CRepository; + +// CLASS DECLARATION +/** +* Class for observing CenRep if MMS Access Point in use changes +*/ +class CMsgCenRepObserver : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aRConnection opened RConnection + */ + static CMsgCenRepObserver* NewL(CMsgErrorWatcherPrivate& aWatcher); + + /** + * Destructor. + */ + virtual ~CMsgCenRepObserver(); + + public: // New functions + + /** + * Subscribe to a notification from CenRep + */ + void SubscribeNotification(); + + protected: // Functions from base classes + + /** + * Active object cancellation + */ + void DoCancel(); + + /** + * If RunL leaves + */ + TInt RunError( TInt aError ); + + private: + + /** + * C++ default constructor. + */ + CMsgCenRepObserver( CMsgErrorWatcherPrivate& aWatcher ); + + /** + * By default Symbian OS constructor is private. + * @param aRConnection opened RConnection + */ + void ConstructL(); + + /** + * Completion + */ + void RunL(); + + // By default, prohibit copy constructor + CMsgCenRepObserver( const CMsgCenRepObserver& ); + + // Prohibit assignment operator + CMsgCenRepObserver& operator= ( const CMsgCenRepObserver& ); + + private: // Data + + CMsgErrorWatcherPrivate& iWatcher; + CRepository* iRepository; + TUid iRepositoryUid; + TInt32 iKey; + + }; + +#endif // CMSGCENREPOBSERVER_H + +// End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorcommdbobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorcommdbobserver.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,104 @@ +/* +* 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: +* CMsgErrorCommDbObserver declaration file +* +*/ + + + +#ifndef MSGERRORCOMMDBOBSERVER_H +#define MSGERRORCOMMDBOBSERVER_H + +#include + +// FORWARD DECLARATIONS +class CMsgErrorWatcherPrivate; +class CCommsDatabase; + +// CLASS DECLARATION + +/** +* CMsgErrorCommDbObserver +*/ +class CMsgErrorCommDbObserver : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @param aWatcher A pointer to CMsgErrorWatcherPrivate + */ + static CMsgErrorCommDbObserver* NewL( CMsgErrorWatcherPrivate& aWatcher ); + + /** + * Destructor. + */ + virtual ~CMsgErrorCommDbObserver(); + + /** + * For external reactivating the active object. + */ + void Restart(); + + private: + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + /** + * Private C++ constructor. + * + * @param aWatcher A pointer to CMsgErrorWatcherPrivate + */ + CMsgErrorCommDbObserver( CMsgErrorWatcherPrivate& aWatcher ); + + private: // from CActive + + /** + * For starting the active object. + */ + void Start(); + + /** + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + void RunL(); + + private: // Data + + /* + * Pointer to commdb + * Own + */ + CCommsDatabase* iDb; + + /** + * Reference to watcher to give call back + * Doesn't own + */ + CMsgErrorWatcherPrivate& iWatcher; + }; + +#endif // MSGERRORCOMMDBOBSERVER_H + +// End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrordiskspaceobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrordiskspaceobserver.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,99 @@ +/* +* 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: +* CMsgErrorDiskSpaceObserver declaration file +* +*/ + + + +#ifndef MSGERRORDISKSPACEOBSERVER_H +#define MSGERRORDISKSPACEOBSERVER_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CMsgErrorWatcherPrivate; +class CMsvSession; + +// CLASS DECLARATION + +/** +* CMsgErrorDiskSpaceObserver +*/ +class CMsgErrorDiskSpaceObserver : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @param aWatcher A pointer to CMsgErrorWatcherPrivate + * @param aSession A reference to message server session + * @param aFs A reference to file session + */ + static CMsgErrorDiskSpaceObserver* NewL( CMsgErrorWatcherPrivate& aWatcher, CMsvSession& aSession, RFs& aFs ); + + /** + * Destructor. + */ + virtual ~CMsgErrorDiskSpaceObserver(); + + public: // New functions + + /** + * Updates the trigger limit to aLimit, if it + * is smaller than current limit. (Re)activates + * the active object. + * + * @param aLimit The trigger limit in bytes + */ + void SetLimitAndActivateL( TInt32 aLimit ); + + private: + + /** + * Private C++ constructor. + * + * @param aWatcher A pointer to CMsgErrorWatcherPrivate + * @param aSession A reference to message server session + * @param aFs A reference to file session + */ + CMsgErrorDiskSpaceObserver( CMsgErrorWatcherPrivate& aWatcher, CMsvSession& aSession, RFs& aFs ); + + private: + + /** + * From CActive + */ + void RunL(); + + /** + * From CActive + */ + void DoCancel(); + + private: // Data + + CMsgErrorWatcherPrivate& iWatcher; + CMsvSession& iSession; + RFs& iFs; + TInt32 iLimit; + }; + +#endif // MSGERRORDISKSPACEOBSERVER_H + +// End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorextsmsdiskspaceobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorextsmsdiskspaceobserver.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,98 @@ +/* +* 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: +* CMsgErrorSmsDiskSpaceObserver declaration file +* +* +*/ + + +#ifndef __MSGERROREXTSMSDISKSPACEOBSERVER_H +#define __MSGERROREXTSMSDISKSPACEOBSERVER_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CMsgErrorWatcherPrivate; + +// CLASS DECLARATION + +/** +* CMsgErrorSmsDiskSpaceObserver +* +* @lib msgerrorwatcher.dll +* @since 5.0 +*/ +class CMsgErrorExtSmsDiskSpaceObserver : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @param aWatcher A pointer to CMsgErrorWatcherPrivate + */ + static CMsgErrorExtSmsDiskSpaceObserver* NewL( CMsgErrorWatcherPrivate& aWatcher); + + /** + * Destructor. + */ + virtual ~CMsgErrorExtSmsDiskSpaceObserver(); + + private: + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + /** + * Private C++ constructor. + * + * @param aWatcher A pointer to CMsgErrorWatcherPrivate + */ + CMsgErrorExtSmsDiskSpaceObserver( CMsgErrorWatcherPrivate& aWatcher); + + private: + + /** + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + void RunL(); + + private: // Data + + /* + * Reference to watcher + * Doesn't own + */ + CMsgErrorWatcherPrivate& iWatcher; + + /* + * Diskspace property + */ + RProperty iSmsDiskSpaceProperty; + + }; + +#endif // __MSGERROREXTSMSDISKSPACEOBSERVER_H + +// End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorroamingobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorroamingobserver.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,106 @@ +/* +* 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: +* CMsgErrorRoamingObserver declaration file +* +*/ + + + +#ifndef MSGERRORROAMINGOBSERVER_H +#define MSGERRORROAMINGOBSERVER_H + +// INCLUDES +#include +#include //RTelServer +#include + + + +// FORWARD DECLARATIONS +class CMsgErrorWatcherPrivate; + +// CLASS DECLARATION + +/** +* CMsgErrorRoamingObserver +*/ +class CMsgErrorRoamingObserver : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @param aWatcher A pointer to CMsgErrorWatcherPrivate + */ + static CMsgErrorRoamingObserver* NewL( CMsgErrorWatcherPrivate& aWatcher ); + + /** + * Destructor. + */ + virtual ~CMsgErrorRoamingObserver(); + + private: + + /** + * Checks whether roaming status has changed + * from home network to roaming or vice versa. + * If so, calls CMsgErrorWatcherPrivate::HandleRoamingEventL + */ + void UpdateRoamingStatusL(); + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + /** + * Private C++ constructor. + * + * @param aWatcher A pointer to CMsgErrorWatcherPrivate + */ + CMsgErrorRoamingObserver( CMsgErrorWatcherPrivate& aWatcher ); + + private: + + /** + * For starting the active object. + */ + void Start(); + + /** + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + void RunL(); + + private: // Data + + CMsgErrorWatcherPrivate& iWatcher; + TBool iRoaming; + RMobilePhone iMobilePhone; + RTelServer iETelServer; + RMobilePhone::TMobilePhoneRegistrationStatus iRegStatus; + TInt iRequestId; + + }; + +#endif // MSGERRORROAMINGOBSERVER_H + +// End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorsmsdiskspaceobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorsmsdiskspaceobserver.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,87 @@ +/* +* 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: +* CMsgErrorSmsDiskSpaceObserver declaration file +* +*/ + + + +#ifndef __MSGERRORSMSDISKSPACEOBSERVER_H +#define __MSGERRORSMSDISKSPACEOBSERVER_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CMsgErrorWatcherPrivate; + +// CLASS DECLARATION + +/** +* CMsgErrorSmsDiskSpaceObserver +*/ +class CMsgErrorSmsDiskSpaceObserver : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @param aWatcher A pointer to CMsgErrorWatcherPrivate + */ + static CMsgErrorSmsDiskSpaceObserver* NewL( CMsgErrorWatcherPrivate& aWatcher); + + /** + * Destructor. + */ + virtual ~CMsgErrorSmsDiskSpaceObserver(); + + private: + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + /** + * Private C++ constructor. + * + * @param aWatcher A pointer to CMsgErrorWatcherPrivate + */ + CMsgErrorSmsDiskSpaceObserver( CMsgErrorWatcherPrivate& aWatcher); + + private: + + /** + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + void RunL(); + + private: // Data + + CMsgErrorWatcherPrivate& iWatcher; + RProperty iSmsDiskSpaceProperty; + + }; + +#endif // __MSGERRORSMSDISKSPACEOBSERVER_H + +// End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorstartupobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorstartupobserver.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,87 @@ +/* +* 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: +* CMsgErrorStartupObserver declaration file +* +*/ + + + +#ifndef __MSGERRORSTARTUPOBSERVER_H +#define __MSGERRORSTARTUPOBSERVER_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CMsgErrorWatcherPrivate; + +// CLASS DECLARATION + +/** +* CMsgErrorStartupObserver +*/ +class CMsgErrorStartupObserver : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @param aWatcher A pointer to CMsgErrorWatcherPrivate + */ + static CMsgErrorStartupObserver* NewL( CMsgErrorWatcherPrivate& aWatcher ); + + /** + * Destructor. + */ + virtual ~CMsgErrorStartupObserver(); + + private: + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + /** + * Private C++ constructor. + * + * @param aWatcher A pointer to CMsgErrorWatcherPrivate + */ + CMsgErrorStartupObserver( CMsgErrorWatcherPrivate& aWatcher ); + + private: + + /** + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + void RunL(); + + private: // Data + + CMsgErrorWatcherPrivate& iWatcher; + RProperty iStartupProperty; + + }; + +#endif // __MSGERRORSTARTUPOBSERVER_H + +// End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorwatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorwatcher.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,71 @@ +/* + * 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: + * CMsgErrorWatcher declaration file + * + */ +#ifndef MSGERRORWATCHER_H +#define MSGERRORWATCHER_H + +#ifdef MSGERRORWATCHER_DLL +#define MSGERRORWATCHER_EXPORT Q_DECL_EXPORT +#else +#define MSGERRORWATCHER_EXPORT Q_DECL_IMPORT +#endif + +// INCLUDES +#include "msgerrorwatcher.hrh" +// SYSTEM INCLUDES +#include +// CLASS DECLARATION +class CMsgErrorWatcherPrivate; + +/** + * Handles showing notes handled by the errowatcher + */ +class MSGERRORWATCHER_EXPORT MsgErrorWatcher: public QObject +{ +Q_OBJECT + +public: + /** + * Constructor + */ + MsgErrorWatcher(QObject* parent = 0); + + /** + * Destructor + */ + ~MsgErrorWatcher(); + +public: + + /** + * Displays notifiction dialog + * @param errornoteid error id + */ + void ShowNote(TMsgErrorNoteIds errornoteid); + +private: + + /** + * Object of private implementation. + * Owned. + */ + CMsgErrorWatcherPrivate* d_ptr; + +}; + +#endif // MSGERRORWATCHER_H +//EOF diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorwatcher.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorwatcher.hrh Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,42 @@ +/* +* 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 file contains declarations for resources of MsgErrorWatcher +* The file can be included in C++ or resource file. +* +*/ + + + +#ifndef MSGERRORWATCHER_HRH +#define MSGERRORWATCHER_HRH + +/** + * ErrorNote Ids + */ +enum TMsgErrorNoteIds + { + ENoAccesPointsNote=1, + EInvalidAccessPointNote, + EConnectionInUseNote, + EDiskLowNote1, + EDiskLowNoteN, + EMemoryLowNote, + ERoamingNote, + ESendFailureNote, + ESendingMessageNote, + ESMSIncomingLowDiskSpace + }; + +#endif // MSGERRORWATCHER_HRH diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorwatcher_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/inc/msgerrorwatcher_p.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,441 @@ +/* +* 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: +* CMsgErrorWatcher declaration file +* +*/ + + + +#ifndef MSGERRORWATCHERPRIVATE_H +#define MSGERRORWATCHERPRIVATE_H + +// INCLUDES +#include +#include +#include +#include // Critical level +#include // KMmsDiskSafetyMargin + +#include "MsgErrorWatcher.hrh" + +const TUint KCriticalDiskLevel = KDRIVECCRITICALTHRESHOLD; +const TUint KCriticalLevel = KCriticalDiskLevel + KMmsDiskSafetyMargin; +const TUint32 KDefaultTriggerLevel = 300 * 1024; // 100 kilobytes +const TUint KTriggerMargin = 20 * 1024; // 20 kilobytes + +// FUNCTION PROTOTYPES +GLREF_C void Panic( TInt aPanic ); + +// FORWARD DECLARATIONS +class CWatcherLog; +class CMmsClientMtm; +class CClientMtmRegistry; +class MsgErrorWatcher; +class CMsgErrorCommDbObserver; +class CMsgErrorDiskSpaceObserver; +class CMsgErrorSmsDiskSpaceObserver; +class CMsgErrorExtSmsDiskSpaceObserver; +class CMsgErrorRoamingObserver; +class CMsgErrorStartupObserver; +class CMsgErrorDisconnectDlg; +class CMsgCenRepObserver; + + +// CLASS DECLARATION + +/** +* CMsgErrorWatcherPrivate +*/ +class CMsgErrorWatcherPrivate :public CActive, public MMsvSessionObserver + { + public: // Constructors and destructor + /** + * Default constructor. + */ + CMsgErrorWatcherPrivate(MsgErrorWatcher* msgErrorWatcher); + + /** + * Destructor + */ + virtual ~CMsgErrorWatcherPrivate(); + + public: // New functions + + /** + * Callback function for roaming observer. + * + * @param aRoaming ETrue if roaming, EFalse otherwise + */ + void HandleRoamingEventL( TBool aRoaming ); + + /** + * Callback function for CommDB observer. + */ + void HandleCommDbEventL(); + + /** + * Callback function for connection observer. + */ + // void HandleConnectionEvent(); + + /** + * Callback function for disk space observer. + */ + void HandleDiskSpaceEventL(); + void HandleDiskSpaceEvent2L(); + + /** + * Callback function for startup state observer (currently + * sent items observer). + */ + void HandleStartupReadyL(); + + /** + * HandleCenRepNotificationL + * Handles events from central repository observer + */ + void HandleCenRepNotificationL(); + + + public: // Functions from base classes + + /** + * From MMsvSessionObserver + */ + void HandleSessionEventL( + TMsvSessionEvent aEvent, + TAny* aArg1, + TAny* aArg2, + TAny* aArg3 ); + + protected: // Functions from base classes + + /** + * From CActive + */ + void RunL(); + + /** + * From CActive + */ + void DoCancel(); + + private: + + + /** + * Initializes the MsgStoreHandler class. + */ + void InitL(); + + /** + * Start watcher. + */ + void StartWatcherL(); + + /** + * Stop watcher. + */ + void StopWatcher(); + + /** + * Start restart timer. Timer is used when trying to reconnect + * to message server after watcher has been stopped due + * to certain message server events. + */ + void StartRestartTimer(); + + /** + * Kills all observers and resets counters. + */ + void ResetWatcher(); + + /** + * Checks whether MMS Service is already found. If not + * gets a pointer to MMS service from MsgStore and if + * found updates the context of MmsClientMtm. + * + * @return ETrue if MMS service was found, EFalse otherwise + */ + TBool GetMmsServiceL(); + + /** + * Initiates MMS fetch by sending a request to MMS engine. + */ + void StartMmsFetchL(); + + /** + * Initiates MMS send by sending a request to MMS engine. + */ + void StartMmsSendL(); + + /** + * Checks whether MMS receiving mode is "Enabled in home network" + * and "On". If so, activates roaming observer. + */ + void CheckMmsReceivingModeL(); + + /** + * A wrapper for CMmsClient::ValidateService(). + * + * @return ETrue if service is valid, EFalse otherwise. + */ + TBool ValidateMmsServiceL(); + + /** + * Called when MMS reception fails due to insufficient + * disk space. + * + * @param aEntry The failed entry + */ + void HandleDiskSpaceErrorL( TMsvEntry& aEntry ); + + /** + * Called when MMS reception fails due to insufficient + * memory. + * + * @param aEntry The failed entry + */ + void HandleMemoryErrorL( TMsvEntry& aEntry ); + + /** + * Called when MMS reception fails because there is + * another data connection open. + * + * @param aEntry The failed entry + * @param aReceive, ETrue for incoming messages, EFalse for outgoing + */ + //void HandleConnectionErrorL( TMsvEntry& aEntry, TBool aReceive ); + + /** + * Called when MMS reception fails because there is no + * access point defined. + * + * @param aEntry The failed entry + */ + void HandleNoAPErrorL( TMsvEntry& aEntry ); + + /** + * Called when MMS reception fails because the current + * access point is invalid. + * + * @param aEntry The failed entry + */ + void HandleInvalidAPErrorL( TMsvEntry& aEntry, TBool aStartObserver ); + + /** + * Subfunction of HandleSessionEventL + * Handles root events from MsgServer observer + * + * @param aEvent Message server event + * @param aEntries Affected entries + */ + void HandleRootEventL( + TMsvSessionEvent aEvent, + CMsvEntrySelection* aEntries ); + + /** + * Subfunction of HandleSessionEventL + * Handles local service events from MsgServer observer + * + * @param aEvent Message server event + * @param aEntries Affected entries + */ + void HandleLocalServiceEventL( + TMsvSessionEvent aEvent, + CMsvEntrySelection* aEntries ); + + /** + * Subfunction of HandleSessionEventL + * Handles inbox events from MsgServer observer + * + * @param aEvent Message server event + * @param aEntries Affected entries + */ + void HandleInboxEventL( + TMsvSessionEvent aEvent, + CMsvEntrySelection* aEntries ); + + /** + * Subfunction of HandleSessionEventL + * Handles outbox events from MsgServer observer + * + * @param aEvent Message server event + * @param aEntries Affected entries + */ + void HandleOutboxEventL( + TMsvSessionEvent aEvent, + CMsvEntrySelection* aEntries ); + + /** + * Subfunction of HandleSessionEventL + * Handles MMS service events from MsgServer observer + * + * @param aEvent Message server event + * @param aEntries Affected entries + */ + void HandleMmsServiceEventL( + TMsvSessionEvent aEvent, + CMsvEntrySelection* aEntries ); + + + /** + * Resets TMsvEntry::iError of an entry saved in iCurrentEntry + */ + void ResetErrorFieldL( ); + + /** + * Resets TMsvEntry::iError of an entry given as parameter + */ + void ResetErrorFieldL( TMsvEntry& aEntry ); + + private: // Data + + enum TMsgErrorWatcherFlags + { + EStartupReady = 0x0001, + EWatcherRunning = 0x0002, + ENoAPErrorPending = 0x0004, + EShowRoamingNote = 0x0008, + ERoamingNoteShown = 0x0010, + EReceivingDisconnectDelay = 0x0020 + }; + + enum TMsgRequestTypes + { + EMsgRequestNone = 0, + EMsgRequestStartingUp, + EMsgRequestFetching, + EMsgRequestFetchingAll, + EMsgRequestSending, + EMsgRequestWaitingErrorNote, + EMsgRequestWaitingDisconnection + }; + + /** + * Pointer to MsgErrorWatcher + * Doesn't own + */ + MsgErrorWatcher* q_ptr; + + /** + * MMSservice id + */ + TMsvId iMmsServiceId; + + /** + * Notification folder id + */ + TMsvId iNotificationFolderId; + + /** + * Msv session + * Own + */ + CMsvSession* iSession; + + /** + * Msv operation + * Own + */ + CMsvOperation* iOperation; + + /** + * Mtmregitsry client + * Own + */ + CClientMtmRegistry* iClientMtmRegistry; + + /** + * Mmsclient + * Own + */ + CMmsClientMtm* iMmsClient; + + /** + * Pointer to mms receive error messages + * Own + */ + CMsvEntrySelection* iMmsReceiveErrorMessages; + + /** + * Pointer to mms receive error messages + * Own + */ + CMsvEntrySelection* iMmsSendErrorMessages; + + /** + * Current entry id + */ + TMsvId iCurrentEntryId; + + /** + * Pointers to error observers + * CommDb observer + * Own + */ + CMsgErrorCommDbObserver* iCommDbObserver; + + /** + * Pointer to diskspace observer + * Own + */ + CMsgErrorDiskSpaceObserver* iDiskSpaceObserver; + /** + * Pointer to sms diskspace observer + * Own + */ + CMsgErrorSmsDiskSpaceObserver* iSmsDiskSpaceObserver; + /** + * Pointer to extension sms diskspace observer + * Own + */ + CMsgErrorExtSmsDiskSpaceObserver* iSmsExtDiskSpaceObserver; + /** + * Pointer to roaming observer + * Own + */ + CMsgErrorRoamingObserver* iRoamingObserver; + /** + * Pointer to startup observer + * Own + */ + CMsgErrorStartupObserver* iStartupObserver; + /** + * Pointer to cenerep observer + * Own + */ + CMsgCenRepObserver* iCenRepObserver; + + /** + * File session + */ + RFs iFs; + + /** + * Timer + */ + RTimer iTimer; + + TMsgRequestTypes iRequestType; + TUint iWatcherFlags; + TUint32 iMaxReceiveSize; + TUint iDiskSpaceErrors; + TUint iTimerRetries; + }; + +#endif // MSGERRORWATCHERPRIVATE_H + +// End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/msgerrorwatcher.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/msgerrorwatcher.pro Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,110 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = msgerrorwatcher + +CONFIG += hb + +DEFINES += MSGERRORWATCHER_DLL + +DEPENDPATH += ./inc ./src +INCLUDEPATH += ./inc +INCLUDEPATH += ../../../inc +INCLUDEPATH += ../../msgsettings/settingsview/inc +INCLUDEPATH += ../../msgui/inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +# Input +HEADERS += ./inc/msgerrorwatcher.h \ + ./inc/msgerrorwatcher_p.h \ + ./inc/msgerrorroamingobserver.h \ + ./inc/msgerrorstartupobserver.h \ + ./inc/msgerrorsmsdiskspaceobserver.h \ + ./inc/msgerrorextsmsdiskspaceobserver.h \ + ./inc/msgcenrepobserver.h \ + ./inc/msgerrorcommdbobserver.h\ + ./inc/msgerrordiskspaceobserver.h + +SOURCES += ./src/msgerrorwatcher.cpp \ + ./src/msgerrorwatcher_p.cpp \ + ./src/msgerrorroamingobserver.cpp \ + ./src/msgerrorstartupobserver.cpp \ + ./src/msgerrorsmsdiskspaceobserver.cpp \ + ./src/msgerrorextsmsdiskspaceobserver.cpp \ + ./src/msgcenrepobserver.cpp \ + ./src/msgerrorcommdbobserver.cpp \ + ./src/msgerrordiskspaceobserver.cpp + +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE ../eabi/msgerrorwatcher.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE ../bwins/msgerrorwatcher.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock +LIBS += -lecom \ + -leuser \ + -lcommonengine \ + -lefsrv\ + -letel \ + -letelmm \ + -lmsgs \ + -lcentralrepository \ + -lcenrepnotifhandler \ + -llogcli \ + -llogwrap \ + -lcommdb \ + -lconnmon \ + -lHbCore \ + -lHbWidgets \ + -lHbUtils \ + -lQtCore \ + -lxqutils \ + -lflogger \ + -lcone \ + -leikcdlg \ + -leikctl \ + -leikcoctl \ + -leikcore \ + -lgdi \ + -lbafl \ + -lplatformenv \ + -lccon \ + -lestor \ + -lCdlEngine \ + -laknskins \ + -laknicon \ + -legul \ + -lxqservice + + +TARGET.UID3 = 0x2001FE78 #MSGERRORWATCHER_DLL_UID +TARGET.CAPABILITY = All -TCB +TARGET.EPOCALLOWDLLDATA = 1 + +# Platforms +SYMBIAN_PLATFORMS = WINSCW \ + ARMV5 + +# Build.inf rules +BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include " \ + "rom/msgerrorwatcher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(msgerrorwatcher.iby)" + +# End of file --Don't remove this. + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/rom/msgerrorwatcher.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/rom/msgerrorwatcher.iby Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,25 @@ +/* +* 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: MsgErrorWatcher.iby* +*/ + + +#ifndef __MSGERRORWATCHER_IBY__ +#define __MSGERRORWATCHER_IBY__ + + +REM DLL +file=ABI_DIR\UREL\msgerrorwatcher.dll SHARED_LIB_DIR\msgerrorwatcher.dll + +#endif \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/src/msgcenrepobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/src/msgcenrepobserver.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,147 @@ +/* +* 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: +* CMsgCenRepObserver implementation file +* +*/ + + + +// INCLUDE FILES +//#include +#include + +#include "msgerrorwatcher_p.h" +#include "msgcenrepobserver.h" + +#include "MmsEngineInternalCRKeys.h" +#include "debugtraces.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// C++ constructor +// --------------------------------------------------------- +// +CMsgCenRepObserver::CMsgCenRepObserver(CMsgErrorWatcherPrivate& aWatcher) + :CActive ( EPriorityStandard), + iWatcher(aWatcher), + iRepositoryUid( KCRUidMmsEngine ), + iKey( KMmsAccesspointArrayBase/*KMmsEngineAccessPointCount*/ ) + { + QDEBUG_WRITE("CMsgCenRepObserver:CMsgCenRepObserver : Enter"); + QDEBUG_WRITE("CMsgCenRepObserver:CMsgCenRepObserver : Exit"); + } + +// --------------------------------------------------------- +// ConstructL +// --------------------------------------------------------- +// +void CMsgCenRepObserver::ConstructL() + { + QDEBUG_WRITE("CMsgCenRepObserver:ConstructL : Enter"); + CActiveScheduler::Add( this ); + + // Connect CenRep + TRAPD( err, iRepository = CRepository::NewL( iRepositoryUid ) ); + if( err != KErrNone ) + { + + QDEBUG_WRITE( "Error in connecting to CenRep!" ); + + return; + } + QDEBUG_WRITE("CMsgCenRepObserver:ConstructL : Exit"); + } + +// --------------------------------------------------------- +// Symbian two-phased constructor +// --------------------------------------------------------- +// +CMsgCenRepObserver* CMsgCenRepObserver::NewL( CMsgErrorWatcherPrivate& aWatcher ) + { + QDEBUG_WRITE("CMsgCenRepObserver:NewL : Enter"); + CMsgCenRepObserver* self = new ( ELeave ) CMsgCenRepObserver( aWatcher ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + QDEBUG_WRITE("CMsgCenRepObserver:NewL : Exit"); + return self; + } + +// --------------------------------------------------------- +// Destructor +// --------------------------------------------------------- +// +CMsgCenRepObserver::~CMsgCenRepObserver() + { + QDEBUG_WRITE("CMsgCenRepObserver:~CMsgCenRepObserver : Enter"); + Cancel(); + if( iRepository ) + { + delete iRepository; + } + QDEBUG_WRITE("CMsgCenRepObserver:~CMsgCenRepObserver : Exit"); + } + +// --------------------------------------------------------- +// SubscribeNotification +// --------------------------------------------------------- +// +void CMsgCenRepObserver::SubscribeNotification( ) + { + QDEBUG_WRITE("CMsgCenRepObserver:SubscribeNotification : Enter"); + // Subscribe + iRepository->NotifyRequest( iKey, iStatus ); + SetActive(); + QDEBUG_WRITE("CMsgCenRepObserver:SubscribeNotification : Exit"); + } + +// --------------------------------------------------------- +// RunL +// --------------------------------------------------------- +// +void CMsgCenRepObserver::RunL() + { + QDEBUG_WRITE("CMsgCenRepObserver:RunL : Enter"); + iWatcher.HandleCenRepNotificationL(); + QDEBUG_WRITE("CMsgCenRepObserver:RunL : Exit"); + } + +// --------------------------------------------------------- +// RunError +// --------------------------------------------------------- +// +TInt CMsgCenRepObserver::RunError( TInt /*aError*/ ) + { + QDEBUG_WRITE("CMsgCenRepObserver:RunError : Enter"); + QDEBUG_WRITE("CMsgCenRepObserver:RunError : Exit"); + return KErrNone; + } + +// --------------------------------------------------------- +// DoCancel +// --------------------------------------------------------- +// +void CMsgCenRepObserver::DoCancel() + { + QDEBUG_WRITE("CMsgCenRepObserver:DoCancel : Enter"); + iRepository->NotifyCancel( iKey ); + QDEBUG_WRITE("CMsgCenRepObserver:DoCancel : Exit"); + } + +// ================= OTHER EXPORTED FUNCTIONS ============== + +// End of File + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorcommdbobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorcommdbobserver.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,163 @@ +/* +* 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: +* CMsgErrorCommDbObserver implementation file +* +*/ + + + +// INCLUDE FILES +#include +#include + +#include "msgerrorwatcher_p.h" +#include "msgerrorcommdbobserver.h" +#include "debugtraces.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CMsgErrorCommDbObserver::CMsgErrorCommDbObserver +// +// C++ constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CMsgErrorCommDbObserver::CMsgErrorCommDbObserver( CMsgErrorWatcherPrivate& aWatcher ) + : CActive( CActive::EPriorityStandard ), + iWatcher( aWatcher ) + { + QDEBUG_WRITE("CMsgErrorCommDbObserver:CMsgErrorCommDbObserver : Enter"); + QDEBUG_WRITE("CMsgErrorCommDbObserver:CMsgErrorCommDbObserver : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorCommDbObserver::ConstructL +// +// Symbian OS default constructor can leave. +// --------------------------------------------------------- +// +void CMsgErrorCommDbObserver::ConstructL() + { + QDEBUG_WRITE("CMsgErrorCommDbObserver:ConstructL : Enter"); + iDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); + CActiveScheduler::Add( this ); + Start(); + QDEBUG_WRITE("CMsgErrorCommDbObserver:ConstructL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorCommDbObserver::NewL +// +// Two-phased constructor. +// --------------------------------------------------------- +// +CMsgErrorCommDbObserver* CMsgErrorCommDbObserver::NewL( CMsgErrorWatcherPrivate& aWatcher ) + { + QDEBUG_WRITE("CMsgErrorCommDbObserver:NewL : Enter"); + CMsgErrorCommDbObserver* self = new ( ELeave ) + CMsgErrorCommDbObserver( aWatcher ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + QDEBUG_WRITE("CMsgErrorCommDbObserver:NewL : Exit"); + return self; + } + + +// --------------------------------------------------------- +// CMsgErrorCommDbObserver::~CMsgErrorCommDbObserver +// +// Destructor +// --------------------------------------------------------- +// +CMsgErrorCommDbObserver::~CMsgErrorCommDbObserver() + { + QDEBUG_WRITE("CMsgErrorCommDbObserver:~CMsgErrorCommDbObserver : Enter"); + Cancel(); + delete iDb; + QDEBUG_WRITE("CMsgErrorCommDbObserver:~CMsgErrorCommDbObserver : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorCommDbObserver::Restart +// +// (Re)starts the active object (public) +// --------------------------------------------------------- +// +void CMsgErrorCommDbObserver::Restart() + { + QDEBUG_WRITE("CMsgErrorCommDbObserver:Restart : Enter"); + Start(); + QDEBUG_WRITE("CMsgErrorCommDbObserver:Restart : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorCommDbObserver::Start +// +// Starts the active object +// --------------------------------------------------------- +// +void CMsgErrorCommDbObserver::Start() + { + QDEBUG_WRITE("CMsgErrorCommDbObserver:Start : Enter"); + if ( !IsActive() ) + { + iDb->RequestNotification( iStatus ); + SetActive(); + } + QDEBUG_WRITE("CMsgErrorCommDbObserver:Start : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorCommDbObserver::DoCancel +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorCommDbObserver::DoCancel() + { + QDEBUG_WRITE("CMsgErrorCommDbObserver:DoCancel : Enter"); + if ( iDb ) + { + iDb->CancelRequestNotification(); + } + QDEBUG_WRITE("CMsgErrorCommDbObserver:DoCancel : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorCommDbObserver::RunL +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorCommDbObserver::RunL() + { + QDEBUG_WRITE("CMsgErrorCommDbObserver:RunL : Enter"); + if ( iStatus == RDbNotifier::ECommit ) + { + TRAP_IGNORE( iWatcher.HandleCommDbEventL() ); + } + else + { + Start(); + } + QDEBUG_WRITE("CMsgErrorCommDbObserver:RunL : Exit"); + } + +// ================= OTHER EXPORTED FUNCTIONS ============== + +// End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/src/msgerrordiskspaceobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/src/msgerrordiskspaceobserver.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,173 @@ +/* +* 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: +* CMsgErrorDiskSpaceObserver implementation file +* +*/ + + + +// INCLUDE FILES +#include + +#include "msgerrorwatcher_p.h" +#include "msgerrordiskspaceobserver.h" +#include "debugtraces.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CMsgErrorDiskSpaceObserver::CMsgErrorDiskSpaceObserver +// +// C++ constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CMsgErrorDiskSpaceObserver::CMsgErrorDiskSpaceObserver( + CMsgErrorWatcherPrivate& aWatcher, + CMsvSession& aSession, + RFs& aFs ) + : CActive( CActive::EPriorityStandard ), + iWatcher( aWatcher ), + iSession( aSession ), + iFs( aFs ), + iLimit( 0 ) + { + QDEBUG_WRITE("CMsgErrorDiskSpaceObserver:CMsgErrorDiskSpaceObserver : Enter"); + CActiveScheduler::Add( this ); + QDEBUG_WRITE("CMsgErrorDiskSpaceObserver:CMsgErrorDiskSpaceObserver : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorDiskSpaceObserver::NewL +// +// Two-phased constructor. +// --------------------------------------------------------- +// +CMsgErrorDiskSpaceObserver* CMsgErrorDiskSpaceObserver::NewL( + CMsgErrorWatcherPrivate& aWatcher, + CMsvSession& aSession, + RFs& aFs ) + { + QDEBUG_WRITE("CMsgErrorDiskSpaceObserver:NewL : Enter"); + CMsgErrorDiskSpaceObserver* self = new ( ELeave ) + CMsgErrorDiskSpaceObserver( aWatcher, aSession, aFs ); + QDEBUG_WRITE("CMsgErrorDiskSpaceObserver:NewL : Exit"); + return self; + } + + +// --------------------------------------------------------- +// CMsgErrorDiskSpaceObserver::~CMsgErrorDiskSpaceObserver +// +// Destructor +// --------------------------------------------------------- +// +CMsgErrorDiskSpaceObserver::~CMsgErrorDiskSpaceObserver() + { + QDEBUG_WRITE("CMsgErrorDiskSpaceObserver:~CMsgErrorDiskSpaceObserver : Enter"); + Cancel(); + QDEBUG_WRITE("CMsgErrorDiskSpaceObserver:~CMsgErrorDiskSpaceObserver : Exit"); + } + + +// --------------------------------------------------------- +// CMsgErrorDiskSpaceObserver::DoCancel +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorDiskSpaceObserver::DoCancel() + { + QDEBUG_WRITE("CMsgErrorDiskSpaceObserver:DoCancel : Enter"); + iFs.NotifyDiskSpaceCancel( iStatus ); + QDEBUG_WRITE("CMsgErrorDiskSpaceObserver:DoCancel : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorDiskSpaceObserver::RunL +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorDiskSpaceObserver::RunL() + { + QDEBUG_WRITE("CMsgErrorDiskSpaceObserver:RunL : Enter"); + QDEBUG_WRITE_FORMAT("DiskSpace: RunL, iStatus: ", iStatus.Int() ); + TInt status = iStatus.Int(); + if ( status < 0 ) + { + //Reset the observer. + TRAP_IGNORE ( SetLimitAndActivateL( iLimit ) ); + return; + } + + //We shouldn't have to check whether we're above the limit, + //because we were below when we activated and the event comes + //when we cross the limit + + TRAP_IGNORE( iWatcher.HandleDiskSpaceEventL() ); + QDEBUG_WRITE("CMsgErrorDiskSpaceObserver:RunL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorDiskSpaceObserver::SetLimitAndActivateL +// +// Sets the disk space trigger level for active object +// and activates it. +// --------------------------------------------------------- +// +void CMsgErrorDiskSpaceObserver::SetLimitAndActivateL( TInt32 aLimit ) + { + QDEBUG_WRITE("CMsgErrorDiskSpaceObserver:SetLimitAndActivateL : Enter"); + QDEBUG_WRITE_FORMAT("DiskSpace: aLimit ", aLimit ); + __ASSERT_DEBUG( aLimit >= 0, User::Leave( KErrArgument ) ); + if ( aLimit < 0 ) + { + return; + } + if ( iLimit == 0 || iLimit > aLimit ) + { + Cancel(); + iLimit = aLimit; + + TInt currentDrive = TInt( iSession.CurrentDriveL() ); + TVolumeInfo volInfo; + User::LeaveIfError( iFs.Volume( volInfo, currentDrive ) ); + QDEBUG_WRITE_FORMAT("DiskSpace: free/hi : ", I64HIGH( volInfo.iFree ) ); + QDEBUG_WRITE_FORMAT("DiskSpace: free/lo : ", I64LOW( volInfo.iFree ) ); + //check if we're already above the limit + if ( I64HIGH( volInfo.iFree ) != 0 || + I64LOW( volInfo.iFree ) > (TUint)iLimit ) //iLimit is always positive. + { + iWatcher.HandleDiskSpaceEventL(); + return; + } + else + { + QDEBUG_WRITE( "notify activated" ); + TInt64 treshold = iLimit; + iFs.NotifyDiskSpace( treshold, currentDrive, iStatus ); + // No need to check IsActive since object is cancelled + // anyway above + SetActive(); + } + } + QDEBUG_WRITE("CMsgErrorDiskSpaceObserver:SetLimitAndActivateL : Exit"); + } + +// ================= OTHER EXPORTED FUNCTIONS ============== + +// End of File + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorextsmsdiskspaceobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorextsmsdiskspaceobserver.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* CMsgErrorExtSmsDiskSpaceObserver implementation file +* +* +*/ + + +// INCLUDE FILES +#include + +#include + +#include +#include "msgerrorwatcher_p.h" +#include "msgerrorextsmsdiskspaceobserver.h" +#include "debugtraces.h" +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CMsgErrorExtSmsDiskSpaceObserver::CMsgErrorExtSmsDiskSpaceObserver +// +// C++ constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CMsgErrorExtSmsDiskSpaceObserver::CMsgErrorExtSmsDiskSpaceObserver( CMsgErrorWatcherPrivate& aWatcher ) + : CActive( CActive::EPriorityStandard ), + iWatcher( aWatcher ) + { + QDEBUG_WRITE("CMsgErrorExtSmsDiskSpaceObserver:CMsgErrorExtSmsDiskSpaceObserver : Enter"); + CActiveScheduler::Add( this ); + QDEBUG_WRITE("CMsgErrorExtSmsDiskSpaceObserver:CMsgErrorExtSmsDiskSpaceObserver : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorExtSmsDiskSpaceObserver::ConstructL() +// +// Symbian OS default constructor can leave. +// --------------------------------------------------------- +// +void CMsgErrorExtSmsDiskSpaceObserver::ConstructL() + { + QDEBUG_WRITE("CMsgErrorExtSmsDiskSpaceObserver:ConstructL : Enter"); + TInt success = iSmsDiskSpaceProperty.Attach( KUidSystemCategory, KUidPSDiskSpaceMonitorKeyType ); + QDEBUG_WRITE_FORMAT("iSmsDiskSpaceProperty.Attach: " ,success ); + User::LeaveIfError(success); + QDEBUG_WRITE( " AFTER ATTACH" ); + iStatus = KRequestPending; + iSmsDiskSpaceProperty.Subscribe( iStatus ); + SetActive(); + QDEBUG_WRITE("CMsgErrorExtSmsDiskSpaceObserver:ConstructL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorExtSmsDiskSpaceObserver::NewL +// +// Two-phased constructor. +// --------------------------------------------------------- +// +CMsgErrorExtSmsDiskSpaceObserver* CMsgErrorExtSmsDiskSpaceObserver::NewL( CMsgErrorWatcherPrivate& aWatcher) + { + QDEBUG_WRITE("CMsgErrorExtSmsDiskSpaceObserver:NewL : Enter"); + CMsgErrorExtSmsDiskSpaceObserver* self = new ( ELeave ) + CMsgErrorExtSmsDiskSpaceObserver( aWatcher); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + QDEBUG_WRITE("CMsgErrorExtSmsDiskSpaceObserver:NewL : Exit"); + return self; + } + +// --------------------------------------------------------- +// CMsgErrorExtSmsDiskSpaceObserver::~CMsgErrorExtSmsDiskSpaceObserver +// +// Destructor +// --------------------------------------------------------- +// +CMsgErrorExtSmsDiskSpaceObserver::~CMsgErrorExtSmsDiskSpaceObserver() + { + QDEBUG_WRITE("CMsgErrorExtSmsDiskSpaceObserver:~CMsgErrorExtSmsDiskSpaceObserver : Enter"); + Cancel(); + iSmsDiskSpaceProperty.Close(); + QDEBUG_WRITE("CMsgErrorExtSmsDiskSpaceObserver:~CMsgErrorExtSmsDiskSpaceObserver : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorExtSmsDiskSpaceObserver::DoCancel +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorExtSmsDiskSpaceObserver::DoCancel() + { + QDEBUG_WRITE("CMsgErrorExtSmsDiskSpaceObserver:DoCancel : Enter"); + iSmsDiskSpaceProperty.Cancel(); + QDEBUG_WRITE("CMsgErrorExtSmsDiskSpaceObserver:DoCancel : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorExtSmsDiskSpaceObserver::RunL +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorExtSmsDiskSpaceObserver::RunL() + { + QDEBUG_WRITE("CMsgErrorExtSmsDiskSpaceObserver:RunL : Enter"); + TInt messagesComingInLowDiskSpace(ESmsDiskSpaceUnknown); + TInt success = iSmsDiskSpaceProperty.Get( messagesComingInLowDiskSpace ); + + QDEBUG_WRITE_FORMAT("iSmsDiskSpaceProperty.Get returns: " ,success ); + QDEBUG_WRITE_FORMAT("iSmsDiskSpaceProperty.Get: " ,messagesComingInLowDiskSpace ); + + if ( messagesComingInLowDiskSpace == ESmsDiskSpaceFull ) + { + QDEBUG_WRITE( "CMsgErrorExtSmsDiskSpaceObserver::RunL: ESmsDiskSpaceFull" ); + TRAP_IGNORE( iWatcher.HandleDiskSpaceEvent2L() ); + } + + iStatus = KRequestPending; + iSmsDiskSpaceProperty.Subscribe( iStatus ); + SetActive(); + QDEBUG_WRITE("CMsgErrorExtSmsDiskSpaceObserver:RunL : Exit"); + } + + + +// ================= OTHER EXPORTED FUNCTIONS ============== + +// End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorroamingobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorroamingobserver.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,247 @@ +/* +* 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: +* CMsgErrorRoamingObserver implementation file +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include + +#include "msgerrorwatcher_p.h" +#include "msgerrorroamingobserver.h" +#include "debugtraces.h" + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +/***************************************************** +* Series 60 Customer / ETel +* Series 60 ETel API +*****************************************************/ + +// --------------------------------------------------------- +// CMsgErrorRoamingObserver::CMsgErrorRoamingObserver +// +// C++ constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CMsgErrorRoamingObserver::CMsgErrorRoamingObserver( CMsgErrorWatcherPrivate& aWatcher ) + : CActive( CActive::EPriorityStandard ), + iWatcher( aWatcher ), + iRoaming( EFalse ), + iRegStatus( RMobilePhone::ERegistrationUnknown ), + iRequestId( 0 ) + { + QDEBUG_WRITE("CMsgErrorRoamingObserver:CMsgErrorRoamingObserver : Enter"); + CActiveScheduler::Add( this ); + QDEBUG_WRITE("CMsgErrorRoamingObserver:CMsgErrorRoamingObserver : Exit"); + } + +/***************************************************** +* Series 60 Customer / ETel +* Series 60 ETel API +*****************************************************/ + +/***************************************************** +* Series 60 Customer / TSY +* Needs customer TSY implementation +*****************************************************/ + +// --------------------------------------------------------- +// CMsgErrorRoamingObserver::ConstructL() +// +// Symbian OS default constructor can leave. +// --------------------------------------------------------- +// +void CMsgErrorRoamingObserver::ConstructL() + { + QDEBUG_WRITE("CMsgErrorRoamingObserver:ConstructL : Enter"); + User::LeaveIfError( iETelServer.Connect() ); + User::LeaveIfError( iETelServer.LoadPhoneModule( KMmTsyModuleName ) ); + User::LeaveIfError( iMobilePhone.Open( iETelServer, KMmTsyPhoneName ) ); + iMobilePhone.GetNetworkRegistrationStatus( iStatus, iRegStatus ); + iRequestId = EMobilePhoneGetNetworkRegistrationStatus; + SetActive(); + QDEBUG_WRITE("CMsgErrorRoamingObserver:ConstructL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorRoamingObserver::NewL +// +// Two-phased constructor. +// --------------------------------------------------------- +// +CMsgErrorRoamingObserver* CMsgErrorRoamingObserver::NewL( CMsgErrorWatcherPrivate& aWatcher ) + { + QDEBUG_WRITE("CMsgErrorRoamingObserver:NewL : Enter"); + CMsgErrorRoamingObserver* self = new ( ELeave ) + CMsgErrorRoamingObserver( aWatcher ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + QDEBUG_WRITE("CMsgErrorRoamingObserver:NewL : Exit"); + + return self; + } + + +/***************************************************** +* Series 60 Customer / ETel +* Series 60 ETel API +*****************************************************/ + +/***************************************************** +* Series 60 Customer / TSY +* Needs customer TSY implementation +*****************************************************/ + +// --------------------------------------------------------- +// CMsgErrorRoamingObserver::~CMsgErrorRoamingObserver +// +// Destructor +// --------------------------------------------------------- +// +CMsgErrorRoamingObserver::~CMsgErrorRoamingObserver() + { + QDEBUG_WRITE("CMsgErrorRoamingObserver:~CMsgErrorRoamingObserver : Enter"); + Cancel(); + iMobilePhone.Close(); + iETelServer.UnloadPhoneModule( KMmTsyModuleName ); + iETelServer.Close(); + QDEBUG_WRITE("CMsgErrorRoamingObserver:~CMsgErrorRoamingObserver : Exit"); + } + +/***************************************************** +* Series 60 Customer / ETel +* Series 60 ETel API +*****************************************************/ + +// --------------------------------------------------------- +// CMsgErrorRoamingObserver::UpdateRoamingStatusL +// +// Checks whether roaming status has actually changed +// --------------------------------------------------------- +// +void CMsgErrorRoamingObserver::UpdateRoamingStatusL() + { + QDEBUG_WRITE("CMsgErrorRoamingObserver:UpdateRoamingStatusL : Enter"); + QDEBUG_WRITE_FORMAT("iRoaming: ", iRoaming); + QDEBUG_WRITE_FORMAT("iRegStatus: ", iRegStatus); + + TBool changed = EFalse; + if ( iRoaming && iRegStatus == RMobilePhone::ERegisteredOnHomeNetwork ) + { + iRoaming = EFalse; + changed = ETrue; + } + else if ( !iRoaming && iRegStatus == RMobilePhone::ERegisteredRoaming ) + { + iRoaming = ETrue; + changed = ETrue; + } + else + { + //Nothing to do + } + QDEBUG_WRITE_FORMAT("changed: ", changed); + if ( changed ) + { + //Inform watcher only when roaming status has changed + iWatcher.HandleRoamingEventL( iRoaming ); + } + QDEBUG_WRITE("CMsgErrorRoamingObserver:UpdateRoamingStatusL : Exit"); + } + +/***************************************************** +* Series 60 Customer / ETel +* Series 60 ETel API +*****************************************************/ + +// --------------------------------------------------------- +// CMsgErrorRoamingObserver::Start +// +// Starts the active object +// --------------------------------------------------------- +// +void CMsgErrorRoamingObserver::Start() + { + QDEBUG_WRITE("CMsgErrorRoamingObserver:Start : Enter"); + if ( !IsActive() ) + { + iMobilePhone.NotifyNetworkRegistrationStatusChange( iStatus, iRegStatus ); + iRequestId = EMobilePhoneNotifyNetworkRegistrationStatusChange; + SetActive(); + } + QDEBUG_WRITE("CMsgErrorRoamingObserver:Start : Exit"); + } + +/***************************************************** +* Series 60 Customer / ETel +* Series 60 ETel API +*****************************************************/ + +// --------------------------------------------------------- +// CMsgErrorRoamingObserver::DoCancel +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorRoamingObserver::DoCancel() + { + QDEBUG_WRITE("CMsgErrorRoamingObserver:DoCancel : Enter"); + if ( iRequestId ) + { + iMobilePhone.CancelAsyncRequest( iRequestId ); + iRequestId = 0; + } + QDEBUG_WRITE("CMsgErrorRoamingObserver:DoCancel : Exit"); + } + +/***************************************************** +* Series 60 Customer / ETel +* Series 60 ETel API +*****************************************************/ + +// --------------------------------------------------------- +// CMsgErrorRoamingObserver::RunL +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorRoamingObserver::RunL() + { + QDEBUG_WRITE("CMsgErrorRoamingObserver:RunL : Enter"); + iRequestId = 0; + TInt status = iStatus.Int(); + if ( status < 0 ) + { + iRegStatus = RMobilePhone::ERegistrationUnknown; + } + TRAP_IGNORE( UpdateRoamingStatusL() ); + Start(); + QDEBUG_WRITE("CMsgErrorRoamingObserver:RunL : Exit"); + } + +// ================= OTHER EXPORTED FUNCTIONS ============== + +// End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorsmsdiskspaceobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorsmsdiskspaceobserver.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,147 @@ +/* +* 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: +* CMsgErrorSmsDiskSpaceObserver implementation file +* +*/ + + + +// INCLUDE FILES +#include + +#include + +#include +#include "msgerrorwatcher_p.h" +#include "msgerrorsmsdiskspaceobserver.h" +#include "debugtraces.h" +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CMsgErrorSmsDiskSpaceObserver::CMsgErrorSmsDiskSpaceObserver +// +// C++ constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CMsgErrorSmsDiskSpaceObserver::CMsgErrorSmsDiskSpaceObserver( CMsgErrorWatcherPrivate& aWatcher ) + : CActive( CActive::EPriorityStandard ), + iWatcher( aWatcher ) + { + QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:CMsgErrorSmsDiskSpaceObserver : Enter"); + CActiveScheduler::Add( this ); + QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:CMsgErrorSmsDiskSpaceObserver : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorSmsDiskSpaceObserver::ConstructL() +// +// Symbian OS default constructor can leave. +// --------------------------------------------------------- +// +void CMsgErrorSmsDiskSpaceObserver::ConstructL() + { + QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:ConstructL : Enter"); + + TInt success = iSmsDiskSpaceProperty.Attach( KUidPSSMSStackCategory, KUidPSSMSStackDiskSpaceMonitorKey ); + QDEBUG_WRITE_FORMAT("iSmsDiskSpaceProperty.Attach: " ,success ); + User::LeaveIfError(success); + iStatus = KRequestPending; + iSmsDiskSpaceProperty.Subscribe( iStatus ); + SetActive(); + QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:ConstructL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorSmsDiskSpaceObserver::NewL +// +// Two-phased constructor. +// --------------------------------------------------------- +// +CMsgErrorSmsDiskSpaceObserver* CMsgErrorSmsDiskSpaceObserver::NewL( CMsgErrorWatcherPrivate& aWatcher) + { + QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:NewL : Enter"); + CMsgErrorSmsDiskSpaceObserver* self = new ( ELeave ) + CMsgErrorSmsDiskSpaceObserver( aWatcher); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:NewL : Exit"); + return self; + } + +// --------------------------------------------------------- +// CMsgErrorSmsDiskSpaceObserver::~CMsgErrorSmsDiskSpaceObserver +// +// Destructor +// --------------------------------------------------------- +// +CMsgErrorSmsDiskSpaceObserver::~CMsgErrorSmsDiskSpaceObserver() + { + QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:~CMsgErrorSmsDiskSpaceObserver : Enter"); + Cancel(); + iSmsDiskSpaceProperty.Close(); + QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:~CMsgErrorSmsDiskSpaceObserver : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorSmsDiskSpaceObserver::DoCancel +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorSmsDiskSpaceObserver::DoCancel() + { + QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:DoCancel : Enter"); + iSmsDiskSpaceProperty.Cancel(); + QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:DoCancel : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorSmsDiskSpaceObserver::RunL +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorSmsDiskSpaceObserver::RunL() + { + QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:RunL : Enter"); + TInt messagesComingInLowDiskSpace(ESmsDiskSpaceUnknown); + TInt success = iSmsDiskSpaceProperty.Get( messagesComingInLowDiskSpace ); + + QDEBUG_WRITE_FORMAT("iSmsDiskSpaceProperty.Get returns: " ,success ); + QDEBUG_WRITE_FORMAT("iSmsDiskSpaceProperty.Get: " ,messagesComingInLowDiskSpace ); + + + if ( messagesComingInLowDiskSpace == ESmsDiskSpaceFull ) + { + QDEBUG_WRITE( "CMsgErrorSmsDiskSpaceObserver::RunL: ESmsDiskSpaceFull" ); + TRAP_IGNORE( iWatcher.HandleDiskSpaceEvent2L() ); + } + + iStatus = KRequestPending; + iSmsDiskSpaceProperty.Subscribe( iStatus ); + SetActive(); + QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:RunL : Exit"); + } + + + +// ================= OTHER EXPORTED FUNCTIONS ============== + +// End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorstartupobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorstartupobserver.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,144 @@ +/* +* 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: +* CMsgErrorStartupObserver implementation file +* +*/ + + + +// INCLUDE FILES +#include + +#include + +#include "msgerrorwatcher_p.h" +#include "msgerrorstartupobserver.h" +#include "debugtraces.h" + + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CMsgErrorStartupObserver::CMsgErrorStartupObserver +// +// C++ constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CMsgErrorStartupObserver::CMsgErrorStartupObserver( CMsgErrorWatcherPrivate& aWatcher ) + : CActive( CActive::EPriorityStandard ), + iWatcher( aWatcher ) + { + QDEBUG_WRITE("CMsgErrorStartupObserver:CMsgErrorStartupObserver : Enter"); + CActiveScheduler::Add( this ); + QDEBUG_WRITE("CMsgErrorStartupObserver:CMsgErrorStartupObserver : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorStartupObserver::ConstructL() +// +// Symbian OS default constructor can leave. +// --------------------------------------------------------- +// +void CMsgErrorStartupObserver::ConstructL() + { + QDEBUG_WRITE("CMsgErrorStartupObserver:ConstructL : Enter"); + User::LeaveIfError( iStartupProperty.Attach( KPSUidStartup, KPSGlobalSystemState ) ); + // Complete self + iStatus = KRequestPending; + TRequestStatus* pStatus = &iStatus; + SetActive(); + User::RequestComplete( pStatus, KErrNone ); + QDEBUG_WRITE("CMsgErrorStartupObserver:ConstructL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorStartupObserver::NewL +// +// Two-phased constructor. +// --------------------------------------------------------- +// +CMsgErrorStartupObserver* CMsgErrorStartupObserver::NewL( CMsgErrorWatcherPrivate& aWatcher ) + { + QDEBUG_WRITE("CMsgErrorStartupObserver:NewL : Enter"); + CMsgErrorStartupObserver* self = new ( ELeave ) + CMsgErrorStartupObserver( aWatcher ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + QDEBUG_WRITE("CMsgErrorStartupObserver:NewL : Exit"); + return self; + } + +// --------------------------------------------------------- +// CMsgErrorStartupObserver::~CMsgErrorStartupObserver +// +// Destructor +// --------------------------------------------------------- +// +CMsgErrorStartupObserver::~CMsgErrorStartupObserver() + { + QDEBUG_WRITE("CMsgErrorStartupObserver:~CMsgErrorStartupObserver : Enter"); + Cancel(); + iStartupProperty.Close(); + QDEBUG_WRITE("CMsgErrorStartupObserver:~CMsgErrorStartupObserver : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorStartupObserver::DoCancel +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorStartupObserver::DoCancel() + { + QDEBUG_WRITE("CMsgErrorStartupObserver:DoCancel : Enter"); + iStartupProperty.Cancel(); + QDEBUG_WRITE("CMsgErrorStartupObserver:DoCancel : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorStartupObserver::RunL +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorStartupObserver::RunL() + { + QDEBUG_WRITE("CMsgErrorStartupObserver:RunL : Enter"); + TInt startupState = 0; + iStartupProperty.Get( startupState ); + + if ( startupState == ESwStateNormalRfOn || + startupState == ESwStateNormalRfOff || + startupState == ESwStateNormalBTSap ) + { + TRAP_IGNORE( iWatcher.HandleStartupReadyL() ); + } + else + { + iStatus = KRequestPending; + iStartupProperty.Subscribe( iStatus ); + SetActive(); + } + QDEBUG_WRITE("CMsgErrorStartupObserver:RunL : Exit"); + } + +// ================= OTHER EXPORTED FUNCTIONS ============== + +// End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorwatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorwatcher.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,132 @@ +/* + * 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: + * MsgErrorWatcher implementation file + * + */ + +// SYSTEM INCLUDES +#include + +//USER INCLUDES +#include "msgerrorwatcher.h" +#include "msgerrorwatcher_p.h" +#include +#include +#include +#include "debugtraces.h" +#include +#include +#include +#include "msgsettingsview.h" +// LOCAL CONSTANTS AND MACROS +#define LOC_MSG_ERRH_DISK_LOW_1 hbTrId("MMS message isn't fetched because disk space is low. Free some memory first.") +#define LOC_MSG_ERRH_MEMORY_LOW hbTrId("MMS message is not been fetched because device memory is low. Try to close other applications.") +#define LOC_MMS_OFF hbTrId("The MMS message reception is now off. You should change the reception to Always enabled in order to receive MMS messages while roaming.") +#define LOC_MSG_ERRH_ACCESS_POINTS_INV hbTrId("MMS Access Points are not valid. Please check the access point data.") +#define LOC_OK hbTrId("Ok") +#define LOC_CANCEL hbTrId("Cancel") +// ---------------------------------------------------------------------------- +// MsgErrorWatcher::MsgErrorWatcher +// @see MsgErrorWatcher.h +// ---------------------------------------------------------------------------- +MsgErrorWatcher::MsgErrorWatcher(QObject* parent) : + QObject(parent) +{ + QDEBUG_WRITE("MsgErrorWatcher::MsgErrorWatcher : Enter") + + d_ptr = new CMsgErrorWatcherPrivate(this); + // load the messaging ts file. + + QDEBUG_WRITE("MsgErrorWatcher::MsgErrorWatcher : Exit") +} + +// ---------------------------------------------------------------------------- +// MsgErrorWatcher::~MsgErrorWatcher +// @see MsgErrorWatcher.h +// ---------------------------------------------------------------------------- +MsgErrorWatcher::~MsgErrorWatcher() +{ + QDEBUG_WRITE("MsgErrorWatcher::~MsgErrorWatcher : Enter") + + delete d_ptr; + + QDEBUG_WRITE("MsgErrorWatcher::~MsgErrorWatcher : Exit") +} + +// ---------------------------------------------------------------------------- +// MsgErrorWatcher::~MsgErrorWatcher +// @see MsgErrorWatcher.h +// ---------------------------------------------------------------------------- +void MsgErrorWatcher::ShowNote(TMsgErrorNoteIds errornoteid) +{ + QDEBUG_WRITE("MsgErrorWatcher::ShowNote : Enter") + QDEBUG_WRITE_FORMAT("errornoteid : ", errornoteid) + HbDeviceMessageBox messageBox(HbMessageBox::MessageTypeWarning); + QAction* actionView = NULL; + QAction* actionQuit = NULL; + const QAction* result = NULL; + //create dialog parameters + QString text(""); + switch (errornoteid) { + case EDiskLowNote1: + text = LOC_MSG_ERRH_DISK_LOW_1; + break; + case EMemoryLowNote: + text = LOC_MSG_ERRH_MEMORY_LOW; + break; + case ERoamingNote: + text = LOC_MMS_OFF; + break; + case EInvalidAccessPointNote: + text = LOC_MSG_ERRH_ACCESS_POINTS_INV; + messageBox.setTimeout(HbPopup::NoTimeout); + messageBox.setText(text); + actionView = new QAction(LOC_OK, this); + messageBox.setAction(actionView, HbDeviceMessageBox::AcceptButtonRole); + + actionQuit = new QAction(LOC_CANCEL, this); + messageBox.setAction(actionQuit, HbDeviceMessageBox::RejectButtonRole); + + messageBox.setDismissPolicy(HbPopup::NoDismiss); + // launch Messagebox + result = messageBox.exec(); + + // if accepted launch view else quit + if (messageBox.isAcceptAction(result)) { + QList args; + QString serviceName("messagesettings"); + QString operation("launchSettings(int)"); + XQAiwRequest* request; + XQApplicationManager appManager; + request = appManager.create(serviceName, "com.nokia.symbian.IMessageSettings", + operation, false); // non embedded + if (request == NULL) { + return; + } + args << QVariant(MsgSettingsView::MMSView); + request->setArguments(args); + request->send(); + delete request; + } + return; + default: + break; + } + HbDeviceNotificationDialog::notification("", text); + QDEBUG_WRITE("MsgErrorWatcher::ShowNote : Exit") + +} + +//EOF diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorwatcher_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgerrorwatcher/src/msgerrorwatcher_p.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,1331 @@ +/* +* 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: +* CMsgErrorWatcherPrivate implementation file +* +*/ + + + +// INCLUDE FILES +#include + +#include +#include //Msv index entry ID's +#include +#include //EMmsScheduledReceiveForced +#include //Notification folder +#include //MTM Uids +#include //ClientMtmRegistry +#include +#include +#include +#include + + + +#include +#include +#include +#include +#include // KErrIfAuthenticationFailure +#include // KErrGprsInsufficientResources, etc. +//#include // KErrGsmMMServiceOptionTemporaryOutOfOrder +#include + +#include // link against centralrepository.lib +#include // for Central Repository keys + +#include // Variation + +#include "msgerrorwatcher.h" +#include "msgerrorwatcher_p.h" +#include "msgerrorwatcher.hrh" +#include "msgerrorcommdbobserver.h" +#include "msgcenrepobserver.h" +// this should be handled later, +//#include "msgerrorconnectionobserver.h" +#include "msgerrordiskspaceobserver.h" +#include "msgerrorsmsdiskspaceobserver.h" +#include "msgerrorextsmsdiskspaceobserver.h" +#include "msgerrorroamingobserver.h" +#include "msgerrorstartupobserver.h" + + + +#include "debugtraces.h" + +//const TInt KConnectionRetries = 3; +//const TInt KIntMaxLength = 10; //2~32 =~ 4000000000 +const TUint KInitialDelayBetweenSessionConnectRetries = 5000000; //five seconds +const TUint KMaxTimerRetries = 50; +//const TInt KDelayAfterDisconnect = 3000000; //3 seconds +//Total delay between first and last retry is +//( A * (B^2 + B) ) / 2 +// - where A is KInitialDelayBetweenSessionConnectRetries +// - and B is KMaxTimerRetries +//If A = 5 seconds and B = 50 times last retry is made +//after about 106 minutes from the first one. +//const TMsvId KWatcherInboxFolderId = KMsvGlobalInBoxIndexEntryIdValue; +const TMsvId KWatcherOutboxFolderId = KMsvGlobalOutBoxIndexEntryIdValue; +//const TUid KMessageEntryUid = { KUidMsvMessageEntryValue }; + + +CMsgErrorWatcherPrivate::CMsgErrorWatcherPrivate(MsgErrorWatcher* msgErrorWatcher ): +CActive( EPriorityStandard ), + q_ptr(msgErrorWatcher), + iMmsServiceId( KMsvNullIndexEntryId ), + iNotificationFolderId( KMsvNullIndexEntryId ), + iCurrentEntryId ( KMsvNullIndexEntryId ) + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:CMsgErrorWatcherPrivate : Enter"); + CActiveScheduler::Add( this ); + TRAP_IGNORE(InitL()) + QDEBUG_WRITE("CMsgErrorWatcherPrivate:CMsgErrorWatcherPrivate : Exit"); + + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::CMsgErrorWatcherPrivate +// +// Symbian OS default constructor can leave. +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::InitL() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:InitL : Enter"); + User::LeaveIfError( iTimer.CreateLocal() ); + User::LeaveIfError(iFs.Connect()); + + TInt features = 0; + CRepository* repository = CRepository::NewL( KCRUidMuiuVariation ); + repository->Get( KMuiuMmsFeatures, features ); + delete repository; + repository = NULL; + if ( features & KMmsFeatureIdDelayDisconnectDialog ) + { + iWatcherFlags |= EReceivingDisconnectDelay; + } + + StartWatcherL(); + QDEBUG_WRITE("CMsgErrorWatcherPrivate:InitL : Exit"); + } + + + + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::~CMsgErrorWatcherPrivate +// +// Destructor +// --------------------------------------------------------- +// +CMsgErrorWatcherPrivate::~CMsgErrorWatcherPrivate() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Enter"); + StopWatcher(); + iTimer.Close(); + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::StartWatcherL +// +// Does the actual construction of the watcher. +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::StartWatcherL() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:StartMmsFetchL : Enter"); + iSession = CMsvSession::OpenSyncL( *this ); + // might be required in future for propogating the errors to the ui. + iMmsReceiveErrorMessages = new ( ELeave ) CMsvEntrySelection; + iMmsSendErrorMessages = new ( ELeave ) CMsvEntrySelection; + + // Get message server session + iClientMtmRegistry = CClientMtmRegistry::NewL( *iSession ); + TRAPD( err, + { + iMmsClient = static_cast + ( iClientMtmRegistry->NewMtmL( KUidMsgTypeMultimedia ) ); + } ); + if ( err == KErrNotFound ) + { + QDEBUG_WRITE( "MmsClientMtm not found!" ); + // Make sure iMmsClient is NULL - just in case. + delete iMmsClient; + iMmsClient = NULL; + } + else + { + User::LeaveIfError( err ); + } + + if ( iMmsClient ) + { + // We're interested in roaming events only if MMS is enabled. + iRoamingObserver = CMsgErrorRoamingObserver::NewL( *this ); + QDEBUG_WRITE( "Created Roaming Observer!" ); + } + + + iStartupObserver = CMsgErrorStartupObserver::NewL( *this ); + + if(!( iWatcherFlags & EWatcherRunning)) + { + //if not yet created + iSmsDiskSpaceObserver = CMsgErrorSmsDiskSpaceObserver::NewL( *this ); + iSmsExtDiskSpaceObserver = CMsgErrorExtSmsDiskSpaceObserver::NewL( *this ); + QDEBUG_WRITE( "Created iSmsDiskSpaceObserver, iSmsExtDiskSpaceObserver!" ); + } + + iWatcherFlags |= EWatcherRunning; + + if ( GetMmsServiceL() ) + { + CheckMmsReceivingModeL(); + } + + // Startup successful if we got this far. Reset retry counter. + iTimerRetries = 0; + + QDEBUG_WRITE("CMsgErrorWatcherPrivate:StartWatcherL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::StopWatcher +// +// Stops (and destructs) the watcher. +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::StopWatcher() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Enter"); + iWatcherFlags &= ~EWatcherRunning; + iWatcherFlags &= ~ENoAPErrorPending; + iMmsServiceId = KMsvNullIndexEntryId; + iNotificationFolderId = KMsvNullIndexEntryId; + Cancel(); + + delete iCommDbObserver; + iCommDbObserver = NULL; + delete iCenRepObserver; + iCenRepObserver = NULL; +// delete iConnectionObserver; +// iConnectionObserver = NULL; + delete iDiskSpaceObserver; + iDiskSpaceObserver = NULL; + delete iSmsDiskSpaceObserver; + iSmsDiskSpaceObserver = NULL; + delete iSmsExtDiskSpaceObserver; + iSmsExtDiskSpaceObserver = NULL; + delete iRoamingObserver; + iRoamingObserver = NULL; + delete iMmsClient; + iMmsClient = NULL; + delete iClientMtmRegistry; + iClientMtmRegistry = NULL; + delete iOperation; + iOperation = NULL; + delete iStartupObserver; + iStartupObserver = NULL; + delete iSession; + iSession = NULL; + delete iMmsReceiveErrorMessages; + iMmsReceiveErrorMessages = NULL; + delete iMmsSendErrorMessages; + iMmsSendErrorMessages = NULL; + + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::StartRestartTimer +// +// Start session reconnect timer. +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::StartRestartTimer() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Enter"); + if ( !IsActive() ) + { + QDEBUG_WRITE( "Starting timer" ); + iStatus = KRequestPending; + iRequestType = EMsgRequestStartingUp; + iTimerRetries++; + //The interval between retries comes longer every time + iTimer.After( iStatus, + iTimerRetries * KInitialDelayBetweenSessionConnectRetries ); + SetActive(); + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::ResetWatcher +// +// Resets watcher. +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::ResetWatcher() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Enter"); + + iWatcherFlags &= ~ENoAPErrorPending; + + //Drop all observers + delete iCommDbObserver; + iCommDbObserver = NULL; + delete iCenRepObserver; + iCenRepObserver = NULL; +// delete iConnectionObserver; +// iConnectionObserver = NULL; + delete iDiskSpaceObserver; + iDiskSpaceObserver = NULL; + delete iSmsDiskSpaceObserver; + iSmsDiskSpaceObserver = NULL; + delete iSmsExtDiskSpaceObserver; + iSmsExtDiskSpaceObserver = NULL; + //Reset disk space errors + iDiskSpaceErrors = 0; + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::GetMmsServiceL +// +// Retrieves MMS service id from MsgStore +// --------------------------------------------------------- +// +TBool CMsgErrorWatcherPrivate::GetMmsServiceL() + { + if ( !iMmsClient ) + { + return EFalse; + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Enter"); + if ( iMmsServiceId == KMsvNullIndexEntryId ) + { + QDEBUG_WRITE( "Looking for MMS service" ); + iMmsClient->RestoreSettingsL(); + iMmsServiceId = iMmsClient->MmsSettings().Service(); + iNotificationFolderId = iMmsClient->MmsSettings().NotificationFolder(); + iMaxReceiveSize = iMmsClient->MmsSettings().MaximumReceiveSize(); + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Exit"); + return ( iMmsServiceId != KMsvNullIndexEntryId ); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::StartMmsFetchL +// +// Initiates MMS fetch +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::StartMmsFetchL() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Enter"); + if ( !IsActive() && iMmsReceiveErrorMessages->Count() ) + { + QDEBUG_WRITE_FORMAT("Fetching message(s): ", + iMmsReceiveErrorMessages->Count() ); + TCommandParameters parameters; // initialized to zero + TCommandParametersBuf paramPack( parameters ); + + //Add service entry as the first entry in the array + iMmsReceiveErrorMessages->InsertL( 0, iMmsServiceId ); + + // First remove existing schedules: + QDEBUG_WRITE( "Deleting old schedules" ); + // Calling synchronous TransferCommandL method + const TInt KBufSize = 256; + TBuf8 dummy; + iSession->TransferCommandL( *iMmsReceiveErrorMessages, + EMmsDeleteSchedule, + paramPack, + dummy ); + QDEBUG_WRITE( "Old schedules deleted!" ); + + // Then reschedule: + iStatus = KRequestPending; + iRequestType = EMsgRequestFetching; + delete iOperation; + iOperation = NULL; + QDEBUG_WRITE( "Request fetch" ); + iOperation = iSession->TransferCommandL( *iMmsReceiveErrorMessages, + EMmsScheduledReceive, + paramPack, + iStatus ); + SetActive(); + QDEBUG_WRITE( "Reset array" ); + iMmsReceiveErrorMessages->Reset(); + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::StartMmsSendL +// +// +// --------------------------------------------------------- +// TODO: to be handled late when connection errors are handled. +//void CMsgErrorWatcherPrivate::StartMmsSendL() +// { +// QDEBUG_WRITE("CMsgErrorWatcherPrivate:StartMmsSendL : Enter"); +// if ( !IsActive() && iMmsSendErrorMessages->Count() ) +// { +// QDEBUG_WRITE_FORMAT("Sending message(s): "), +// iMmsSendErrorMessages->Count() ); +// TCommandParameters parameters; // initialized to zero +// TCommandParametersBuf paramPack( parameters ); +// +// //Add service entry as the first entry in the array +// iMmsSendErrorMessages->InsertL( 0, iMmsServiceId ); +// +// iStatus = KRequestPending; +// iRequestType = EMsgRequestSending; +// delete iOperation; +// iOperation = NULL; +// QDEBUG_WRITE( "Request send" ); +// iOperation = iSession->TransferCommandL( *iMmsSendErrorMessages, +// EMmsScheduledSend, +// paramPack, +// iStatus ); +// SetActive(); +// QDEBUG_WRITE( "Reset array" ); +// iMmsSendErrorMessages->Reset(); +// } +// QDEBUG_WRITE("CMsgErrorWatcherPrivate:StartMmsSendL : Exit"); +// } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::CheckMmsReceivingModeL +// +// Checks MMS receiving mode +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::CheckMmsReceivingModeL() + { + if ( !( iWatcherFlags & EStartupReady ) || !GetMmsServiceL() ) + { + return; + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:CMsgErrorWatcherPrivate : Enter"); + TBool validAP = ValidateMmsServiceL(); //Refreshes MMS settings + + + TInt fetchHome = iMmsClient->MmsSettings().ReceivingModeHome(); + TInt fetchRoam = iMmsClient->MmsSettings().ReceivingModeForeign(); + QDEBUG_WRITE_FORMAT("ReceivingModeHome: ", fetchHome ); + QDEBUG_WRITE_FORMAT("ReceivingModeForeign: ", fetchRoam ); + + if ( validAP && + fetchRoam == EMmsReceivingReject && + fetchHome != EMmsReceivingReject ) + { + QDEBUG_WRITE( "ShowNote flag enabled" ); + iWatcherFlags |= EShowRoamingNote; + } + else + { + //Reset roaming note flag + QDEBUG_WRITE( "ShowNote flag disabled" ); + iWatcherFlags &= ~EShowRoamingNote; + iWatcherFlags &= ~ERoamingNoteShown; + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::ValidateMmsServiceL +// +// Validates MMS service +// --------------------------------------------------------- +// +TBool CMsgErrorWatcherPrivate::ValidateMmsServiceL() + { +// if ( !GetMmsServiceL() ) +// { +// return EFalse; +// } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:ValidateMmsServiceL : Enter"); + iMmsClient->RestoreSettingsL(); //Refreshes MMS settings + QDEBUG_WRITE_FORMAT("ValidateService: ", iMmsClient->ValidateService( iMmsServiceId ) ); + + TInt errorCode = iMmsClient->ValidateService( iMmsServiceId ); + QDEBUG_WRITE_FORMAT("ValidateService: errorcode --- ", errorCode ); + QDEBUG_WRITE("CMsgErrorWatcherPrivate:ValidateMmsServiceL : Exit"); + return ( errorCode == KErrNone ); + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleNoAPErrorL +// +// Handles "no access point defined" error +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleNoAPErrorL( TMsvEntry& aEntry ) + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleNoAPErrorL : Enter"); + iMmsReceiveErrorMessages->AppendL( aEntry.Id() ); + + iWatcherFlags |= ENoAPErrorPending; + if ( !iCenRepObserver ) + { + QDEBUG_WRITE( "Creating CenRep observer" ); + iCenRepObserver = CMsgCenRepObserver::NewL( *this ); + iCenRepObserver->SubscribeNotification(); + } + //Let's reset the TMsvEntry::iError to get rig of excess warning note + ResetErrorFieldL( aEntry ); + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleNoAPErrorL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleInvalidAPErrorL +// +// Handles "invalid access point" error +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleInvalidAPErrorL( TMsvEntry& aEntry, TBool aStartObserver ) + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleInvalidAPErrorL : Enter"); + iMmsReceiveErrorMessages->AppendL( aEntry.Id() ); + + q_ptr->ShowNote(EInvalidAccessPointNote); + if ( aStartObserver && !iCommDbObserver ) + { + QDEBUG_WRITE( "Creating CommDB observer" ); + iCommDbObserver = CMsgErrorCommDbObserver::NewL( *this ); + } + if ( aStartObserver && !iCenRepObserver ) + { + //We must also start cenrep observer + QDEBUG_WRITE( "Creating CenRep observer" ); + iCenRepObserver = CMsgCenRepObserver::NewL( *this ); + iCenRepObserver->SubscribeNotification(); + } + + //Let's reset the TMsvEntry::iError to get rig of excess warning note + ResetErrorFieldL( aEntry ); + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleInvalidAPErrorL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleConnectionErrorL +// +// Handles "connection reserved" error +// --------------------------------------------------------- +// TODO: to be handled later. +//void CMsgErrorWatcherPrivate::HandleConnectionErrorL( TMsvEntry& aEntry, TBool aReceive ) +// { +// QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleConnectionErrorL : Enter"); +// if ( !iConnectionObserver ) +// { +// QDEBUG_WRITE( "Creating connection observer" ); +// iConnectionObserver = CMsgErrorConnectionObserver::NewL( *this ); +// } +// if ( iConnectionObserver->ConnectionsOpen() ) +// { +// QDEBUG_WRITE( "Open connections detected" ); +// if ( aReceive ) +// { +// iMmsReceiveErrorMessages->AppendL( aEntry.Id() ); +// } +// else +// { +// iMmsSendErrorMessages->AppendL( aEntry.Id() ); +// } +// //No matter if already started +// iConnectionObserver->StartL(); +// } +// else +// { +// QDEBUG_WRITE( "No open connections" ); +// delete iConnectionObserver; +// iConnectionObserver = NULL; +// } +// QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleConnectionErrorL : Exit"); +// } + +// --------------------------------------------------------- +// CMsgErrorWatcher::HandleDiskSpaceErrorL +// +// Handles "no disk space" error +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleDiskSpaceErrorL( TMsvEntry& aEntry ) + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleDiskSpaceErrorL : Enter"); + iMmsReceiveErrorMessages->AppendL( aEntry.Id() ); + + iDiskSpaceErrors++; + if ( iDiskSpaceErrors == 1 ) + { + if ( !( iWatcherFlags & EStartupReady ) ) + { + return; + } + QDEBUG_WRITE( "Show note" ); + q_ptr->ShowNote(EDiskLowNote1); + } + TUint triggerLevel = Max( KDefaultTriggerLevel, iMaxReceiveSize ); + //Activate DiskSpace observer + if ( !iDiskSpaceObserver ) + { + QDEBUG_WRITE( "Creating disk space observer" ); + iDiskSpaceObserver = CMsgErrorDiskSpaceObserver::NewL( *this, *iSession, iFs ); + } + QDEBUG_WRITE_FORMAT("Limit set to: ", + KCriticalLevel + triggerLevel + KTriggerMargin ); + iDiskSpaceObserver->SetLimitAndActivateL( KCriticalLevel + + triggerLevel + + KTriggerMargin ); + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleDiskSpaceErrorL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleMemoryErrorL +// +// Handles "no memory" error +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleMemoryErrorL( TMsvEntry& aEntry ) + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleMemoryErrorL : Enter"); + iMmsReceiveErrorMessages->AppendL( aEntry.Id() ); + if ( !( iWatcherFlags & EStartupReady ) ) + { + return; + } + q_ptr->ShowNote(EMemoryLowNote); + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleMemoryErrorL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleRoamingEventL +// +// Handles events from roaming observer +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleRoamingEventL( TBool aRoaming ) + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleRoamingEventL : Enter"); + QDEBUG_WRITE_FORMAT("aRoaming : ", aRoaming ); + if ( !iMmsClient ) + { + // We should never get here if MMS Client MTM is not present + // since roaming observer is not started in that case. + // This return is here just in case... + return; + } + + TInt fetchHome = iMmsClient->MmsSettings().ReceivingModeHome(); + TInt fetchRoam = iMmsClient->MmsSettings().ReceivingModeForeign(); + QDEBUG_WRITE_FORMAT("HandleRoamingEventL fetchHome : ", fetchHome ); + QDEBUG_WRITE_FORMAT("HandleRoamingEventL fetchRoam : ", fetchRoam ); + + TBool fetchAll = EFalse; + + if ( aRoaming ) + { + QDEBUG_WRITE( "we are in roaming." ); + //We are in roaming network + if ( fetchRoam == EMmsReceivingAutomatic && + fetchHome != EMmsReceivingAutomatic ) + { + fetchAll = ETrue; + } + if ( ( iWatcherFlags & EShowRoamingNote ) && + !( iWatcherFlags & ERoamingNoteShown ) ) + { + //Show roaming note if requested + if ( !( iWatcherFlags & EStartupReady ) ) + { + return; + } + q_ptr->ShowNote(ERoamingNote); + iWatcherFlags |= ERoamingNoteShown; + } + } + else + { + QDEBUG_WRITE( "we are in home network." ); + //We are in home network + if ( fetchHome == EMmsReceivingAutomatic && + fetchRoam != EMmsReceivingAutomatic ) + { + fetchAll = ETrue; + } + //Reset roaming note flag + iWatcherFlags &= ~ERoamingNoteShown; + } + + if ( fetchAll && !IsActive() ) + { + QDEBUG_WRITE( "starting fetch all" ); + iStatus = KRequestPending; + iRequestType = EMsgRequestFetchingAll; + delete iOperation; + iOperation = NULL; + iOperation = iMmsClient->FetchAllL( iStatus, EFalse ); + SetActive(); + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:~CMsgErrorWatcherPrivate : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleCommDbEventL +// +// Handles events from CommDB observer +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleCommDbEventL() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleCommDbEventL : Enter"); + if ( ValidateMmsServiceL() ) + { + QDEBUG_WRITE( "starting fetch" ); + StartMmsFetchL(); + } + else + { + //Wait for another event + QDEBUG_WRITE( "restart CommDB observer" ); + iCommDbObserver->Restart(); + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleCommDbEventL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleConnectionEvent +// +// Handles events from connection observer +// --------------------------------------------------------- +// TODO: handel later. +//void CMsgErrorWatcherPrivate::HandleConnectionEvent() +// { +// QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleConnectionEvent : Enter"); +// if ( !IsActive() ) +// { +// MEWLOGGER_WRITE( "HandleConnectionEvent, Starting delay timer" ); +// iStatus = KRequestPending; +// iRequestType = EMsgRequestWaitingDisconnection; +// iTimer.After( iStatus, KDelayAfterDisconnect ); +// SetActive(); +// } +// QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleConnectionEvent : Exit"); +// } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleDiskSpaceEventL +// +// Handles events from disk space observer +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleDiskSpaceEventL() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleDiskSpaceEventL : Enter"); + QDEBUG_WRITE( "starting fetch" ); + StartMmsFetchL(); + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleDiskSpaceEventL : Exit"); + } + + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleDiskSpaceEvent2L +// +// Handles events from disk space observer +// -------k-------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleDiskSpaceEvent2L() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleDiskSpaceEvent2L : Enter"); + // erro note text was coming form avkon. + QDEBUG_WRITE( "show note" ); + q_ptr->ShowNote(ESMSIncomingLowDiskSpace); + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleDiskSpaceEvent2L : Exit"); + + } + + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleStartupReadyL +// +// Handles events from startup state observer (currently +// CMsgSentItemsObserver) +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleStartupReadyL() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleStartupReadyL : Enter"); + QDEBUG_WRITE( "Startup ready!" ); + iWatcherFlags |= EStartupReady; + CheckMmsReceivingModeL(); + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleStartupReadyL : Exit"); + } + + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleCenRepNotificationL +// +// Handles events from Central Repository observer +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleCenRepNotificationL() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleCenRepNotificationL : Enter"); + if ( ValidateMmsServiceL() ) + { + QDEBUG_WRITE( "starting fetch" ); + StartMmsFetchL(); + } + else + { + //Wait for another event + QDEBUG_WRITE( "restart CenRep observer" ); + iCenRepObserver->SubscribeNotification(); + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleCenRepNotificationL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleSessionEventL +// +// Handles events from MsgServer observer +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleSessionEventL( TMsvSessionEvent aEvent, + TAny* aArg1, + TAny* aArg2, + TAny* aArg3 ) + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleSessionEventL : Enter"); + if ( ( aEvent == EMsvCloseSession || + aEvent == EMsvServerTerminated || + aEvent == EMsvMediaUnavailable || + aEvent == EMsvMediaChanged ) && + iWatcherFlags & EWatcherRunning ) + { + QDEBUG_WRITE_FORMAT("StopWatcher event: ", aEvent ); + StopWatcher(); + //Start retry timer + StartRestartTimer(); + return; + } + if ( aEvent == EMsvServerReady && + !( iWatcherFlags & EWatcherRunning ) ) + { + TRAPD ( err, StartWatcherL() ); + if ( err ) //make sure watcher is not left in obscure state + { + StopWatcher(); + } + return; + } + if ( aArg1 == 0 || aArg2 == 0 || !( iWatcherFlags & EWatcherRunning ) ) + { + return; + } + // If for some reason MMS service is not yet found, + // we try to find it now... + GetMmsServiceL(); + + CMsvEntrySelection* entries = static_cast( aArg1 ); + TInt count = entries->Count(); + + // Mark the _original_ folder as parent for "entries moved" events (in "aArg3"). + // For other events the parent is in "aArg2". + TMsvId parentId = ( aEvent == EMsvEntriesMoved ) + ? *( static_cast( aArg3 ) ) + : *( static_cast( aArg2 ) ); + + if ( count < 1 ) + { + return; + } + if ( parentId == KMsvRootIndexEntryIdValue && + iMmsServiceId != KMsvNullIndexEntryId ) + { + // We're not interested in these events if MMS Service is not present. + HandleRootEventL( aEvent, entries ); + } + else if ( parentId == KMsvLocalServiceIndexEntryIdValue ) + { + HandleLocalServiceEventL( aEvent, entries ); + } + else if ( parentId == KWatcherOutboxFolderId ) + { + HandleOutboxEventL( aEvent, entries ); + } + else if ( ( iMmsServiceId != KMsvNullIndexEntryId && parentId == iMmsServiceId ) || + ( iNotificationFolderId != KMsvNullIndexEntryId && parentId == iNotificationFolderId ) ) + { + HandleMmsServiceEventL( aEvent, entries ); + } + else + { + //do nothing + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleSessionEventL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleRootEventL +// +// Handles root events from MsgServer observer +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleRootEventL( TMsvSessionEvent aEvent, + CMsvEntrySelection* aEntries ) + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleRootEventL : Enter"); + QDEBUG_WRITE_FORMAT("aEvent : ",aEvent); + switch ( aEvent ) + { + case EMsvEntriesChanged: + { + TInt count = aEntries->Count(); + TInt i = 0; + while ( i < count ) + { + TMsvId dummy; + TMsvEntry entry; + TInt error = iSession->GetEntry( + aEntries->At( i ), dummy, entry ); + + //We're only interested in MMS service + if ( !error && + iMmsServiceId != KMsvNullIndexEntryId && + entry.Id() == iMmsServiceId ) + { + QDEBUG_WRITE( "HandleRootEventL, MMS service changed" ); + //Check whether the roaming setting has changed + CheckMmsReceivingModeL(); + + //We're waiting for the the user to change access points + //if iCommDbObserver exists + if ( iCommDbObserver && ValidateMmsServiceL() ) + { + QDEBUG_WRITE( "HandleRootEventL, deleting CommDB observer" ); + StartMmsFetchL(); + } + } + i++; + } + break; + } + default: + break; + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleRootEventL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleLocalServiceEventL +// +// Handles local service events from MsgServer observer +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleLocalServiceEventL( TMsvSessionEvent aEvent, + CMsvEntrySelection* aEntries ) + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleLocalServiceEventL : Enter"); + if ( iNotificationFolderId == KMsvNullIndexEntryId && + aEvent == EMsvEntriesCreated ) + { + TInt count = aEntries->Count(); + TInt i = 0; + while ( i < count ) + { + TMsvId dummy; + TMsvEntry entry; + TInt error = iSession->GetEntry( + aEntries->At( i ), dummy, entry ); + if ( !error && + entry.iDetails.Compare( KMMSNotificationFolder ) == 0 ) + { + iNotificationFolderId = aEntries->At( i ); + QDEBUG_WRITE_FORMAT("Notification folder created: ", iNotificationFolderId ); + } + i++; + } + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleLocalServiceEventL : Exit"); + } + + + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleOutboxEventL +// +// Handles outbox events from MsgServer observer +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleOutboxEventL( TMsvSessionEvent aEvent, + CMsvEntrySelection* aEntries ) + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleOutboxEventL : Enter"); + TInt count = aEntries->Count(); + QDEBUG_WRITE_FORMAT("aEvent: ",aEvent); + switch (aEvent) + { + case EMsvEntriesChanged: + { +// MEWLOGGER_WRITE("HandleOutboxEventL: case: EMsvEntriesChanged start"); +// TInt i = 0; +// MEWLOGGER_WRITEF( _L("EMsvEntriesChanged count: %d"), count ); +// while ( i < count ) +// { +// MEWLOGGER_WRITE( "EMsvEntriesChanged - inside while" ); +// TMsvId dummy; +// TMsvEntry entry; +// TInt error = iSession->GetEntry( +// aEntries->At( i ), dummy, entry ); +// TUid mtm = entry.iMtm; +// MEWLOGGER_WRITEF( _L("EMsvEntriesChanged - mtm --- %d"), mtm ); +// MEWLOGGER_WRITEF( _L("EMsvEntriesChanged - entry id --- %d"), iMmsSendErrorMessages->Find( entry.Id() )); +// if ( mtm == KSenduiMtmMmsUid && +// iMmsSendErrorMessages->Find( entry.Id() ) == KErrNotFound ) +// { +// MEWLOGGER_WRITE( "EMsvEntriesChanged - inside if" ); +// if ( // the first error is activated again to synchronize +// // with connection manager (MPM) +// entry.iError == KErrPacketDataTsyMaxPdpContextsReached || +// entry.iError == KErrUmtsMaxNumOfContextExceededByPhone || +// entry.iError == KErrUmtsMaxNumOfContextExceededByNetwork || +// // add the following error to the list to synchronize with +// // connection manager (MPM) +// entry.iError == KErrGprsInsufficientResources ) +// { +// MEWLOGGER_WRITE( "MMS send - connection active" ); +// +// //Let's now save the id. This way we can reset the entrys +// //error field just before the fetch start. This prevents +// //duplicate error notes because this case branch is reached many times. +// iCurrentEntryId = entry.Id(); +// +// HandleConnectionErrorL( entry, EFalse ); +// } +// } +// i++; +// } + break; + } + case EMsvEntriesMoved: // Messages are moved _from_ this folder. + case EMsvEntriesDeleted: + { + TInt i = 0; + while ( i < count ) + { + TInt selectionId = iMmsSendErrorMessages->Find( aEntries->At( i ) ); + if ( selectionId != KErrNotFound ) + { + iMmsSendErrorMessages->Delete( selectionId ); + } + i++; + } + } + break; + default: + break; + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleOutboxEventL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::HandleMmsServiceEventL +// +// Handles MMS service events from MsgServer observer +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::HandleMmsServiceEventL( TMsvSessionEvent aEvent, + CMsvEntrySelection* aEntries ) + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleMmsServiceEventL : Enter"); + TInt count = aEntries->Count(); + QDEBUG_WRITE_FORMAT("aEvent: ", aEvent ); + switch (aEvent) + { + case EMsvEntriesChanged: + { + TInt i = 0; + while ( i < count ) + { + TMsvId dummy; + TMsvEntry entry; + TInt error = iSession->GetEntry( + aEntries->At( i ), dummy, entry ); + + if ( !error ) + { + QDEBUG_WRITE_FORMAT("FetchState: ", entry.SendingState() ); + QDEBUG_WRITE_FORMAT("Error: ", entry.iError ); + QDEBUG_WRITE_FORMAT("Retries: ", entry.iMtmData3 ); + QDEBUG_WRITE_FORMAT("Failed: ", (TInt)entry.Failed() ); + QDEBUG_WRITE_FORMAT("ArrayId: ", iMmsReceiveErrorMessages->Find( entry.Id() ) ); + } + //Check that reception has failed and that the entry is not + //already in iMmsReceiveErrorMessages + if ( !error && + iMmsReceiveErrorMessages->Find( entry.Id() ) == KErrNotFound ) + { + TInt entryErr = entry.iError; + if ( entryErr == KErrGprsMissingorUnknownAPN ) + { + // Map to "invalid ap" error. + entryErr = KMmsErrorAP1Invalid; + } + QDEBUG_WRITE_FORMAT("entryErr: ", entryErr ); + switch ( entryErr ) + { + case KErrDiskFull: + { + HandleDiskSpaceErrorL( entry ); + } + break; + case KErrNoMemory: + { + HandleMemoryErrorL( entry ); + } + break; + // TODO: to be handled later. + // the first error is activated again to synchronize + // with connection manager (MPM) +// case KErrPacketDataTsyMaxPdpContextsReached: +// case KErrUmtsMaxNumOfContextExceededByPhone: +// case KErrUmtsMaxNumOfContextExceededByNetwork: +// // add the following error to the list to synchronize with +// // connection manager (MPM) +// case KErrGprsInsufficientResources: +// { +// //Let's now save the id. This way we can reset the entrys +// //error field just before the fetch start. This prevents +// //duplicate error notes because this case branch is reached many times. +// iCurrentEntryId = entry.Id(); +// //Connection already active should be "detected" +// //only after third retry failure if "disconnect +// //delay" feature is activated. +// TInt retries = ( iWatcherFlags & EReceivingDisconnectDelay ) +// ? KConnectionRetries +// : 0; +// if ( ( entry.iMtmData3 & KMmsRetryCountMask ) >= retries ) //lint !e574 +// { +// MEWLOGGER_WRITE( "MMS fetch - connection active" ); +// +// +// HandleConnectionErrorL( entry, ETrue ); +// } +// } +// +// break; + + case KMmsErrorNoWAPAccessPoint: + { + HandleNoAPErrorL( entry ); + } + break; + case KMmsErrorAP1Invalid: + case KMmsErrorNoURI1: + { + HandleInvalidAPErrorL( entry, ETrue ); + } + break; + case KErrIfAuthenticationFailure: //username/passwd + { + HandleInvalidAPErrorL( entry, EFalse ); + } + break; + default: + //nothing to do + break; + } + } + i++; + } + } + break; + case EMsvEntriesMoved: // Messages are moved _from_ this "folder". + case EMsvEntriesDeleted: + { + TInt i = 0; + TInt originalCount = iMmsReceiveErrorMessages->Count(); + while ( i < count ) + { + TInt selectionId = iMmsReceiveErrorMessages->Find( aEntries->At( i ) ); + if ( selectionId != KErrNotFound ) + { + iMmsReceiveErrorMessages->Delete( selectionId ); + } + i++; + } + if ( originalCount && !iMmsReceiveErrorMessages->Count() ) + { + // array was emptied + ResetWatcher(); + } + } + break; + default: + break; + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:HandleMmsServiceEventL : Enter"); + } + + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::ResetErrorFieldL +// +// Reset TMsvEntry::iError of the current notification +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::ResetErrorFieldL( ) + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:ResetErrorFieldL : Enter"); + //Makes sure the entry is set + if( iCurrentEntryId != KMsvNullIndexEntryId ) + { + CMsvEntry *cEntry( NULL ); + TRAPD( err, cEntry = iSession->GetEntryL( iCurrentEntryId ) ); + if ( err == KErrNotFound ) + { + iCurrentEntryId = KMsvNullIndexEntryId; + return; + } + CleanupStack::PushL( cEntry ); + TMsvEntry tEntry = cEntry->Entry(); + tEntry.iError = KErrNone; + cEntry -> ChangeL( tEntry ); + CleanupStack::PopAndDestroy( cEntry ); + //This prevents getting here to often + iCurrentEntryId = KMsvNullIndexEntryId; + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:ResetErrorFieldL : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::ResetErrorFieldL +// +// Reset TMsvEntry::iError +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::ResetErrorFieldL( TMsvEntry& aEntry ) + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:ResetErrorFieldL() : Enter"); + CMsvEntry *cEntry = iSession->GetEntryL( aEntry.Id() ); + CleanupStack::PushL( cEntry ); + aEntry.iError = KErrNone; + cEntry -> ChangeL( aEntry ); + CleanupStack::PopAndDestroy( cEntry ); + QDEBUG_WRITE("CMsgErrorWatcherPrivate:ResetErrorFieldL() : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::DoCancel +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::DoCancel() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:DoCancel : Enter"); + iTimer.Cancel(); + if ( iOperation ) + { + iOperation->Cancel(); + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:DoCancel : Exit"); + } + +// --------------------------------------------------------- +// CMsgErrorWatcherPrivate::RunL +// +// From active object framework +// --------------------------------------------------------- +// +void CMsgErrorWatcherPrivate::RunL() + { + QDEBUG_WRITE("CMsgErrorWatcherPrivate:RunL : Enter"); + QDEBUG_WRITE_FORMAT("RunL, iStatus: ", iStatus.Int() ); + QDEBUG_WRITE_FORMAT("RunL, iRequestType: ", iRequestType ); + QDEBUG_WRITE_FORMAT("RunL, EMsgRequestSending - iMmsReceiveErrorMessages: ", iMmsReceiveErrorMessages->Count() ); + + switch ( iRequestType ) + { + case EMsgRequestStartingUp: + { + if ( !( iWatcherFlags & EWatcherRunning ) ) + { + TRAPD ( err, StartWatcherL() ); + if ( err ) //make sure watcher is not left in obscure state + { + QDEBUG_WRITE_FORMAT("Leave from StartWatcherL: %d", err ); + StopWatcher(); + if ( iTimerRetries < KMaxTimerRetries ) + { + StartRestartTimer(); + } + //else give up + } + } + } + break; + case EMsgRequestSending: + { + if ( iMmsReceiveErrorMessages->Count() ) + { + StartMmsFetchL(); + } + else + { +// delete iConnectionObserver; +// iConnectionObserver = NULL; + ResetErrorFieldL(); + } + break; + } + case EMsgRequestFetching: + { + ResetErrorFieldL(); + ResetWatcher(); + break; + } +// TODO: to be handled later. +// case EMsgRequestWaitingDisconnection: +// { +// MEWLOGGER_WRITE( "RunL, Disconnect delay passed" ); +// MEWLOGGER_WRITEF( _L("RunL, EMsgRequestWaitingDisconnection - iMmsReceiveErrorMessages: %d"), iMmsSendErrorMessages->Count() ); +// if ( iMmsSendErrorMessages->Count() ) +// { +// StartMmsSendL(); +// } +// else +// { +// StartMmsFetchL(); +// } +// //ResetErrorFieldL(); +// } +// break; + case EMsgRequestFetchingAll: + default: + break; + } + QDEBUG_WRITE("CMsgErrorWatcherPrivate:RunL : Exit"); + } + + +// End of File + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifications.pro --- a/messagingapp/msgnotifications/msgnotifications.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgnotifications/msgnotifications.pro Tue Aug 31 18:53:38 2010 +0530 @@ -19,6 +19,7 @@ SYMBIAN_PLATFORMS = WINSCW ARMV5 SUBDIRS += msgnotificationdialogplugin/msgnotificationdialogplugin.pro SUBDIRS += msgindicatorplugin/msgindicatorplugin.pro +SUBDIRS += msgerrorwatcher/msgerrorwatcher.pro SUBDIRS += msgnotifier/msgnotifier.pro SUBDIRS += msgerrornotifier/msgerrornotifier.pro SUBDIRS += flashmsgnotifier/flashmsgnotifier.pro diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/inc/msgnotifier.h --- a/messagingapp/msgnotifications/msgnotifier/inc/msgnotifier.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgnotifications/msgnotifier/inc/msgnotifier.h Tue Aug 31 18:53:38 2010 +0530 @@ -28,6 +28,7 @@ // CLASS DECLARATION class MsgNotifierPrivate; class MsgSimNumDetector; +class MsgErrorWatcher; /** * Stores the data required for notification. @@ -137,6 +138,12 @@ * Sim settings handler */ MsgSimNumDetector* mSimHandler; + + /** + * Pointer to error watcher + * Own + */ + MsgErrorWatcher* mErrorWatcher; }; #endif // MSGNOTIFIER_H diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/msgnotifier.pro --- a/messagingapp/msgnotifications/msgnotifier/msgnotifier.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgnotifications/msgnotifier/msgnotifier.pro Tue Aug 31 18:53:38 2010 +0530 @@ -22,6 +22,7 @@ HEADERS += $$PUBLIC_HEADERS INCLUDEPATH += . inc ../../../inc INCLUDEPATH += ../../msgsettings/msginit/inc +INCLUDEPATH += ../msgerrorwatcher/inc INCLUDEPATH += ../inc INCLUDEPATH += $$APP_LAYER_INCLUDEPATH INCLUDEPATH += $$MW_LAYER_INCLUDEPATH @@ -66,12 +67,13 @@ -lQtContacts \ -lQtVersit \ -lunidatamodelloader \ - -lxqsettingsmanager \ + -lxqsettingsmanager \ -apgrfx.lib \ -lxqutils \ -lws32 \ -lapgrfx \ - -lxqsystemtoneservice \ - -lgsmu \ - -lssmcmn + -lxqsystemtoneservice \ + -lmsgerrorwatcher \ + -lgsmu \ + -lssmcmn diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp --- a/messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -31,6 +31,7 @@ #include "unidatamodelloader.h" #include "unidatamodelplugininterface.h" #include "msgcontacthandler.h" +#include "msgerrorwatcher.h" #include "debugtraces.h" @@ -58,6 +59,7 @@ d_ptr = q_check_ptr(new MsgNotifierPrivate(this)); mSimHandler = new MsgSimNumDetector(); + mErrorWatcher = new MsgErrorWatcher(this); QDEBUG_WRITE("MsgNotifier::MsgNotifier : Exit") } @@ -72,6 +74,7 @@ delete d_ptr; delete mSimHandler; + delete mErrorWatcher; QDEBUG_WRITE("MsgNotifier::~MsgNotifier : Enter") } diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/tsrc.pro --- a/messagingapp/msgnotifications/msgnotifier/tsrc/tsrc.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/tsrc.pro Tue Aug 31 18:53:38 2010 +0530 @@ -19,7 +19,7 @@ CONFIG += symbian_test #Sub .pro files -SUBDIRS += unittest_mmsplugin/unittest_mmsplugin.pro +SUBDIRS += unittest_mmsplugin # Platforms SYMBIAN_PLATFORMS = DEFAULT \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/mmstestbed.pro --- a/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/mmstestbed.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/mmstestbed.pro Tue Aug 31 18:53:38 2010 +0530 @@ -67,7 +67,7 @@ symbian { - TARGET.UID3 = 0xE5c588a1 + TARGET.UID3 = 0xE5c588a1 TARGET.CAPABILITY = CAP_GENERAL_DLL TARGET.EPOCSTACKSIZE = 0x8000 TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000 diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/data/SmileyFace.gif Binary file messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/data/SmileyFace.gif has changed diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/data/sample.txt diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/data/testmmsplugin.cfg --- a/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/data/testmmsplugin.cfg Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -TestMmsPlugin diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/data/testmmsplugin.pl --- a/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/data/testmmsplugin.pl Wed Aug 18 00:46:12 2010 +0530 +++ /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 "

Messaging101 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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/inc/testmmsplugin.h --- a/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/inc/testmmsplugin.h Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - Main test class for Msgnotification -indicator plugin, - * -notification dialog plugin - */ - -#ifndef TEST_MMS_PLUGIN_H -#define TEST_MMS_PLUGIN_H - -#ifdef BUILD_TEST_DLL -#define TEST_EXPORT Q_DECL_EXPORT -#else -#define TEST_EXPORT Q_DECL_IMPORT -#endif - -#include -#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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/inc/testmmsplugin.ini --- a/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/inc/testmmsplugin.ini Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -//this file is used to provide predefined set of input data. - -const char TEST_MSG_RECIEPIENT[] = "+919000"; -const char TEST_MSG_FROM2[] = "999"; -const char TEST_MSG_SUBJECT[] = "Message Subject"; -const char TEST_SERVICE_NAME_MMS[] = "messaging.mserver.testservice.MMS"; -const char TEST_SENDER[] = "+918888"; -const char TEST_ATTACHMENT[] = "c:\\sample.txt"; -const char TEST_ATTACHMENT4[] = "c:\\SmileyFace.gif"; -const char TEST_ATTACHMENT5[] = "c:\\sample.txt"; -const char TEST_CC[] = "DummyCCAddress"; -const char TEST_BCC[] = "DummyBCCAddress"; \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/src/testmmsplugin.cpp --- a/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/src/testmmsplugin.cpp Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - Main test class for Msgnotification -indicator plugin, - * -notification dialog plugin - */ - -#include "testmmsplugin.h" -#include -#include "debugtraces.h" -#include -#include -#include "convergedmessage.h" -#include "convergedmessageid.h" -#include "unieditormmsplugin.h" -#include "mmstestbed.h" -#include "testmmsplugin.ini" -#include - - - -//factory method to create objects. -QObject* getObject(QString className) -{ - if(className == "TestMmsPlugin" ) - { - return new TestMmsPlugin; - } - else - { - return 0; - } -} - -//main entry point -int main(int argc, char *argv[]) - { - int ret = -1; - QCoreApplication app(argc, argv); - - //the configuration file. - QFile data("c:/testmmsplugin.cfg"); - if (data.open(QFile::ReadOnly)) - { - QTextStream in(&data); - while(!in.atEnd()) - { - QString name = in.readLine(); - QObject* tc = getObject(name); - - if(tc) - { - ret = QTest::qExec(tc, argc, argv); - delete tc; - } - } - } - return ret; - - } - - - - - - -//--------------------------------------------------------------- -// TestMmsPlugin::initTestCase -//--------------------------------------------------------------- - -void TestMmsPlugin::initTestCase() -{ - qRegisterMetaType ("long int"); - 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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/testmmsplugin.pro --- a/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/testmmsplugin.pro Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ - -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -QT += testlib -QT -= gui - -CONFIG += hb -CONFIG += symbian_test - -TEMPLATE = app -TARGET = testmmsplugin - -INCLUDEPATH += inc -INCLUDEPATH += ../../inc -INCLUDEPATH += ../../../../../../../../inc -INCLUDEPATH += ../../../../../../inc -INCLUDEPATH += ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc -INCLUDEPATH += ../../../../../msgutils/unidatautils/unidatamodel/inc -INCLUDEPATH += ../../../../../msgutils/unieditorutils/editorgenutils/inc -INCLUDEPATH += ../../../../../../../../mmsengine/mmsmessage/inc -INCLUDEPATH += ../../../../../../../../mmsengine/inc -INCLUDEPATH += ../mmstestbed/inc -INCLUDEPATH += -INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE - -DEFINES += BUILD_TEST_DLL - -SOURCES += \ - src/testmmsplugin.cpp \ - ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp \ - ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp - - -# Input -HEADERS += \ - inc/testmmsplugin.h \ - ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin.h \ - ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h - - -SYMBIAN_PLATFORMS = WINSCW ARMV5 - -symbian { - TARGET.UID3 = 0xE7232a7c - TARGET.CAPABILITY = CAP_GENERAL_DLL - TARGET.EPOCSTACKSIZE = 0x8000 - TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000 - TARGET.EPOCALLOWDLLDATA = 1 - VENDORID = VID_DEFAULT - BLD_INF_RULES.prj_exports += "data/testmmsplugin.cfg c:/testmmsplugin.cfg" - BLD_INF_RULES.prj_exports += "data/testmmsplugin.pl c:/testmmsplugin.pl" - BLD_INF_RULES.prj_exports += "data/SmileyFace.gif c:/SmileyFace.gif" - BLD_INF_RULES.prj_exports += "data/sample.txt c:/sample.txt" - - } - - LIBS += -leuser \ - -lcsserverclientapi \ - -lcsutils \ - -lconvergedmessageutils \ - -lMsgMedia \ - -leikctl \ - -leditorgenutils \ - -lcone \ - -leikcoctl \ - -leikcore \ - -leikdlg \ - -lmsgs \ - -letext \ - -lmmsserversettings \ - -lgsmu \ - -lmmsgenutils \ - -lefsrv \ - -lestor \ - -lsmcm \ - -lCommonEngine \ - -lbafl \ - -lCdlEngine \ - -lFeatMgr \ - -lapmime \ - -lapgrfx \ - -lcharconv \ - -lInetProtUtil \ - -lsmildtd \ - -lxmldom \ - -lxmlparser \ - -lcone \ - -lQtCore \ - -letel \ - -lmmsmessage \ - -lcommdb \ - -lcommsdat \ - -letelmm \ - -lunidatamodelloader \ - -lunidatamodel \ - -lavkon \ - -leikcoctl \ - -leikctl \ - -lform \ - -luiklaf\ - -lxqutils\ - -lmmstestbed\ - -lmsginit \ - -lmsgs \ - -letext \ - -lsmcm \ - -lmmsmessage \ - -lmmsserversettings \ - -lmmscli \ - -lxqservice \ - -lQtContacts \ - -lQtVersit \ - -lunidatamodelloader \ - -lxqsettingsmanager \ - -apgrfx.lib \ - -lxqutils \ - -lws32 \ - -lapgrfx \ - -lxqsystemtoneservice - - - -packageheader = "$${LITERAL_HASH}{\"QTestLibCVsClientServerTest\"},(0xE7232a7c),1,0,0,TYPE=SA" - -vendorinfo = \ - "; Localised Vendor name" \ - "%{\"Nokia\"}" \ - "; Unique Vendor name" \ - ":\"Nokia\"" - -dependencyinfo = \ - "; Default HW/platform dependencies" \ - "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ - "[0x2001E61C],4,6,3,{"Qt"} - -default_deployment.pkg_prerules = packageheader \ - vendorinfo \ - dependencyinfo - -#Copy the dependent DLL -symbian: { - addCfg.sources = ./data/testmmsplugin.cfg - addCfg.path = C:/ - DEPLOYMENT += addCfg - - addPl.sources = ./data/testmmsplugin.pl - addPl.path = C:/ - DEPLOYMENT += addPl - - addFiles.sources = mmstestbed.dll - addFiles.path = /sys/bin - DEPLOYMENT += addFiles - - addP2.sources = ./data/SmileyFace.gif - addP2.path = C:/ - DEPLOYMENT += addP2 - - addP3.sources = ./data/sample.txt - addP3.path = C:/ - DEPLOYMENT += addP3 - - -} diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/data/SmileyFace.gif Binary file messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/data/SmileyFace.gif has changed diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/data/sample.txt diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/data/testmmsplugin.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/data/testmmsplugin.cfg Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,1 @@ +TestMmsPlugin diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/data/testmmsplugin.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/data/testmmsplugin.pl Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,182 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +#!/usr/bin/perl -w +use warnings; +use strict; + +my $TOTALCASES = 0; +my $TOTALPASSED = 0; +my $TOTALRUN = 0; +my $TOTALFAILED = 0; +my $TOTALSKIPPED = 0; + +sub parse_line +{ + my $line = $_[0]; + my @parts = split (" ", $line); + my $passed = $parts[1]; + my $failed = $parts[3]; + my $skipped = $parts[5]; + + my $total = $passed + $failed + $skipped; + my $passrate = $passed * 100 / $total; + my $passrateround = sprintf("%.0f",$passrate); + my $runrate = ($total - $skipped)*100/$total; + my $runrateround = sprintf("%.0f",$runrate); + + $TOTALCASES += $total; + $TOTALPASSED += $passed; + $TOTALRUN += ($total - $skipped); + $TOTALFAILED += $failed; + $TOTALSKIPPED += $skipped; + + printf MYFILE "\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 "

Messaging101 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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/inc/testmmsplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/inc/testmmsplugin.h Tue Aug 31 18:53:38 2010 +0530 @@ -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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/inc/testmmsplugin.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/inc/testmmsplugin.ini Tue Aug 31 18:53:38 2010 +0530 @@ -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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/src/testmmsplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/src/testmmsplugin.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: - Main test class for Msgnotification -indicator plugin, + * -notification dialog plugin + */ + +#include "testmmsplugin.h" +#include +#include "debugtraces.h" +#include +#include +#include "convergedmessage.h" +#include "convergedmessageid.h" +#include "unieditormmsplugin.h" +#include "mmstestbed.h" +#include "testmmsplugin.ini" +#include + + + +//factory method to create objects. +QObject* getObject(QString className) +{ + if(className == "TestMmsPlugin" ) + { + return new TestMmsPlugin; + } + else + { + return 0; + } +} + +//main entry point +int main(int argc, char *argv[]) + { + int ret = -1; + QCoreApplication app(argc, argv); + + //the configuration file. + QFile data("c:/testmmsplugin.cfg"); + if (data.open(QFile::ReadOnly)) + { + QTextStream in(&data); + while(!in.atEnd()) + { + QString name = in.readLine(); + QObject* tc = getObject(name); + + if(tc) + { + ret = QTest::qExec(tc, argc, argv); + delete tc; + } + } + } + return ret; + + } + + + + + + +//--------------------------------------------------------------- +// TestMmsPlugin::initTestCase +//--------------------------------------------------------------- + +void TestMmsPlugin::initTestCase() +{ + qRegisterMetaType ("long int"); + 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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/testmmsplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/testmmsplugin.pro Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,177 @@ + +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +QT += testlib +QT -= gui + +CONFIG += hb +CONFIG += symbian_test + +TEMPLATE = app +TARGET = testmmsplugin + +INCLUDEPATH += inc +INCLUDEPATH += ../../inc +INCLUDEPATH += ../../../../../../../../inc +INCLUDEPATH += ../../../../../../inc +INCLUDEPATH += ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc +INCLUDEPATH += ../../../../../msgutils/unidatautils/unidatamodel/inc +INCLUDEPATH += ../../../../../msgutils/unieditorutils/editorgenutils/inc +INCLUDEPATH += ../../../../../../../../mmsengine/mmsmessage/inc +INCLUDEPATH += ../../../../../../../../mmsengine/inc +INCLUDEPATH += ../mmstestbed/inc +INCLUDEPATH += +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +DEFINES += BUILD_TEST_DLL + +SOURCES += \ + src/testmmsplugin.cpp \ + ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp \ + ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp + + +# Input +HEADERS += \ + inc/testmmsplugin.h \ + ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin.h \ + ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h + + +SYMBIAN_PLATFORMS = WINSCW ARMV5 + +symbian { + TARGET.UID3 = 0xE7232a7c + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.EPOCSTACKSIZE = 0x8000 + TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000 + TARGET.EPOCALLOWDLLDATA = 1 + VENDORID = VID_DEFAULT + BLD_INF_RULES.prj_exports += "data/testmmsplugin.cfg c:/testmmsplugin.cfg" + BLD_INF_RULES.prj_exports += "data/testmmsplugin.pl c:/testmmsplugin.pl" + BLD_INF_RULES.prj_exports += "data/SmileyFace.gif c:/SmileyFace.gif" + BLD_INF_RULES.prj_exports += "data/sample.txt c:/sample.txt" + + } + + LIBS += -leuser \ + -lcsserverclientapi \ + -lcsutils \ + -lconvergedmessageutils \ + -lMsgMedia \ + -leikctl \ + -leditorgenutils \ + -lcone \ + -leikcoctl \ + -leikcore \ + -leikdlg \ + -lmsgs \ + -letext \ + -lmmsserversettings \ + -lgsmu \ + -lmmsgenutils \ + -lefsrv \ + -lestor \ + -lsmcm \ + -lCommonEngine \ + -lbafl \ + -lCdlEngine \ + -lFeatMgr \ + -lapmime \ + -lapgrfx \ + -lcharconv \ + -lInetProtUtil \ + -lsmildtd \ + -lxmldom \ + -lxmlparser \ + -lcone \ + -lQtCore \ + -letel \ + -lmmsmessage \ + -lcommdb \ + -lcommsdat \ + -letelmm \ + -lunidatamodelloader \ + -lunidatamodel \ + -lavkon \ + -leikcoctl \ + -leikctl \ + -lform \ + -luiklaf\ + -lxqutils\ + -lmmstestbed\ + -lmsginit \ + -lmsgs \ + -letext \ + -lsmcm \ + -lmmsmessage \ + -lmmsserversettings \ + -lmmscli \ + -lxqservice \ + -lQtContacts \ + -lQtVersit \ + -lunidatamodelloader \ + -lxqsettingsmanager \ + -apgrfx.lib \ + -lxqutils \ + -lws32 \ + -lapgrfx \ + -lxqsystemtoneservice + + + +packageheader = "$${LITERAL_HASH}{\"QTestMsgNotifier\"},(0xE7232a7c),1,0,0,TYPE=SA" + +vendorinfo = \ + "; Localised Vendor name" \ + "%{\"Nokia\"}" \ + "; Unique Vendor name" \ + ":\"Nokia\"" + +dependencyinfo = \ + "; Default HW/platform dependencies" \ + "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ + "[0x2001E61C],4,6,3,{"Qt"} + +default_deployment.pkg_prerules = packageheader \ + vendorinfo \ + dependencyinfo + +#Copy the dependent DLL +symbian: { + addCfg.sources = ./data/testmmsplugin.cfg + addCfg.path = C:/ + DEPLOYMENT += addCfg + + addPl.sources = ./data/testmmsplugin.pl + addPl.path = C:/ + DEPLOYMENT += addPl + + addFiles.sources = mmstestbed.dll + addFiles.path = /sys/bin + DEPLOYMENT += addFiles + + addP2.sources = ./data/SmileyFace.gif + addP2.path = C:/ + DEPLOYMENT += addP2 + + addP3.sources = ./data/sample.txt + addP3.path = C:/ + DEPLOYMENT += addP3 + + +} diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/unittest_mmsplugin.pro --- a/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/unittest_mmsplugin.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/unittest_mmsplugin.pro Tue Aug 31 18:53:38 2010 +0530 @@ -20,8 +20,8 @@ CONFIG += ordered #Sub .pro files -SUBDIRS += mmstestbed/mmstestbed.pro -SUBDIRS += testmmsgplugin/testmmsplugin.pro +SUBDIRS += mmstestbed +SUBDIRS += testmmsplugin # Platforms diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h --- a/messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h Tue Aug 31 18:53:38 2010 +0530 @@ -22,6 +22,7 @@ #include #include #include +#include class QGraphicsItem; class QGraphicsPixmapItem; @@ -83,6 +84,13 @@ * @param data data to be sent. */ void send(QVariant data); + + /** + * Send message. + */ + void send(ConvergedMessage message); + + /** * Opens the viewer to view the message. diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgservices/msgserviceapp/inc/msgservicewindow.h --- a/messagingapp/msgservices/msgserviceapp/inc/msgservicewindow.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgservices/msgserviceapp/inc/msgservicewindow.h Tue Aug 31 18:53:38 2010 +0530 @@ -26,6 +26,7 @@ class MsgServiceViewManager; class MsgShareUiInterface; class MsgSendInterface; +class MsgUriHandlerInterface; class MsgServiceWindow : public HbMainWindow { @@ -60,6 +61,12 @@ * Owned */ MsgShareUiInterface* mShareUiInterface; + + /** + * URI handler interface object + * Owned + */ + MsgUriHandlerInterface* mUriInterface; /** * Message store handler diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgservices/msgserviceapp/inc/msgurihandlerinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgservices/msgserviceapp/inc/msgurihandlerinterface.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,59 @@ +/* + * 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: Message Application service interface used for interfacing between + * QT highway and other applications + * + */ + +#ifndef __MSG_URIHANDLERINTERFACE_H__ +#define __MSG_URIHANDLERINTERFACE_H__ + +#include +#include +#include + +class MsgServiceViewManager; + +class MsgUriHandlerInterface : public XQServiceProvider + { + Q_OBJECT + +public: + /* + * Constructor + */ + MsgUriHandlerInterface(MsgServiceViewManager* viewManager, QObject* parent=0); + + /* + * Destructor + */ + ~MsgUriHandlerInterface(); + +public slots: + + bool view(const QString& uri); + +private: + + void normalizeQueryItems(QUrl &url); + + void addRecipients(ConvergedMessage &message, const QString &recipientsList); + +private: + + MsgServiceViewManager* viewManager; + + }; + +#endif /* __MSG_URIHANDLERINTERFACE_H__ */ diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgservices/msgserviceapp/msgserviceapp.pro --- a/messagingapp/msgservices/msgserviceapp/msgserviceapp.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgservices/msgserviceapp/msgserviceapp.pro Tue Aug 31 18:53:38 2010 +0530 @@ -36,15 +36,17 @@ inc/msgstorehandler.h \ inc/msgsendinterface.h \ inc/msgshareuiinterface.h \ - inc/msgserviceviewmanager.h + inc/msgserviceviewmanager.h \ + inc/msgurihandlerinterface.h SOURCES += src/main.cpp \ src/msgviewinterface.cpp \ src/msgservicewindow.cpp \ src/msgstorehandler.cpp \ src/msgsendinterface.cpp \ - src/msgshareuiinterface.cpp \ - src/msgserviceviewmanager.cpp + src/msgshareuiinterface.cpp \ + src/msgserviceviewmanager.cpp \ + src/msgurihandlerinterface.cpp # Capability TARGET.CAPABILITY = ALL -TCB diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgservices/msgserviceapp/rom/msgserviceapp.iby --- a/messagingapp/msgservices/msgserviceapp/rom/msgserviceapp.iby Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgservices/msgserviceapp/rom/msgserviceapp.iby Tue Aug 31 18:53:38 2010 +0530 @@ -22,10 +22,9 @@ data=DATAZ_\resource\apps\msgserviceapp.rsc resource\apps\msgserviceapp.rsc data=DATAZ_\private\10003a3f\import\apps\msgserviceapp_reg.rsc private\10003a3f\import\apps\msgserviceapp_reg.rsc - - data=ZRESOURCE\hb\splashml\messagingsendservice.splashml RESOURCE_FILES_DIR\hb\splashml\messagingsendservice.splashml - data=ZRESOURCE\hb\splashml\messagingsendservice.docml RESOURCE_FILES_DIR\hb\splashml\messagingsendservice.docml - data=ZRESOURCE\hb\splashml\messagingviewservice.splashml RESOURCE_FILES_DIR\hb\splashml\messagingviewservice.splashml - data=ZRESOURCE\hb\splashml\messagingviewservice.docml RESOURCE_FILES_DIR\hb\splashml\messagingviewservice.docml - +data=ZRESOURCE\hb\splashml\messagingsendservice.splashml RESOURCE_FILES_DIR\hb\splashml\messagingsendservice.splashml +data=ZRESOURCE\hb\splashml\messagingsendservice.docml RESOURCE_FILES_DIR\hb\splashml\messagingsendservice.docml +data=ZRESOURCE\hb\splashml\messagingviewservice.splashml RESOURCE_FILES_DIR\hb\splashml\messagingviewservice.splashml +data=ZRESOURCE\hb\splashml\messagingviewservice.docml RESOURCE_FILES_DIR\hb\splashml\messagingviewservice.docml + #endif diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgservices/msgserviceapp/service_conf.xml --- a/messagingapp/msgservices/msgserviceapp/service_conf.xml Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgservices/msgserviceapp/service_conf.xml Tue Aug 31 18:53:38 2010 +0530 @@ -4,6 +4,13 @@ No path Messaging services + com.nokia.symbian.IUriView + 1.0 + Interface for showing URIs + sms,mmsto + + + com.nokia.symbian.IFileShare 1.0 Share UI send interface diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgservices/msgserviceapp/src/msgserviceviewmanager.cpp --- a/messagingapp/msgservices/msgserviceapp/src/msgserviceviewmanager.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgservices/msgserviceapp/src/msgserviceviewmanager.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -693,3 +693,26 @@ return animFile; } + +//----------------------------------------------------------------------------- +//MsgServiceViewManager::send +//@see header +//----------------------------------------------------------------------------- + +void MsgServiceViewManager::send(ConvergedMessage message) + { + QVariantList param; + QByteArray dataArray; + QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append); + + message.serialize(messageStream); + param << dataArray; + + // switch to editor + switchToUniEditor(param); + + XQServiceUtil::toBackground(false); + } + + + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgservices/msgserviceapp/src/msgservicewindow.cpp --- a/messagingapp/msgservices/msgserviceapp/src/msgservicewindow.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgservices/msgserviceapp/src/msgservicewindow.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -20,6 +20,7 @@ #include "msgviewinterface.h" #include "msgsendinterface.h" #include "msgshareuiinterface.h" +#include "msgurihandlerinterface.h" #include "msgstorehandler.h" #include "msgserviceviewmanager.h" @@ -51,6 +52,7 @@ // create interfaces mSendInterface = new MsgSendInterface(mViewManager); mViewInterface = new MsgViewInterface(mViewManager); + mUriInterface = new MsgUriHandlerInterface(mViewManager); mShareUiInterface = new MsgShareUiInterface(mViewManager); } @@ -64,6 +66,12 @@ { delete mShareUiInterface; } + + if(mUriInterface) + { + delete mUriInterface; + } + if(mViewInterface) { delete mViewInterface; diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgservices/msgserviceapp/src/msgurihandlerinterface.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgservices/msgserviceapp/src/msgurihandlerinterface.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,164 @@ +/* + * 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: + * class to manage differnt messaging views. + * + */ + +#include "msgurihandlerinterface.h" + +#include + +#include +#include +#include +#include +#include +#include + +#include "msgserviceviewmanager.h" +#include "debugtraces.h" + + +MsgUriHandlerInterface::MsgUriHandlerInterface(MsgServiceViewManager* viewManager, QObject* parent) +: +XQServiceProvider(QLatin1String("messaging.com.nokia.symbian.IUriView"), parent), +viewManager(viewManager) +{ + publishAll(); +} + +MsgUriHandlerInterface::~MsgUriHandlerInterface() +{ + +} + +bool MsgUriHandlerInterface::view(const QString& uri) +{ + QDEBUG_WRITE_FORMAT("service request for URI:", uri.toLatin1().data()); + QUrl parsedUri; + + parsedUri.setUrl(uri); + normalizeQueryItems(parsedUri); + + QDEBUG_WRITE_FORMAT("scheme: ", parsedUri.scheme().toLatin1().data()); + QDEBUG_WRITE_FORMAT("path: ", parsedUri.path().toLatin1().data()); + QDEBUG_WRITE_FORMAT("items count: ", parsedUri.queryItems().size()); + QDEBUG_WRITE_FORMAT("error: ", parsedUri.errorString()); +#ifdef _DEBUG_TRACES_ + QPair item; + foreach (item, parsedUri.queryItems()) + { + int i = 0; + QDEBUG_WRITE_FORMAT("MsgUriHandlerInterface::view(): query item # i :", i++); + QDEBUG_WRITE_FORMAT("MsgUriHandlerInterface::view(): query item # First Item :", item.first.toLatin1().data()); + QDEBUG_WRITE_FORMAT("MsgUriHandlerInterface::view(): query item # Second Item :", item.second.toLatin1().data()); + } +#endif + + ConvergedMessage message; + + if (parsedUri.scheme().compare("sms", Qt::CaseInsensitive)) + { + message.setMessageType(ConvergedMessage::Sms); + } + else if (parsedUri.scheme().compare("mmsto", Qt::CaseInsensitive)) + { + message.setMessageType(ConvergedMessage::Mms); + } + else + { + QDEBUG_WRITE_FORMAT("Unsupported scheme:", parsedUri.scheme().toLatin1().data()); + return false; + } + + QString addressLine = parsedUri.path(); + addRecipients(message, addressLine); + + QString body = parsedUri.queryItemValue("body"); + message.setBodyText(body); + + /* mms specific query values */ + + QString subject = parsedUri.queryItemValue("subject"); + message.setSubject(subject); + + QString priority = parsedUri.queryItemValue("priority"); + if (priority.compare("Low", Qt::CaseInsensitive)) + { + message.setPriority(ConvergedMessage::Low); + } + else if (priority.compare("Normal", Qt::CaseInsensitive)) + { + message.setPriority(ConvergedMessage::Normal); + } + else if (priority.compare("High", Qt::CaseInsensitive)) + { + message.setPriority(ConvergedMessage::High); + } + else + { + QDEBUG_WRITE_FORMAT("MsgUriHandlerInterface::view(): Unknown priority value: ", priority.toLatin1().data()); + return false; + } + + QStringList tos = parsedUri.allQueryItemValues("to"); + QString to; + foreach (to, tos) + { + addRecipients(message, to); + } + + QStringList ccs = parsedUri.allQueryItemValues("cc"); + QString cc; + foreach (cc, ccs) + { + addRecipients(message, cc); + } + + viewManager->send(message); + + return true; +} + +void MsgUriHandlerInterface::normalizeQueryItems(QUrl &url) +{ + QList > items = url.queryItems(); + QPair item; + int i = 0; + foreach (item, items) + { + items.replace(i++, QPair(item.first.toLower(), item.second)); + } + url.setQueryItems(items); +} + + +void MsgUriHandlerInterface::addRecipients(ConvergedMessage &message, const QString &recipientsList) +{ + QStringList addressList = recipientsList.split(","); + QString addressEntry; + + foreach (addressEntry, addressList) + { + addressEntry.trimmed(); + if (! addressEntry.isEmpty()) + { + ConvergedMessageAddress address; + address.setAddress(addressEntry); + message.addToRecipient(address); + QDEBUG_WRITE_FORMAT("MsgUriHandlerInterface::addRecipients() recipient added: ", addressEntry.toLatin1().data()); + } + } +} diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgsettings/msginit/tsrc/testmsginit/inc/testmsginit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgsettings/msginit/tsrc/testmsginit/inc/testmsginit.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef TESTMSGINIT_H_ +#define TESTMSGINIT_H_ + +#ifdef BUILD_TEST_DLL +#define TEST_EXPORT Q_DECL_EXPORT +#else +#define TEST_EXPORT +#endif + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class MsgSimNumDetector; +class CMsvOperation; +class COutboxObserver; +class CMobileSignalStrengthHandler; +class CTestMsgSimOperation; + +class TEST_EXPORT TestMsgInit: public QObject +{ + Q_OBJECT + +private slots: + + /** + * Intializes component for testing + */ + void initTestCase(); + + /** + * Initilazes the test case data to be executed + */ + void init(); + + void validateMobileSignalStrength(); + + void validateOutboxSenderOperation(); + + void validateOutboxObserver(); + + void validateSimNumDetector(); + /** + * Clean the test case data + */ + void cleanup(); + + /** + * Delete the initialized component for testing + */ + void cleanupTestCase(); + +private: + MsgSimNumDetector* iSimHandler; + CMsvOperation* iMsvOperation; + COutboxObserver* iOutBoxObserver; + CTestMsgSimOperation* iTestMsgSimOperation; + CMobileSignalStrengthHandler* iSignalStrengthHandler; + +}; +#endif /* TESTMSGINIT_H_ */ diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgsettings/msginit/tsrc/testmsginit/inc/testoutboxobserver_stub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgsettings/msginit/tsrc/testmsginit/inc/testoutboxobserver_stub.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The purpose of this class is to observe if there are messages + * in the outbox. + * + */ + +#ifndef TESTOUTBOXOBSERVER_STUB_H_ +#define TESTOUTBOXOBSERVER_STUB_H_ + +// INCLUDES +#include +#include // for MMsvSessionObserver +#include "msignalstrengthobserver.h" + +// FORWARD DECLARATIONS + +class CMsvSession; +class COutboxSender; +class MSignalStrengthHandler; + +// CLASS DECLARATION + +/** + * Observes if there are messages in the OutBox.. + */ +class CTestOutboxObserver: public MSignalStrengthObserver +{ +public: + // Constructors and destructor + + /** + * A Two-phased constructor. + */ + static CTestOutboxObserver* NewL(); + + /** + * Destructor. + */ + virtual ~CTestOutboxObserver(); + +private: + // From MSignalStrengthObserver + + void SignalStrengthAndBarUpdatedL(TInt aNewSignalValue, TInt aNewBarValue); + +public: + + void HandleMsvSessionReadyL(CMsvSession& aMsvSession); + void HandleMsvSessionClosedL(); + +public: + // New functions + + /** + * Informs the networkstatus to Outbox Sender + */ + void InformOutboxSenderL(const TInt& aNetworkBars); + +private: + + /** + * A C++ constructor. + */ + CTestOutboxObserver(); + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + /** + * Creates the Msv Session and sets the outbox + * observer and outbox sender. + * @param aMsvSession The Msv session to use. + */ + void StartSessionsL(CMsvSession& aMsvSession); + + /** + * Delete session, outbox observer and outbox sender. + */ + void EndSessions(); + +private: + // In-box folder entry. Note that the entry is not owned by this class. + CMsvEntry* iOutboxFolder; + // Pointer to Outbox Sender. + COutboxSender* iOutboxSender; + // Signal strength handler. Owned. + MSignalStrengthHandler* iSignalStrengthHandler; +}; + +#endif /* TESTOUTBOXOBSERVER_STUB_H_ */ diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgsettings/msginit/tsrc/testmsginit/inc/testoutboxsender_stub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgsettings/msginit/tsrc/testmsginit/inc/testoutboxsender_stub.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * This class follows the offline status of the phone. When the mode is + * changed from online to offline, the sending operation is started. When + * the mode is changed from online to offline, the current sending + * operation is cancelled. + * + */ + + +#ifndef TESTOUTBOXSENDER_STUB_H_ +#define TESTOUTBOXSENDER_STUB_H_ + +// INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS +class CRepository; + +// CLASS DECLARATION + +class CTestOutboxSender: public MMsvSingleOpWatcher +{ +public: + // Constructors and destructor + + /** + * A two-phased constructor. + */ + static CTestOutboxSender* NewL(CMsvSession& aMsvSession); + + /** + * A destructor. + */ + virtual ~CTestOutboxSender(); + +public: + // New functions + + /** + * Starts the message sending operation for sms-messages. + */ + void StartSendingL(); + + /** + * Cancels current message sending operation. + */ + void CancelSending(); + + /** + * Checks if the sending operation is currently active. + */ + TBool IsSending() const; + + /** + * Confirms the network status and starts sending messages + */ + void CheckAndStartSendingL(const TInt& aNetworkBars); + +public: + // Functions from base classes + + /** + * From MMsvSingleOpWatcher. Deletes the sending operation. + */ + virtual void OpCompleted(CMsvSingleOpWatcher& aOpWatcher, TInt aCompletionCode); + +private: + /** + * A C++ Constructor + */ + CTestOutboxSender(CMsvSession& aMsvSession); + + /** + * Creates the connection to shared data and + * begins listening the KGSNetworkConnectionAllowed-key. + */ + void ConstructL(); + + /** + * Checks whether SMS sending is needed in boot-phase and + * launches the sending operation + */ + void CheckBootPhaseL(); + +private: + enum TCleanupFlags + { + EUserSettingsConnected = 0x01, + EUserSettingsNotifierSet = 0x02, + EOffllineSendingNeeded = 0x10 + }; +}; + +#endif /* TESTOUTBOXSENDER_STUB_H_ */ diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgsettings/msginit/tsrc/testmsginit/inc/testsimnumdetector_stub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgsettings/msginit/tsrc/testmsginit/inc/testsimnumdetector_stub.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,80 @@ +/* + * 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: + * An active object class which takes care of reading the possible new + * service centres from SIM and adds them to Sms Settings. + * + */ + + +#ifndef TESTSIMNUMDETECTOR_STUB_H_ +#define TESTSIMNUMDETECTOR_STUB_H_ + +// INCLUDES +#include // for MsvSession + +// FORWARD DECLARATIONS +class CMsvSession; + +/** + * CTestMsgSimOperation + * Inherited from CBase, MMsvSessionObserver + */ +class CTestMsgSimOperation : public MMsvSessionObserver +{ +public: + + /** + * Constructor. + */ + IMPORT_C static CTestMsgSimOperation* NewL(); + + /** + * Destructor + */ + ~CTestMsgSimOperation(); + +public: + + + /** + * Callback function for startup state monitor object + */ + void HandleStartupReadyL(); + +private: + + /** + * C++ constructor which initializes the active object with a + * default priority and adds it to the active scheduler. + * @param TRequestStatus& aStatus, TInt aPriority + * @return nothing + */ + CTestMsgSimOperation(); + + void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, + TAny* aArg3); + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + +public: + //data + CMsvSession* iMsvSession; + +}; + +#endif /* TESTSIMNUMDETECTOR_STUB_H_ */ diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgsettings/msginit/tsrc/testmsginit/src/testmsginit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgsettings/msginit/tsrc/testmsginit/src/testmsginit.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +// INCLUDES +#include "testmsginit.h" +#include "debugtraces.h" +#include "msgsimnumberdetector.h" +#include "coutboxobserver.h" +#include "startupmonitor.h" +#include "coutboxsendoperation.h" +#include "cmobilesignalstrengthhandler.h" +#include "testoutboxobserver_stub.h" +#include "testoutboxsender_stub.h" +#include "testsimnumdetector_stub.h" + +#include +#include +#include + + +void TestMsgInit::initTestCase() + { + + } + +void TestMsgInit::init() + { + qDebug("TestMsgInit::init enter"); + + iTestMsgSimOperation = CTestMsgSimOperation::NewL(); + QVERIFY2(iTestMsgSimOperation != NULL, "CTestMsgSimOperation init failed."); + + qDebug("TestMsgInit::init exit"); + } + +void TestMsgInit::validateMobileSignalStrength() + { + qDebug("TestMsgInit::validateMobileSignalStrength enter"); + + CTestOutboxObserver* mOutBoxObserver = CTestOutboxObserver::NewL(); + QVERIFY2(mOutBoxObserver != NULL, "CTestOutboxObserver init failed."); + CleanupStack::PushL(mOutBoxObserver); + + iSignalStrengthHandler = CMobileSignalStrengthHandler::NewL(); + QVERIFY2(iSignalStrengthHandler != NULL, "CMobileSignalStrengthHandler init failed."); + + if (iSignalStrengthHandler->ObservingSupported()) + { + iSignalStrengthHandler->SetSignalStrengthObserverL(mOutBoxObserver); + iSignalStrengthHandler->StartObservingL(); + } + + CleanupStack::PopAndDestroy(mOutBoxObserver); + //QTest::qWait(1000); + if(NULL !=iSignalStrengthHandler) + { + delete iSignalStrengthHandler; + iSignalStrengthHandler = NULL; + } + qDebug("TestMsgInit::validateMobileSignalStrength exit"); + } + +void TestMsgInit::validateOutboxSenderOperation() + { + qDebug("TestMsgInit::validateOutboxSenderOperation enter"); + + CTestOutboxSender* mTestOutboxSender = CTestOutboxSender::NewL(*(iTestMsgSimOperation->iMsvSession)); + QVERIFY2(mTestOutboxSender != NULL, "CTestOutboxSender init failed."); + CleanupStack::PushL(mTestOutboxSender); + + CMsvSingleOpWatcher* msingleOpWatcher = CMsvSingleOpWatcher::NewL(*mTestOutboxSender); + QVERIFY2(msingleOpWatcher != NULL, "CMsvSingleOpWatcher init failed."); + CleanupStack::PushL(msingleOpWatcher); + + iMsvOperation = COutboxSendOperation::NewL(*(iTestMsgSimOperation->iMsvSession), msingleOpWatcher->iStatus); + QVERIFY2(iMsvOperation != NULL, "COutboxSendOperation init failed."); + + //QTest::qWait(1000); + if(NULL !=iMsvOperation) + { + delete iMsvOperation; + iMsvOperation = NULL; + } + CleanupStack::PopAndDestroy(2); //mTestOutboxSender, msingleOpWatcher + + qDebug("TestMsgInit::validateOutboxSenderOperation exit"); + } + +void TestMsgInit::validateOutboxObserver() + { + qDebug("TestMsgInit::validateOutboxObserver enter"); + + // Observes the OUTBOX for any offline messages... + iOutBoxObserver = COutboxObserver::NewL(); + QVERIFY2(iOutBoxObserver != NULL, "COutboxObserver init failed."); + + // Start the Auto-send AO, to handle offline SMS messages + iOutBoxObserver->HandleMsvSessionReadyL(*(iTestMsgSimOperation->iMsvSession)); + //QTest::qWait(1000); + + if(NULL !=iOutBoxObserver) + { + delete iOutBoxObserver; + iOutBoxObserver = NULL; + } + qDebug("TestMsgInit::validateOutboxObserver exit"); + } + + void TestMsgInit::validateSimNumDetector() + { + qDebug("TestMsgInit::validateSimNumDetector enter"); + + TInt startupState = 0; + TInt modifiedState = ESwStateNormalRfOn; + TInt status = 0; + + //Load current settings + CSmsSettings* smsSettings = CSmsSettings::NewLC(); + CSmsAccount* smsAccount = CSmsAccount::NewLC(); + smsAccount->LoadSettingsL(*smsSettings); + + // Remove all old SMSC's configured + TInt numSCAddresses = smsSettings->ServiceCenterCount(); + + qDebug() << "numSCAddresses:" << numSCAddresses; + + for (TInt j = numSCAddresses; j > 0; j--) + { + smsSettings->RemoveServiceCenter(j - 1); + } + + // Save settings + TInt maxTries(5); + TBool done(EFalse); + while (maxTries && !done) + { + TRAPD( err, smsAccount->SaveSettingsL( *smsSettings ) ); + if (err == KErrNone) + { + qDebug("CMsgSimOperation::CreateDefaultSettingsL settings saved"); + + done = ETrue; + } + else if (err == KErrLocked) + { + qDebug("CMsgSimOperation::CreateDefaultSettingsL KErrLocked"); + + // Wait a while and retry. + User::After(100000); // 0.1 seconds + maxTries--; + } + else + { + User::Leave(err); + } + } + + QVERIFY2((iSimHandler = new MsgSimNumDetector()) != NULL, "Message settings engine init failed."); + status = RProperty::Get( KPSUidStartup, KPSGlobalSystemState, startupState ); + if(ESwStateNormalRfOn != startupState) + { + RProperty::Set( KPSUidStartup, KPSGlobalSystemState, modifiedState ); + } + qDebug() << "startupState:" << startupState; + qDebug() << "modifiedState:" << modifiedState; + RProperty::Set(KPSUidStartup, KPSGlobalSystemState, startupState); + + qDebug() << "startupState:" << startupState; + qDebug() << "modifiedState:" << modifiedState; + CleanupStack::PopAndDestroy(2); // smsAccount, smsSettings + //QTest::qWait(1000); + if(NULL !=iSimHandler) + { + delete iSimHandler; + iSimHandler = NULL; + } + + qDebug("TestMsgInit::validateSimNumDetector Exit"); + } + +void TestMsgInit::cleanup() + { + if(NULL !=iTestMsgSimOperation) + { + delete iTestMsgSimOperation; + iTestMsgSimOperation = NULL; + } + } + +void TestMsgInit::cleanupTestCase() + { + + } + +//main entry point +int main(int argc, char *argv[]) + { + int ret = -1; + QCoreApplication app(argc, argv); + QObject* tc = new TestMsgInit(); + +#ifdef __WINSCW__ + char *new_argv[3]; + QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; + QByteArray bytes = str.toAscii(); + char arg1[] = "-o"; + new_argv[0] = argv[0]; + new_argv[1] = arg1; + new_argv[2] = bytes.data(); + ret = QTest::qExec(tc, 3, new_argv); +#else + ret = QTest::qExec(tc, argc, argv); +#endif + delete tc; + return ret; + } + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgsettings/msginit/tsrc/testmsginit/src/testoutboxobserver_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgsettings/msginit/tsrc/testmsginit/src/testoutboxobserver_stub.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implements the class + * + */ + +// INCLUDE FILES +#include +#include // Entry Ids +#include +#include +#include "coutboxsender.h" +#include "testoutboxobserver_stub.h" +#include "cmobilesignalstrengthhandler.h" +#include "debugtraces.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CTestOutboxObserver::CTestOutboxObserver +// --------------------------------------------------------- +// +CTestOutboxObserver::CTestOutboxObserver(){} + +// --------------------------------------------------------- +// CTestOutboxObserver::ConstructL +// --------------------------------------------------------- +// +void CTestOutboxObserver::ConstructL() +{ + QDEBUG_WRITE( "CTestOutboxObserver::ConstructL Enter" ); + // instantiate the signal strength handler + iSignalStrengthHandler = CMobileSignalStrengthHandler::NewL(); + + if (iSignalStrengthHandler->ObservingSupported()) + { + iSignalStrengthHandler->SetSignalStrengthObserverL(this); + iSignalStrengthHandler->StartObservingL(); + } + else + { + QDEBUG_WRITE( "CTestOutboxObserver::ConstructL else part" ); + } + QDEBUG_WRITE( "CTestOutboxObserver::ConstructL Exit" ); +} + +// --------------------------------------------------------- +// CTestOutboxObserver::NewL +// --------------------------------------------------------- +// +CTestOutboxObserver* CTestOutboxObserver::NewL() +{ + // Create the instance of the outbox observer + CTestOutboxObserver* self = new (ELeave) CTestOutboxObserver(); + // Push it to stack while executing the constructor + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; +} + +// --------------------------------------------------------- +// CTestOutboxObserver::~CTestOutboxObserver +// --------------------------------------------------------- +// +CTestOutboxObserver::~CTestOutboxObserver() +{ + delete iSignalStrengthHandler; + EndSessions(); +} + +// --------------------------------------------------------- +// CTestOutboxObserver::SignalStrengthUpdatedL +// --------------------------------------------------------- +// +void CTestOutboxObserver::SignalStrengthAndBarUpdatedL(TInt /*aNewSignalValue*/, TInt aNewBarValue) +{ + QDEBUG_WRITE_FORMAT( "CTestOutboxObserver::SignalStrengthUpdatedL - Signal bars ", aNewBarValue ); + // pass new bar value to outbox sender + InformOutboxSenderL(aNewBarValue); +} + +// --------------------------------------------------------- +// CTestOutboxObserver::InformOutboxSenderL +// --------------------------------------------------------- +// +void CTestOutboxObserver::InformOutboxSenderL(const TInt& aNetworkBars) +{ + QDEBUG_WRITE( "CTestOutboxObserver::InformOutboxSenderL" ); +} + +// --------------------------------------------------------- +// CTestOutboxObserver::StartSessionsL +// --------------------------------------------------------- +// +void CTestOutboxObserver::StartSessionsL(CMsvSession& aMsvSession) +{ + QDEBUG_WRITE( "CTestOutboxObserver::StartSessionsL" ); +} + +// --------------------------------------------------------- +// CTestOutboxObserver::EndSessions +// --------------------------------------------------------- +// +void CTestOutboxObserver::EndSessions() +{ + QDEBUG_WRITE( "CTestOutboxObserver::EndSessions" ); +} + +// --------------------------------------------------------- +// CTestOutboxObserver::HandleMsvSessionReadyL +// --------------------------------------------------------- +// +void CTestOutboxObserver::HandleMsvSessionReadyL(CMsvSession& aMsvSession) +{ + StartSessionsL(aMsvSession); +} +// --------------------------------------------------------- +// CTestOutboxObserver::HandleMsvSessionClosedL +// --------------------------------------------------------- +// +void CTestOutboxObserver::HandleMsvSessionClosedL() +{ + EndSessions(); +} + +// End of File + + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgsettings/msginit/tsrc/testmsginit/src/testoutboxsender_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgsettings/msginit/tsrc/testmsginit/src/testoutboxsender_stub.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -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: Implements class + * + */ + +// INCLUDE FILES + +#include +#include // Entry Uids +#include "coutboxsendoperation.h" +#include "testoutboxsender_stub.h" +#include "debugtraces.h" + +// CONSTANTS +const TInt KListBar0(0); + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------- +// CTestOutboxSender::NewL +// ---------------------------------------------------- +// +CTestOutboxSender* CTestOutboxSender::NewL(CMsvSession& aMsvSession) +{ + CTestOutboxSender* self = new (ELeave) CTestOutboxSender(aMsvSession); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; +} + +// ---------------------------------------------------- +// CTestOutboxSender::CTestOutboxSender +// ---------------------------------------------------- +// +CTestOutboxSender::CTestOutboxSender(CMsvSession& aMsvSession) +{ + QDEBUG_WRITE( "CTestOutboxObserver::CTestOutboxSender" ); +} + +// ---------------------------------------------------- +// CTestOutboxSender::~CTestOutboxSender +// ---------------------------------------------------- +// +CTestOutboxSender::~CTestOutboxSender() +{ + QDEBUG_WRITE( "CTestOutboxObserver::CTestOutboxSender" ); +} + +// ---------------------------------------------------- +// CTestOutboxSender::ConstructL +// ---------------------------------------------------- +// +void CTestOutboxSender::ConstructL() +{ + QDEBUG_WRITE( "CTestOutboxObserver::ConstructL" ); +} + +// ---------------------------------------------------- +// CTestOutboxSender::StartSendingL +// ---------------------------------------------------- +// +void CTestOutboxSender::StartSendingL() +{ + QDEBUG_WRITE( "CTestOutboxObserver::ConstructL Enter" ); +} + +// ---------------------------------------------------- +// CTestOutboxSender::CancelSending +// ---------------------------------------------------- +// +void CTestOutboxSender::CancelSending() +{ + QDEBUG_WRITE( "CTestOutboxObserver::CancelSending" ); +} + +// ---------------------------------------------------- +// CTestOutboxSender::IsSending +// ---------------------------------------------------- +// +TBool CTestOutboxSender::IsSending() const +{ + QDEBUG_WRITE( "CTestOutboxObserver::IsSending" ); +} + +// ---------------------------------------------------- +// CTestOutboxSender::OpCompleted +// ---------------------------------------------------- +// +void CTestOutboxSender::OpCompleted(CMsvSingleOpWatcher& /*aOpWatcher*/, TInt /*aCompletionCode*/) +{ + QDEBUG_WRITE( "CTestOutboxObserver::OpCompleted" ); +} + +// ---------------------------------------------------- +// CTestOutboxSender::CheckAndStartSendingL +// ---------------------------------------------------- +// +void CTestOutboxSender::CheckAndStartSendingL(const TInt& aNetworkBars) +{ + QDEBUG_WRITE( "CTestOutboxObserver::CheckAndStartSendingL" ); +} + +// ---------------------------------------------------- +// CTestOutboxSender::CheckBootPhaseL +// ---------------------------------------------------- +// +void CTestOutboxSender::CheckBootPhaseL() +{ + QDEBUG_WRITE( "CTestOutboxObserver::CheckBootPhaseL" ); +} + +// End of file + + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgsettings/msginit/tsrc/testmsginit/src/testsimnumdetector_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgsettings/msginit/tsrc/testmsginit/src/testsimnumdetector_stub.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,90 @@ +/* + * 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: + * A class which takes care of reading the possible new + * service centres from SIM and adds them to pda-side Sms Settings. + * + */ + +// INCLUDE FILES + +#include "coutboxobserver.h" +#include "testsimnumdetector_stub.h" +#include "startupmonitor.h" +#include "debugtraces.h" + + + +// ================= MEMBER FUNCTIONS ======================= + +EXPORT_C CTestMsgSimOperation* CTestMsgSimOperation::NewL() + { + QDEBUG_WRITE("CTestMsgSimOperation::NewL enter") + + CTestMsgSimOperation* self = new (ELeave) CTestMsgSimOperation(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + QDEBUG_WRITE("CTestMsgSimOperation::NewL End") + return self; + } + + +CTestMsgSimOperation::CTestMsgSimOperation() + { + } + +void CTestMsgSimOperation::ConstructL() + { + QDEBUG_WRITE("CTestMsgSimOperation::ConstructL enter") + + // initialise + iMsvSession = CMsvSession::OpenSyncL(*this); + + QDEBUG_WRITE("CTestMsgSimOperation::ConstructL exit") + } + +CTestMsgSimOperation::~CTestMsgSimOperation() + { + QDEBUG_WRITE("CTestMsgSimOperation::~CTestMsgSimOperation Enter") + if(NULL != iMsvSession) + { + delete iMsvSession; + iMsvSession = NULL; + } + + QDEBUG_WRITE("CTestMsgSimOperation::~CTestMsgSimOperation Exit") + } + +void CTestMsgSimOperation::HandleSessionEventL(TMsvSessionEvent aEvent, + TAny* /*aArg1*/, TAny* /*aArg2*/, + TAny* /*aArg3*/) + { + QDEBUG_WRITE("CTestMsgSimOperation::HandleSessionEventL Enter") + + QDEBUG_WRITE("CTestMsgSimOperation::HandleSessionEventL Exit") + } + +void CTestMsgSimOperation::HandleStartupReadyL() + { + QDEBUG_WRITE("CTestMsgSimOperation::HandleStartupReadyL Enter") + // Boot ready, start the real SimOperation + + QDEBUG_WRITE("CTestMsgSimOperation::HandleStartupReadyL Exit") + } + +// End of File + + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgsettings/settingsview/src/msgsettingsview.cpp --- a/messagingapp/msgsettings/settingsview/src/msgsettingsview.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgsettings/settingsview/src/msgsettingsview.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -66,18 +66,11 @@ MsgSettingsView::~MsgSettingsView() { - delete mSMSCenterView; } void MsgSettingsView::onNewSMSCCenterClicked(int index) { //open the sms center views - if (mSMSCenterView) - { - delete mSMSCenterView; - mSMSCenterView = NULL; - } - mSMSCenterView = new MsgSMSCenterView(index); connect(mSMSCenterView, @@ -95,11 +88,16 @@ //sms center view was directly launched, no need to go back to settings view. if(mCurrentView == SMSView) { + // mSMSCenterView will be deleted by MainWindow. this->navigationAction()->trigger(); return; } //remove the view mMainWindow->removeView(mSMSCenterView); + // Delete the view since the ownership is transferred to caller. + // @see HbMainWindow::removeView() + delete mSMSCenterView; + mSMSCenterView = NULL; // This check is needed in case when smsc center view is // launched directly diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/appengine/inc/conversationsmodel.h --- a/messagingapp/msgui/appengine/inc/conversationsmodel.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/appengine/inc/conversationsmodel.h Tue Aug 31 18:53:38 2010 +0530 @@ -180,6 +180,14 @@ */ void handleVCard(QStandardItem& item, int msgId); + /* + * Get the scaled size from the original image size + * @param originalSize, QSize + * @param scaledSize, QSize + */ + void getScaledSize(const QSize &originalSize, + QSize &scaledSize); + private: /** diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/appengine/src/conversationsmodel.cpp --- a/messagingapp/msgui/appengine/src/conversationsmodel.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/appengine/src/conversationsmodel.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -53,8 +53,8 @@ // 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; +const int KWidth = 24 * 6.7; +const int KHeight = 24 * 6.7; //--------------------------------------------------------------- // ConversationsModel::ConversationsModel // Constructor @@ -512,6 +512,12 @@ true); } + else + { + QPixmap pixmap; + setPreviewIcon(pixmap, attachmentPath, msgId, + false); + } //remove bitmap delete bitmap; } @@ -817,7 +823,12 @@ if (!inDb) { QPixmap pixmap(filePath); - QPixmap scaledPixmap = pixmap.scaled(KWidth, KHeight, Qt::IgnoreAspectRatio); + QSize originalIconSize = pixmap.size(); + QSize scaledIconSize; + getScaledSize(originalIconSize,scaledIconSize); + + QPixmap scaledPixmap = pixmap.scaled(scaledIconSize.width(), + scaledIconSize.height(), Qt::KeepAspectRatio); HbIcon *previewIcon = new HbIcon(scaledPixmap); previewIconCache.insert(msgId, previewIcon); @@ -935,7 +946,12 @@ if (!imagePreviewed) { QPixmap orgPixmap(filePath); - pixmap = orgPixmap.scaled(63.65, 63.65, Qt::IgnoreAspectRatio); + QSize originalIconSize = pixmap.size(); + QSize scaledIconSize; + getScaledSize(originalIconSize,scaledIconSize); + + QPixmap scaledPixmap = orgPixmap.scaled(scaledIconSize.width(), + scaledIconSize.height(), Qt::KeepAspectRatio); } HbIcon * previewIcon = new HbIcon(pixmap); @@ -1073,4 +1089,45 @@ { emit conversationViewEmpty(); } + +//--------------------------------------------------------------- +// ConversationsModel::getScaledSize() +// @see header +//--------------------------------------------------------------- +void ConversationsModel::getScaledSize(const QSize &originalSize, + QSize &scaledSize) +{ + qreal newLength =0; + if(originalSize.width() >= originalSize.height()) + { + if(originalSize.width() < KWidth) + { + scaledSize.setHeight(originalSize.height()); + scaledSize.setWidth(originalSize.width()); + } + else + { + scaledSize.setWidth(KWidth); + newLength = (KWidth * originalSize.height())/ + originalSize.width(); + scaledSize.setHeight(newLength); + } + } + else + { + if(originalSize.height() < KHeight) + { + scaledSize.setHeight(originalSize.height()); + scaledSize.setWidth(originalSize.width()); + } + else + { + scaledSize.setHeight(KHeight); + newLength = (KHeight * originalSize.width())/ + originalSize.height(); + scaledSize.setWidth(newLength); + } + } +} + //EOF diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/bwins/msgaudiofetcheru.def --- a/messagingapp/msgui/bwins/msgaudiofetcheru.def Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/bwins/msgaudiofetcheru.def Tue Aug 31 18:53:38 2010 +0530 @@ -1,20 +1,23 @@ 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) + ?qt_metacast@MsgAudioFetcherDialog@@UAEPAXPBD@Z @ 1 NONAME ; void * MsgAudioFetcherDialog::qt_metacast(char const *) + ?onSelectAction@MsgAudioFetcherDialog@@AAEXXZ @ 2 NONAME ; void MsgAudioFetcherDialog::onSelectAction(void) + ?onCancelAction@MsgAudioFetcherDialog@@AAEXXZ @ 3 NONAME ; void MsgAudioFetcherDialog::onCancelAction(void) + ?getCurrentItemPath@MsgAudioFetcherDialog@@AAE?AVQString@@XZ @ 4 NONAME ; class QString MsgAudioFetcherDialog::getCurrentItemPath(void) + ?trUtf8@MsgAudioFetcherDialog@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString MsgAudioFetcherDialog::trUtf8(char const *, char const *) + ?metaObject@MsgAudioFetcherDialog@@UBEPBUQMetaObject@@XZ @ 6 NONAME ; struct QMetaObject const * MsgAudioFetcherDialog::metaObject(void) const + ??0MsgAudioFetcherDialog@@QAE@PAVQGraphicsItem@@@Z @ 7 NONAME ; MsgAudioFetcherDialog::MsgAudioFetcherDialog(class QGraphicsItem *) + ?audioSelected@MsgAudioFetcherDialog@@IAEXAAVQString@@@Z @ 8 NONAME ; void MsgAudioFetcherDialog::audioSelected(class QString &) + ?reset@MsgAudioFetcherDialog@@AAEXXZ @ 9 NONAME ; void MsgAudioFetcherDialog::reset(void) + ?initActions@MsgAudioFetcherDialog@@AAEXXZ @ 10 NONAME ; void MsgAudioFetcherDialog::initActions(void) + ?on_list_activated@MsgAudioFetcherDialog@@AAEXABVQModelIndex@@@Z @ 11 NONAME ; void MsgAudioFetcherDialog::on_list_activated(class QModelIndex const &) + ?trUtf8@MsgAudioFetcherDialog@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString MsgAudioFetcherDialog::trUtf8(char const *, char const *, int) + ?staticMetaObject@MsgAudioFetcherDialog@@2UQMetaObject@@B @ 13 NONAME ; struct QMetaObject const MsgAudioFetcherDialog::staticMetaObject + ??1MsgAudioFetcherDialog@@UAE@XZ @ 14 NONAME ; MsgAudioFetcherDialog::~MsgAudioFetcherDialog(void) + ?initMainWidget@MsgAudioFetcherDialog@@AAEXXZ @ 15 NONAME ; void MsgAudioFetcherDialog::initMainWidget(void) + ?qt_metacall@MsgAudioFetcherDialog@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 16 NONAME ; int MsgAudioFetcherDialog::qt_metacall(enum QMetaObject::Call, int, void * *) + ?doDelayedConstruction@MsgAudioFetcherDialog@@AAEXXZ @ 17 NONAME ; void MsgAudioFetcherDialog::doDelayedConstruction(void) + ?tr@MsgAudioFetcherDialog@@SA?AVQString@@PBD0@Z @ 18 NONAME ; class QString MsgAudioFetcherDialog::tr(char const *, char const *) + ?getStaticMetaObject@MsgAudioFetcherDialog@@SAABUQMetaObject@@XZ @ 19 NONAME ; struct QMetaObject const & MsgAudioFetcherDialog::getStaticMetaObject(void) + ??_EMsgAudioFetcherDialog@@UAE@I@Z @ 20 NONAME ; MsgAudioFetcherDialog::~MsgAudioFetcherDialog(unsigned int) + ?tr@MsgAudioFetcherDialog@@SA?AVQString@@PBD0H@Z @ 21 NONAME ; class QString MsgAudioFetcherDialog::tr(char const *, char const *, int) diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/bwins/unifiededitoru.def --- a/messagingapp/msgui/bwins/unifiededitoru.def Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/bwins/unifiededitoru.def Tue Aug 31 18:53:38 2010 +0530 @@ -1,64 +1,68 @@ EXPORTS - ?fetchAudio@MsgUnifiedEditorView@@AAEXXZ @ 1 NONAME ; void MsgUnifiedEditorView::fetchAudio(void) - ??0CUniImageProcessor@@QAE@PAVMUniImageProcessorCallback@@@Z @ 2 NONAME ; CUniImageProcessor::CUniImageProcessor(class MUniImageProcessorCallback *) - ?changePriority@MsgUnifiedEditorView@@AAEXXZ @ 3 NONAME ; void MsgUnifiedEditorView::changePriority(void) - ?updateOtherRecipientCount@MsgUnifiedEditorView@@AAEX_N@Z @ 4 NONAME ; void MsgUnifiedEditorView::updateOtherRecipientCount(bool) - ?qt_metacall@MsgUnifiedEditorView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 5 NONAME ; int MsgUnifiedEditorView::qt_metacall(enum QMetaObject::Call, int, void * *) - ?fetchImages@MsgUnifiedEditorView@@AAEXXZ @ 6 NONAME ; void MsgUnifiedEditorView::fetchImages(void) - ?packMessage@MsgUnifiedEditorView@@AAEXAAVConvergedMessage@@_N@Z @ 7 NONAME ; void MsgUnifiedEditorView::packMessage(class ConvergedMessage &, bool) - ?handleViewExtnActivated@MsgUnifiedEditorView@@AAEXPAVHbListWidgetItem@@@Z @ 8 NONAME ; void MsgUnifiedEditorView::handleViewExtnActivated(class HbListWidgetItem *) - ?addAttachment@MsgUnifiedEditorView@@AAEHABVQString@@@Z @ 9 NONAME ; int MsgUnifiedEditorView::addAttachment(class QString const &) - ?doDelayedConstruction@MsgUnifiedEditorView@@AAEXXZ @ 10 NONAME ; void MsgUnifiedEditorView::doDelayedConstruction(void) - ?fetchMessageFromStore@MsgUnifiedEditorView@@AAEXAAVConvergedMessageId@@W4MessageType@ConvergedMessage@@H@Z @ 11 NONAME ; void MsgUnifiedEditorView::fetchMessageFromStore(class ConvergedMessageId &, enum ConvergedMessage::MessageType, int) - ?onContentChanged@MsgUnifiedEditorView@@AAEXXZ @ 12 NONAME ; void MsgUnifiedEditorView::onContentChanged(void) - ?staticMetaObject@MsgUnifiedEditorView@@2UQMetaObject@@B @ 13 NONAME ; struct QMetaObject const MsgUnifiedEditorView::staticMetaObject - ?activateInputBlocker@MsgUnifiedEditorView@@AAEXXZ @ 14 NONAME ; void MsgUnifiedEditorView::activateInputBlocker(void) - ?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) + ?fetchImages@MsgUnifiedEditorView@@AAEXXZ @ 1 NONAME ; void MsgUnifiedEditorView::fetchImages(void) + ?handleViewExtnActivated@MsgUnifiedEditorView@@AAEXPAVHbListWidgetItem@@@Z @ 2 NONAME ; void MsgUnifiedEditorView::handleViewExtnActivated(class HbListWidgetItem *) + ?fetchMessageFromStore@MsgUnifiedEditorView@@AAEXAAVConvergedMessageId@@W4MessageType@ConvergedMessage@@H@Z @ 3 NONAME ; void MsgUnifiedEditorView::fetchMessageFromStore(class ConvergedMessageId &, enum ConvergedMessage::MessageType, int) + ?onContentChanged@MsgUnifiedEditorView@@AAEXXZ @ 4 NONAME ; void MsgUnifiedEditorView::onContentChanged(void) + ?staticMetaObject@MsgUnifiedEditorView@@2UQMetaObject@@B @ 5 NONAME ; struct QMetaObject const MsgUnifiedEditorView::staticMetaObject + ?resizeEvent@MsgUnifiedEditorView@@MAEXPAVQGraphicsSceneResizeEvent@@@Z @ 6 NONAME ; void MsgUnifiedEditorView::resizeEvent(class QGraphicsSceneResizeEvent *) + ?ScaleImageL@CUniImageProcessor@@QAEXPAVCFbsBitmap@@0H@Z @ 7 NONAME ; void CUniImageProcessor::ScaleImageL(class CFbsBitmap *, class CFbsBitmap *, int) + ?vkbAboutToClose@MsgUnifiedEditorView@@AAEXXZ @ 8 NONAME ; void MsgUnifiedEditorView::vkbAboutToClose(void) + ?onDialogSmsSettings@MsgUnifiedEditorView@@AAEXPAVHbAction@@@Z @ 9 NONAME ; void MsgUnifiedEditorView::onDialogSmsSettings(class HbAction *) + ?addCcBcc@MsgUnifiedEditorView@@AAEXXZ @ 10 NONAME ; void MsgUnifiedEditorView::addCcBcc(void) + ?saveContentToDrafts@MsgUnifiedEditorView@@QAEHXZ @ 11 NONAME ; int MsgUnifiedEditorView::saveContentToDrafts(void) + ?generateFileName@MsgUnifiedEditorView@@AAE?AVQString@@AAV2@@Z @ 12 NONAME ; class QString MsgUnifiedEditorView::generateFileName(class QString &) + ?createVCards@MsgUnifiedEditorView@@AAEHABVQVariant@@AAVQStringList@@@Z @ 13 NONAME ; int MsgUnifiedEditorView::createVCards(class QVariant const &, class QStringList &) + ?addSubject@MsgUnifiedEditorView@@AAEXXZ @ 14 NONAME ; void MsgUnifiedEditorView::addSubject(void) + ?createTempFolder@MsgUnifiedEditorView@@AAE_NXZ @ 15 NONAME ; bool MsgUnifiedEditorView::createTempFolder(void) + ?imagesFetched@MsgUnifiedEditorView@@AAEXABVQVariant@@@Z @ 16 NONAME ; void MsgUnifiedEditorView::imagesFetched(class QVariant const &) + ?setFocus@MsgUnifiedEditorView@@AAEXPAVMsgUnifiedEditorBaseWidget@@@Z @ 17 NONAME ; void MsgUnifiedEditorView::setFocus(class MsgUnifiedEditorBaseWidget *) + ?serviceRequestError@MsgUnifiedEditorView@@AAEXHABVQString@@@Z @ 18 NONAME ; void MsgUnifiedEditorView::serviceRequestError(int, class QString const &) + ?isReplyPathBroken@MsgUnifiedEditorView@@AAE_NXZ @ 19 NONAME ; bool MsgUnifiedEditorView::isReplyPathBroken(void) + ?removeTempFolder@MsgUnifiedEditorView@@AAEXXZ @ 20 NONAME ; void MsgUnifiedEditorView::removeTempFolder(void) + ?vkbOpened@MsgUnifiedEditorView@@AAEXXZ @ 21 NONAME ; void MsgUnifiedEditorView::vkbOpened(void) + ?addMenu@MsgUnifiedEditorView@@AAEXXZ @ 22 NONAME ; void MsgUnifiedEditorView::addMenu(void) + ??_EMsgUnifiedEditorView@@UAE@I@Z @ 23 NONAME ; MsgUnifiedEditorView::~MsgUnifiedEditorView(unsigned int) + ?setAttachOptionEnabled@MsgUnifiedEditorView@@AAEXW4TBE_AttachOption@1@_N@Z @ 24 NONAME ; void MsgUnifiedEditorView::setAttachOptionEnabled(enum MsgUnifiedEditorView::TBE_AttachOption, bool) + ?ScaleImageL@CUniImageProcessor@@QAEXPAVCFbsBitmap@@AAVRFile@@ABVTSize@@ABVTDesC8@@H@Z @ 25 NONAME ; void CUniImageProcessor::ScaleImageL(class CFbsBitmap *, class RFile &, class TSize const &, class TDesC8 const &, int) + ?send@MsgUnifiedEditorView@@AAEXXZ @ 26 NONAME ; void MsgUnifiedEditorView::send(void) + ?populateContentIntoEditor@MsgUnifiedEditorView@@AAEXABVConvergedMessage@@_N@Z @ 27 NONAME ; void MsgUnifiedEditorView::populateContentIntoEditor(class ConvergedMessage const &, bool) + ?addToolBar@MsgUnifiedEditorView@@AAEXXZ @ 28 NONAME ; void MsgUnifiedEditorView::addToolBar(void) + ?onDialogDeleteMsg@MsgUnifiedEditorView@@AAEXPAVHbAction@@@Z @ 29 NONAME ; void MsgUnifiedEditorView::onDialogDeleteMsg(class HbAction *) + ?onAudioSelected@MsgUnifiedEditorView@@AAEXAAVQString@@@Z @ 30 NONAME ; void MsgUnifiedEditorView::onAudioSelected(class QString &) + ?fetchContacts@MsgUnifiedEditorView@@AAEXXZ @ 31 NONAME ; void MsgUnifiedEditorView::fetchContacts(void) + ?formatAddresses@MsgUnifiedEditorView@@AAEXAAV?$QList@PAVConvergedMessageAddress@@@@@Z @ 32 NONAME ; void MsgUnifiedEditorView::formatAddresses(class QList &) + ?addAttachments@MsgUnifiedEditorView@@AAEXVQStringList@@@Z @ 33 NONAME ; void MsgUnifiedEditorView::addAttachments(class QStringList) + ??0CUniImageProcessor@@QAE@PAVMUniImageProcessorCallback@@@Z @ 34 NONAME ; CUniImageProcessor::CUniImageProcessor(class MUniImageProcessorCallback *) + ?fetchAudio@MsgUnifiedEditorView@@AAEXXZ @ 35 NONAME ; void MsgUnifiedEditorView::fetchAudio(void) + ?changePriority@MsgUnifiedEditorView@@AAEXXZ @ 36 NONAME ; void MsgUnifiedEditorView::changePriority(void) + ?qt_metacall@MsgUnifiedEditorView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 37 NONAME ; int MsgUnifiedEditorView::qt_metacall(enum QMetaObject::Call, int, void * *) + ?updateOtherRecipientCount@MsgUnifiedEditorView@@AAEX_N@Z @ 38 NONAME ; void MsgUnifiedEditorView::updateOtherRecipientCount(bool) + ?addAttachment@MsgUnifiedEditorView@@AAEHABVQString@@@Z @ 39 NONAME ; int MsgUnifiedEditorView::addAttachment(class QString const &) + ?vkbAboutToOpen@MsgUnifiedEditorView@@AAEXXZ @ 40 NONAME ; void MsgUnifiedEditorView::vkbAboutToOpen(void) + ?doDelayedConstruction@MsgUnifiedEditorView@@AAEXXZ @ 41 NONAME ; void MsgUnifiedEditorView::doDelayedConstruction(void) + ?activateInputBlocker@MsgUnifiedEditorView@@AAEXXZ @ 42 NONAME ; void MsgUnifiedEditorView::activateInputBlocker(void) + ?onDialogMmsSettings@MsgUnifiedEditorView@@AAEXPAVHbAction@@@Z @ 43 NONAME ; void MsgUnifiedEditorView::onDialogMmsSettings(class HbAction *) + ?populateContent@MsgUnifiedEditorView@@QAEXABV?$QList@VQVariant@@@@@Z @ 44 NONAME ; void MsgUnifiedEditorView::populateContent(class QList const &) + ?ProcessImageL@CUniImageProcessor@@QAEXAAVRFile@@0AAVTSize@@ABVTDesC8@@HH@Z @ 45 NONAME ; void CUniImageProcessor::ProcessImageL(class RFile &, class RFile &, class TSize &, class TDesC8 const &, int, int) + ?metaObject@MsgUnifiedEditorView@@UBEPBUQMetaObject@@XZ @ 46 NONAME ; struct QMetaObject const * MsgUnifiedEditorView::metaObject(void) const + ?vkbClosed@MsgUnifiedEditorView@@AAEXXZ @ 47 NONAME ; void MsgUnifiedEditorView::vkbClosed(void) + ?qt_metacast@MsgUnifiedEditorView@@UAEPAXPBD@Z @ 48 NONAME ; void * MsgUnifiedEditorView::qt_metacast(char const *) + ?enableSendButton@MsgUnifiedEditorView@@AAEX_N@Z @ 49 NONAME ; void MsgUnifiedEditorView::enableSendButton(bool) + ?ScaleImageL@CUniImageProcessor@@QAEXAAVRFile@@AAPAVCFbsBitmap@@1AAVTSize@@H@Z @ 50 NONAME ; void CUniImageProcessor::ScaleImageL(class RFile &, class CFbsBitmap * &, class CFbsBitmap * &, class TSize &, int) + ?initView@MsgUnifiedEditorView@@AAEXXZ @ 51 NONAME ; void MsgUnifiedEditorView::initView(void) + ?packMessage@MsgUnifiedEditorView@@AAEHAAVConvergedMessage@@_N@Z @ 52 NONAME ; int MsgUnifiedEditorView::packMessage(class ConvergedMessage &, bool) + ??1MsgUnifiedEditorView@@UAE@XZ @ 53 NONAME ; MsgUnifiedEditorView::~MsgUnifiedEditorView(void) + ?hideChrome@MsgUnifiedEditorView@@AAEX_N@Z @ 54 NONAME ; void MsgUnifiedEditorView::hideChrome(bool) + ?getStaticMetaObject@MsgUnifiedEditorView@@SAABUQMetaObject@@XZ @ 55 NONAME ; struct QMetaObject const & MsgUnifiedEditorView::getStaticMetaObject(void) + ?tr@MsgUnifiedEditorView@@SA?AVQString@@PBD0@Z @ 56 NONAME ; class QString MsgUnifiedEditorView::tr(char const *, char const *) + ?trUtf8@MsgUnifiedEditorView@@SA?AVQString@@PBD0@Z @ 57 NONAME ; class QString MsgUnifiedEditorView::trUtf8(char const *, char const *) + ?tr@MsgUnifiedEditorView@@SA?AVQString@@PBD0H@Z @ 58 NONAME ; class QString MsgUnifiedEditorView::tr(char const *, char const *, int) + ?Reset@CUniImageProcessor@@QAEXXZ @ 59 NONAME ; void CUniImageProcessor::Reset(void) + ?openDraftsMessage@MsgUnifiedEditorView@@QAEXABV?$QList@VQVariant@@@@@Z @ 60 NONAME ; void MsgUnifiedEditorView::openDraftsMessage(class QList const &) + ?contactsFetched@MsgUnifiedEditorView@@AAEXABVQVariant@@@Z @ 61 NONAME ; void MsgUnifiedEditorView::contactsFetched(class QVariant const &) + ?removeAttachmentContainer@MsgUnifiedEditorView@@AAEXXZ @ 62 NONAME ; void MsgUnifiedEditorView::removeAttachmentContainer(void) + ??0MsgUnifiedEditorView@@QAE@PAVQGraphicsItem@@@Z @ 63 NONAME ; MsgUnifiedEditorView::MsgUnifiedEditorView(class QGraphicsItem *) + ?trUtf8@MsgUnifiedEditorView@@SA?AVQString@@PBD0H@Z @ 64 NONAME ; class QString MsgUnifiedEditorView::trUtf8(char const *, char const *, int) + ?deleteMessage@MsgUnifiedEditorView@@AAEXXZ @ 65 NONAME ; void MsgUnifiedEditorView::deleteMessage(void) + ?deactivateInputBlocker@MsgUnifiedEditorView@@AAEXXZ @ 66 NONAME ; void MsgUnifiedEditorView::deactivateInputBlocker(void) diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/conversationview.pro --- a/messagingapp/msgui/conversationview/conversationview.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/conversationview/conversationview.pro Tue Aug 31 18:53:38 2010 +0530 @@ -24,7 +24,6 @@ INCLUDEPATH += . INCLUDEPATH += ../../../inc -INCLUDEPATH += ../msgaudiofetcher/inc INCLUDEPATH += ../msguiutils/inc INCLUDEPATH += ../../msgutils/unieditorutils/editorgenutils/inc INCLUDEPATH += ../appengine/inc diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h --- a/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h Tue Aug 31 18:53:38 2010 +0530 @@ -211,6 +211,13 @@ * Own. */ ThumbnailManager *mThumbnailManager; + +#ifdef MSGUI_UNIT_TEST + /** + * Unit Testing + */ + friend class TestMsgContactCardWidget; +#endif }; #endif // MSGCONTACTCARDWIDGET_H diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/inc/msgconversationbaseview.h --- a/messagingapp/msgui/conversationview/inc/msgconversationbaseview.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/conversationview/inc/msgconversationbaseview.h Tue Aug 31 18:53:38 2010 +0530 @@ -18,10 +18,14 @@ #ifndef MSG_CONVERSATION_VIEW_INTERFACE_H #define MSG_CONVERSATION_VIEW_INTERFACE_H -#ifdef CONVERSATIONVIEW_DLL -#define CONVERSATION_VIEW_EXPORT Q_DECL_EXPORT +#ifdef MSGUI_UNIT_TEST + #define CONVERSATION_VIEW_EXPORT #else -#define CONVERSATION_VIEW_EXPORT Q_DECL_IMPORT + #ifdef CONVERSATIONVIEW_DLL + #define CONVERSATION_VIEW_EXPORT Q_DECL_EXPORT + #else + #define CONVERSATION_VIEW_EXPORT Q_DECL_IMPORT + #endif #endif #include diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/inc/msgconversationview.h --- a/messagingapp/msgui/conversationview/inc/msgconversationview.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/conversationview/inc/msgconversationview.h Tue Aug 31 18:53:38 2010 +0530 @@ -33,6 +33,8 @@ class HbStaticVkbHost; class QGraphicsLinearLayout; class HbAction; +class MsgAudioFetcherDialog; + //Defines #define INVALID_MSG_ID -1 @@ -337,6 +339,12 @@ */ bool isSharedMessage(qint32 messageId); + /** + * This slot is called after sound clip is + * selected from audio fetcher dialog + */ + void onAudioSelected(QString& filePath); + signals: /** * Signal emitted to inform close the conversation view. @@ -449,6 +457,12 @@ HbStaticVkbHost* mVkbHost; /** + * Instance of Audio Fetcher Dialog + * Need to show when attachment audio selected + */ + MsgAudioFetcherDialog* mDialog; + + /** * variable holding the visible model index */ QModelIndex mVisibleIndex; @@ -463,6 +477,13 @@ * Flag is set when */ bool mViewReady; + +#ifdef MSGUI_UNIT_TEST + /** + * Unit Testing + */ + friend class TestMsgConversationView; +#endif }; #endif // MSG_CONVERSATION_VIEW_H diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/inc/msgconversationviewitem.h --- a/messagingapp/msgui/conversationview/inc/msgconversationviewitem.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/conversationview/inc/msgconversationviewitem.h Tue Aug 31 18:53:38 2010 +0530 @@ -108,6 +108,13 @@ */ void init(); + /** + * Finds the message timestamp to be set. + * @parma index Model index of the item. + * @return Timestamp string to be set. + */ + QString getMsgTimeStamp(const QModelIndex& index); + private slots: /* diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/inc/msgconversationwidget.h --- a/messagingapp/msgui/conversationview/inc/msgconversationwidget.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/conversationview/inc/msgconversationwidget.h Tue Aug 31 18:53:38 2010 +0530 @@ -459,6 +459,13 @@ * Owned */ HbIconItem *mPreviewIconItem; + +#ifdef MSGUI_UNIT_TEST + /** + * Unit Testing + */ + friend class TestMsgConversationWidget; +#endif }; #endif // MSG_CONVERSATIONWIDGET_H diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/inc/msgeditorwidget.h --- a/messagingapp/msgui/conversationview/inc/msgeditorwidget.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/conversationview/inc/msgeditorwidget.h Tue Aug 31 18:53:38 2010 +0530 @@ -234,6 +234,13 @@ * Indication for sms char limt reached */ bool mSmsCharLimitReached; + +#ifdef MSGUI_UNIT_TEST + /** + * Unit Testing + */ + friend class TestMsgEditorWidget; +#endif }; #endif // MSGEDITORWIDGET_H diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/inc/msgviewutils.h --- a/messagingapp/msgui/conversationview/inc/msgviewutils.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/conversationview/inc/msgviewutils.h Tue Aug 31 18:53:38 2010 +0530 @@ -60,6 +60,13 @@ private: // Data +#ifdef MSGUI_UNIT_TEST + /** + * Unit Testing + */ + friend class TestMsgViewUtils; +#endif + }; #endif // MSGVIEWUTILS_H diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.widgetml --- a/messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.widgetml Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.widgetml Tue Aug 31 18:53:38 2010 +0530 @@ -83,7 +83,7 @@ - + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp --- a/messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -439,8 +439,16 @@ QList matchingContacts = MsgContactHandler::findContactList(mContactNumber); if (!matchingContacts.isEmpty()) { - setAddress(matchingContacts.at(0).displayLabel()); - + QString displayLabel = matchingContacts.at(0).displayLabel(); + if(!displayLabel.isEmpty()) + { + setAddress(displayLabel); + } + else + { + setAddress(mContactNumber); + } + QList avatarDetails = matchingContacts.at(0).details (); if (!avatarDetails.isEmpty()) { diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/src/msgconversationview.cpp --- a/messagingapp/msgui/conversationview/src/msgconversationview.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/conversationview/src/msgconversationview.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -18,6 +18,7 @@ #include "msgconversationview.h" // SYSTEM INCLUDES +#include #include #include #include @@ -31,6 +32,7 @@ #include #include +#include #include #include #include @@ -57,9 +59,9 @@ #include "ringbc.h" #include "mmsconformancecheck.h" #include "msgsettingsview.h" -#include "msgaudiofetcherview.h" #include "unieditorpluginloader.h" #include "unieditorplugininterface.h" +#include "msgaudiofetcherdialog.h" //Item specific menu. @@ -106,6 +108,7 @@ mContactCardWidget(contactCardWidget), mSendUtil(NULL), mVkbHost(NULL), + mDialog(NULL), mVisibleIndex(), mModelPopulated(false), mViewReady(false) @@ -133,7 +136,8 @@ //--------------------------------------------------------------- MsgConversationView::~MsgConversationView() { - + //delete the popup dialog + delete mDialog; } //--------------------------------------------------------------- // MsgConversationView::setupView @@ -485,6 +489,15 @@ } } deactivateInputBlocker(); + + // make sure virtual keyboard is closed + QInputContext *ic = qApp->inputContext(); + if (ic) { + QEvent *closeEvent = new QEvent(QEvent::CloseSoftwareInputPanel); + ic->filterEvent(closeEvent); + delete closeEvent; + } + if( sendResult == KErrNotFound) { HbMessageBox::question(LOC_DIALOG_SMS_SETTINGS_INCOMPLETE, this, @@ -595,25 +608,18 @@ //--------------------------------------------------------------- void MsgConversationView::fetchAudio() { - // Launch Audio fetcher view - QVariantList params; - QByteArray dataArray; - QDataStream messageStream - (&dataArray, QIODevice::WriteOnly | QIODevice::Append); + // Launch Audio fetcher dialog + if (!mDialog) + { + mDialog = new MsgAudioFetcherDialog(); + bool b = connect(mDialog, + SIGNAL(audioSelected(QString&)), + this, + SLOT(onAudioSelected(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); - - params << MsgBaseView::AUDIOFETCHER; // target view - params << MsgBaseView::CV; // source view - params << dataArray; - emit switchView(params); + //show the dialog + mDialog->show(); } //--------------------------------------------------------------- @@ -841,7 +847,7 @@ args << QVariant(messageId); request->setSynchronous(true); - + request->setEmbedded(true); request->setArguments(args); request->send(); delete request; @@ -1488,4 +1494,34 @@ return shared; } +void MsgConversationView::onAudioSelected(QString& filePath) +{ + QVariantList params; + QByteArray dataArray; + QDataStream messageStream + (&dataArray, QIODevice::WriteOnly | QIODevice::Append); + + 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); + + //add the attachment as selected from audio picker + ConvergedMessageAttachment* attachment = + new ConvergedMessageAttachment(filePath); + ConvergedMessageAttachmentList attachmentList; + attachmentList.append(attachment); + message.addAttachments(attachmentList); + message.serialize(messageStream); + + params << MsgBaseView::UNIEDITOR; // target view + params << MsgBaseView::CV; // source view + params << dataArray; + params << MsgBaseView::ADD_AUDIO; + emit switchView(params); +} + // EOF diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp --- a/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -20,9 +20,7 @@ // SYSTEM INCLUDES #include #include "debugtraces.h" -#include #include -#include #include #include #include @@ -173,21 +171,7 @@ mConversation->drawBubbleFrame(); mConversation->drawNewItemFrame(); - QDateTime dateTime; - dateTime.setTime_t(index.data(TimeStamp).toUInt()); - QString resendStateNote((index.data(SendingState).toInt() - == ConvergedMessage::Resend) ? LOC_RESEND_AT : ""); - - HbExtendedLocale locale = HbExtendedLocale::system(); - QString date = locale.format(dateTime.date(), DATE_FORMAT); - QString time = locale.format(dateTime.time(), TIME_FORMAT); - - if (dateTime.date() == QDateTime::currentDateTime().date()) { - mConversation->setTimeStamp(resendStateNote % time); - } - else { - mConversation->setTimeStamp(resendStateNote % date); - } + mConversation->setTimeStamp(getMsgTimeStamp(index)); if (messageSubType == ConvergedMessage::VCal) { @@ -258,21 +242,7 @@ mConversation->drawBubbleFrame(); mConversation->drawNewItemFrame(); - QDateTime dateTime; - dateTime.setTime_t(index.data(TimeStamp).toUInt()); - QString resendStateNote((index.data(SendingState).toInt() - == ConvergedMessage::Resend) ? LOC_RESEND_AT : ""); - - HbExtendedLocale locale = HbExtendedLocale::system(); - QString date = locale.format(dateTime.date(), DATE_FORMAT); - QString time = locale.format(dateTime.time(), TIME_FORMAT); - - if (dateTime.date() == QDateTime::currentDateTime().date()) { - mConversation->setTimeStamp(resendStateNote % time); - } - else { - mConversation->setTimeStamp(resendStateNote % date); - } + mConversation->setTimeStamp(getMsgTimeStamp(index)); if (messageType == ConvergedMessage::Mms) { @@ -570,6 +540,35 @@ } //--------------------------------------------------------------- +// MsgConversationViewItem::getMsgTimeStamp +// @see header file +//--------------------------------------------------------------- +QString MsgConversationViewItem::getMsgTimeStamp(const QModelIndex& index) +{ + QDateTime dateTime; + dateTime.setTime_t(index.data(TimeStamp).toUInt()); + + HbExtendedLocale locale = HbExtendedLocale::system(); + + QString timeStampStr; + if (dateTime.date() == QDateTime::currentDateTime().date()) { + timeStampStr = locale.format(dateTime.time(), TIME_FORMAT); + } + else { + timeStampStr = locale.format(dateTime.date(), DATE_FORMAT); + } + + QString msgTimeStamp; + if (ConvergedMessage::Resend == index.data(SendingState).toInt()) { + msgTimeStamp = LOC_RESEND_AT.arg(timeStampStr); + } + else { + msgTimeStamp = timeStampStr; + } + return msgTimeStamp; +} + +//--------------------------------------------------------------- // MsgConversationViewItem::orientationchanged // @see header file //--------------------------------------------------------------- diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/src/msgeditorwidget.cpp --- a/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -382,19 +382,12 @@ // @see header //--------------------------------------------------------------- void MsgEditor::focusInEvent(QFocusEvent *event) - { - if(event->reason() == Qt::MouseFocusReason) - { - HbLineEdit::focusInEvent(event); - FOCUSITEM->setFocusProxy(this); - setCursorVisibility(Hb::TextCursorVisible); - emit replyStarted(); - } - else - { - setCursorVisibility(Hb::TextCursorHidden); - } - } + { + HbLineEdit::focusInEvent(event); + FOCUSITEM->setFocusProxy(this); + setCursorVisibility(Hb::TextCursorVisible); + emit replyStarted(); + } //--------------------------------------------------------------- // MsgEditor::focusOutEvent diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/hbwidget.h --- a/messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/hbwidget.h Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef 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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/msgconversationwidgetheaders.h --- a/messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/msgconversationwidgetheaders.h Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,282 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef 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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/unittest_msgconversationwidget.cpp --- a/messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/unittest_msgconversationwidget.cpp Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include - -#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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/unittest_msgconversationwidget.pro --- a/messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/unittest_msgconversationwidget.pro Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -# -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -# - -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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/conversationview/tsrc/unittests/unittests.pro --- a/messagingapp/msgui/conversationview/tsrc/unittests/unittests.pro Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -# -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -# - -CONFIG += symbian_test -SUBDIRS += unittest_nmexampleadapterclass \ - unittest_nmexamplesymbianclass \ - unittest_nmexampleview -TEMPLATE = subdirs diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/eabi/msgaudiofetcheru.def --- a/messagingapp/msgui/eabi/msgaudiofetcheru.def Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/eabi/msgaudiofetcheru.def Tue Aug 31 18:53:38 2010 +0530 @@ -1,24 +1,27 @@ 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 + _ZN21MsgAudioFetcherDialog11initActionsEv @ 1 NONAME + _ZN21MsgAudioFetcherDialog11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME + _ZN21MsgAudioFetcherDialog11qt_metacastEPKc @ 3 NONAME + _ZN21MsgAudioFetcherDialog13audioSelectedER7QString @ 4 NONAME + _ZN21MsgAudioFetcherDialog14initMainWidgetEv @ 5 NONAME + _ZN21MsgAudioFetcherDialog14onCancelActionEv @ 6 NONAME + _ZN21MsgAudioFetcherDialog14onSelectActionEv @ 7 NONAME + _ZN21MsgAudioFetcherDialog16staticMetaObjectE @ 8 NONAME DATA 16 + _ZN21MsgAudioFetcherDialog17on_list_activatedERK11QModelIndex @ 9 NONAME + _ZN21MsgAudioFetcherDialog18getCurrentItemPathEv @ 10 NONAME + _ZN21MsgAudioFetcherDialog19getStaticMetaObjectEv @ 11 NONAME + _ZN21MsgAudioFetcherDialog21doDelayedConstructionEv @ 12 NONAME + _ZN21MsgAudioFetcherDialog5resetEv @ 13 NONAME + _ZN21MsgAudioFetcherDialogC1EP13QGraphicsItem @ 14 NONAME + _ZN21MsgAudioFetcherDialogC2EP13QGraphicsItem @ 15 NONAME + _ZN21MsgAudioFetcherDialogD0Ev @ 16 NONAME + _ZN21MsgAudioFetcherDialogD1Ev @ 17 NONAME + _ZN21MsgAudioFetcherDialogD2Ev @ 18 NONAME + _ZNK21MsgAudioFetcherDialog10metaObjectEv @ 19 NONAME + _ZTI21MsgAudioFetcherDialog @ 20 NONAME + _ZTV21MsgAudioFetcherDialog @ 21 NONAME + _ZThn16_N21MsgAudioFetcherDialogD0Ev @ 22 NONAME + _ZThn16_N21MsgAudioFetcherDialogD1Ev @ 23 NONAME + _ZThn8_N21MsgAudioFetcherDialogD0Ev @ 24 NONAME + _ZThn8_N21MsgAudioFetcherDialogD1Ev @ 25 NONAME diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/eabi/unifiededitoru.def --- a/messagingapp/msgui/eabi/unifiededitoru.def Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/eabi/unifiededitoru.def Tue Aug 31 18:53:38 2010 +0530 @@ -22,48 +22,52 @@ _ZN20MsgUnifiedEditorView13imagesFetchedERK8QVariant @ 21 NONAME _ZN20MsgUnifiedEditorView14addAttachmentsE11QStringList @ 22 NONAME _ZN20MsgUnifiedEditorView14changePriorityEv @ 23 NONAME - _ZN20MsgUnifiedEditorView15contactsFetchedERK8QVariant @ 24 NONAME - _ZN20MsgUnifiedEditorView15formatAddressesER5QListIP23ConvergedMessageAddressE @ 25 NONAME - _ZN20MsgUnifiedEditorView15populateContentERK5QListI8QVariantE @ 26 NONAME - _ZN20MsgUnifiedEditorView16createTempFolderEv @ 27 NONAME - _ZN20MsgUnifiedEditorView16enableSendButtonEb @ 28 NONAME - _ZN20MsgUnifiedEditorView16generateFileNameER7QString @ 29 NONAME - _ZN20MsgUnifiedEditorView16onContentChangedEv @ 30 NONAME - _ZN20MsgUnifiedEditorView16removeTempFolderEv @ 31 NONAME - _ZN20MsgUnifiedEditorView16staticMetaObjectE @ 32 NONAME DATA 16 - _ZN20MsgUnifiedEditorView17onDialogDeleteMsgEP8HbAction @ 33 NONAME - _ZN20MsgUnifiedEditorView17openDraftsMessageERK5QListI8QVariantE @ 34 NONAME - _ZN20MsgUnifiedEditorView19getStaticMetaObjectEv @ 35 NONAME - _ZN20MsgUnifiedEditorView19onDialogMmsSettingsEP8HbAction @ 36 NONAME - _ZN20MsgUnifiedEditorView19onDialogSmsSettingsEP8HbAction @ 37 NONAME - _ZN20MsgUnifiedEditorView19saveContentToDraftsEv @ 38 NONAME - _ZN20MsgUnifiedEditorView19serviceRequestErrorEiRK7QString @ 39 NONAME - _ZN20MsgUnifiedEditorView20activateInputBlockerEv @ 40 NONAME - _ZN20MsgUnifiedEditorView21doDelayedConstructionEv @ 41 NONAME - _ZN20MsgUnifiedEditorView21fetchMessageFromStoreER18ConvergedMessageIdN16ConvergedMessage11MessageTypeEi @ 42 NONAME - _ZN20MsgUnifiedEditorView22deactivateInputBlockerEv @ 43 NONAME - _ZN20MsgUnifiedEditorView22setAttachOptionEnabledENS_16TBE_AttachOptionEb @ 44 NONAME - _ZN20MsgUnifiedEditorView23handleViewExtnActivatedEP16HbListWidgetItem @ 45 NONAME - _ZN20MsgUnifiedEditorView25populateContentIntoEditorERK16ConvergedMessageb @ 46 NONAME - _ZN20MsgUnifiedEditorView25removeAttachmentContainerEv @ 47 NONAME - _ZN20MsgUnifiedEditorView25updateOtherRecipientCountEb @ 48 NONAME - _ZN20MsgUnifiedEditorView4sendEv @ 49 NONAME - _ZN20MsgUnifiedEditorView7addMenuEv @ 50 NONAME - _ZN20MsgUnifiedEditorView8addCcBccEv @ 51 NONAME - _ZN20MsgUnifiedEditorView8initViewEv @ 52 NONAME - _ZN20MsgUnifiedEditorView8setFocusEP26MsgUnifiedEditorBaseWidget @ 53 NONAME - _ZN20MsgUnifiedEditorView9vkbClosedEv @ 54 NONAME - _ZN20MsgUnifiedEditorView9vkbOpenedEv @ 55 NONAME - _ZN20MsgUnifiedEditorViewC1EP13QGraphicsItem @ 56 NONAME - _ZN20MsgUnifiedEditorViewC2EP13QGraphicsItem @ 57 NONAME - _ZN20MsgUnifiedEditorViewD0Ev @ 58 NONAME - _ZN20MsgUnifiedEditorViewD1Ev @ 59 NONAME - _ZN20MsgUnifiedEditorViewD2Ev @ 60 NONAME - _ZNK20MsgUnifiedEditorView10metaObjectEv @ 61 NONAME - _ZTI20MsgUnifiedEditorView @ 62 NONAME - _ZTV20MsgUnifiedEditorView @ 63 NONAME - _ZThn16_N20MsgUnifiedEditorViewD0Ev @ 64 NONAME - _ZThn16_N20MsgUnifiedEditorViewD1Ev @ 65 NONAME - _ZThn8_N20MsgUnifiedEditorViewD0Ev @ 66 NONAME - _ZThn8_N20MsgUnifiedEditorViewD1Ev @ 67 NONAME + _ZN20MsgUnifiedEditorView14vkbAboutToOpenEv @ 24 NONAME + _ZN20MsgUnifiedEditorView15contactsFetchedERK8QVariant @ 25 NONAME + _ZN20MsgUnifiedEditorView15formatAddressesER5QListIP23ConvergedMessageAddressE @ 26 NONAME + _ZN20MsgUnifiedEditorView15onAudioSelectedER7QString @ 27 NONAME + _ZN20MsgUnifiedEditorView15populateContentERK5QListI8QVariantE @ 28 NONAME + _ZN20MsgUnifiedEditorView15vkbAboutToCloseEv @ 29 NONAME + _ZN20MsgUnifiedEditorView16createTempFolderEv @ 30 NONAME + _ZN20MsgUnifiedEditorView16enableSendButtonEb @ 31 NONAME + _ZN20MsgUnifiedEditorView16generateFileNameER7QString @ 32 NONAME + _ZN20MsgUnifiedEditorView16onContentChangedEv @ 33 NONAME + _ZN20MsgUnifiedEditorView16removeTempFolderEv @ 34 NONAME + _ZN20MsgUnifiedEditorView16staticMetaObjectE @ 35 NONAME DATA 16 + _ZN20MsgUnifiedEditorView17isReplyPathBrokenEv @ 36 NONAME + _ZN20MsgUnifiedEditorView17onDialogDeleteMsgEP8HbAction @ 37 NONAME + _ZN20MsgUnifiedEditorView17openDraftsMessageERK5QListI8QVariantE @ 38 NONAME + _ZN20MsgUnifiedEditorView19getStaticMetaObjectEv @ 39 NONAME + _ZN20MsgUnifiedEditorView19onDialogMmsSettingsEP8HbAction @ 40 NONAME + _ZN20MsgUnifiedEditorView19onDialogSmsSettingsEP8HbAction @ 41 NONAME + _ZN20MsgUnifiedEditorView19saveContentToDraftsEv @ 42 NONAME + _ZN20MsgUnifiedEditorView19serviceRequestErrorEiRK7QString @ 43 NONAME + _ZN20MsgUnifiedEditorView20activateInputBlockerEv @ 44 NONAME + _ZN20MsgUnifiedEditorView21doDelayedConstructionEv @ 45 NONAME + _ZN20MsgUnifiedEditorView21fetchMessageFromStoreER18ConvergedMessageIdN16ConvergedMessage11MessageTypeEi @ 46 NONAME + _ZN20MsgUnifiedEditorView22deactivateInputBlockerEv @ 47 NONAME + _ZN20MsgUnifiedEditorView22setAttachOptionEnabledENS_16TBE_AttachOptionEb @ 48 NONAME + _ZN20MsgUnifiedEditorView23handleViewExtnActivatedEP16HbListWidgetItem @ 49 NONAME + _ZN20MsgUnifiedEditorView25populateContentIntoEditorERK16ConvergedMessageb @ 50 NONAME + _ZN20MsgUnifiedEditorView25removeAttachmentContainerEv @ 51 NONAME + _ZN20MsgUnifiedEditorView25updateOtherRecipientCountEb @ 52 NONAME + _ZN20MsgUnifiedEditorView4sendEv @ 53 NONAME + _ZN20MsgUnifiedEditorView7addMenuEv @ 54 NONAME + _ZN20MsgUnifiedEditorView8addCcBccEv @ 55 NONAME + _ZN20MsgUnifiedEditorView8initViewEv @ 56 NONAME + _ZN20MsgUnifiedEditorView8setFocusEP26MsgUnifiedEditorBaseWidget @ 57 NONAME + _ZN20MsgUnifiedEditorView9vkbClosedEv @ 58 NONAME + _ZN20MsgUnifiedEditorView9vkbOpenedEv @ 59 NONAME + _ZN20MsgUnifiedEditorViewC1EP13QGraphicsItem @ 60 NONAME + _ZN20MsgUnifiedEditorViewC2EP13QGraphicsItem @ 61 NONAME + _ZN20MsgUnifiedEditorViewD0Ev @ 62 NONAME + _ZN20MsgUnifiedEditorViewD1Ev @ 63 NONAME + _ZN20MsgUnifiedEditorViewD2Ev @ 64 NONAME + _ZNK20MsgUnifiedEditorView10metaObjectEv @ 65 NONAME + _ZTI20MsgUnifiedEditorView @ 66 NONAME + _ZTV20MsgUnifiedEditorView @ 67 NONAME + _ZThn16_N20MsgUnifiedEditorViewD0Ev @ 68 NONAME + _ZThn16_N20MsgUnifiedEditorViewD1Ev @ 69 NONAME + _ZThn8_N20MsgUnifiedEditorViewD0Ev @ 70 NONAME + _ZThn8_N20MsgUnifiedEditorViewD1Ev @ 71 NONAME diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/inc/msgaudiofetcherdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/inc/msgaudiofetcherdialog.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,143 @@ +/* + * 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 MSGAUDIOFETCHERDIALOG_H +#define MSGAUDIOFETCHERDIALOG_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 +#include + +// FORWARD DECLARATIONS +//class MsgAudioFetcherWidget; +class HbAction; +class HbListView; +class MsgAudioFetcherModel; +class MsgAudioPreview; + +/** + * @class MsgAudioFetcherView + * @brief This class is messaging's audio fetcher view + */ +class MSGAUDIOFETCHER_DLL_EXPORT MsgAudioFetcherDialog : public HbDialog +{ +Q_OBJECT + +public: + /** + * Constructor + */ + explicit MsgAudioFetcherDialog(QGraphicsItem *parent = 0); + + /** + * Destructor + */ + ~MsgAudioFetcherDialog(); + +private: + /** + * Creates a widget and sets it to the view + */ + void initMainWidget(); + + /** + * Initializes dialog actions + */ + void initActions(); + + /** + * Returns the selected audio path + */ + QString getCurrentItemPath(); + +signals: + + /** + * Emits when audio selected from dialog + */ + void audioSelected(QString& filePath); + +private slots: + + /** + * On View Ready signal do some construction + */ + void doDelayedConstruction(); + + /** + * Handles toolbar's leftaction (select) + */ + void onSelectAction(); + + /** + * Handles toolbar's rightaction (cancel) + */ + void onCancelAction(); + + /** + * On close of dialog this resets the item + */ + void reset(); + + /** + * This gets called after list item gets + * activated + */ + void on_list_activated(const QModelIndex &index); + +private: + + /** + * List for displaying the audio list + */ + HbListView* mListView; + + /** + * Model for the List View + */ + MsgAudioFetcherModel* mFetcherModel; + + /** + * Audio preview instance + */ + MsgAudioPreview* mAudioPreview; + + /** + * Toolbar's left SELECT action + */ + HbAction *mLeftAction; + + /** + * last selected item + */ + QModelIndex mSeletedItem; + + /** + * This to enable the left action in dialog + */ + bool mSelected; +}; + +#endif /* MSGAUDIOFETCHERVIEW_H */ diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/inc/msgbaseview.h --- a/messagingapp/msgui/inc/msgbaseview.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/inc/msgbaseview.h Tue Aug 31 18:53:38 2010 +0530 @@ -45,8 +45,7 @@ UNIEDITOR, UNIVIEWER, MSGSETTINGS, - SERVICE, - AUDIOFETCHER + SERVICE }; /** diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msgapp/inc/msglistviewitem.h --- a/messagingapp/msgui/msgapp/inc/msglistviewitem.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/msgapp/inc/msglistviewitem.h Tue Aug 31 18:53:38 2010 +0530 @@ -149,6 +149,14 @@ * To display the presence indication */ HbIconItem* mMsgCommonIndicatorItem; + + /** + * Unit Testing + */ + #ifdef MSGUI_UNIT_TEST + friend class TestMsgListViewItem; + + #endif }; diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msgapp/inc/msgviewmanager.h --- a/messagingapp/msgui/msgapp/inc/msgviewmanager.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/msgapp/inc/msgviewmanager.h Tue Aug 31 18:53:38 2010 +0530 @@ -33,7 +33,6 @@ class MsgSettingsView; class HbAction; class HbView; -class MsgAudioFetcherView; class MsgViewManager: public QObject { @@ -178,11 +177,6 @@ void populateUniEditorAfterViewReady(const QVariantList& editorData); /** - * Launch Audio fetcher view - */ - void switchToAudioFetcher(const QVariantList& data); - - /** * opens unieditor as activity. * @param activityMsgId activity msg id. */ @@ -247,7 +241,7 @@ UnifiedViewer* mUniViewer; DraftsListView* mDraftsListView; MsgSettingsView* mSettingsView; - MsgAudioFetcherView* mAudioFetcherView; + HbAction* mBackAction; int mPreviousView; diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msgapp/msgapp.pro --- a/messagingapp/msgui/msgapp/msgapp.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/msgapp/msgapp.pro Tue Aug 31 18:53:38 2010 +0530 @@ -21,7 +21,6 @@ INCLUDEPATH += . INCLUDEPATH += ../inc INCLUDEPATH += ../../../inc -INCLUDEPATH += ../msgaudiofetcher/inc INCLUDEPATH += ../unifiededitor/inc INCLUDEPATH += ../appengine/inc INCLUDEPATH += ../conversationview/inc @@ -102,6 +101,5 @@ -lQtContacts \ -lsettingsview \ -lringbc \ - -lunidatamodelloader \ - -lmsgaudiofetcher + -lunidatamodelloader diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msgapp/rom/msgapp.iby --- a/messagingapp/msgui/msgapp/rom/msgapp.iby Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/msgapp/rom/msgapp.iby Tue Aug 31 18:53:38 2010 +0530 @@ -23,11 +23,9 @@ 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 - +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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msgapp/src/msglistview.cpp --- a/messagingapp/msgui/msgapp/src/msglistview.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/msgapp/src/msglistview.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -55,6 +55,7 @@ //Localized constants #define LOC_DIALOG_DELETE_CONVERSATION hbTrId("txt_messaging_dialog_delete_conversation") +#define LOC_DIALOG_UNABLE_TO_DELETE_CONVERSATION hbTrId("txt_messaging_dialog_unable_to_delete_conversation") //itemspecific menu #define LOC_OPEN hbTrId("txt_common_menu_open") @@ -225,10 +226,28 @@ #ifdef _DEBUG_TRACES_ qDebug() << "Inside MsgListView::deleteItem"; #endif - //confirmation dialog. - HbMessageBox::question(LOC_DIALOG_DELETE_CONVERSATION, - this,SLOT(onDialogDeleteMsg(HbAction*)), - HbMessageBox::Delete | HbMessageBox::Cancel); + QModelIndex index = mMsgList->currentIndex(); + if (index.isValid()) + { + int sendState = index.data(SendingState).toInt(); + if(ConvergedMessage::Sending == sendState) + { + //confirmation dialog. + HbMessageBox::information(LOC_DIALOG_UNABLE_TO_DELETE_CONVERSATION, + 0,0, + HbMessageBox::Ok); + } + // not in sending state and hence can be deleted. + else + { + //confirmation dialog. + HbMessageBox::question(LOC_DIALOG_DELETE_CONVERSATION, + this,SLOT(onDialogDeleteMsg(HbAction*)), + HbMessageBox::Delete | HbMessageBox::Cancel); + } + + } + #ifdef _DEBUG_TRACES_ qDebug() << " Leaving MsgConversationView::deleteItem"; #endif diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msgapp/src/msglistviewitem.cpp --- a/messagingapp/msgui/msgapp/src/msglistviewitem.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/msgapp/src/msglistviewitem.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -244,7 +244,7 @@ switch (sendState) { case ConvergedMessage::Resend: { - previewText = LOC_MSG_RESEND_AT + dateTimeString; + previewText = LOC_MSG_RESEND_AT.arg(dateTimeString); dateTimeString = QString(); setCommonIndicator(MSG_OUTGOING_ICON); break; diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msgapp/src/msgviewmanager.cpp --- a/messagingapp/msgui/msgapp/src/msgviewmanager.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/msgapp/src/msgviewmanager.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -41,7 +41,6 @@ #include "unidatamodelplugininterface.h" #include "msgcontacthandler.h" #include "debugtraces.h" -#include "msgaudiofetcherview.h" // LOCALIZATION #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") @@ -51,7 +50,7 @@ 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), mAudioFetcherView(0), mBackAction(0), + mUniViewer(0), mDraftsListView(0), mSettingsView(0), mBackAction(0), mServiceRequest(serviceRequest), mConversationId(-1), mViewServiceRequest(false),mMessageId(-1) { //creating back action. @@ -240,20 +239,7 @@ param << MsgBaseView::MSGSETTINGS; 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; @@ -308,11 +294,6 @@ switchToMsgSettings(data); break; } - case MsgBaseView::AUDIOFETCHER: - { - switchToAudioFetcher(data); - break; - } } QCRITICAL_WRITE("MsgViewManager::switchView end."); } @@ -575,13 +556,6 @@ HbApplication::quit(); } - // delete Audio Fetcher view - if(mAudioFetcherView) - { - appendViewToBeDeleted(mAudioFetcherView); - mAudioFetcherView = NULL; - } - //delete UniEditor if (mUniEditor) { @@ -694,24 +668,14 @@ * Editor is tried to open again before exiting the previously * opened editor. Multi taping in DLV or Forward. */ - if (mUniEditor && !mAudioFetcherView) + if (mUniEditor) { return; } mCurrentView = MsgBaseView::UNIEDITOR; - if(MsgBaseView::AUDIOFETCHER != data.at(1).toInt()) - { - mPreviousView = data.at(1).toInt(); - } - - // delete Audio Fetcher view - if(mAudioFetcherView) - { - appendViewToBeDeleted(mAudioFetcherView); - mAudioFetcherView = NULL; - } - + mPreviousView = data.at(1).toInt(); + // delete UniViewer if (mUniViewer ) { @@ -1118,42 +1082,6 @@ } // ---------------------------------------------------------------------------- -// 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,true,Hb::ViewSwitchSequential); - } - -// ---------------------------------------------------------------------------- // MsgViewManager::saveContentToDraft // @see header // ---------------------------------------------------------------------------- diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetcherview.h --- a/messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetcherview.h Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * 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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetcherwidget.h --- a/messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetcherwidget.h Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * 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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msgaudiofetcher/msgaudiofetcher.pro --- a/messagingapp/msgui/msgaudiofetcher/msgaudiofetcher.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/msgaudiofetcher/msgaudiofetcher.pro Tue Aug 31 18:53:38 2010 +0530 @@ -43,15 +43,12 @@ # Input HEADERS += msgaudioselectionengine.h \ msgaudiofetchermodel.h \ - msgaudiofetcherwidget.h \ - msgaudiofetcherview.h \ - msgaudiopreview.h \ - ../inc/msgbaseview.h + ../inc/msgaudiofetcherdialog.h \ + msgaudiopreview.h SOURCES += msgaudioselectionengine.cpp \ msgaudiofetchermodel.cpp \ - msgaudiofetcherwidget.cpp \ - msgaudiofetcherview.cpp \ + msgaudiofetcherdialog.cpp \ msgaudiopreview.cpp defBlock = \ @@ -64,8 +61,7 @@ MMP_RULES += defBlock # Libs -LIBS += -lconvergedmessageutils \ - -lxqutils \ +LIBS += -lxqutils \ -lmdeclient \ -lcentralrepository \ -lProfileEng \ diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherdialog.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,203 @@ +/* + * 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 dialog. + * + */ + +// SYSTEM INCLUDES +#include +#include +#include +#include +#include +#include +#include + +// USER INCLUDES +#include "msgaudiofetcherdialog.h" +#include "msgaudiofetchermodel.h" +#include "msgaudiopreview.h" + +#define LOC_SELECT_SELECT hbTrId("txt_common_button_select") +#define LOC_SELECT_CANCEL hbTrId("txt_common_button_cancel") +#define LOC_SELECT_SOUND hbTrId("txt_messaging_title_select_a_sound") + +const QString LIST_ITEM_TITLE("qtc_list_item_title_normal"); + +MsgAudioFetcherDialog::MsgAudioFetcherDialog(QGraphicsItem *parent) : + HbDialog(parent), + mListView(NULL), + mFetcherModel(NULL), + mAudioPreview(NULL), + mSelected(false) +{ + setDismissPolicy(HbDialog::NoDismiss); + setFrameType(HbDialog::Strong); + setModal(true); + + initActions(); + initMainWidget(); + + connect( + this, + SIGNAL(aboutToClose()), + this, + SLOT(reset())); + + //TODO: Goal was to put in viewReady, but connect is + //not working since it only works for views not dialogs + doDelayedConstruction(); +} + +MsgAudioFetcherDialog::~MsgAudioFetcherDialog() +{ + //do nothing +} + +void MsgAudioFetcherDialog::initMainWidget() +{ + //set heading + HbTextItem* heading = new HbTextItem( + LOC_SELECT_SOUND, + this); + QColor color = HbColorScheme::color( LIST_ITEM_TITLE ); + heading->setTextColor( color ); + heading->setAlignment(Qt::AlignLeft); + setHeadingWidget(heading); +} + +void MsgAudioFetcherDialog::initActions() +{ + mLeftAction = new HbAction(this); + mLeftAction->setText(LOC_SELECT_SELECT); + addAction(mLeftAction); + mLeftAction->setEnabled(false); + + HbAction* rightAction = new HbAction(this); + rightAction->setText(LOC_SELECT_CANCEL); + rightAction->setEnabled(true); + addAction(rightAction); + + connect(mLeftAction, + SIGNAL(triggered()), + this, + SLOT(onSelectAction())); + + connect(rightAction, + SIGNAL(triggered()), + this, + SLOT(onCancelAction())); +} + +QString MsgAudioFetcherDialog::getCurrentItemPath() +{ + if (mSeletedItem.isValid()) + { + QString temppath = + mFetcherModel->data( + mSeletedItem, + Qt::UserRole).toString(); + //return the path + return QDir::toNativeSeparators(temppath); + } + return QString(); +} + +void MsgAudioFetcherDialog::doDelayedConstruction() +{ + //set the content list + mListView = new HbListView(this); + Q_ASSERT(mListView); + mListView->setSelectionMode( + HbAbstractItemView::SingleSelection); + mFetcherModel = new MsgAudioFetcherModel(this); + mListView->setModel(mFetcherModel); + mListView->setUniformItemSizes(true); + setContentWidget(mListView); + connect(mListView, SIGNAL(activated(QModelIndex)), + this, SLOT(on_list_activated(QModelIndex))); + + //initializes the audio preview + mAudioPreview = new MsgAudioPreview(this); +} + +void MsgAudioFetcherDialog::onSelectAction() +{ + //stop the playing file + if (mAudioPreview->IsPlaying()) { + mAudioPreview->Stop(); + } + + //emit the selected sound file + QString filePath = getCurrentItemPath(); + emit audioSelected(filePath); + + //close the dialog + close(); +} + +void MsgAudioFetcherDialog::onCancelAction() +{ + //stop the playing file and return + if (mAudioPreview->IsPlaying()) { + mAudioPreview->Stop(); + } + close(); + return; +} + +void MsgAudioFetcherDialog::reset() +{ + mSelected = false; + mLeftAction->setEnabled(false); + + //list scroll to top + mListView->scrollTo( + mListView->model( + )->index(0,0)); + + //deselect the selected item + mListView->selectionModel( + )->select( + mSeletedItem, + QItemSelectionModel::Deselect); +} + +void MsgAudioFetcherDialog::on_list_activated( + const QModelIndex &index) +{ + //stop previewing when clicking another item. + if (mAudioPreview->IsPlaying()) { + mAudioPreview->SetAttr(getCurrentItemPath()); + mAudioPreview->Play(); + } + + //enable the action select + if(!mSelected) + { + mLeftAction->setEnabled(true); + mSelected = true; + } + + //save the latest selected + mSeletedItem = index; + + //start play the item + mAudioPreview->SetAttr(getCurrentItemPath()); + mAudioPreview->Play(); + + return; +} +//End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherview.cpp --- a/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherview.cpp Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * The source file for messaging's audio fetcher view. - * - */ - -// SYSTEM INCLUDES -#include -#include - -// USER INCLUDES -#include "msgaudiofetcherview.h" -#include "msgaudiofetcherwidget.h" -#include "convergedmessage.h" - -#define LOC_SELECT_SOUND hbTrId("txt_messaging_title_select_a_sound") - -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(LOC_SELECT_SOUND); - 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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherwidget.cpp --- a/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherwidget.cpp Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +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: - * 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(NULL), - 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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/inc/mmsreadfile.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/inc/mmsreadfile.h Tue Aug 31 18:53:38 2010 +0530 @@ -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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/inc/mmstestbed.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/inc/mmstestbed.h Tue Aug 31 18:53:38 2010 +0530 @@ -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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/inc/mmstestbed.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/inc/mmstestbed.hrh Tue Aug 31 18:53:38 2010 +0530 @@ -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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/inc/mmsteststaticutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/inc/mmsteststaticutils.h Tue Aug 31 18:53:38 2010 +0530 @@ -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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/inc/mmstestuitimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/inc/mmstestuitimer.h Tue Aug 31 18:53:38 2010 +0530 @@ -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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/src/mmsreadfile.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/src/mmsreadfile.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/src/mmstestbed.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/src/mmstestbed.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/src/mmsteststaticutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/src/mmsteststaticutils.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/src/mmstestuitimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msguiutils/tsrc/unittest_msguiutils/mmstestbed/src/mmstestuitimer.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -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 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/inc/msgunieditoraddress.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditoraddress.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditoraddress.h Tue Aug 31 18:53:38 2010 +0530 @@ -62,7 +62,7 @@ * setter method to set address * @param addrlist, list of addresses to be set in address editor */ - void setAddresses(ConvergedMessageAddressList addrlist); + void setAddresses(ConvergedMessageAddressList addrlist,bool aSkipCheck=FALSE); /** * Get amount of digits to be used in contact matching diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/inc/msgunieditorattachment.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditorattachment.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorattachment.h Tue Aug 31 18:53:38 2010 +0530 @@ -112,11 +112,6 @@ * slot to open attachment */ 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 diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/inc/msgunieditorattachmentcontainer.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditorattachmentcontainer.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorattachmentcontainer.h Tue Aug 31 18:53:38 2010 +0530 @@ -91,7 +91,7 @@ */ void emptyAttachmentContainer(); -private slots: +public slots: /** * delete attachment from the container */ diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h Tue Aug 31 18:53:38 2010 +0530 @@ -116,6 +116,12 @@ return mIsImageResizing; } + /** + * remove media content.called when file is not avaialable + * @param fileName file name + */ + void removeMediaContent(QString fileName); + public slots: /** * Called to insert image content in editor. diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/inc/msgunieditorlineedit.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditorlineedit.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorlineedit.h Tue Aug 31 18:53:38 2010 +0530 @@ -98,6 +98,10 @@ int mSelectionStart; int mSelectionEnd; bool mDefaultBehaviour; + +#ifdef MSGUI_UNIT_TEST + friend class TestMsgUnifiedEditorLineEdit; +#endif }; #endif // MSG_UNIFIED_EDITOR_LINEEDIT_H diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/inc/msgunieditorpixmapwidget.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditorpixmapwidget.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorpixmapwidget.h Tue Aug 31 18:53:38 2010 +0530 @@ -89,11 +89,6 @@ 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. */ diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/inc/msgunieditorsubject.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditorsubject.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorsubject.h Tue Aug 31 18:53:38 2010 +0530 @@ -118,6 +118,10 @@ * Holds the previous buffer inside subject field */ QString mPrevBuffer; + +#ifdef MSGUI_UNIT_TEST + friend class TestMsgUnifiesEditorSubject; +#endif }; #endif //MSG_UNIFIED_EDITOR_SUBJECT_H diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/inc/msgunieditorview.h --- a/messagingapp/msgui/unifiededitor/inc/msgunieditorview.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorview.h Tue Aug 31 18:53:38 2010 +0530 @@ -18,10 +18,14 @@ #ifndef MSG_UNIFIED_EDITOR_VIEW_H #define MSG_UNIFIED_EDITOR_VIEW_H -#ifdef UNIFIEDEDITOR_DLL -#define UNIFIEDEDITOR_EXPORT Q_DECL_EXPORT +#ifdef MSGUI_UNIT_TEST + #define UNIFIEDEDITOR_EXPORT #else -#define UNIFIEDEDITOR_EXPORT Q_DECL_IMPORT + #ifdef UNIFIEDEDITOR_DLL + #define UNIFIEDEDITOR_EXPORT Q_DECL_EXPORT + #else + #define UNIFIEDEDITOR_EXPORT Q_DECL_IMPORT + #endif #endif #include "msgbaseview.h" @@ -42,6 +46,7 @@ class HbAbstractVkbHost; class MsgUnifiedEditorBaseWidget; class HbListWidget; +class MsgAudioFetcherDialog; class UNIFIEDEDITOR_EXPORT MsgUnifiedEditorView : public MsgBaseView { @@ -100,8 +105,9 @@ * @param [OUT]msg, converged message to hold editor data * @param isSave, flag to indicate that msg needs to be packed * for saving to draft or not + * @return returns error if something fails */ - void packMessage(ConvergedMessage &msg, bool isSave=false); + int packMessage(ConvergedMessage &msg, bool isSave=false); /** * Populate editor with prepopulated msg content @@ -337,8 +343,21 @@ * This slot is triggered when vkb is about to be closed. */ void vkbAboutToClose(); + + /** + * This slot is called after sound clip is + * selected from audio fetcher dialog + */ + void onAudioSelected(QString& filePath); + + /** + * Check if the reply-path is broken + * @return bool, true if reply-path constraints are broken + */ + bool isReplyPathBroken(); private: + HbAction* mSubjectAction; HbAction* mCcBccAction; HbAction* mSendAction; @@ -369,6 +388,29 @@ */ HbAbstractVkbHost* mVkbHost; + /** + * Instance of Audio Fetcher Dialog + * Need to show when attachment audio selected + */ + MsgAudioFetcherDialog* mDialog; + + /** + * Originating SC, + * to be used only when reply-path is available + */ + QString mOriginatingSC; + + /** + * Originating SME, + * to be used only when reply-path is available + */ + QString mOriginatingSME; + + /** + * Flag to tell if reply-path is available + */ + bool mReplyPath; + friend class MsgUnifiedEditorMonitor; }; diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp --- a/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -205,7 +205,7 @@ return mAddressEdit->addresses().count(); } -void MsgUnifiedEditorAddress::setAddresses(ConvergedMessageAddressList addrlist) +void MsgUnifiedEditorAddress::setAddresses(ConvergedMessageAddressList addrlist,bool aSkipCheck) { // avoid processing if no info available if(addrlist.count() == 0) @@ -243,7 +243,15 @@ for(int i = 0; i < count; i++ ) { bool isValid = false; - isValid = checkValidAddress(addrlist.at(i)->address()); + if(!aSkipCheck) + { + isValid = checkValidAddress(addrlist.at(i)->address()); + } + else + { + // no need to validate, assume correct + isValid = true; + } if(!isValid) { invalidCount ++; @@ -253,7 +261,10 @@ { invalidContacts.append(COMMA_SEPERATOR); } - invalidContacts.append(addrlist.at(i)->alias()); + if(addrlist[i]->alias().isEmpty()) + invalidContacts.append(addrlist.at(i)->address()); + else + invalidContacts.append(addrlist.at(i)->alias()); } else { @@ -271,12 +282,10 @@ if(invalidCount) { 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, 0, 0, HbMessageBox::Ok); - } + (invalidCount == 1)?(invalidStr = QString(LOC_INVALID_RECIPIENT_NOT_ADDED.arg(invalidContacts))) :(invalidStr = QString(LOC_INVALID_RECIPIENTS_NOT_ADDED.arg(invalidContacts))); + HbMessageBox::information(invalidStr, 0, 0, HbMessageBox::Ok); + } + // addition operation complete, reset flags mAboutToExceedMaxSmsRecipients = false; diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/src/msgunieditorattachment.cpp --- a/messagingapp/msgui/unifiededitor/src/msgunieditorattachment.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorattachment.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -46,7 +46,6 @@ //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") const QString LIST_ITEM_BG_FRAME_NORMAL ("qtg_fr_list_normal"); const QString LIST_ITEM_BG_FRAME_PRESSED("qtg_fr_list_pressed"); @@ -141,9 +140,10 @@ void MsgUnifiedEditorAttachment::handleLongTap(QPointF position) { HbMenu* menu = new HbMenu; + 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); menu->setPreferredPos(position); @@ -171,11 +171,6 @@ QTimer::singleShot(300,this,SLOT(regrabGesture())); } -void MsgUnifiedEditorAttachment::viewDetails() -{ - //open details view. -} - bool MsgUnifiedEditorAttachment::isMultimediaContent() { bool ret = true; diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp --- a/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -776,4 +776,40 @@ { mTextEdit->setFocus(Qt::MouseFocusReason); } + +//--------------------------------------------------------------- +// MsgUnifiedEditorBody :: removeMediaContent +// @see header file +//--------------------------------------------------------------- +void MsgUnifiedEditorBody::removeMediaContent(QString fileName) +{ + if(!(mImageFile.compare(fileName))) //remove image + { + mImageFile.clear(); + if(mPixmapItem) + { + mPixmapItem->setParent(NULL); + delete mPixmapItem; + mPixmapItem = NULL; + } + setImage(false); + mImageSize = 0; + } + else if(!(mAudioFile.compare(fileName)))//remove audio item + { + mAudioFile.clear(); + if(mAudioItem) + { + mAudioItem->setParent(NULL); + delete mAudioItem; + mAudioItem = NULL; + } + setAudio(false); + mAudioSize = 0; + } + + this->repolish(); + + emit contentChanged(); +} // EOF diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/src/msgunieditorpixmapwidget.cpp --- a/messagingapp/msgui/unifiededitor/src/msgunieditorpixmapwidget.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorpixmapwidget.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -31,7 +31,6 @@ // 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"); @@ -135,15 +134,6 @@ emit remove(); } -//--------------------------------------------------------------- -// MsgUnifiedEditorPixmapWidget::handleSave -// @see header file -//--------------------------------------------------------------- -void MsgUnifiedEditorPixmapWidget::viewDetails() -{ - -} - //---------------------------------------------------------------------------- // MsgUnifiedEditorPixmapWidget::handleShortTap // @see header file @@ -170,7 +160,6 @@ 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(); diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp --- a/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -66,6 +66,8 @@ #include "unieditorpluginloader.h" #include "unieditorplugininterface.h" #include "msgsettingsview.h" +#include "msgcontacthandler.h" +#include "msgaudiofetcherdialog.h" QTM_USE_NAMESPACE // Constants @@ -122,6 +124,8 @@ //settings confirmation #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") +#define LOC_NOTE_FILES_MISSED_DRAFTS hbTrId("txt_messaging_dpopinfo_some_files_in_the_message") +#define LOC_NOTE_FILES_MISSED_SEND hbTrId("txt_messaging_dialog_unable_to_send_message_some") // LOCAL FUNCTIONS //--------------------------------------------------------------- @@ -158,7 +162,11 @@ mAttachmentContainer(0), mPluginLoader(0), mCanSaveToDrafts(true), - mVkbHost(NULL) + mVkbHost(NULL), + mDialog(NULL), + mOriginatingSC(0), + mOriginatingSME(0), + mReplyPath(false) { connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction())); @@ -174,6 +182,9 @@ { // clean editor's temporary contents before exiting removeTempFolder(); + + //delete the popup dialog + delete mDialog; } //--------------------------------------------------------------- @@ -295,6 +306,12 @@ if( msg != NULL ) { + mReplyPath = msg->replyPath(); + if(mReplyPath) + { + mOriginatingSC = msg->originatingSC(); + mOriginatingSME = msg->toAddressList().at(0)->address(); + } //Populate the content inside editor populateContentIntoEditor(*msg,true); // true as it is draft message delete msg; @@ -330,6 +347,15 @@ (UniEditorPluginInterface::EditorOperation)editorOperation); if( msg != NULL ) { + if(editorOperation == UniEditorPluginInterface::Reply) + { + mReplyPath = msg->replyPath(); + if(mReplyPath) + { + mOriginatingSC = msg->originatingSC(); + mOriginatingSME = msg->toAddressList().at(0)->address(); + } + } //Populate the content inside editor populateContentIntoEditor(*msg); delete msg; @@ -474,14 +500,14 @@ mMsgMonitor->setSkipNote(true); mToField->skipMaxRecipientQuery(true); - mToField->setAddresses(messageDetails.toAddressList()); + mToField->setAddresses(messageDetails.toAddressList(),draftMessage); if(messageDetails.ccAddressList().count() > 0 ) { if(!mCcField) { addCcBcc(); } - mCcField->setAddresses(messageDetails.ccAddressList()); + mCcField->setAddresses(messageDetails.ccAddressList(),draftMessage); } if(messageDetails.bccAddressList().count() > 0 ) { @@ -489,7 +515,7 @@ { addCcBcc(); } - mBccField->setAddresses(messageDetails.bccAddressList()); + mBccField->setAddresses(messageDetails.bccAddressList(),draftMessage); } if(messageDetails.subject().size() > 0) { @@ -860,8 +886,13 @@ //close vkb before switching view. mVkbHost->closeKeypad(true); - packMessage(msg); - + int result = packMessage(msg); + if(result == KErrNotFound) + { + HbMessageBox::information(LOC_NOTE_FILES_MISSED_SEND, 0, 0, HbMessageBox::Ok); + deactivateInputBlocker(); + return; + } // send message MsgSendUtil *sendUtil = new MsgSendUtil(this); int sendResult = sendUtil->send(msg); @@ -952,8 +983,20 @@ } } -void MsgUnifiedEditorView::packMessage(ConvergedMessage &msg, bool isSave) +int MsgUnifiedEditorView::packMessage(ConvergedMessage &msg, bool isSave) { + // reset reply-path if originating SME constraint is broken + if(mReplyPath && isReplyPathBroken()) + { + mReplyPath = false; + } + + msg.setReplyPath(mReplyPath); + if(mReplyPath) + { + msg.setOriginatingSC(mOriginatingSC); + } + ConvergedMessage::MessageType messageType = MsgUnifiedEditorMonitor::messageType(); msg.setMessageType(messageType); // If isSave is true (save to draft usecase), then don't remove duplicates @@ -963,7 +1006,8 @@ mToField->addresses(removeDuplicates); ConvergedMessageAddressList ccAddresses; ConvergedMessageAddressList bccAddresses; - + ConvergedMessageAttachmentList mediaList; + int errorCode = 0; //Don't format the addresses for save to drfats case if(!isSave) { @@ -1050,18 +1094,23 @@ msg.setPriority(mSubjectField->priority()); } - ConvergedMessageAttachmentList mediaList; - QStringList mediafiles(mBody->mediaContent()); if (!mediafiles.isEmpty()) { for (int i = 0; i < mediafiles.size(); ++i) { + if(QFile::exists(mediafiles.at(i))) + { ConvergedMessageAttachment* attachment = new ConvergedMessageAttachment( mediafiles.at(i), ConvergedMessageAttachment::EInline); mediaList << attachment; + } + else + { mBody->removeMediaContent(mediafiles.at(i)); + errorCode = KErrNotFound; + } } } @@ -1079,17 +1128,26 @@ mAttachmentContainer->attachmentList(); for (int i = 0; i < editorAttachmentList.count(); ++i) { - ConvergedMessageAttachment* attachment = - new ConvergedMessageAttachment( - editorAttachmentList.at(i)->path(), - ConvergedMessageAttachment::EAttachment); - attachmentList << attachment; + if(QFile::exists(editorAttachmentList.at(i)->path())) + { + ConvergedMessageAttachment* attachment = + new ConvergedMessageAttachment( + editorAttachmentList.at(i)->path(), + ConvergedMessageAttachment::EAttachment); + attachmentList << attachment; + } + else + { + mAttachmentContainer->deleteAttachment(editorAttachmentList.at(i)); + errorCode = KErrNotFound; + } } } if(attachmentList.count() > 0) { msg.addAttachments(attachmentList); } + return errorCode; } int MsgUnifiedEditorView::saveContentToDrafts() @@ -1165,8 +1223,25 @@ return INVALID_MSGID; } ConvergedMessage msg; - packMessage(msg, true); + int result = packMessage(msg, true); + if(result == KErrNotFound) + { + HbNotificationDialog::launchDialog(LOC_NOTE_FILES_MISSED_DRAFTS); + if(messageType == ConvergedMessage::Sms && + addresses.isEmpty() && + MsgUnifiedEditorMonitor::bodySize() <= 0 && + MsgUnifiedEditorMonitor::containerSize() <= 0) + { + if(mOpenedMessageId.getId() != -1) + { + pluginInterface->deleteDraftsEntry(mOpenedMessageId.getId()); + } + // if empty msg, do not save + deactivateInputBlocker(); + return INVALID_MSGID; + } + } // save to drafts MsgSendUtil *sendUtil = new MsgSendUtil(this); int msgId = sendUtil->saveToDrafts(msg); @@ -1429,11 +1504,18 @@ //--------------------------------------------------------------- void MsgUnifiedEditorView::fetchAudio() { - // Launch Audio fetcher view - QVariantList params; - params << MsgBaseView::AUDIOFETCHER; // target view - params << MsgBaseView::UNIEDITOR; // source view - emit switchView(params); + // Launch Audio fetcher dialog + if(!mDialog) + { + mDialog = new MsgAudioFetcherDialog(); + connect(mDialog, + SIGNAL(audioSelected(QString&)), + this, + SLOT(onAudioSelected(QString&))); + } + + //show the dialog + mDialog->show(); } //--------------------------------------------------------------- @@ -1550,6 +1632,20 @@ connect(mVkbHost,SIGNAL(aboutToOpen()), this,SLOT(vkbAboutToOpen())); } + +//--------------------------------------------------------------- +// MsgUnifiedEditorView::onAudioSelected +// @see header file +//--------------------------------------------------------------- +void +MsgUnifiedEditorView::onAudioSelected(QString& filePath) +{ + if (!filePath.isEmpty()) + { + mBody->setAudio(filePath); + } +} + //--------------------------------------------------------------- // MsgUnifiedEditorView::hideChrome // @@ -1750,4 +1846,60 @@ delete tempAddr; } } + +// ---------------------------------------------------------------------------- +// MsgUnifiedEditorView::isReplyPathBroken +// @see header +// ---------------------------------------------------------------------------- +bool MsgUnifiedEditorView::isReplyPathBroken() +{ + // 1. Never set for MMS + // 2. if additional recipients exits + if( (MsgUnifiedEditorMonitor::messageType() == ConvergedMessage::Mms) || + (mToField->addressCount() != 1) ) + { + // broken + return true; + } + + // 3. if only recipient is not same as originating SME + QString dispName; + int phCount; + int origCntLocalId = MsgContactHandler::resolveContactDisplayName( + mOriginatingSME, dispName, phCount); + int currCntLocalId = -1; + QString currAddress(mToField->addresses().at(0)->address()); + if(origCntLocalId != -1) + { + currCntLocalId = MsgContactHandler::resolveContactDisplayName( + currAddress, dispName, phCount); + } + + if(currCntLocalId != -1) + { // both are mapped contacts present in contacts db + if(currCntLocalId != origCntLocalId) + { + return true; + } + } + else + { // atleast one contact is not present in contacts db + // direct compare + UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils); + bool compareResult = false; + TRAP_IGNORE( + compareResult = genUtils->MatchPhoneNumberL( + *XQConversions::qStringToS60Desc(mOriginatingSME), + *XQConversions::qStringToS60Desc(currAddress)) + ); + delete genUtils; + if(!compareResult) + { + return true; + } + } + + return false; +} + //EOF diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiededitor/unifiededitor.pro --- a/messagingapp/msgui/unifiededitor/unifiededitor.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiededitor/unifiededitor.pro Tue Aug 31 18:53:38 2010 +0530 @@ -109,6 +109,7 @@ -lsmcm \ -lxqserviceutil \ -lcommonengine \ - -lefsrv + -lefsrv \ + -lmsgaudiofetcher \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp --- a/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -51,7 +51,7 @@ //DB-file _LIT(KDbFileName, "c:[2002A542]conversations.db"); // query to see if msg is forwardable -_LIT(KSelectMsgPropertyStmt, " SELECT message_id, msg_property FROM conversation_messages WHERE message_id=:message_id "); +_LIT(KSelectMsgPropertyStmt, " SELECT message_id, msg_property, msg_processingstate FROM conversation_messages WHERE message_id=:message_id "); //LOCALIZED CONSTANTS @@ -366,15 +366,36 @@ // read the flag TInt msgPropertyIndex = sqlSelectStmt.ColumnIndex(_L("msg_property")); + + TInt msgProcessingStateIndex = sqlSelectStmt.ColumnIndex( + _L("msg_processingstate")); + TInt retValue = 0; + TInt processingStateVal = 0; if (sqlSelectStmt.Next() == KSqlAtRow) { retValue = static_cast (sqlSelectStmt.ColumnInt(msgPropertyIndex)); - } + processingStateVal = static_cast + (sqlSelectStmt.ColumnInt(msgProcessingStateIndex)); + } + CleanupStack::PopAndDestroy(&sqlSelectStmt); sqlDb.Close(); - canForwardMsg = (retValue & EPreviewForward)? true:false; + + bool processing = (processingStateVal & EPreviewMsgProcessed)? true:false; + if(processing) + { + canForwardMsg = (retValue & EPreviewForward)? true:false; + } + else + { + // If message is still getting processed, forward field may not be updated in + // Preview DB, so get the forwardable state from MMS conformance checks... + MmsConformanceCheck* mmsConformanceCheck = new MmsConformanceCheck; + canForwardMsg = mmsConformanceCheck->validateMsgForForward(mMessageId); + delete mmsConformanceCheck; + } } else { diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp --- a/messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -283,7 +283,7 @@ int count; for (int i = 0; i < mCcAddressList.count(); ++i) { MsgContactHandler::resolveContactDisplayName( - mToAddressList.at(i)->address(), alias, count); + mCcAddressList.at(i)->address(), alias, count); mCcAddressList.at(i)->setAlias(alias); alias.clear(); diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/bwins/convergedmessageutilsu.def --- a/messagingapp/msgutils/bwins/convergedmessageutilsu.def Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/bwins/convergedmessageutilsu.def Tue Aug 31 18:53:38 2010 +0530 @@ -2,71 +2,73 @@ ??0ConvergedMessageId@@QAE@H@Z @ 1 NONAME ; ConvergedMessageId::ConvergedMessageId(int) ?toAddressList@ConvergedMessage@@QBE?BV?$QList@PAVConvergedMessageAddress@@@@XZ @ 2 NONAME ; class QList const ConvergedMessage::toAddressList(void) const ?serialize@ConvergedMessageAttachment@@QBEXAAVQDataStream@@@Z @ 3 NONAME ; void ConvergedMessageAttachment::serialize(class QDataStream &) const - ?fromAddress@ConvergedMessage@@QBEPAVConvergedMessageAddress@@XZ @ 4 NONAME ; class ConvergedMessageAddress * ConvergedMessage::fromAddress(void) const - ?setProperty@ConvergedMessage@@QAEXW4MessageProperty@1@@Z @ 5 NONAME ; void ConvergedMessage::setProperty(enum ConvergedMessage::MessageProperty) - ?sendingState@ConvergedMessage@@QBE?AW4SendingState@1@XZ @ 6 NONAME ; enum ConvergedMessage::SendingState ConvergedMessage::sendingState(void) const - ?properties@ConvergedMessage@@QBEGXZ @ 7 NONAME ; unsigned short ConvergedMessage::properties(void) const - ?address@ConvergedMessageAddress@@QBEABVQString@@XZ @ 8 NONAME ; class QString const & ConvergedMessageAddress::address(void) const - ??4ConvergedMessageId@@QAEAAV0@ABV0@@Z @ 9 NONAME ; class ConvergedMessageId & ConvergedMessageId::operator=(class ConvergedMessageId const &) - ?location@ConvergedMessage@@QBE?AW4MessageLocation@1@XZ @ 10 NONAME ; enum ConvergedMessage::MessageLocation ConvergedMessage::location(void) const - ?setTimeStamp@ConvergedMessage@@QAEX_J@Z @ 11 NONAME ; void ConvergedMessage::setTimeStamp(long long) - ?setAttachmentType@ConvergedMessageAttachment@@QAEXH@Z @ 12 NONAME ; void ConvergedMessageAttachment::setAttachmentType(int) - ?setSubject@ConvergedMessage@@QAEXABVQString@@@Z @ 13 NONAME ; void ConvergedMessage::setSubject(class QString const &) - ?timeStamp@ConvergedMessage@@QBE_JXZ @ 14 NONAME ; long long ConvergedMessage::timeStamp(void) const - ?bodyText@ConvergedMessage@@QBEABVQString@@XZ @ 15 NONAME ; class QString const & ConvergedMessage::bodyText(void) const - ??0ConvergedMessageAttachment@@QAE@ABVQString@@H@Z @ 16 NONAME ; ConvergedMessageAttachment::ConvergedMessageAttachment(class QString const &, int) - ?setAddress@ConvergedMessageAddress@@QAEXABVQString@@@Z @ 17 NONAME ; void ConvergedMessageAddress::setAddress(class QString const &) - ?addCcRecipient@ConvergedMessage@@QAEXAAVConvergedMessageAddress@@@Z @ 18 NONAME ; void ConvergedMessage::addCcRecipient(class ConvergedMessageAddress &) - ??0ConvergedMessage@@QAE@ABV0@@Z @ 19 NONAME ; ConvergedMessage::ConvergedMessage(class ConvergedMessage const &) - ?setPriority@ConvergedMessage@@QAEXW4Priority@1@@Z @ 20 NONAME ; void ConvergedMessage::setPriority(enum ConvergedMessage::Priority) - ?setBodyText@ConvergedMessage@@QAEXABVQString@@@Z @ 21 NONAME ; void ConvergedMessage::setBodyText(class QString const &) - ?setDirection@ConvergedMessage@@QAEXW4Direction@1@@Z @ 22 NONAME ; void ConvergedMessage::setDirection(enum ConvergedMessage::Direction) - ?addBccRecipients@ConvergedMessage@@QAEXAAV?$QList@PAVConvergedMessageAddress@@@@@Z @ 23 NONAME ; void ConvergedMessage::addBccRecipients(class QList &) - ?attachmentType@ConvergedMessageAttachment@@QBEHXZ @ 24 NONAME ; int ConvergedMessageAttachment::attachmentType(void) const - ?addToRecipients@ConvergedMessage@@QAEXAAV?$QList@PAVConvergedMessageAddress@@@@@Z @ 25 NONAME ; void ConvergedMessage::addToRecipients(class QList &) - ?serialize@ConvergedMessageAddress@@QBEXAAVQDataStream@@@Z @ 26 NONAME ; void ConvergedMessageAddress::serialize(class QDataStream &) const - ??0ConvergedMessageAddress@@QAE@ABVQString@@0@Z @ 27 NONAME ; ConvergedMessageAddress::ConvergedMessageAddress(class QString const &, class QString const &) - ??_EConvergedMessageAddress@@QAE@I@Z @ 28 NONAME ABSENT ; ConvergedMessageAddress::~ConvergedMessageAddress(unsigned int) - ??_EConvergedMessageAttachment@@QAE@I@Z @ 29 NONAME ABSENT ; ConvergedMessageAttachment::~ConvergedMessageAttachment(unsigned int) - ?addFromRecipient@ConvergedMessage@@QAEXAAVConvergedMessageAddress@@@Z @ 30 NONAME ; void ConvergedMessage::addFromRecipient(class ConvergedMessageAddress &) + ?setReplyPath@ConvergedMessage@@QAEX_N@Z @ 4 NONAME ; void ConvergedMessage::setReplyPath(bool) + ?fromAddress@ConvergedMessage@@QBEPAVConvergedMessageAddress@@XZ @ 5 NONAME ; class ConvergedMessageAddress * ConvergedMessage::fromAddress(void) const + ?setProperty@ConvergedMessage@@QAEXW4MessageProperty@1@@Z @ 6 NONAME ; void ConvergedMessage::setProperty(enum ConvergedMessage::MessageProperty) + ?sendingState@ConvergedMessage@@QBE?AW4SendingState@1@XZ @ 7 NONAME ; enum ConvergedMessage::SendingState ConvergedMessage::sendingState(void) const + ?properties@ConvergedMessage@@QBEGXZ @ 8 NONAME ; unsigned short ConvergedMessage::properties(void) const + ?address@ConvergedMessageAddress@@QBEABVQString@@XZ @ 9 NONAME ; class QString const & ConvergedMessageAddress::address(void) const + ??4ConvergedMessageId@@QAEAAV0@ABV0@@Z @ 10 NONAME ; class ConvergedMessageId & ConvergedMessageId::operator=(class ConvergedMessageId const &) + ?location@ConvergedMessage@@QBE?AW4MessageLocation@1@XZ @ 11 NONAME ; enum ConvergedMessage::MessageLocation ConvergedMessage::location(void) const + ?setTimeStamp@ConvergedMessage@@QAEX_J@Z @ 12 NONAME ; void ConvergedMessage::setTimeStamp(long long) + ?setAttachmentType@ConvergedMessageAttachment@@QAEXH@Z @ 13 NONAME ; void ConvergedMessageAttachment::setAttachmentType(int) + ?setSubject@ConvergedMessage@@QAEXABVQString@@@Z @ 14 NONAME ; void ConvergedMessage::setSubject(class QString const &) + ?timeStamp@ConvergedMessage@@QBE_JXZ @ 15 NONAME ; long long ConvergedMessage::timeStamp(void) const + ?bodyText@ConvergedMessage@@QBEABVQString@@XZ @ 16 NONAME ; class QString const & ConvergedMessage::bodyText(void) const + ??0ConvergedMessageAttachment@@QAE@ABVQString@@H@Z @ 17 NONAME ; ConvergedMessageAttachment::ConvergedMessageAttachment(class QString const &, int) + ?setAddress@ConvergedMessageAddress@@QAEXABVQString@@@Z @ 18 NONAME ; void ConvergedMessageAddress::setAddress(class QString const &) + ?addCcRecipient@ConvergedMessage@@QAEXAAVConvergedMessageAddress@@@Z @ 19 NONAME ; void ConvergedMessage::addCcRecipient(class ConvergedMessageAddress &) + ??0ConvergedMessage@@QAE@ABV0@@Z @ 20 NONAME ; ConvergedMessage::ConvergedMessage(class ConvergedMessage const &) + ?setPriority@ConvergedMessage@@QAEXW4Priority@1@@Z @ 21 NONAME ; void ConvergedMessage::setPriority(enum ConvergedMessage::Priority) + ?setBodyText@ConvergedMessage@@QAEXABVQString@@@Z @ 22 NONAME ; void ConvergedMessage::setBodyText(class QString const &) + ?setDirection@ConvergedMessage@@QAEXW4Direction@1@@Z @ 23 NONAME ; void ConvergedMessage::setDirection(enum ConvergedMessage::Direction) + ?addBccRecipients@ConvergedMessage@@QAEXAAV?$QList@PAVConvergedMessageAddress@@@@@Z @ 24 NONAME ; void ConvergedMessage::addBccRecipients(class QList &) + ?attachmentType@ConvergedMessageAttachment@@QBEHXZ @ 25 NONAME ; int ConvergedMessageAttachment::attachmentType(void) const + ?addToRecipients@ConvergedMessage@@QAEXAAV?$QList@PAVConvergedMessageAddress@@@@@Z @ 26 NONAME ; void ConvergedMessage::addToRecipients(class QList &) + ?serialize@ConvergedMessageAddress@@QBEXAAVQDataStream@@@Z @ 27 NONAME ; void ConvergedMessageAddress::serialize(class QDataStream &) const + ??0ConvergedMessageAddress@@QAE@ABVQString@@0@Z @ 28 NONAME ; ConvergedMessageAddress::ConvergedMessageAddress(class QString const &, class QString const &) + ?addFromRecipient@ConvergedMessage@@QAEXAAVConvergedMessageAddress@@@Z @ 29 NONAME ; void ConvergedMessage::addFromRecipient(class ConvergedMessageAddress &) + ?setMessageSubType@ConvergedMessage@@QAEXW4MessageSubType@1@@Z @ 30 NONAME ; void ConvergedMessage::setMessageSubType(enum ConvergedMessage::MessageSubType) ?addBccRecipient@ConvergedMessage@@QAEXAAVConvergedMessageAddress@@@Z @ 31 NONAME ; void ConvergedMessage::addBccRecipient(class ConvergedMessageAddress &) ?direction@ConvergedMessage@@QBE?AW4Direction@1@XZ @ 32 NONAME ; enum ConvergedMessage::Direction ConvergedMessage::direction(void) const ?setMessageId@ConvergedMessage@@QAEXAAVConvergedMessageId@@@Z @ 33 NONAME ; void ConvergedMessage::setMessageId(class ConvergedMessageId &) ?isUnread@ConvergedMessage@@QBE_NXZ @ 34 NONAME ; bool ConvergedMessage::isUnread(void) const ?setAlias@ConvergedMessageAddress@@QAEXABVQString@@@Z @ 35 NONAME ; void ConvergedMessageAddress::setAlias(class QString const &) - ?setLocation@ConvergedMessage@@QAEXW4MessageLocation@1@@Z @ 36 NONAME ; void ConvergedMessage::setLocation(enum ConvergedMessage::MessageLocation) - ?addAttachments@ConvergedMessage@@QAEXAAV?$QList@PAVConvergedMessageAttachment@@@@@Z @ 37 NONAME ; void ConvergedMessage::addAttachments(class QList &) - ?bccAddressList@ConvergedMessage@@QBE?BV?$QList@PAVConvergedMessageAddress@@@@XZ @ 38 NONAME ; class QList const ConvergedMessage::bccAddressList(void) const - ?attachments@ConvergedMessage@@QBE?AV?$QList@PAVConvergedMessageAttachment@@@@XZ @ 39 NONAME ; class QList ConvergedMessage::attachments(void) const - ?priority@ConvergedMessage@@QBE?AW4Priority@1@XZ @ 40 NONAME ; enum ConvergedMessage::Priority ConvergedMessage::priority(void) const - ?getId@ConvergedMessageId@@QBEHXZ @ 41 NONAME ; int ConvergedMessageId::getId(void) const - ?deserialize@ConvergedMessageAddress@@QAEXAAVQDataStream@@@Z @ 42 NONAME ; void ConvergedMessageAddress::deserialize(class QDataStream &) - ?hasAttachment@ConvergedMessage@@QBE_NXZ @ 43 NONAME ; bool ConvergedMessage::hasAttachment(void) const - ?setId@ConvergedMessageId@@QAEXH@Z @ 44 NONAME ; void ConvergedMessageId::setId(int) - ?setMessageType@ConvergedMessage@@QAEXW4MessageType@1@@Z @ 45 NONAME ; void ConvergedMessage::setMessageType(enum ConvergedMessage::MessageType) - ?id@ConvergedMessage@@QBEPAVConvergedMessageId@@XZ @ 46 NONAME ; class ConvergedMessageId * ConvergedMessage::id(void) const - ??0ConvergedMessage@@QAE@ABVConvergedMessageId@@@Z @ 47 NONAME ; ConvergedMessage::ConvergedMessage(class ConvergedMessageId const &) - ??0ConvergedMessage@@QAE@W4MessageType@0@@Z @ 48 NONAME ; ConvergedMessage::ConvergedMessage(enum ConvergedMessage::MessageType) - ?addToRecipient@ConvergedMessage@@QAEXAAVConvergedMessageAddress@@@Z @ 49 NONAME ; void ConvergedMessage::addToRecipient(class ConvergedMessageAddress &) - ?subject@ConvergedMessage@@QBEABVQString@@XZ @ 50 NONAME ; class QString const & ConvergedMessage::subject(void) const - ?alias@ConvergedMessageAddress@@QBEABVQString@@XZ @ 51 NONAME ; class QString const & ConvergedMessageAddress::alias(void) const - ?ccAddressList@ConvergedMessage@@QBE?BV?$QList@PAVConvergedMessageAddress@@@@XZ @ 52 NONAME ; class QList const ConvergedMessage::ccAddressList(void) const - ??1ConvergedMessageAddress@@QAE@XZ @ 53 NONAME ; ConvergedMessageAddress::~ConvergedMessageAddress(void) - ?messageType@ConvergedMessage@@QBE?AW4MessageType@1@XZ @ 54 NONAME ; enum ConvergedMessage::MessageType ConvergedMessage::messageType(void) const - ?deserialize@ConvergedMessageAttachment@@QAEXAAVQDataStream@@@Z @ 55 NONAME ; void ConvergedMessageAttachment::deserialize(class QDataStream &) - ??1ConvergedMessageAttachment@@QAE@XZ @ 56 NONAME ; ConvergedMessageAttachment::~ConvergedMessageAttachment(void) - ?serialize@ConvergedMessage@@QBEXAAVQDataStream@@@Z @ 57 NONAME ; void ConvergedMessage::serialize(class QDataStream &) const - ??0ConvergedMessageId@@QAE@ABV0@@Z @ 58 NONAME ; ConvergedMessageId::ConvergedMessageId(class ConvergedMessageId const &) - ?serialize@ConvergedMessageId@@QBEXAAVQDataStream@@@Z @ 59 NONAME ; void ConvergedMessageId::serialize(class QDataStream &) const - ?setSendingState@ConvergedMessage@@QAEXW4SendingState@1@@Z @ 60 NONAME ; void ConvergedMessage::setSendingState(enum ConvergedMessage::SendingState) - ??8ConvergedMessageAttachment@@QBE_NABV0@@Z @ 61 NONAME ; bool ConvergedMessageAttachment::operator==(class ConvergedMessageAttachment const &) const - ??8ConvergedMessageId@@QBE_NABV0@@Z @ 62 NONAME ; bool ConvergedMessageId::operator==(class ConvergedMessageId const &) const - ?deserialize@ConvergedMessageId@@QAEXAAVQDataStream@@@Z @ 63 NONAME ; void ConvergedMessageId::deserialize(class QDataStream &) - ?filePath@ConvergedMessageAttachment@@QBEABVQString@@XZ @ 64 NONAME ; class QString const & ConvergedMessageAttachment::filePath(void) const - ??1ConvergedMessage@@QAE@XZ @ 65 NONAME ; ConvergedMessage::~ConvergedMessage(void) - ?addCcRecipients@ConvergedMessage@@QAEXAAV?$QList@PAVConvergedMessageAddress@@@@@Z @ 66 NONAME ; void ConvergedMessage::addCcRecipients(class QList &) - ?deserialize@ConvergedMessage@@QAEXAAVQDataStream@@@Z @ 67 NONAME ; void ConvergedMessage::deserialize(class QDataStream &) - ?setFilePath@ConvergedMessageAttachment@@QAEXABVQString@@@Z @ 68 NONAME ; void ConvergedMessageAttachment::setFilePath(class QString const &) - ?setMessageSubType@ConvergedMessage@@QAEXW4MessageSubType@1@@Z @ 69 NONAME ; void ConvergedMessage::setMessageSubType(enum ConvergedMessage::MessageSubType) - ?messageSubType@ConvergedMessage@@QBE?AW4MessageSubType@1@XZ @ 70 NONAME ; enum ConvergedMessage::MessageSubType ConvergedMessage::messageSubType(void) const + ?setOriginatingSC@ConvergedMessage@@QAEXABVQString@@@Z @ 36 NONAME ; void ConvergedMessage::setOriginatingSC(class QString const &) + ?setLocation@ConvergedMessage@@QAEXW4MessageLocation@1@@Z @ 37 NONAME ; void ConvergedMessage::setLocation(enum ConvergedMessage::MessageLocation) + ?addAttachments@ConvergedMessage@@QAEXAAV?$QList@PAVConvergedMessageAttachment@@@@@Z @ 38 NONAME ; void ConvergedMessage::addAttachments(class QList &) + ?bccAddressList@ConvergedMessage@@QBE?BV?$QList@PAVConvergedMessageAddress@@@@XZ @ 39 NONAME ; class QList const ConvergedMessage::bccAddressList(void) const + ?attachments@ConvergedMessage@@QBE?AV?$QList@PAVConvergedMessageAttachment@@@@XZ @ 40 NONAME ; class QList ConvergedMessage::attachments(void) const + ?priority@ConvergedMessage@@QBE?AW4Priority@1@XZ @ 41 NONAME ; enum ConvergedMessage::Priority ConvergedMessage::priority(void) const + ?replyPath@ConvergedMessage@@QAE_NXZ @ 42 NONAME ; bool ConvergedMessage::replyPath(void) + ?getId@ConvergedMessageId@@QBEHXZ @ 43 NONAME ; int ConvergedMessageId::getId(void) const + ?deserialize@ConvergedMessageAddress@@QAEXAAVQDataStream@@@Z @ 44 NONAME ; void ConvergedMessageAddress::deserialize(class QDataStream &) + ?hasAttachment@ConvergedMessage@@QBE_NXZ @ 45 NONAME ; bool ConvergedMessage::hasAttachment(void) const + ?setId@ConvergedMessageId@@QAEXH@Z @ 46 NONAME ; void ConvergedMessageId::setId(int) + ?setMessageType@ConvergedMessage@@QAEXW4MessageType@1@@Z @ 47 NONAME ; void ConvergedMessage::setMessageType(enum ConvergedMessage::MessageType) + ?originatingSC@ConvergedMessage@@QBEABVQString@@XZ @ 48 NONAME ; class QString const & ConvergedMessage::originatingSC(void) const + ?id@ConvergedMessage@@QBEPAVConvergedMessageId@@XZ @ 49 NONAME ; class ConvergedMessageId * ConvergedMessage::id(void) const + ??0ConvergedMessage@@QAE@ABVConvergedMessageId@@@Z @ 50 NONAME ; ConvergedMessage::ConvergedMessage(class ConvergedMessageId const &) + ??0ConvergedMessage@@QAE@W4MessageType@0@@Z @ 51 NONAME ; ConvergedMessage::ConvergedMessage(enum ConvergedMessage::MessageType) + ?addToRecipient@ConvergedMessage@@QAEXAAVConvergedMessageAddress@@@Z @ 52 NONAME ; void ConvergedMessage::addToRecipient(class ConvergedMessageAddress &) + ?subject@ConvergedMessage@@QBEABVQString@@XZ @ 53 NONAME ; class QString const & ConvergedMessage::subject(void) const + ?alias@ConvergedMessageAddress@@QBEABVQString@@XZ @ 54 NONAME ; class QString const & ConvergedMessageAddress::alias(void) const + ?messageSubType@ConvergedMessage@@QBE?AW4MessageSubType@1@XZ @ 55 NONAME ; enum ConvergedMessage::MessageSubType ConvergedMessage::messageSubType(void) const + ?ccAddressList@ConvergedMessage@@QBE?BV?$QList@PAVConvergedMessageAddress@@@@XZ @ 56 NONAME ; class QList const ConvergedMessage::ccAddressList(void) const + ??1ConvergedMessageAddress@@QAE@XZ @ 57 NONAME ; ConvergedMessageAddress::~ConvergedMessageAddress(void) + ?messageType@ConvergedMessage@@QBE?AW4MessageType@1@XZ @ 58 NONAME ; enum ConvergedMessage::MessageType ConvergedMessage::messageType(void) const + ?deserialize@ConvergedMessageAttachment@@QAEXAAVQDataStream@@@Z @ 59 NONAME ; void ConvergedMessageAttachment::deserialize(class QDataStream &) + ??1ConvergedMessageAttachment@@QAE@XZ @ 60 NONAME ; ConvergedMessageAttachment::~ConvergedMessageAttachment(void) + ?serialize@ConvergedMessage@@QBEXAAVQDataStream@@@Z @ 61 NONAME ; void ConvergedMessage::serialize(class QDataStream &) const + ??0ConvergedMessageId@@QAE@ABV0@@Z @ 62 NONAME ; ConvergedMessageId::ConvergedMessageId(class ConvergedMessageId const &) + ?serialize@ConvergedMessageId@@QBEXAAVQDataStream@@@Z @ 63 NONAME ; void ConvergedMessageId::serialize(class QDataStream &) const + ?setSendingState@ConvergedMessage@@QAEXW4SendingState@1@@Z @ 64 NONAME ; void ConvergedMessage::setSendingState(enum ConvergedMessage::SendingState) + ??8ConvergedMessageAttachment@@QBE_NABV0@@Z @ 65 NONAME ; bool ConvergedMessageAttachment::operator==(class ConvergedMessageAttachment const &) const + ?deserialize@ConvergedMessageId@@QAEXAAVQDataStream@@@Z @ 66 NONAME ; void ConvergedMessageId::deserialize(class QDataStream &) + ??8ConvergedMessageId@@QBE_NABV0@@Z @ 67 NONAME ; bool ConvergedMessageId::operator==(class ConvergedMessageId const &) const + ?filePath@ConvergedMessageAttachment@@QBEABVQString@@XZ @ 68 NONAME ; class QString const & ConvergedMessageAttachment::filePath(void) const + ??1ConvergedMessage@@QAE@XZ @ 69 NONAME ; ConvergedMessage::~ConvergedMessage(void) + ?addCcRecipients@ConvergedMessage@@QAEXAAV?$QList@PAVConvergedMessageAddress@@@@@Z @ 70 NONAME ; void ConvergedMessage::addCcRecipients(class QList &) + ?deserialize@ConvergedMessage@@QAEXAAVQDataStream@@@Z @ 71 NONAME ; void ConvergedMessage::deserialize(class QDataStream &) + ?setFilePath@ConvergedMessageAttachment@@QAEXABVQString@@@Z @ 72 NONAME ; void ConvergedMessageAttachment::setFilePath(class QString const &) diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/convergedmessageutils/inc/convergedmessageimpl.h --- a/messagingapp/msgutils/convergedmessageutils/inc/convergedmessageimpl.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/convergedmessageutils/inc/convergedmessageimpl.h Tue Aug 31 18:53:38 2010 +0530 @@ -286,6 +286,33 @@ * @param stream data stream from which data is deserialized. */ void deserialize(QDataStream &stream); + + /** + * Sets the message property, if reply-path is present + * @param replypath, TP-RP (Reply Path) Found in first octet of + * Submit and Deliver PDU + */ + void setReplyPath(bool replypath); + + /** + * Tells if the reply-path is set for this message + * @return bool, if the reply-path exists + */ + bool replyPath(); + + /** + * Set originating service center address. This is used for reply + * purposes, if the reply-via-same-smsc flag is ON + * @param scaddress, service center address + */ + void setOriginatingSC(const QString& scaddress); + + /** + * Get originating service center address, + * if preserved for reply-via-same-smsc + * @return originating service center address + */ + const QString& originatingSC() const; private: /** @@ -379,6 +406,12 @@ * Messaging sending states */ quint8 mSendingState; + + /** + * Originating SC, + * to be used only when reply-path is available + */ + QString mOriginatingSC; }; #endif // CONVERGED_MESSAGE_IMPL_H diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/convergedmessageutils/src/convergedmessage.cpp --- a/messagingapp/msgutils/convergedmessageutils/src/convergedmessage.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/convergedmessageutils/src/convergedmessage.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -416,5 +416,41 @@ mConvergedMessageImpl->deserialize(stream); } +//---------------------------------------------------------------- +// ConvergedMessage::setReplyPath +// @see header +//---------------------------------------------------------------- +void ConvergedMessage::setReplyPath(bool replypath) + { + mConvergedMessageImpl->setReplyPath(replypath); + } + +//---------------------------------------------------------------- +// ConvergedMessage::replyPath +// @see header +//---------------------------------------------------------------- +bool ConvergedMessage::replyPath() + { + return mConvergedMessageImpl->replyPath(); + } + +//---------------------------------------------------------------- +// ConvergedMessage::setOriginatingSC +// @see header +//---------------------------------------------------------------- +void ConvergedMessage::setOriginatingSC(const QString& scaddress) + { + mConvergedMessageImpl->setOriginatingSC(scaddress); + } + +//---------------------------------------------------------------- +// ConvergedMessage::originatingSC +// @see header +//---------------------------------------------------------------- +const QString& ConvergedMessage::originatingSC() const + { + return mConvergedMessageImpl->originatingSC(); + } + // eof diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/convergedmessageutils/src/convergedmessageimpl.cpp --- a/messagingapp/msgutils/convergedmessageutils/src/convergedmessageimpl.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/convergedmessageutils/src/convergedmessageimpl.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -38,7 +38,8 @@ mPriority(ConvergedMessage::Normal), mLocation( ConvergedMessage::Delete), mDirection( ConvergedMessage::Incoming), mSendingState( - ConvergedMessage::Unknown) + ConvergedMessage::Unknown), + mOriginatingSC(0) { mMessageType = messageType; mId = new ConvergedMessageId(); @@ -56,11 +57,11 @@ mPriority(ConvergedMessage::Normal), mLocation( ConvergedMessage::Delete), mDirection( ConvergedMessage::Incoming), mSendingState( - ConvergedMessage::Unknown) + ConvergedMessage::Unknown), + mOriginatingSC(0) { mId = new ConvergedMessageId(id); mFromAddress = new ConvergedMessageAddress(); - } //---------------------------------------------------------------- @@ -121,6 +122,7 @@ mLocation = msg.location(); mDirection = msg.direction(); mSendingState = msg.sendingState(); + mOriginatingSC = QString(msg.originatingSC()); } //---------------------------------------------------------------- @@ -507,7 +509,6 @@ ConvergedMessageAttachmentList attachmentList) { mAttachments.append(attachmentList); - } //---------------------------------------------------------------- @@ -560,6 +561,7 @@ stream << mLocation; stream << mDirection; stream << mSendingState; + stream << mOriginatingSC; } //---------------------------------------------------------------- @@ -633,6 +635,52 @@ stream >> mLocation; stream >> mDirection; stream >> mSendingState; + stream >> mOriginatingSC; + } + +//---------------------------------------------------------------- +// ConvergedMessageImpl::setReplyPath +// @see header +//---------------------------------------------------------------- +void ConvergedMessageImpl::setReplyPath(bool replypath) + { + if( replypath ) + { + // set replypath property + mProperty |= ConvergedMessage::ReplyPath; + } + else + { + // reset replypath property + mProperty &= ~ConvergedMessage::ReplyPath; + } + } + +//---------------------------------------------------------------- +// ConvergedMessageImpl::replyPath +// @see header +//---------------------------------------------------------------- +bool ConvergedMessageImpl::replyPath() + { + return mProperty & ConvergedMessage::ReplyPath; + } + +//---------------------------------------------------------------- +// ConvergedMessageImpl::setOriginatingSC +// @see header +//---------------------------------------------------------------- +void ConvergedMessageImpl::setOriginatingSC(const QString& scaddress) + { + mOriginatingSC = scaddress; + } + +//---------------------------------------------------------------- +// ConvergedMessageImpl::originatingSC +// @see header +//---------------------------------------------------------------- +const QString& ConvergedMessageImpl::originatingSC() const + { + return mOriginatingSC; } // eof diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/inc/testconvergedmessageutils.ini --- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/inc/testconvergedmessageutils.ini Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/inc/testconvergedmessageutils.ini Tue Aug 31 18:53:38 2010 +0530 @@ -21,14 +21,3 @@ const char TEST_CC[] = "DummyCCAddress"; const char TEST_BCC[] = "DummyBCCAddress"; const char TEST_ALIAS[] = "DummySenderAlias"; - -//out put directory for test results. -QString OUTPUTDIRECTORY = "c:/logs/TestConvergedMessageUtils"; -//o/p directory for data to be written on temp file. -QString TEMPDIR = "c:/logs/TestConvergedMessageUtils/testdata"; -//test result O/P file name. -QString RESULTFILE = "c:/logs/TestConvergedMessageUtils/result_%1.txt"; -// folder named UID3 of msgapptestsuite inside private folder. -const QString PRIVATE_DIR("C:/private/E39cd515"); -//application class name -const QString appClassName("TestConvergedMessageUtils"); \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/src/testconvergedmessageutils.cpp --- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/src/testconvergedmessageutils.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/src/testconvergedmessageutils.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -265,67 +265,30 @@ } //--------------------------------------------------------------- -// getObject -// factory method to create objects. -//--------------------------------------------------------------- -QObject* getObject(QString className) -{ - if(className == "TestConvergedMessageUtils" ) - { - return new TestConvergedMessageUtils; - } - else - { - return 0; - } -} - -//--------------------------------------------------------------- -// createOutPutDirectory -// creating o/p directory. -//--------------------------------------------------------------- -void createOutPutDirectory() - { - QDir dir; - //o/p dir - dir.mkdir(OUTPUTDIRECTORY); - //tmp dir - dir.mkdir(TEMPDIR); - // dir inside private folder. - dir.mkdir(PRIVATE_DIR); - } - -//--------------------------------------------------------------- // main // main entry point //--------------------------------------------------------------- int main(int argc, char *argv[]) { - int ret = -1; - QCoreApplication app(argc, argv); - - //creating output directory. - createOutPutDirectory(); - - QStringList args; - QString appName = argv[0]; - args << appName; - - QString option = "-o"; - args << option; - - QString outFile = RESULTFILE; - outFile = outFile.arg(appClassName); - args << outFile; - - QObject* tc = getObject(appClassName); - - if(tc) - { - ret = QTest::qExec(tc, args); - delete tc; - } - return ret; + int ret = -1; + QCoreApplication app(argc, argv); + QObject* tc = new TestConvergedMessageUtils(); + +#ifdef __WINSCW__ + char *new_argv[3]; + QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; + QByteArray bytes = str.toAscii(); + char arg1[] = "-o"; + new_argv[0] = argv[0]; + new_argv[1] = arg1; + new_argv[2] = bytes.data(); + ret = QTest::qExec(tc, 3, new_argv); +#else + ret = QTest::qExec(tc, argc, argv); +#endif + + delete tc; + return ret; } //End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutilsapp.pro --- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutilsapp.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutilsapp.pro Tue Aug 31 18:53:38 2010 +0530 @@ -16,7 +16,7 @@ TEMPLATE = subdirs -SUBDIRS += mmstestbed/mmstestbed.pro -SUBDIRS += testconvergedmessageutils/testconvergedmessageutils.pro +SUBDIRS += mmstestbed +SUBDIRS += testconvergedmessageutils CONFIG += ordered \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/convergedmessageutils/tsrc/tsrc.pro --- a/messagingapp/msgutils/convergedmessageutils/tsrc/tsrc.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/convergedmessageutils/tsrc/tsrc.pro Tue Aug 31 18:53:38 2010 +0530 @@ -16,6 +16,6 @@ TEMPLATE = subdirs -SUBDIRS += testconvergedmessageutilsapp/testconvergedmessageutilsapp.pro +SUBDIRS += testconvergedmessageutilsapp CONFIG += ordered \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/eabi/convergedmessageutilsu.def --- a/messagingapp/msgutils/eabi/convergedmessageutilsu.def Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/eabi/convergedmessageutilsu.def Tue Aug 31 18:53:38 2010 +0530 @@ -7,74 +7,78 @@ _ZN16ConvergedMessage11setPropertyENS_15MessagePropertyE @ 6 NONAME _ZN16ConvergedMessage12setDirectionENS_9DirectionE @ 7 NONAME _ZN16ConvergedMessage12setMessageIdER18ConvergedMessageId @ 8 NONAME - _ZN16ConvergedMessage12setTimeStampEx @ 9 NONAME - _ZN16ConvergedMessage14addAttachmentsER5QListIP26ConvergedMessageAttachmentE @ 10 NONAME - _ZN16ConvergedMessage14addCcRecipientER23ConvergedMessageAddress @ 11 NONAME - _ZN16ConvergedMessage14addToRecipientER23ConvergedMessageAddress @ 12 NONAME - _ZN16ConvergedMessage14setMessageTypeENS_11MessageTypeE @ 13 NONAME - _ZN16ConvergedMessage15addBccRecipientER23ConvergedMessageAddress @ 14 NONAME - _ZN16ConvergedMessage15addCcRecipientsER5QListIP23ConvergedMessageAddressE @ 15 NONAME - _ZN16ConvergedMessage15addToRecipientsER5QListIP23ConvergedMessageAddressE @ 16 NONAME - _ZN16ConvergedMessage15setSendingStateENS_12SendingStateE @ 17 NONAME - _ZN16ConvergedMessage16addBccRecipientsER5QListIP23ConvergedMessageAddressE @ 18 NONAME - _ZN16ConvergedMessage16addFromRecipientER23ConvergedMessageAddress @ 19 NONAME - _ZN16ConvergedMessageC1ENS_11MessageTypeE @ 20 NONAME - _ZN16ConvergedMessageC1ERK18ConvergedMessageId @ 21 NONAME - _ZN16ConvergedMessageC1ERKS_ @ 22 NONAME - _ZN16ConvergedMessageC2ENS_11MessageTypeE @ 23 NONAME - _ZN16ConvergedMessageC2ERK18ConvergedMessageId @ 24 NONAME - _ZN16ConvergedMessageC2ERKS_ @ 25 NONAME - _ZN16ConvergedMessageD1Ev @ 26 NONAME - _ZN16ConvergedMessageD2Ev @ 27 NONAME - _ZN18ConvergedMessageId11deserializeER11QDataStream @ 28 NONAME - _ZN18ConvergedMessageId5setIdEi @ 29 NONAME - _ZN18ConvergedMessageIdC1ERKS_ @ 30 NONAME - _ZN18ConvergedMessageIdC1Ei @ 31 NONAME - _ZN18ConvergedMessageIdC2ERKS_ @ 32 NONAME - _ZN18ConvergedMessageIdC2Ei @ 33 NONAME - _ZN18ConvergedMessageIdaSERKS_ @ 34 NONAME - _ZN23ConvergedMessageAddress10setAddressERK7QString @ 35 NONAME - _ZN23ConvergedMessageAddress11deserializeER11QDataStream @ 36 NONAME - _ZN23ConvergedMessageAddress8setAliasERK7QString @ 37 NONAME - _ZN23ConvergedMessageAddressC1ERK7QStringS2_ @ 38 NONAME - _ZN23ConvergedMessageAddressC2ERK7QStringS2_ @ 39 NONAME - _ZN23ConvergedMessageAddressD1Ev @ 40 NONAME - _ZN23ConvergedMessageAddressD2Ev @ 41 NONAME - _ZN26ConvergedMessageAttachment11deserializeER11QDataStream @ 42 NONAME - _ZN26ConvergedMessageAttachment11setFilePathERK7QString @ 43 NONAME - _ZN26ConvergedMessageAttachment17setAttachmentTypeEi @ 44 NONAME - _ZN26ConvergedMessageAttachmentC1ERK7QStringi @ 45 NONAME - _ZN26ConvergedMessageAttachmentC2ERK7QStringi @ 46 NONAME - _ZN26ConvergedMessageAttachmentD1Ev @ 47 NONAME - _ZN26ConvergedMessageAttachmentD2Ev @ 48 NONAME - _ZNK16ConvergedMessage10propertiesEv @ 49 NONAME - _ZNK16ConvergedMessage11attachmentsEv @ 50 NONAME - _ZNK16ConvergedMessage11fromAddressEv @ 51 NONAME - _ZNK16ConvergedMessage11messageTypeEv @ 52 NONAME - _ZNK16ConvergedMessage12sendingStateEv @ 53 NONAME - _ZNK16ConvergedMessage13ccAddressListEv @ 54 NONAME - _ZNK16ConvergedMessage13hasAttachmentEv @ 55 NONAME - _ZNK16ConvergedMessage13toAddressListEv @ 56 NONAME - _ZNK16ConvergedMessage14bccAddressListEv @ 57 NONAME - _ZNK16ConvergedMessage2idEv @ 58 NONAME - _ZNK16ConvergedMessage7subjectEv @ 59 NONAME - _ZNK16ConvergedMessage8bodyTextEv @ 60 NONAME - _ZNK16ConvergedMessage8isUnreadEv @ 61 NONAME - _ZNK16ConvergedMessage8locationEv @ 62 NONAME - _ZNK16ConvergedMessage8priorityEv @ 63 NONAME - _ZNK16ConvergedMessage9directionEv @ 64 NONAME - _ZNK16ConvergedMessage9serializeER11QDataStream @ 65 NONAME - _ZNK16ConvergedMessage9timeStampEv @ 66 NONAME - _ZNK18ConvergedMessageId5getIdEv @ 67 NONAME - _ZNK18ConvergedMessageId9serializeER11QDataStream @ 68 NONAME - _ZNK18ConvergedMessageIdeqERKS_ @ 69 NONAME - _ZNK23ConvergedMessageAddress5aliasEv @ 70 NONAME - _ZNK23ConvergedMessageAddress7addressEv @ 71 NONAME - _ZNK23ConvergedMessageAddress9serializeER11QDataStream @ 72 NONAME - _ZNK26ConvergedMessageAttachment14attachmentTypeEv @ 73 NONAME - _ZNK26ConvergedMessageAttachment8filePathEv @ 74 NONAME - _ZNK26ConvergedMessageAttachment9serializeER11QDataStream @ 75 NONAME - _ZNK26ConvergedMessageAttachmenteqERKS_ @ 76 NONAME - _ZN16ConvergedMessage17setMessageSubTypeENS_14MessageSubTypeE @ 77 NONAME - _ZNK16ConvergedMessage14messageSubTypeEv @ 78 NONAME + _ZN16ConvergedMessage12setReplyPathEb @ 9 NONAME + _ZN16ConvergedMessage12setTimeStampEx @ 10 NONAME + _ZN16ConvergedMessage14addAttachmentsER5QListIP26ConvergedMessageAttachmentE @ 11 NONAME + _ZN16ConvergedMessage14addCcRecipientER23ConvergedMessageAddress @ 12 NONAME + _ZN16ConvergedMessage14addToRecipientER23ConvergedMessageAddress @ 13 NONAME + _ZN16ConvergedMessage14setMessageTypeENS_11MessageTypeE @ 14 NONAME + _ZN16ConvergedMessage15addBccRecipientER23ConvergedMessageAddress @ 15 NONAME + _ZN16ConvergedMessage15addCcRecipientsER5QListIP23ConvergedMessageAddressE @ 16 NONAME + _ZN16ConvergedMessage15addToRecipientsER5QListIP23ConvergedMessageAddressE @ 17 NONAME + _ZN16ConvergedMessage15setSendingStateENS_12SendingStateE @ 18 NONAME + _ZN16ConvergedMessage16addBccRecipientsER5QListIP23ConvergedMessageAddressE @ 19 NONAME + _ZN16ConvergedMessage16addFromRecipientER23ConvergedMessageAddress @ 20 NONAME + _ZN16ConvergedMessage16setOriginatingSCERK7QString @ 21 NONAME + _ZN16ConvergedMessage17setMessageSubTypeENS_14MessageSubTypeE @ 22 NONAME + _ZN16ConvergedMessage9replyPathEv @ 23 NONAME + _ZN16ConvergedMessageC1ENS_11MessageTypeE @ 24 NONAME + _ZN16ConvergedMessageC1ERK18ConvergedMessageId @ 25 NONAME + _ZN16ConvergedMessageC1ERKS_ @ 26 NONAME + _ZN16ConvergedMessageC2ENS_11MessageTypeE @ 27 NONAME + _ZN16ConvergedMessageC2ERK18ConvergedMessageId @ 28 NONAME + _ZN16ConvergedMessageC2ERKS_ @ 29 NONAME + _ZN16ConvergedMessageD1Ev @ 30 NONAME + _ZN16ConvergedMessageD2Ev @ 31 NONAME + _ZN18ConvergedMessageId11deserializeER11QDataStream @ 32 NONAME + _ZN18ConvergedMessageId5setIdEi @ 33 NONAME + _ZN18ConvergedMessageIdC1ERKS_ @ 34 NONAME + _ZN18ConvergedMessageIdC1Ei @ 35 NONAME + _ZN18ConvergedMessageIdC2ERKS_ @ 36 NONAME + _ZN18ConvergedMessageIdC2Ei @ 37 NONAME + _ZN18ConvergedMessageIdaSERKS_ @ 38 NONAME + _ZN23ConvergedMessageAddress10setAddressERK7QString @ 39 NONAME + _ZN23ConvergedMessageAddress11deserializeER11QDataStream @ 40 NONAME + _ZN23ConvergedMessageAddress8setAliasERK7QString @ 41 NONAME + _ZN23ConvergedMessageAddressC1ERK7QStringS2_ @ 42 NONAME + _ZN23ConvergedMessageAddressC2ERK7QStringS2_ @ 43 NONAME + _ZN23ConvergedMessageAddressD1Ev @ 44 NONAME + _ZN23ConvergedMessageAddressD2Ev @ 45 NONAME + _ZN26ConvergedMessageAttachment11deserializeER11QDataStream @ 46 NONAME + _ZN26ConvergedMessageAttachment11setFilePathERK7QString @ 47 NONAME + _ZN26ConvergedMessageAttachment17setAttachmentTypeEi @ 48 NONAME + _ZN26ConvergedMessageAttachmentC1ERK7QStringi @ 49 NONAME + _ZN26ConvergedMessageAttachmentC2ERK7QStringi @ 50 NONAME + _ZN26ConvergedMessageAttachmentD1Ev @ 51 NONAME + _ZN26ConvergedMessageAttachmentD2Ev @ 52 NONAME + _ZNK16ConvergedMessage10propertiesEv @ 53 NONAME + _ZNK16ConvergedMessage11attachmentsEv @ 54 NONAME + _ZNK16ConvergedMessage11fromAddressEv @ 55 NONAME + _ZNK16ConvergedMessage11messageTypeEv @ 56 NONAME + _ZNK16ConvergedMessage12sendingStateEv @ 57 NONAME + _ZNK16ConvergedMessage13ccAddressListEv @ 58 NONAME + _ZNK16ConvergedMessage13hasAttachmentEv @ 59 NONAME + _ZNK16ConvergedMessage13originatingSCEv @ 60 NONAME + _ZNK16ConvergedMessage13toAddressListEv @ 61 NONAME + _ZNK16ConvergedMessage14bccAddressListEv @ 62 NONAME + _ZNK16ConvergedMessage14messageSubTypeEv @ 63 NONAME + _ZNK16ConvergedMessage2idEv @ 64 NONAME + _ZNK16ConvergedMessage7subjectEv @ 65 NONAME + _ZNK16ConvergedMessage8bodyTextEv @ 66 NONAME + _ZNK16ConvergedMessage8isUnreadEv @ 67 NONAME + _ZNK16ConvergedMessage8locationEv @ 68 NONAME + _ZNK16ConvergedMessage8priorityEv @ 69 NONAME + _ZNK16ConvergedMessage9directionEv @ 70 NONAME + _ZNK16ConvergedMessage9serializeER11QDataStream @ 71 NONAME + _ZNK16ConvergedMessage9timeStampEv @ 72 NONAME + _ZNK18ConvergedMessageId5getIdEv @ 73 NONAME + _ZNK18ConvergedMessageId9serializeER11QDataStream @ 74 NONAME + _ZNK18ConvergedMessageIdeqERKS_ @ 75 NONAME + _ZNK23ConvergedMessageAddress5aliasEv @ 76 NONAME + _ZNK23ConvergedMessageAddress7addressEv @ 77 NONAME + _ZNK23ConvergedMessageAddress9serializeER11QDataStream @ 78 NONAME + _ZNK26ConvergedMessageAttachment14attachmentTypeEv @ 79 NONAME + _ZNK26ConvergedMessageAttachment8filePathEv @ 80 NONAME + _ZNK26ConvergedMessageAttachment9serializeER11QDataStream @ 81 NONAME + _ZNK26ConvergedMessageAttachmenteqERKS_ @ 82 NONAME diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/tsrc.pro Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,25 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = subdirs + +CONFIG += symbian_test + +#Sub .pro files +SUBDIRS += unittest_unidatamodelloader + +# Platforms +SYMBIAN_PLATFORMS = DEFAULT \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/unittest_unidatamodelloader/data/SmileyFace.gif Binary file messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/unittest_unidatamodelloader/data/SmileyFace.gif has changed diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/unittest_unidatamodelloader/data/sample.txt diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/unittest_unidatamodelloader/data/testunidatamodelloader.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/unittest_unidatamodelloader/data/testunidatamodelloader.cfg Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,1 @@ +TestUniDataModelLoader diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/unittest_unidatamodelloader/inc/testunidatamodelloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/unittest_unidatamodelloader/inc/testunidatamodelloader.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef TEST_UNI_DATA_MODEL_LOADER_H +#define TEST_UNI_DATA_MODEL_LOADER_H + +#ifdef BUILD_TEST_DLL +#define TEST_EXPORT Q_DECL_EXPORT +#else +#define TEST_EXPORT Q_DECL_IMPORT +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include + +const TInt32 KUidBIOVCalenderMsg = {0x10005533}; // VCalender diary + +class UniDataModelPluginInterface; +class UniDataModelLoader; +class MsgObserver; +class S60QConversions; +class ConvergedMessage; +class CBIODatabase; +class ConvergedMessgageAddress; +class UniEditorPluginInterface; + +typedef enum + { // GENERATE A MESSAGE USING.... + ENoMessage, // .. error cases + EBioIapSettingsMessage, // .. IAP grammar, includes Internet settings + // Email settings, and logon scripts, + EBioEnpMessage, // .. Email Notification grammar. + EBioRingTonesMessage, // .. Ringing Tones binary data + EBioOpLogoMessage, // .. Logo for Operator service + EBioCompBusCardMessage, // .. Compact Business Card data + EBiovCardMessage, // .. virtual business card data + EBiovCalenderMessage, // .. vCalender data + EBioWAPSettingsMessage, // .. wap settings + EBioWPRVSettingsMessage // .. wprv settings + } TBIOMessageType; + + +class TEST_EXPORT TestUniDataModelLoader: public QObject +{ +Q_OBJECT + +private slots: + //called by frame work. + void initTestCase();//called before the first testfunction is executed. + void init();//called before each testfunction is executed. + + //test cases. + void testBioMessage(); + + void testMMSMessage(); + void testSMSMessage(); + + void cleanup();//called after every testfunction. + void cleanupTestCase();//called after the last testfunction was executed. + +private: + + UniDataModelPluginInterface* pluginInterface; + MsgObserver* iObserver; + CMsvSession* iMSession; + CClientMtmRegistry* iMtmReg; + TMsvId messageId; + UniDataModelLoader* pluginLoader; + QDateTime retTimeStamp; + RFs iFs; + CMsvEntry* iMsvEntry; + CBIODatabase* iBioDb; + TMsvId newEntryId; + HBufC* tempNumber; + TBufC currentFile; + TBool inbox; + +}; + +class MsgObserver : public MMsvSessionObserver +{ +public: + void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, + TAny* aArg3); +}; + +#endif //TEST_UNI_DATA_MODEL_LOADER_H diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/unittest_unidatamodelloader/inc/testunidatamodelloader.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/unittest_unidatamodelloader/inc/testunidatamodelloader.ini Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,15 @@ +//this file is used to provide predefined set of input data. + +//eg. +const char TEST_MSG_RECIEPIENT[] = "Shweta Singh<77>"; +const char TEST_MSG_FROM1[] = "88"; +const char TEST_MSG_ALIAS1[] = "Shweta Singh"; +const char TEST_MSG_FROM2[] = "999"; +const char TEST_MSG_SUBJECT[] = "Hi"; +const char TEST_MSG_BODY[] = "Hello"; +const char TEST_SERVICE_NAME_MMS[] = "messaging.mserver.testservice.MMS"; +const char TEST_SENDER[] = "+918888"; +const char TEST_ATTACHMENT4[] = "c:\\SmileyFace.gif"; +const char TEST_ATTACHMENT5[] = "c:\\sample.txt"; +const char TEST_CC[] = "DummyCCAddress"; +const char TEST_BCC[] = "DummyBCCAddress"; diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/unittest_unidatamodelloader/src/testunidatamodelloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/unittest_unidatamodelloader/src/testunidatamodelloader.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -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: + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "convergedmessageaddress.h" + +#include "testunidatamodelloader.h" +#include +#include "testunidatamodelloader.ini" +#include "unidatamodelplugininterface.h" +#include +#include + +const TInt KTelephoneNumberMaxLength = 32; + +// vCalender +_LIT(KUnixEpoch, "19700000:000000.000000"); +#define KBioUidValue 0x10001262 + +const TUid KBioUidValueUid = {KBioUidValue}; + + +//--------------------------------------------------------------- +//Main entry point +//--------------------------------------------------------------- +int main(int argc, char *argv[]) + { + int ret = -1; + QCoreApplication app(argc, argv); + QObject* tc = new TestUniDataModelLoader(); + +#ifdef __WINSCW__ + char *new_argv[3]; + QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; + QByteArray bytes = str.toAscii(); + char arg1[] = "-o"; + new_argv[0] = argv[0]; + new_argv[1] = arg1; + new_argv[2] = bytes.data(); + ret = QTest::qExec(tc, 3, new_argv); +#else + ret = QTest::qExec(tc, argc, argv); +#endif + delete tc; + return ret; + + } +//--------------------------------------------------------------- +// TestUniDataModelLoader::init +//--------------------------------------------------------------- + + +void TestUniDataModelLoader::initTestCase() +{ + iObserver = new (ELeave) MsgObserver(); + + // Create a new messaging server session.. + iMSession = CMsvSession::OpenSyncL(*iObserver); + + iMsvEntry = iMSession->GetEntryL(KMsvRootIndexEntryId); + newEntryId = 0; + pluginLoader = new UniDataModelLoader(); + + retTimeStamp = QDateTime::currentDateTime(); + int err = iFs.Connect(); + QVERIFY(err == 0); + iBioDb = CBIODatabase::NewL(iFs); + iFs.SetSessionPath(_L("c:\\")); + inbox = EFalse; +} + +//--------------------------------------------------------------- +// TestUniDataModelLoader::cleanupTestCase +//--------------------------------------------------------------- + +void TestUniDataModelLoader::cleanupTestCase() +{ + delete iMsvEntry; + iMsvEntry = NULL; + delete iObserver; + iObserver = NULL; + delete iMSession; + iMSession = NULL; + delete pluginLoader; +} + + +//--------------------------------------------------------------- +// TestUniDataModelLoader::init +//--------------------------------------------------------------- + +void TestUniDataModelLoader::init() +{ + +} + +//--------------------------------------------------------------- +// TestUniDataModelLoader::cleanup +//--------------------------------------------------------------- +void TestUniDataModelLoader::cleanup() +{ + + +} + +//--------------------------------------------------------------- +// TestUniDataModelLoader::testSMSMessage +//--------------------------------------------------------------- + +void TestUniDataModelLoader::testSMSMessage() +{ + QString subject = TEST_MSG_SUBJECT; + qint64 timeStamp = QDateTime::currentDateTime().toTime_t(); + QString sender(TEST_SENDER); + ConvergedMessageAddress address(sender); + ConvergedMessage msg; + msg.setMessageType(ConvergedMessage::Sms); + msg.setSubject(subject); + msg.setTimeStamp(timeStamp); + msg.addToRecipient(address); + msg.setBodyText( TEST_MSG_BODY); + msg.setPriority(ConvergedMessage::Normal); + //Adding alias + ConvergedMessageAddress address1; + address1.setAlias(QString(TEST_MSG_RECIEPIENT)); + msg.addToRecipient(address1); + + pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); + + QVERIFY( pluginInterface != NULL ); + + QString msgType = pluginInterface->messageType(); + + qDebug() <<"msgType" << msgType; + QCOMPARE(msgType, QString("sms")); + + qDebug() <<"UnidataModel Loader for SMS Created Successfully"; + +} + + +//--------------------------------------------------------------- +// TestUniDataModelLoader::testMMSMessage +//--------------------------------------------------------------- + +void TestUniDataModelLoader::testMMSMessage() +{ + 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); + + pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Mms); + pluginInterface->setMessageId(newEntryId); + + QVERIFY( pluginInterface != NULL ); + + QString msgType = pluginInterface->messageType(); + + qDebug() <<"msgType" << msgType; + QCOMPARE(msgType, QString("mms")); + + qDebug() <<"UnidataModel Loader for MMS Created Successfully"; + int count = pluginInterface->attachmentCount(); + QVERIFY(count == 1); + +} + +//--------------------------------------------------------------- +// TestUniDataModelLoader::testBioMessage +//--------------------------------------------------------------- + +void TestUniDataModelLoader::testBioMessage() +{ + inbox = ETrue; + pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg); + + QVERIFY( pluginInterface != NULL ); + + QString msgType = pluginInterface->messageType(); + + qDebug() <<"msgType" << msgType; + QCOMPARE(msgType, QString("biomessage")); + + qDebug() <<"UnidataModel Loader for Biomessage Created Successfully"; + + +} + + +//--------------------------------------------------------------- +// TestUniDataModelLoader::HandleSessionEventL +//--------------------------------------------------------------- + +void MsgObserver::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, + TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) +{ +} diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/unittest_unidatamodelloader/testunidatamodelloader.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/unittest_unidatamodelloader/testunidatamodelloader.pro Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,106 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +QT += testlib +QT -= gui + +TEMPLATE = app +TARGET = testunidatamodelloader + +CONFIG += hb +CONFIG += symbian_test + + +INCLUDEPATH += inc +INCLUDEPATH += ../../../../../../inc +INCLUDEPATH += ../../../../../../../inc +INCLUDEPATH += ../../../../../../../../../../epoc32/include/platform/mw +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +DEFINES += BUILD_TEST_DLL + +SOURCES += \ + src/testunidatamodelloader.cpp + + +# Input +HEADERS += \ + inc/testunidatamodelloader.h + + + +SYMBIAN_PLATFORMS = WINSCW ARMV5 + symbian { + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.EPOCSTACKSIZE = 0x8000 + TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000 + TARGET.EPOCALLOWDLLDATA = 1 + BLD_INF_RULES.prj_exports += "testunidatamodelloader.cfg c:/testunidatamodelloader.cfg" + BLD_INF_RULES.prj_exports += "data/SmileyFace.gif c:/SmileyFace.gif" + BLD_INF_RULES.prj_exports += "data/sample.txt c:/sample.txt" + } + + + +packageheader = "$${LITERAL_HASH}{\"QTestUnidataModelLoader\"},(0xEadfc3ef.),1,0,0,TYPE=SA" + +vendorinfo = \ + "; Localised Vendor name" \ + "%{\"Nokia\"}" \ + "; Unique Vendor name" \ + ":\"Nokia\"" + +dependencyinfo = \ + "; Default HW/platform dependencies" \ + "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ + "[0x2001E61C],4,6,3,{"Qt"} + +default_deployment.pkg_prerules = packageheader \ + vendorinfo \ + dependencyinfo + + + LIBS += -leuser \ + -lconvergedmessageutils\ + -lmsgs \ + -lsmcm \ + -lgsmu \ + -letext \ + -lmsgs \ + -lunidatamodelloader\ + -lQtCore \ + -lbioc \ + -lefsrv \ + -lbiodb \ + -lxqutils \ + -lbifu + +#Copy the dependent DLL +symbian: { + addCfg.sources = ./data/testunidatamodelloader.cfg + addCfg.path = C:/ + DEPLOYMENT += addCfg + + addP2.sources = ./data/SmileyFace.gif + addP2.path = C:/ + DEPLOYMENT += addP2 + + addP3.sources = ./data/sample.txt + addP3.path = C:/ + DEPLOYMENT += addP3 + + } + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/bwins/test_unidatamodel_mms_pluginu.def --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/bwins/test_unidatamodel_mms_pluginu.def Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -EXPORTS - ?createMMS@TestUniDataModelMMSPlugin@@AAEXJH@Z @ 1 NONAME ; void TestUniDataModelMMSPlugin::createMMS(long, int) - ?testOutboxMessage@TestUniDataModelMMSPlugin@@AAEXXZ @ 2 NONAME ; void TestUniDataModelMMSPlugin::testOutboxMessage(void) - ?tr@TestUniDataModelMMSPlugin@@SA?AVQString@@PBD0H@Z @ 3 NONAME ; class QString TestUniDataModelMMSPlugin::tr(char const *, char const *, int) - ?cleanup@TestUniDataModelMMSPlugin@@AAEXXZ @ 4 NONAME ; void TestUniDataModelMMSPlugin::cleanup(void) - ?staticMetaObject@TestUniDataModelMMSPlugin@@2UQMetaObject@@B @ 5 NONAME ; struct QMetaObject const TestUniDataModelMMSPlugin::staticMetaObject - ?initTestCase@TestUniDataModelMMSPlugin@@AAEXXZ @ 6 NONAME ; void TestUniDataModelMMSPlugin::initTestCase(void) - ?testInboxMessage@TestUniDataModelMMSPlugin@@AAEXXZ @ 7 NONAME ; void TestUniDataModelMMSPlugin::testInboxMessage(void) - ?tr@TestUniDataModelMMSPlugin@@SA?AVQString@@PBD0@Z @ 8 NONAME ; class QString TestUniDataModelMMSPlugin::tr(char const *, char const *) - ?getStaticMetaObject@TestUniDataModelMMSPlugin@@SAABUQMetaObject@@XZ @ 9 NONAME ; struct QMetaObject const & TestUniDataModelMMSPlugin::getStaticMetaObject(void) - ?metaObject@TestUniDataModelMMSPlugin@@UBEPBUQMetaObject@@XZ @ 10 NONAME ; struct QMetaObject const * TestUniDataModelMMSPlugin::metaObject(void) const - ?testInboxImageMMSMessage@TestUniDataModelMMSPlugin@@AAEXXZ @ 11 NONAME ; void TestUniDataModelMMSPlugin::testInboxImageMMSMessage(void) - ?init@TestUniDataModelMMSPlugin@@AAEXXZ @ 12 NONAME ; void TestUniDataModelMMSPlugin::init(void) - ?qt_metacast@TestUniDataModelMMSPlugin@@UAEPAXPBD@Z @ 13 NONAME ; void * TestUniDataModelMMSPlugin::qt_metacast(char const *) - ?testGetPluginWithoutLoading@TestUniDataModelMMSPlugin@@AAEXXZ @ 14 NONAME ; void TestUniDataModelMMSPlugin::testGetPluginWithoutLoading(void) - ?trUtf8@TestUniDataModelMMSPlugin@@SA?AVQString@@PBD0@Z @ 15 NONAME ; class QString TestUniDataModelMMSPlugin::trUtf8(char const *, char const *) - ?trUtf8@TestUniDataModelMMSPlugin@@SA?AVQString@@PBD0H@Z @ 16 NONAME ; class QString TestUniDataModelMMSPlugin::trUtf8(char const *, char const *, int) - ?createInboxImageMMS@TestUniDataModelMMSPlugin@@AAEXXZ @ 17 NONAME ; void TestUniDataModelMMSPlugin::createInboxImageMMS(void) - ?testPluginLoading@TestUniDataModelMMSPlugin@@AAEXXZ @ 18 NONAME ; void TestUniDataModelMMSPlugin::testPluginLoading(void) - ?cleanupTestCase@TestUniDataModelMMSPlugin@@AAEXXZ @ 19 NONAME ; void TestUniDataModelMMSPlugin::cleanupTestCase(void) - ?qt_metacall@TestUniDataModelMMSPlugin@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 20 NONAME ; int TestUniDataModelMMSPlugin::qt_metacall(enum QMetaObject::Call, int, void * *) - ?testPluginLoadingMultipleTimes@TestUniDataModelMMSPlugin@@AAEXXZ @ 21 NONAME ; void TestUniDataModelMMSPlugin::testPluginLoadingMultipleTimes(void) - diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/data/TestUnidataModelMMSPluginPhoto.jpg Binary file messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/data/TestUnidataModelMMSPluginPhoto.jpg has changed diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/inc/testunidatamodelmmsplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/inc/testunidatamodelmmsplugin.h Tue Aug 31 18:53:38 2010 +0530 @@ -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: Main test class declaration for MMS Data Plugin + */ + +#ifndef TESTUNIDATAMODELMMSPLUGIN_H_ +#define TESTUNIDATAMODELMMSPLUGIN_H_ + +#ifdef BUILD_TESTUNIDATAMODELMMSPLUGIN_DLL +#define TEST_EXPORT Q_DECL_EXPORT +#else +#define TEST_EXPORT Q_DECL_IMPORT +#endif + +#include +#include +#include +#include +#include +#include +#include + +//Forward Declarations +class UniDataModelPluginInterface; +class UniDataModelLoader; +class TestObserverMMS; +class CMmsClientMtm; +class ConvergedMessage; +class RFs; + +//Class Declaration +class TEST_EXPORT TestUniDataModelMMSPlugin : 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. + + /** + * Tests that the MMS message is created successfully in the Inbox Folder + **/ + void testInboxMessage(); + + /** + * 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: + + /** + * Creates the MMS message in the Inbox Folder + **/ + void createMMS(TMsvId pId, TBool subjectField); + +private: //Data + + /** + * pluginInterface - UniDataMMSPlug-in + **/ + UniDataModelPluginInterface* pluginInterface; + + /** + * pluginLoader - UniDataPlug-in Loader + **/ + UniDataModelLoader* pluginLoader; + + /** + * iObserver - Observer pointer For Test Class + **/ + TestObserverMMS* iObserver; + + /** + * iMSession - Session + **/ + CMsvSession* iMSession; + + /** + * iMmsClientMtm - MMS Client MTM + **/ + CMmsClientMtm* iMmsClientMtm; + + /** + * iMessageId - MMS Message ID of the MMS created in the Inbox Folder + **/ + TMsvId iMessageId; + + /** + * retTimeStamp - Timestamp for the MMS being Created + **/ + QDateTime retTimeStamp; + + /** + * iFs - File Server + **/ + RFs iFs; + + /** + * iServiceId - MMS Service Id + **/ + TMsvId iServiceId; + + /** + * msgSize - Size of the MMS message created in the Inbox Folder + **/ + TInt msgSize; +}; + +//Observer Class Declaration +class TestObserverMMS : public MMsvSessionObserver +{ +public: + + /** + * Handles various outcome Events after the different services like Creation, Sending, etc. of a MMS Message + **/ + void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, + TAny* aArg3); +}; + +#endif /* TESTUNIDATAMODELMMSPLUGIN_H_ */ diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/inc/testunidatamodelmmsplugin.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/inc/testunidatamodelmmsplugin.ini Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,9 @@ +const char TEST_MSG_FROM1[] = "9741596546"; +const char TEST_MSG_RECIEPIENT1[] = "9741596546"; +const char TEST_MSG_RECIEPIENT2[] = "9741596547"; +const char TEST_MSG_RECIEPIENT3[] = "9741596548"; +const char TEST_MSG_SUBJECT[] = "This is an MMS"; + +_LIT(KUnixEpoch, "19700000:000000.000000"); +_LIT(KRootPath, "c:\\" ); +_LIT(KPictureFileName, "C:\\data\\TestUnidataModelMMSPluginPhoto.jpg"); diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/photo.jpg Binary file messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/photo.jpg has changed diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/src/testunidatamodelmmsplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/src/testunidatamodelmmsplugin.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,372 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 Data Plugin + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "debugtraces.h" +#include "convergedmessageaddress.h" +#include "testunidatamodelmmsplugin.h" +#include "testunidatamodelmmsplugin.ini" +#include "xqconversions.h" +#include "unidatamodelplugininterface.h" +#include "unidatamodelloader.h" + +//--------------------------------------------------------------- +// TestUniDataModelPlugin::initTestCase +//--------------------------------------------------------------- +void TestUniDataModelMMSPlugin::initTestCase() + { + iObserver = new (ELeave) TestObserverMMS(); + + // Create a new messaging server session.. + TRAPD(err,iMSession = CMsvSession::OpenSyncL(*iObserver)); + if(err) + { + TInt x = err; + } + + // Create the client mtm registry + CClientMtmRegistry* mtmReg = CClientMtmRegistry::NewL(*iMSession); + + // Get the MMS clientmtm + iMmsClientMtm = static_cast (mtmReg->NewMtmL(KUidMsgTypeMultimedia)); + + //Connecting to File Server Session + User::LeaveIfError( iFs.Connect() ); + iFs.SetSessionPath( KRootPath ); + + //Getting Service ID for MMS + CMmsSettings* settings = CMmsSettings::NewL(); + settings->LoadSettingsL(); + iServiceId = settings->Service(); + + iMessageId = 0; + + //Saving the Timestamp before Message is created + retTimeStamp = QDateTime::currentDateTime(); + + // Get the MMS data modelplugin + pluginLoader = new UniDataModelLoader; + pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Mms); + } + +//--------------------------------------------------------------- +// TestUniDataModelPlugin::init +//--------------------------------------------------------------- +void TestUniDataModelMMSPlugin::init() +{ +} + +//--------------------------------------------------------------- +// TestUniDataModelPlugin::testInboxMessage +//--------------------------------------------------------------- +void TestUniDataModelMMSPlugin::testInboxMessage() + { + //Create the MMS First + createMMS(KMsvGlobalInBoxIndexEntryIdValue,ETrue); + + QTest::qWait(50000); //to ensure path completion + + //MMS Message created, will now be validated + + //Checking if Another Instance of MMS Data Plugin can be created form an existing one + QObject* anotherInstance = pluginInterface->createInstance(); + QVERIFY(anotherInstance != NULL); + delete anotherInstance; + + //Setting a Message ID, thereby populating the MMS message at the Plugin + QVERIFY(pluginInterface->setMessageId(iMessageId) == KErrNone); + + //Verifying the MMS message size + QVERIFY(pluginInterface->messageSize() == msgSize); + + //Verifying the MMS timestamp + QVERIFY(pluginInterface->timeStamp() == retTimeStamp); + + //Verifying is the MMP Plugin works file afetr it has been Reset and Restored + pluginInterface->reset(); + pluginInterface->restore(*iMmsClientMtm); + QVERIFY(pluginInterface->setMessageId(iMessageId) == KErrNone); + + //Subject Verification + QVERIFY(pluginInterface->subject().compare(QString(TEST_MSG_SUBJECT)) == 0); + + //MMS message have no Body String + QString body; + pluginInterface->body(body); + QVERIFY(body == QString("")); + + //Message type verification + QVERIFY(pluginInterface->messageType().compare(QString("mms")) == 0); + + //Fetch the To List + ConvergedMessageAddressList recipientList; + pluginInterface->toRecipientList(recipientList); + QVERIFY(recipientList.count() != 0); + QVERIFY(recipientList[0]->address().compare(QString(TEST_MSG_RECIEPIENT1)) == 0); + + //Fetch the CC List + ConvergedMessageAddressList recipientList2; + pluginInterface->ccRecipientList(recipientList2); + QVERIFY(recipientList2.count() != 0); + QVERIFY(recipientList2[0]->address().compare(QString(TEST_MSG_RECIEPIENT2)) == 0); + + //Fetch the BCC List + ConvergedMessageAddressList recipientList3; + pluginInterface->bccRecipientList(recipientList3); + QVERIFY(recipientList3.count() != 0); + QVERIFY(recipientList3[0]->address().compare(QString(TEST_MSG_RECIEPIENT3)) == 0); + + //Fetch the From Address + QString recepient(TEST_MSG_FROM1); + QString fromaddress; + pluginInterface->fromAddress(fromaddress); + QVERIFY(recepient == fromaddress); + + //Verifying Attachments + UniMessageInfoList attList = pluginInterface->attachmentList(); + QVERIFY(attList.count() == 0); + + QVERIFY(pluginInterface->hasAttachment() == false); + + QVERIFY(pluginInterface->attachmentCount() == 0); + + QVERIFY(pluginInterface->messagePriority() == 1); + + //Verifying various objects added to the MMS Message during creation + QVERIFY(pluginInterface->objectCount() == 2); + + UniMessageInfoList objectlist = pluginInterface->objectList(); + QVERIFY(!objectlist.isEmpty()); + + QVERIFY(objectlist[1]->path().contains(QString("TestUnidataModelMMSPluginPhoto.jpg"), Qt::CaseInsensitive) == true); + QVERIFY(objectlist[1]->mimetype().contains(QString("image/jpeg"), Qt::CaseInsensitive) == true); + + QVERIFY(pluginInterface->slideCount() == 1); + + QVERIFY(pluginInterface->slideContent(0)[0]->path().contains(QString("Story.txt"), Qt::CaseInsensitive) == true); + QVERIFY(pluginInterface->slideContent(0)[0]->mimetype().contains(QString("text/plain"), Qt::CaseInsensitive) == true); + + //Verifying if the plugin returns the correct session, thus will correctly delete the MMS we just created + CMsvSession* msvSession = pluginInterface->session(); + QVERIFY(msvSession != NULL); + msvSession->RemoveEntry(iMessageId); + + qDebug() << "Verified Test MMS Successfully"; + } + +//--------------------------------------------------------------- +// TestUniDataModelPlugin::cleanup +//--------------------------------------------------------------- +void TestUniDataModelMMSPlugin::cleanup() +{ +} + +//--------------------------------------------------------------- +// TestUniDataModelPlugin::cleanupTestCase +//--------------------------------------------------------------- +void TestUniDataModelMMSPlugin::cleanupTestCase() + { + //Cleanup + delete pluginInterface; + delete pluginLoader; + delete iMmsClientMtm; + delete iMSession; + delete iObserver; + } + +//--------------------------------------------------------------- +// TestUniDataModelPlugin::createMMS +//--------------------------------------------------------------- +void TestUniDataModelMMSPlugin::createMMS(TMsvId pId, TBool subjectField) + { + TMsvEntry indexEntry; + indexEntry.iType = KUidMsvMessageEntry; + indexEntry.iMtm = KUidMsgTypeMultimedia; + indexEntry.iServiceId = iServiceId; + indexEntry.iDate.HomeTime(); + + // Convert TTime to QDateTime , this will be used for comparing the time of mesage + // when fetched from datamodel + TTime unixEpoch(KUnixEpoch); + TTimeIntervalSeconds seconds; + TTime timeStamp = indexEntry.iDate; + timeStamp.SecondsFrom(unixEpoch, seconds); + retTimeStamp.setTime_t(seconds.Int()); + + TMsvId parentId = pId; + CMsvEntry* entry = CMsvEntry::NewL(*iMSession,parentId,TMsvSelectionOrdering()); + CleanupStack::PushL(entry); + + entry->SetEntryL(parentId); + entry->CreateL(indexEntry); + entry->SetEntryL(indexEntry.Id()); + iMmsClientMtm->SwitchCurrentEntryL(entry->EntryId()); + + CMsvStore* store = iMmsClientMtm->Entry().EditStoreL(); + CleanupStack::PushL(store); + + //MMS Message ID Saved + iMessageId = indexEntry.Id(); + + //Adding Subject + if(subjectField) + { + QString subject(TEST_MSG_SUBJECT); + HBufC* subj = XQConversions::qStringToS60Desc(subject); + iMmsClientMtm->SetSubjectL(*subj); + } + + //Adding Sender + QString sender(TEST_MSG_FROM1); + HBufC* addr = XQConversions::qStringToS60Desc(sender); + + if (addr) + { + CleanupStack::PushL(addr); + TBuf<32> name; + name.Copy(addr->Left(32)); + indexEntry.iDetails.Set(name); + + iMmsClientMtm->SetSenderL(*addr); + + CleanupStack::PopAndDestroy(addr); + } + + //Adding Recipient + QString recipient(TEST_MSG_RECIEPIENT1); + HBufC* addr2 = XQConversions::qStringToS60Desc(recipient); + if (addr2) + { + CleanupStack::PushL(addr2); + iMmsClientMtm->AddAddresseeL(EMsvRecipientTo,*addr2); + CleanupStack::PopAndDestroy(addr2); + } + + //Adding cCRecipient + QString recipient2(TEST_MSG_RECIEPIENT2); + HBufC* addr3 = XQConversions::qStringToS60Desc(recipient2); + if (addr3) + { + CleanupStack::PushL(addr3); + iMmsClientMtm->AddAddresseeL(EMsvRecipientCc,*addr3); + CleanupStack::PopAndDestroy(addr3); + } + + //Adding bCCRecipient + QString recipient3(TEST_MSG_RECIEPIENT3); + HBufC* addr4 = XQConversions::qStringToS60Desc(recipient3); + if (addr4) + { + CleanupStack::PushL(addr4); + iMmsClientMtm->AddAddresseeL(EMsvRecipientBcc,*addr4); + CleanupStack::PopAndDestroy(addr4); + } + + //Create Text Attachment + TMsvAttachmentId attaId = 0; + TFileName attachmentFile( _L("story.txt") ); + TBufC<12> story = _L( "Hello world!" ); + + iMmsClientMtm->CreateTextAttachmentL(*store, attaId, story, attachmentFile, ETrue ); + qDebug() << "Text Attachment id" << attaId; + + //Image Attachment added to the message entry + RFile attaFile; + // Set filename of attachment + TFileName name( KPictureFileName ); + + CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL(); + CleanupStack::PushL( mimeHeaders ); + + // Set values to mime headers + mimeHeaders->SetContentTypeL( _L8( "image") ); + mimeHeaders->SetContentSubTypeL( _L8( "jpeg" ) ); + + _LIT8(KMimeType, "image/jpeg"); + TBufC8<10> mimeType(KMimeType); + // CreateAttachment2L will set the content type to attachment Info + + // Open the attachment file for reading + attaFile.Open( iFs, name, EFileShareReadersOnly | EFileRead ); + CleanupClosePushL(attaFile); + + CMsvAttachment* attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); + // attaInfo ownerhip will be transferred to Attachment Manager. + // It must not be pushed onto the cleanupStack before calling + // CreateAttachment2L. + + iMmsClientMtm->CreateAttachment2L(*store, attaFile,mimeType,*mimeHeaders,attaInfo,attaId); + qDebug() << "Image Attachment id" << attaId; + + // Now Attachment Manager owns the attaInfo + CleanupStack::Pop(); // attaFile.Close() + CleanupStack::PopAndDestroy(); // mimeHeaders + + store->CommitL(); + + CleanupStack::PopAndDestroy(store); // store + + iMmsClientMtm->SaveMessageL(); + + //Saving the message size for future checking + msgSize = iMmsClientMtm->MessageSize(); + + CleanupStack::Pop(entry); // entry + } + +//--------------------------------------------------------------- +// TestObserverMMS::HandleSessionEventL +//--------------------------------------------------------------- +void TestObserverMMS::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, + TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) +{ +} + +//--------------------------------------------------------------- +// main +// main entry point +//--------------------------------------------------------------- +int main(int argc, char *argv[]) + { + int ret = -1; + QCoreApplication app(argc, argv); + QObject* tc = new TestUniDataModelMMSPlugin(); + +#ifdef __WINSCW__ + char *new_argv[3]; + QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; + QByteArray bytes = str.toAscii(); + char arg1[] = "-o"; + new_argv[0] = argv[0]; + new_argv[1] = arg1; + new_argv[2] = bytes.data(); + ret = QTest::qExec(tc, 3, new_argv); +#else + ret = QTest::qExec(tc, argc, argv); +#endif + + delete tc; + return ret; + } + +//End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.cpp --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.cpp Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,496 +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 "serviceinfo.h" -#include -#include -#include -#include "convergedmessage.h" -#include -#include "unidatamodelplugininterface.h" -#include "unidatamodelloader.h" -#include -#include -#include -#include -#include "convergedmessageaddress.h" -#include "testunidatamodelmmsplugin.h" -#include "testunidatamodelmmsplugin.ini" -#include - -_LIT(KUnixEpoch, "19700000:000000.000000"); -_LIT( KRootPath, "c:\\" ); - - -void TestUniDataModelMMSPlugin::initTestCase() - { - iObserver = new (ELeave) TestObserverMMS(); - - // Create a new messaging server session.. - TRAPD(err,iMSession = CMsvSession::OpenSyncL(*iObserver)); - if(err) - { - TInt x=err; - } - // Create the client mtm registry - iMtmReg = CClientMtmRegistry::NewL(*iMSession); - - // Get the MMS clientmtm - iMmsClientMtm = (CMmsClientMtm *) iMtmReg->NewMtmL(KUidMsgTypeMultimedia); - - User::LeaveIfError( iFs.Connect() ); - iFs.SetSessionPath( KRootPath ); - iSettings = CMmsSettings::NewL(); - iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion()); - iSettings->LoadSettingsL(); - iServiceId = iSettings->Service(); - - iMessageId = 0; - pluginLoader = new UniDataModelLoader(); - retTimeStamp = QDateTime::currentDateTime(); - } - -void TestUniDataModelMMSPlugin::cleanupTestCase() - { - for(TInt i=0; iEntry().DeleteL(idArr[i]); - } - - delete iObserver; - delete iMmsClientMtm; - delete iMtmReg; - delete iMSession; - delete pluginLoader; - } - - -//--------------------------------------------------------------- -// TestUniDataModelPlugin::init -//--------------------------------------------------------------- - -void TestUniDataModelMMSPlugin::init() -{ -/* iObserver = new (ELeave) TestObserverMMS(); - - // Create a new messaging server session.. - TRAPD(err,iMSession = CMsvSession::OpenSyncL(*iObserver)); - if(err) - { - TInt x=err; - } - // Create the client mtm registry - iMtmReg = CClientMtmRegistry::NewL(*iMSession); - - // Get the MMS clientmtm - iMmsClientMtm = (CMmsClientMtm *) iMtmReg->NewMtmL(KUidMsgTypeMultimedia); - - User::LeaveIfError( iFs.Connect() ); - iFs.SetSessionPath( KRootPath ); - iSettings = CMmsSettings::NewL(); - iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion()); - iSettings->LoadSettingsL(); - iServiceId = iSettings->Service(); - - iMessageId = 0; - pluginLoader = new UniDataModelLoader(); - retTimeStamp = QDateTime::currentDateTime();*/ -} - -//--------------------------------------------------------------- -// TestUniDataModelPlugin::cleanup -//--------------------------------------------------------------- -void TestUniDataModelMMSPlugin::cleanup() -{ - - /* - for(TInt i=0; iEntry().DeleteL(idArr[i]); - } - - delete iObserver; - delete iMmsClientMtm; - delete iMtmReg; - delete iMSession; - delete pluginLoader;*/ -} - - -void TestUniDataModelMMSPlugin::createMMS(TMsvId pId, TBool subjectField) - { - TMsvEntry indexEntry; - indexEntry.iType = KUidMsvMessageEntry; - indexEntry.iMtm = KUidMsgTypeMultimedia; - indexEntry.iServiceId = iServiceId; - indexEntry.iDate.HomeTime(); - - // Convert TTime to QDateTime , this will be used for comparing the time of mesage - // when fetched from datamodel - TTime unixEpoch(KUnixEpoch); - TTimeIntervalSeconds seconds; - TTime timeStamp = indexEntry.iDate; - timeStamp.SecondsFrom(unixEpoch, seconds); - retTimeStamp.setTime_t(seconds.Int()); - - - TMsvId parentId = pId; - CMsvEntry* entry = CMsvEntry::NewL(*iMSession,parentId,TMsvSelectionOrdering()); - CleanupStack::PushL(entry); - - entry->SetEntryL(parentId); - entry->CreateL(indexEntry); - entry->SetEntryL(indexEntry.Id()); - iMmsClientMtm->SwitchCurrentEntryL(entry->EntryId()); - - //iMmsClientMtm->LoadMessageL(); - - CMsvStore* store = iMmsClientMtm->Entry().EditStoreL(); - CleanupStack::PushL(store); - - iMessageId = indexEntry.Id(); - idArr.Append(iMessageId); - - if(subjectField) - { - QString subject(TEST_MSG_SUBJECT); - HBufC* subj = XQConversions::qStringToS60Desc(subject); - iMmsClientMtm->SetSubjectL(*subj); - } - - //Sender - QString sender(TEST_MSG_FROM1); - HBufC* addr = XQConversions::qStringToS60Desc(sender); - - - if (addr) - { - CleanupStack::PushL(addr); - TBuf<32> name; - name.Copy(addr->Left(32)); - indexEntry.iDetails.Set(name); - - iMmsClientMtm->SetSenderL(*addr); - - CleanupStack::PopAndDestroy(addr); - } - - //Recipient - QString recipient(TEST_MSG_RECIEPIENT1); - HBufC* addr2 = XQConversions::qStringToS60Desc(recipient); - if (addr2) - { - CleanupStack::PushL(addr2); - iMmsClientMtm->AddAddresseeL(EMsvRecipientTo,*addr2); - CleanupStack::PopAndDestroy(addr2); - } - - QString recipient2(TEST_MSG_RECIEPIENT2); - HBufC* addr3 = XQConversions::qStringToS60Desc(recipient2); - if (addr3) - { - CleanupStack::PushL(addr3); - iMmsClientMtm->AddAddresseeL(EMsvRecipientCc,*addr3); - CleanupStack::PopAndDestroy(addr3); - } - - QString recipient3(TEST_MSG_RECIEPIENT3); - HBufC* addr4 = XQConversions::qStringToS60Desc(recipient3); - if (addr4) - { - CleanupStack::PushL(addr4); - iMmsClientMtm->AddAddresseeL(EMsvRecipientBcc,*addr4); - CleanupStack::PopAndDestroy(addr4); - } - - //Create Text Attachment - TMsvAttachmentId attaId = 0; - TFileName attachmentFile( _L("story.txt") ); - TBufC<12> story = _L( "Hello world!" ); - - iMmsClientMtm->CreateTextAttachmentL(*store, attaId, story, attachmentFile, ETrue ); - msgSize = iMmsClientMtm->MessageSize(); - - store->CommitL(); - CleanupStack::PopAndDestroy(); // store - - iMmsClientMtm->SaveMessageL(); - } - -void TestUniDataModelMMSPlugin::testInboxMessage() - { - createMMS(KMsvGlobalInBoxIndexEntryIdValue,ETrue); - - // Get the MMS data modelplugin - pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Mms); - - pluginInterface->setMessageId(iMessageId); - - int size = pluginInterface->messageSize(); - QVERIFY(size == msgSize); - - QVERIFY(pluginInterface->timeStamp() == retTimeStamp); - - - //Fetch the To List - ConvergedMessageAddressList recipientList; - pluginInterface->toRecipientList(recipientList); - QVERIFY(recipientList.count() != 0); - - ConvergedMessageAddressList recipientList2; - pluginInterface->ccRecipientList(recipientList2); - QVERIFY(recipientList2.count() != 0); - - ConvergedMessageAddressList recipientList3; - pluginInterface->bccRecipientList(recipientList3); - QVERIFY(recipientList3.count() != 0); - - QString recepient(TEST_MSG_FROM1); - QString fromaddress; - pluginInterface->fromAddress(fromaddress); - QVERIFY(recepient == fromaddress); - - UniMessageInfoList attList = pluginInterface->attachmentList(); - QVERIFY(attList.count() != 0); - - TInt attCount =0; - attCount = pluginInterface->attachmentCount(); - QVERIFY(attCount != 0); - - MsgPriority priority = pluginInterface->messagePriority(); - // Normal priority - qDebug() << "prority" << priority; - QVERIFY(priority == 1); - - QVERIFY(pluginInterface->objectCount() == 1); - - UniMessageInfoList objectlist = pluginInterface->objectList(); - QVERIFY(!objectlist.isEmpty()); - - QVERIFY(pluginInterface->slideCount() == 0); - - TRAPD(err, iMmsClientMtm->SwitchCurrentEntryL(KMsvGlobalInBoxIndexEntryId)); - } - -void TestUniDataModelMMSPlugin::testOutboxMessage() - { - createMMS(KMsvGlobalOutBoxIndexEntryIdValue,EFalse); - - // Get the MMS data modelplugin - pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Mms); - QVERIFY(pluginInterface->messageType()=="mms"); - - pluginInterface->setMessageId(iMessageId); - - int size = pluginInterface->messageSize(); - QVERIFY(size == msgSize); - - QVERIFY(pluginInterface->timeStamp() == retTimeStamp); - - - //Fetch the To List - ConvergedMessageAddressList recipientList; - pluginInterface->toRecipientList(recipientList); - QVERIFY(recipientList.count() != 0); - - ConvergedMessageAddressList recipientList2; - pluginInterface->ccRecipientList(recipientList2); - QVERIFY(recipientList2.count() != 0); - - ConvergedMessageAddressList recipientList3; - pluginInterface->bccRecipientList(recipientList3); - QVERIFY(recipientList3.count() != 0); - - QString recepient(TEST_MSG_FROM1); - QString fromaddress; - pluginInterface->fromAddress(fromaddress); - QVERIFY(recepient == fromaddress); - - UniMessageInfoList attList = pluginInterface->attachmentList(); - QVERIFY(attList.count() != 0); - - TInt attCount =0; - attCount = pluginInterface->attachmentCount(); - QVERIFY(attCount != 0); - - MsgPriority priority = pluginInterface->messagePriority(); - // Normal priority - qDebug() << "prority" << priority; - QVERIFY(priority == 1); - - QVERIFY(pluginInterface->objectCount() == 1); - - UniMessageInfoList objectlist = pluginInterface->objectList(); - QVERIFY(!objectlist.isEmpty()); - - TRAPD(err, iMmsClientMtm->SwitchCurrentEntryL(KMsvGlobalInBoxIndexEntryId)); - } - - -void TestUniDataModelMMSPlugin::createInboxImageMMS() - { - TMsvEntry indexEntry; - indexEntry.iType = KUidMsvMessageEntry; - indexEntry.iMtm = KUidMsgTypeMultimedia; - indexEntry.iServiceId = iServiceId; - indexEntry.iDate.HomeTime(); - - // Convert TTime to QDateTime , this will be used for comparing the time of mesage - // when fetched from datamodel - TTime unixEpoch(KUnixEpoch); - TTimeIntervalSeconds seconds; - TTime timeStamp = indexEntry.iDate; - timeStamp.SecondsFrom(unixEpoch, seconds); - retTimeStamp.setTime_t(seconds.Int()); - - - TMsvId parentId = KMsvGlobalInBoxIndexEntryIdValue; - CMsvEntry* entry = CMsvEntry::NewL(*iMSession,parentId,TMsvSelectionOrdering()); - CleanupStack::PushL(entry); - - entry->SetEntryL(parentId); - entry->CreateL(indexEntry); - entry->SetEntryL(indexEntry.Id()); - iMmsClientMtm->SwitchCurrentEntryL(entry->EntryId()); - - //iMmsClientMtm->LoadMessageL(); - - CMsvStore* store = iMmsClientMtm->Entry().EditStoreL(); - CleanupStack::PushL(store); - - iMessageId = indexEntry.Id(); - idArr.Append(iMessageId); - - //Sender - QString sender(TEST_MSG_FROM1); - HBufC* addr = XQConversions::qStringToS60Desc(sender); - - if (addr) - { - CleanupStack::PushL(addr); - TBuf<32> name; - name.Copy(addr->Left(32)); - indexEntry.iDetails.Set(name); - - iMmsClientMtm->SetSenderL(*addr); - - CleanupStack::PopAndDestroy(addr); - } - - //Recipient - QString recipient(TEST_MSG_RECIEPIENT1); - HBufC* addr2 = XQConversions::qStringToS60Desc(recipient); - if (addr2) - { - CleanupStack::PushL(addr2); - iMmsClientMtm->AddAddresseeL(EMsvRecipientTo,*addr2); - CleanupStack::PopAndDestroy(addr2); - } - - - // Attachments are added to the message entry one by one - - TMsvAttachmentId attaId = 0; - - RFile attaFile; - // Set filename of attachment - TFileName name( _L("C:\\pictures\\photo.jpg") ); - - CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL(); - CleanupStack::PushL( mimeHeaders ); - - // Set values to mime headers - mimeHeaders->SetContentTypeL( _L8( "image") ); - mimeHeaders->SetContentSubTypeL( _L8( "jpeg" ) ); - - _LIT8(KMimeType, "image/jpeg"); - TBufC8<10> mimeType(KMimeType); - // CreateAttachment2L will set the content type to attachment Info - - // Open the attachment file for reading - attaFile.Open( iFs, name, EFileShareReadersOnly | EFileRead ); - CleanupClosePushL(attaFile); - - CMsvAttachment* attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); - // attaInfo ownerhip will be transferred to Attachment Manager. - // It must not be pushed onto the cleanupStack before calling - // CreateAttachment2L. - - - iMmsClientMtm->CreateAttachment2L(*store, attaFile,mimeType,*mimeHeaders,attaInfo,attaId); - // Now Attachment Manager owns the attaInfo - attaInfo = NULL; - - CleanupStack::PopAndDestroy(); // attaFile.Close() - CleanupStack::PopAndDestroy(); // mimeHeaders - - // Several attachments can be added before committing the store - - // Store must be committed before it is destroyed - store->CommitL(); - CleanupStack::PopAndDestroy(); // store - - iMmsClientMtm->SaveMessageL(); - } - -void TestUniDataModelMMSPlugin::testInboxImageMMSMessage() - { - createInboxImageMMS(); - - // Get the MMS data modelplugin - pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Mms); - - pluginInterface->setMessageId(iMessageId); - - int size = pluginInterface->messageSize(); - - QVERIFY(pluginInterface->timeStamp() == retTimeStamp); - - - //Fetch the To List - ConvergedMessageAddressList recipientList; - pluginInterface->toRecipientList(recipientList); - QVERIFY(recipientList.count() != 0); - - QString recepient(TEST_MSG_FROM1); - QString fromaddress; - pluginInterface->fromAddress(fromaddress); - QVERIFY(recepient == fromaddress); - - TRAPD(err, iMmsClientMtm->SwitchCurrentEntryL(KMsvGlobalInBoxIndexEntryId)); - } - - - -void TestUniDataModelMMSPlugin::testGetPluginWithoutLoading() -{ - pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Mms); - QVERIFY(pluginInterface == NULL); - - // Try to geta plugin for a differnt message type - pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg); - QVERIFY(pluginInterface == NULL); -} - - -void TestObserverMMS::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, - TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) -{ -} - - - diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.h --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.h Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -#ifndef TESTUNIDATAMODELMMSPLUGIN_H_ -#define TESTUNIDATAMODELMMSPLUGIN_H_ - -#ifdef BUILD_TEST_DLL -#define TEST_EXPORT Q_DECL_EXPORT -#else -#define TEST_EXPORT Q_DECL_IMPORT -#endif - -#include -#include -#include -#include -#include -#include -#include - -class UniDataModelPluginInterface; -class UniDataModelLoader; -class TestObserverMMS; -class CMmsClientMtm; -class CMmsHeaders; -class CMmsSettings; - -class ConvergedMessage; -class RFs; - -class TEST_EXPORT TestUniDataModelMMSPlugin : 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. - void testInboxMessage(); - void testOutboxMessage(); - void testInboxImageMMSMessage(); - -private: - void createMMS(TMsvId pId, TBool subjectField); - void createInboxImageMMS(); - -private: - UniDataModelPluginInterface* pluginInterface; - TestObserverMMS* iObserver; - CMsvSession* iMSession; - CClientMtmRegistry* iMtmReg; - CMmsClientMtm* iMmsClientMtm; - TMsvId iMessageId; - RArray idArr; - UniDataModelLoader* pluginLoader; - QDateTime retTimeStamp ; - RFs iFs; - CMmsSettings* iSettings; - CMmsHeaders* iMmsHeaders; - TMsvId iServiceId; - TInt msgSize; -}; - -class TestObserverMMS : public MMsvSessionObserver -{ -public: - void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, - TAny* aArg3); -}; - -#endif /* TESTUNIDATAMODELMMSPLUGIN_H_ */ diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.ini --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.ini Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -const char TEST_MSG_FROM1[] = "9741596546"; -const char TEST_MSG_RECIEPIENT1[] = "9741596546"; -const char TEST_MSG_RECIEPIENT2[] = "9741596547"; -const char TEST_MSG_RECIEPIENT3[] = "9741596548"; -const char TEST_MSG_SUBJECT[] = "This is an MMS"; \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.pro --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.pro Tue Aug 31 18:53:38 2010 +0530 @@ -1,63 +1,92 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Fri Aug 7 12:54:45 2009 -###################################################################### +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies 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 UnidataModelMMSPlugin +# + QT += testlib QT -= gui -TEMPLATE = lib -TARGET = test-unidatamodel-mms-plugin - +CONFIG += hb +CONFIG += symbian_test +CONFIG += qtestlib -INCLUDEPATH += . -INCLUDEPATH += ../../../../../internal/sf/app/messaging/mmsengine/mmsmessage/inc -INCLUDEPATH += ../../../../../internal/sf/app/messaging/mmsengine/inc -INCLUDEPATH += ../../../../../../inc +TEMPLATE = app +TARGET = testunidatamodelmmsplugin +INCLUDEPATH += ./inc +INCLUDEPATH += ../../../../../../../inc +INCLUDEPATH += ../../../../unidatamodel/inc +INCLUDEPATH += ../../inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE -DEFINES += BUILD_TEST_DLL +DEFINES += BUILD_TESTUNIDATAMODELMMSPLUGIN_DLL + +SYMBIAN_PLATFORMS = WINSCW ARMV5 SOURCES += \ - TestUniDataModelMmsPlugin.cpp - - + ./src/TestUniDataModelMmsPlugin.cpp # Input HEADERS += \ - TestUniDataModelMmsPlugin.h - - - + ./inc/TestUniDataModelMmsPlugin.h + SYMBIAN_PLATFORMS = WINSCW ARMV5 symbian { - TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.UID3 = 0xE7567466 + TARGET.CAPABILITY = All -TCB -DRM TARGET.EPOCSTACKSIZE = 0x8000 TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000 - TARGET.EPOCALLOWDLLDATA = 1 - 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" + VENDORID = VID_DEFAULT + BLD_INF_RULES.prj_exports += "data/TestUnidataModelMMSPluginPhoto.jpg C:/data/TestUnidataModelMMSPluginPhoto.jpg" + } -MMP_RULES += defBlock - - LIBS += -leuser \ - -lconvergedmessageutils\ +LIBS += -leuser \ + -lconvergedmessageutils \ -lxqutils \ -lmsgs \ -lsmcm \ -lgsmu \ -letext \ -lmsgs \ - -lunidatamodelloader\ -lQtCore \ -lmmscli \ -lefsrv \ -lmmsmessage \ - -lmmsserversettings + -lmmsserversettings \ + -lunidatamodelloader + +packageheader = "$${LITERAL_HASH}{\"TestUnidataModelMMSPlugin\"},(0xE7567466),1,0,0,TYPE=SA" +vendorinfo = \ + "; Localised Vendor name" \ + "%{\"Nokia\"}" \ + "; Unique Vendor name" \ + ":\"Nokia\"" + +dependencyinfo = \ + "; Default HW/platform dependencies" \ + "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ + "[0x2001E61C],4,6,3,{"Qt"} + +default_deployment.pkg_prerules = packageheader \ + vendorinfo \ + dependencyinfo + +#Copy the dependent DLL +symbian: { + addFile1.sources = ./data/TestUnidataModelMMSPluginPhoto.jpg + addFile1.path = C:/data/ + DEPLOYMENT += addFile1 + } + \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/tsrc.pro Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,21 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Project file for testmmsgplugin +# + +TEMPLATE = subdirs + +SUBDIRS += testunidatamodelmmsplugin + +CONFIG += ordered \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/bwins/test_unidatamodel_sms_pluginu.def --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/bwins/test_unidatamodel_sms_pluginu.def Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -EXPORTS - ?testGetPluginWithoutLoading@TestUniDataModelSMSPlugin@@AAEXXZ @ 1 NONAME ; void TestUniDataModelSMSPlugin::testGetPluginWithoutLoading(void) - ?qt_metacall@TestUniDataModelSMSPlugin@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 2 NONAME ; int TestUniDataModelSMSPlugin::qt_metacall(enum QMetaObject::Call, int, void * *) - ?tr@TestUniDataModelSMSPlugin@@SA?AVQString@@PBD0H@Z @ 3 NONAME ; class QString TestUniDataModelSMSPlugin::tr(char const *, char const *, int) - ?createDraftsSMSNoRecipient@TestUniDataModelSMSPlugin@@AAEXXZ @ 4 NONAME ; void TestUniDataModelSMSPlugin::createDraftsSMSNoRecipient(void) - ?createSentSMS@TestUniDataModelSMSPlugin@@AAEXXZ @ 5 NONAME ; void TestUniDataModelSMSPlugin::createSentSMS(void) - ?testOutboxMessage@TestUniDataModelSMSPlugin@@AAEXXZ @ 6 NONAME ; void TestUniDataModelSMSPlugin::testOutboxMessage(void) - ?testDraftsMessageNoRecipient@TestUniDataModelSMSPlugin@@AAEXXZ @ 7 NONAME ; void TestUniDataModelSMSPlugin::testDraftsMessageNoRecipient(void) - ?staticMetaObject@TestUniDataModelSMSPlugin@@2UQMetaObject@@B @ 8 NONAME ; struct QMetaObject const TestUniDataModelSMSPlugin::staticMetaObject - ?metaObject@TestUniDataModelSMSPlugin@@UBEPBUQMetaObject@@XZ @ 9 NONAME ; struct QMetaObject const * TestUniDataModelSMSPlugin::metaObject(void) const - ?cleanup@TestUniDataModelSMSPlugin@@AAEXXZ @ 10 NONAME ; void TestUniDataModelSMSPlugin::cleanup(void) - ?trUtf8@TestUniDataModelSMSPlugin@@SA?AVQString@@PBD0H@Z @ 11 NONAME ; class QString TestUniDataModelSMSPlugin::trUtf8(char const *, char const *, int) - ?testUnusedAPIs@TestUniDataModelSMSPlugin@@AAEXXZ @ 12 NONAME ; void TestUniDataModelSMSPlugin::testUnusedAPIs(void) - ?testInboxMessage@TestUniDataModelSMSPlugin@@AAEXXZ @ 13 NONAME ; void TestUniDataModelSMSPlugin::testInboxMessage(void) - ?createInboxSMS@TestUniDataModelSMSPlugin@@AAEXXZ @ 14 NONAME ; void TestUniDataModelSMSPlugin::createInboxSMS(void) - ?qt_metacast@TestUniDataModelSMSPlugin@@UAEPAXPBD@Z @ 15 NONAME ; void * TestUniDataModelSMSPlugin::qt_metacast(char const *) - ?init@TestUniDataModelSMSPlugin@@AAEXXZ @ 16 NONAME ; void TestUniDataModelSMSPlugin::init(void) - ?tr@TestUniDataModelSMSPlugin@@SA?AVQString@@PBD0@Z @ 17 NONAME ; class QString TestUniDataModelSMSPlugin::tr(char const *, char const *) - ?getStaticMetaObject@TestUniDataModelSMSPlugin@@SAABUQMetaObject@@XZ @ 18 NONAME ; struct QMetaObject const & TestUniDataModelSMSPlugin::getStaticMetaObject(void) - ?testPluginLoading@TestUniDataModelSMSPlugin@@AAEXXZ @ 19 NONAME ; void TestUniDataModelSMSPlugin::testPluginLoading(void) - ?trUtf8@TestUniDataModelSMSPlugin@@SA?AVQString@@PBD0@Z @ 20 NONAME ; class QString TestUniDataModelSMSPlugin::trUtf8(char const *, char const *) - ?testDraftsMessage@TestUniDataModelSMSPlugin@@AAEXXZ @ 21 NONAME ; void TestUniDataModelSMSPlugin::testDraftsMessage(void) - ?testPluginLoadingMultipleTimes@TestUniDataModelSMSPlugin@@AAEXXZ @ 22 NONAME ; void TestUniDataModelSMSPlugin::testPluginLoadingMultipleTimes(void) - ?createOutboxSMS@TestUniDataModelSMSPlugin@@AAEXXZ @ 23 NONAME ; void TestUniDataModelSMSPlugin::createOutboxSMS(void) - ?createDraftsSMS@TestUniDataModelSMSPlugin@@AAEXXZ @ 24 NONAME ; void TestUniDataModelSMSPlugin::createDraftsSMS(void) - ?testSentMessage@TestUniDataModelSMSPlugin@@AAEXXZ @ 25 NONAME ; void TestUniDataModelSMSPlugin::testSentMessage(void) - diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.cpp --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.cpp Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,646 +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 -#include -#include - -#include "convergedmessage.h" -#include "unidatamodelplugininterface.h" -#include "unidatamodelloader.h" -#include "serviceinfo.h" -#include "testunidatamodelsmsplugin.h" -#include "testunidatamodelsmsplugin.ini" -_LIT(KUnixEpoch, "19700000:000000.000000"); - -//--------------------------------------------------------------- -// TestUniDataModelSMSPlugin::init -//--------------------------------------------------------------- - -void TestUniDataModelSMSPlugin::init() -{ - iObserver = new (ELeave) TestObserver(); - - // Create a new messaging server session.. - iMSession = CMsvSession::OpenSyncL(*iObserver); - // Create the client mtm registry - iMtmReg = CClientMtmRegistry::NewL(*iMSession); - - // Get the SMS clientmtm - iSmsClientMtm - = static_cast (iMtmReg->NewMtmL(KUidMsgTypeSMS)); - - TRAPD(err, iSmsClientMtm->DefaultServiceL()) ; - - if( err == KErrNotFound) - { - CSmsAccount* account = CSmsAccount::NewL(); - CleanupStack::PushL(account); - CSmsSettings* settings = CSmsSettings::NewL(); - CleanupStack::PushL(settings); - account->InitialiseDefaultSettingsL(*settings); - CleanupStack::PopAndDestroy(2); - - } - messageId = 0; - pluginLoader = new UniDataModelLoader(); - retTimeStamp = QDateTime::currentDateTime(); -} - -//--------------------------------------------------------------- -// TestUniDataModelSMSPlugin::cleanup -//--------------------------------------------------------------- -void TestUniDataModelSMSPlugin::cleanup() -{ - - if (messageId > 0) - iSmsClientMtm->Entry().DeleteL(messageId); - - delete iObserver; - iObserver = NULL; - delete iSmsClientMtm; - iSmsClientMtm = NULL; - delete iMtmReg; - iMtmReg = NULL; - delete iMSession; - iMSession = NULL; - - delete pluginLoader; -} - -//--------------------------------------------------------------- -// TestUniDataModelSMSPlugin::validateMsg -//--------------------------------------------------------------- -void TestUniDataModelSMSPlugin::createInboxSMS() -{ - TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvGlobalInBoxIndexEntryId)); - - // Create a SMS message - iSmsClientMtm->CreateMessageL(iSmsClientMtm->DefaultServiceL()); - TMsvEntry indexEntry = iSmsClientMtm->Entry().Entry(); - - indexEntry.SetInPreparation(ETrue); - indexEntry.iMtm = KUidMsgTypeSMS; - indexEntry.iType = KUidMsvMessageEntry; - indexEntry.iServiceId = iSmsClientMtm->ServiceId(); - indexEntry.iDate.HomeTime(); - - // Convert TTime to QDateTime , this will be used for comparing the time of message - // when fetched from datamodel - TTime unixEpoch(KUnixEpoch); - TTimeIntervalSeconds seconds; - TTime timeStamp = indexEntry.iDate; - timeStamp.SecondsFrom(unixEpoch, seconds); - retTimeStamp.setTime_t(seconds.Int()); - - //AddBody - QString body(TEST_MSG_BODY); - - HBufC* bodyText = XQConversions::qStringToS60Desc(body); - if (bodyText) - { - CleanupStack::PushL(bodyText); - // Set the Body of the message - CRichText & body = iSmsClientMtm->Body(); - body.Reset(); - body.InsertL(0, *bodyText); - - TBuf<32> buf; - buf.Copy(bodyText->Left(32)); - indexEntry.iDescription.Set(buf); - - CleanupStack::PopAndDestroy(bodyText); - } - - QString recepient(TEST_MSG_FROM1); - QString recepient2(TEST_MSG_FROM2); - QString alias(TEST_MSG_ALIAS1); - - HBufC* addr = XQConversions::qStringToS60Desc(recepient); - HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2); - HBufC* alias1 = XQConversions::qStringToS60Desc(alias); - - if (addr) - { - CleanupStack::PushL(addr); - TBuf<32> name; - name.Copy(addr->Left(32)); - indexEntry.iDetails.Set(name); - CSmsHeader& smsHeader = iSmsClientMtm->SmsHeader(); - smsHeader.SetFromAddressL(*addr); - messageId = indexEntry.Id(); - - CleanupStack::PopAndDestroy(addr); - } - - indexEntry.SetAttachment(EFalse); - indexEntry.SetVisible(ETrue); - indexEntry.SetInPreparation(EFalse); - - indexEntry.SetComplete(ETrue); - iSmsClientMtm->Entry().ChangeL(indexEntry); - iSmsClientMtm->SaveMessageL(); - -} - -void TestUniDataModelSMSPlugin::createOutboxSMS() -{ - TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvGlobalOutBoxIndexEntryId)); - - // Create a SMS message - iSmsClientMtm->CreateMessageL(iSmsClientMtm->DefaultServiceL()); - TMsvEntry indexEntry = iSmsClientMtm->Entry().Entry(); - - indexEntry.SetInPreparation(ETrue); - indexEntry.iMtm = KUidMsgTypeSMS; - indexEntry.iType = KUidMsvMessageEntry; - indexEntry.iServiceId = iSmsClientMtm->ServiceId(); - indexEntry.iDate.HomeTime(); - - // Convert TTime to QDateTime , this will be used for comparing the time of message - // when fetched from datamodel - TTime unixEpoch(KUnixEpoch); - TTimeIntervalSeconds seconds; - TTime timeStamp = indexEntry.iDate; - timeStamp.SecondsFrom(unixEpoch, seconds); - retTimeStamp.setTime_t(seconds.Int()); - - //AddBody - QString body(TEST_MSG_BODY); - - HBufC* bodyText = XQConversions::qStringToS60Desc(body); - if (bodyText) - { - CleanupStack::PushL(bodyText); - // Set the Body of the message - CRichText & body = iSmsClientMtm->Body(); - body.Reset(); - body.InsertL(0, *bodyText); - - TBuf<32> buf; - buf.Copy(bodyText->Left(32)); - indexEntry.iDescription.Set(buf); - - CleanupStack::PopAndDestroy(bodyText); - } - - QString recepient(TEST_MSG_FROM1); - QString recepient2(TEST_MSG_FROM2); - QString alias(TEST_MSG_ALIAS1); - - HBufC* addr = XQConversions::qStringToS60Desc(recepient); - HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2); - HBufC* alias1 = XQConversions::qStringToS60Desc(alias); - - if (addr) - { - CleanupStack::PushL(addr); - TBuf<32> name; - name.Copy(addr->Left(32)); - indexEntry.iDetails.Set(name); - - // If drafts/ outbox message , set the recipients - iSmsClientMtm->AddAddresseeL(*addr, TPtrC()); - iSmsClientMtm->AddAddresseeL(*addr2, *alias1); - indexEntry.SetSendingState(KMsvSendStateWaiting); - messageId = indexEntry.Id(); - CleanupStack::PopAndDestroy(addr); - } - - indexEntry.SetAttachment(EFalse); - indexEntry.SetVisible(ETrue); - indexEntry.SetInPreparation(EFalse); - - indexEntry.SetComplete(ETrue); - iSmsClientMtm->Entry().ChangeL(indexEntry); - iSmsClientMtm->SaveMessageL(); - -} - -void TestUniDataModelSMSPlugin::createSentSMS() -{ - TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvSentEntryId)); - - // Create a SMS message - iSmsClientMtm->CreateMessageL(iSmsClientMtm->DefaultServiceL()); - TMsvEntry indexEntry = iSmsClientMtm->Entry().Entry(); - - indexEntry.SetInPreparation(ETrue); - indexEntry.iMtm = KUidMsgTypeSMS; - indexEntry.iType = KUidMsvMessageEntry; - indexEntry.iServiceId = iSmsClientMtm->ServiceId(); - indexEntry.iDate.HomeTime(); - - // Convert TTime to QDateTime , this will be used for comparing the time of message - // when fetched from datamodel - - TTime unixEpoch(KUnixEpoch); - TTimeIntervalSeconds seconds; - TTime timeStamp = indexEntry.iDate; - timeStamp.SecondsFrom(unixEpoch, seconds); - retTimeStamp.setTime_t(seconds.Int()); - - //AddBody - QString body(TEST_MSG_BODY); - - HBufC* bodyText = XQConversions::qStringToS60Desc(body); - if (bodyText) - { - CleanupStack::PushL(bodyText); - // Set the Body of the message - CRichText & body = iSmsClientMtm->Body(); - body.Reset(); - body.InsertL(0, *bodyText); - - TBuf<32> buf; - buf.Copy(bodyText->Left(32)); - indexEntry.iDescription.Set(buf); - - CleanupStack::PopAndDestroy(bodyText); - } - - QString recepient(TEST_MSG_FROM1); - QString recepient2(TEST_MSG_FROM2); - QString alias(TEST_MSG_ALIAS1); - - HBufC* addr = XQConversions::qStringToS60Desc(recepient); - HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2); - HBufC* alias1 = XQConversions::qStringToS60Desc(alias); - - if (addr) - { - CleanupStack::PushL(addr); - TBuf<32> name; - name.Copy(addr->Left(32)); - indexEntry.iDetails.Set(name); - - // If inbox/ sent folder message , set the from address - CSmsHeader& smsHeader = iSmsClientMtm->SmsHeader(); - smsHeader.SetFromAddressL(*addr); - messageId = indexEntry.Id(); - - CleanupStack::PopAndDestroy(addr); - } - - indexEntry.SetAttachment(EFalse); - indexEntry.SetVisible(ETrue); - indexEntry.SetInPreparation(EFalse); - - indexEntry.SetComplete(ETrue); - iSmsClientMtm->Entry().ChangeL(indexEntry); - iSmsClientMtm->SaveMessageL(); - -} - -void TestUniDataModelSMSPlugin::createDraftsSMS() -{ - TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvDraftEntryId)); - // Create a SMS message - iSmsClientMtm->CreateMessageL(iSmsClientMtm->DefaultServiceL()); - TMsvEntry indexEntry = iSmsClientMtm->Entry().Entry(); - - indexEntry.SetInPreparation(ETrue); - indexEntry.iMtm = KUidMsgTypeSMS; - indexEntry.iType = KUidMsvMessageEntry; - indexEntry.iServiceId = iSmsClientMtm->ServiceId(); - indexEntry.iDate.HomeTime(); - - // Convert TTime to QDateTime , this will be used for comparing the time of message - // when fetched from datamodel - TTime unixEpoch(KUnixEpoch); - TTimeIntervalSeconds seconds; - TTime timeStamp = indexEntry.iDate; - timeStamp.SecondsFrom(unixEpoch, seconds); - retTimeStamp.setTime_t(seconds.Int()); - - //AddBody - QString body(TEST_MSG_BODY); - - HBufC* bodyText = XQConversions::qStringToS60Desc(body); - if (bodyText) - { - CleanupStack::PushL(bodyText); - // Set the Body of the message - CRichText & body = iSmsClientMtm->Body(); - body.Reset(); - body.InsertL(0, *bodyText); - - TBuf<32> buf; - buf.Copy(bodyText->Left(32)); - indexEntry.iDescription.Set(buf); - - CleanupStack::PopAndDestroy(bodyText); - } - - QString recipient(TEST_MSG_FROM1); - QString recipient2(TEST_MSG_FROM2); - QString alias(TEST_MSG_ALIAS1); - - HBufC* addr = XQConversions::qStringToS60Desc(recipient); - HBufC* addr2 = XQConversions::qStringToS60Desc(recipient2); - HBufC* alias1 = XQConversions::qStringToS60Desc(alias); - - if (addr) - { - CleanupStack::PushL(addr); - TBuf<32> name; - name.Copy(addr->Left(32)); - indexEntry.iDetails.Set(name); - - // If drafts/ outbox message , set the recipients - iSmsClientMtm->AddAddresseeL(*addr, TPtrC()); - indexEntry.SetSendingState(KMsvSendStateWaiting); - messageId = indexEntry.Id(); - - CleanupStack::PopAndDestroy(addr); - } - - indexEntry.SetAttachment(EFalse); - indexEntry.SetVisible(ETrue); - indexEntry.SetInPreparation(EFalse); - - indexEntry.SetComplete(ETrue); - iSmsClientMtm->Entry().ChangeL(indexEntry); - iSmsClientMtm->SaveMessageL(); - -} - -void TestUniDataModelSMSPlugin::createDraftsSMSNoRecipient() -{ - TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvDraftEntryId)); - // Create a SMS message - iSmsClientMtm->CreateMessageL(iSmsClientMtm->DefaultServiceL()); - TMsvEntry indexEntry = iSmsClientMtm->Entry().Entry(); - - indexEntry.SetInPreparation(ETrue); - indexEntry.iMtm = KUidMsgTypeSMS; - indexEntry.iType = KUidMsvMessageEntry; - indexEntry.iServiceId = iSmsClientMtm->ServiceId(); - indexEntry.iDate.HomeTime(); - - //AddBody - QString body(TEST_MSG_BODY); - - HBufC* bodyText = XQConversions::qStringToS60Desc(body); - if (bodyText) - { - CleanupStack::PushL(bodyText); - // Set the Body of the message - CRichText & body = iSmsClientMtm->Body(); - body.Reset(); - body.InsertL(0, *bodyText); - - TBuf<32> buf; - buf.Copy(bodyText->Left(32)); - indexEntry.iDescription.Set(buf); - - CleanupStack::PopAndDestroy(bodyText); - } - - indexEntry.SetSendingState(KMsvSendStateWaiting); - messageId = indexEntry.Id(); - - indexEntry.SetAttachment(EFalse); - indexEntry.SetVisible(ETrue); - indexEntry.SetInPreparation(EFalse); - - indexEntry.SetComplete(ETrue); - iSmsClientMtm->Entry().ChangeL(indexEntry); - iSmsClientMtm->SaveMessageL(); - -} - -void TestUniDataModelSMSPlugin::testInboxMessage() -{ - createInboxSMS(); - - // Get the SMS data modelplugin - pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); - - pluginInterface->setMessageId(messageId); - - int size = pluginInterface->messageSize(); - - QVERIFY(pluginInterface->timeStamp() == retTimeStamp); - - QString body; - pluginInterface->body(body); - QString origBody(TEST_MSG_BODY); - QVERIFY(origBody == body); - - ConvergedMessageAddressList recipientList; - pluginInterface->toRecipientList(recipientList); - - QString recipient(TEST_MSG_FROM1); - QString recipient2(TEST_MSG_FROM2); - QString origalias(TEST_MSG_ALIAS1); - - QVERIFY(recipientList.count() == 0); - - int size1 = pluginInterface->messageSize(); - - QString fromaddress; - pluginInterface->fromAddress(fromaddress); - QVERIFY(recipient == fromaddress); - TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvGlobalInBoxIndexEntryId)); -} - -void TestUniDataModelSMSPlugin::testOutboxMessage() -{ - createOutboxSMS(); - // Get the SMS data modelplugin - pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); - - // Get the data for the first message in DRAFTS - pluginInterface->setMessageId(messageId); - int size = pluginInterface->messageSize(); - - QVERIFY(pluginInterface->timeStamp() == retTimeStamp); - - QString body; - pluginInterface->body(body); - QString origBody(TEST_MSG_BODY); - QVERIFY(origBody == body); - - ConvergedMessageAddressList recipientList; - pluginInterface->toRecipientList(recipientList); - - QString recipient(TEST_MSG_FROM1); - QString recipient2(TEST_MSG_FROM2); - QString origalias(TEST_MSG_ALIAS1); - - QVERIFY(recipientList.count() == 2); - QVERIFY(recipient == recipientList[0]->address() - && recipientList[0]->alias().isEmpty()); - - const QString& as = recipientList[1]->address(); - const QString& as1 = recipientList[1]->alias(); - QVERIFY(recipient2 == as); - - // ConvergedMessageAddress::alias return a QSting with a space - origalias.append(' '); - QVERIFY(origalias == as1); - - int size1 = pluginInterface->messageSize(); - - QString fromaddress; - pluginInterface->fromAddress(fromaddress); - QVERIFY(fromaddress.isEmpty()); - TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvGlobalOutBoxIndexEntryId)); -} - -void TestUniDataModelSMSPlugin::testSentMessage() -{ - createSentSMS(); - // Get the SMS data modelplugin - pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); - - pluginInterface->setMessageId(messageId); - - int size = pluginInterface->messageSize(); - - QVERIFY(pluginInterface->timeStamp() == retTimeStamp); - - QString body; - pluginInterface->body(body); - QString origBody(TEST_MSG_BODY); - QVERIFY(origBody == body); - - ConvergedMessageAddressList recipientList; - pluginInterface->toRecipientList(recipientList); - - QString recipient(TEST_MSG_FROM1); - QString recipient2(TEST_MSG_FROM2); - QString origalias(TEST_MSG_ALIAS1); - - QVERIFY(recipientList.count() == 0); - - QString fromaddress; - pluginInterface->fromAddress(fromaddress); - QVERIFY(recipient == fromaddress); - TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvSentEntryId)); -} - -void TestUniDataModelSMSPlugin::testDraftsMessage() -{ - createDraftsSMS(); - // Get the SMS data modelplugin - pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); - - // Get the data for the first message in DRAFTS - pluginInterface->setMessageId(messageId); - int size = pluginInterface->messageSize(); - - QVERIFY(pluginInterface->timeStamp() == retTimeStamp); - - QString body; - pluginInterface->body(body); - QString origBody(TEST_MSG_BODY); - QVERIFY(origBody == body); - - ConvergedMessageAddressList recipientList; - pluginInterface->toRecipientList(recipientList); - - QString recipient(TEST_MSG_FROM1); - - QVERIFY(recipientList.count() == 1); - QVERIFY(recipient == recipientList[0]->address() - && recipientList[0]->alias().isEmpty()); - - QString fromaddress; - pluginInterface->fromAddress(fromaddress); - QVERIFY(fromaddress.isEmpty()); - TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvDraftEntryId)); -} - -void TestUniDataModelSMSPlugin::testDraftsMessageNoRecipient() -{ - createDraftsSMSNoRecipient(); - // Get the SMS data modelplugin - pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); - - // Get the data for the first message in DRAFTS - pluginInterface->setMessageId(messageId); - int size = pluginInterface->messageSize(); - - QString body; - pluginInterface->body(body); - QString origBody(TEST_MSG_BODY); - QVERIFY(origBody == body); - - ConvergedMessageAddressList recipientList; - pluginInterface->toRecipientList(recipientList); - - QVERIFY(recipientList.count() == 0); - - QString fromaddress; - pluginInterface->fromAddress(fromaddress); - QVERIFY(fromaddress.isEmpty()); - TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvDraftEntryId)); -} - -void TestUniDataModelSMSPlugin::testGetPluginWithoutLoading() -{ - pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); - QVERIFY(pluginInterface == NULL); - - // Try to geta plugin for a differnt message type - pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Mms); - QVERIFY(pluginInterface == NULL); -} - -void TestUniDataModelSMSPlugin::testUnusedAPIs() -{ - pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); - - QVERIFY(pluginInterface->hasAttachment() == false); - - UniMessageInfoList attachmentlist = pluginInterface->attachmentList(); - QVERIFY(attachmentlist.isEmpty()); - - QVERIFY(pluginInterface->objectCount() == 0); - - UniMessageInfoList objectlist = pluginInterface->objectList(); - QVERIFY(objectlist.isEmpty()); - - QVERIFY(pluginInterface->slideCount() == 0); - - UniMessageInfoList slidelist = pluginInterface->slideContent(0); - QVERIFY(slidelist.isEmpty()); - - ConvergedMessageAddressList recipientList; - - pluginInterface->ccRecipientList(recipientList); - QVERIFY(recipientList.count() == 0); - - pluginInterface->bccRecipientList(recipientList); - QVERIFY(recipientList.count() == 0); - - MsgPriority priority = pluginInterface->messagePriority(); - // Normal priority - qDebug() << "prority" << priority; - QVERIFY(priority == 1); - int count = pluginInterface->attachmentCount(); - QVERIFY(count == 0); - -} - -void TestObserver::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, - TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) -{ -} diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.h --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.h Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -#ifndef TEST_UNI_DATA_MODEL_SMS_PLUGIN_H -#define TEST_UNI_DATA_MODEL_SMS_PLUGIN_H - -#ifdef BUILD_TEST_DLL -#define TEST_EXPORT Q_DECL_EXPORT -#else -#define TEST_EXPORT Q_DECL_IMPORT -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class UniDataModelPluginInterface; -class UniDataModelLoader; -class TestObserver; - -class ConvergedMessage; - -class TEST_EXPORT TestUniDataModelSMSPlugin : 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 testInboxMessage(); - void testOutboxMessage(); - void testSentMessage(); - void testDraftsMessage(); - void testDraftsMessageNoRecipient(); - void testUnusedAPIs(); - -private: - void createInboxSMS(); - void createOutboxSMS(); - void createSentSMS(); - void createDraftsSMS(); - void createDraftsSMSNoRecipient(); - - -private: - UniDataModelPluginInterface* pluginInterface; - TestObserver* iObserver; - CMsvSession* iMSession; - CClientMtmRegistry* iMtmReg; - CSmsClientMtm* iSmsClientMtm; - TMsvId messageId; - UniDataModelLoader* pluginLoader; - QDateTime retTimeStamp ; -}; - -class TestObserver : public MMsvSessionObserver -{ -public: - void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, - TAny* aArg3); -}; - -#endif //TEST_UNI_DATA_MODEL_SMS_PLUGIN_H diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.ini --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.ini Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -//this file is used to provide predefined set of input data. - -//eg. -const char TEST_MSG_BODY[] = "This string is message body test string"; -const char TEST_MSG_RECIEPIENT[] = "Javaid Nabi<9741596546>"; -const char TEST_MSG_FROM1[] = "9741596546"; -const char TEST_MSG_ALIAS1[] = "Javaid Nabi"; -const char TEST_MSG_FROM2[] = "9797979797"; -const char TEST_MSG_ALIAS2[] = "Rajesh Batchu"; -const char TEST_MSG_SUBJECT[] = "Message Subject"; diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.pro --- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.pro Wed Aug 18 00:46:12 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -QT += testlib -QT -= gui - -TEMPLATE = lib -TARGET = test-unidatamodel-sms-plugin - - -INCLUDEPATH += . -INCLUDEPATH += ../../../../../../inc -INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE - -DEFINES += BUILD_TEST_DLL - -SOURCES += \ - testunidatamodelsmsplugin.cpp - - - -# Input -HEADERS += \ - testunidatamodelsmsplugin.h - - - -SYMBIAN_PLATFORMS = WINSCW ARMV5 - symbian { - TARGET.CAPABILITY = CAP_GENERAL_DLL - TARGET.EPOCSTACKSIZE = 0x8000 - 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\ - -lxqutils \ - -lmsgs \ - -lsmcm \ - -lgsmu \ - -letext \ - -lmsgs \ - -lunidatamodelloader\ - -lQtCore - - diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/tsrc.pro Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,25 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = subdirs + +CONFIG += symbian_test + +#Sub .pro files +SUBDIRS += unittest_unidatamodelsmsplugin + +# Platforms +SYMBIAN_PLATFORMS = DEFAULT \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/unittest_unidatamodelsmsplugin/data/Testunidatamodelsmsplugin.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/unittest_unidatamodelsmsplugin/data/Testunidatamodelsmsplugin.cfg Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,1 @@ +TestUniDataModelSMSPlugin diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/unittest_unidatamodelsmsplugin/src/testunidatamodelsmsplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/unittest_unidatamodelsmsplugin/src/testunidatamodelsmsplugin.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,725 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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 "convergedmessage.h" +#include "unidatamodelplugininterface.h" +#include "unidatamodelloader.h" +#include "testunidatamodelsmsplugin.h" +#include "testunidatamodelsmsplugin.ini" +_LIT(KUnixEpoch, "19700000:000000.000000"); + + +//main entry point +int main(int argc, char *argv[]) + { + int ret = -1; + QCoreApplication app(argc, argv); + QObject* tc = new TestUniDataModelSMSPlugin(); + + #ifdef __WINSCW__ + char *new_argv[3]; + QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; + QByteArray bytes = str.toAscii(); + char arg1[] = "-o"; + new_argv[0] = argv[0]; + new_argv[1] = arg1; + new_argv[2] = bytes.data(); + ret = QTest::qExec(tc, 3, new_argv); + + #else + ret = QTest::qExec(tc, argc, argv); + #endif + + + delete tc; + return ret; + + } + + + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::init +//--------------------------------------------------------------- + +void TestUniDataModelSMSPlugin::init() +{ + iObserver = new (ELeave) TestObserver(); + + // Create a new messaging server session.. + iMSession = CMsvSession::OpenSyncL(*iObserver); + // Create the client mtm registry + iMtmReg = CClientMtmRegistry::NewL(*iMSession); + + // Get the SMS clientmtm + iSmsClientMtm = static_cast (iMtmReg->NewMtmL(KUidMsgTypeSMS)); + + TRAPD(err, iSmsClientMtm->DefaultServiceL()) ; + + if( err == KErrNotFound) + { + CSmsAccount* account = CSmsAccount::NewL(); + CleanupStack::PushL(account); + CSmsSettings* settings = CSmsSettings::NewL(); + CleanupStack::PushL(settings); + account->InitialiseDefaultSettingsL(*settings); + CleanupStack::PopAndDestroy(2); + } + messageId = 0; + pluginLoader = new UniDataModelLoader(); + retTimeStamp = QDateTime::currentDateTime(); +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::cleanup +//--------------------------------------------------------------- +void TestUniDataModelSMSPlugin::cleanup() +{ + + if (messageId > 0) + iSmsClientMtm->Entry().DeleteL(messageId); + + delete iObserver; + iObserver = NULL; + + delete iSmsClientMtm; + iSmsClientMtm = NULL; + + delete iMtmReg; + iMtmReg = NULL; + + delete iMSession; + iMSession = NULL; + + delete pluginLoader; +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::validateMsg +//--------------------------------------------------------------- + +void TestUniDataModelSMSPlugin::createInboxSMS() +{ + TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvGlobalInBoxIndexEntryId)); + + // Create a SMS message + iSmsClientMtm->CreateMessageL(iSmsClientMtm->DefaultServiceL()); + TMsvEntry indexEntry = iSmsClientMtm->Entry().Entry(); + + indexEntry.SetInPreparation(ETrue); + indexEntry.iMtm = KUidMsgTypeSMS; + indexEntry.iType = KUidMsvMessageEntry; + indexEntry.iServiceId = iSmsClientMtm->ServiceId(); + indexEntry.iDate.HomeTime(); + + // Convert TTime to QDateTime , this will be used for comparing the time of message + // when fetched from datamodel + TTime unixEpoch(KUnixEpoch); + TTimeIntervalSeconds seconds; + TTime timeStamp = indexEntry.iDate; + timeStamp.SecondsFrom(unixEpoch, seconds); + retTimeStamp.setTime_t(seconds.Int()); + + //AddBody + QString body(TEST_MSG_BODY); + + HBufC* bodyText = XQConversions::qStringToS60Desc(body); + if (bodyText) + { + CleanupStack::PushL(bodyText); + // Set the Body of the message + CRichText & body = iSmsClientMtm->Body(); + body.Reset(); + body.InsertL(0, *bodyText); + + TBuf<32> buf; + buf.Copy(bodyText->Left(32)); + indexEntry.iDescription.Set(buf); + + CleanupStack::PopAndDestroy(bodyText); + } + + QString recepient(TEST_MSG_FROM1); + QString recepient2(TEST_MSG_FROM2); + QString alias(TEST_MSG_ALIAS1); + + HBufC* addr = XQConversions::qStringToS60Desc(recepient); + HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2); + HBufC* alias1 = XQConversions::qStringToS60Desc(alias); + + if (addr) + { + CleanupStack::PushL(addr); + TBuf<32> name; + name.Copy(addr->Left(32)); + indexEntry.iDetails.Set(name); + CSmsHeader& smsHeader = iSmsClientMtm->SmsHeader(); + smsHeader.SetFromAddressL(*addr); + messageId = indexEntry.Id(); + + CleanupStack::PopAndDestroy(addr); + } + + indexEntry.SetAttachment(EFalse); + indexEntry.SetVisible(ETrue); + indexEntry.SetInPreparation(EFalse); + + indexEntry.SetComplete(ETrue); + iSmsClientMtm->Entry().ChangeL(indexEntry); + iSmsClientMtm->SaveMessageL(); + +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::createOutboxSMS +//--------------------------------------------------------------- + +void TestUniDataModelSMSPlugin::createOutboxSMS() +{ + TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvGlobalOutBoxIndexEntryId)); + + // Create a SMS message + iSmsClientMtm->CreateMessageL(iSmsClientMtm->DefaultServiceL()); + TMsvEntry indexEntry = iSmsClientMtm->Entry().Entry(); + + indexEntry.SetInPreparation(ETrue); + indexEntry.iMtm = KUidMsgTypeSMS; + indexEntry.iType = KUidMsvMessageEntry; + indexEntry.iServiceId = iSmsClientMtm->ServiceId(); + indexEntry.iDate.HomeTime(); + + // Convert TTime to QDateTime , this will be used for comparing the time of message + // when fetched from datamodel + TTime unixEpoch(KUnixEpoch); + TTimeIntervalSeconds seconds; + TTime timeStamp = indexEntry.iDate; + timeStamp.SecondsFrom(unixEpoch, seconds); + retTimeStamp.setTime_t(seconds.Int()); + + //AddBody + QString body(TEST_MSG_BODY); + + HBufC* bodyText = XQConversions::qStringToS60Desc(body); + if (bodyText) + { + CleanupStack::PushL(bodyText); + // Set the Body of the message + CRichText & body = iSmsClientMtm->Body(); + body.Reset(); + body.InsertL(0, *bodyText); + + TBuf<32> buf; + buf.Copy(bodyText->Left(32)); + indexEntry.iDescription.Set(buf); + + CleanupStack::PopAndDestroy(bodyText); + } + + QString recepient(TEST_MSG_FROM1); + QString recepient2(TEST_MSG_FROM2); + QString alias(TEST_MSG_ALIAS1); + + HBufC* addr = XQConversions::qStringToS60Desc(recepient); + HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2); + HBufC* alias1 = XQConversions::qStringToS60Desc(alias); + + if (addr) + { + CleanupStack::PushL(addr); + TBuf<32> name; + name.Copy(addr->Left(32)); + indexEntry.iDetails.Set(name); + + // If drafts/ outbox message , set the recipients + iSmsClientMtm->AddAddresseeL(*addr, TPtrC()); + iSmsClientMtm->AddAddresseeL(*addr2, *alias1); + indexEntry.SetSendingState(KMsvSendStateWaiting); + messageId = indexEntry.Id(); + CleanupStack::PopAndDestroy(addr); + } + + indexEntry.SetAttachment(EFalse); + indexEntry.SetVisible(ETrue); + indexEntry.SetInPreparation(EFalse); + + indexEntry.SetComplete(ETrue); + iSmsClientMtm->Entry().ChangeL(indexEntry); + iSmsClientMtm->SaveMessageL(); + +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::createSentSMS +//--------------------------------------------------------------- + +void TestUniDataModelSMSPlugin::createSentSMS() +{ + TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvSentEntryId)); + + // Create a SMS message + iSmsClientMtm->CreateMessageL(iSmsClientMtm->DefaultServiceL()); + TMsvEntry indexEntry = iSmsClientMtm->Entry().Entry(); + + indexEntry.SetInPreparation(ETrue); + indexEntry.iMtm = KUidMsgTypeSMS; + indexEntry.iType = KUidMsvMessageEntry; + indexEntry.iServiceId = iSmsClientMtm->ServiceId(); + indexEntry.iDate.HomeTime(); + + // Convert TTime to QDateTime , this will be used for comparing the time of message + // when fetched from datamodel + + TTime unixEpoch(KUnixEpoch); + TTimeIntervalSeconds seconds; + TTime timeStamp = indexEntry.iDate; + timeStamp.SecondsFrom(unixEpoch, seconds); + retTimeStamp.setTime_t(seconds.Int()); + + //AddBody + QString body(TEST_MSG_BODY); + + HBufC* bodyText = XQConversions::qStringToS60Desc(body); + if (bodyText) + { + CleanupStack::PushL(bodyText); + // Set the Body of the message + CRichText & body = iSmsClientMtm->Body(); + body.Reset(); + body.InsertL(0, *bodyText); + + TBuf<32> buf; + buf.Copy(bodyText->Left(32)); + indexEntry.iDescription.Set(buf); + + CleanupStack::PopAndDestroy(bodyText); + } + + QString recepient(TEST_MSG_FROM1); + QString recepient2(TEST_MSG_FROM2); + QString alias(TEST_MSG_ALIAS1); + + HBufC* addr = XQConversions::qStringToS60Desc(recepient); + HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2); + HBufC* alias1 = XQConversions::qStringToS60Desc(alias); + + if (addr) + { + CleanupStack::PushL(addr); + TBuf<32> name; + name.Copy(addr->Left(32)); + indexEntry.iDetails.Set(name); + + // If inbox/ sent folder message , set the from address + CSmsHeader& smsHeader = iSmsClientMtm->SmsHeader(); + smsHeader.SetFromAddressL(*addr); + messageId = indexEntry.Id(); + + CleanupStack::PopAndDestroy(addr); + } + + indexEntry.SetAttachment(EFalse); + indexEntry.SetVisible(ETrue); + indexEntry.SetInPreparation(EFalse); + + indexEntry.SetComplete(ETrue); + iSmsClientMtm->Entry().ChangeL(indexEntry); + iSmsClientMtm->SaveMessageL(); + +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::createDraftsSMS +//--------------------------------------------------------------- + +void TestUniDataModelSMSPlugin::createDraftsSMS() +{ + TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvDraftEntryId)); + // Create a SMS message + iSmsClientMtm->CreateMessageL(iSmsClientMtm->DefaultServiceL()); + TMsvEntry indexEntry = iSmsClientMtm->Entry().Entry(); + + indexEntry.SetInPreparation(ETrue); + indexEntry.iMtm = KUidMsgTypeSMS; + indexEntry.iType = KUidMsvMessageEntry; + indexEntry.iServiceId = iSmsClientMtm->ServiceId(); + indexEntry.iDate.HomeTime(); + + // Convert TTime to QDateTime , this will be used for comparing the time of message + // when fetched from datamodel + TTime unixEpoch(KUnixEpoch); + TTimeIntervalSeconds seconds; + TTime timeStamp = indexEntry.iDate; + timeStamp.SecondsFrom(unixEpoch, seconds); + retTimeStamp.setTime_t(seconds.Int()); + + //AddBody + QString body(TEST_MSG_BODY); + + HBufC* bodyText = XQConversions::qStringToS60Desc(body); + if (bodyText) + { + CleanupStack::PushL(bodyText); + // Set the Body of the message + CRichText & body = iSmsClientMtm->Body(); + body.Reset(); + body.InsertL(0, *bodyText); + + TBuf<32> buf; + buf.Copy(bodyText->Left(32)); + indexEntry.iDescription.Set(buf); + + CleanupStack::PopAndDestroy(bodyText); + } + + QString recipient(TEST_MSG_FROM1); + QString recipient2(TEST_MSG_FROM2); + QString alias(TEST_MSG_ALIAS1); + + HBufC* addr = XQConversions::qStringToS60Desc(recipient); + HBufC* addr2 = XQConversions::qStringToS60Desc(recipient2); + HBufC* alias1 = XQConversions::qStringToS60Desc(alias); + + if (addr) + { + CleanupStack::PushL(addr); + TBuf<32> name; + name.Copy(addr->Left(32)); + indexEntry.iDetails.Set(name); + + // If drafts/ outbox message , set the recipients + iSmsClientMtm->AddAddresseeL(*addr, TPtrC()); + indexEntry.SetSendingState(KMsvSendStateWaiting); + messageId = indexEntry.Id(); + + CleanupStack::PopAndDestroy(addr); + } + + indexEntry.SetAttachment(EFalse); + indexEntry.SetVisible(ETrue); + indexEntry.SetInPreparation(EFalse); + + indexEntry.SetComplete(ETrue); + iSmsClientMtm->Entry().ChangeL(indexEntry); + iSmsClientMtm->SaveMessageL(); + +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::createDraftsSMSNoRecipient +//--------------------------------------------------------------- + +void TestUniDataModelSMSPlugin::createDraftsSMSNoRecipient() +{ + TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvDraftEntryId)); + // Create a SMS message + iSmsClientMtm->CreateMessageL(iSmsClientMtm->DefaultServiceL()); + TMsvEntry indexEntry = iSmsClientMtm->Entry().Entry(); + + indexEntry.SetInPreparation(ETrue); + indexEntry.iMtm = KUidMsgTypeSMS; + indexEntry.iType = KUidMsvMessageEntry; + indexEntry.iServiceId = iSmsClientMtm->ServiceId(); + indexEntry.iDate.HomeTime(); + + //AddBody + QString body(TEST_MSG_BODY); + + HBufC* bodyText = XQConversions::qStringToS60Desc(body); + if (bodyText) + { + CleanupStack::PushL(bodyText); + // Set the Body of the message + CRichText & body = iSmsClientMtm->Body(); + body.Reset(); + body.InsertL(0, *bodyText); + + TBuf<32> buf; + buf.Copy(bodyText->Left(32)); + indexEntry.iDescription.Set(buf); + + CleanupStack::PopAndDestroy(bodyText); + } + + indexEntry.SetSendingState(KMsvSendStateWaiting); + messageId = indexEntry.Id(); + + indexEntry.SetAttachment(EFalse); + indexEntry.SetVisible(ETrue); + indexEntry.SetInPreparation(EFalse); + + indexEntry.SetComplete(ETrue); + iSmsClientMtm->Entry().ChangeL(indexEntry); + iSmsClientMtm->SaveMessageL(); + +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::testInboxMessage +//--------------------------------------------------------------- + +void TestUniDataModelSMSPlugin::testInboxMessage() +{ + createInboxSMS(); + + // Get the SMS data modelplugin + pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); + + pluginInterface->setMessageId(messageId); + + int size = pluginInterface->messageSize(); + + QVERIFY(pluginInterface->timeStamp() == retTimeStamp); + + QString body; + pluginInterface->body(body); + QString origBody(TEST_MSG_BODY); + QVERIFY(origBody == body); + + ConvergedMessageAddressList recipientList; + pluginInterface->toRecipientList(recipientList); + + QString recipient(TEST_MSG_FROM1); + QString recipient2(TEST_MSG_FROM2); + QString origalias(TEST_MSG_ALIAS1); + + QVERIFY(recipientList.count() == 0); + + int size1 = pluginInterface->messageSize(); + + QString fromaddress; + pluginInterface->fromAddress(fromaddress); + QVERIFY(recipient == fromaddress); + TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvGlobalInBoxIndexEntryId)); +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::testOutboxMessage +//--------------------------------------------------------------- + +void TestUniDataModelSMSPlugin::testOutboxMessage() +{ + createOutboxSMS(); + // Get the SMS data modelplugin + pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); + + // Get the data for the first message in DRAFTS + pluginInterface->setMessageId(messageId); + int size = pluginInterface->messageSize(); + + QVERIFY(pluginInterface->timeStamp() == retTimeStamp); + + QString body; + pluginInterface->body(body); + QString origBody(TEST_MSG_BODY); + QVERIFY(origBody == body); + + ConvergedMessageAddressList recipientList; + pluginInterface->toRecipientList(recipientList); + + QString recipient(TEST_MSG_FROM1); + QString recipient2(TEST_MSG_FROM2); + QString origalias(TEST_MSG_ALIAS1); + + QVERIFY(recipientList.count() == 2); + QVERIFY(recipient == recipientList[0]->address() + && recipientList[0]->alias().isEmpty()); + + const QString& as = recipientList[1]->address(); + const QString& as1 = recipientList[1]->alias(); + QVERIFY(recipient2 == as); + + // ConvergedMessageAddress::alias return a QSting with a space + origalias.append(' '); + QVERIFY(origalias == as1); + + int size1 = pluginInterface->messageSize(); + + QString fromaddress; + pluginInterface->fromAddress(fromaddress); + QVERIFY(fromaddress.isEmpty()); + TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvGlobalOutBoxIndexEntryId)); +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::testSentMessage +//--------------------------------------------------------------- + +void TestUniDataModelSMSPlugin::testSentMessage() +{ + createSentSMS(); + // Get the SMS data modelplugin + pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); + + pluginInterface->setMessageId(messageId); + + int size = pluginInterface->messageSize(); + + QVERIFY(pluginInterface->timeStamp() == retTimeStamp); + + QString body; + pluginInterface->body(body); + QString origBody(TEST_MSG_BODY); + QVERIFY(origBody == body); + + ConvergedMessageAddressList recipientList; + pluginInterface->toRecipientList(recipientList); + + QString recipient(TEST_MSG_FROM1); + QString recipient2(TEST_MSG_FROM2); + QString origalias(TEST_MSG_ALIAS1); + + QVERIFY(recipientList.count() == 0); + + QString fromaddress; + pluginInterface->fromAddress(fromaddress); + QVERIFY(recipient == fromaddress); + TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvSentEntryId)); +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::testDraftsMessage +//--------------------------------------------------------------- + +void TestUniDataModelSMSPlugin::testDraftsMessage() +{ + createDraftsSMS(); + // Get the SMS data modelplugin + pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); + + // Get the data for the first message in DRAFTS + pluginInterface->setMessageId(messageId); + int size = pluginInterface->messageSize(); + + QVERIFY(pluginInterface->timeStamp() == retTimeStamp); + + QString body; + pluginInterface->body(body); + QString origBody(TEST_MSG_BODY); + QVERIFY(origBody == body); + + ConvergedMessageAddressList recipientList; + pluginInterface->toRecipientList(recipientList); + + QString recipient(TEST_MSG_FROM1); + + QVERIFY(recipientList.count() == 1); + QVERIFY(recipient == recipientList[0]->address() + && recipientList[0]->alias().isEmpty()); + + QString fromaddress; + pluginInterface->fromAddress(fromaddress); + QVERIFY(fromaddress.isEmpty()); + TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvDraftEntryId)); +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::testDraftsMessageNoRecipient +//--------------------------------------------------------------- + +void TestUniDataModelSMSPlugin::testDraftsMessageNoRecipient() +{ + createDraftsSMSNoRecipient(); + // Get the SMS data modelplugin + pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); + + // Get the data for the first message in DRAFTS + pluginInterface->setMessageId(messageId); + int size = pluginInterface->messageSize(); + + QString body; + pluginInterface->body(body); + QString origBody(TEST_MSG_BODY); + QVERIFY(origBody == body); + + ConvergedMessageAddressList recipientList; + pluginInterface->toRecipientList(recipientList); + + QVERIFY(recipientList.count() == 0); + + QString fromaddress; + pluginInterface->fromAddress(fromaddress); + QVERIFY(fromaddress.isEmpty()); + TRAPD(err, iSmsClientMtm->SwitchCurrentEntryL(KMsvDraftEntryId)); +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::testGetPluginWithoutLoading +//--------------------------------------------------------------- + +void TestUniDataModelSMSPlugin::testGetPluginWithoutLoading() +{ + pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); + QVERIFY(pluginInterface == NULL); + + // Try to geta plugin for a differnt message type + pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Mms); + QVERIFY(pluginInterface == NULL); +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::testUnusedAPIs +//--------------------------------------------------------------- + +void TestUniDataModelSMSPlugin::testUnusedAPIs() +{ + pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::Sms); + + QVERIFY(pluginInterface->hasAttachment() == false); + + UniMessageInfoList attachmentlist = pluginInterface->attachmentList(); + QVERIFY(attachmentlist.isEmpty()); + + QVERIFY(pluginInterface->objectCount() == 0); + + UniMessageInfoList objectlist = pluginInterface->objectList(); + QVERIFY(objectlist.isEmpty()); + + QVERIFY(pluginInterface->slideCount() == 0); + + UniMessageInfoList slidelist = pluginInterface->slideContent(0); + QVERIFY(slidelist.isEmpty()); + + ConvergedMessageAddressList recipientList; + + pluginInterface->ccRecipientList(recipientList); + QVERIFY(recipientList.count() == 0); + + pluginInterface->bccRecipientList(recipientList); + QVERIFY(recipientList.count() == 0); + + MsgPriority priority = pluginInterface->messagePriority(); + // Normal priority + qDebug() << "prority" << priority; + QVERIFY(priority == 1); + int count = pluginInterface->attachmentCount(); + QVERIFY(count == 0); + +} + +//--------------------------------------------------------------- +// TestUniDataModelSMSPlugin::HandleSessionEventL +//--------------------------------------------------------------- + +void TestObserver::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, + TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) +{ +} diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/unittest_unidatamodelsmsplugin/testunidatamodelsmsplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/unittest_unidatamodelsmsplugin/testunidatamodelsmsplugin.pro Tue Aug 31 18:53:38 2010 +0530 @@ -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: +# + +QT += testlib +QT -= gui + +TEMPLATE = app +//TEMPLATE = lib +TARGET = test-unidatamodel-sms-plugin + + +CONFIG += hb +CONFIG += symbian_test + +INCLUDEPATH += inc +INCLUDEPATH += ../../../../../../inc +INCLUDEPATH += ../../../../../../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +DEFINES += BUILD_TEST_DLL + +SOURCES += \ + src/testunidatamodelsmsplugin.cpp + + + +# Input +HEADERS += \ + inc/testunidatamodelsmsplugin.h + + + +SYMBIAN_PLATFORMS = WINSCW ARMV5 + symbian { + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.EPOCSTACKSIZE = 0x8000 + TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000 + TARGET.EPOCALLOWDLLDATA = 1 + BLD_INF_RULES.prj_exports += "data/Testunidatamodelsmsplugin.cfg c:/data/Testunidatamodelsmsplugin.cfg" + } + +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 + + +packageheader = "$${LITERAL_HASH}{\"QTestLibCVsClientServerTest\"},(0xEa1ebe60),1,0,0,TYPE=SA" + +vendorinfo = \ + "; Localised Vendor name" \ + "%{\"Nokia\"}" \ + "; Unique Vendor name" \ + ":\"Nokia\"" + +dependencyinfo = \ + "; Default HW/platform dependencies" \ + "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ + "[0x2001E61C],4,6,3,{"Qt"} + +default_deployment.pkg_prerules = packageheader \ + vendorinfo \ + dependencyinfo + + + + LIBS += -leuser \ + -lconvergedmessageutils\ + -lxqutils \ + -lmsgs \ + -lsmcm \ + -lgsmu \ + -letext \ + -lmsgs \ + -lunidatamodelloader\ + -lQtCore + + + +#Copy the dependent DLL +symbian: { + addCfg.sources = ./data/Testunidatamodelsmsplugin.cfg + addCfg.path = C:/data + DEPLOYMENT += addCfg + } + diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/bwins/editorgenutilsu.def --- a/messagingapp/msgutils/unieditorutils/bwins/editorgenutilsu.def Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/unieditorutils/bwins/editorgenutilsu.def Tue Aug 31 18:53:38 2010 +0530 @@ -18,14 +18,15 @@ ?NewLC@CMuiuOperationWait@@SAPAV1@H@Z @ 17 NONAME ; class CMuiuOperationWait * CMuiuOperationWait::NewLC(int) ?RunL@CMuiuOperationWait@@MAEXXZ @ 18 NONAME ; void CMuiuOperationWait::RunL(void) ?getFileInfoL@UniEditorGenUtils@@QAEXVQString@@AAHAAV2@AAW4TMsgMediaType@@@Z @ 19 NONAME ; void UniEditorGenUtils::getFileInfoL(class QString, int &, class QString &, enum TMsgMediaType &) - ??1UniEditorGenUtils@@UAE@XZ @ 20 NONAME ; UniEditorGenUtils::~UniEditorGenUtils(void) - ?MaxMmsRecipientsL@UniEditorGenUtils@@QAEHXZ @ 21 NONAME ; int UniEditorGenUtils::MaxMmsRecipientsL(void) - ??1CMuiuOperationWait@@UAE@XZ @ 22 NONAME ; CMuiuOperationWait::~CMuiuOperationWait(void) - ?VerifyEmailAddressesL@UniEditorGenUtils@@QAEHV?$QList@PAVConvergedMessageAddress@@@@@Z @ 23 NONAME ; int UniEditorGenUtils::VerifyEmailAddressesL(class QList) - ?WriteEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHABVTDes16@@0ABH@Z @ 24 NONAME ; int UniEditorGenUtils::WriteEmailOverSmsSettingsL(class TDes16 const &, class TDes16 const &, int const &) - ?ReadEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHAAVTDes16@@0AAH@Z @ 25 NONAME ; int UniEditorGenUtils::ReadEmailOverSmsSettingsL(class TDes16 &, class TDes16 &, int &) - ?absoluteMaxSmsPartsL@UniEditorGenUtils@@AAEHXZ @ 26 NONAME ; int UniEditorGenUtils::absoluteMaxSmsPartsL(void) - ?UTF8Size@UniEditorGenUtils@@QAEHVQString@@@Z @ 27 NONAME ; int UniEditorGenUtils::UTF8Size(class QString) - ?IsPhoneOfflineL@UniEditorGenUtils@@QAEHXZ @ 28 NONAME ; int UniEditorGenUtils::IsPhoneOfflineL(void) - ?AcceptEmailAddressesL@UniEditorGenUtils@@QAEHXZ @ 29 NONAME ; int UniEditorGenUtils::AcceptEmailAddressesL(void) + ?MatchPhoneNumberL@UniEditorGenUtils@@QAEHAAVTDesC16@@0@Z @ 20 NONAME ; int UniEditorGenUtils::MatchPhoneNumberL(class TDesC16 &, class TDesC16 &) + ??1UniEditorGenUtils@@UAE@XZ @ 21 NONAME ; UniEditorGenUtils::~UniEditorGenUtils(void) + ?MaxMmsRecipientsL@UniEditorGenUtils@@QAEHXZ @ 22 NONAME ; int UniEditorGenUtils::MaxMmsRecipientsL(void) + ??1CMuiuOperationWait@@UAE@XZ @ 23 NONAME ; CMuiuOperationWait::~CMuiuOperationWait(void) + ?VerifyEmailAddressesL@UniEditorGenUtils@@QAEHV?$QList@PAVConvergedMessageAddress@@@@@Z @ 24 NONAME ; int UniEditorGenUtils::VerifyEmailAddressesL(class QList) + ?WriteEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHABVTDes16@@0ABH@Z @ 25 NONAME ; int UniEditorGenUtils::WriteEmailOverSmsSettingsL(class TDes16 const &, class TDes16 const &, int const &) + ?ReadEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHAAVTDes16@@0AAH@Z @ 26 NONAME ; int UniEditorGenUtils::ReadEmailOverSmsSettingsL(class TDes16 &, class TDes16 &, int &) + ?absoluteMaxSmsPartsL@UniEditorGenUtils@@AAEHXZ @ 27 NONAME ; int UniEditorGenUtils::absoluteMaxSmsPartsL(void) + ?UTF8Size@UniEditorGenUtils@@QAEHVQString@@@Z @ 28 NONAME ; int UniEditorGenUtils::UTF8Size(class QString) + ?IsPhoneOfflineL@UniEditorGenUtils@@QAEHXZ @ 29 NONAME ; int UniEditorGenUtils::IsPhoneOfflineL(void) + ?AcceptEmailAddressesL@UniEditorGenUtils@@QAEHXZ @ 30 NONAME ; int UniEditorGenUtils::AcceptEmailAddressesL(void) diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/eabi/editorgenutilsu.def --- a/messagingapp/msgutils/unieditorutils/eabi/editorgenutilsu.def Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/unieditorutils/eabi/editorgenutilsu.def Tue Aug 31 18:53:38 2010 +0530 @@ -6,34 +6,35 @@ _ZN17UniEditorGenUtils14MaxSmsMsgSizeLEb @ 5 NONAME _ZN17UniEditorGenUtils15ConvertDigitsToER6TDes1610TDigitType @ 6 NONAME _ZN17UniEditorGenUtils15IsPhoneOfflineLEv @ 7 NONAME - _ZN17UniEditorGenUtils17MaxMmsRecipientsLEv @ 8 NONAME - _ZN17UniEditorGenUtils17MaxSmsRecipientsLEv @ 9 NONAME - _ZN17UniEditorGenUtils17ReplaceCharactersER6TDes16RK7TDesC165TChar @ 10 NONAME - _ZN17UniEditorGenUtils19IsValidEmailAddressERK7TDesC16 @ 11 NONAME - _ZN17UniEditorGenUtils20absoluteMaxSmsPartsLEv @ 12 NONAME - _ZN17UniEditorGenUtils21AcceptEmailAddressesLEv @ 13 NONAME - _ZN17UniEditorGenUtils21VerifyEmailAddressesLE5QListIP23ConvergedMessageAddressE @ 14 NONAME - _ZN17UniEditorGenUtils21getSmsCharacterLimitsERiS0_b @ 15 NONAME - _ZN17UniEditorGenUtils25ReadEmailOverSmsSettingsLER6TDes16S1_Ri @ 16 NONAME - _ZN17UniEditorGenUtils25absoluteMaxSmsCharactersLEv @ 17 NONAME - _ZN17UniEditorGenUtils26WriteEmailOverSmsSettingsLERK6TDes16S2_RKi @ 18 NONAME - _ZN17UniEditorGenUtils8UTF8SizeE7QString @ 19 NONAME - _ZN17UniEditorGenUtilsC1Ev @ 20 NONAME - _ZN17UniEditorGenUtilsC2Ev @ 21 NONAME - _ZN17UniEditorGenUtilsD0Ev @ 22 NONAME - _ZN17UniEditorGenUtilsD1Ev @ 23 NONAME - _ZN17UniEditorGenUtilsD2Ev @ 24 NONAME - _ZN18CMuiuOperationWait4RunLEv @ 25 NONAME - _ZN18CMuiuOperationWait5NewLCEi @ 26 NONAME - _ZN18CMuiuOperationWait5StartEv @ 27 NONAME - _ZN18CMuiuOperationWait8DoCancelEv @ 28 NONAME - _ZN18CMuiuOperationWaitC1Ei @ 29 NONAME - _ZN18CMuiuOperationWaitC2Ei @ 30 NONAME - _ZN18CMuiuOperationWaitD0Ev @ 31 NONAME - _ZN18CMuiuOperationWaitD1Ev @ 32 NONAME - _ZN18CMuiuOperationWaitD2Ev @ 33 NONAME - _ZTI17UniEditorGenUtils @ 34 NONAME - _ZTI18CMuiuOperationWait @ 35 NONAME - _ZTV17UniEditorGenUtils @ 36 NONAME - _ZTV18CMuiuOperationWait @ 37 NONAME + _ZN17UniEditorGenUtils17MatchPhoneNumberLER7TDesC16S1_ @ 8 NONAME + _ZN17UniEditorGenUtils17MaxMmsRecipientsLEv @ 9 NONAME + _ZN17UniEditorGenUtils17MaxSmsRecipientsLEv @ 10 NONAME + _ZN17UniEditorGenUtils17ReplaceCharactersER6TDes16RK7TDesC165TChar @ 11 NONAME + _ZN17UniEditorGenUtils19IsValidEmailAddressERK7TDesC16 @ 12 NONAME + _ZN17UniEditorGenUtils20absoluteMaxSmsPartsLEv @ 13 NONAME + _ZN17UniEditorGenUtils21AcceptEmailAddressesLEv @ 14 NONAME + _ZN17UniEditorGenUtils21VerifyEmailAddressesLE5QListIP23ConvergedMessageAddressE @ 15 NONAME + _ZN17UniEditorGenUtils21getSmsCharacterLimitsERiS0_b @ 16 NONAME + _ZN17UniEditorGenUtils25ReadEmailOverSmsSettingsLER6TDes16S1_Ri @ 17 NONAME + _ZN17UniEditorGenUtils25absoluteMaxSmsCharactersLEv @ 18 NONAME + _ZN17UniEditorGenUtils26WriteEmailOverSmsSettingsLERK6TDes16S2_RKi @ 19 NONAME + _ZN17UniEditorGenUtils8UTF8SizeE7QString @ 20 NONAME + _ZN17UniEditorGenUtilsC1Ev @ 21 NONAME + _ZN17UniEditorGenUtilsC2Ev @ 22 NONAME + _ZN17UniEditorGenUtilsD0Ev @ 23 NONAME + _ZN17UniEditorGenUtilsD1Ev @ 24 NONAME + _ZN17UniEditorGenUtilsD2Ev @ 25 NONAME + _ZN18CMuiuOperationWait4RunLEv @ 26 NONAME + _ZN18CMuiuOperationWait5NewLCEi @ 27 NONAME + _ZN18CMuiuOperationWait5StartEv @ 28 NONAME + _ZN18CMuiuOperationWait8DoCancelEv @ 29 NONAME + _ZN18CMuiuOperationWaitC1Ei @ 30 NONAME + _ZN18CMuiuOperationWaitC2Ei @ 31 NONAME + _ZN18CMuiuOperationWaitD0Ev @ 32 NONAME + _ZN18CMuiuOperationWaitD1Ev @ 33 NONAME + _ZN18CMuiuOperationWaitD2Ev @ 34 NONAME + _ZTI17UniEditorGenUtils @ 35 NONAME + _ZTI18CMuiuOperationWait @ 36 NONAME + _ZTV17UniEditorGenUtils @ 37 NONAME + _ZTV18CMuiuOperationWait @ 38 NONAME diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/editorgenutils/inc/UniEditorGenUtils.h --- a/messagingapp/msgutils/unieditorutils/editorgenutils/inc/UniEditorGenUtils.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/unieditorutils/editorgenutils/inc/UniEditorGenUtils.h Tue Aug 31 18:53:38 2010 +0530 @@ -187,6 +187,14 @@ */ TBool IsValidEmailAddress( const TDesC& aAddress ); + /** + * Verifies if the given two numbers are same + * @param aFirstNumber, phone number to be matched + * @param aSecondNumber, phone number to be matched + * @return TBool, true if the numbers match + */ + TBool MatchPhoneNumberL(TDesC& aFirstNumber, TDesC& aSecondNumber); + private: /** * get sms character limits from feature manager @@ -236,6 +244,11 @@ * MMS size limit */ int mMaxMmsSize; + + /** + * The amount of digits to be used in contact matching + */ + int mMatchDigitCount; }; diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/editorgenutils/src/UniEditorGenUtils.cpp --- a/messagingapp/msgutils/unieditorutils/editorgenutils/src/UniEditorGenUtils.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/unieditorutils/editorgenutils/src/UniEditorGenUtils.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -22,6 +22,8 @@ #include #include #include +#include // for KDefaultGsmNumberMatchLength +#include // for KCRUidTelephonyConfiguration #include "MessagingVariant.hrh" #include "MessagingInternalCRKeys.h" // Keys @@ -47,7 +49,8 @@ UniEditorGenUtils::UniEditorGenUtils() : mAbsMaxConcatenatedSms(-1), mAbsMaxSmsCharacters(-1), -mMaxMmsSize(-1) +mMaxMmsSize(-1), +mMatchDigitCount(-1) { } @@ -602,4 +605,41 @@ return ( aDomain[length-1] != '.' ); } +// ---------------------------------------------------- +// UniEditorGenUtils::MatchPhoneNumber +// @see header +// ---------------------------------------------------- +TBool UniEditorGenUtils::MatchPhoneNumberL( + TDesC& aFirstNumber, TDesC& aSecondNumber) + { + // if matching digit count is already read from CR, then don't do that again + if(mMatchDigitCount == -1) + { + mMatchDigitCount = KDefaultGsmNumberMatchLength; + // Read the amount of digits to be used in contact matching + // The key is owned by PhoneApp + CRepository* repository = CRepository::NewL(KCRUidTelConfiguration); + CleanupStack::PushL(repository); + if (repository->Get(KTelMatchDigits, mMatchDigitCount) == KErrNone) + { + // Min is 7 + mMatchDigitCount = Max(mMatchDigitCount, KDefaultGsmNumberMatchLength); + } + CleanupStack::PopAndDestroy(); // repository + } + + // start matching + if( (aFirstNumber.Length() == 0) || (aSecondNumber.Length() == 0) ) + { + return EFalse; + } + + if (aFirstNumber.Right(mMatchDigitCount).CompareF( + aSecondNumber.Right(mMatchDigitCount)) == 0) + { + return ETrue; + } + return EFalse; + } + // End of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/testunieditorpluginloader/data/TestUnieditorPluginLoaderSample.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/testunieditorpluginloader/data/TestUnieditorPluginLoaderSample.txt Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,1 @@ +Message Text \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/testunieditorpluginloader/inc/testunieditorpluginloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/testunieditorpluginloader/inc/testunieditorpluginloader.h Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Main test class declaration for UnieditorPluginLoader + */ + +#ifndef TEST_UNIEDITORPLUGINLOADER_H +#define TEST_UNIEDITORPLUGINLOADER_H + +#ifdef BUILD_TEST_DLL +#define TEST_EXPORT Q_DECL_EXPORT +#else +#define TEST_EXPORT Q_DECL_IMPORT +#endif + +#include +#include +#include "convergedmessage.h" + +class UniEditorPluginLoader; + +//Main Tets Class Declaration +class TEST_EXPORT TestUnieditorPluginLoader: 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(); + + /** + * Creates a SMS messsage + **/ + void createSMS(); + + /** + * Tests the SMS message + **/ + void testSMS(); + + /** + * 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 - SMS/MMS Message Plug-in Loader + **/ + UniEditorPluginLoader* unieditorPluginLoader; + + /** + * mmsMsgId - The SMS/MMS message Id + **/ + long int msgId; + + /** + * messageType - type of Message - SMS or MMS + **/ + ConvergedMessage::MessageType messageType; + }; +#endif //TEST_UNIEDITORPLUGINLOADER_H diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/testunieditorpluginloader/inc/testunieditorpluginloader.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/testunieditorpluginloader/inc/testunieditorpluginloader.ini Tue Aug 31 18:53:38 2010 +0530 @@ -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: Input data Set File for TestUnieditorPluginLoader test cases + */ + +const char TEST_MSG_BODY[] = "TestTextE_1_2"; +const char TEST_MSG_SUBJECT[] = "Message Subject"; +const char TEST_SENDER[] = "+919860479112"; +const char TEST_ATTACHMENT[] = "c:\\data\\TestUnieditorPluginLoaderSample.txt"; +const char TEST_CC[] = "DummyCCAddress"; +const char TEST_BCC[] = "DummyBCCAddress"; +const char TEST_ALIAS[] = "DummySenderAlias"; diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/testunieditorpluginloader/src/testunieditorpluginloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/testunieditorpluginloader/src/testunieditorpluginloader.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,300 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Main test class definition for UnieditorPluginLoader + */ + +#include +#include "debugtraces.h" +#include "unieditorpluginloader.h" +#include "unieditorplugininterface.h" +#include "testunieditorpluginloader.h" +#include "testunieditorpluginloader.ini" + +//--------------------------------------------------------------- +// TestUnieditorPluginLoader::initTestCase +//--------------------------------------------------------------- +void TestUnieditorPluginLoader::initTestCase() +{ + //register user defined object to meta system. + qRegisterMetaType ("long int"); + + //Instantiate UnieditorPluginLoader and verify if it is correctly Instantited. + unieditorPluginLoader = new UniEditorPluginLoader; + QVERIFY(unieditorPluginLoader != NULL); +} + +//--------------------------------------------------------------- +// TestUnieditorPluginLoader::init +//--------------------------------------------------------------- +void TestUnieditorPluginLoader::init() +{ +} + +//--------------------------------------------------------------- +// TestUnieditorPluginLoader::createMMS +//--------------------------------------------------------------- +void TestUnieditorPluginLoader::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; + + messageType = ConvergedMessage::Mms; + msg.setMessageType(messageType); + + //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); + + UniEditorPluginInterface* pluginInterface = unieditorPluginLoader->getUniEditorPlugin(messageType); + + //Get a valid MMS message ID and verify that it is valid. + msgId = pluginInterface->convertTo(&msg); + QVERIFY(msgId != -1); + QDEBUG_WRITE("MMS Successfully Created in Drafts Folder"); +} + +//--------------------------------------------------------------- +// TestUnieditorPluginLoader::testMMS +//--------------------------------------------------------------- +void TestUnieditorPluginLoader::testMMS() +{ + //check if draft-folder signal was received...this means message was created in draft + + UniEditorPluginInterface* pluginInterface = unieditorPluginLoader->getUniEditorPlugin(messageType); + + //Validate the MMS message with all the values set before. + ConvergedMessage draftMsg = *(pluginInterface->convertFrom(msgId)); + 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"); +} + +//--------------------------------------------------------------- +// TestUnieditorPluginLoader::createSMS +//--------------------------------------------------------------- +void TestUnieditorPluginLoader::createSMS() +{ + //Create a Converged Message instance. + QString subject = TEST_MSG_SUBJECT; + + qint64 timeStamp = QDateTime::currentDateTime().toTime_t(); + + QString sender(TEST_SENDER); + ConvergedMessageAddress address(sender); + + //Instantiate a Converged Message object and set service a SMS + ConvergedMessage msg; + + messageType = ConvergedMessage::Sms; + msg.setMessageType(messageType); + + //Set Subject + msg.setSubject(subject); + + //Set Body + msg.setBodyText(QString(TEST_MSG_BODY)); + + //Set Timestamp and verify + msg.setTimeStamp(timeStamp); + QVERIFY(timeStamp == msg.timeStamp()); + + //Set recipient. + msg.addToRecipient(address); + + //Set priority. + msg.setPriority(ConvergedMessage::Normal); + + //Adding From Address + QString recipientAddress(TEST_SENDER); + ConvergedMessageAddress recipientAdd(recipientAddress); + msg.addFromRecipient(recipientAdd); + + //Set Property and Verify + msg.setProperty(ConvergedMessage::Unread); + QVERIFY(msg.properties() == ConvergedMessage::Unread); + 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); + + UniEditorPluginInterface* pluginInterface = unieditorPluginLoader->getUniEditorPlugin(messageType); + + //Get a valid SMS message ID and verify that it is valid. + msgId = pluginInterface->convertTo(&msg); + QVERIFY(msgId != -1); + QDEBUG_WRITE("SMS Successfully Created in Drafts Folder"); +} + +//--------------------------------------------------------------- +// TestUnieditorPluginLoader::testSMS +//--------------------------------------------------------------- +void TestUnieditorPluginLoader::testSMS() +{ + //check if draft-folder signal was received...this means message was created in draft + + UniEditorPluginInterface* pluginInterface = unieditorPluginLoader->getUniEditorPlugin(messageType); + + //Validate the SMS message with all the values set before. + ConvergedMessage draftMsg = *(pluginInterface->convertFrom(msgId)); + QVERIFY(draftMsg.subject().compare(QString(TEST_MSG_SUBJECT)) == 0); + QVERIFY(draftMsg.bodyText().compare(QString(TEST_MSG_BODY)) == 0); + QVERIFY(draftMsg.messageType() == ConvergedMessage::Sms); + QVERIFY(QString(TEST_SENDER).contains(draftMsg.toAddressList()[0]->address(), Qt::CaseInsensitive) == true); + QVERIFY(QString(TEST_SENDER).contains(draftMsg.fromAddress()->address(), Qt::CaseInsensitive) == true); + QVERIFY(draftMsg.location() == ConvergedMessage::Draft); + QVERIFY(draftMsg.priority() == ConvergedMessage::Normal); + QVERIFY(draftMsg.direction() == ConvergedMessage::Outgoing); + QDEBUG_WRITE("SMS Successfully Verified at Drafts Folder"); +} + +//--------------------------------------------------------------- +// TestUnieditorPluginLoader::cleanup +//--------------------------------------------------------------- +void TestUnieditorPluginLoader::cleanup() +{ +} + +//--------------------------------------------------------------- +// TestUnieditorPluginLoader::cleanupTestCase +//--------------------------------------------------------------- +void TestUnieditorPluginLoader::cleanupTestCase() +{ + //Cleanup + delete unieditorPluginLoader;//SMS/MMS Plugin Loader +} + +//--------------------------------------------------------------- +// main +// main entry point +//--------------------------------------------------------------- +int main(int argc, char *argv[]) + { + int ret = -1; + QCoreApplication app(argc, argv); + QObject* tc = new TestUnieditorPluginLoader(); + +#ifdef __WINSCW__ + char *new_argv[3]; + QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; + QByteArray bytes = str.toAscii(); + char arg1[] = "-o"; + new_argv[0] = argv[0]; + new_argv[1] = arg1; + new_argv[2] = bytes.data(); + ret = QTest::qExec(tc, 3, new_argv); +#else + ret = QTest::qExec(tc, argc, argv); +#endif + + delete tc; + return ret; + } + +//End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/testunieditorpluginloader/testunieditorpluginloader.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/testunieditorpluginloader/testunieditorpluginloader.pro Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,75 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies 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 UnieditorPluginLoader +# + +QT += testlib +QT -= gui + +CONFIG += hb +CONFIG += symbian_test +CONFIG += qtestlib + +TEMPLATE = app +TARGET = testunieditorpluginloader + +INCLUDEPATH += ../../../../../../inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +DEFINES += BUILD_TEST_DLL + +# Input +SOURCES += \ + ./src/testunieditorpluginloader.cpp + +HEADERS += \ + ./inc/testunieditorpluginloader.h + +SYMBIAN_PLATFORMS = WINSCW ARMV5 + symbian { + TARGET.UID3 = 0xEc0880aa + TARGET.CAPABILITY = All -TCB -DRM + TARGET.EPOCSTACKSIZE = 0x8000 + TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000 + VENDORID = VID_DEFAULT + BLD_INF_RULES.prj_exports += "data/TestUnieditorPluginLoaderSample.txt c:/data/TestUnieditorPluginLoaderSample.txt" + } + +LIBS += -lunieditorpluginloader \ + -lconvergedmessageutils + +packageheader = "$${LITERAL_HASH}{\"TestUnieditorPluginLoader\"},(0xEc0880aa),1,0,0,TYPE=SA" + +vendorinfo = \ + "; Localised Vendor name" \ + "%{\"Nokia\"}" \ + "; Unique Vendor name" \ + ":\"Nokia\"" + +dependencyinfo = \ + "; Default HW/platform dependencies" \ + "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ + "[0x2001E61C],4,6,3,{"Qt"} + +default_deployment.pkg_prerules = packageheader \ + vendorinfo \ + dependencyinfo + +#Copy the dependent files +symbian: { + addFile1.sources = ./data/TestUnieditorPluginLoaderSample.txt + addFile1.path = C:/data/ + DEPLOYMENT += addFile1 + } + \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/tsrc.pro Tue Aug 31 18:53:38 2010 +0530 @@ -0,0 +1,21 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies 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 TestUnieditorPluginLoader +# + +TEMPLATE = subdirs + +SUBDIRS += testunieditorpluginloader + +CONFIG += ordered \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h Tue Aug 31 18:53:38 2010 +0530 @@ -24,6 +24,8 @@ #include "convergedmessage.h" #include "convergedmessageid.h" #include "UniDataModel.h" +#include "UniEditorGenUtils.h" + // DATA TYPES // FORWARD DECLARATIONS @@ -230,6 +232,39 @@ * Populates converged message for default case */ void convertFromDefaultHandlerL(ConvergedMessage* aMessage); + + /** + * Handles own-number identification/deletion for composing reply-all + * to a message + * @param sourcemsg, message on which own-number logic is applied + * @param targetmsg, message to which trimmed address list is committed + */ + void removeOwnNumberForReplyAll( + ConvergedMessage* sourcemsg, + ConvergedMessage* targetmsg); + + /** + * Helper method to make a copy of address list + * @param addrList, list of addresses to make a copy of + * @return ConvergedMessageAddressList, copy of list of addresses + */ + ConvergedMessageAddressList copyAddrList( + ConvergedMessageAddressList addrList); + + /** + * Helper method to resolve contacts in an addresslist + * @param addrList, list of addresses whose contacts need to be resolved + */ + void resolveContacts(ConvergedMessageAddressList addrList); + + /** + * Helper method to check if a given address is self-address or not + * @param address, address to be verified + * @param selfAddrList, list of self-addresses + * @return bool, true if address is a self-address + */ + bool isSelfAddress(QString address,QStringList selfAddrList); + private: // Data @@ -255,6 +290,8 @@ CEikRichTextEditor* iEditor; // owned CMDXMLDocument* iDom; + // owned + UniEditorGenUtils* iGenUtils; }; #endif // __UNIEDITORMMSPLUGINPRIVATE_H diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -46,7 +46,6 @@ #include "msgcontacthandler.h" #include #include "debugtraces.h" -#include "UniEditorGenUtils.h" // Possible values for mms validity period in seconds const TInt32 KUniMmsValidityPeriod1h = 3600; @@ -103,6 +102,7 @@ { delete iSession; } + delete iGenUtils; } // ----------------------------------------------------------------------------- @@ -113,6 +113,7 @@ CUniEditorMmsPluginPrivate::CUniEditorMmsPluginPrivate( ) { TRAP_IGNORE(iSession = CMsvSession::OpenSyncL(*this)); + iGenUtils = new UniEditorGenUtils(); } // ----------------------------------------------------------------------------- @@ -664,9 +665,7 @@ // Internal data structures always holds the address data in western format. // UI is responsible of doing language specific conversions. //MuiuTextUtils::ConvertDigitsTo( addressPtr, EDigitTypeWestern ); - UniEditorGenUtils* genUtils = new UniEditorGenUtils(); - genUtils->ConvertDigitsTo( addressPtr, EDigitTypeWestern ); - delete genUtils; + iGenUtils->ConvertDigitsTo( addressPtr, EDigitTypeWestern ); } if ( ( aDetails.Length() != 0 ) && // Not a first address @@ -1032,10 +1031,11 @@ { QString alias; int count; - int localId = - MsgContactHandler::resolveContactDisplayName( - addr->address(), alias, count); - addr->setAlias(alias); + if(-1 != MsgContactHandler::resolveContactDisplayName( + addr->address(), alias, count)) + { + addr->setAlias(alias); + } } } } @@ -1048,67 +1048,16 @@ void CUniEditorMmsPluginPrivate::convertFromReplyAllHandlerL( ConvergedMessage* aMessage) { + ConvergedMessage* tempmsg = new ConvergedMessage(); // populate all recipients (and sender for received mms) TMsvEntry entry = MmsMtmL()->Entry().Entry(); if( entry.Parent() == KMsvGlobalInBoxIndexEntryIdValue ) { - populateSenderL(*aMessage); - } - populateRecipientsL(*aMessage); - - // resolve to-field contacts - ConvergedMessageAddressList addrList = aMessage->toAddressList(); - int addrCount = addrList.count(); - for(int i=0; ialias().isEmpty()) - { - QString alias; - int count; - int localId = - MsgContactHandler::resolveContactDisplayName( - addr->address(), alias, count); - addr->setAlias(alias); - } + populateSenderL(*tempmsg); } - - // resolve cc-field contacts - addrList = aMessage->ccAddressList(); - addrCount = addrList.count(); - for(int i=0; ialias().isEmpty()) - { - QString alias; - int count; - int localId = - MsgContactHandler::resolveContactDisplayName( - addr->address(), alias, count); - addr->setAlias(alias); - } - } - - // resolve bcc-field contacts - addrList = aMessage->bccAddressList(); - addrCount = addrList.count(); - for(int i=0; ialias().isEmpty()) - { - QString alias; - int count; - int localId = - MsgContactHandler::resolveContactDisplayName( - addr->address(), alias, count); - addr->setAlias(alias); - } - } + populateRecipientsL(*tempmsg); + removeOwnNumberForReplyAll(tempmsg, aMessage); + delete tempmsg; // populate the subject field QString subject = XQConversions::s60DescToQString( @@ -1176,4 +1125,178 @@ QDEBUG_WRITE("Exit convertFromDefaultHandlerL"); } + +// ----------------------------------------------------------------------------- +// removeOwnNumberForReplyAll +// @see Header +// ----------------------------------------------------------------------------- +void CUniEditorMmsPluginPrivate::removeOwnNumberForReplyAll( + ConvergedMessage* sourcemsg, + ConvergedMessage* targetmsg) +{ + // allocate new memory for trimming the address list + // why do we need it? Because ConvergedMessageAddressList is implicitely + // shared, and Implicit sharing automatically detaches the object from + // a shared block if the object is about to change and the reference count + // is greater than one. This is called copy-on-write or value semantics. + ConvergedMessageAddressList toAddrList = + copyAddrList(sourcemsg->toAddressList()); + ConvergedMessageAddressList ccAddrList = + copyAddrList(sourcemsg->ccAddressList()); + ConvergedMessageAddressList bccAddrList = + copyAddrList(sourcemsg->bccAddressList()); + + // start self-address check/remove process. Stop if there's only one + // address left in the address-list (to+cc+bcc) + QStringList selfAddrs = MsgContactHandler::selfAddresses(); + int remainingAddr = + toAddrList.count() + ccAddrList.count() + bccAddrList.count(); + bool runOwnAddrCheck =(remainingAddr>1)?true:false; + if(runOwnAddrCheck) + { + foreach(ConvergedMessageAddress *bccAddress,bccAddrList) + { + if(isSelfAddress(bccAddress->address(), selfAddrs)) + { + bccAddrList.removeOne(bccAddress); + --remainingAddr; + if(remainingAddr == 1) + { + runOwnAddrCheck = false; + break; + } + } + } + } + + if(runOwnAddrCheck) + { + foreach(ConvergedMessageAddress *ccAddress,ccAddrList) + { + if(isSelfAddress(ccAddress->address(), selfAddrs)) + { + ccAddrList.removeOne(ccAddress); + --remainingAddr; + if(remainingAddr == 1) + { + runOwnAddrCheck = false; + break; + } + } + } + } + + if(runOwnAddrCheck) + { + foreach(ConvergedMessageAddress *toAddress,toAddrList) + { + if(isSelfAddress(toAddress->address(), selfAddrs)) + { + toAddrList.removeOne(toAddress); + --remainingAddr; + if(remainingAddr == 1) + { + runOwnAddrCheck = false; + break; + } + } + } + } + + // Run contact-resolution on address list now. This is needed + // because we by-pass server and directly feed data in UI + resolveContacts(toAddrList); + resolveContacts(ccAddrList); + resolveContacts(bccAddrList); + + // restore addresses to aMessage + targetmsg->addToRecipients(toAddrList); + targetmsg->addCcRecipients(ccAddrList); + targetmsg->addBccRecipients((bccAddrList)); +} + +// ----------------------------------------------------------------------------- +// copyAddrList +// @see Header +// ----------------------------------------------------------------------------- +ConvergedMessageAddressList CUniEditorMmsPluginPrivate::copyAddrList( + ConvergedMessageAddressList addrList) +{ + ConvergedMessageAddressList copyAddrList; + int count = addrList.count(); + for(int i=0; isetAddress(addrList.at(i)->address()); + addr->setAlias(addrList.at(i)->alias()); + copyAddrList << addr; + } + return copyAddrList; +} + +// ----------------------------------------------------------------------------- +// resolveContacts +// @see Header +// ----------------------------------------------------------------------------- +void CUniEditorMmsPluginPrivate::resolveContacts( + ConvergedMessageAddressList addrList) +{ + int count = addrList.count(); + for(int i=0; ialias().isEmpty()) + { + QString alias; + int count; + if(-1 != MsgContactHandler::resolveContactDisplayName( + addr->address(), alias, count)) + { + addr->setAlias(alias); + } + } + } +} + +// ----------------------------------------------------------------------------- +// isSelfAddress +// @see Header +// ----------------------------------------------------------------------------- +bool CUniEditorMmsPluginPrivate::isSelfAddress( + QString address, + QStringList selfAddrList) +{ + bool ifSelfAddr = false; + + TRAP_IGNORE( + // check if the given address is an email-address + HBufC* addr = XQConversions::qStringToS60Desc(address); + CleanupStack::PushL(addr); + + if( iGenUtils->IsValidEmailAddress(*addr) ) + { + ifSelfAddr = selfAddrList.contains(address, Qt::CaseInsensitive); + } + else // address is a phonenumber, use contact matching + { + foreach(QString selfaddress, selfAddrList) + { + bool ret = false; + HBufC* selfAddr = XQConversions::qStringToS60Desc(selfaddress); + CleanupStack::PushL(selfAddr); + ret = iGenUtils->MatchPhoneNumberL(*addr,*selfAddr); + CleanupStack::PopAndDestroy(selfAddr); + if(ret) + { + ifSelfAddr = true; + break; + } + } + } + CleanupStack::PopAndDestroy(addr); + ); + return ifSelfAddr; +} + // End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsgpluginapp.pro --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsgpluginapp.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsgpluginapp.pro Tue Aug 31 18:53:38 2010 +0530 @@ -16,7 +16,7 @@ TEMPLATE = subdirs -SUBDIRS += mmstestbed/mmstestbed.pro -SUBDIRS += testmmsplugin/testmmsplugin.pro +SUBDIRS += mmstestbed +SUBDIRS += testmmsplugin CONFIG += ordered \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/inc/testmmsplugin.ini --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/inc/testmmsplugin.ini Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/inc/testmmsplugin.ini Tue Aug 31 18:53:38 2010 +0530 @@ -7,14 +7,3 @@ const char TEST_ATTACHMENT5[] = "c:\\data\\TestMMSPluginSample.txt"; const char TEST_CC[] = "DummyCCAddress<+919860479113>"; const char TEST_BCC[] = "DummyBCCAddress<+919860479114>"; - -//out put directory for test results. -QString OUTPUTDIRECTORY = "c:/logs/TestMmsPlugin"; -//o/p directory for data to be written on temp file. -QString TEMPDIR = "c:/logs/TestMmsPlugin/testdata"; -//test result O/P file name. -QString RESULTFILE = "c:/logs/TestMmsPlugin/result_%1.txt"; -// folder named UID3 of msgapptestsuite inside private folder. -const QString PRIVATE_DIR("C:/private/E274bf60"); -//application class name -const QString appClassName("TestMmsPlugin"); \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/src/testmmsplugin.cpp --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/src/testmmsplugin.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/src/testmmsplugin.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -413,67 +413,29 @@ } //--------------------------------------------------------------- -// getObject -// factory method to create objects. -//--------------------------------------------------------------- -QObject* getObject(QString className) -{ - if(className == "TestMmsPlugin" ) - { - return new TestMmsPlugin; - } - else - { - return 0; - } -} - -//--------------------------------------------------------------- -// createOutPutDirectory -// creating o/p directory. -//--------------------------------------------------------------- -void createOutPutDirectory() - { - QDir dir; - //o/p dir - dir.mkdir(OUTPUTDIRECTORY); - //tmp dir - dir.mkdir(TEMPDIR); - // dir inside private folder. - dir.mkdir(PRIVATE_DIR); - } - -//--------------------------------------------------------------- // main // main entry point //--------------------------------------------------------------- int main(int argc, char *argv[]) { - int ret = -1; - QCoreApplication app(argc, argv); - - //creating output directory. - createOutPutDirectory(); - - QStringList args; - QString appName = argv[0]; - args << appName; - - QString option = "-o"; - args << option; - - QString outFile = RESULTFILE; - outFile = outFile.arg(appClassName); - args << outFile; - - QObject* tc = getObject(appClassName); - - if(tc) - { - ret = QTest::qExec(tc, args); - delete tc; - } - return ret; + int ret = -1; + QCoreApplication app(argc, argv); + QObject* tc = new TestMmsPlugin(); + +#ifdef __WINSCW__ + char *new_argv[3]; + QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; + QByteArray bytes = str.toAscii(); + char arg1[] = "-o"; + new_argv[0] = argv[0]; + new_argv[1] = arg1; + new_argv[2] = bytes.data(); + ret = QTest::qExec(tc, 3, new_argv); +#else + ret = QTest::qExec(tc, argc, argv); +#endif + delete tc; + return ret; } //End of File diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/tsrc.pro --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/tsrc.pro Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/tsrc.pro Tue Aug 31 18:53:38 2010 +0530 @@ -16,6 +16,6 @@ TEMPLATE = subdirs -SUBDIRS += testmmsgpluginapp/testmmsgpluginapp.pro +SUBDIRS += testmmsgpluginapp CONFIG += ordered \ No newline at end of file diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/inc/unieditorsmsplugin_p.h --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/inc/unieditorsmsplugin_p.h Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/inc/unieditorsmsplugin_p.h Tue Aug 31 18:53:38 2010 +0530 @@ -259,7 +259,7 @@ /** * set/update sms settings */ - void SetSmsSettingsL(); + void SetSmsSettingsL(ConvergedMessage* message); /** * set data to the sms diff -r 5b3b2fa8c3ec -r f42d9a78f435 messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp --- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp Wed Aug 18 00:46:12 2010 +0530 +++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp Tue Aug 31 18:53:38 2010 +0530 @@ -329,6 +329,17 @@ //Populate message body populateMessageBodyL(aMessage,msvEntry); + + // read flag for reply-via-same-smsc usecase + bool replyPath = SmsMtmL()->SmsHeader().Submit().ReplyPath(); + aMessage->setReplyPath(replyPath); + if(replyPath) + { + // save smsc in the message + QString scaddress = XQConversions::s60DescToQString( + SmsMtmL()->SmsHeader().Message().ServiceCenterAddress()); + aMessage->setOriginatingSC(scaddress); + } } else if(aOperation == UniEditorPluginInterface::Forward) { @@ -368,7 +379,7 @@ // set sms data SetSmsDataL( message ); // set sms settings - SetSmsSettingsL(); + SetSmsSettingsL( message ); // save all changes for the entry SmsMtmL()->SaveMessageL(); ); @@ -692,7 +703,7 @@ // SetSmsSettingsL // @see header // ----------------------------------------------------------------------------- -void UniEditorSmsPluginPrivate::SetSmsSettingsL() +void UniEditorSmsPluginPrivate::SetSmsSettingsL(ConvergedMessage* message) { CSmsSettings* sendOptions = CSmsSettings::NewL(); CleanupStack::PushL( sendOptions ); @@ -728,7 +739,7 @@ sendOptions->SetDeliveryReport( defaultSettings->DeliveryReport() ); sendOptions->SetSmsBearer( defaultSettings->SmsBearer() ); sendOptions->SetValidityPeriod( defaultSettings->ValidityPeriod() ); - sendOptions->SetReplyPath( defaultSettings->ReplyPath() ); + sendOptions->SetReplyPath( message->replyPath() ); if (defaultSettings->CharacterSet() == TSmsDataCodingScheme::ESmsAlphabetUCS2) @@ -744,9 +755,16 @@ // Move all the stuff from iSmsHeader::SmsSettings to SmsMtm::SmsHeader::SmsSettings SmsMtmL()->SmsHeader( ).SetSmsSettingsL( *sendOptions ); - //If sc is existant then only set the default service center - if(ValidateSCNumberL()) + + // if reply-path is present, then lets use it + if(message->replyPath()) { + QString scaddress = message->originatingSC(); + SmsMtmL()->SmsHeader( ).Message( ). + SetServiceCenterAddressL( *XQConversions::qStringToS60Desc(scaddress) ); + } + else if(ValidateSCNumberL()) + { // Or if default SC is existant then only set the default SC SmsMtmL()->SmsHeader( ).Message( ). SetServiceCenterAddressL( defaultSettings->GetServiceCenter(defaultSettings->DefaultServiceCenter()).Address() ); } @@ -1917,6 +1935,16 @@ ConvergedMessageAddress messageAddress(addr); aMessage->addToRecipient(messageAddress); } + // read flag for reply-via-same-smsc usecase + bool replyPath = SmsMtmL()->SmsHeader().Deliver().ReplyPath(); + aMessage->setReplyPath(replyPath); + if(replyPath) + { + // save smsc in the message + QString scaddress = XQConversions::s60DescToQString( + SmsMtmL()->SmsHeader().Deliver().ServiceCenterAddress()); + aMessage->setOriginatingSC(scaddress); + } } // else, for outgoing message, populate receiver address in To-field else if(smsPduType == CSmsPDU::ESmsSubmit) @@ -1935,10 +1963,11 @@ { QString alias; int count; - int localId = - MsgContactHandler::resolveContactDisplayName( - addr->address(), alias, count); - addr->setAlias(alias); + if(-1 != MsgContactHandler::resolveContactDisplayName( + addr->address(), alias, count)) + { + addr->setAlias(alias); + } } } }