messagingfw/deprecate/send_ui_datautils_api/inc/CSendUiAttachment.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 message real addressa and alias
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef T_ATTACHMENTFILE_H
       
    21 #define T_ATTACHMENTFILE_H
       
    22 
       
    23 #include <e32base.h> 
       
    24 #include <apmstd.h>
       
    25 
       
    26 // Forward declarations
       
    27 class RFs;
       
    28 class RFile;
       
    29 class TDesC16;
       
    30 class RApaLsSession;
       
    31 class CDesC16Array;
       
    32 class CRichText;
       
    33 class CMsvSession;
       
    34 class CFileMan;
       
    35 
       
    36 NONSHARABLE_CLASS (CSendUiAttachment) : public CBase
       
    37 	{
       
    38 public:
       
    39 
       
    40 	enum TSendUiAttachmentType
       
    41 		{
       
    42 		EAttachmentHandle,
       
    43 		EAttachmentPath
       
    44 		};
       
    45 		
       
    46 	enum TSendUiAttachmentFlags
       
    47 	    {
       
    48 	    EAttachmentTemporary = 0x01  // The file will be deleted at object destruction
       
    49 	    };
       
    50 	
       
    51 public:	
       
    52 
       
    53     /**
       
    54      * NewLC
       
    55      *
       
    56      * Member variables iPath, iHandle and iSize are guaranteed to have a correct values
       
    57      * after creation. Owns created iHandle.
       
    58      * 
       
    59      * @return Pointer to a valid CSendUiAttachment object.
       
    60      */  
       
    61     static CSendUiAttachment* NewLC( const TDesC16* aPath, RFs& aRFs );
       
    62 
       
    63    /**
       
    64     * NewLC
       
    65     *
       
    66     * @param aHandle Does not take ownership of aHandle. iHandle is not own.
       
    67     */
       
    68     static CSendUiAttachment* NewLC( const RFile* aHandle );
       
    69 	
       
    70    /**
       
    71     * NewLC
       
    72     *
       
    73     * @param aBodyText Object of CRichText. Temporary attachment file is created, which
       
    74     *        takes name of first characters of the CRichText object. The created iHandle
       
    75     *        is own.
       
    76     */
       
    77     static CSendUiAttachment* NewLC( const CRichText& aBodyText, RFs& aRFs );
       
    78 	
       
    79 	void ConstructL( const TDesC16* aPath, RFs& aRFs );
       
    80 	
       
    81 	void ConstructL( const CRichText& aBodyText, RFs& aRFs );
       
    82 	
       
    83 	CSendUiAttachment( );
       
    84 	
       
    85 	virtual ~CSendUiAttachment();
       
    86 
       
    87     /**
       
    88     * InitAttachmentArrayLCC
       
    89     *
       
    90     * Static init function for importing file paths and handles into CSendUiAttachment
       
    91     * array.
       
    92     */
       
    93     IMPORT_C static CArrayPtrFlat<CSendUiAttachment>* InitAttachmentArrayLCC(
       
    94         const CDesC16Array& aPaths,
       
    95         const RArray<RFile>& aHandles,
       
    96         RFs& aFSs );
       
    97     
       
    98     
       
    99     /**
       
   100      * Returns type of the attachment
       
   101      * @return 	EAttachmentHandle or EAttachmentPath
       
   102      */   
       
   103 	IMPORT_C TInt Type();
       
   104 
       
   105     /**
       
   106     * Creates temporary path
       
   107     *
       
   108     * This is used to save the temporary body text attachment. See above.
       
   109     * @since Series 60 v3.2
       
   110     * @param aTempFileName Name of a temporary file
       
   111     */  
       
   112     IMPORT_C static void CreateTempPathL( 
       
   113         TDes16& aCompletePath, 
       
   114         TFileName& aTempFileName,
       
   115         RFs& aRFs );
       
   116 
       
   117     /**
       
   118      * @return A path to the attachment
       
   119      */   
       
   120     inline const TDesC16* Path();
       
   121         
       
   122     /**
       
   123      * @return A handle to the attachment
       
   124      */   
       
   125     inline const RFile* Handle();
       
   126     
       
   127     /**
       
   128      * Set MimeType of the attachment
       
   129      * @return None
       
   130      */   
       
   131     inline void SetMimeType( TDataType aMimeType );
       
   132     
       
   133     /**
       
   134      * Return Mime type descriptor
       
   135      * @return Mime type description
       
   136      */   
       
   137     inline const TPtrC8 MimeType();
       
   138     
       
   139     /**
       
   140      * @return Size of file. Size is set during construction.
       
   141      */   
       
   142     inline TInt Size();
       
   143     
       
   144     /**
       
   145      * Set flag(s)
       
   146      * @param aFlag
       
   147      */   
       
   148 	inline void SetFlags( TInt aFlag );
       
   149     
       
   150     /**
       
   151      * File flags
       
   152      * @return Flags.
       
   153      */   	
       
   154 	inline TBool Flag( TInt aFlag );
       
   155 
       
   156     
       
   157 private:
       
   158 
       
   159     /**
       
   160      * Size of attachment. Initialized in construction. 
       
   161      */   
       
   162 	TInt 	iSize;
       
   163 
       
   164     /**
       
   165      * Flags. 
       
   166      */   
       
   167 	TInt    iFlags;
       
   168 
       
   169     /**
       
   170      * MimeType 
       
   171      */   
       
   172     TDataType iMimeType;
       
   173 
       
   174     /**
       
   175      * Handle to the attachment. 
       
   176      * Owns, if iPath is not NULL.
       
   177      * Does not own, if iPath is NULL.
       
   178      *
       
   179      * Note: See NewLC functions for clarification of ownership.
       
   180      */   
       
   181 	const RFile* iHandle;
       
   182 	
       
   183     /**
       
   184      * Path to the attachment. 
       
   185      * Owns.
       
   186      */   
       
   187 	TDesC16* iPath;
       
   188 
       
   189     /**
       
   190      * FileManager. Used for file operations with the temporary file.
       
   191      * Owns.
       
   192      */
       
   193     CFileMan* iFileManager;
       
   194 	};
       
   195 
       
   196 
       
   197 #include "csenduiattachment.inl"	
       
   198 
       
   199 #endif