22 #include <avkon.mbg> |
22 #include <avkon.mbg> |
23 #include <btengconnman.h> |
23 #include <btengconnman.h> |
24 #include <btotgpairpub.inl> |
24 #include <btotgpairpub.inl> |
25 #include <btextnotifiers.h> |
25 #include <btextnotifiers.h> |
26 #include <BTNotif.rsg> // Own resources |
26 #include <BTNotif.rsg> // Own resources |
|
27 #include <bluetoothuiutil.h> |
27 #include "btnotif.hrh" // Own resource header |
28 #include "btnotif.hrh" // Own resource header |
28 #include "btnpinnotifier.h" // Own class definition |
29 #include "btnpinnotifier.h" // Own class definition |
29 #include "btNotifDebug.h" // Debugging macros |
30 #include "btNotifDebug.h" // Debugging macros |
30 #include "btnotifnameutils.h" |
31 #include "btnotifnameutils.h" |
31 |
32 |
165 // minimum length requirement |
166 // minimum length requirement |
166 // |
167 // |
167 FOREVER |
168 FOREVER |
168 { |
169 { |
169 TBuf<KBTPassKeyMaxLength> tempResultBuffer; |
170 TBuf<KBTPassKeyMaxLength> tempResultBuffer; |
170 |
171 RBuf prompt; |
171 HBufC* prompt = GenerateQueryPromoptLC(); // prompt still in stack. |
172 prompt.CleanupClosePushL(); |
172 TInt keypress = iNotifUiUtil->ShowTextInputQueryL(tempResultBuffer, *prompt, R_BT_ENTER_PASSKEY_QUERY, |
173 GenerateQueryPromptL( prompt ); |
|
174 TInt keypress = iNotifUiUtil->ShowTextInputQueryL(tempResultBuffer, prompt, R_BT_ENTER_PASSKEY_QUERY, |
173 ECmdShowBtOpenCoverNote, CAknQueryDialog::EConfirmationTone ); |
175 ECmdShowBtOpenCoverNote, CAknQueryDialog::EConfirmationTone ); |
174 CleanupStack::PopAndDestroy( prompt ); |
176 CleanupStack::PopAndDestroy( &prompt ); |
175 |
177 |
176 if( keypress ) // OK pressed |
178 if( keypress ) // OK pressed |
177 { |
179 { |
178 // Convert data from buf to pin |
180 // Convert data from buf to pin |
179 TBuf8<KBTPassKeyMaxLength> buf8; |
181 TBuf8<KBTPassKeyMaxLength> buf8; |
246 } |
248 } |
247 return ret; |
249 return ret; |
248 } |
250 } |
249 |
251 |
250 // ---------------------------------------------------------- |
252 // ---------------------------------------------------------- |
251 // CBTPinNotifier::GenerateQueryPromoptLC |
253 // CBTPinNotifier::GenerateQueryPromptL |
252 // ---------------------------------------------------------- |
254 // ---------------------------------------------------------- |
253 HBufC* CBTPinNotifier::GenerateQueryPromoptLC() |
255 void CBTPinNotifier::GenerateQueryPromptL( RBuf& aRBuf ) |
254 { |
256 { |
255 FLOG(_L("[BTNOTIF]\t CBTPinNotifier::GenerateQueryPromoptLC() >>")); |
257 FLOG(_L("[BTNOTIF]\t CBTPinNotifier::GenerateQueryPromptLC() >>")); |
256 HBufC* prompt = NULL; |
|
257 |
|
258 TBTDeviceName devName; |
258 TBTDeviceName devName; |
259 BtNotifNameUtils::GetDeviceDisplayName( devName, iDevice ); |
259 BtNotifNameUtils::GetDeviceDisplayName( devName, iDevice ); |
260 if (iPasskeyLength > 0) //Minimum length passkey is defined |
260 if (iPasskeyLength > 0) //Minimum length passkey is defined |
261 { |
261 { |
262 CDesCArray* stringArray = new ( ELeave ) CDesCArrayFlat( 1 ); |
262 BluetoothUiUtil::LoadResourceAndSubstringL( |
263 CleanupStack::PushL( stringArray ); |
263 aRBuf, R_BT_MIN_PASSKEY_PROMPT, devName, 1 ); |
264 CArrayFix<TInt>* indexArray = new(ELeave) CArrayFixFlat<TInt>(1); |
264 |
265 CleanupStack::PushL( indexArray ); |
265 RBuf tmpBuf; |
266 |
266 tmpBuf.CleanupClosePushL(); |
267 stringArray->AppendL( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName()) ); |
267 tmpBuf.Swap( aRBuf ); |
268 indexArray->AppendL( iPasskeyLength); |
268 aRBuf.ReAllocL( aRBuf.MaxLength() + sizeof(TUint)); |
269 prompt = StringLoader::LoadL( R_BT_MIN_PASSKEY_PROMPT, *stringArray, *indexArray ); |
269 aRBuf.Zero(); |
270 |
270 // Passkey length should be localized, hope StringLoader can make it: |
271 CleanupStack::PopAndDestroy( indexArray ); |
271 StringLoader::Format( aRBuf, tmpBuf, 0, iPasskeyLength ); |
272 CleanupStack::PopAndDestroy( stringArray ); |
272 CleanupStack::PopAndDestroy( &tmpBuf ); |
273 CleanupStack::PushL( prompt ); |
|
274 } |
273 } |
275 else |
274 else |
276 { |
275 { |
277 prompt = StringLoader::LoadLC( R_BT_PASSKEY_PROMPT, devName ); |
276 BluetoothUiUtil::LoadResourceAndSubstringL( |
278 } |
277 aRBuf, R_BT_PASSKEY_PROMPT, devName, 0 ); |
279 FLOG(_L("[BTNOTIF]\t CBTPinNotifier::GenerateQueryPromoptLC() <<")); |
278 } |
280 return prompt; |
279 FLOG(_L("[BTNOTIF]\t CBTPinNotifier::GenerateQueryPromptLC() <<")); |
281 } |
280 } |
282 // End of File |
281 // End of File |