javaextensions/wma/mms/src.s60/cmmsmessageattachment.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 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 the License "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:  ?Description
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _CMMS_MESSAGE_ATTACHMENT_H
       
    20 #define _CMMS_MESSAGE_ATTACHMENT_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <f32file.h>
       
    25 
       
    26 namespace java
       
    27 {
       
    28 namespace wma
       
    29 {
       
    30 _LIT(KTempMmsAttachmentName, "midp_wma20_attachment");
       
    31 _LIT(KTempDriveExt, ":\\");
       
    32 
       
    33 /**
       
    34  * Class to store the attachment data on the native side
       
    35  * 1. Attachment data
       
    36  * 2. Attach data type
       
    37  * 3. Content Id
       
    38  * 4. Content location
       
    39  * 5. IsStarterId
       
    40  * 6. Attchment Character encoding
       
    41  * 7. Attachment size
       
    42  *
       
    43  *  @lib hmidpS60v30.lib on wins/winscw and midp2.exe
       
    44  *  @since Series 60 3.0
       
    45  */
       
    46 
       
    47 class CMMSMessageAttachment: public CBase
       
    48 {
       
    49 public:
       
    50     /**
       
    51      * Create the Java counter part of MessagePart.
       
    52      * @since Series 60 3.0
       
    53      * @param aRFs
       
    54      * @param aDataArray: data of the message part
       
    55      * @param aAttachmentType: data type (attachment type)
       
    56      * @param aContentId: Content Id of the data
       
    57      * @param aLocation: lovcation of the data
       
    58      * @param aValue: Message is from java side to native side or
       
    59      *                other way arround.
       
    60      * @return newly created CMIDMessageAttachment
       
    61      */
       
    62     static CMMSMessageAttachment* NewL(RFs& aRFs, const TDesC8& aDataArray,
       
    63                                        const TDesC8& aAttachmentType, const TDesC8& aContentId,
       
    64                                        const TDesC8& aLocation, TInt aAttachmentNameOrData = TRUE);
       
    65     /**
       
    66      * Destructor of the CMIDMEssageAttachment.
       
    67      * @since Series 60 3.0
       
    68      *
       
    69      * @return
       
    70      */
       
    71     ~CMMSMessageAttachment();
       
    72 
       
    73     /**
       
    74      * Set the character encoding of MessagePart.
       
    75      * @since Series 60 3.0
       
    76      * @param aEncoding Character encoding as TUint
       
    77      *
       
    78      * @return
       
    79      */
       
    80     void SetEncoding(TUint aEncoding);
       
    81     /**
       
    82      * Get the character encoding of MessagePart.
       
    83      * @since Series 60 3.0
       
    84      *
       
    85      * @return the character encoding of MessagePart
       
    86      */
       
    87     TInt Encoding();
       
    88     /**
       
    89      * Get the mime type of MessagePart (attachment).
       
    90      * @since Series 60 3.0
       
    91      *
       
    92      * @return the mime type of MessagePart (attachment).
       
    93      */
       
    94     TDesC8& AttachmentType();
       
    95     /**
       
    96      * Get the data of MessagePart (attachment).
       
    97      * @since Series 60 3.0
       
    98      *
       
    99      * @return the data of MessagePart (attachment).
       
   100      */
       
   101     TDesC8& AttachmentData();
       
   102     /**
       
   103      * Get the value of starter contentId of MessagePart (attachment).
       
   104      * @since Series 60 3.0
       
   105      *
       
   106      * @return if the messge part is starter content Id it will
       
   107      true orther wise false.
       
   108      */
       
   109     TInt IsStarterContentId();
       
   110     /**
       
   111      * Set the value of starter contentId of MessagePart (attachment).
       
   112      * @since Series 60 3.0
       
   113      *
       
   114      * @return
       
   115      */
       
   116     void SetStarterContentId(TInt aValue = FALSE);
       
   117     /**
       
   118      * Get the contentId of MessagePart (attachment).
       
   119      * @since Series 60 3.0
       
   120      *
       
   121      * @return content Id
       
   122      */
       
   123     TDesC8& ContentIdL();
       
   124     /**
       
   125      * Get the location of MessagePart (attachment).
       
   126      * @since Series 60 3.0
       
   127      *
       
   128      * @return content Id
       
   129      */
       
   130     TDesC8& ContentLocationL();
       
   131     /**
       
   132      * When sending messages from Java side to native side.
       
   133      * We are saving the attachment on the D drive in temp folder.
       
   134      * Get the name of that temp file contain data of MessagePart
       
   135      * (attachment).
       
   136      * @since Series 60 3.0
       
   137      *
       
   138      * @return temp file name
       
   139      */
       
   140     // required in client connection
       
   141     TDesC& AttachmentName();
       
   142 
       
   143 private:
       
   144     /**
       
   145      * private constructor of CMIDMessageAttachment
       
   146      * C++ default constructor.
       
   147      * @since Series 60 3.0
       
   148      * @param aRFs
       
   149      * @return temp file name
       
   150      */
       
   151     CMMSMessageAttachment(RFs& aRFs);
       
   152     /**
       
   153      * default Symbian 2nd phase constructor.
       
   154      * @since Series 60 3.0
       
   155      * @param aDataArray: data of the message part
       
   156      * @param aAttachmentType: data type (attachment type)
       
   157      * @param aContentId: Content Id of the data
       
   158      * @param aLocation: lovcation of the data
       
   159      * @param aValue: Message is from java side to native side or
       
   160      *                other way arround.
       
   161      * @return
       
   162      */
       
   163     void ConstructL(const TDesC8& aDataArray, const TDesC8& aAttachmentType,
       
   164                     const TDesC8& aContentId, const TDesC8& aLocation,
       
   165                     TInt aAttachmentNameOrData);
       
   166 
       
   167     /**
       
   168      * Set the contentlocation of the MessagePart (Attachment)
       
   169      * @since Series 60 3.0
       
   170      * @param aLocation
       
   171      * @return
       
   172      */
       
   173     void SetContentLocationLC(const TDesC8& aLocation);
       
   174     /**
       
   175      * Set the contentId of the MessagePart (Attachment)
       
   176      * @since Series 60 3.0
       
   177      * @param aContentId
       
   178      * @return
       
   179      */
       
   180     void SetContentIdLC(const TDesC8& aContentId);
       
   181     /**
       
   182      * Set the mime type of the MessagePart (Attachment)
       
   183      * @since Series 60 3.0
       
   184      * @param aAttachmentType
       
   185      * @return
       
   186      */
       
   187     void SetAttchmentTypeLC(const TDesC8& aAttachmentType);
       
   188 
       
   189 private:
       
   190     /*
       
   191      * own the mAttachmentNameWithPath
       
   192      */
       
   193     TFileName *mAttachmentNameWithPath;
       
   194     /*
       
   195      * own the mAttachmentTypeBuf8
       
   196      */
       
   197     TDesC8* mAttachmentTypeBuf8;
       
   198     /*
       
   199      * own the mAttachmentData8
       
   200      */
       
   201     TDesC8* mAttachmentData8;
       
   202     /*
       
   203      * own the mContantId8
       
   204      */
       
   205     HBufC8* mContantId8;
       
   206     /*
       
   207      * own the mContantLocation8
       
   208      */
       
   209     HBufC8* mContantLocation8;
       
   210 
       
   211     TInt mEncoding;
       
   212     //Handle to fileserver
       
   213     RFs& mRFs;
       
   214     //
       
   215     TInt mIsStarterContentId;
       
   216 };
       
   217 } //namespace wma
       
   218 } //namespace java
       
   219 
       
   220 #endif