email/imap4mtm/imapmailstore/src/cimmimeheaderqueueentry.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <miuthdr.h>
       
    17 #include "cimmimeheaderqueueentry.h"
       
    18 
       
    19 /**
       
    20 Constructor.
       
    21 */
       
    22 CImMimeHeaderQueueEntry::CImMimeHeaderQueueEntry(CImMimeHeader* aHeader,TMsvId aId,CImapMailStore& aParent,CMsvServerEntry& aServerEntry,MMailStoreObserver& aObserver)
       
    23 	: CQueueEntryBase(aId,EIMMimeHeader,aParent,aServerEntry,aObserver),iHeader(aHeader)
       
    24 	{
       
    25 	}
       
    26 	
       
    27 /**
       
    28 Factory constructors.
       
    29 Ownership aHeader is taken.
       
    30 */	
       
    31 CImMimeHeaderQueueEntry* CImMimeHeaderQueueEntry::NewL(CImMimeHeader* aHeader,TMsvId aId,CImapMailStore& aParent,CMsvServerEntry& aServerEntry,MMailStoreObserver& aObserver)
       
    32 	{
       
    33 	CleanupStack::PushL(aHeader);
       
    34 	CImMimeHeaderQueueEntry* self=new(ELeave) CImMimeHeaderQueueEntry(aHeader,aId,aParent,aServerEntry,aObserver);
       
    35 	CleanupStack::Pop(aHeader);
       
    36 	CleanupStack::PushL(self);
       
    37 	self->ConstructL();
       
    38 	CleanupStack::Pop();
       
    39 	return self;
       
    40 	}
       
    41 	
       
    42 void CImMimeHeaderQueueEntry::ConstructL()
       
    43 	{
       
    44 	BaseConstructL();
       
    45 	CompleteSelf();		
       
    46 	}
       
    47 
       
    48 /**
       
    49 Destructor.
       
    50 */	
       
    51 CImMimeHeaderQueueEntry::~CImMimeHeaderQueueEntry()
       
    52 	{
       
    53 	delete iHeader;
       
    54 	}
       
    55 
       
    56 /**
       
    57 Uses CMsvEntry to synchronousy store the requests data object.
       
    58 @param	
       
    59 @return
       
    60 */
       
    61 
       
    62 void CImMimeHeaderQueueEntry::RunL()
       
    63 	{
       
    64 	iServerEntry.SetEntry(iId);
       
    65 	CMsvStore* store = iServerEntry.EditStoreL();
       
    66 	CleanupStack::PushL(store);
       
    67 	iHeader->StoreL(*store);
       
    68 	store->CommitL();
       
    69 	CleanupStack::PopAndDestroy(store); 
       
    70 	//call back to the observer as the operation is complete
       
    71 	StoreComplete(KErrNone);
       
    72 	//request can be removed from the queue
       
    73 	iParent.RemoveFromQueueAndDelete(this);	
       
    74 	}
       
    75 
       
    76