messagingfw/sendas/server/inc/csendasmessage.h
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2004-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 //
       
    15 
       
    16 #ifndef __CSENDASMESSAGE_H__
       
    17 #define __CSENDASMESSAGE_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <msvids.h>
       
    21 #include <rsendasmessage.h>
       
    22 #include <tsendasclientpanic.h>
       
    23 
       
    24 #include "msendassenderobserver.h"
       
    25 #include "msendasattachmentobserver.h"
       
    26 #include "sendasserverdefs.h"
       
    27 
       
    28 // forward declarations
       
    29 class CSendAsSession;
       
    30 class CSendAsAttachment;
       
    31 class CSendAsSender;
       
    32 
       
    33 /**
       
    34 A message is represented by this object, one per message.
       
    35 
       
    36 This class is derived from CObject, so that the object ID methods
       
    37 can be used to handle messages in the correct subsession.
       
    38 
       
    39 @internalComponent
       
    40 @released
       
    41 */
       
    42 class CSendAsMessage : public CObject, public MSendAsSenderObserver, public MSendAsAttachmentObserver
       
    43 	{
       
    44 public:
       
    45 	static CSendAsMessage* NewL(CSendAsSession& aSession);
       
    46 	virtual ~CSendAsMessage();
       
    47 
       
    48 	TBool DoSubSessionServiceL(const RMessage2& aMsg);
       
    49 	void CancelMessage();
       
    50 private:
       
    51 	CSendAsMessage(CSendAsSession& aSession);
       
    52 	void ConstructL();
       
    53 	//
       
    54 	void CreateMessageForAccountL(const RMessage2& aMessage);
       
    55 	void CreateMessageByTypeL(const RMessage2& aMessage);
       
    56 	void ProgressL(const RMessage2& aMessage);
       
    57 	void DeleteMessageL(const RMessage2& aMessage);
       
    58 	void SetBodyTextL(const RMessage2& aMessage, TBool aFirstChunk = EFalse);
       
    59 	void SetSubjectL(const RMessage2& aMessage);
       
    60 	void SetBioTypeL(const RMessage2& aMessage);
       
    61 	void TransferAttachmentFileL(const RMessage2& aMessage);
       
    62 	void AddRecipientWithAliasL(const RMessage2& aMessage);
       
    63 	void AddRecipientL(const RMessage2& aMessage);
       
    64 	void AddAttachmentL(const RMessage2& aMessage);
       
    65 	void AddAttachmentWithMimeTypeL(const RMessage2& aMessage);
       
    66 	void AddLinkedAttachmentL(const RMessage2& aMessage);
       
    67 	void AddLinkedAttachmentWithMimeTypeL(const RMessage2& aMessage);
       
    68 	void CreateAttachmentL(const RMessage2& aMessage);
       
    69 	void CreateAttachmentWithMimeTypeL(const RMessage2& aMessage);
       
    70 	void Cancel();
       
    71 	void LaunchEditorL(const RMessage2& aMessage);
       
    72 	void SendMessageL(const RMessage2& aMessage, TBool aConfirmed, TBool aBackground = EFalse);
       
    73         void DoSaveMessageL();
       
    74 	//
       
    75 	void DoCreateMessageL(TUid aMtm, TSendAsAccount aAccount = KMsvRootIndexEntryId);
       
    76 	void PrepareAddCreateAttachmentL(const RMessage2& aMessage);
       
    77 	void DeleteClientMtm();
       
    78 	void VerifyCallerCapabilitiesL(const RMessage2& aMessage, TBool& aConfirmed);
       
    79 	
       
    80 	/** 
       
    81 	Sets the character encoding value. The character encoding value options are 7-bit,
       
    82 	8-bit and 16-Bit Unicode. By default the character set encoding is 7 bit encoding.
       
    83 	*/
       
    84 	void SetMessageCharacterSetL(const RMessage2& aMessage);	
       
    85 
       
    86 	void SetCharsetInfoForAttachment(const RMessage2& aMessage);
       
    87 	//
       
    88 	HBufC* GetDesParamLC(const RMessage2& aMsg, TInt aIndex);
       
    89 	HBufC8* GetDesParam8LC(const RMessage2& aMsg, TInt aIndex);
       
    90 	//
       
    91 	void PanicClientL(const RMessage2& aMessage, TSendAsClientPanic aPanic) const;
       
    92 	// methods from MSendAsSenderObserver
       
    93 	virtual void SenderComplete(TInt aError);
       
    94 	// methods from MSendAsAttachmentObserver
       
    95 	virtual void AttachmentCompleteL(TInt aError, TBool aCompleteMessage);
       
    96 private:
       
    97 	enum TSendAsMessageState
       
    98 		{
       
    99 		EIdle,
       
   100 		EMessageCreated,
       
   101 		EAddingOrCreatingAttachment,
       
   102 		ESendingMessage,
       
   103 		ESendingMessageComplete,
       
   104 		EMessageDeleted,
       
   105 		EPendingClose
       
   106 		};
       
   107 private:
       
   108 	TMsvSendOperationProgress	iProgress;
       
   109 	TSendAsMessageState 		iState;
       
   110 	CSendAsSession& 			iSession;
       
   111 	TUid						iMessageType;
       
   112 	CSendAsSender*				iSender;
       
   113 	CBaseMtm*					iClientMtm;
       
   114 	CSendAsAttachment*			iAttachment;
       
   115 	RMessage2					iQueuedMessage;
       
   116 	RFile						iAttachmentFile;
       
   117 	TUint						iSignatureSize;
       
   118 	TUint						iCharSet;
       
   119 	};
       
   120 		
       
   121 #endif	// __CSENDASMESSAGE_H__