ipsservices/ipssosplugin/src/ipsplgcreateforwardmessageoperation.cpp
changeset 18 578830873419
child 20 ecc8def7944a
equal deleted inserted replaced
4:e7aa27f58ae1 18:578830873419
       
     1 /*
       
     2 * Copyright (c) 2006-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 "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: This file implements class CIpsPlgCreateForwardMessageOperation.
       
    15 *
       
    16 */
       
    17 
       
    18 // <qmail>
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include "emailtrace.h"
       
    23 #include "ipsplgheaders.h"
       
    24 
       
    25 // LOCAL CONSTANTS AND MACROS
       
    26 
       
    27 // ================= MEMBER FUNCTIONS =======================
       
    28 
       
    29 // ----------------------------------------------------------------------------
       
    30 // CIpsPlgCreateForwardMessageOperation::CIpsPlgCreateForwardMessageOperation
       
    31 // ----------------------------------------------------------------------------
       
    32 //
       
    33 CIpsPlgCreateForwardMessageOperation::CIpsPlgCreateForwardMessageOperation(
       
    34     CIpsPlgSmtpService* aSmtpService,
       
    35     CMsvSession& aMsvSession,
       
    36     TRequestStatus& aObserverRequestStatus,
       
    37     TMsvPartList aPartList,
       
    38     TMsvId aMailBoxId,
       
    39     TMsvId aOriginalMessageId, 
       
    40     MFSMailRequestObserver& aOperationObserver,
       
    41     const TInt aRequestId ) 
       
    42     :
       
    43     CIpsPlgCreateMessageOperation(
       
    44         aSmtpService,
       
    45         aMsvSession,
       
    46         aObserverRequestStatus,
       
    47         KMsvNullIndexEntryId,
       
    48         aPartList,
       
    49         aMailBoxId,
       
    50         aOperationObserver,
       
    51         aRequestId),
       
    52     iOriginalMessageId(aOriginalMessageId)
       
    53     {
       
    54     FUNC_LOG;
       
    55     }
       
    56 
       
    57 
       
    58 // ----------------------------------------------------------------------------
       
    59 // CIpsPlgCreateForwardMessageOperation::NewL
       
    60 // ----------------------------------------------------------------------------
       
    61 //
       
    62 CIpsPlgCreateForwardMessageOperation* CIpsPlgCreateForwardMessageOperation::NewL(
       
    63     CIpsPlgSmtpService* aSmtpService,
       
    64     CMsvSession& aMsvSession,
       
    65     TRequestStatus& aObserverRequestStatus,
       
    66     TMsvPartList aPartList,
       
    67     TMsvId aMailBoxId,
       
    68     TMsvId aOriginalMessageId, 
       
    69     MFSMailRequestObserver& aOperationObserver,
       
    70     const TInt aRequestId )
       
    71     {
       
    72     FUNC_LOG;
       
    73     CIpsPlgCreateForwardMessageOperation* self =
       
    74         new (ELeave) CIpsPlgCreateForwardMessageOperation(
       
    75             aSmtpService, 
       
    76             aMsvSession, 
       
    77             aObserverRequestStatus,
       
    78             aPartList, 
       
    79             aMailBoxId, 
       
    80             aOriginalMessageId, 
       
    81             aOperationObserver, 
       
    82             aRequestId );
       
    83     CleanupStack::PushL( self );
       
    84     self->ConstructL();
       
    85     CleanupStack::Pop( self ); 
       
    86     return self;
       
    87     }
       
    88 
       
    89 // ----------------------------------------------------------------------------
       
    90 // CIpsPlgCreateForwardMessageOperation::~CIpsPlgCreateForwardMessageOperation
       
    91 // ----------------------------------------------------------------------------
       
    92 //
       
    93 CIpsPlgCreateForwardMessageOperation::~CIpsPlgCreateForwardMessageOperation()
       
    94     {
       
    95     }
       
    96 
       
    97 // ----------------------------------------------------------------------------
       
    98 // CIpsPlgCreateForwardMessageOperation::RunL
       
    99 // ----------------------------------------------------------------------------
       
   100 //
       
   101 void CIpsPlgCreateForwardMessageOperation::RunL()
       
   102     {
       
   103     FUNC_LOG;
       
   104 
       
   105     if( iStatus.Int() == KErrNone )
       
   106         {
       
   107         // new message creation has finished so make an FS type message
       
   108         CFSMailMessage* newMessage = NULL;
       
   109         
       
   110         TMsvId msgId = TMsvId();
       
   111         TRAPD( err, msgId = GetIdFromProgressL( iOperation->FinalProgress() ) );
       
   112             
       
   113         if( err == KErrNone )
       
   114             {
       
   115             newMessage = iSmtpService->CreateFSMessageAndSetFlagsL( 
       
   116                     msgId, iOriginalMessageId, iMailBoxId, ETrue );
       
   117             }
       
   118         
       
   119         // relay the created message (observer takes ownership)
       
   120         SignalFSObserver( iStatus.Int(), newMessage );        
       
   121         }
       
   122     
       
   123     // nothing left to process, so complete the observer
       
   124     TRequestStatus* status = &iObserverRequestStatus;
       
   125     User::RequestComplete( status, iStatus.Int() );
       
   126     }
       
   127 
       
   128 // ----------------------------------------------------------------------------
       
   129 // CIpsPlgCreateForwardMessageOperation::StartMessageCreationL
       
   130 // ----------------------------------------------------------------------------
       
   131 //
       
   132 void CIpsPlgCreateForwardMessageOperation::StartMessageCreationL()
       
   133     {
       
   134     FUNC_LOG;
       
   135     delete iOperation;
       
   136     iOperation = NULL;
       
   137     
       
   138     // Start a new operation, execution continues in RunL 
       
   139     // once the operation has finished.
       
   140     iOperation = CImEmailOperation::CreateForwardL(
       
   141             iStatus, 
       
   142             iMsvSession,
       
   143             iOriginalMessageId,
       
   144             KMsvDraftEntryId,
       
   145             iPartList, 
       
   146             KIpsPlgForwardSubjectFormat,
       
   147             KMsvEmailTypeListMHTMLMessage,
       
   148             //0,
       
   149             KUidMsgTypeSMTP);
       
   150     }
       
   151 
       
   152 //  End of File
       
   153 
       
   154 // </qmail>