emailuis/emailui/src/FreestyleEmailUiSendAttachmentsListControl.cpp
branchRCL_3
changeset 13 8592a65ad3fb
parent 8 e1b6206813b4
child 14 b13141f05c3d
equal deleted inserted replaced
12:4ce476e64c59 13:8592a65ad3fb
    60 
    60 
    61 // CONSTANTS
    61 // CONSTANTS
    62 
    62 
    63 // CLASS IMPLEMENTATION
    63 // CLASS IMPLEMENTATION
    64 
    64 
       
    65 TInt KGenericTimerDialogInterval = 1000; // Interval for iDialogTimer
       
    66 
    65 // ---------------------------------------------------------------------------
    67 // ---------------------------------------------------------------------------
    66 // Two-phased constructor.
    68 // Two-phased constructor.
    67 // ---------------------------------------------------------------------------
    69 // ---------------------------------------------------------------------------
    68 //
    70 //
    69 CFreestyleEmailUiSendAttachmentsListControl* CFreestyleEmailUiSendAttachmentsListControl::NewL(
    71 CFreestyleEmailUiSendAttachmentsListControl* CFreestyleEmailUiSendAttachmentsListControl::NewL(
   117     {
   119     {
   118     FUNC_LOG;
   120     FUNC_LOG;
   119     CAlfControl::ConstructL( aEnv );
   121     CAlfControl::ConstructL( aEnv );
   120 	iService = CFscContactActionService::NewL( iAppUi->GetVPbkManagerL() );
   122 	iService = CFscContactActionService::NewL( iAppUi->GetVPbkManagerL() );
   121     iModel = CFSEmailUiSendAttachmentsListModel::NewL( iAppUi, Env(), this );
   123     iModel = CFSEmailUiSendAttachmentsListModel::NewL( iAppUi, Env(), this );
       
   124     iAttachmentAddingLocked = EFalse;
       
   125     iDialogTimer = CFSEmailUiGenericTimer::NewL( this );
   122     }
   126     }
   123 
   127 
   124 // ---------------------------------------------------------------------------
   128 // ---------------------------------------------------------------------------
   125 // Virtual destructor.
   129 // Virtual destructor.
   126 // ---------------------------------------------------------------------------
   130 // ---------------------------------------------------------------------------
   127 //
   131 //
   128 CFreestyleEmailUiSendAttachmentsListControl::~CFreestyleEmailUiSendAttachmentsListControl()
   132 CFreestyleEmailUiSendAttachmentsListControl::~CFreestyleEmailUiSendAttachmentsListControl()
   129     {
   133     {
   130     FUNC_LOG;
   134     FUNC_LOG;
       
   135 	if(iDialogTimer)
       
   136 		{
       
   137 	    iDialogTimer->Cancel();
       
   138 	    delete iDialogTimer;
       
   139 		}
   131 	delete iService;
   140 	delete iService;
   132     }
   141     }
   133 
   142 
   134 // <cmail>
   143 // <cmail>
   135 // ---------------------------------------------------------------------------
   144 // ---------------------------------------------------------------------------
   322 {
   331 {
   323     FUNC_LOG;
   332     FUNC_LOG;
   324 	return iModel;
   333 	return iModel;
   325 }
   334 }
   326 
   335 
       
   336 
       
   337 // ---------------------------------------------------------------------------
       
   338 // IsAttachmentAddingLocked
       
   339 //
       
   340 // ---------------------------------------------------------------------------
       
   341 //
       
   342 TBool CFreestyleEmailUiSendAttachmentsListControl::IsAttachmentAddingLocked() const
       
   343 {
       
   344     FUNC_LOG;
       
   345 	return iAttachmentAddingLocked;
       
   346 }
       
   347 
       
   348 
       
   349 // ---------------------------------------------------------------------------
       
   350 // TimerEventL
       
   351 // Timer that delays the dialog will open the dialog here
       
   352 // ---------------------------------------------------------------------------
       
   353 //
       
   354 void CFreestyleEmailUiSendAttachmentsListControl::TimerEventL( CFSEmailUiGenericTimer* /*aTriggeredTimer*/ )
       
   355 	{
       
   356 	TFsEmailUiUtility::ShowWaitNoteL( iWaitNote, R_FSE_WAIT_INSERTING_TEXT, EFalse,ETrue );
       
   357 	iDialogTimer->Cancel();
       
   358 	}
       
   359 
   327 // ---------------------------------------------------------------------------
   360 // ---------------------------------------------------------------------------
   328 // AppendAttachmentToListL
   361 // AppendAttachmentToListL
   329 //
   362 //
   330 // Open files selection dialog and append given filename to attachment list
   363 // Open files selection dialog and append given filename to attachment list
   331 // ---------------------------------------------------------------------------
   364 // ---------------------------------------------------------------------------
   335     FUNC_LOG;
   368     FUNC_LOG;
   336 	TBool ret = EFalse;
   369 	TBool ret = EFalse;
   337 	TFileName filePath;
   370 	TFileName filePath;
   338 	// <cmail>
   371 	// <cmail>
   339 	TBool fetchOK = EFalse;
   372 	TBool fetchOK = EFalse;
       
   373 	
       
   374 	if(iAttachmentAddingLocked)
       
   375 		{
       
   376 	    return ret;
       
   377 		}
   340 	
   378 	
   341 	if (aType != MsgAttachmentUtils::EUnknown)
   379 	if (aType != MsgAttachmentUtils::EUnknown)
   342 	    {
   380 	    {
   343         CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
   381         CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
   344                     
   382                     
   371 	else
   409 	else
   372 	    {
   410 	    {
   373 	    fetchOK = TFsEmailUiUtility::ShowSelectFileDialogL( filePath );
   411 	    fetchOK = TFsEmailUiUtility::ShowSelectFileDialogL( filePath );
   374 	    }
   412 	    }
   375         
   413         
       
   414 	iAttachmentAddingLocked = ETrue;
       
   415 	
   376 	if ( fetchOK && filePath.Length() > 0 ) // </cmail>
   416 	if ( fetchOK && filePath.Length() > 0 ) // </cmail>
   377 		{
   417 		{
       
   418 	    iDialogTimer->Start(KGenericTimerDialogInterval);   
       
   419 	
   378         if ( !FileDrmProtectedL( filePath ) )
   420         if ( !FileDrmProtectedL( filePath ) )
   379 			{
   421 			{
   380 			// add file as a email message part
   422 			// add file as a email message part
   381 	    	CFSMailMessagePart* msgPart = NULL;
   423 	    	CFSMailMessagePart* msgPart = NULL;
   382 	    	
   424 	    	
   423 			iModel->UpdateHeaderItemTextL();
   465 			iModel->UpdateHeaderItemTextL();
   424 			
   466 			
   425 			ret = ETrue;
   467 			ret = ETrue;
   426 			}
   468 			}
   427 		}
   469 		}
       
   470 
       
   471 	iDialogTimer->Cancel();
       
   472 	if(iWaitNote) 
       
   473 	  	{
       
   474 	    iWaitNote->ProcessFinishedL();
       
   475 	   	}
       
   476 	iAttachmentAddingLocked = EFalse;
       
   477 	
   428 	return ret;
   478 	return ret;
   429 	}
   479 	}
   430 
   480 
   431 // ---------------------------------------------------------------------------
   481 // ---------------------------------------------------------------------------
   432 // FileDrmProtectedL
   482 // FileDrmProtectedL