messagingfw/deprecate/senduiservices/inc/CMessageDataImpl.h
branchRCL_3
changeset 22 d2c4c66342f3
equal deleted inserted replaced
21:e5b3a2155e1a 22:d2c4c66342f3
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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:   Encapsulates the message data for sending services.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_MESSAGEDATAIMPL_H
       
    20 #define C_MESSAGEDATAIMPL_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <badesca.h>
       
    24 #include <f32file.h>
       
    25 #include <msvstd.h>
       
    26 #include <CMessageAddress.h>
       
    27 
       
    28 class MDesC16Array;
       
    29 class CRichText;
       
    30 
       
    31 /**
       
    32 *  Encapsulates the message data for sending services.
       
    33 *
       
    34 *  Encapsulates the message data for sending services. Class supports
       
    35 *  externalazation and internalization, which are used to relay message 
       
    36 *  to SendUI server application.
       
    37 *
       
    38 *  @lib sendui
       
    39 *  @since S60 v3.2
       
    40 */ 
       
    41 NONSHARABLE_CLASS( CMessageDataImpl ) : public CBase
       
    42     {
       
    43     public:  // Constructors and destructor
       
    44 
       
    45         /**
       
    46         * Two-phased constructor.
       
    47         *
       
    48         * @return Pointer to object of CMessageDataImpl.
       
    49         */
       
    50         static CMessageDataImpl* NewL();
       
    51 
       
    52         /**
       
    53         * Two-phased constructor.
       
    54         *
       
    55         * @return Pointer to object of CMessageDataImpl.
       
    56         */
       
    57         static CMessageDataImpl* NewLC();
       
    58 
       
    59         /**
       
    60         * Destructor.
       
    61         */
       
    62         virtual ~CMessageDataImpl();
       
    63 
       
    64     public: // New functions
       
    65 
       
    66         /**
       
    67         * Set message subject.
       
    68         *
       
    69         * @since Series 60 3.0
       
    70         * @param aSubject Sets message subject. Does not take ownership.
       
    71         * @return None.
       
    72         */
       
    73         void SetSubjectL( const TDesC* aSubject );
       
    74 
       
    75         /**
       
    76         * Returns message subject.
       
    77         *
       
    78         * @since Series 60 3.0
       
    79         * @return Message subject.
       
    80         */
       
    81         const TPtrC Subject() const;
       
    82 
       
    83         /**
       
    84         * Appends attachment file path to the array of attachment file paths. Only a link 
       
    85         * to the attachment is stored and compared to AppendAttachmentHandleL less resources 
       
    86         * is used during the send operation.
       
    87         * 
       
    88         * NOTE: Do not add any temporary files as an attachment. Always use 
       
    89         * AppendAttachmentHandleL for temporary files.
       
    90         *
       
    91         * @since Series 60 3.2
       
    92         * @param aFilePath File path of the attachment. 
       
    93         *                  
       
    94         * @return None.
       
    95         */
       
    96         void AppendAttachmentL( const TDesC& aFilePath );
       
    97 
       
    98         /**
       
    99         * Returns the array of attachment file paths.
       
   100         *
       
   101         * @since Series 60 3.2
       
   102         * @return Array of attachment file paths.
       
   103         */
       
   104         const CDesCArray& AttachmentArray() const;
       
   105 
       
   106         /**
       
   107         * Clears the array of attachment file paths.
       
   108         *
       
   109         * @since Series 60 3.2
       
   110         * @return Array of attachment file paths.
       
   111         */        
       
   112         void ClearAttachmentArray();
       
   113 
       
   114         /**
       
   115         * Encapsulates address and alias to CMessageAddress and adds to array.
       
   116         *
       
   117         * @since Series 60 3.2
       
   118         * @param aAddress Real address.
       
   119         * @param aAlias Alias for the real address.
       
   120         * @return None.
       
   121         */
       
   122         void AppendToAddressL(
       
   123             const TDesC& aAddress,
       
   124             const TDesC& aAlias = KNullDesC);
       
   125 
       
   126         /**
       
   127         * Returns array of addresses and aliases.
       
   128         *
       
   129         * @since Series 60 3.2
       
   130         * @return Array of addresses and aliases.
       
   131         */
       
   132         const CMessageAddressArray& ToAddressArray() const;
       
   133 
       
   134         /**
       
   135         * Encapsulates CC address and alias to CMessageAddress and adds to 
       
   136         * array.
       
   137         *
       
   138         * @since Series 60 3.2
       
   139         * @param aCcAddress Real CC-address.
       
   140         * @param aCcAlias Alias for the real CC-address.
       
   141         * @return None.
       
   142         */
       
   143         void AppendCcAddressL(
       
   144             const TDesC& aCcAddress,
       
   145             const TDesC& aCcAlias = KNullDesC);
       
   146 
       
   147         /**
       
   148         * Returns array of CC addresses and aliases.
       
   149         *
       
   150         * @since Series 60 3.2
       
   151         * @return Array of cc addresses and aliases.
       
   152         */
       
   153         const CMessageAddressArray& CcAddressArray() const;
       
   154 
       
   155         /**
       
   156         * Encapsulates Bcc address and alias to CMessageAddress and adds to
       
   157         * array.
       
   158         *
       
   159         * @since Series 60 3.2
       
   160         * @param aBccAddress Real Bcc-address.
       
   161         * @param aBccAlias Alias for the real Bcc-address.
       
   162         * @return None.
       
   163         */
       
   164         void AppendBccAddressL(
       
   165             const TDesC& aBccAddress,
       
   166             const TDesC& aBccAlias = KNullDesC);
       
   167 
       
   168         /**
       
   169         * Returns array of Bcc addresses and aliases.
       
   170         *
       
   171         * @since Series 60 3.2
       
   172         * @return Array of Bcc addresses and aliases.
       
   173         */
       
   174         const CMessageAddressArray& BccAddressArray() const;
       
   175 
       
   176         /**
       
   177         * Set message body text.
       
   178         *
       
   179         * @since Series 60 3.2
       
   180         * @param aBodyText Message body text.
       
   181         * @return None.
       
   182         */
       
   183         void SetBodyTextL( const CRichText* aBodyText );
       
   184 
       
   185         /**
       
   186         * Returns message body text.
       
   187         *
       
   188         * @since Series 60 3.2
       
   189         * @return Message body text.
       
   190         */
       
   191         const CRichText* BodyText() const;
       
   192 
       
   193         /**
       
   194         * Appends attachment handle to the array of attachment handles. 
       
   195         *
       
   196         * NOTE: Attachment handles should be opened using ShareProtected()
       
   197         * file session, otherwise handles can not be transfered through
       
   198         * client-server interface.
       
   199         *
       
   200         * NOTE: When adding a temporary file as an attachment, always use this method,
       
   201         *
       
   202         * @since Series 60 3.2
       
   203         * @param aFileHandle File handle of the attachment.
       
   204         * @return None.
       
   205         */
       
   206         void AppendAttachmentHandleL( const RFile& aFileHandle );
       
   207 
       
   208         /**
       
   209         * Returns the array of attachment handles.
       
   210         *
       
   211         * @since Series 60 3.2
       
   212         * @return Array of attachment handles.
       
   213         */
       
   214         const RArray<RFile>& AttachmentHandleArray() const;
       
   215 
       
   216         /**
       
   217         * Returns data type id.
       
   218         *
       
   219         * This is used for static casting.
       
   220         * @since Series 60 3.2
       
   221         * @return Data type id.
       
   222         */
       
   223         TUid DataType() const;
       
   224 
       
   225         /**
       
   226         * Clears all addressee arrays.
       
   227         *
       
   228         * @since Series 60 3.2
       
   229         * @return None.
       
   230         */ 
       
   231         void ClearAddresses();
       
   232 
       
   233         /**
       
   234         * Externalizes message data to a stream
       
   235         *
       
   236         * @since Series 60 3.2
       
   237         * @return None.
       
   238         */ 
       
   239 
       
   240         void ExternalizeL( RWriteStream& aStream ) const;
       
   241 
       
   242         /**
       
   243         * Internalizes message data to from a stream
       
   244         *
       
   245         * @since Series 60 3.2
       
   246         * @return None.
       
   247         */ 
       
   248         void InternalizeL( RReadStream& aStream );
       
   249         
       
   250         /**
       
   251         * Set opaque data
       
   252         *
       
   253         * @since Series 60 3.2
       
   254         * @param aData Opaque data.
       
   255         * @return None.
       
   256         */
       
   257         void SetOpaqueDataL( const TDesC8* aData );
       
   258         
       
   259         /**
       
   260         * Get opaque data
       
   261         *
       
   262         * @since Series 60 3.2
       
   263         * @return aData Opaque data.
       
   264         */
       
   265         const TPtrC8 OpaqueData() const;
       
   266 
       
   267     private:
       
   268 
       
   269         /**
       
   270         * C++ default constructor.
       
   271         */
       
   272         CMessageDataImpl();
       
   273 
       
   274         /**
       
   275         * By default Symbian 2nd phase constructor is private.
       
   276         */
       
   277         void ConstructL();
       
   278 
       
   279         /**
       
   280         * Externalizes an address array
       
   281         *
       
   282         * @since Series 60 3.2
       
   283         * @param anArray Addresses to be externalized
       
   284         * @param aStream Destination stream
       
   285         * @return None.
       
   286         */ 
       
   287         void ExternalizeArrayL(   CMessageAddressArray* anArray,    RWriteStream& aStream ) const;
       
   288 
       
   289         /**
       
   290         * Internalizes an address array
       
   291         *
       
   292         * @since Series 60 3.2
       
   293         * @param anArray Destination of the internalized addresses
       
   294         * @param aStream Source stream
       
   295         * @return None.
       
   296         */ 
       
   297         void InternalizeArrayL( CMessageAddressArray* anArray,  RReadStream& aStream );
       
   298 
       
   299         /**
       
   300         * Creates temporary path
       
   301         */
       
   302         void CreateTempPathL( TDes16& aPath, RFs& aFs ) const;
       
   303 
       
   304     protected:  // Data
       
   305 
       
   306         /**
       
   307         * Data type of this message. Normally this is KSenduiMsgDataBase
       
   308         */
       
   309         TUid                            iDataType;
       
   310 
       
   311         private:  // Data
       
   312 
       
   313         /**
       
   314         *  Message subject. 
       
   315         *  Owned.
       
   316         */
       
   317         HBufC*                          iSubject;
       
   318 
       
   319         /**
       
   320         *  Message body text. 
       
   321         *  Owned.
       
   322         */
       
   323         CRichText*                      iBodyText;
       
   324 
       
   325         /**
       
   326         *  Attachment filepaths. 
       
   327         *  Owned.
       
   328         */
       
   329         CDesCArray*                     iAttachments;
       
   330 
       
   331         /**
       
   332         *  Array of real addresses and aliases. 
       
   333         *  Owned.
       
   334         */
       
   335         CMessageAddressArray*           iToAddresses;
       
   336 
       
   337         /**
       
   338         *  Array of real CC addresses and aliases. 
       
   339         *  Owned.
       
   340         */
       
   341         CMessageAddressArray*           iCcAddresses;
       
   342 
       
   343         /**
       
   344         *  Array of real BC addresses and aliases.
       
   345         *  Owned.
       
   346         */
       
   347         CMessageAddressArray*           iBccAddresses;
       
   348 
       
   349         /**
       
   350         *  Attachment handles. 
       
   351         *  Owned.
       
   352         */
       
   353         RArray<RFile>                   iAttachmentHandles;
       
   354         
       
   355         /**
       
   356         *  Opaque data. Interpretation depends on service handler.
       
   357         *  Owned.
       
   358         */
       
   359         HBufC8*                          iOpaqueData;
       
   360     };
       
   361 
       
   362 #endif      // C_MESSAGEDATAIMPL_H
       
   363 
       
   364 // End of File
       
   365