|         |      1 /* | 
|         |      2 * Copyright (c) 2002 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:  Implements document for application. | 
|         |     15 * | 
|         |     16 */ | 
|         |     17  | 
|         |     18  | 
|         |     19 // INCLUDE FILES | 
|         |     20 #include "MailLog.h" | 
|         |     21 #include "MailUtils.h" | 
|         |     22 #include "MsgMailViewerDocument.h" | 
|         |     23 #include "MsgMailViewerAppUi.h" | 
|         |     24 #include <MsgMailViewer.rsg> | 
|         |     25 #include "MsgMailDRMHandler.h" | 
|         |     26 #include "CMailCRHandler.h" | 
|         |     27 #include "CMailForwardOperation.h" | 
|         |     28 #include "MsgMailViewerRemoveAttachment.h" | 
|         |     29 #include <CMailMessage.h> | 
|         |     30 #include <Muiumsginfo.hrh> | 
|         |     31 #include <MuiuMsgEditorLauncher.h>      // for TEditorParameters | 
|         |     32 #include <miutmsg.h> | 
|         |     33 #include <mtmuibas.h> | 
|         |     34 #include <mmsvattachmentmanager.h> | 
|         |     35 #include <MsgAttachmentModel.h> | 
|         |     36 #include <MsgAttachmentInfo.h> | 
|         |     37 #include <DocumentHandler.h> | 
|         |     38 #include <MuiuOperationWait.h>          // CMuiuOperationWait | 
|         |     39 #include <impicmds.h>                   // TIMAP4Cmds | 
|         |     40 #include <sendui.h> | 
|         |     41 #include <mtmuidef.hrh> | 
|         |     42  | 
|         |     43 // LOCAL CONSTANTS | 
|         |     44 // Max param length for msg info. | 
|         |     45 const TInt KMessageSizeMaxLength(10); | 
|         |     46  | 
|         |     47 // ================= MEMBER FUNCTIONS ======================= | 
|         |     48  | 
|         |     49 // Default constructor | 
|         |     50 CMsgMailViewerDocument::CMsgMailViewerDocument(CEikApplication& aApp) | 
|         |     51     : CMsgMailDocument(aApp), iCharSet(0) | 
|         |     52     {  | 
|         |     53     } | 
|         |     54  | 
|         |     55 // destructor | 
|         |     56 CMsgMailViewerDocument::~CMsgMailViewerDocument() | 
|         |     57     { | 
|         |     58     delete iViewedMessage;     | 
|         |     59     delete iPrefs; | 
|         |     60     iPrefs = NULL; // Owned by a superclass | 
|         |     61     delete iDRMHandler; | 
|         |     62     delete iSendUi; | 
|         |     63     delete iMailCRHandler;         | 
|         |     64     } | 
|         |     65  | 
|         |     66 // Symbian OS default constructor can leave. | 
|         |     67 void CMsgMailViewerDocument::ConstructL() | 
|         |     68     { | 
|         |     69     CMsgEditorDocument::ConstructL(); | 
|         |     70     iMailCRHandler = CMailCRHandler::NewL( this ); | 
|         |     71     } | 
|         |     72  | 
|         |     73 // ---------------------------------------------------------------------------- | 
|         |     74 // CMsgMailViewerDocument::DoInitDRMHandlerL() | 
|         |     75 // ---------------------------------------------------------------------------- | 
|         |     76 // | 
|         |     77 void CMsgMailViewerDocument::DoInitDRMHandlerL() | 
|         |     78 	{ | 
|         |     79 	if (!iDRMHandler) | 
|         |     80 		{ | 
|         |     81         LOG("CMsgMailViewerAppUi::DoInitDRMHandlerL initializing DRM"); | 
|         |     82 		iDRMHandler = MsgMailDRMHandler::NewL(); | 
|         |     83 		} | 
|         |     84 	}	 | 
|         |     85 // ---------------------------------------------------------------------------- | 
|         |     86 // Two-phased constructor. | 
|         |     87 // ---------------------------------------------------------------------------- | 
|         |     88 // | 
|         |     89 CMsgMailViewerDocument* CMsgMailViewerDocument::NewL( | 
|         |     90         CEikApplication& aApp)     // CMsgMailViewerApp reference | 
|         |     91     { | 
|         |     92     CMsgMailViewerDocument* self = new (ELeave) CMsgMailViewerDocument( aApp ); | 
|         |     93     CleanupStack::PushL( self ); | 
|         |     94     self->ConstructL(); | 
|         |     95     CleanupStack::Pop(); | 
|         |     96  | 
|         |     97     return self; | 
|         |     98     }     | 
|         |     99 // ---------------------------------------------------------------------------- | 
|         |    100 // CMsgMailViewerDocument::CreateAppUiL() | 
|         |    101 // constructs CMsgMailViewerAppUi | 
|         |    102 // ---------------------------------------------------------------------------- | 
|         |    103 // | 
|         |    104 CEikAppUi* CMsgMailViewerDocument::CreateAppUiL() | 
|         |    105     { | 
|         |    106     return new (ELeave) CMsgMailViewerAppUi; | 
|         |    107     } | 
|         |    108  | 
|         |    109 // ---------------------------------------------------------------------------- | 
|         |    110 // CMsgMailViewerDocument::NotifyChanges() | 
|         |    111 // ---------------------------------------------------------------------------- | 
|         |    112 // | 
|         |    113 void CMsgMailViewerDocument::NotifyChanges(TMsgAttachmentCommand aCommand,  | 
|         |    114     CMsgAttachmentInfo* /*aAttachmentInfo*/ ) | 
|         |    115     { | 
|         |    116     switch (aCommand) | 
|         |    117         { | 
|         |    118         case EMsgAttachmentAdded: | 
|         |    119             // FALLTHROUGH | 
|         |    120         case EMsgAttachmentRemoved: | 
|         |    121             SetChanged(ETrue); | 
|         |    122             break; | 
|         |    123         default: | 
|         |    124             break; | 
|         |    125         }    | 
|         |    126     } | 
|         |    127 // ---------------------------------------------------------------------------- | 
|         |    128 // CMsgMailViewerDocument::GetAttachmentFileL() | 
|         |    129 // ---------------------------------------------------------------------------- | 
|         |    130 // | 
|         |    131 RFile CMsgMailViewerDocument::GetAttachmentFileL( TMsvAttachmentId aId ) | 
|         |    132 	{ | 
|         |    133     LOG1("CMsgMailViewerDocument::GetAttachmentFileL %08x", aId);	 | 
|         |    134     return MailMessage().GetFileHandleL( aId ); | 
|         |    135 	} | 
|         |    136  | 
|         |    137 // ---------------------------------------------------------------------------- | 
|         |    138 // CMsgMailViewerDocument::EntryChangedL() | 
|         |    139 // ---------------------------------------------------------------------------- | 
|         |    140 // | 
|         |    141 void CMsgMailViewerDocument::EntryChangedL() | 
|         |    142 	{ | 
|         |    143     delete iViewedMessage; | 
|         |    144     iViewedMessage = NULL; | 
|         |    145     iViewedMessage = CMailMessage::NewL(CurrentEntry()); | 
|         |    146     iViewedMessage->SetNew( (LaunchFlags() & EMsgUnreadMessage) );   | 
|         |    147     LOG2( "CMsgMailViewerDocument::EntryChangedL %08x is new:%d" ,  | 
|         |    148     	MailMessage().MessageEntry().Id(), iViewedMessage->IsNew() ); | 
|         |    149 	} | 
|         |    150 	 | 
|         |    151 // ---------------------------------------------------------------------------- | 
|         |    152 // CMsgMailViewerDocument::AddAttachmentL() | 
|         |    153 // ---------------------------------------------------------------------------- | 
|         |    154 // | 
|         |    155 void CMsgMailViewerDocument::AddAttachmentL(  | 
|         |    156 	CMsvAttachment& aAttachmentInfo, | 
|         |    157 	TBool aCanBeRemoved ) | 
|         |    158 	{ | 
|         |    159     // add attachment to model | 
|         |    160 	CMsgAttachmentModel& attmodel = AttachmentModel(); | 
|         |    161 	TDataType dataType(aAttachmentInfo.MimeType());      | 
|         |    162  | 
|         |    163     if ( aAttachmentInfo.Type() != CMsvAttachment::EMsvMessageEntry )  | 
|         |    164     	{	    		     | 
|         |    165 	    RFile attachment = GetAttachmentFileL( aAttachmentInfo.Id() ); | 
|         |    166 	    CleanupClosePushL(attachment);	 | 
|         |    167 	     | 
|         |    168 	    dataType = ResolveMimeType( attachment );	    | 
|         |    169 	    if ( !dataType.Des().Length() && aAttachmentInfo.MimeType().Length() ) | 
|         |    170 	    	{ | 
|         |    171 	    	dataType = aAttachmentInfo.MimeType(); | 
|         |    172 	    	} | 
|         |    173 	     | 
|         |    174 	    CMsgAttachmentInfo* info = attmodel.AddAttachmentL( | 
|         |    175 	        aAttachmentInfo.AttachmentName(), | 
|         |    176 	        aAttachmentInfo.Size(), | 
|         |    177 	        aAttachmentInfo.Id(), | 
|         |    178 	        aAttachmentInfo.Complete(), | 
|         |    179 	        dataType); 	     | 
|         |    180  | 
|         |    181     	TMsvId serviceId; | 
|         |    182     	TMsvEmailEntry attachmentEntry; | 
|         |    183     	User::LeaveIfError(Session().GetEntry( | 
|         |    184         aAttachmentInfo.Id(), serviceId, attachmentEntry)); | 
|         |    185     	info->SetAttachedThisSession( aCanBeRemoved ); | 
|         |    186     	LOG1("CMsgMailViewerAppUi::AddAttachmentL attachment complete:%d", | 
|         |    187     		attachmentEntry.Complete()); | 
|         |    188     	LOG1("CMsgMailViewerAppUi::AddAttachmentL attachment BodyComplete:%d", | 
|         |    189     		attachmentEntry.BodyTextComplete()); | 
|         |    190 	     | 
|         |    191 	    DoInitDRMHandlerL(); | 
|         |    192 	    iDRMHandler->SetDRMDataTypeL( *info, attachment ); | 
|         |    193     	CleanupStack::PopAndDestroy(); // attachment | 
|         |    194     	} | 
|         |    195     else  // EMsvMessageEntry  | 
|         |    196     	{ | 
|         |    197     	// completed flag is not set correctly to message entry info | 
|         |    198 	    CMsgAttachmentInfo* info = attmodel.AddAttachmentL( | 
|         |    199 	        aAttachmentInfo.AttachmentName(), | 
|         |    200     	    aAttachmentInfo.Size(), | 
|         |    201         	aAttachmentInfo.Id(), | 
|         |    202         	ETrue /*aAttachmentInfo.Complete()*/, | 
|         |    203         	dataType); | 
|         |    204         info->SetAttachedThisSession( aCanBeRemoved );	  | 
|         |    205     	}  	 | 
|         |    206 	 | 
|         |    207 	} | 
|         |    208     	 | 
|         |    209  | 
|         |    210 // ---------------------------------------------------------------------------- | 
|         |    211 // CMsgMailViewerDocument::CanSaveFileL() | 
|         |    212 // ---------------------------------------------------------------------------- | 
|         |    213 // | 
|         |    214 TBool CMsgMailViewerDocument::CanSaveFileL( TDataType aDataType ) | 
|         |    215 	{ | 
|         |    216 	// remove save if system doesn't support saving | 
|         |    217 	CDocumentHandler* doch = CDocumentHandler::NewLC(  | 
|         |    218 		CEikonEnv::Static()->Process() );					// CSI: 27 # Must be used because of  | 
|         |    219 															// iEikEnv is not accessible. | 
|         |    220       | 
|         |    221     TBool canSave(EFalse); | 
|         |    222     TRAP_IGNORE( canSave = doch->CanSaveL( aDataType ) ); | 
|         |    223     // if error hide save | 
|         |    224     CleanupStack::PopAndDestroy(); //doch	 | 
|         |    225    	return canSave; | 
|         |    226 	} | 
|         |    227 	 | 
|         |    228  | 
|         |    229 // ---------------------------------------------------------------------------- | 
|         |    230 // CMsgMailViewerDocument::DeleteMessageL() | 
|         |    231 // ---------------------------------------------------------------------------- | 
|         |    232 // | 
|         |    233 TBool CMsgMailViewerDocument::DeleteMessageL() | 
|         |    234 	{ | 
|         |    235     CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection; | 
|         |    236     CleanupStack::PushL(sel); | 
|         |    237     TMsvId msgID = MailMessage().MessageEntry().Id(); | 
|         |    238     sel->AppendL( msgID ); | 
|         |    239     Mtm().SwitchCurrentEntryL( MailMessage().MessageEntry().Parent() ); | 
|         |    240     CMuiuOperationWait* wait = CMuiuOperationWait::NewLC(); | 
|         |    241     CMsvOperation* op = MtmUi().DeleteFromL( *sel, wait->iStatus ); | 
|         |    242     CleanupStack::PushL(op); | 
|         |    243      | 
|         |    244     //Check if delete is cancelled from IMUM menu | 
|         |    245     TBool cancel(op->iStatus.Int() == KErrCancel); | 
|         |    246     | 
|         |    247     //When deleting is really started we proceed | 
|         |    248     //as it was done complitely (= close viewer). | 
|         |    249     //Reason for this is that we don't | 
|         |    250     //know if IMUM has deleted message completely | 
|         |    251     //or not. | 
|         |    252          | 
|         |    253     wait->Start(); | 
|         |    254 	 | 
|         |    255     CleanupStack::PopAndDestroy(3);			// CSI: 47 # op, wait, sel | 
|         |    256  | 
|         |    257 	return cancel;        	 | 
|         |    258 	} | 
|         |    259 	 | 
|         |    260 // ---------------------------------------------------------------------------- | 
|         |    261 // CMsgMailViewerDocument::FetchAttachmentL() | 
|         |    262 // ---------------------------------------------------------------------------- | 
|         |    263 // | 
|         |    264 CMsvOperation* CMsgMailViewerDocument::FetchAttachmentL(  | 
|         |    265     CMsvEntrySelection& aSelection, TRequestStatus& aCompletionStatus ) | 
|         |    266 	{ | 
|         |    267 	TBuf8<1> param; | 
|         |    268 	// Set context back to message if not allready set | 
|         |    269 	SetEntryWithoutNotificationL( MailMessage().MessageEntry().Id() );  | 
|         |    270 	return MtmUi().InvokeAsyncFunctionL( | 
|         |    271 		KImpiMTMFetchAttachments, aSelection, aCompletionStatus, param ); | 
|         |    272 	} | 
|         |    273  | 
|         |    274 // ---------------------------------------------------------------------------- | 
|         |    275 // CMsgMailViewerDocument::FetchAttachmentL() | 
|         |    276 // ---------------------------------------------------------------------------- | 
|         |    277 // | 
|         |    278 void CMsgMailViewerDocument::FetchAttachmentL( CMsvEntrySelection& aSelection ) | 
|         |    279 	{ | 
|         |    280 	CMsvSingleOpWatcher* watch=CMsvSingleOpWatcher::NewLC( *this ); | 
|         |    281 	CMsvOperation* op = FetchAttachmentL( aSelection, watch->iStatus ); | 
|         |    282     // watch owns op before leave can occur | 
|         |    283     AddSingleOperationL(op, watch); | 
|         |    284     CleanupStack::Pop( watch ); // watch     | 
|         |    285 	} | 
|         |    286 // ---------------------------------------------------------------------------- | 
|         |    287 // CMsgMailViewerDocument::FetchAttachmentL() | 
|         |    288 // ---------------------------------------------------------------------------- | 
|         |    289 // | 
|         |    290 void CMsgMailViewerDocument::FetchAttachmentL( TMsvAttachmentId aAttachmentId ) | 
|         |    291 	{ | 
|         |    292     CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection; | 
|         |    293 	CleanupStack::PushL(sel); | 
|         |    294 	sel->AppendL( aAttachmentId ); | 
|         |    295 	FetchAttachmentL( *sel ); | 
|         |    296 	CleanupStack::PopAndDestroy( sel ); | 
|         |    297 	}	 | 
|         |    298  | 
|         |    299 // ---------------------------------------------------------------------------- | 
|         |    300 // CMsgMailViewerDocument::RemoveAttachmentL() | 
|         |    301 // ---------------------------------------------------------------------------- | 
|         |    302 //		 | 
|         |    303 void CMsgMailViewerDocument::RemoveAttachmentL(  | 
|         |    304 	TMsvAttachmentId aAttachmentId ) | 
|         |    305 	{ | 
|         |    306     CMsvSingleOpWatcher* watch=CMsvSingleOpWatcher::NewLC( *this ); | 
|         |    307     LOG1("CMsgMailViewerDocument::RemoveAttachmentL %08x",  | 
|         |    308         	aAttachmentId);       	 | 
|         |    309     TMsvId msgID = MailMessage().MessageEntry().Id(); | 
|         |    310      | 
|         |    311     CMsvOperation* op = CMsgMailViewerRemoveAttachmentOp::NewLC( | 
|         |    312     	Session(), watch->iStatus, aAttachmentId, msgID ); | 
|         |    313  | 
|         |    314     CleanupStack::Pop(); // op | 
|         |    315     // watch owns op before leave can occur | 
|         |    316     AddSingleOperationL(op, watch); | 
|         |    317     CleanupStack::Pop( watch ); // watch	 | 
|         |    318 	} | 
|         |    319 	 | 
|         |    320 // ---------------------------------------------------------------------------- | 
|         |    321 // CMsgMailViewerDocument::IsOnLineL() | 
|         |    322 // ---------------------------------------------------------------------------- | 
|         |    323 // | 
|         |    324 TBool CMsgMailViewerDocument::IsOnLineL() const | 
|         |    325     { | 
|         |    326     const TMsvId entryId(CurrentEntry().OwningService()); | 
|         |    327     CMsvEntry *entry = CMsvEntry::NewL(Session(), | 
|         |    328         entryId, TMsvSelectionOrdering()); | 
|         |    329     const TBool result(entry->Entry().Connected()); | 
|         |    330     delete entry; | 
|         |    331     return result; | 
|         |    332     } | 
|         |    333  | 
|         |    334  | 
|         |    335 // ---------------------------------------------------------------------------- | 
|         |    336 // CMsgMailViewerDocument::RetrieveMessageL() | 
|         |    337 // ---------------------------------------------------------------------------- | 
|         |    338 // | 
|         |    339 void CMsgMailViewerDocument::RetrieveMessageL() | 
|         |    340 	{ | 
|         |    341     CMsvEntrySelection* sel= new (ELeave) CMsvEntrySelection(); | 
|         |    342     CleanupStack::PushL( sel ); | 
|         |    343     TMsvId messageId = Entry().Id(); | 
|         |    344     sel->AppendL( messageId ); | 
|         |    345  | 
|         |    346     SetEntryL(Entry().Parent()); | 
|         |    347  | 
|         |    348     TBuf8<1> blankParams; | 
|         |    349     CMuiuOperationWait* wait = CMuiuOperationWait::NewLC(); | 
|         |    350  | 
|         |    351     CMsvOperation* op=MtmUi().InvokeAsyncFunctionL( | 
|         |    352         KMtmUiFunctionFetchSelected, | 
|         |    353         *sel, | 
|         |    354         wait->iStatus, | 
|         |    355         blankParams); | 
|         |    356  | 
|         |    357     CleanupStack::PushL(op); | 
|         |    358     wait->Start(); | 
|         |    359  | 
|         |    360     // Set content back to message itself | 
|         |    361     SetEntryL(messageId); | 
|         |    362      | 
|         |    363     // ignore return value. | 
|         |    364     MtmUi().DisplayProgressSummary( op->FinalProgress() ); | 
|         |    365     CleanupStack::PopAndDestroy(3);				// CSI: 47 # op, wait, sel	 | 
|         |    366 	} | 
|         |    367  | 
|         |    368 // ---------------------------------------------------------------------------- | 
|         |    369 // CMsgMailViewerDocument::SendUiL() | 
|         |    370 // ---------------------------------------------------------------------------- | 
|         |    371 // | 
|         |    372 CSendUi& CMsgMailViewerDocument::SendUiL() | 
|         |    373     { | 
|         |    374     if ( !iSendUi ) | 
|         |    375         iSendUi = CSendUi::NewL(); | 
|         |    376      | 
|         |    377     return *iSendUi; | 
|         |    378     } | 
|         |    379      | 
|         |    380 // ---------------------------------------------------------------------------- | 
|         |    381 // CMsgMailViewerDocument::ShowMessageInfoL() | 
|         |    382 // ---------------------------------------------------------------------------- | 
|         |    383 // | 
|         |    384 void CMsgMailViewerDocument::ShowMessageInfoL()     | 
|         |    385 	{ | 
|         |    386     CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection; | 
|         |    387     CleanupStack::PushL(sel); | 
|         |    388     TMsvId id( Entry().Id() ); | 
|         |    389     sel->AppendL(id); | 
|         |    390  | 
|         |    391     TBuf8<KMessageSizeMaxLength> infoParams(KMessageInfoViewer); | 
|         |    392     CMsvSingleOpWatcher* watch=CMsvSingleOpWatcher::NewLC(*this); | 
|         |    393     CMsvOperation* op= MtmUi().InvokeAsyncFunctionL( | 
|         |    394         KMtmUiFunctionMessageInfo, | 
|         |    395         *sel, | 
|         |    396         watch->iStatus, | 
|         |    397         infoParams | 
|         |    398         ); | 
|         |    399     // watch owns op before leave can occur | 
|         |    400     AddSingleOperationL(op, watch); | 
|         |    401     CleanupStack::Pop(); // watch | 
|         |    402     CleanupStack::PopAndDestroy(); // sel	 | 
|         |    403 	} | 
|         |    404 	 | 
|         |    405 // ---------------------------------------------------------------------------- | 
|         |    406 // CMsgMailViewerDocument::OpenMessageEntryL() | 
|         |    407 // ---------------------------------------------------------------------------- | 
|         |    408 // | 
|         |    409 TBool CMsgMailViewerDocument::OpenMessageEntryL(TMsvId aEntryId ) | 
|         |    410 	{ | 
|         |    411    	TMsvEntry entry; | 
|         |    412    	TMsvId service; | 
|         |    413    	User::LeaveIfError( Session().GetEntry(aEntryId, service, entry) ); | 
|         |    414       | 
|         |    415     if (entry.iType==KUidMsvMessageEntry) | 
|         |    416         { | 
|         |    417         // dealing with attached message  | 
|         |    418         const TMsvId prevEntry = CurrentEntry().EntryId(); | 
|         |    419         SetEntryL( aEntryId ); | 
|         |    420  | 
|         |    421         // create watcher | 
|         |    422         CMsvSingleOpWatcher* watch=CMsvSingleOpWatcher::NewLC( | 
|         |    423             *this ); | 
|         |    424         // open attached message | 
|         |    425         CMsvOperation* op = MtmUi().ViewL(watch->iStatus); | 
|         |    426         // add to operation queue, watch owns op before leave can occur | 
|         |    427         AddSingleOperationL(op, watch); | 
|         |    428         CleanupStack::Pop(); // watch | 
|         |    429         // set context back to original entry | 
|         |    430         SetEntryL(prevEntry);  | 
|         |    431         return ETrue; | 
|         |    432         } | 
|         |    433     return EFalse; | 
|         |    434 	} | 
|         |    435  | 
|         |    436 // ---------------------------------------------------------------------------- | 
|         |    437 // CMsgMailViewerDocument::MailMessage() | 
|         |    438 // ---------------------------------------------------------------------------- | 
|         |    439 // | 
|         |    440 CMailMessage& CMsgMailViewerDocument::MailMessage() | 
|         |    441 	{ | 
|         |    442 	__ASSERT_DEBUG( iViewedMessage, User::Invariant() ); | 
|         |    443 	return *iViewedMessage; | 
|         |    444 	} | 
|         |    445 	 | 
|         |    446 // ---------------------------------------------------------------------------- | 
|         |    447 // CMsgMailViewerDocument::MoveRemoteEntryL() | 
|         |    448 // ---------------------------------------------------------------------------- | 
|         |    449 // | 
|         |    450 void CMsgMailViewerDocument::MoveRemoteEntryL(  | 
|         |    451 	TMsvId aTo, TMsvId aService, TBool aDestinationIsRemote ) | 
|         |    452 	{ | 
|         |    453     CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection(); | 
|         |    454     CleanupStack::PushL(sel); | 
|         |    455     sel->AppendL( MailMessage().MessageEntry().Id() ); | 
|         |    456  | 
|         |    457     CMsvOperation* op=NULL; | 
|         |    458     CMuiuOperationWait* wait = CMuiuOperationWait::NewLC(); | 
|         |    459      | 
|         |    460     if ( aDestinationIsRemote ) | 
|         |    461         { | 
|         |    462         Mtm().SwitchCurrentEntryL( aTo ); | 
|         |    463         op=MtmUi().CopyToL( *sel, wait->iStatus); | 
|         |    464         } | 
|         |    465     else | 
|         |    466         { | 
|         |    467         Mtm().SwitchCurrentEntryL( aService ); | 
|         |    468         op=MtmUi().CopyFromL( *sel, aTo, wait->iStatus); | 
|         |    469         } | 
|         |    470  | 
|         |    471     CleanupStack::PushL(op); | 
|         |    472     wait->Start();  // wait for completion of asynch operation | 
|         |    473     LOG1("CMsgMailViewerDocument::MoveRemoteEntryL iStatus:%d", | 
|         |    474         wait->iStatus.Int() ); | 
|         |    475     User::LeaveIfError( wait->iStatus.Int() );     | 
|         |    476  | 
|         |    477     CleanupStack::PopAndDestroy(3);			// CSI: 47 # sel, op, wait	 | 
|         |    478 	} | 
|         |    479 	 | 
|         |    480 // ---------------------------------------------------------------------------- | 
|         |    481 // CMsgMailViewerDocument::UpdateAttachmentModelFromMessageL() | 
|         |    482 // ---------------------------------------------------------------------------- | 
|         |    483 // | 
|         |    484 void CMsgMailViewerDocument::UpdateAttachmentModelFromMessageL() | 
|         |    485     { | 
|         |    486     // Now message is fetched, we'll update datatype information | 
|         |    487     //MailMessage().LoadAttachmentsL( *this );     | 
|         |    488     MMsvAttachmentManager& manager = MailMessage().AttachmentManager(); | 
|         |    489     LOG1("CMsgMailViewerDocument::UpdateAttachmentModelFromMessageL count:%d", | 
|         |    490         manager.AttachmentCount() );     | 
|         |    491     } | 
|         |    492  | 
|         |    493 // ---------------------------------------------------------------------------- | 
|         |    494 // CMsgMailViewerDocument::ForwardMailMessageL() | 
|         |    495 // ---------------------------------------------------------------------------- | 
|         |    496 // | 
|         |    497 CMailOperation* CMsgMailViewerDocument::ForwardMailMessageL(  | 
|         |    498     MMsvProgressReporter& aReporter, | 
|         |    499     TRequestStatus& aStatus,  | 
|         |    500     TBool aSetSuspend ) | 
|         |    501     { | 
|         |    502     return CMailForwardOperation::NewL(  | 
|         |    503     	aReporter, *this, aStatus, aSetSuspend ); | 
|         |    504     } | 
|         |    505  | 
|         |    506  | 
|         |    507 // End of File   |