btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmui.cpp
changeset 42 b72428996822
parent 32 19bd632b5100
equal deleted inserted replaced
32:19bd632b5100 42:b72428996822
    30 #include <app/btcmtm.h>
    30 #include <app/btcmtm.h>
    31 #endif //NO101APPDEPFIXES_NEW
    31 #endif //NO101APPDEPFIXES_NEW
    32 
    32 
    33 #include <mtmuidef.hrh>
    33 #include <mtmuidef.hrh>
    34 #include <mtclreg.h>
    34 #include <mtclreg.h>
    35 #include <obexutilsuilayer.h>
       
    36 #include <Obexutils.rsg>
       
    37 #include <msvuids.h>
    35 #include <msvuids.h>
    38 #include <msvids.h>
    36 #include <msvids.h>
    39 #include <obexconstants.h>
    37 #include <obexconstants.h>
    40 
    38 
    41 
    39 
    79 // Destructor
    77 // Destructor
    80 CBtMtmUi::~CBtMtmUi()
    78 CBtMtmUi::~CBtMtmUi()
    81 	{
    79 	{
    82     FLOG( _L( "[CBtMtmUi] CBtMtmUi: ~CBtMtmUi\t" ) );
    80     FLOG( _L( "[CBtMtmUi] CBtMtmUi: ~CBtMtmUi\t" ) );
    83 	delete iClientRegistry;
    81 	delete iClientRegistry;
       
    82 	delete iDialog;
    84 	}
    83 	}
    85 
    84 
    86 // Symbian OS default constructor can leave.
    85 // Symbian OS default constructor can leave.
    87 void CBtMtmUi::ConstructL()
    86 void CBtMtmUi::ConstructL()
    88 	{
    87 	{
    89     FLOG( _L( "[CBtMtmUi] CBtMtmUi: ConstructL\t" ) );
    88     FLOG( _L( "[CBtMtmUi] CBtMtmUi: ConstructL\t" ) );
    90     CBaseMtmUi::ConstructL();
    89     CBaseMtmUi::ConstructL();
       
    90     iDialog = CObexUtilsDialog::NewL(this);
    91 	}
    91 	}
    92 
    92 
    93 // ---------------------------------------------------------
    93 // ---------------------------------------------------------
    94 // GetResourceFileName(...)
    94 // GetResourceFileName(...)
    95 // return progress status.
    95 // return progress status.
    96 // ---------------------------------------------------------
    96 // ---------------------------------------------------------
    97 //
    97 //
    98 void CBtMtmUi::GetResourceFileName( TFileName& aFileName ) const
    98 void CBtMtmUi::GetResourceFileName( TFileName& aFileName ) const
    99 	{ 
    99 	{ 
   100 	FLOG( _L( "[CBtMtmUi] CBtMtmUi: GetResourceFileName\t" ) );
   100 	FLOG( _L( "[CBtMtmUi] CBtMtmUi: GetResourceFileName\t" ) );
   101     aFileName = KObexUtilsFileDrive;
   101 	(void)aFileName;
   102     aFileName += KDC_RESOURCE_FILES_DIR;
   102 	//todo: This function should be removed it is using avkon resource file.
   103     aFileName += KObexUtilsResourceFileName;
       
   104 	}
   103 	}
   105 
   104 
   106 // ---------------------------------------------------------
   105 // ---------------------------------------------------------
   107 // QueryCapability(TUid aCapability, TInt& aResponse)
   106 // QueryCapability(TUid aCapability, TInt& aResponse)
   108 // return capability of mtm.
   107 // return capability of mtm.
   276                             iWaiter.Start();
   275                             iWaiter.Start();
   277                             }
   276                             }
   278                         }
   277                         }
   279                     if ( retVal != KErrNone ||iState  != KErrNone )
   278                     if ( retVal != KErrNone ||iState  != KErrNone )
   280                         {
   279                         {
   281                         resourceId = R_BT_DEV_NOT_AVAIL;                        
   280                         //resourceId = R_BT_DEV_NOT_AVAIL;                        
   282 						TObexUtilsUiLayer::ShowInformationNoteL( resourceId );
   281 						//TObexUtilsUiLayer::ShowInformationNoteL( resourceId );
       
   282                         //todo: Need to use Localized string.
       
   283                         _LIT(KText, "Cannot establish Bluetooth connection");
       
   284                         iDialog->ShowInformationNoteL(KText);
   283                         CleanupStack::PopAndDestroy(3); // BtDevice, BtConnection, password
   285                         CleanupStack::PopAndDestroy(3); // BtDevice, BtConnection, password
   284                         return CMsvCompletedOperation::NewL(
   286                         return CMsvCompletedOperation::NewL(
   285                              Session(), 
   287                              Session(), 
   286                              Type(), 
   288                              Type(), 
   287                              KNullDesC8, 
   289                              KNullDesC8, 
   513 
   515 
   514 	const TObexMtmProgress::TSendState progressType	= progress.iSendState;
   516 	const TObexMtmProgress::TSendState progressType	= progress.iSendState;
   515 	const TInt error = progress.iError;
   517 	const TInt error = progress.iError;
   516     if ( error == KErrInUse )
   518     if ( error == KErrInUse )
   517 		{
   519 		{
   518         resourceId = R_BT_DEV_NOT_AVAIL;
   520         //resourceId = R_BT_DEV_NOT_AVAIL;
   519 		TObexUtilsUiLayer::ShowInformationNoteL( resourceId );
   521 		//TObexUtilsUiLayer::ShowInformationNoteL( resourceId );
       
   522         //todo: Need to use Localized string.
       
   523         _LIT(KText, "Cannot establish Bluetooth connection");
       
   524         iDialog->ShowInformationNoteL(KText);
       
   525 
   520 	    return KErrNone;
   526 	    return KErrNone;
   521 		}
   527 		}
   522     
   528     
   523 	switch( progressType )
   529 	switch( progressType )
   524 		{
   530 		{
   525 	    case TObexMtmProgress::EDisconnected:
   531 	    case TObexMtmProgress::EDisconnected:
   526             {
   532             {
   527             FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: EDisconnected\t" ) );
   533             FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: EDisconnected\t" ) );
   528             // Allowed to send again.
   534             // Allowed to send again.
   529             resourceId = R_BT_DATA_SENT;
   535             //resourceId = R_BT_DATA_SENT;
   530 			TObexUtilsUiLayer::ShowInformationNoteL( resourceId );
   536 			//TObexUtilsUiLayer::ShowInformationNoteL( resourceId );
       
   537             //todo: Need to use Localized string.
       
   538             _LIT(KText, "Message sent!");
       
   539             iDialog->ShowInformationNoteL(KText);
       
   540 
   531 		    break;
   541 		    break;
   532             }
   542             }
   533         case TObexMtmProgress::ESendError:
   543         case TObexMtmProgress::ESendError:
   534             {
   544             {
   535             FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: ESendError\t" ) );
   545             FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: ESendError\t" ) );
   536             if( error == KErrIrObexClientNoDevicesFound )
   546             if( error == KErrIrObexClientNoDevicesFound )
   537                 {
   547                 {
   538                 resourceId = R_BT_DEV_NOT_AVAIL;
   548                 //resourceId = R_BT_DEV_NOT_AVAIL;
   539 				TObexUtilsUiLayer::ShowInformationNoteL( resourceId );
   549 				//TObexUtilsUiLayer::ShowInformationNoteL( resourceId );
       
   550                 //todo: Need to use Localized string.
       
   551                 _LIT(KText, "Cannot establish Bluetooth connection");
       
   552                 iDialog->ShowInformationNoteL(KText);
       
   553 
   540                 }
   554                 }
   541             else
   555             else
   542                 {
   556                 {
   543                 resourceId = R_BT_FAILED_TO_SEND;
   557                 //resourceId = R_BT_FAILED_TO_SEND;
   544 				TObexUtilsUiLayer::ShowErrorNoteL( resourceId );
   558 				//TObexUtilsUiLayer::ShowErrorNoteL( resourceId );
       
   559                 //todo: Need to use Localized string.
       
   560                 _LIT(KText, "Failed to send message");
       
   561                 iDialog->ShowErrorNoteL(KText);
       
   562 
   545                 }
   563                 }
   546             break;
   564             break;
   547             }
   565             }
   548         case TObexMtmProgress::ESendComplete:
   566         case TObexMtmProgress::ESendComplete:
   549             {
   567             {
   664 //
   682 //
   665 CMsvOperation* CBtMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus, 
   683 CMsvOperation* CBtMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus, 
   666                                                   CMsvSession& aSession)
   684                                                   CMsvSession& aSession)
   667 	{
   685 	{
   668 	FLOG( _L( "[CommonMtmUi] CBtMtmUi: LaunchEditorApplicationL\t" ) );
   686 	FLOG( _L( "[CommonMtmUi] CBtMtmUi: LaunchEditorApplicationL\t" ) );
   669 	CMsvEntry* message;
   687 	(void)aStatus;
   670 	message = &iBaseMtm.Entry();    
   688 	(void)aSession;
   671 	return TObexUtilsUiLayer::LaunchEditorApplicationOperationL( aSession, message, aStatus );
   689 	//CMsvEntry* message;
       
   690 	//message = &iBaseMtm.Entry();
       
   691 	//todo: need to replace this 
       
   692 	//return TObexUtilsUiLayer::LaunchEditorApplicationOperationL( aSession, message, aStatus );
       
   693 	return NULL;
   672 	}
   694 	}
   673 
   695 
   674 // ---------------------------------------------------------
   696 // ---------------------------------------------------------
   675 // GetClientMtmLC(TUid aMtmType)
   697 // GetClientMtmLC(TUid aMtmType)
   676 // Handles MTM registration.
   698 // Handles MTM registration.
   803     {
   825     {
   804     iState=aErr;        
   826     iState=aErr;        
   805     iWaiter.AsyncStop();
   827     iWaiter.AsyncStop();
   806     }            
   828     }            
   807 
   829 
       
   830 void CBtMtmUi::DialogDismissed(TInt /*aButtonId*/)
       
   831     {
       
   832     
       
   833     }
       
   834 
   808 // End of File
   835 // End of File