bluetoothengine/btnotif/src/btnpairnotifier.cpp
branchRCL_3
changeset 6 6a29d5ad0713
parent 0 f63038272f30
equal deleted inserted replaced
2:0b192a3a05a4 6:6a29d5ad0713
    20 #else
    20 #else
    21 #include <btextnotifiers.h>
    21 #include <btextnotifiers.h>
    22 #include <btextnotifierspartner.h> // new file introduced by xSymbian
    22 #include <btextnotifierspartner.h> // new file introduced by xSymbian
    23 #endif
    23 #endif
    24 
    24 
    25 #include <StringLoader.h>    // Localisation stringloader
       
    26 #include <utf.h>             // Unicode character conversion utilities
    25 #include <utf.h>             // Unicode character conversion utilities
    27 #include <btengconnman.h>
    26 #include <btengconnman.h>
    28 #include <BTNotif.rsg>       // Own resources
    27 #include <BTNotif.rsg>       // Own resources
       
    28 #include <bluetoothuiutil.h>
    29 #include "btnpairnotifier.h"
    29 #include "btnpairnotifier.h"
    30 #include "btNotifDebug.h"
    30 #include "btNotifDebug.h"
    31 #include "btnotifnameutils.h"
    31 #include "btnotifnameutils.h"
    32 
    32 
    33 // ----------------------------------------------------------
    33 // ----------------------------------------------------------
    78     (void)aBuffer;
    78     (void)aBuffer;
    79     if( !iMessage.IsNull() )
    79     if( !iMessage.IsNull() )
    80         {
    80         {
    81         User::Leave(KErrInUse);
    81         User::Leave(KErrInUse);
    82         }
    82         }
    83     else if ( AutoLockOnL() )
    83 
       
    84     iMessage = (RMessage2)aMessage;
       
    85     iReplySlot = aReplySlot;
       
    86 
       
    87     if ( AutoLockOnL() )
    84         {
    88         {
    85         // The phone is locked, access denied.
    89         // The phone is locked, access denied.
    86         //
    90         //
    87         CompleteMessage(KErrCancel);
    91         CompleteMessage(KErrCancel);
    88         return;
    92         }
    89         }
    93 
    90 
       
    91     iMessage = (RMessage2)aMessage;
       
    92     iReplySlot = aReplySlot;
       
    93     }
    94     }
    94 
    95 
    95 // ----------------------------------------------------------
    96 // ----------------------------------------------------------
    96 // CBTNPairNotifierBase::UpdateL
    97 // CBTNPairNotifierBase::UpdateL
    97 // ----------------------------------------------------------
    98 // ----------------------------------------------------------
   125 
   126 
   126     // Finally show new prompt for dialog if it is still on the screen
   127     // Finally show new prompt for dialog if it is still on the screen
   127     // and user has not given a alias for device.   
   128     // and user has not given a alias for device.   
   128         if( !iNotifUiUtil->IsQueryReleased() && !iDevice->IsValidFriendlyName() )
   129         if( !iNotifUiUtil->IsQueryReleased() && !iDevice->IsValidFriendlyName() )
   129             {
   130             {
   130             HBufC* prompt = GenerateQueryPromoptLC();
   131             RBuf prompt;
   131             iNotifUiUtil->UpdateQueryDlgL( *prompt );
   132             prompt.CleanupClosePushL();
   132             CleanupStack::PopAndDestroy( prompt );
   133             GenerateQueryPromptL( prompt );
       
   134             iNotifUiUtil->UpdateQueryDlgL( prompt );
       
   135             CleanupStack::PopAndDestroy( &prompt );
   133             }
   136             }
   134         }
   137         }
   135 
   138 
   136     FLOG(_L("[BTNOTIF]\t CBTNPairNotifierBase::UpdateL() completed"));
   139     FLOG(_L("[BTNOTIF]\t CBTNPairNotifierBase::UpdateL() completed"));
   137     TPtrC8 ret(KNullDesC8);
   140     TPtrC8 ret(KNullDesC8);
   201         return EFalse;            
   204         return EFalse;            
   202         }
   205         }
   203     
   206     
   204     TBTDeviceName devName;
   207     TBTDeviceName devName;
   205     BtNotifNameUtils::GetDeviceDisplayName( devName, iDevice );
   208     BtNotifNameUtils::GetDeviceDisplayName( devName, iDevice );
   206     HBufC* prompt = StringLoader::LoadLC( R_BT_ACCEPT_PAIRING_REQUEST, devName );   
   209     RBuf prompt;
   207 
   210     prompt.CleanupClosePushL();
   208     TBTDeviceName nameCoverUi( KNullDesC );
   211     BluetoothUiUtil::LoadResourceAndSubstringL( 
       
   212             prompt, R_BT_ACCEPT_PAIRING_REQUEST, devName, 0 );
       
   213 
       
   214     devName.Zero();
   209     // Show query for use to accept/reject incoming pairing request
   215     // Show query for use to accept/reject incoming pairing request
   210     TInt keypress = iNotifUiUtil->ShowQueryL( *prompt, R_BT_GENERIC_QUERY, 
   216     TInt keypress = iNotifUiUtil->ShowQueryL( prompt, R_BT_GENERIC_QUERY, 
   211              ECmdBTnotifUnavailable, nameCoverUi, CAknQueryDialog::EConfirmationTone );
   217              ECmdBTnotifUnavailable, devName, CAknQueryDialog::EConfirmationTone );
   212     CleanupStack::PopAndDestroy( prompt );
   218     CleanupStack::PopAndDestroy( &prompt );
   213 
   219 
   214     if( iMessage.IsNull() ) // cancelled by the stack
   220     if( iMessage.IsNull() ) // cancelled by the stack
   215         {
   221         {
   216         return EFalse;
   222         return EFalse;
   217         }
   223         }
   234     FLOG(_L("[BTNOTIF]\t CBTNPairNotifierBase::AuthoriseIncomingPairingL() << "));
   240     FLOG(_L("[BTNOTIF]\t CBTNPairNotifierBase::AuthoriseIncomingPairingL() << "));
   235     return ETrue;
   241     return ETrue;
   236     }
   242     }
   237 
   243 
   238 // ----------------------------------------------------------
   244 // ----------------------------------------------------------
   239 // CBTNPairNotifierBase::GenerateQueryPromoptLC
   245 // CBTNPairNotifierBase::GenerateQueryPromptL
   240 // To be implemented in derived classes.
   246 // To be implemented in derived classes.
   241 // ----------------------------------------------------------
   247 // ----------------------------------------------------------
   242 //
   248 //
   243 HBufC* CBTNPairNotifierBase::GenerateQueryPromoptLC()
   249 void CBTNPairNotifierBase::GenerateQueryPromptL(  RBuf& aRBuf )
   244     {
   250     {
   245     return NULL;
   251     FLOG(_L("[BTNOTIF]\t CBTNPairNotifierBase::GenerateQueryPromptL WARNING "));
   246     }
   252     (void) aRBuf;
       
   253     }