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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
31 class CSmsSimParamOperation;
32 class CMobilePhoneSmspList;
36 The SMS client MTM interface.
38 Most of the functions in this class are implementations of the virtual functions
39 defined by the base class CBaseMtm.
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
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.
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.
53 @see CClientMtmRegistry
54 @see CBaseMtm::HasContext
55 @see CBaseMtm::SetCurrentEntryL
56 @see CBaseMtm::SwitchCurrenEntryL
61 NONSHARABLE_CLASS (CSmsClientMtm) : public CBaseMtm
65 IMPORT_C static CSmsClientMtm* NewL(CRegisteredMtmDll& aRegisteredMtmDll,CMsvSession& aSession);
66 virtual ~CSmsClientMtm();
68 void HandleEntryEvent(enum MMsvEntryObserver::TMsvEntryEvent,TAny*,TAny*,TAny*);
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;
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);
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.
85 void SetMessageCharacterSetL(TSmsDataCodingScheme::TSmsAlphabet aTsmsAlphabet);
87 public: // methods from CBaseMtm
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);
102 IMPORT_C void CreateMessageL(TMsvId aServiceId);
103 IMPORT_C void BioTypeChangedL(TUid aBioTypeUid);
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.
110 IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
114 CSmsClientMtm(CRegisteredMtmDll& aRegisteredMtmDll,CMsvSession& aSession);
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;
122 private: // methods from CBaseMtm
124 virtual void ContextEntrySwitched();
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);
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);
139 CSmsSettings* iServiceSettings;
141 CSmsHeader* iSmsHeader;
142 TChar iRealAddressOpen;
143 TChar iRealAddressClose;
144 HBufC* iEmailForwardSubjectFormat;
145 HBufC* iEmailReplySubjectFormat;
148 #include <smsclnt.inl>
150 #endif // __SMSCLNT_H__