31 #include "btnumcmpnotifier.h" // Own class definition |
31 #include "btnumcmpnotifier.h" // Own class definition |
32 #include "btNotifDebug.h" // Debugging macros |
32 #include "btNotifDebug.h" // Debugging macros |
33 #include <btotgpairpub.inl> |
33 #include <btotgpairpub.inl> |
34 #include <btengconnman.h> |
34 #include <btengconnman.h> |
35 #include <SecondaryDisplay/BTnotifSecondaryDisplayAPI.h> |
35 #include <SecondaryDisplay/BTnotifSecondaryDisplayAPI.h> |
|
36 #include <bluetoothuiutil.h> |
36 #include "btnotifnameutils.h" |
37 #include "btnotifnameutils.h" |
37 |
38 |
38 #ifdef __SERIES60_HELP |
39 #ifdef __SERIES60_HELP |
39 #include <hlplch.h> |
40 #include <hlplch.h> |
40 #include <csxhelp/bt.hlp.hrh> // The bt hrh info is needed, for help launching |
41 #include <csxhelp/bt.hlp.hrh> // The bt hrh info is needed, for help launching |
152 } |
153 } |
153 |
154 |
154 // For outgoing pairing request or accepted incoming pairing request, |
155 // For outgoing pairing request or accepted incoming pairing request, |
155 // ask user to compare the pincodes in two devices. |
156 // ask user to compare the pincodes in two devices. |
156 TBTDeviceName nameCoverUi( KNullDesC ); |
157 TBTDeviceName nameCoverUi( KNullDesC ); |
157 HBufC* prompt = GenerateQueryPromoptLC(); |
158 RBuf prompt; |
158 TInt answer = iNotifUiUtil->ShowQueryL( *prompt, R_BT_GENERIC_QUERY, ECmdShowBtOpenCoverNote, nameCoverUi ); |
159 prompt.CleanupClosePushL(); |
159 CleanupStack::PopAndDestroy( prompt ); |
160 GenerateQueryPromptL( prompt ); |
|
161 TInt answer = iNotifUiUtil->ShowQueryL( prompt, R_BT_GENERIC_QUERY, ECmdShowBtOpenCoverNote, nameCoverUi ); |
|
162 CleanupStack::PopAndDestroy( &prompt ); |
160 |
163 |
161 if( answer ) |
164 if( answer ) |
162 { |
165 { |
163 CompleteMessage(answer, KErrNone); |
166 CompleteMessage(answer, KErrNone); |
164 } |
167 } |
185 |
188 |
186 FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::HandleGetDeviceCompletedL() completed")); |
189 FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::HandleGetDeviceCompletedL() completed")); |
187 } |
190 } |
188 |
191 |
189 // ---------------------------------------------------------- |
192 // ---------------------------------------------------------- |
190 // CBTNumCmpNotifier::GenerateQueryPromoptLC |
193 // CBTNumCmpNotifier::GenerateQueryPromptL |
191 // Generate prompt for Numeric Comparison query and return. |
194 // Generate prompt for Numeric Comparison query and return. |
192 // ---------------------------------------------------------- |
195 // ---------------------------------------------------------- |
193 // |
196 // |
194 HBufC* CBTNumCmpNotifier::GenerateQueryPromoptLC() |
197 void CBTNumCmpNotifier::GenerateQueryPromptL( RBuf& aRBuf ) |
195 { |
198 { |
196 FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::GenerateQueryPromoptLC()")); |
199 FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::GenerateQueryPromptL()")); |
197 TBTDeviceName devName; |
200 TBTDeviceName devName; |
198 BtNotifNameUtils::GetDeviceDisplayName( devName, iDevice ); |
201 BtNotifNameUtils::GetDeviceDisplayName( devName, iDevice ); |
199 |
|
200 CPtrCArray* subs = new (ELeave) CPtrCArray(2); |
|
201 CleanupStack::PushL( subs ); |
|
202 TBuf<KBTDeviceShortNameLength> shortName; |
202 TBuf<KBTDeviceShortNameLength> shortName; |
203 |
203 |
|
204 TPtrC namePtr; |
204 // Cut the name and put ellipsis in the middle if necessary |
205 // Cut the name and put ellipsis in the middle if necessary |
205 // By example "SampleSymbianDevice" after this operation will be shown in |
206 // By example "SampleSymbianDevice" after this operation will be shown in |
206 // the dialog as "Sam...ice"(for 7 chars device name limit) |
207 // the dialog as "Sam...ice"(for 7 chars device name limit) |
207 // This need to be done, because if name of the device is too long, the PIN |
208 // This need to be done, because if name of the device is too long, the PIN |
208 // codes aren't visible and user can't compare it with PIN code taken from |
209 // codes aren't visible and user can't compare it with PIN code taken from |
213 //adding ellipsis ("...") char in the middle of the string |
214 //adding ellipsis ("...") char in the middle of the string |
214 shortName.Append( TChar( KEllipsis) ); |
215 shortName.Append( TChar( KEllipsis) ); |
215 //adding only end of the name to the final string |
216 //adding only end of the name to the final string |
216 shortName.Append( devName.Right( shortName.MaxLength() - |
217 shortName.Append( devName.Right( shortName.MaxLength() - |
217 shortName.Length() ) ); |
218 shortName.Length() ) ); |
218 subs->AppendL( shortName ); |
219 namePtr.Set( shortName ); |
219 } |
220 } |
220 else |
221 else |
221 { |
222 { |
222 subs->AppendL( devName ); |
223 namePtr.Set( devName ); |
223 } |
224 } |
224 subs->AppendL( iPasskeyToShow ); |
225 |
225 HBufC* prompt = StringLoader::LoadL( R_BT_SSP_PASSKEY_COMPARISON_PROMPT, *subs ); |
226 BluetoothUiUtil::LoadResourceAndSubstringL( |
226 CleanupStack::PopAndDestroy( subs ); |
227 aRBuf, R_BT_SSP_PASSKEY_COMPARISON_PROMPT, namePtr, 0 ); |
227 CleanupStack::PushL( prompt ); |
228 // Numeric comparison key shall not be localized either, use our own |
228 FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::GenerateQueryPromoptLC() <<")); |
229 // string loading: |
229 return prompt; |
230 BluetoothUiUtil::AddSubstringL( aRBuf, iPasskeyToShow, 1); |
|
231 FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::GenerateQueryPromptL() <<")); |
|
232 |
230 } |
233 } |
231 |
234 |
232 // End of File |
235 // End of File |