21 #include <StringLoader.h> // Localisation stringloader |
21 #include <StringLoader.h> // Localisation stringloader |
22 #include <SecondaryDisplay/BTnotifSecondaryDisplayAPI.h> |
22 #include <SecondaryDisplay/BTnotifSecondaryDisplayAPI.h> |
23 #include <e32cmn.h> |
23 #include <e32cmn.h> |
24 #include <BTNotif.rsg> // Own resources |
24 #include <BTNotif.rsg> // Own resources |
25 #include <btengsettings.h> |
25 #include <btengsettings.h> |
|
26 #include <bluetoothuiutil.h> |
26 #include "BTNGenericQueryNotifier.h" // Own class definition |
27 #include "BTNGenericQueryNotifier.h" // Own class definition |
27 #include "btNotifDebug.h" // Debugging macros |
28 #include "btNotifDebug.h" // Debugging macros |
28 |
29 |
29 #ifdef __SERIES60_HELP |
30 #ifdef __SERIES60_HELP |
30 #include <hlplch.h> |
31 #include <hlplch.h> |
63 // |
64 // |
64 CBTGenericQueryNotifier::~CBTGenericQueryNotifier() |
65 CBTGenericQueryNotifier::~CBTGenericQueryNotifier() |
65 { |
66 { |
66 Cancel(); // Free own resources |
67 Cancel(); // Free own resources |
67 delete iName; |
68 delete iName; |
68 delete iQueryMessage; |
69 iQueryMessage.Close(); |
69 delete iQueryHeader; |
70 delete iQueryHeader; |
70 } |
71 } |
71 |
72 |
72 // ---------------------------------------------------------- |
73 // ---------------------------------------------------------- |
73 // CBTGenericQueryNotifier::RegisterL |
74 // CBTGenericQueryNotifier::RegisterL |
224 FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier:: Unkown messageType! ")); |
225 FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier:: Unkown messageType! ")); |
225 User::Leave(KErrNotFound); |
226 User::Leave(KErrNotFound); |
226 } |
227 } |
227 |
228 |
228 // if the logic string contains substitute indicator "%U", replace it with device name: |
229 // if the logic string contains substitute indicator "%U", replace it with device name: |
229 // |
230 // |
230 iQueryMessage = StringLoader::LoadL( iMessageResourceId); |
231 HBufC* buf = StringLoader::LoadL( iMessageResourceId); |
231 _LIT(PU,"%U"); |
232 iQueryMessage.Assign( buf ); |
232 if( iQueryMessage->Find(PU) != KErrNotFound) |
233 |
|
234 TInt keyLen; |
|
235 TInt pos = BluetoothUiUtil::GetStringSubstringKeyPos( |
|
236 iQueryMessage, 0, keyLen ); |
|
237 if( pos > KErrNotFound) |
233 { |
238 { |
234 delete iQueryMessage; |
|
235 iQueryMessage=NULL; |
|
236 |
|
237 //if no device name provided, default name will be used: |
239 //if no device name provided, default name will be used: |
238 if( !bPckg().iNameExists ) |
240 if( !bPckg().iNameExists ) |
239 iName=StringLoader::LoadL(R_BT_DIALOG_DEF_NAME); |
241 iName=StringLoader::LoadL(R_BT_DIALOG_DEF_NAME); |
240 else |
242 else |
241 { |
243 { |
242 iName=HBufC::NewL(bPckg().iName.Length() ); |
244 iName=HBufC::NewL(bPckg().iName.Length() ); |
243 iName->Des().Copy(bPckg().iName); |
245 iName->Des().Copy(bPckg().iName); |
244 } |
246 } |
245 iQueryMessage = StringLoader::LoadL( iMessageResourceId,*iName); |
247 BluetoothUiUtil::LoadResourceAndSubstringL( |
|
248 iQueryMessage, iMessageResourceId, *iName, 0); |
246 } |
249 } |
247 else |
250 else |
248 { |
251 { |
249 iName=NULL; |
252 iName=NULL; |
250 } |
253 } |
256 // ---------------------------------------------------------- |
259 // ---------------------------------------------------------- |
257 // |
260 // |
258 TPtrC8 CBTGenericQueryNotifier::UpdateL(const TDesC8& aBuffer) |
261 TPtrC8 CBTGenericQueryNotifier::UpdateL(const TDesC8& aBuffer) |
259 { |
262 { |
260 FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::UpdateL")); |
263 FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::UpdateL")); |
261 delete iQueryMessage; |
|
262 iQueryMessage = NULL; |
|
263 ProcessParamBufferL(aBuffer); |
264 ProcessParamBufferL(aBuffer); |
264 if( !iNotifUiUtil->IsQueryReleased() ) |
265 if( !iNotifUiUtil->IsQueryReleased() ) |
265 { |
266 { |
266 if(iIsMessageQuery ) |
267 if(iIsMessageQuery ) |
267 { |
268 { |
268 iNotifUiUtil->UpdateMessageQueryDlgL(*iQueryMessage); |
269 iNotifUiUtil->UpdateMessageQueryDlgL(iQueryMessage); |
269 } |
270 } |
270 else |
271 else |
271 { |
272 { |
272 iNotifUiUtil->UpdateQueryDlgL(*iQueryMessage); |
273 iNotifUiUtil->UpdateQueryDlgL(iQueryMessage); |
273 } |
274 } |
274 } |
275 } |
275 FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::UpdateL complete")); |
276 FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::UpdateL complete")); |
276 |
277 |
277 TPtrC8 ret(KNullDesC8); |
278 TPtrC8 ret(KNullDesC8); |
323 name.Copy( *iName ); |
324 name.Copy( *iName ); |
324 } |
325 } |
325 if( iIsMessageQuery ) |
326 if( iIsMessageQuery ) |
326 { |
327 { |
327 |
328 |
328 keypress = iNotifUiUtil->ShowMessageQueryL(*iQueryMessage, *iQueryHeader, |
329 keypress = iNotifUiUtil->ShowMessageQueryL(iQueryMessage, *iQueryHeader, |
329 R_BT_GENERIC_MESSAGE_QUERY, CAknQueryDialog::EConfirmationTone ); |
330 R_BT_GENERIC_MESSAGE_QUERY, CAknQueryDialog::EConfirmationTone ); |
330 } |
331 } |
331 else |
332 else |
332 { |
333 { |
333 keypress = iNotifUiUtil->ShowQueryL( *iQueryMessage, R_BT_GENERIC_QUERY, |
334 keypress = iNotifUiUtil->ShowQueryL( iQueryMessage, R_BT_GENERIC_QUERY, |
334 iSecondaryDisplayCommand, name, CAknQueryDialog::EConfirmationTone ); |
335 iSecondaryDisplayCommand, name, CAknQueryDialog::EConfirmationTone ); |
335 } |
336 } |
336 |
337 |
337 CompleteMessage( (keypress) ? ETrue: EFalse, KErrNone ); |
338 CompleteMessage( (keypress) ? ETrue: EFalse, KErrNone ); |
338 |
339 |