|
1 /* |
|
2 * Copyright (c) 2008 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: This is the source file for the CClockCitySelectionListImpl class. |
|
15 * |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 #include <aknlists.h> |
|
20 #include <akntitle.h> |
|
21 #include <eikclbd.h> |
|
22 #include <clock.rsg> |
|
23 #include <aknsfld.h> |
|
24 #include <eikcapc.h> |
|
25 #include <bautils.h> |
|
26 #include <hlplch.h> |
|
27 #include <featmgr.h> |
|
28 #include <AknUtils.h> |
|
29 #include <eikmenup.h> |
|
30 #include <StringLoader.h> |
|
31 #include <data_caging_path_literals.hrh> |
|
32 #include <tzlocalizationdatatypes.h> |
|
33 #include <tzlocalizer.h> |
|
34 #include <tz.h> |
|
35 #include <csxhelp/clk.hlp.hrh> |
|
36 #include <ConeResLoader.h> |
|
37 |
|
38 // User includes |
|
39 #include "clockcityselectionlistimpl.h" |
|
40 #include "clockcityselectionlistpopup.h" |
|
41 #include "clockcityselectionlist.hrh" |
|
42 #include "clockworldview.h" |
|
43 #include "clock_debug.h" |
|
44 #include "clkcommon.h" |
|
45 |
|
46 // Constants |
|
47 const TInt KMaxDataLength( 120 ); |
|
48 const TInt KArrayGranularity( 24 ); |
|
49 const TInt KSingleCity( 1 ); |
|
50 |
|
51 // Literals |
|
52 _LIT( KResourceFile, "\\resource\\apps\\clock.rsc" ); |
|
53 _LIT( KEmpty, " " ); |
|
54 _LIT( KFieldSeparator, "\t" ); |
|
55 |
|
56 // --------------------------------------------------------- |
|
57 // CClockCitySelectionListImpl::CClockCitySelectionListImpl |
|
58 // rest of the details are commented in the header |
|
59 // --------------------------------------------------------- |
|
60 // |
|
61 CClockCitySelectionListImpl::CClockCitySelectionListImpl() : CAknSelectionListDialog( iSelectionIndex, NULL, NULL ) |
|
62 { |
|
63 __PRINTS( "CClockCitySelectionListImpl::CClockCitySelectionListImpl - Entry" ); |
|
64 |
|
65 iCityDialogOffset = 0; |
|
66 iCitySelected = EFalse; |
|
67 |
|
68 __PRINTS( "CClockCitySelectionListImpl::CClockCitySelectionListImpl - Exit" ); |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------- |
|
72 // CClockCitySelectionListImpl::~CClockCitySelectionListImpl |
|
73 // rest of the details are commented in the header |
|
74 // --------------------------------------------------------- |
|
75 // |
|
76 CClockCitySelectionListImpl::~CClockCitySelectionListImpl() |
|
77 { |
|
78 __PRINTS( "CClockCitySelectionListImpl::~CClockCitySelectionListImpl - Entry" ); |
|
79 |
|
80 iCoeEnv->DeleteResourceFile( iCityDialogOffset ); |
|
81 |
|
82 __PRINTS( "CClockCitySelectionListImpl::~CClockCitySelectionListImpl - Exit" ); |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------- |
|
86 // CClockCitySelectionListImpl::ConstructL |
|
87 // rest of the details are commented in the header |
|
88 // --------------------------------------------------------- |
|
89 // |
|
90 void CClockCitySelectionListImpl::ConstructL( TCityInfo* aCityInfo ) |
|
91 { |
|
92 __PRINTS( "CClockCitySelectionListImpl::ConstructL - Entry" ); |
|
93 |
|
94 TFileName fileName( KResourceFile ); |
|
95 BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); |
|
96 TRAP_IGNORE( iCityDialogOffset = iCoeEnv->AddResourceFileL( fileName ) ); |
|
97 |
|
98 CAknSelectionListDialog::ConstructL( R_CLOCK_CITY_SELECTION_LIST_MENUBAR ); |
|
99 |
|
100 iCityArray = new ( ELeave ) CDesCArrayFlat( KArrayGranularity ); |
|
101 |
|
102 CTzLocalizer* cTzLocalizer = CTzLocalizer::NewL(); |
|
103 CleanupStack::PushL( cTzLocalizer ); |
|
104 |
|
105 CTzLocalizedCityGroupArray* cityGroupArray( cTzLocalizer->GetAllCityGroupsL( CTzLocalizer::ETzAlphaNameAscending ) ); |
|
106 CleanupStack::PushL( cityGroupArray ); |
|
107 |
|
108 for( TInt index( KErrNone ); index < cityGroupArray->Count(); index++ ) |
|
109 { |
|
110 CTzLocalizedCityGroup& cityGroup( cityGroupArray->At( index ) ); |
|
111 if( KErrNone != cityGroup.Name().Compare( KEmpty ) ) |
|
112 { |
|
113 TBuf< KMaxDataLength > countryName; |
|
114 countryName.Append( KFieldSeparator ); |
|
115 countryName.Append( cityGroup.Name() ); |
|
116 countryName.Append( KFieldSeparator ); |
|
117 iCityArray->AppendL( countryName ); |
|
118 } |
|
119 } |
|
120 iCityInfo = aCityInfo; |
|
121 |
|
122 // Cleanup |
|
123 CleanupStack::PopAndDestroy( cityGroupArray ); |
|
124 CleanupStack::PopAndDestroy( cTzLocalizer ); |
|
125 |
|
126 __PRINTS( "CClockCitySelectionListImpl::ConstructL - Exit" ); |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------- |
|
130 // CClockCitySelectionListImpl::DynInitMenuPaneL |
|
131 // rest of the details are commented in the header |
|
132 // --------------------------------------------------------- |
|
133 // |
|
134 void CClockCitySelectionListImpl::DynInitMenuPaneL( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ ) |
|
135 { |
|
136 __PRINTS( "CClockCitySelectionListImpl::DynInitMenuPaneL - Entry" ); |
|
137 |
|
138 // No implementation yet. |
|
139 |
|
140 __PRINTS( "CClockCitySelectionListImpl::DynInitMenuPaneL - Exit" ); |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------- |
|
144 // CClockCitySelectionListImpl::HandleResourceChange |
|
145 // rest of the details are commented in the header |
|
146 // --------------------------------------------------------- |
|
147 // |
|
148 void CClockCitySelectionListImpl::HandleResourceChange( TInt aType ) |
|
149 { |
|
150 __PRINTS( "CClockCitySelectionListImpl::HandleResourceChange - Entry" ); |
|
151 |
|
152 if( KEikDynamicLayoutVariantSwitch == aType ) |
|
153 { |
|
154 CAknSearchField* findPane( FindBox() ); |
|
155 if( findPane ) |
|
156 { |
|
157 TBool isVisible( findPane->IsVisible() ); |
|
158 CAknSelectionListDialog::HandleResourceChange( aType ); |
|
159 findPane->MakeVisible( isVisible ); |
|
160 } |
|
161 } |
|
162 else |
|
163 { |
|
164 CAknSelectionListDialog::HandleResourceChange( aType ); |
|
165 } |
|
166 |
|
167 __PRINTS( "CClockCitySelectionListImpl::HandleResourceChange - Exit" ); |
|
168 } |
|
169 |
|
170 // --------------------------------------------------------- |
|
171 // CClockCitySelectionListImpl::ExecuteLD |
|
172 // rest of the details are commented in the header |
|
173 // --------------------------------------------------------- |
|
174 // |
|
175 TInt CClockCitySelectionListImpl::ExecuteLD() |
|
176 { |
|
177 __PRINTS( "CClockCitySelectionListImpl::ExecuteLD - Entry" ); |
|
178 |
|
179 __PRINTS( "CClockCitySelectionListImpl::ExecuteLD - Exit" ); |
|
180 |
|
181 return CAknSelectionListDialog::ExecuteLD( R_CLOCK_CITY_SELECTION_LIST_DIALOG ); |
|
182 } |
|
183 |
|
184 // --------------------------------------------------------- |
|
185 // CClockCitySelectionListImpl::OKToExit |
|
186 // rest of the details are commented in the header |
|
187 // --------------------------------------------------------- |
|
188 // |
|
189 TBool CClockCitySelectionListImpl::OKToExit() |
|
190 { |
|
191 __PRINTS( "CClockCitySelectionListImpl::OKToExit - Entry" ); |
|
192 |
|
193 __PRINTS( "CClockCitySelectionListImpl::OKToExit - Exit" ); |
|
194 |
|
195 return ETrue; |
|
196 } |
|
197 |
|
198 // --------------------------------------------------------- |
|
199 // CClockCitySelectionListImpl::PreLayoutDynInitL |
|
200 // rest of the details are commented in the header |
|
201 // --------------------------------------------------------- |
|
202 // |
|
203 void CClockCitySelectionListImpl::PreLayoutDynInitL() |
|
204 { |
|
205 __PRINTS( "CClockCitySelectionListImpl::PreLayoutDynInitL - Entry" ); |
|
206 |
|
207 CEikStatusPane* statusPane( iEikonEnv->AppUiFactory()->StatusPane() ); |
|
208 CAknTitlePane* titlePane = STATIC_CAST( CAknTitlePane*, statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
209 |
|
210 HBufC* titleText( NULL ); |
|
211 titleText = StringLoader::LoadLC( R_CLOCK_CITY_SELECTION_LIST_COUNTRY_TITLE, iCoeEnv ); |
|
212 |
|
213 titlePane->SetTextL( *titleText ); |
|
214 titlePane->DrawNow(); |
|
215 CleanupStack::PopAndDestroy( titleText ); |
|
216 |
|
217 CAknSingleStyleListBox* listBox = static_cast< CAknSingleStyleListBox* > ( Control( EClockCityListBoxID ) ); |
|
218 |
|
219 // Enable Marquee for the list |
|
220 CColumnListBoxData* columnData( listBox->ItemDrawer()->ColumnData() ); |
|
221 columnData->EnableMarqueeL( ETrue ); |
|
222 |
|
223 User::LeaveIfNull( listBox ); |
|
224 |
|
225 CTextListBoxModel* listBoxModel( listBox->Model() ); |
|
226 listBoxModel->SetItemTextArray( iCityArray ); |
|
227 |
|
228 listBox->CreateScrollBarFrameL( ETrue ); |
|
229 listBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
230 listBox->HandleItemAdditionL(); |
|
231 listBox->UpdateScrollBarsL(); |
|
232 |
|
233 CAknSelectionListDialog::PreLayoutDynInitL(); |
|
234 |
|
235 __PRINTS( "CClockCitySelectionListImpl::PreLayoutDynInitL - Exit" ); |
|
236 } |
|
237 |
|
238 // --------------------------------------------------------- |
|
239 // CClockCitySelectionListImpl::ProcessCommandL |
|
240 // rest of the details are commented in the header |
|
241 // --------------------------------------------------------- |
|
242 // |
|
243 void CClockCitySelectionListImpl::ProcessCommandL( TInt aCommandId ) |
|
244 { |
|
245 __PRINTS( "CClockCitySelectionListImpl::ProcessCommandL - Entry" ); |
|
246 |
|
247 CAknSelectionListDialog::ProcessCommandL( aCommandId ); |
|
248 |
|
249 __PRINTS( "CClockCitySelectionListImpl::ProcessCommandL - Exit" ); |
|
250 } |
|
251 |
|
252 // --------------------------------------------------------- |
|
253 // CClockCitySelectionListImpl::OfferKeyEventL |
|
254 // rest of the details are commented in the header |
|
255 // --------------------------------------------------------- |
|
256 // |
|
257 TKeyResponse CClockCitySelectionListImpl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
258 { |
|
259 __PRINTS( "CClockCitySelectionListImpl::OfferKeyEventL - Entry" ); |
|
260 |
|
261 if( EEventKey == aType ) |
|
262 { |
|
263 |
|
264 if( EStdKeyNo == aKeyEvent.iScanCode ) |
|
265 { |
|
266 // This indicates that Call End key was pressed. |
|
267 TryExitL( KClockHideInBackground ); |
|
268 |
|
269 __PRINTS( "CClockCitySelectionListImpl::OfferKeyEventL - Exit" ); |
|
270 |
|
271 return EKeyWasConsumed; |
|
272 } |
|
273 |
|
274 if( EKeyOK == aKeyEvent.iCode || EKeyEnter == aKeyEvent.iCode ) |
|
275 { |
|
276 DoSelectCityL(); |
|
277 |
|
278 __PRINTS( "CClockCitySelectionListImpl::OfferKeyEventL - Exit" ); |
|
279 |
|
280 return EKeyWasConsumed; |
|
281 } |
|
282 } |
|
283 |
|
284 if( EStdKeyEnter != aKeyEvent.iCode && EEventKey == aType ) |
|
285 { |
|
286 CAknSingleStyleListBox* listbox = static_cast< CAknSingleStyleListBox* > ( Control( EClockCityListBoxID ) ); |
|
287 TInt itemIndex( listbox->CurrentItemIndex() ); |
|
288 |
|
289 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
290 if( cba->IsCommandInGroup( EAknSoftkeyCancel ) ) |
|
291 { |
|
292 if( KErrNone > itemIndex ) |
|
293 { |
|
294 cba->SetCommandSetL( R_AVKON_SOFTKEYS_CANCEL ); |
|
295 cba->DrawDeferred(); |
|
296 } |
|
297 else |
|
298 { |
|
299 cba->SetCommandSetL( R_AVKON_SOFTKEYS_SELECT_CANCEL ); |
|
300 cba->DrawDeferred(); |
|
301 } |
|
302 } |
|
303 } |
|
304 |
|
305 if( ( EStdKeyBackspace == aKeyEvent.iCode || EStdKeyDelete == aKeyEvent.iCode ) || |
|
306 ( EEventKeyUp == aType ) ) |
|
307 { |
|
308 CAknSingleStyleListBox* listbox = static_cast< CAknSingleStyleListBox* > ( Control( EClockCityListBoxID ) ); |
|
309 TInt itemIndex( listbox->CurrentItemIndex() ); |
|
310 |
|
311 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
312 if( cba->IsCommandInGroup( EAknSoftkeyCancel ) ) |
|
313 { |
|
314 if( 0 > itemIndex ) |
|
315 { |
|
316 cba->SetCommandSetL( R_AVKON_SOFTKEYS_CANCEL ); |
|
317 cba->DrawDeferred(); |
|
318 } |
|
319 else |
|
320 { |
|
321 cba->SetCommandSetL( R_AVKON_SOFTKEYS_SELECT_CANCEL ); |
|
322 cba->DrawDeferred(); |
|
323 } |
|
324 } |
|
325 } |
|
326 |
|
327 __PRINTS( "CClockCitySelectionListImpl::OfferKeyEventL - Exit" ); |
|
328 |
|
329 return CAknSelectionListDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
330 } |
|
331 |
|
332 // --------------------------------------------------------- |
|
333 // CClockCitySelectionListImpl::OkToExitL |
|
334 // rest of the details are commented in the header |
|
335 // --------------------------------------------------------- |
|
336 // |
|
337 TBool CClockCitySelectionListImpl::OkToExitL( TInt aButtonId ) |
|
338 { |
|
339 __PRINTS( "CClockCitySelectionListImpl::OkToExitL - Entry" ); |
|
340 |
|
341 if( EAknSoftkeySelect == aButtonId ) |
|
342 { |
|
343 DoSelectCityL(); |
|
344 |
|
345 __PRINTS( "CClockCitySelectionListImpl::OkToExitL - Exit" ); |
|
346 |
|
347 return EFalse; |
|
348 } |
|
349 |
|
350 __PRINTS( "CClockCitySelectionListImpl::OkToExitL - Exit" ); |
|
351 |
|
352 return CAknSelectionListDialog::OkToExitL( aButtonId ); |
|
353 } |
|
354 |
|
355 // --------------------------------------------------------- |
|
356 // CClockCitySelectionListImpl::HandleListBoxEventL |
|
357 // rest of the details are commented in the header |
|
358 // --------------------------------------------------------- |
|
359 // |
|
360 void CClockCitySelectionListImpl::HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ) |
|
361 { |
|
362 __PRINTS( "CClockCitySelectionListImpl::HandleListBoxEventL - Entry" ); |
|
363 |
|
364 if( !AknLayoutUtils::PenEnabled() || iCitySelected ) |
|
365 { |
|
366 __PRINTS( "CClockCitySelectionListImpl::HandleListBoxEventL - Exit" ); |
|
367 |
|
368 return; |
|
369 } |
|
370 //Single click integration |
|
371 if( EEventItemSingleClicked == aEventType ) |
|
372 |
|
373 { |
|
374 DoSelectCityL( EFalse ); |
|
375 if( iCitySelected ) |
|
376 { |
|
377 CAknSelectionListDialog::HandleListBoxEventL( aListBox, aEventType ); |
|
378 } |
|
379 } |
|
380 |
|
381 __PRINTS( "CClockCitySelectionListImpl::HandleListBoxEventL - Exit" ); |
|
382 } |
|
383 |
|
384 // --------------------------------------------------------- |
|
385 // CClockCitySelectionListImpl::DoSelectCityL |
|
386 // rest of the details are commented in the header |
|
387 // --------------------------------------------------------- |
|
388 // |
|
389 void CClockCitySelectionListImpl::DoSelectCityL( TBool aTryExit ) |
|
390 { |
|
391 __PRINTS( "CClockCitySelectionListImpl::DoSelectCityL - Entry" ); |
|
392 |
|
393 // The country listbox. |
|
394 CAknSingleStyleListBox* listBox = |
|
395 static_cast< CAknSingleStyleListBox* > ( Control( EClockCityListBoxID ) ); |
|
396 |
|
397 // The item currently focused item in the list. |
|
398 TInt itemIndex( listBox->CurrentItemIndex() ); |
|
399 |
|
400 // If the index is valid. |
|
401 if( KErrNone <= itemIndex ) |
|
402 { |
|
403 // Find the item text. |
|
404 TPtrC itemText( listBox->Model()->ItemText( itemIndex ) ); |
|
405 // The country name, in the item focused. |
|
406 TInt tabLocation( itemText.Locate( TChar( '\t' ) ) ); |
|
407 TPtrC countryName( itemText.Mid( tabLocation + 1, itemText.Length() - 2 ) ); |
|
408 |
|
409 // The tzlocalizer. |
|
410 CTzLocalizer* tzLocalizer = CTzLocalizer::NewL(); |
|
411 CleanupStack::PushL( tzLocalizer ); |
|
412 // This group will be the country. |
|
413 CTzLocalizedCityGroup* localizedCityGroup( tzLocalizer->FindCityGroupByNameL( countryName ) ); |
|
414 CleanupStack::PushL( localizedCityGroup ); |
|
415 // The cities under the group. |
|
416 CTzLocalizedCityArray* localizedCityArray( |
|
417 tzLocalizer->GetCitiesInGroupL( localizedCityGroup->Id(), |
|
418 CTzLocalizer::ETzAlphaNameAscending ) ); |
|
419 CleanupStack::PushL( localizedCityArray ); |
|
420 CTzLocalizedCity* tzLocalizedCity( NULL ); |
|
421 |
|
422 // If there's only one city, then choose the city and return. |
|
423 if( KSingleCity == localizedCityArray->Count() ) |
|
424 { |
|
425 iCitySelected = ETrue; |
|
426 tzLocalizedCity = &( localizedCityArray->At( KErrNone ) ); |
|
427 } |
|
428 // We've more than one city in the list. Construct a list to display the same. |
|
429 else |
|
430 { |
|
431 CAknSinglePopupMenuStyleListBox* cityListBox = new ( ELeave ) CAknSinglePopupMenuStyleListBox; |
|
432 CleanupStack::PushL( cityListBox ); |
|
433 // Create a new popupList to display the city list for a country. |
|
434 CClockCitySelectionListPopup* popupCityList = |
|
435 CClockCitySelectionListPopup::NewL( cityListBox, |
|
436 R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT, |
|
437 AknPopupLayouts::EMenuWindow ); |
|
438 CleanupStack::PushL( popupCityList ); |
|
439 // Set the properties of the list. |
|
440 cityListBox->ConstructL( popupCityList, EAknListBoxSelectionList | EAknListBoxScrollBarSizeExcluded ); |
|
441 cityListBox->CreateScrollBarFrameL( ETrue ); |
|
442 cityListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, |
|
443 CEikScrollBarFrame::EAuto ); |
|
444 // Enable Marquee for the list |
|
445 cityListBox->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue ); |
|
446 |
|
447 // The array for the strings representing the cities. |
|
448 CDesCArrayFlat* cityListArray = new ( ELeave ) CDesCArrayFlat( KArrayGranularity ); |
|
449 CleanupStack::PushL( cityListArray ); |
|
450 |
|
451 for( TInt index( FALSE ); index < localizedCityArray->Count(); index++ ) |
|
452 { |
|
453 TBuf< KMaxDataLength > cityName; |
|
454 cityName.Append( ( localizedCityArray->At( index ) ).Name() ); |
|
455 cityListArray->AppendL( cityName ); |
|
456 } |
|
457 // Cleanup. |
|
458 CleanupStack::Pop( cityListArray ); |
|
459 |
|
460 CTextListBoxModel* cityModel( cityListBox->Model() ); |
|
461 cityModel->SetItemTextArray( cityListArray ); |
|
462 cityModel->SetOwnershipType( ELbmOwnsItemArray ); |
|
463 |
|
464 // Set the title for the citylist popup. |
|
465 HBufC* cityTitle = StringLoader::LoadLC( R_CLOCK_CITY_SELECTION_LIST_SELECT_CITY ); |
|
466 popupCityList->SetTitleL( cityTitle->Des() ); |
|
467 CleanupStack::PopAndDestroy( cityTitle ); |
|
468 popupCityList->EnableFind(); |
|
469 |
|
470 // Hide the menu. |
|
471 HideMenu(); |
|
472 |
|
473 if( popupCityList->ExecuteLD() ) |
|
474 { |
|
475 iCitySelected = ETrue; |
|
476 tzLocalizedCity = &( localizedCityArray->At( cityListBox->CurrentItemIndex() ) ); |
|
477 } |
|
478 |
|
479 // Cleanup. |
|
480 CleanupStack::Pop( popupCityList ); |
|
481 CleanupStack::PopAndDestroy( cityListBox ); |
|
482 } |
|
483 |
|
484 if( NULL != tzLocalizedCity ) |
|
485 { |
|
486 RTz rTzHandle; |
|
487 User::LeaveIfError( rTzHandle.Connect() ); |
|
488 CleanupClosePushL( rTzHandle ); |
|
489 |
|
490 iCityInfo->iCountry.Copy( countryName ); |
|
491 iCityInfo->iCity.Copy( tzLocalizedCity->Name() ); |
|
492 iCityInfo->iTimeZoneId = tzLocalizedCity->TimeZoneId(); |
|
493 |
|
494 RArray< TInt > timeZoneId; |
|
495 RArray< TInt > zoneOffset; |
|
496 |
|
497 timeZoneId.Append( iCityInfo->iTimeZoneId ); |
|
498 rTzHandle.GetOffsetsForTimeZoneIdsL( timeZoneId, zoneOffset ); |
|
499 CleanupStack::PopAndDestroy( &rTzHandle ); |
|
500 |
|
501 iCityInfo->iUtcOffset = zoneOffset[ 0 ]; |
|
502 |
|
503 timeZoneId.Close(); |
|
504 zoneOffset.Close(); |
|
505 |
|
506 TInt cityGroupId( tzLocalizedCity->GroupId() ); |
|
507 |
|
508 CTzLocalizedCityArray* cityArray( tzLocalizer->GetCitiesInGroupL( cityGroupId, CTzLocalizer::ETzUnsorted ) ); |
|
509 CleanupStack::PushL( cityArray ); |
|
510 |
|
511 TInt selectedIndex( FALSE ); |
|
512 for( TInt index( FALSE ); index < cityArray->Count(); index++ ) |
|
513 { |
|
514 if( KErrNone == ( cityArray->At( index ) ).Name().Compare( tzLocalizedCity->Name() ) ) |
|
515 { |
|
516 selectedIndex = index; |
|
517 } |
|
518 } |
|
519 |
|
520 iCityInfo->iCityOffsetInGroup = selectedIndex; |
|
521 iCityInfo->iCityGroupId = cityGroupId; |
|
522 |
|
523 // Cleanup. |
|
524 CleanupStack::PopAndDestroy( cityArray ); |
|
525 |
|
526 if( aTryExit ) |
|
527 { |
|
528 // City is selected. We can exit the dialog now. |
|
529 this->TryExitL( NULL ); |
|
530 } |
|
531 } |
|
532 // Cleanup. |
|
533 CleanupStack::PopAndDestroy( localizedCityArray ); |
|
534 CleanupStack::PopAndDestroy( localizedCityGroup ); |
|
535 CleanupStack::PopAndDestroy( tzLocalizer ); |
|
536 } |
|
537 |
|
538 __PRINTS( "CClockCitySelectionListImpl::DoSelectCityL - Exit" ); |
|
539 } |
|
540 |
|
541 // --------------------------------------------------------- |
|
542 // NewDialog |
|
543 // This is the function used to instantiate the dialog when calling DLL dynamically. |
|
544 // --------------------------------------------------------- |
|
545 // |
|
546 EXPORT_C MClockCitySelectionList* NewDialog() |
|
547 { |
|
548 __PRINTS( "NewDialog - Entry" ); |
|
549 |
|
550 MClockCitySelectionList* citySelectionList( NULL ); |
|
551 TRAP_IGNORE( citySelectionList = new ( ELeave ) CClockCitySelectionListImpl() ); |
|
552 |
|
553 __PRINTS( "NewDialog - Exit" ); |
|
554 |
|
555 return citySelectionList; |
|
556 } |
|
557 |
|
558 // End of file |