messagingappbase/smsmtm/clientmtm/inc/SMSCLNT.H
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
child 79 2981cb3aa489
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // SMSCLNT.H
       
    15 //
       
    16 /**
       
    17  * @file 
       
    18  * @publishedAll
       
    19  * @released
       
    20  */
       
    21 #ifndef __SMSCLNT_H__
       
    22 #define __SMSCLNT_H__
       
    23 
       
    24 #include <mtclbase.h>
       
    25 #include <smuthdr.h>
       
    26 
       
    27 class CSmsHeader;
       
    28 class CSmsMessage;
       
    29 class CSmsSettings;
       
    30 class TSmsUtilities;
       
    31 class CSmsSimParamOperation;
       
    32 class CMobilePhoneSmspList;
       
    33 class RResourceFile;
       
    34 
       
    35 /** 
       
    36 The SMS client MTM interface.
       
    37 
       
    38 Most of the functions in this class are implementations of the virtual functions 
       
    39 defined by the base class CBaseMtm.
       
    40 
       
    41 An object of this class can be obtained from the Client MTM registry. The message
       
    42 server provides the necessary information required by the registry to provide
       
    43 the SMS client MTM.
       
    44 
       
    45 All client MTM objects have a current context. This is an entry in the message 
       
    46 store that will be manipulated by certain APIs supplied by the MTM. If the 
       
    47 current context is not set then certain APIs will panic. 
       
    48 
       
    49 The CBaseMtm::HasContext API can be used to check that the current context has 
       
    50 been set. It can be set using either the CBaseMtm::SwitchCurrenEntryL API or the
       
    51 CBaseMtm::SetCurrentEntryL API.
       
    52 
       
    53 @see	CClientMtmRegistry
       
    54 @see	CBaseMtm::HasContext
       
    55 @see	CBaseMtm::SetCurrentEntryL
       
    56 @see	CBaseMtm::SwitchCurrenEntryL
       
    57 
       
    58 @publishedAll
       
    59 @released
       
    60 */
       
    61 NONSHARABLE_CLASS (CSmsClientMtm) : public CBaseMtm
       
    62 	{
       
    63 public:
       
    64 
       
    65 	IMPORT_C static CSmsClientMtm* NewL(CRegisteredMtmDll& aRegisteredMtmDll,CMsvSession& aSession);
       
    66 	virtual ~CSmsClientMtm();
       
    67 
       
    68 	void HandleEntryEvent(enum MMsvEntryObserver::TMsvEntryEvent,TAny*,TAny*,TAny*);
       
    69 
       
    70 	inline CSmsHeader& SmsHeader();
       
    71 	inline const CSmsHeader& SmsHeader() const;
       
    72 	inline CSmsSettings& ServiceSettings();
       
    73 	inline const CSmsSettings& ServiceSettings() const;
       
    74 	inline TInt ServiceId() const;
       
    75 
       
    76 	IMPORT_C void RestoreServiceAndSettingsL();
       
    77 	IMPORT_C CSmsSimParamOperation* ReadSimParamsL(TRequestStatus& aObserverRequestStatus);
       
    78 	IMPORT_C CSmsSimParamOperation* WriteSimParamsL(const CMobilePhoneSmspList& aList, TRequestStatus& aObserverRequestStatus); 
       
    79 	IMPORT_C void SaveMessageL(CMsvStore& aEditStore, TMsvEntry& aEntry);
       
    80 	IMPORT_C void CreateMessageL(TMsvEntry& aEntry);
       
    81 	/** 
       
    82 	Sets the character encoding value. The character encoding value options are 7-bit,
       
    83 	8-bit and 16-Bit Unicode. By default the character set encoding is 7 bit encoding.
       
    84 	*/
       
    85 	void SetMessageCharacterSetL(TSmsDataCodingScheme::TSmsAlphabet aTsmsAlphabet);
       
    86 
       
    87 public:	// methods from CBaseMtm
       
    88 
       
    89 	virtual void SaveMessageL(); 
       
    90 	virtual void LoadMessageL();
       
    91 	virtual TMsvPartList ValidateMessage(TMsvPartList aPartList);
       
    92 	virtual TMsvPartList Find(const TDesC& aTextToFind, TMsvPartList aPartList);
       
    93 	virtual CMsvOperation* ReplyL(TMsvId aDestination, TMsvPartList aPartList, TRequestStatus& aCompletionStatus);
       
    94 	virtual CMsvOperation* ForwardL(TMsvId aDestination, TMsvPartList aPartList, TRequestStatus& aCompletionStatus);
       
    95 	virtual void AddAddresseeL(const TDesC& aRealAddress);
       
    96 	virtual void AddAddresseeL(const TDesC& aRealAddress, const TDesC& aAlias);
       
    97 	virtual void RemoveAddressee(TInt aIndex);
       
    98 	virtual TInt QueryCapability(TUid aCapability, TInt& aResponse);
       
    99 	virtual void InvokeSyncFunctionL(TInt aFunctionId,const CMsvEntrySelection& aSelection, TDes8& aParameter);
       
   100 	virtual CMsvOperation* InvokeAsyncFunctionL(TInt aFunctionId,const CMsvEntrySelection& aSelection, TDes8& aParameter, TRequestStatus& aCompletionStatus);
       
   101 
       
   102 	IMPORT_C void CreateMessageL(TMsvId aServiceId);
       
   103 	IMPORT_C void BioTypeChangedL(TUid aBioTypeUid);
       
   104 	
       
   105 protected: 
       
   106 	/**
       
   107 	Methods from CBaseMtm, The implementation of this function assumes that
       
   108     the new service for setting the charset encoding value for a SMS message is supported.
       
   109     */
       
   110 	IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
       
   111  
       
   112 private:
       
   113 
       
   114 	CSmsClientMtm(CRegisteredMtmDll& aRegisteredMtmDll,CMsvSession& aSession);
       
   115 	void ConstructL();
       
   116 
       
   117 	void BasicReplyForwardEntry(TMsvEntry& aNewEntry) const;
       
   118 	CMsvOperation* CreateNewEntryL(TMsvEntry& aNewEntry, TMsvId aDestination,CSmsHeader& aSmsHeader,const CRichText& aBody, TRequestStatus& aCompletionStatus);
       
   119 	TBool ValidRecipients() const;
       
   120 	TBool ValidNumber(const TDesC& aNumber) const;
       
   121 
       
   122 private:	// methods from CBaseMtm
       
   123 
       
   124 	virtual void ContextEntrySwitched(); 
       
   125 
       
   126 private:
       
   127 
       
   128 	void DoAddAddresseeL(const TDesC& aRealAddress, const TDesC& aAlias);
       
   129 	void AddRecipientL(const TDesC& aRealAddress, const TDesC& aAlias);
       
   130 	void DoAddRecipientL(CSmsHeader* aSmsHeader, const TDesC& aRealAddress, const TDesC& aAlias);
       
   131 	void ResetHeader();
       
   132 	TMsvPartList DoFindL(const TDesC& aTextToFind,TMsvPartList aPartList);
       
   133 	void FindL(const TDesC& aTextToFind, const TMsvPartList aPartList,TMsvPartList& aFoundList);
       
   134 	void FindInBodyL(const TDesC& aTextToFind, const TMsvPartList& aFoundList, TMsvPartList& aResult);
       
   135 	HBufC* ReadEmailSubjectFormatL(RResourceFile& aResourceFile, TInt aResourceId, const TDesC& aDefaultFormat);
       
   136 
       
   137 private:
       
   138 
       
   139 	CSmsSettings*	iServiceSettings;
       
   140 	TMsvId			iServiceId;
       
   141 	CSmsHeader*		iSmsHeader;
       
   142 	TChar			iRealAddressOpen;
       
   143 	TChar			iRealAddressClose;
       
   144 	HBufC*			iEmailForwardSubjectFormat;
       
   145 	HBufC*			iEmailReplySubjectFormat;
       
   146 	};
       
   147 
       
   148 #include <smsclnt.inl>
       
   149 
       
   150 #endif	// __SMSCLNT_H__