notepad/notepad1/LibSrc/NpdDialogBase.cpp
branchRCL_3
changeset 27 55d60436f00b
parent 0 f979ecb2b13e
child 67 1539a383d7b6
equal deleted inserted replaced
21:9711e452b5e9 27:55d60436f00b
   480     TInt aCommandId )
   480     TInt aCommandId )
   481     {
   481     {
   482     TInt index(0);
   482     TInt index(0);
   483     aMenuPane.ItemAndPos( aCommandId, index );
   483     aMenuPane.ItemAndPos( aCommandId, index );
   484 	aSendUi.AddSendMenuItemL( aMenuPane, index+1, ENotepadCmdSend/*, TSendingCapabilities()*/ );
   484 	aSendUi.AddSendMenuItemL( aMenuPane, index+1, ENotepadCmdSend/*, TSendingCapabilities()*/ );
   485 	aMenuPane.SetItemSpecific(ENotepadCmdSend, ETrue);
   485 	
       
   486     if ( IsNoteListDialog() )
       
   487         {
       
   488         aMenuPane.SetItemSpecific( ENotepadCmdSend, ETrue );
       
   489         }	
   486     }
   490     }
   487 
   491 
   488 // -----------------------------------------------------------------------------
   492 // -----------------------------------------------------------------------------
   489 // CNotepadDialogBase::ActivateL
   493 // CNotepadDialogBase::ActivateL
   490 // -----------------------------------------------------------------------------
   494 // -----------------------------------------------------------------------------
   867 // -----------------------------------------------------------------------------
   871 // -----------------------------------------------------------------------------
   868 // CNotepadDialogBase::CCreateAndAppendFiles::StartAttachingL
   872 // CNotepadDialogBase::CCreateAndAppendFiles::StartAttachingL
   869 // -----------------------------------------------------------------------------
   873 // -----------------------------------------------------------------------------
   870 
   874 
   871 void CNotepadDialogBase::CCreateAndAppendFiles::StartAttachingL()
   875 void CNotepadDialogBase::CCreateAndAppendFiles::StartAttachingL()
   872 	{
   876     {
   873 	iStatus = KRequestPending;
       
   874 	if( iCount < iTotalCount )
   877 	if( iCount < iTotalCount )
   875 		iAttaching = ETrue;
   878 		iAttaching = ETrue;
   876 	else
   879 	else
   877 		iAttaching = EFalse;
   880 		iAttaching = EFalse;
   878 	
   881 	
   879 	
   882 	
   880 	if( iAttaching )
   883 	if( iAttaching )
   881 		{
   884 		{
   882 		TInt tempInt = iKeys[iCount];
   885         TInt tempInt = iKeys[iCount];
   883 		HBufC* buf = iModel.ContentByKeyL(tempInt);
   886         HBufC* buf = iModel.ContentByKeyL(tempInt);
   884 		
   887 		
   885         CleanupStack::PushL(buf);
   888         CleanupStack::PushL(buf);
   886         iText->Reset();
   889         iText->Reset();
   887         iText->InsertL(0, *buf);
   890 
       
   891         TRAPD( err, iText->InsertL( 0, *buf ) );
       
   892     
       
   893         if( err != KErrNone )
       
   894             {
       
   895             Cancel();
       
   896             
       
   897             if ( iProgressBar )
       
   898                 {
       
   899                 EndProgressDialog();
       
   900                 }
       
   901             // release the member in advance to avoid memory-consumed erupted when endless send Notes by Messaging.			
       
   902             ReleaseMemory();		  	
       
   903         
       
   904             User::LeaveIfError( err );
       
   905             }
       
   906         
   888         iFiles->AppendL(*iText);
   907         iFiles->AppendL(*iText);
   889  
   908  
   890         User::LeaveIfError( array->At(iCount).Open( iFs, iFiles->iSendFileName, EFileRead ) );
   909         User::LeaveIfError( array->At(iCount).Open( iFs, iFiles->iSendFileName, EFileRead ) );
   891    		imessageData->AppendAttachmentHandleL( array->At(iCount));
   910         imessageData->AppendAttachmentHandleL( array->At(iCount));
   892 		
   911 		
   893 		iCount++;
   912         iCount++;
       
   913     
   894         CleanupStack::PopAndDestroy(); // buf
   914         CleanupStack::PopAndDestroy(); // buf
   895 		}
   915         }
       
   916 	
       
   917 	iStatus = KRequestPending;
   896 	SetActive();
   918 	SetActive();
   897 	TRequestStatus* status = &iStatus;
   919 	TRequestStatus* status = &iStatus;
   898 	User::RequestComplete(status,KErrNone);
   920 	User::RequestComplete(status,KErrNone);
   899 	}
   921 	}
   900 
   922 
   932 			       iSendAppUi.CreateAndSendMessageL( iServiceUId, imessageData ); 
   954 			       iSendAppUi.CreateAndSendMessageL( iServiceUId, imessageData ); 
   933 			    }
   955 			    }
   934 			    
   956 			    
   935 			iListDialog->ClearSaveOrMarkedListItemsL(!iCanceled );   
   957 			iListDialog->ClearSaveOrMarkedListItemsL(!iCanceled );   
   936 			iCanceled = EFalse;
   958 			iCanceled = EFalse;
   937 
       
   938 			if(iFiles)		
       
   939 			{
       
   940 				delete iFiles;
       
   941 			 	iFiles =NULL;
       
   942 			}
       
   943 			
   959 			
   944 			if(iText)
   960 			// release the member in advance in case of memory-consumed erupted when endless send Notes by Messaging.	
   945 			{
   961 			ReleaseMemory();
   946 				delete iText;
       
   947 				iText =NULL;
       
   948 			}
       
   949 			
       
   950 			if(imessageData)
       
   951 			{
       
   952 			
       
   953 			delete imessageData;
       
   954 			imessageData =NULL;	
       
   955 			}
       
   956 			
       
   957 			if(array)
       
   958 			{
       
   959 			array->Reset();
       
   960 
       
   961 			delete array;
       
   962 			array =NULL;
       
   963 			}
       
   964 			
       
   965 			
       
   966 			iKeys.Close();
       
   967 
       
   968 			iFs.Close();
       
   969 			
   962 			
   970 			RFs fs;
   963 			RFs fs;
   971 			User::LeaveIfError(fs.Connect());
   964 			User::LeaveIfError(fs.Connect());
   972 			CleanupClosePushL(fs);
   965 			CleanupClosePushL(fs);
   973 		    CFileMan* fileMan = CFileMan::NewL(fs);
   966 		    CFileMan* fileMan = CFileMan::NewL(fs);
   998 		{
   991 		{
   999 		EndProgressDialog();
   992 		EndProgressDialog();
  1000 		}
   993 		}
  1001 
   994 
  1002 	}
   995 	}
       
   996 
       
   997 // -----------------------------------------------------------------------------
       
   998 // CNotepadDialogBase::CCreateAndAppendFiles::PrepareToClose
       
   999 // -----------------------------------------------------------------------------
       
  1000 void CNotepadDialogBase::CCreateAndAppendFiles::ReleaseMemory()
       
  1001     {
       
  1002     if( iFiles )		
       
  1003         {
       
  1004         delete iFiles;
       
  1005         iFiles = NULL;
       
  1006         }
       
  1007 
       
  1008     if( iText )
       
  1009         {
       
  1010         delete iText;
       
  1011         iText = NULL;
       
  1012         }
       
  1013 
       
  1014     if( imessageData )
       
  1015         {	
       
  1016         delete imessageData;
       
  1017         imessageData = NULL;	
       
  1018         }
       
  1019 
       
  1020     if( array )
       
  1021         {
       
  1022         array->Reset();
       
  1023 
       
  1024         delete array;
       
  1025         array = NULL;
       
  1026         }
       
  1027 
       
  1028     iKeys.Close();
       
  1029     iFs.Close();	
       
  1030     }
       
  1031 
  1003 // End of File  
  1032 // End of File