1 /* |
1 /* |
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
219 |
219 |
220 //get "default enhancement" string resource |
220 //get "default enhancement" string resource |
221 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Read default enhancement string" ); |
221 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Read default enhancement string" ); |
222 defaultText = iCoeEnv->AllocReadResourceLC( R_TEXT_DEFAULT_ENHANC ); |
222 defaultText = iCoeEnv->AllocReadResourceLC( R_TEXT_DEFAULT_ENHANC ); |
223 |
223 |
224 TPtrC enhancement; |
224 HBufC* enhancement=NULL; |
225 TBool enhancementOk( ETrue ); |
225 TBool enhancementOk( ETrue ); |
226 |
226 |
227 if ( value != 0 ) |
227 if ( value != 0 ) |
228 { |
228 { |
229 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Default selection" ); |
229 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Default selection" ); |
230 |
230 |
231 enhancementOk = EFalse; |
231 enhancementOk = EFalse; |
232 HBufC8* literals = iCoeEnv->AllocReadResourceAsDes8L( R_SELECTION_DIALOG_LITERALS ); |
232 HBufC8* literals = iCoeEnv->AllocReadResourceAsDes8L( R_SELECTION_DIALOG_LITERALS ); |
|
233 CleanupStack::PushL(literals); |
233 TResourceReader reader; |
234 TResourceReader reader; |
234 reader.SetBuffer( literals ); |
235 reader.SetBuffer( literals ); |
235 |
236 |
236 TInt count( reader.ReadInt16() ); |
237 TInt count( reader.ReadInt16() ); |
237 API_TRACE_1( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Read literals, count %d", count ); |
238 API_TRACE_1( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Read literals, count %d", count ); |
245 |
246 |
246 if ( index == value ) |
247 if ( index == value ) |
247 { |
248 { |
248 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Literal found!" ); |
249 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Literal found!" ); |
249 // Literal found |
250 // Literal found |
250 enhancement.Set( reader.ReadTPtrC() ); |
251 enhancement=reader.ReadTPtrC().AllocL(); |
251 enhancementOk = ETrue; |
252 enhancementOk = ETrue; |
252 break; |
253 break; |
253 } |
254 } |
254 else |
255 else |
255 { |
256 { |
256 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Not found!" ); |
257 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Not found!" ); |
257 reader.ReadTPtrC(); |
258 reader.ReadTPtrC(); |
258 } |
259 } |
259 } |
260 } |
260 |
261 |
261 delete literals; |
262 CleanupStack::PopAndDestroy(literals); |
|
263 CleanupStack::PushL(enhancement); |
262 } |
264 } |
263 |
265 |
264 if ( enhancementOk ) |
266 if ( enhancementOk ) |
265 { |
267 { |
266 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Enhancement OK!" ); |
268 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Enhancement OK!" ); |
273 |
275 |
274 // Default enhancement string if needed |
276 // Default enhancement string if needed |
275 if ( value != 0 ) |
277 if ( value != 0 ) |
276 { |
278 { |
277 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Show also default information!" ); |
279 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Show also default information!" ); |
278 noteStr = HBufC::NewL( defaultText->Length() + enhancement.Length() + 3 ); |
280 noteStr = HBufC::NewL( defaultText->Length() + enhancement->Length() + 3 ); |
279 |
281 |
280 TPtr ptr( noteStr->Des() ); |
282 TPtr ptr( noteStr->Des() ); |
281 ptr.Append( defaultText->Des() ); |
283 ptr.Append( defaultText->Des() ); |
282 ptr.Append( ' ' ); |
284 ptr.Append( ' ' ); |
283 ptr.Append( enhancement ); |
285 ptr.Append( *enhancement ); |
284 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Default string ready!" ); |
286 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Default string ready!" ); |
285 } |
287 } |
286 |
288 |
287 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Read use phone mic string!" ); |
289 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Read use phone mic string!" ); |
288 // Read resource use phone mic and default enhancement text... |
290 // Read resource use phone mic and default enhancement text... |
323 } |
325 } |
324 else |
326 else |
325 { |
327 { |
326 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Create default accessory text!" ); |
328 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Create default accessory text!" ); |
327 //only default accessory text |
329 //only default accessory text |
328 noteStr = HBufC::NewL( defaultText->Length() + enhancement.Length() + 1 ); |
330 noteStr = HBufC::NewL( defaultText->Length() + enhancement->Length() + 1 ); |
329 TPtr ptr( noteStr->Des() ); |
331 TPtr ptr( noteStr->Des() ); |
330 |
332 |
331 ptr.Append( defaultText->Des() ); |
333 ptr.Append( defaultText->Des() ); |
332 ptr.Append( ' ' ); |
334 ptr.Append( ' ' ); |
333 ptr.Append( enhancement ); |
335 ptr.Append( *enhancement ); |
334 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Default accessory text ready!" ); |
336 API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - Default accessory text ready!" ); |
335 } |
337 } |
336 |
338 |
|
339 CleanupStack::PopAndDestroy(enhancement); |
337 // Pass string to member string and free local copies |
340 // Pass string to member string and free local copies |
338 CleanupStack::PopAndDestroy( defaultText ); |
341 CleanupStack::PopAndDestroy( defaultText ); |
339 CleanupStack::PushL( noteStr ); |
342 CleanupStack::PushL( noteStr ); |
340 iNoteText = HBufC::NewL( noteStr->Length() ); |
343 iNoteText = HBufC::NewL( noteStr->Length() ); |
341 TPtr ptr( iNoteText->Des() ); |
344 TPtr ptr( iNoteText->Des() ); |