|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Details dialog for last message. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <bldvariant.hrh> |
|
22 #include "VmDetailsDialog.h" |
|
23 #include "VoiceMailboxAppPrivateCRKeys.h" |
|
24 #include "VmDetDlgPropertyObserver.h" |
|
25 #include <centralrepository.h> |
|
26 #include "Vm.hrh" |
|
27 #include <Vm.rsg> |
|
28 #include <AknLists.h> |
|
29 #include <AknTitle.h> |
|
30 #include <NumberGrouping.h> |
|
31 #include <NumberGroupingCRKeys.h> |
|
32 #include <StringLoader.h> |
|
33 #include "VMBLogger.h" |
|
34 |
|
35 // CONSTANTS |
|
36 const TInt KVmMaxLabelStringLength = 100; |
|
37 const TInt KVmMaxLabelFreeTextLength = 255; |
|
38 const TUint KVmDateSeparator = '/'; |
|
39 const TUint KVmTimeSeparator = ':'; |
|
40 |
|
41 |
|
42 // ============================ MEMBER FUNCTIONS =============================== |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CVmDetailsDialog::CVmDetailsDialog |
|
46 // C++ default constructor can NOT contain any code, that |
|
47 // might leave. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CVmDetailsDialog::CVmDetailsDialog() |
|
51 { |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CVmDetailsDialog::ConstructL |
|
56 // Symbian 2nd phase constructor can leave. |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 void CVmDetailsDialog::ConstructL() |
|
60 { |
|
61 VMBLOGSTRING( "VMBX: CVmDetailsDialog::ConstructL =>" ); |
|
62 CAknDialog::ConstructL( R_VMBX_DETAIL_MENUBAR ); |
|
63 |
|
64 // Central Repository handle |
|
65 iSession = CRepository::NewL( KCRUidVoiceMailbox ); |
|
66 iObserver = CVmDetDlgPropertyObserver::NewL( *this ); |
|
67 StartObservingL(); |
|
68 |
|
69 TInt pngErr( KErrNone ); |
|
70 TInt pngSupported( 0 ); |
|
71 CRepository* repository = CRepository::NewL( KCRUidNumberGrouping ); |
|
72 pngErr = repository->Get( KNumberGrouping, pngSupported ); |
|
73 delete repository; |
|
74 |
|
75 // create number grouping component if is supported. |
|
76 if ( KErrNone == pngErr && pngSupported != 0 ) |
|
77 { |
|
78 iNumberGrouping = CPNGNumberGrouping::NewL( KVmMaxLabelStringLength ); |
|
79 } |
|
80 VMBLOGSTRING( "VMBX: CVmDetailsDialog::ConstructL <=" ); |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CVmDetailsDialog::NewL |
|
85 // Two-phased constructor. |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 CVmDetailsDialog* CVmDetailsDialog::NewL() |
|
89 { |
|
90 VMBLOGSTRING( "VMBX: CVmDetailsDialog::NewL =>" ); |
|
91 CVmDetailsDialog* self = new( ELeave ) CVmDetailsDialog; |
|
92 |
|
93 CleanupStack::PushL( self ); |
|
94 self->ConstructL(); |
|
95 CleanupStack::Pop( self ); |
|
96 VMBLOGSTRING( "VMBX: CVmDetailsDialog::NewL <=" ); |
|
97 return self; |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CVmDetailsDialog::~CVmDetailsDialog |
|
102 // Destructor |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 CVmDetailsDialog::~CVmDetailsDialog() |
|
106 { |
|
107 VMBLOGSTRING( "VMBX: CVmDetailsDialog::~CVmDetailsDialog =>" ); |
|
108 delete iOldTitlePaneText; |
|
109 iOldTitlePaneText = NULL; |
|
110 |
|
111 delete iObserver; |
|
112 delete iSession; |
|
113 delete iNumberGrouping; |
|
114 |
|
115 VMBLOGSTRING( "VMBX: CVmDetailsDialog::~CVmDetailsDialog <=" ); |
|
116 } |
|
117 |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CVmDetailsDialog::PreLayoutDynInitL |
|
121 // Called before the dialog is launched. Title pane is updated and listbox |
|
122 // is filled with a last message information. |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 void CVmDetailsDialog::PreLayoutDynInitL() |
|
126 { |
|
127 // Take old title pane to variable. |
|
128 CAknTitlePane* titlePane = |
|
129 static_cast< CAknTitlePane* > |
|
130 ( iEikonEnv->AppUiFactory()->StatusPane()->ControlL( |
|
131 TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
132 iOldTitlePaneText = titlePane->Text()->AllocL(); |
|
133 |
|
134 // Set new title |
|
135 HBufC* titleText = StringLoader::LoadL( R_TITLE_DETAILS ); |
|
136 titlePane->SetText( titleText ); //takes ownership |
|
137 titleText = NULL; |
|
138 |
|
139 |
|
140 // Get listbox pointer |
|
141 CAknSingleHeadingStyleListBox* listbox = |
|
142 static_cast<CAknSingleHeadingStyleListBox*> |
|
143 ( Control( KVmDetailsDialog ) ); |
|
144 |
|
145 listbox->CreateScrollBarFrameL( ETrue ); |
|
146 listbox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
147 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
148 |
|
149 // populate array |
|
150 MDesCArray* itemList = listbox->Model()->ItemTextArray(); |
|
151 CDesCArray* itemArray = static_cast<CDesCArray*>( itemList ); |
|
152 PopulateListboxItemsL( *itemArray ); |
|
153 } |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // CVmDetailsDialog::PopulateListboxItemsL |
|
157 // Reads message details from shared data. |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 void CVmDetailsDialog::PopulateListboxItemsL( CDesCArray& aItemArray ) |
|
161 { |
|
162 VMBLOGSTRING( "VMBX: CVmDetailsDialog::PopulateListboxItemsL =>" ); |
|
163 // To calculate the rect for the text box. |
|
164 CAknSingleHeadingStyleListBox* listbox = |
|
165 static_cast<CAknSingleHeadingStyleListBox*> |
|
166 ( Control(KVmDetailsDialog) ); |
|
167 CListBoxView* view = listbox->View(); |
|
168 TRect itemTextRect (TPoint( view->ItemPos(0) ), TSize(view->ItemSize() ) ); |
|
169 aItemArray.Reset(); |
|
170 |
|
171 // Used variables |
|
172 HBufC* heading = NULL; |
|
173 HBufC* data = NULL; |
|
174 TInt error = KErrNone; |
|
175 |
|
176 |
|
177 // Urgency |
|
178 heading = StringLoader::LoadLC( R_URGENCY ); |
|
179 |
|
180 TInt urgency; |
|
181 error = iSession->Get( KVmUrgencyLevel, urgency ); |
|
182 if ( error == KErrNone ) |
|
183 { |
|
184 switch ( urgency ) |
|
185 { |
|
186 case 0: // Normal |
|
187 case 1: // Interactive |
|
188 { |
|
189 data = StringLoader::LoadLC( R_NORMAL ); |
|
190 break; |
|
191 } |
|
192 case 2: // Urgent |
|
193 { |
|
194 data = StringLoader::LoadLC( R_URGENT ); |
|
195 break; |
|
196 } |
|
197 case 3: // Emergency |
|
198 { |
|
199 data = StringLoader::LoadLC( R_EMERGENCY ); |
|
200 break; |
|
201 } |
|
202 default: |
|
203 { |
|
204 User::Leave( KErrNotSupported ); |
|
205 break; |
|
206 } |
|
207 } |
|
208 } |
|
209 else |
|
210 { |
|
211 data = KNullDesC().AllocLC(); |
|
212 } |
|
213 |
|
214 AppendLineL( aItemArray, heading->Des(), data->Des(), itemTextRect ); |
|
215 CleanupStack::PopAndDestroy( data ); |
|
216 CleanupStack::PopAndDestroy( heading ); |
|
217 |
|
218 |
|
219 // Date |
|
220 heading = StringLoader::LoadLC( R_DATE ); |
|
221 |
|
222 data = HBufC::NewLC( KVmMaxLabelStringLength ); |
|
223 TPtr datePtr = data->Des(); |
|
224 if ( iSession->Get( KVmDateStamp, datePtr ) == KErrNone ) |
|
225 { |
|
226 FormatDateStringL( datePtr ); |
|
227 } |
|
228 |
|
229 AppendLineL( aItemArray, heading->Des(), data->Des(), itemTextRect ); |
|
230 CleanupStack::PopAndDestroy( data ); |
|
231 CleanupStack::PopAndDestroy( heading ); |
|
232 |
|
233 // Time |
|
234 heading = StringLoader::LoadLC( R_TIME ); |
|
235 |
|
236 data = HBufC::NewLC( KVmMaxLabelStringLength ); |
|
237 TPtr timePtr = data->Des(); |
|
238 if ( iSession->Get( KVmTimeStamp, timePtr ) == KErrNone ) |
|
239 { |
|
240 FormatTimeStringL( timePtr ); |
|
241 } |
|
242 |
|
243 AppendLineL( aItemArray, heading->Des(), data->Des(), itemTextRect ); |
|
244 CleanupStack::PopAndDestroy( data ); |
|
245 CleanupStack::PopAndDestroy( heading ); |
|
246 |
|
247 // Callback number |
|
248 heading = StringLoader::LoadLC( R_CALL_BACK ); |
|
249 |
|
250 data = HBufC::NewLC( KVmMaxLabelStringLength ); |
|
251 TPtr callbackPtr = data->Des(); |
|
252 iSession->Get( KVmCallbackNumber, callbackPtr ); // ignore error |
|
253 |
|
254 if ( iNumberGrouping ) |
|
255 { |
|
256 iNumberGrouping->Set( callbackPtr ); |
|
257 CleanupStack::PopAndDestroy( data ); |
|
258 data = iNumberGrouping->FormattedNumber().AllocLC(); |
|
259 } |
|
260 |
|
261 AppendLineL( aItemArray, heading->Des(), data->Des(), itemTextRect, ETrue ); |
|
262 CleanupStack::PopAndDestroy( data ); |
|
263 CleanupStack::PopAndDestroy( heading ); |
|
264 |
|
265 // Text |
|
266 heading = StringLoader::LoadLC( R_TEXT ); |
|
267 |
|
268 data = HBufC::NewLC( KVmMaxLabelFreeTextLength ); |
|
269 TPtr textPtr = data->Des(); |
|
270 iSession->Get( KVmUserData, textPtr ); // ignore error |
|
271 |
|
272 AppendLineL( aItemArray, heading->Des(), data->Des(), itemTextRect, ETrue ); |
|
273 CleanupStack::PopAndDestroy( data ); |
|
274 CleanupStack::PopAndDestroy( heading ); |
|
275 VMBLOGSTRING( "VMBX: CVmDetailsDialog::PopulateListboxItemsL <=" ); |
|
276 } |
|
277 |
|
278 // ----------------------------------------------------------------------------- |
|
279 // CVmDetailsDialog::FormatDateStringL |
|
280 // Formats date string |
|
281 // ----------------------------------------------------------------------------- |
|
282 // |
|
283 void CVmDetailsDialog::FormatDateStringL( TDes& aDateString ) |
|
284 { |
|
285 VMBLOGSTRING( "VMBX: CVmDetailsDialog::FormatDateStringL =>" ); |
|
286 if ( !aDateString.Length() ) |
|
287 { |
|
288 return; |
|
289 } |
|
290 |
|
291 // Check that we have two separators '/' |
|
292 TInt indexFirst = aDateString.Locate( KVmDateSeparator ); |
|
293 TInt indexSecond = aDateString.LocateReverse( KVmDateSeparator ); |
|
294 if ( indexFirst == indexSecond ) // Also -1 is covered |
|
295 { |
|
296 // Incorrect date format |
|
297 User::Leave( KErrCorrupt ); |
|
298 } |
|
299 |
|
300 TLex lex = aDateString.Right( aDateString.Length() - indexSecond - 1 ); |
|
301 TInt year; |
|
302 User::LeaveIfError( lex.Val( year ) ); |
|
303 |
|
304 lex = aDateString.Mid( indexFirst + 1, indexSecond - indexFirst ); |
|
305 TInt month; |
|
306 User::LeaveIfError( lex.Val( month ) ); |
|
307 |
|
308 lex = aDateString.Left( indexFirst ); |
|
309 TInt day; |
|
310 User::LeaveIfError( lex.Val( day ) ); |
|
311 |
|
312 // Format date according the locale: |
|
313 TDateTime dateTime( year, TMonth( month - 1 ), day, 0, 0, 0, 0 ); |
|
314 TTime time( dateTime ); |
|
315 HBufC* dateFormat = StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO ); |
|
316 time.FormatL( aDateString, *dateFormat ); |
|
317 CleanupStack::PopAndDestroy( dateFormat ); //dateFormatString |
|
318 VMBLOGSTRING( "VMBX: CVmDetailsDialog::FormatDateStringL <=" ); |
|
319 } |
|
320 |
|
321 // ----------------------------------------------------------------------------- |
|
322 // CVmDetailsDialog::FormatTimeStringL |
|
323 // Formats time string |
|
324 // ----------------------------------------------------------------------------- |
|
325 // |
|
326 void CVmDetailsDialog::FormatTimeStringL( TDes& aTimeString ) |
|
327 { |
|
328 VMBLOGSTRING( "VMBX: CVmDetailsDialog::FormatTimeStringL =>" ); |
|
329 if ( !aTimeString.Length() ) |
|
330 { |
|
331 VMBLOGSTRING( "VMBX: CVmDetailsDialog::FormatTimeStringL: \ |
|
332 Empty time " ); |
|
333 return; |
|
334 } |
|
335 |
|
336 // Check that we have two separators ':' |
|
337 TInt indexFirst = aTimeString.Locate( KVmTimeSeparator ); |
|
338 TInt indexSecond = aTimeString.LocateReverse( KVmTimeSeparator ); |
|
339 if ( indexFirst == indexSecond ) // Also -1 is covered |
|
340 { |
|
341 VMBLOGSTRING( "VMBX: CVmDetailsDialog::FormatTimeStringL \ |
|
342 Incorrect date format" ); |
|
343 // Incorrect date format |
|
344 User::Leave( KErrCorrupt ); |
|
345 } |
|
346 |
|
347 TLex lex( aTimeString.Left( indexFirst ) ); |
|
348 TInt hour; |
|
349 User::LeaveIfError( lex.Val( hour ) ); |
|
350 |
|
351 lex = aTimeString.Mid( indexFirst + 1, indexSecond - indexFirst ); |
|
352 TInt minute; |
|
353 User::LeaveIfError( lex.Val( minute ) ); |
|
354 |
|
355 lex = aTimeString.Right( aTimeString.Length() - indexSecond - 1 ); |
|
356 TInt second; |
|
357 User::LeaveIfError( lex.Val( second ) ); |
|
358 |
|
359 // Format time according the locale: |
|
360 TDateTime dateTime( 0, TMonth(0), 0, hour, minute, second, 0 ); |
|
361 TTime time( dateTime ); |
|
362 HBufC* timeFormat = StringLoader::LoadLC( R_QTN_TIME_USUAL_WITH_ZERO ); |
|
363 time.FormatL( aTimeString, *timeFormat ); |
|
364 CleanupStack::PopAndDestroy( timeFormat ); //dateFormatString |
|
365 VMBLOGSTRING( "VMBX: CVmDetailsDialog::FormatTimeStringL <=" ); |
|
366 } |
|
367 |
|
368 // ----------------------------------------------------------------------------- |
|
369 // CVmDetailsDialog::AppendLineL |
|
370 // Adds line to the listbox. |
|
371 // ----------------------------------------------------------------------------- |
|
372 // |
|
373 void CVmDetailsDialog::AppendLineL( CDesCArray& aItemArray, |
|
374 const TDesC& aHeading, |
|
375 const TDesC& aData, |
|
376 TRect aItemTextRect, |
|
377 TBool aUseMultipleLines ) |
|
378 { |
|
379 VMBLOGSTRING( "VMBX: CVmDetailsDialog::AppendLineL =>" ); |
|
380 TBuf<1> tabChar(_L("\t")); |
|
381 HBufC* combination = NULL; |
|
382 |
|
383 if ( aUseMultipleLines ) |
|
384 { |
|
385 CArrayFixFlat<TPtrC>* wrappedTexts = |
|
386 new (ELeave) CArrayFixFlat<TPtrC>( 2 ); |
|
387 CleanupStack::PushL( wrappedTexts ); |
|
388 |
|
389 // Layout used for CAknSingleHeadingStyleListBox |
|
390 // is list_single_heading_pane |
|
391 // Layout text for list_single_heading_pane_2 (first row from No.2) |
|
392 TAknTextLineLayout layout = |
|
393 AKN_LAYOUT_TEXT_List_pane_texts__single_heading__Line_2 (0 ); |
|
394 TAknLayoutText text; |
|
395 text.LayoutText( aItemTextRect, layout ); |
|
396 TRect rect = text.TextRect(); |
|
397 |
|
398 // Wrap the long text to several lines. |
|
399 AknTextUtils::WrapToArrayL( aData, |
|
400 rect.Width() /* layout.iW */, |
|
401 *AknLayoutUtils::FontFromId( layout.FontId() /* iFont */), |
|
402 *wrappedTexts ); |
|
403 |
|
404 if ( wrappedTexts->Count() == 0 ) // i.e. empty text |
|
405 { |
|
406 // For creating the first line |
|
407 wrappedTexts->AppendL( KNullDesC() ); |
|
408 } |
|
409 |
|
410 // Create the first line: |
|
411 combination = HBufC::NewLC( aHeading.Length() + |
|
412 tabChar.Length() + |
|
413 wrappedTexts->At( 0 ).Length() ); |
|
414 |
|
415 TPtr comPtr = combination->Des(); |
|
416 |
|
417 comPtr.Append( aHeading ); |
|
418 comPtr.Append( tabChar ); |
|
419 comPtr.Append( wrappedTexts->At( 0 ) ); |
|
420 |
|
421 aItemArray.AppendL( comPtr ); |
|
422 |
|
423 CleanupStack::PopAndDestroy( combination ); |
|
424 combination = NULL; |
|
425 |
|
426 // Create the other lines |
|
427 for ( TInt i = 1 ; i < wrappedTexts->Count() ; i++ ) |
|
428 { |
|
429 // combination is created without the header. |
|
430 combination = HBufC::NewLC( tabChar.Length() + |
|
431 wrappedTexts->At( i ).Length() ); |
|
432 |
|
433 comPtr.Set( combination->Des() ); |
|
434 |
|
435 comPtr.Append( tabChar ); |
|
436 comPtr.Append( wrappedTexts->At( i ) ); |
|
437 |
|
438 aItemArray.AppendL( comPtr ); |
|
439 |
|
440 CleanupStack::PopAndDestroy( combination ); |
|
441 combination = NULL; |
|
442 } |
|
443 CleanupStack::PopAndDestroy( wrappedTexts ); |
|
444 } |
|
445 else |
|
446 { |
|
447 // Create combination to one line in listbox. |
|
448 combination = HBufC::NewLC( aHeading.Length() + |
|
449 tabChar.Length() + |
|
450 aData.Length() ); |
|
451 |
|
452 TPtr comPtr = combination->Des(); |
|
453 |
|
454 comPtr.Append( aHeading ); |
|
455 comPtr.Append( tabChar ); |
|
456 comPtr.Append( aData ); |
|
457 |
|
458 aItemArray.AppendL( comPtr ); |
|
459 |
|
460 CleanupStack::PopAndDestroy( combination ); |
|
461 } |
|
462 VMBLOGSTRING( "VMBX: CVmDetailsDialog::AppendLineL =>" ); |
|
463 } |
|
464 |
|
465 // ----------------------------------------------------------------------------- |
|
466 // CVmDetailsDialog::OfferKeyEventL |
|
467 // Called when a key is pressed. |
|
468 // ----------------------------------------------------------------------------- |
|
469 // |
|
470 TKeyResponse CVmDetailsDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
471 TEventCode aType ) |
|
472 { |
|
473 // Special case: exiting with escape key |
|
474 if ( aKeyEvent.iCode == EKeyEscape ) |
|
475 { |
|
476 SetOldTitleL(); |
|
477 return CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
478 } |
|
479 |
|
480 TKeyResponse res = EKeyWasNotConsumed; |
|
481 res = Control(KVmDetailsDialog)->OfferKeyEventL( aKeyEvent, aType ); |
|
482 if (res != EKeyWasNotConsumed) |
|
483 { |
|
484 return res; |
|
485 } |
|
486 |
|
487 res = CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
488 return res; |
|
489 } |
|
490 |
|
491 // ----------------------------------------------------------------------------- |
|
492 // CVmDetailsDialog::OkToExitL |
|
493 // Called when softkeys are pressed. |
|
494 // ----------------------------------------------------------------------------- |
|
495 // |
|
496 TBool CVmDetailsDialog::OkToExitL( TInt aButtonId ) |
|
497 { |
|
498 VMBLOGSTRING( "VMBX: CVmDetailsDialog::OkToExitL =>" ); |
|
499 TBool retVal( EFalse ); |
|
500 // Translate the button presses into commands |
|
501 if ( aButtonId == EAknSoftkeyBack ) |
|
502 { |
|
503 // terminate the diallog. |
|
504 SetOldTitleL(); |
|
505 retVal = ETrue; |
|
506 } |
|
507 VMBLOGSTRING( "VMBX: CVmDetailsDialog::OkToExitL <=" ); |
|
508 return retVal; |
|
509 } |
|
510 |
|
511 // ----------------------------------------------------------------------------- |
|
512 // CVmDetailsDialog::SetOldTitleL |
|
513 // Saves the old title text. |
|
514 // ----------------------------------------------------------------------------- |
|
515 // |
|
516 void CVmDetailsDialog::SetOldTitleL() |
|
517 { |
|
518 VMBLOGSTRING( "VMBX: CVmDetailsDialog::SetOldTitleL =>" ); |
|
519 if ( !iOldTitlePaneText ) |
|
520 { |
|
521 VMBLOGSTRING( "VMBX: CVmDetailsDialog::SetOldTitleL: already set" ); |
|
522 return; // already set |
|
523 } |
|
524 |
|
525 CAknTitlePane* titlePane = static_cast<CAknTitlePane*> |
|
526 ( iEikonEnv->AppUiFactory()->StatusPane()->ControlL( |
|
527 TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
528 titlePane->SetText( iOldTitlePaneText ); // takes ownership |
|
529 iOldTitlePaneText = NULL; |
|
530 VMBLOGSTRING( "VMBX: CVmDetailsDialog::SetOldTitleL =>" ); |
|
531 } |
|
532 |
|
533 // ----------------------------------------------------------------------------- |
|
534 // CVmDetailsDialog::HandlePropertyNotificationEventL |
|
535 // Called when key value is set. |
|
536 // ----------------------------------------------------------------------------- |
|
537 // |
|
538 void CVmDetailsDialog::HandlePropertyNotificationEventL( const TDesC& aValue ) |
|
539 { |
|
540 VMBLOGSTRING( "VMBX: CVmDetailsDialog::HandlePropertyNotificationEventL \ |
|
541 =>" ); |
|
542 StartObservingL(); |
|
543 TLex lexer( aValue ); |
|
544 TInt value = KErrNotFound; |
|
545 User::LeaveIfError( lexer.Val( value ) ); |
|
546 if ( value == 0 ) // message is not set |
|
547 { |
|
548 // Exit the details dialog |
|
549 TryExitL( EAknSoftkeyBack ); |
|
550 } |
|
551 else // new message set |
|
552 { |
|
553 // Update listbox context: |
|
554 CAknSingleHeadingStyleListBox* listbox = |
|
555 static_cast<CAknSingleHeadingStyleListBox*>( |
|
556 Control( KVmDetailsDialog ) ); |
|
557 MDesCArray* itemList = listbox->Model()->ItemTextArray(); |
|
558 CDesCArray* itemArray = static_cast<CDesCArray*>( itemList ); |
|
559 PopulateListboxItemsL( *itemArray ); |
|
560 listbox->HandleItemAdditionL(); |
|
561 } |
|
562 VMBLOGSTRING( "VMBX: CVmDetailsDialog::HandlePropertyNotificationEventL \ |
|
563 <=" ); |
|
564 } |
|
565 // ----------------------------------------------------------------------------- |
|
566 // CVmDetailsDialog::StartObservingL |
|
567 // Starts observing for key value changes. |
|
568 // ----------------------------------------------------------------------------- |
|
569 // |
|
570 void CVmDetailsDialog::StartObservingL() |
|
571 { |
|
572 VMBLOGSTRING( "VMBX: CVmDetailsDialog::StartObservingL =>" ); |
|
573 iObserver->ObservePropertyChangeL( KCRUidVoiceMailbox, KVmSummaryInfoIsSet ); |
|
574 VMBLOGSTRING( "VMBX: CVmDetailsDialog::StartObservingL <=" ); |
|
575 } |
|
576 |
|
577 // End of File |