emailuis/emailui/src/FreestyleEmailUiSendAttachmentsListControl.cpp
branchRCL_3
changeset 13 8592a65ad3fb
parent 8 e1b6206813b4
child 14 b13141f05c3d
--- a/emailuis/emailui/src/FreestyleEmailUiSendAttachmentsListControl.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiSendAttachmentsListControl.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -62,6 +62,8 @@
 
 // CLASS IMPLEMENTATION
 
+TInt KGenericTimerDialogInterval = 1000; // Interval for iDialogTimer
+
 // ---------------------------------------------------------------------------
 // Two-phased constructor.
 // ---------------------------------------------------------------------------
@@ -119,6 +121,8 @@
     CAlfControl::ConstructL( aEnv );
 	iService = CFscContactActionService::NewL( iAppUi->GetVPbkManagerL() );
     iModel = CFSEmailUiSendAttachmentsListModel::NewL( iAppUi, Env(), this );
+    iAttachmentAddingLocked = EFalse;
+    iDialogTimer = CFSEmailUiGenericTimer::NewL( this );
     }
 
 // ---------------------------------------------------------------------------
@@ -128,6 +132,11 @@
 CFreestyleEmailUiSendAttachmentsListControl::~CFreestyleEmailUiSendAttachmentsListControl()
     {
     FUNC_LOG;
+	if(iDialogTimer)
+		{
+	    iDialogTimer->Cancel();
+	    delete iDialogTimer;
+		}
 	delete iService;
     }
 
@@ -324,6 +333,30 @@
 	return iModel;
 }
 
+
+// ---------------------------------------------------------------------------
+// IsAttachmentAddingLocked
+//
+// ---------------------------------------------------------------------------
+//
+TBool CFreestyleEmailUiSendAttachmentsListControl::IsAttachmentAddingLocked() const
+{
+    FUNC_LOG;
+	return iAttachmentAddingLocked;
+}
+
+
+// ---------------------------------------------------------------------------
+// TimerEventL
+// Timer that delays the dialog will open the dialog here
+// ---------------------------------------------------------------------------
+//
+void CFreestyleEmailUiSendAttachmentsListControl::TimerEventL( CFSEmailUiGenericTimer* /*aTriggeredTimer*/ )
+	{
+	TFsEmailUiUtility::ShowWaitNoteL( iWaitNote, R_FSE_WAIT_INSERTING_TEXT, EFalse,ETrue );
+	iDialogTimer->Cancel();
+	}
+
 // ---------------------------------------------------------------------------
 // AppendAttachmentToListL
 //
@@ -338,6 +371,11 @@
 	// <cmail>
 	TBool fetchOK = EFalse;
 	
+	if(iAttachmentAddingLocked)
+		{
+	    return ret;
+		}
+	
 	if (aType != MsgAttachmentUtils::EUnknown)
 	    {
         CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
@@ -373,8 +411,12 @@
 	    fetchOK = TFsEmailUiUtility::ShowSelectFileDialogL( filePath );
 	    }
         
+	iAttachmentAddingLocked = ETrue;
+	
 	if ( fetchOK && filePath.Length() > 0 ) // </cmail>
 		{
+	    iDialogTimer->Start(KGenericTimerDialogInterval);   
+	
         if ( !FileDrmProtectedL( filePath ) )
 			{
 			// add file as a email message part
@@ -425,6 +467,14 @@
 			ret = ETrue;
 			}
 		}
+
+	iDialogTimer->Cancel();
+	if(iWaitNote) 
+	  	{
+	    iWaitNote->ProcessFinishedL();
+	   	}
+	iAttachmentAddingLocked = EFalse;
+	
 	return ret;
 	}