creator/engine/inc/creator_message.h
branchRCL_3
changeset 21 b3cee849fa46
equal deleted inserted replaced
20:48060abbbeaf 21:b3cee849fa46
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef __CREATORMESSAGES_H__
       
    23 #define __CREATORMESSAGES_H__
       
    24 
       
    25 #include "engine.h"
       
    26 #include "creator_modulebase.h"
       
    27 
       
    28 #include <e32base.h>
       
    29 #include <e32std.h>
       
    30 #include <msvapi.h>
       
    31 #include <mtclbase.h>
       
    32 #include <mtclreg.h>
       
    33 #include <smut.h>
       
    34 #include <smuthdr.h>
       
    35 #include <smsclnt.h>
       
    36 #include <miutset.h>
       
    37 #include <mmsclient.h>
       
    38 #include <ircmtm.h>
       
    39 #include <irmsgtypeuid.h>
       
    40 #include <btmsgtypeuid.h>
       
    41 #include <bif.h>
       
    42 #include <biouids.h>
       
    43 #include <miuthdr.h>
       
    44 
       
    45 #include <cmsvmimeheaders.h>
       
    46 #include <smtcmtm.h>
       
    47 #include <ircmtm.h>
       
    48 #include <btcmtm.h>
       
    49 #include <mmsvattachmentmanager.h>
       
    50 
       
    51 
       
    52 class CCreatorEngine;
       
    53 class CMessagesParameters;
       
    54 class CAsyncWaiter; 
       
    55 
       
    56 enum TMessageType
       
    57     {
       
    58     ESMS = 0,
       
    59     EMMS,
       
    60     EAMS,
       
    61     EEmail,
       
    62     ESmartMessage,
       
    63     EIrMessage,
       
    64     EBTMessage
       
    65     };
       
    66 
       
    67 enum TFolderType
       
    68     {
       
    69     EInbox = 0,
       
    70     EDrafts,
       
    71     EOutbox,
       
    72     ESent,
       
    73     EMailbox
       
    74     };
       
    75     
       
    76 class CRecipientInfo : public CBase
       
    77 {
       
    78 public:
       
    79     CRecipientInfo();
       
    80     virtual ~CRecipientInfo();
       
    81     
       
    82     void SetPhoneNumber(HBufC* aPhone);
       
    83     void SetEmailAddress(HBufC* aEmail);
       
    84     const HBufC* PhoneNumber() const;
       
    85     const HBufC* EmailAddress() const;
       
    86     
       
    87 private:
       
    88     HBufC* iPhoneNumber;
       
    89     HBufC* iEmailAddress;
       
    90 };
       
    91 
       
    92 class CCreatorMessages : public CCreatorModuleBase, public MMsvSessionObserver
       
    93     {
       
    94 enum TCreatorMessagesStatus{
       
    95     ECreatorMessagesDelete = 0,
       
    96     ECreatorMessagesStart, 
       
    97     ECreatorMessagesMessageType,
       
    98     ECreatorMessagesFolderType,
       
    99     ECreatorMessagesMessageStatus, 
       
   100     ECreatorMessagesCharsInBody,
       
   101     ECreatorMessagesAttachment,
       
   102 };
       
   103 
       
   104 public: 
       
   105     static CCreatorMessages* NewL(CCreatorEngine* aEngine);
       
   106     static CCreatorMessages* NewLC(CCreatorEngine* aEngine);
       
   107     ~CCreatorMessages();
       
   108 
       
   109 private:
       
   110     CCreatorMessages();
       
   111     void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase
       
   112 
       
   113     TInt CreateSMSEntryL(const CMessagesParameters& parameters);
       
   114     TInt CreateMMSEntryL(const CMessagesParameters& parameters);
       
   115     TInt CreateAMSEntryL(const CMessagesParameters& parameters);
       
   116     TInt CreateEmailEntryL(const CMessagesParameters& parameters);
       
   117     TInt CreateSmartMessageEntryL(const CMessagesParameters& parameters);
       
   118     TInt CreateObexEntryL(TUid aMtm, const CMessagesParameters& parameters);
       
   119     void HandleAttachementsL(const CMessagesParameters& parameters, CMsvStore* store, TInt err );
       
   120     void HandleAttachementL(CMsvStore* store, TInt err, TFileName& sourceFileName );
       
   121 
       
   122     CMsvEntrySelection* DoGetListOfAccountsL(CMsvSession& aSession, TUid aMtm, TBool aAlwaysListHidden);
       
   123     TMsvId DefaultServiceForMTML(CMsvSession& aSession, TUid aMtm, TBool aFindFirstServiceIfNoDefault);
       
   124 
       
   125     void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); // from MMsvSessionObserver
       
   126     
       
   127     void AddRecipientsL(CBaseMtm& aMtm, const CMessagesParameters& aParameters, TBool aUseEmailAddress );
       
   128     void GetLinkedAddressesL(   RPointerArray<HBufC>& aAddressArray, 
       
   129                                 const RArray<TLinkIdParam>& aLinkIds, 
       
   130                                 TBool aUseEmailAddress,
       
   131                                 TInt aNumOfExistingAddresses );
       
   132     
       
   133     void GetAllRecipientsL(RPointerArray<HBufC>& aRecipientArray, const CMessagesParameters& aParameters, TBool aUseEmailAddress );
       
   134     void SetSenderToEntryDetailsL(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress);
       
   135     void SetRecipientToEntryDetailsL(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress);
       
   136     void AddSenderToMtmAddresseeL(CBaseMtm& aMtm, const CMessagesParameters& aParameters, TBool aUseEmailAddress );
       
   137     void AddMtmSenderL(CMmsClientMtm& aMtm, const CMessagesParameters& aParameters, TBool aUseEmailAddress );
       
   138     void GetSendersL(RPointerArray<HBufC>& aSenderArray, const CMessagesParameters& aParameters, TBool aUseEmailAddress, TInt aMaxNum );
       
   139     void DeleteAllMessagesL( TBool aOnlyCreatedWithCreator );
       
   140     void DeleteAllFromFolderL( const TMsvId aContext, CMsvSession* aSession, CSmsClientMtm* aClientMtm, TBool aOnlyCreatedWithCreator = EFalse );
       
   141     
       
   142 public:
       
   143     TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
       
   144     void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData); //from MUIObserver
       
   145     
       
   146     TInt CreateMessageEntryL(CMessagesParameters *aParameters, TBool aTakeUserGivenParameters=EFalse);    
       
   147     TInt CreateRandomMessageEntryL(TInt aCommand);
       
   148     void DeleteAllL();
       
   149     void DeleteAllCreatedByCreatorL();
       
   150 
       
   151 private:
       
   152     CMessagesParameters*    iParameters;
       
   153     TMessageType            iMessageType;
       
   154     TFolderType             iFolderType;
       
   155     TInt                    iDefinedMessageLength;
       
   156     CArrayFixFlat<TInt>*    iAttachments; 
       
   157     //RPointerArray<HBufC>    iAttachmentPaths;
       
   158     TBool                   iCreateAsUnread;
       
   159     TMsvId                  iUserSelectedMailbox;
       
   160     HBufC*                  iTmpPhoneNumber;
       
   161     HBufC*                  iTmpEmail;
       
   162     RArray<TInt>            iEntryIds; // TMsvId ( == TInt32 ) TMsvEntry::Id()
       
   163     CAsyncWaiter* iWaiter;
       
   164     RPointerArray<HBufC>    iSenderArray;
       
   165     RPointerArray<HBufC>    iRecipientArray;
       
   166 public:
       
   167     };
       
   168 
       
   169 
       
   170 class CMessagesParameters : public CCreatorModuleBaseParameters
       
   171     {
       
   172 public: 
       
   173     TMessageType            iMessageType;
       
   174     TFolderType             iFolderType;
       
   175     HBufC*                  iSenderAddress;    
       
   176     HBufC*                  iRecipientAddress;
       
   177     RPointerArray<HBufC>    iRecipientAddressArray;
       
   178     HBufC*                  iMessageSubject;
       
   179     HBufC*                  iMessageBodyText;
       
   180     CArrayFixFlat<TInt>*    iAttachments; 
       
   181     RPointerArray<HBufC>    iAttachmentPaths;
       
   182     TInt                    iDefinedMessageLength;
       
   183     TUid                    iBIOMessageType;
       
   184     TBool                   iCreateAsUnread;
       
   185     RArray<TLinkIdParam>    iRecipientLinkIds;
       
   186     RArray<TLinkIdParam>    iSenderLinkIds;
       
   187     TInt                    iNumberOfExistingRecipients;
       
   188     TInt                    iNumberOfExistingSenders;
       
   189 
       
   190 public:
       
   191     CMessagesParameters();
       
   192     ~CMessagesParameters();
       
   193     };
       
   194 
       
   195 
       
   196 
       
   197 #endif // __CREATORMESSAGES_H__