messagingappbase/sendui/mmsdirectupload/inc/MDUSyncCreateAndSend.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:   Wrapper to make message creation and sending synchronous.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CMDUSYNCCREATEANDSEND_H
       
    22 #define CMDUSYNCCREATEANDSEND_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include "MDUCreateAndSend.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 //class CMDUCreateAndSend;
       
    29 class CActiveSchedulerWait;
       
    30 class CSendUiSingleton;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 *  Wrapper to make message creation and sending synchronous.
       
    36 *
       
    37 *  @lib MmsDirectUpload.lib
       
    38 *  @since Series 60 2.8
       
    39 */
       
    40 class CMDUSyncCreateAndSend : public CBase, 
       
    41                               public MMDUCreateAndSendCallback
       
    42                               
       
    43     {
       
    44     public:  // Constructors and destructor
       
    45 
       
    46         /**
       
    47         * Two-phased constructor.
       
    48         */
       
    49         static CMDUSyncCreateAndSend* NewLC( CCoeEnv& aCoeEnv, CSendUiSingleton& aSingleton );
       
    50 
       
    51         /**
       
    52         * Destructor.
       
    53         */
       
    54         virtual ~CMDUSyncCreateAndSend();
       
    55 
       
    56     public: // New functions        
       
    57 
       
    58         /**
       
    59         * Creates and sends as many MMS messages as there are files
       
    60         * to be send.Synchronous operation.
       
    61         *
       
    62         * @since Series 60 2.8
       
    63         * @param aAttachments, Files to be send.
       
    64         * @param aToAddress, Recipient address.
       
    65         * @param aToAlias, Alias for recipient.
       
    66         * @param aMaxMsgSize, Maximum size of the created MMS.
       
    67         * @return None.
       
    68         */
       
    69         void CreateAndSendL(
       
    70             CArrayPtrFlat<CSendUiAttachment>* aAttachments,
       
    71             const TDesC& aToAddress,
       
    72             const TDesC& aToAlias,
       
    73             TInt aMaxMsgSize);
       
    74                     
       
    75         /**
       
    76         * Error
       
    77         * @since Series 60 3.0
       
    78         * @return Returns system wide error code.
       
    79         */
       
    80         inline TInt Error() const;
       
    81         
       
    82         /**
       
    83         * Can be used to query compression results.
       
    84         * Oversized JPEG images are compressed to fit in MMS.
       
    85         *
       
    86         * @since Series 60 2.8
       
    87         * @param aCompressionOk, Return value contains amount of succesfully
       
    88         *        compressed JPEG images.
       
    89         * @param aCompressionFail, Return value contains amount of failed
       
    90         *        compression attempts.
       
    91         * @return None.
       
    92         */
       
    93         inline void CompressionResults(
       
    94             TInt& aCompressionOk,
       
    95             TInt& aCompressionFail ) const;
       
    96 
       
    97     private: // Functions from base classes
       
    98 
       
    99         /**
       
   100         * From MMmsCreateAndSendCallback.
       
   101         * Callback to tell that message creation and sending is ready.
       
   102         * @since Series 60 2.8
       
   103         * @return None.
       
   104         */
       
   105         void MessagesReady();
       
   106 
       
   107     private: 
       
   108 
       
   109         /**
       
   110         * C++ default constructor.
       
   111         */
       
   112         CMDUSyncCreateAndSend();
       
   113 
       
   114         /**
       
   115         * By default Symbian 2nd phase constructor is private.
       
   116         */
       
   117         void ConstructL( CCoeEnv& aCoeEnv, CSendUiSingleton& aSingleton );
       
   118 
       
   119         /**
       
   120         * Starts asynchronous wait loop.
       
   121         * @since Series 60 3.0
       
   122         * @return None.
       
   123         */
       
   124         void BeginActiveWait();
       
   125 
       
   126     private: // Data
       
   127         
       
   128         // Asynchronous image compressor. Owned.
       
   129         CMDUCreateAndSend*              iCreateAndSend;
       
   130         
       
   131         // For Active Scheduler wait loop. Owned
       
   132         CActiveSchedulerWait            iWait;
       
   133 };
       
   134 
       
   135 
       
   136 // ==========================================================
       
   137 
       
   138 inline TInt CMDUSyncCreateAndSend::Error() const
       
   139     {
       
   140     return ( !iCreateAndSend ? KErrNotReady : iCreateAndSend->Error() );
       
   141     }
       
   142 
       
   143 inline void CMDUSyncCreateAndSend::CompressionResults(
       
   144     TInt& aCompressionOk,
       
   145     TInt& aCompressionFail ) const
       
   146     {
       
   147     iCreateAndSend->CompressionResults( aCompressionOk, aCompressionFail );
       
   148     }
       
   149 
       
   150 #endif      // CMDUSYNCCREATEANDSEND_H
       
   151 
       
   152 // End of file