btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBIPController.cpp
changeset 42 b72428996822
parent 32 19bd632b5100
child 57 5ebadcda06cb
equal deleted inserted replaced
32:19bd632b5100 42:b72428996822
     1 /*
     1 /*
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include "BTSBIPController.h"
    21 #include "BTSBIPController.h"
    22 #include "BTSUDebug.h"
    22 #include "BTSUDebug.h"
    23 #include "BTSUImageConverter.h"
    23 #include "BTSUImageConverter.h"
    24 #include "BTSUXmlParser.h"
    24 #include "BTSUXmlParser.h"
    25 #include <Obexutils.rsg>
    25 #include <hbtextresolversymbian.h>
    26 
    26 
    27 
    27 
    28 
    28 
    29 // CONSTANTS
    29 // CONSTANTS
    30 // image push target header
    30 // image push target header
    46 
    46 
    47 //temp file path drive letter
    47 //temp file path drive letter
    48 _LIT(KBTSBIPTempPathDrive,"c:");
    48 _LIT(KBTSBIPTempPathDrive,"c:");
    49 const TInt KBTSUMaxPathLenght=256;
    49 const TInt KBTSUMaxPathLenght=256;
    50 const TInt KBTSUMaxPrivatePathLenght=20;
    50 const TInt KBTSUMaxPrivatePathLenght=20;
       
    51 
       
    52 _LIT(KBTNotSendSomeText,"txt_bt_info_receiving_device_does_not_support_all");
       
    53 _LIT(KBTNotSendOneText,"txt_bt_info_receiving_device_does_not_support_this");
       
    54 
    51 
    55 
    52 
    56 
    53 
    57 
    54 // ============================ MEMBER FUNCTIONS ===============================
    58 // ============================ MEMBER FUNCTIONS ===============================
    55 
    59 
   233             iObserverPtr->ControllerComplete( EBTSGettingFailed );
   237             iObserverPtr->ControllerComplete( EBTSGettingFailed );
   234             }
   238             }
   235         }
   239         }
   236     else if( aStatus != KErrAbort && aGetResponse->BytesReceived()==0 )
   240     else if( aStatus != KErrAbort && aGetResponse->BytesReceived()==0 )
   237         {
   241         {
   238         TRAPD( error,iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageListSize(),iListPtr->ImageCount() ) );
   242         TRAPD( error,iObserverPtr->LaunchProgressNoteL( iClient,iListPtr->ImageCount() ) );
   239         error=KErrNone;
   243         error=KErrNone;
   240         TRAP(error, SendL() );    	 
   244         TRAP(error, SendL() );    	 
   241         if ( error != KErrNone )
   245         if ( error != KErrNone )
   242             {            
   246             {            
   243             iObserverPtr->ControllerComplete( EBTSPuttingFailed );
   247             iObserverPtr->ControllerComplete( EBTSPuttingFailed );
   289         // Send image
   293         // Send image
   290         //
   294         //
   291         
   295         
   292         TBTSUImageParam imageparam = iListPtr->ImageAtL( iFileIndex );        
   296         TBTSUImageParam imageparam = iListPtr->ImageAtL( iFileIndex );        
   293         RBuf filename;
   297         RBuf filename;
   294         filename.CreateL(256);
   298         filename.CreateL(KMaxFileName);
   295         CleanupClosePushL(filename);
   299         CleanupClosePushL(filename);
   296         imageparam.iFile.Name(filename);
   300         imageparam.iFile.Name(filename);
   297         
   301         
   298         iObserverPtr->UpdateProgressNoteL(imageparam.iFileSize,iFileIndex,filename);
   302         iObserverPtr->UpdateProgressNoteL(imageparam.iFileSize,iFileIndex,filename);
   299         CleanupStack::PopAndDestroy(&filename);
   303         CleanupStack::PopAndDestroy(&filename);
   555     FLOG(_L("[BTSU]\t CBTSBIPController::HandleGetCompleteIndicationL()"));
   559     FLOG(_L("[BTSU]\t CBTSBIPController::HandleGetCompleteIndicationL()"));
   556 
   560 
   557     TBool found;
   561     TBool found;
   558     TBool allSupported;
   562     TBool allSupported;
   559     TInt picindex,capindex;
   563     TInt picindex,capindex;
   560     TInt confirm=0;
       
   561     CBTSUXmlParser* xmlParser = CBTSUXmlParser::NewL();
   564     CBTSUXmlParser* xmlParser = CBTSUXmlParser::NewL();
   562     CleanupStack::PushL( xmlParser );
   565     CleanupStack::PushL( xmlParser );
   563     GenerateTempFileNameL( iTempFileName );
   566     GenerateTempFileNameL( iTempFileName );
   564     aGetResponse->WriteToFile( iTempFileName );
   567     aGetResponse->WriteToFile( iTempFileName );
   565     aGetResponse->Reset();
   568     aGetResponse->Reset();
   629 	delete remoteCapabilityList;
   632 	delete remoteCapabilityList;
   630     CleanupStack::PopAndDestroy( xmlParser ); 
   633     CleanupStack::PopAndDestroy( xmlParser ); 
   631     
   634     
   632     if(!allSupported  && iListPtr->ImageCount() > 1)
   635     if(!allSupported  && iListPtr->ImageCount() > 1)
   633     	{      	
   636     	{      	
   634     	
   637         HBufC* sendText = HbTextResolverSymbian::LoadLC(KBTNotSendSomeText);
   635     	confirm=iObserverPtr->LaunchConfirmationQuery(R_BT_NOT_SEND_ALL_QUERY_MIXED);    	
   638     	iObserverPtr->LaunchConfirmationQuery(sendText->Des());
   636     		
   639     	CleanupStack::PopAndDestroy( sendText );
   637     	if(confirm==EAknSoftkeyYes)
       
   638     		{
       
   639     		// Everything went ok. Start sending images
       
   640     		//
       
   641     		iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageListSize(),iListPtr->ImageCount() );
       
   642     
       
   643 		    // Start sending images
       
   644     		//
       
   645    			SendL();
       
   646     		}
       
   647     	
       
   648     		
       
   649     	}
   640     	}
   650     else if ( !allSupported  &&  iListPtr->ImageCount() == 1)
   641     else if ( !allSupported  &&  iListPtr->ImageCount() == 1)
   651         {
   642         {
   652         // We allow user to choose wheather to send the image file which is not supported on target device
   643         // We allow user to choose wheather to send the image file which is not supported on target device
   653         // Original codeline: iObserverPtr->ControllerComplete( EBTSBIPOneNotSend ); 
   644         HBufC* sendText = HbTextResolverSymbian::LoadLC(KBTNotSendOneText);
   654         confirm=iObserverPtr->LaunchConfirmationQuery(R_BT_NOT_SEND_ALL_QUERY_SINGLE);       
   645         iObserverPtr->LaunchConfirmationQuery(sendText->Des());
   655                     
   646         CleanupStack::PopAndDestroy( sendText );
   656         if(confirm==EAknSoftkeyYes)
       
   657             {
       
   658             // Everything went ok. Start sending the images
       
   659             //
       
   660             iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageListSize(),iListPtr->ImageCount() );
       
   661             
       
   662             // Start sending images
       
   663             //
       
   664             SendL();
       
   665             }
       
   666         } 	
   647         } 	
   667     else if( allSupported )  	
   648     else if( allSupported )  	
   668         {
   649         {
   669     	iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageListSize() + iListPtr->ObjectListSizeL(),iListPtr->ImageCount() + iListPtr->ObjectCount());
   650     	iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageCount() + iListPtr->ObjectCount());
   670     
   651     
   671 	    // Start sending images
   652 	    // Start sending images
   672     	//   	
   653     	//   	
   673    		SendL();   		
   654    		SendL();   		
   674     	}
   655     	}
   686     {
   667     {
   687     iObserverPtr->ConnectTimedOut();    
   668     iObserverPtr->ConnectTimedOut();    
   688     }
   669     }
   689 
   670 
   690 
   671 
       
   672 
       
   673 void CBTSBIPController::SendUnSupportedFiles()
       
   674     {
       
   675     // Everything went ok. Start sending images
       
   676 
       
   677     // group leaving functions in one trap for better performance:
       
   678     TRAPD(err, {
       
   679             iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageCount() );
       
   680             SendL(); } );
       
   681     
       
   682     if ( err != KErrNone )
       
   683         {
       
   684         DeleteTempFile( iTempFileName );
       
   685         // Error on capability handling
       
   686         //
       
   687         iObserverPtr->ControllerComplete( EBTSGettingFailed );
       
   688         }
       
   689     }
       
   690 
   691 //  End of File  
   691 //  End of File