|
1 /* |
|
2 * Copyright (c) 2005 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include "AspScheduleDialog.h" |
|
23 #include "AspProfileSelectionDialog.h" |
|
24 #include "AspSchedule.h" |
|
25 #include "AspProfileWizard.h" |
|
26 #include "AspSyncUtil.rh" |
|
27 #include "AspDebug.h" |
|
28 #include <csxhelp/ds.hlp.hrh> |
|
29 |
|
30 #include <aspsyncutil.mbg> // for bitmap enumerations |
|
31 #include <AknIconArray.h> // for GulArray |
|
32 #include <featmgr.h> // FeatureManager |
|
33 |
|
34 #include "AspProfile.h" |
|
35 #include "AspContentDialog.h" |
|
36 #include "AspSettingViewDialog.h" |
|
37 #include <ConnectionUiUtilities.h> |
|
38 #include <cmdefconnvalues.h> |
|
39 #include <cmmanager.h> |
|
40 const TInt KMSKControlId( CEikButtonGroupContainer::EMiddleSoftkeyPosition ); |
|
41 // ============================ MEMBER FUNCTIONS =============================== |
|
42 |
|
43 |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // AspScheduleDialog::ShowDialogL |
|
47 // |
|
48 // ----------------------------------------------------------------------------- |
|
49 TBool CAspScheduleDialog::ShowDialogL(const TAspParam& aParam) |
|
50 { |
|
51 CAspScheduleDialog* dialog = CAspScheduleDialog::NewL(aParam); |
|
52 |
|
53 TBool ret = dialog->ExecuteLD(R_ASP_AUTO_SYNC_DIALOG); |
|
54 |
|
55 return ret; |
|
56 } |
|
57 |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CAspScheduleDialog::NewL |
|
61 // |
|
62 // ----------------------------------------------------------------------------- |
|
63 CAspScheduleDialog* CAspScheduleDialog::NewL(const TAspParam& aParam) |
|
64 { |
|
65 FLOG( _L("CAspScheduleDialog::NewL START") ); |
|
66 |
|
67 CAspScheduleDialog* self = new (ELeave) CAspScheduleDialog(aParam); |
|
68 CleanupStack::PushL(self); |
|
69 self->ConstructL(); |
|
70 CleanupStack::Pop(self); |
|
71 |
|
72 FLOG( _L("CAspScheduleDialog::NewL END") ); |
|
73 return self; |
|
74 } |
|
75 |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CAspScheduleDialog::CAspScheduleDialog |
|
79 // |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 CAspScheduleDialog::CAspScheduleDialog(const TAspParam& aParam) |
|
83 { |
|
84 iSyncSession = aParam.iSyncSession; |
|
85 iApplicationId = aParam.iApplicationId; |
|
86 iProfileList = aParam.iProfileList; |
|
87 iEditMode = aParam.iMode; |
|
88 iProfile = aParam.iProfile; |
|
89 iContentList = aParam.iContentList; |
|
90 iSchedule = aParam.iSchedule; |
|
91 |
|
92 iDoCleanUp = EFalse; |
|
93 |
|
94 __ASSERT_ALWAYS(iProfileList, TUtil::Panic(KErrGeneral)); |
|
95 __ASSERT_ALWAYS(iSyncSession, TUtil::Panic(KErrGeneral)); |
|
96 } |
|
97 |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CAspScheduleDialog::ConstructL |
|
101 // |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void CAspScheduleDialog::ConstructL() |
|
105 { |
|
106 FLOG( _L("CAspScheduleDialog::ConstructL START") ); |
|
107 |
|
108 CAknDialog::ConstructL(R_ASP_AUTO_SYNC_DIALOG_MENU); |
|
109 |
|
110 iResHandler = CAspResHandler::NewL(); |
|
111 |
|
112 iSettingEnforcement = TUtil::SettingEnforcementState(); |
|
113 |
|
114 iSettingList = new (ELeave) CArrayPtrFlat<CAspListItemData>(KDefaultArraySize); |
|
115 |
|
116 if (!iSchedule) |
|
117 { |
|
118 iDoCleanUp = ETrue; |
|
119 iSchedule = CAspSchedule::NewL(); |
|
120 } |
|
121 |
|
122 iWeekdayList = iResHandler->ReadDesArrayL(R_ASP_AUTO_SYNC_DAYS_LIST); |
|
123 iContentsList = new (ELeave) CDesCArrayFlat(KDefaultArraySize); |
|
124 // get previous title so it can be restored |
|
125 iStatusPaneHandler = CStatusPaneHandler::NewL(iAvkonAppUi); |
|
126 iStatusPaneHandler->StoreOriginalTitleL(); |
|
127 |
|
128 iSettingChanged = EFalse; |
|
129 |
|
130 |
|
131 FLOG( _L("CAspScheduleDialog::ConstructL END") ); |
|
132 } |
|
133 |
|
134 |
|
135 // ---------------------------------------------------------------------------- |
|
136 // Destructor |
|
137 // |
|
138 // ---------------------------------------------------------------------------- |
|
139 // |
|
140 CAspScheduleDialog::~CAspScheduleDialog() |
|
141 { |
|
142 FLOG( _L("CAspScheduleDialog::~CAspScheduleDialog START") ); |
|
143 |
|
144 delete iResHandler; |
|
145 |
|
146 if (iSettingList) |
|
147 { |
|
148 iSettingList->ResetAndDestroy(); |
|
149 delete iSettingList; |
|
150 } |
|
151 if (iDoCleanUp) |
|
152 { |
|
153 delete iSchedule; |
|
154 } |
|
155 delete iWeekdayList; |
|
156 delete iContentsList; |
|
157 delete iStatusPaneHandler; |
|
158 |
|
159 if (iAvkonAppUi) |
|
160 { |
|
161 iAvkonAppUi->RemoveFromStack(this); |
|
162 } |
|
163 |
|
164 FLOG( _L("CAspScheduleDialog::~CAspScheduleDialog END") ); |
|
165 } |
|
166 |
|
167 |
|
168 //------------------------------------------------------------------------------ |
|
169 // CAspScheduleDialog::ActivateL |
|
170 // |
|
171 // Called by system when dialog is activated. |
|
172 //------------------------------------------------------------------------------ |
|
173 // |
|
174 void CAspScheduleDialog::ActivateL() |
|
175 { |
|
176 CAknDialog::ActivateL(); |
|
177 |
|
178 // this cannot be in ConstructL which is executed before dialog is launched |
|
179 iAvkonAppUi->AddToStackL(this); |
|
180 } |
|
181 |
|
182 |
|
183 //------------------------------------------------------------------------------ |
|
184 // CAspContentListDialog::GetHelpContext |
|
185 // |
|
186 //------------------------------------------------------------------------------ |
|
187 // |
|
188 void CAspScheduleDialog::GetHelpContext(TCoeHelpContext& aContext) const |
|
189 { |
|
190 aContext.iMajor = KUidSmlSyncApp; |
|
191 aContext.iContext = KDS_HLP_SETTINGS; |
|
192 } |
|
193 |
|
194 |
|
195 // ----------------------------------------------------------------------------- |
|
196 // CAspScheduleDialog::HandleListBoxEventL |
|
197 // |
|
198 // ----------------------------------------------------------------------------- |
|
199 |
|
200 void CAspScheduleDialog::HandleListBoxEventL(CEikListBox* /*aListBox*/, |
|
201 TListBoxEvent aEventType) |
|
202 { |
|
203 if( AknLayoutUtils::PenEnabled() ) |
|
204 { |
|
205 switch ( aEventType ) |
|
206 { |
|
207 case EEventItemSingleClicked: |
|
208 HandleOKL(); |
|
209 break; |
|
210 case EEventEnterKeyPressed : |
|
211 case EEventItemDraggingActioned : |
|
212 case EEventPenDownOnItem : |
|
213 break; |
|
214 default: |
|
215 break; |
|
216 } |
|
217 |
|
218 } |
|
219 |
|
220 } |
|
221 |
|
222 |
|
223 // ----------------------------------------------------------------------------- |
|
224 // CAspScheduleDialog::PreLayoutDynInitL |
|
225 // |
|
226 // ----------------------------------------------------------------------------- |
|
227 // |
|
228 void CAspScheduleDialog::PreLayoutDynInitL() |
|
229 { |
|
230 iSettingListBox = (CAknSettingStyleListBox*) ControlOrNull (EAspAutoSyncDialogList); |
|
231 |
|
232 __ASSERT_ALWAYS(iSettingListBox, TUtil::Panic(KErrGeneral)); |
|
233 |
|
234 if(iSettingEnforcement) |
|
235 { |
|
236 ButtonGroupContainer().RemoveCommandFromStack(KMSKControlId,EAknSoftkeyOpen ); |
|
237 HBufC* middleSKText = StringLoader::LoadLC( R_TEXT_SOFTKEY_EMPTY ); |
|
238 |
|
239 ButtonGroupContainer().AddCommandToStackL( |
|
240 KMSKControlId, |
|
241 EAknSoftkeyEmpty, |
|
242 *middleSKText ); |
|
243 CleanupStack::PopAndDestroy( middleSKText ); |
|
244 } |
|
245 iSettingListBox->SetListBoxObserver(this); |
|
246 iSettingListBox->CreateScrollBarFrameL(ETrue); |
|
247 iSettingListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
248 CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto); |
|
249 |
|
250 SetIconsL(); |
|
251 |
|
252 // create array of setting items (iSettingList) |
|
253 CreateSettingsListL(); |
|
254 |
|
255 // add setting headers into listbox |
|
256 UpdateListBoxL(iSettingListBox, iSettingList); |
|
257 |
|
258 if (iEditMode == EDialogModeEditMandatory) |
|
259 { |
|
260 TInt index = CheckMandatoryFields(); |
|
261 if (index != KErrNotFound) |
|
262 { |
|
263 iSettingListBox->SetCurrentItemIndexAndDraw(index); |
|
264 } |
|
265 } |
|
266 |
|
267 |
|
268 iStatusPaneHandler->SetTitleL(R_ASP_TITLE_AUTOMATIC_SYNC_SETTINGS); |
|
269 iStatusPaneHandler->SetNaviPaneTitleL(KNullDesC); |
|
270 } |
|
271 |
|
272 |
|
273 // ---------------------------------------------------------------------------- |
|
274 // CAspScheduleDialog::SetIconsL |
|
275 // |
|
276 // ---------------------------------------------------------------------------- |
|
277 // |
|
278 void CAspScheduleDialog::SetIconsL() |
|
279 { |
|
280 if (!iSettingListBox) |
|
281 { |
|
282 return; |
|
283 } |
|
284 |
|
285 TFileName bitmapName; |
|
286 CAspResHandler::GetBitmapFileName(bitmapName); |
|
287 CArrayPtr<CGulIcon>* icons = new (ELeave) CAknIconArray(KDefaultArraySize); |
|
288 CleanupStack::PushL(icons); |
|
289 |
|
290 icons->AppendL(IconL(KAknsIIDQgnIndiSettProtectedAdd, bitmapName, |
|
291 EMbmAspsyncutilQgn_indi_sett_protected_add, |
|
292 EMbmAspsyncutilQgn_indi_sett_protected_add_mask)); |
|
293 |
|
294 // delete old icons |
|
295 CArrayPtr<CGulIcon>* arr = iSettingListBox->ItemDrawer()->FormattedCellData()->IconArray(); |
|
296 if (arr) |
|
297 { |
|
298 arr->ResetAndDestroy(); |
|
299 delete arr; |
|
300 arr = NULL; |
|
301 } |
|
302 |
|
303 iSettingListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons); |
|
304 CleanupStack::Pop(icons); |
|
305 } |
|
306 |
|
307 |
|
308 // ----------------------------------------------------------------------------- |
|
309 // CAspScheduleDialog::IconL |
|
310 // |
|
311 // ----------------------------------------------------------------------------- |
|
312 // |
|
313 CGulIcon* CAspScheduleDialog::IconL(TAknsItemID aId, const TDesC& aFileName, TInt aFileIndex, TInt aFileMaskIndex) |
|
314 { |
|
315 return TDialogUtil::CreateIconL(aId, aFileName, aFileIndex, aFileMaskIndex); |
|
316 } |
|
317 |
|
318 |
|
319 //------------------------------------------------------------------------------ |
|
320 // CAspScheduleDialog::DynInitMenuPaneL |
|
321 // |
|
322 // Called by system before menu is shown. |
|
323 //------------------------------------------------------------------------------ |
|
324 // |
|
325 void CAspScheduleDialog::DynInitMenuPaneL(TInt aResourceID, CEikMenuPane* aMenuPane) |
|
326 { |
|
327 if (aResourceID != R_ASP_AUTO_SYNC_DIALOG_MENU_PANE) |
|
328 { |
|
329 return; |
|
330 } |
|
331 |
|
332 if (iSettingListBox->Model()->NumberOfItems() == 0) |
|
333 { |
|
334 TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdChange); |
|
335 return; |
|
336 } |
|
337 |
|
338 CAspListItemData* item = GetItemForIndex(iSettingListBox->CurrentItemIndex()); |
|
339 if (item->iHidden == EVisibilityReadOnly) |
|
340 { |
|
341 TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdChange); |
|
342 } |
|
343 |
|
344 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
345 { |
|
346 TDialogUtil::DeleteMenuItem(aMenuPane, EAknCmdHelp); |
|
347 } |
|
348 } |
|
349 |
|
350 |
|
351 //------------------------------------------------------------------------------ |
|
352 // CAspScheduleDialog::ProcessCommandL |
|
353 // |
|
354 // Handle commands from menu. |
|
355 //------------------------------------------------------------------------------ |
|
356 // |
|
357 void CAspScheduleDialog::ProcessCommandL(TInt aCommandId) |
|
358 { |
|
359 HideMenu(); |
|
360 |
|
361 switch (aCommandId) |
|
362 { |
|
363 case EAknCmdHelp: |
|
364 { |
|
365 |
|
366 TUtil::LaunchHelpAppL(iEikonEnv); |
|
367 break; |
|
368 |
|
369 } |
|
370 |
|
371 case EAspMenuCmdChange: |
|
372 { |
|
373 CAspListItemData* item = GetItemForIndex(iSettingListBox->CurrentItemIndex()); |
|
374 |
|
375 if (item->iItemType == CAspListItemData::ETypeListYesNo) |
|
376 { |
|
377 // open editor for Yes/No setting |
|
378 /* if (EditSettingItemListL(*item)) |
|
379 { |
|
380 SetVisibility(); |
|
381 UpdateListBoxL(iSettingListBox, iSettingList); |
|
382 |
|
383 iSettingChanged = ETrue; |
|
384 }*/ |
|
385 } |
|
386 else |
|
387 { |
|
388 HandleOKL(); |
|
389 } |
|
390 |
|
391 break; |
|
392 } |
|
393 |
|
394 case EAspMenuCmdExit: |
|
395 case EAknCmdExit: |
|
396 case EEikCmdExit: |
|
397 { |
|
398 // close dialog and exit calling application |
|
399 iAvkonAppUi->ProcessCommandL(EAknCmdExit); |
|
400 break; |
|
401 } |
|
402 |
|
403 default: |
|
404 break; |
|
405 } |
|
406 } |
|
407 |
|
408 |
|
409 //------------------------------------------------------------------------------ |
|
410 // CAspScheduleDialog::OkToExitL |
|
411 // |
|
412 //------------------------------------------------------------------------------ |
|
413 // |
|
414 TBool CAspScheduleDialog::OkToExitL(TInt aButtonId) |
|
415 { |
|
416 if (aButtonId == EEikBidCancel) |
|
417 { |
|
418 // TRAP_IGNORE(SaveSettingsL()); |
|
419 return ETrue; |
|
420 } |
|
421 |
|
422 if (aButtonId == EAknSoftkeyBack) |
|
423 { |
|
424 #if 0 |
|
425 TInt mandatoryIndex = CheckMandatoryFields(); |
|
426 if (mandatoryIndex != KErrNotFound) |
|
427 { |
|
428 if (!TDialogUtil::ShowConfirmationQueryL(R_ASP_EXIT_ANYWAY)) |
|
429 { |
|
430 iSettingListBox->SetCurrentItemIndexAndDraw(mandatoryIndex); |
|
431 return EFalse; // leave dialog open |
|
432 } |
|
433 } |
|
434 #endif |
|
435 if (iSettingChanged) |
|
436 { |
|
437 if(!CheckPeakTime()) |
|
438 { |
|
439 HBufC* hBuf = CAspResHandler::ReadLC(R_ASP_INCORRECT_PEAK_TIME); |
|
440 TDialogUtil::ShowInformationNoteL(hBuf->Des()); |
|
441 CleanupStack::PopAndDestroy(hBuf); |
|
442 return EFalse; |
|
443 } |
|
444 TRAPD(err, SaveSettingsL()); |
|
445 if (err == KErrNone) |
|
446 { |
|
447 CheckMandatoryDataL(); |
|
448 iSchedule->CopyAutoSyncContentsL(); |
|
449 iSchedule->UpdateProfileSettingsL(); |
|
450 iSchedule->UpdateSyncSchedule(); |
|
451 iSchedule->SaveL(); // for saving sync schedule id |
|
452 iSchedule->EnableScheduleL(); |
|
453 } |
|
454 } |
|
455 ShowAutoSyncInfoL(); |
|
456 return ETrue; |
|
457 } |
|
458 |
|
459 if (aButtonId == EAknSoftkeyOpen || aButtonId == EAknSoftkeyEmpty) // MSK |
|
460 { |
|
461 HandleOKL(); |
|
462 return EFalse; // leave dialog open |
|
463 } |
|
464 |
|
465 return CAknDialog::OkToExitL(aButtonId); |
|
466 } |
|
467 |
|
468 |
|
469 // ---------------------------------------------------------------------------- |
|
470 // CAspScheduleDialog::OfferKeyEventL |
|
471 // |
|
472 // ---------------------------------------------------------------------------- |
|
473 // |
|
474 TKeyResponse CAspScheduleDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
475 TEventCode aType) |
|
476 { |
|
477 if (aType == EEventKey) |
|
478 { |
|
479 switch (aKeyEvent.iCode) |
|
480 { |
|
481 case EKeyEnter: |
|
482 case EKeyOK: |
|
483 { |
|
484 CAspListItemData* item = |
|
485 GetItemForIndex(iSettingListBox->CurrentItemIndex()); |
|
486 if (item->iHidden == EVisibilityReadOnly) |
|
487 { |
|
488 TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_READ_ONLY); |
|
489 return EKeyWasConsumed; |
|
490 } |
|
491 |
|
492 |
|
493 HandleOKL(); |
|
494 return EKeyWasConsumed; |
|
495 } |
|
496 |
|
497 case EKeyEscape: // framework calls this when dialog must shut down |
|
498 { |
|
499 return CAknDialog::OfferKeyEventL(aKeyEvent, aType); |
|
500 } |
|
501 |
|
502 default: |
|
503 { |
|
504 break; |
|
505 } |
|
506 } |
|
507 } |
|
508 |
|
509 return CAknDialog::OfferKeyEventL( aKeyEvent, aType); |
|
510 } |
|
511 |
|
512 |
|
513 // ---------------------------------------------------------------------------- |
|
514 // CAspScheduleDialog::HandleResourceChange |
|
515 // |
|
516 // ---------------------------------------------------------------------------- |
|
517 // |
|
518 void CAspScheduleDialog::HandleResourceChange(TInt aType) |
|
519 { |
|
520 if (aType == KEikDynamicLayoutVariantSwitch) //Handle change in layout orientation |
|
521 { |
|
522 TRect mainPaneRect; |
|
523 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
524 SetRect(mainPaneRect); |
|
525 iSettingListBox->SetSize(mainPaneRect.Size()); |
|
526 CCoeControl::HandleResourceChange(aType); |
|
527 DrawDeferred(); |
|
528 return; |
|
529 } |
|
530 |
|
531 if (aType == KAknsMessageSkinChange) |
|
532 { |
|
533 TRAP_IGNORE(SetIconsL()); |
|
534 } |
|
535 |
|
536 CCoeControl::HandleResourceChange(aType); |
|
537 } |
|
538 |
|
539 |
|
540 //------------------------------------------------------------------------------ |
|
541 // CAspScheduleDialog::CheckMandatoryFields |
|
542 // |
|
543 // Check that all mandatory fields are filled. |
|
544 //------------------------------------------------------------------------------ |
|
545 // |
|
546 TInt CAspScheduleDialog::CheckMandatoryFields() |
|
547 { |
|
548 TInt count = iSettingList->Count(); |
|
549 for (TInt i=0; i<count; i++) |
|
550 { |
|
551 CAspListItemData* item = (*iSettingList)[i]; |
|
552 |
|
553 if ( item->iMandatory && item->IsEmpty() && (item->iHidden == EVisibilityNormal) ) |
|
554 { |
|
555 return item->iIndex; |
|
556 } |
|
557 } |
|
558 |
|
559 return KErrNotFound; |
|
560 } |
|
561 |
|
562 |
|
563 //------------------------------------------------------------------------------ |
|
564 // CAspScheduleDialog::HandleOKL |
|
565 // |
|
566 //------------------------------------------------------------------------------ |
|
567 // |
|
568 void CAspScheduleDialog::HandleOKL() |
|
569 { |
|
570 CAspListItemData* item = GetItemForIndex(iSettingListBox->CurrentItemIndex()); |
|
571 |
|
572 if (item->iHidden == EVisibilityReadOnly) |
|
573 { |
|
574 if(!iSettingEnforcement) |
|
575 { |
|
576 TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_READ_ONLY); |
|
577 } |
|
578 else |
|
579 { |
|
580 TDialogUtil::ShowInformationNoteL(R_ASP_PROTECTED_SETTING); |
|
581 } |
|
582 return; |
|
583 } |
|
584 |
|
585 if (EditSettingItemL(*item)) |
|
586 { |
|
587 SetVisibility(); |
|
588 UpdateListBoxL(iSettingListBox, iSettingList); |
|
589 |
|
590 iSettingChanged = ETrue; |
|
591 } |
|
592 } |
|
593 |
|
594 |
|
595 // ---------------------------------------------------------------------------- |
|
596 // CAspScheduleDialog::CreateSettingsListL |
|
597 // |
|
598 // ---------------------------------------------------------------------------- |
|
599 // |
|
600 void CAspScheduleDialog::CreateSettingsListL() |
|
601 { |
|
602 |
|
603 AddItemL(EAspAutoSyncProfile,R_ASP_SETT_AUTO_SYNC_PROFILE); |
|
604 AddItemL(EAspAutoSyncContents, R_ASP_SETT_AUTO_SYNC_CONTENTS); |
|
605 AddItemL(EAspAutoSyncFrequency, R_ASP_SETT_AUTO_SYNC_FREQ); |
|
606 AddItemL(EAspAutoSyncPeakSchedule, R_ASP_SETT_AUTO_PEAK_SCHEDULE); |
|
607 AddItemL(EAspAutoSyncOffPeakSchedule, R_ASP_SETT_AUTO_OFF_PEAK_SCHEDULE); |
|
608 AddItemL(EAspAutoSyncScheduleTime, R_ASP_SETT_AUTO_SYNC_TIME); |
|
609 AddItemL(EAspAutoSyncPeakStartTime, R_ASP_SETT_AUTO_PEAK_START); |
|
610 AddItemL(EAspAutoSyncPeakEndTime, R_ASP_SETT_AUTO_PEAK_END); |
|
611 AddItemL(EAspAutoSyncPeakDays, R_ASP_SETT_AUTO_SYNC_DAYS); |
|
612 |
|
613 //roaming to be implemented later |
|
614 #if 0 |
|
615 AddItemL(EAspAutoSyncRoamingStatus, R_ASP_SETTING_AUTO_SYNC_ROAMING_STATUS); |
|
616 #endif |
|
617 |
|
618 // write setting data into each CAspListItemData |
|
619 TInt count=iSettingList->Count(); |
|
620 for (TInt i=0; i<count; i++) |
|
621 { |
|
622 InitSettingItemL((*iSettingList)[i]); |
|
623 } |
|
624 |
|
625 SetVisibility(); // find out what setting appear on UI |
|
626 } |
|
627 |
|
628 |
|
629 // ---------------------------------------------------------------------------- |
|
630 // CAspScheduleDialog::AddItemL |
|
631 // |
|
632 // ---------------------------------------------------------------------------- |
|
633 // |
|
634 void CAspScheduleDialog::AddItemL(TInt aItemId, TInt aResourceId) |
|
635 { |
|
636 CAspListItemData* item = CAspListItemData::NewLC(); |
|
637 item->SetHeaderL(aResourceId); |
|
638 item->iItemId = aItemId; |
|
639 iSettingList->AppendL(item); |
|
640 CleanupStack::Pop(item); |
|
641 } |
|
642 |
|
643 |
|
644 // ---------------------------------------------------------------------------- |
|
645 // CAspScheduleDialog::UpdateListBoxL |
|
646 // |
|
647 // Add settings headers into listbox. |
|
648 // ---------------------------------------------------------------------------- |
|
649 // |
|
650 void CAspScheduleDialog::UpdateListBoxL(CEikTextListBox* aListBox, |
|
651 CAspSettingList* aItemList) |
|
652 { |
|
653 CDesCArray* arr = (CDesCArray*)aListBox->Model()->ItemTextArray(); |
|
654 arr->Reset(); |
|
655 |
|
656 TInt count = aItemList->Count(); |
|
657 for (TInt i=0; i<count; i++ ) |
|
658 { |
|
659 CAspListItemData* item = (*aItemList)[i]; |
|
660 |
|
661 TBool convert = ETrue; |
|
662 |
|
663 if (item->iHidden != EVisibilityHidden) |
|
664 { |
|
665 HBufC* hBuf = item->ListItemTextL(convert); |
|
666 CleanupStack::PushL(hBuf); |
|
667 |
|
668 arr->AppendL(hBuf->Des()); |
|
669 |
|
670 // store listbox index (from zero up) into setting item |
|
671 item->iIndex = arr->Count() - 1; |
|
672 |
|
673 CleanupStack::PopAndDestroy(hBuf); |
|
674 } |
|
675 else |
|
676 { |
|
677 item->iIndex = KErrNotFound; |
|
678 } |
|
679 } |
|
680 |
|
681 iSettingListBox->HandleItemAdditionL(); |
|
682 } |
|
683 |
|
684 |
|
685 // ----------------------------------------------------------------------------- |
|
686 // CAspScheduleDialog::SetVisibility |
|
687 // |
|
688 // ----------------------------------------------------------------------------- |
|
689 // |
|
690 void CAspScheduleDialog::SetVisibility() |
|
691 { |
|
692 |
|
693 Item(EAspAutoSyncScheduleTime)->iHidden = EVisibilityHidden; |
|
694 Item(EAspAutoSyncPeakStartTime)->iHidden = EVisibilityHidden; |
|
695 Item(EAspAutoSyncPeakEndTime)->iHidden = EVisibilityHidden; |
|
696 Item(EAspAutoSyncPeakSchedule)->iHidden = EVisibilityHidden; |
|
697 Item(EAspAutoSyncOffPeakSchedule)->iHidden = EVisibilityHidden; |
|
698 Item(EAspAutoSyncPeakDays)->iHidden = EVisibilityHidden; |
|
699 |
|
700 if (Item(EAspAutoSyncFrequency)->iNumberData == CAspSchedule::EManyTimesPerDay) |
|
701 { |
|
702 Item(EAspAutoSyncScheduleTime)->iHidden = EVisibilityHidden; |
|
703 Item(EAspAutoSyncPeakSchedule)->iHidden = EVisibilityNormal; |
|
704 Item(EAspAutoSyncOffPeakSchedule)->iHidden = EVisibilityNormal; |
|
705 if (Item(EAspAutoSyncPeakSchedule)->iNumberData || |
|
706 Item(EAspAutoSyncOffPeakSchedule)->iNumberData) |
|
707 { |
|
708 Item(EAspAutoSyncPeakStartTime)->iHidden = EVisibilityNormal; |
|
709 Item(EAspAutoSyncPeakEndTime)->iHidden = EVisibilityNormal; |
|
710 Item(EAspAutoSyncPeakDays)->iHidden = EVisibilityNormal; |
|
711 } |
|
712 } |
|
713 if (iSchedule->IntervalType(Item(EAspAutoSyncFrequency)->iNumberData) == EDaily ) |
|
714 { |
|
715 Item(EAspAutoSyncScheduleTime)->iHidden = EVisibilityNormal; |
|
716 } |
|
717 |
|
718 if (iEditMode == EDialogModeReadOnly || iSettingEnforcement) |
|
719 { |
|
720 SetAllReadOnly(); |
|
721 } |
|
722 |
|
723 } |
|
724 |
|
725 |
|
726 // ----------------------------------------------------------------------------- |
|
727 // CAspContentDialog::SetAllReadOnly |
|
728 // |
|
729 // ----------------------------------------------------------------------------- |
|
730 // |
|
731 void CAspScheduleDialog::SetAllReadOnly() |
|
732 { |
|
733 TInt count = iSettingList->Count(); |
|
734 |
|
735 for (TInt i=0; i<count; i++ ) |
|
736 { |
|
737 CAspListItemData* item = (*iSettingList)[i]; |
|
738 if (item->iHidden != EVisibilityHidden) |
|
739 { |
|
740 item->iHidden = EVisibilityReadOnly; |
|
741 } |
|
742 } |
|
743 } |
|
744 |
|
745 |
|
746 // ----------------------------------------------------------------------------- |
|
747 // CAspScheduleDialog::InitSettingItemL |
|
748 // |
|
749 // Constructs CAspListItemData for one connection setting. |
|
750 // ----------------------------------------------------------------------------- |
|
751 // |
|
752 void CAspScheduleDialog::InitSettingItemL(CAspListItemData* aItem) |
|
753 { |
|
754 __ASSERT_ALWAYS(aItem, TUtil::Panic(KErrGeneral)); |
|
755 |
|
756 iBuf = KNullDesC; // reset common buffer |
|
757 |
|
758 switch (aItem->iItemId) |
|
759 { |
|
760 |
|
761 case EAspAutoSyncProfile: |
|
762 { |
|
763 if (!iSchedule->IsAutoSyncEnabled()) |
|
764 { |
|
765 aItem->iNumberData = KErrNotFound; |
|
766 } |
|
767 else |
|
768 { |
|
769 aItem->iNumberData = iSchedule->ProfileId(); |
|
770 } |
|
771 |
|
772 GetProfileName(aItem->iNumberData, iBuf); |
|
773 aItem->SetValueL(iBuf); |
|
774 aItem->SetDisplayValueL(R_ASP_SETT_VALUE_NOT_DEFINED); |
|
775 aItem->iMandatory = ETrue; |
|
776 aItem->iItemType = CAspListItemData::ETypeAutoSyncProfile; |
|
777 break; |
|
778 } |
|
779 case EAspAutoSyncContents: |
|
780 { |
|
781 if (!iSchedule->IsAutoSyncEnabled()) |
|
782 { |
|
783 SetDefaultContentL(); |
|
784 } |
|
785 GetContentsNameL(iBuf); |
|
786 aItem->SetValueL(iBuf); |
|
787 aItem->SetDisplayValueL(R_ASP_SETTING_VALUE_NONE); |
|
788 aItem->iItemType = CAspListItemData::ETypeAutoSyncContent; |
|
789 break; |
|
790 } |
|
791 case EAspAutoSyncFrequency: |
|
792 { |
|
793 CDesCArray* arr = GetSyncFrequencyListLC(); |
|
794 aItem->iNumberData = iSchedule->SyncFrequency(); |
|
795 if (iSchedule->ProfileId() == KErrNotFound || !iSchedule->IsContentSelected() |
|
796 || !iSchedule->IsAutoSyncEnabled()) |
|
797 { |
|
798 aItem->iNumberData = CAspSchedule::EIntervalManual; |
|
799 } |
|
800 TInt currentSelection = GetSyncFrequencyPositionL(arr, aItem->iNumberData); |
|
801 aItem->SetValueL((*arr)[currentSelection]); |
|
802 aItem->iItemType = CAspListItemData::ETypeAutoSyncFrequency; |
|
803 CleanupStack::PopAndDestroy(arr); |
|
804 break; |
|
805 |
|
806 } |
|
807 case EAspAutoSyncPeakSchedule: |
|
808 { |
|
809 CDesCArray* arr = GetPeakScheduleListLC(); |
|
810 aItem->iNumberData = iSchedule->SyncPeakSchedule(); |
|
811 if (iSchedule->ProfileId() == KErrNotFound || !iSchedule->IsContentSelected() |
|
812 || !iSchedule->IsAutoSyncEnabled()) |
|
813 { |
|
814 aItem->iNumberData = CAspSchedule::EIntervalManual; |
|
815 } |
|
816 TInt currentSelection = GetPeakPositionL(arr, aItem->iNumberData); |
|
817 aItem->SetValueL((*arr)[currentSelection]); |
|
818 aItem->iItemType = CAspListItemData::ETypeAutoSyncPeakSchedule; |
|
819 CleanupStack::PopAndDestroy(arr); |
|
820 break; |
|
821 } |
|
822 |
|
823 case EAspAutoSyncOffPeakSchedule: |
|
824 { |
|
825 CDesCArray* arr = GetOffPeakScheduleListLC(); |
|
826 aItem->iNumberData = iSchedule->SyncOffPeakSchedule(); |
|
827 if (iSchedule->ProfileId() == KErrNotFound || !iSchedule->IsContentSelected() |
|
828 || !iSchedule->IsAutoSyncEnabled()) |
|
829 { |
|
830 aItem->iNumberData = CAspSchedule::EIntervalManual; |
|
831 } |
|
832 TInt currentSelection = GetOffPeakPositionL(arr, aItem->iNumberData); |
|
833 aItem->SetValueL((*arr)[currentSelection]); |
|
834 aItem->iItemType = CAspListItemData::ETypeAutoSyncOffPeakSchedule; |
|
835 CleanupStack::PopAndDestroy(arr); |
|
836 break; |
|
837 } |
|
838 case EAspAutoSyncScheduleTime: |
|
839 { |
|
840 if (iSchedule->DailySyncEnabled()) |
|
841 { |
|
842 aItem->iTime = iSchedule->AutoSyncScheduleTime(); |
|
843 } |
|
844 else |
|
845 { |
|
846 TTime currentTime; |
|
847 currentTime.HomeTime(); |
|
848 aItem->iTime = currentTime; |
|
849 } |
|
850 |
|
851 GetTimeTextL(iBuf, aItem->iTime); |
|
852 aItem->SetValueL(iBuf); |
|
853 aItem->SetDisplayValueL(R_ASP_SETTING_VALUE_NONE); |
|
854 aItem->iItemType = CAspListItemData::ETypeAutoSyncTime; |
|
855 Item(EAspAutoSyncScheduleTime)->iHidden = EVisibilityHidden; |
|
856 break; |
|
857 } |
|
858 case EAspAutoSyncPeakStartTime: |
|
859 { |
|
860 if (iSchedule->ProfileId() == KErrNotFound || !iSchedule->IsContentSelected() |
|
861 || !iSchedule->IsAutoSyncEnabled()) |
|
862 { |
|
863 TDateTime time(0, EJanuary, 0, KStartPeakHour, KStartPeakMin, 0, 0); |
|
864 TTime startTime(time); |
|
865 aItem->iTime = time; |
|
866 } |
|
867 else |
|
868 { |
|
869 aItem->iTime = iSchedule->StartPeakTime(); |
|
870 } |
|
871 |
|
872 GetTimeTextL(iBuf, aItem->iTime); |
|
873 aItem->SetValueL(iBuf); |
|
874 aItem->SetDisplayValueL(R_ASP_SETTING_VALUE_NONE); |
|
875 aItem->iItemType = CAspListItemData::ETypeAutoSyncTime; |
|
876 break; |
|
877 } |
|
878 case EAspAutoSyncPeakEndTime: |
|
879 { |
|
880 if (iSchedule->ProfileId() == KErrNotFound || !iSchedule->IsContentSelected() |
|
881 || !iSchedule->IsAutoSyncEnabled()) |
|
882 { |
|
883 TDateTime time(0, EJanuary, 0, KEndPeakHour, KEndPeakMin, 0, 0); |
|
884 TTime startTime(time); |
|
885 aItem->iTime = time; |
|
886 } |
|
887 else |
|
888 { |
|
889 aItem->iTime = iSchedule->EndPeakTime(); |
|
890 } |
|
891 GetTimeTextL(iBuf, aItem->iTime); |
|
892 aItem->SetValueL(iBuf); |
|
893 aItem->SetDisplayValueL(R_ASP_SETTING_VALUE_NONE); |
|
894 aItem->iItemType = CAspListItemData::ETypeAutoSyncTime; |
|
895 break; |
|
896 } |
|
897 case EAspAutoSyncPeakDays: |
|
898 { |
|
899 if (iSchedule->ProfileId() == KErrNotFound || !iSchedule->IsContentSelected() |
|
900 || !iSchedule->IsAutoSyncEnabled()) |
|
901 { |
|
902 SetDefaultdaySelectionL(); |
|
903 } |
|
904 GetWeekdayNameL(iBuf); |
|
905 aItem->SetValueL(iBuf); |
|
906 aItem->SetDisplayValueL(R_ASP_SETTING_VALUE_NONE); |
|
907 aItem->iResource = R_ASP_AUTO_SYNC_DAYS_LIST; |
|
908 aItem->iItemType = CAspListItemData::ETypeAutoSyncDays; |
|
909 break; |
|
910 } |
|
911 case EAspAutoSyncRoamingStatus: |
|
912 { |
|
913 CDesCArray* arr = iResHandler->ReadDesArrayLC(R_ASP_AUTO_SYNC_ROAMING_YESNO); |
|
914 |
|
915 if (iSchedule->RoamingAllowed()) |
|
916 { |
|
917 aItem->iNumberData = EAspSettingEnabled; // 1 |
|
918 } |
|
919 else |
|
920 { |
|
921 aItem->iNumberData = EAspSettingDisabled; // 0 |
|
922 } |
|
923 |
|
924 aItem->iResource = R_ASP_AUTO_SYNC_ROAMING_YESNO; |
|
925 aItem->SetValueL((*arr)[aItem->iNumberData]); |
|
926 aItem->iItemType = CAspListItemData::ETypeListYesNo; |
|
927 |
|
928 CleanupStack::PopAndDestroy(arr); |
|
929 break; |
|
930 } |
|
931 |
|
932 default: |
|
933 TUtil::Panic(KErrGeneral); |
|
934 break; |
|
935 |
|
936 |
|
937 } |
|
938 } |
|
939 |
|
940 |
|
941 // ---------------------------------------------------------------------------- |
|
942 // CAspScheduleDialog::SaveSettingsL |
|
943 // |
|
944 // ---------------------------------------------------------------------------- |
|
945 // |
|
946 void CAspScheduleDialog::SaveSettingsL() |
|
947 { |
|
948 iBuf = KNullDesC; // reset common buffer |
|
949 |
|
950 TInt count = iSettingList->Count(); |
|
951 |
|
952 if (iSettingEnforcement) |
|
953 { |
|
954 return; |
|
955 } |
|
956 |
|
957 for (TInt i=0; i<count; i++) |
|
958 { |
|
959 CAspListItemData* item = (*iSettingList)[i]; |
|
960 |
|
961 switch (item->iItemId) |
|
962 { |
|
963 case EAspAutoSyncProfile: |
|
964 { |
|
965 TInt oldProfile = iSchedule->ProfileId(); |
|
966 iSchedule->SetProfileId(item->iNumberData); |
|
967 if(oldProfile != iSchedule->ProfileId()) |
|
968 { |
|
969 iSchedule->SaveL(); //Saved values to be used in Update |
|
970 iSchedule->UpdateProfileSettingsL(); |
|
971 } |
|
972 break; |
|
973 } |
|
974 |
|
975 case EAspAutoSyncContents: |
|
976 break;//handled in EditSettingItemContentL |
|
977 case EAspAutoSyncFrequency: |
|
978 { |
|
979 iSchedule->SetSyncFrequency(item->iNumberData); |
|
980 if (iSchedule->IntervalType(item->iNumberData) == EDaily) |
|
981 { |
|
982 iSchedule->SetDailySyncEnabled(ETrue); |
|
983 } |
|
984 else |
|
985 { |
|
986 iSchedule->SetDailySyncEnabled(EFalse); |
|
987 } |
|
988 |
|
989 } |
|
990 case EAspAutoSyncPeakSchedule: |
|
991 { |
|
992 iSchedule->SetSyncPeakSchedule(item->iNumberData); |
|
993 if(item->iNumberData) |
|
994 { |
|
995 iSchedule->SetPeakSyncEnabled(ETrue); |
|
996 } |
|
997 else |
|
998 { |
|
999 iSchedule->SetPeakSyncEnabled(EFalse); |
|
1000 } |
|
1001 break; |
|
1002 } |
|
1003 case EAspAutoSyncOffPeakSchedule: |
|
1004 { |
|
1005 iSchedule->SetSyncOffPeakSchedule(item->iNumberData); |
|
1006 if(item->iNumberData) |
|
1007 { |
|
1008 iSchedule->SetOffPeakSyncEnabled(ETrue); |
|
1009 } |
|
1010 else |
|
1011 { |
|
1012 iSchedule->SetOffPeakSyncEnabled(EFalse); |
|
1013 } |
|
1014 break; |
|
1015 } |
|
1016 case EAspAutoSyncScheduleTime: |
|
1017 iSchedule->SetAutoSyncScheduleTime(item->iTime); |
|
1018 case EAspAutoSyncPeakStartTime: |
|
1019 iSchedule->SetStartPeakTime(item->iTime); |
|
1020 break; |
|
1021 case EAspAutoSyncPeakEndTime: |
|
1022 iSchedule->SetEndPeakTime(item->iTime); |
|
1023 break; |
|
1024 case EAspAutoSyncPeakDays: |
|
1025 break;//handled in EditSettingItemWeekdaysL |
|
1026 case EAspAutoSyncRoamingStatus: |
|
1027 iSchedule->SetRoamingAllowed(item->iNumberData); |
|
1028 break; |
|
1029 |
|
1030 default: |
|
1031 break; |
|
1032 } |
|
1033 } |
|
1034 |
|
1035 iSchedule->SaveL(); |
|
1036 } |
|
1037 |
|
1038 |
|
1039 //------------------------------------------------------------------------------ |
|
1040 // CAspScheduleDialog::EditSettingItemL |
|
1041 // |
|
1042 // Calls setting editing functions. |
|
1043 //------------------------------------------------------------------------------ |
|
1044 // |
|
1045 TBool CAspScheduleDialog::EditSettingItemL(CAspListItemData& aItem) |
|
1046 { |
|
1047 TInt ret = EFalse; |
|
1048 |
|
1049 switch (aItem.iItemType) |
|
1050 { |
|
1051 case CAspListItemData::ETypeText: |
|
1052 ret = EditSettingItemTextL(aItem); |
|
1053 break; |
|
1054 |
|
1055 case CAspListItemData::ETypeAutoSyncTime: |
|
1056 ret = EditSettingItemTimeL(aItem); |
|
1057 break; |
|
1058 |
|
1059 case CAspListItemData::ETypeAutoSyncFrequency: |
|
1060 ret = EditSettingItemSyncFrequencyL(aItem); |
|
1061 break; |
|
1062 |
|
1063 case CAspListItemData::ETypeAutoSyncPeakSchedule: |
|
1064 ret = EditSettingItemPeakScheduleL(aItem); |
|
1065 break; |
|
1066 |
|
1067 case CAspListItemData::ETypeAutoSyncOffPeakSchedule: |
|
1068 ret = EditSettingItemOffPeakScheduleL(aItem); |
|
1069 break; |
|
1070 |
|
1071 case CAspListItemData::ETypeAutoSyncProfile: |
|
1072 ret = EditSettingItemProfileL(aItem); |
|
1073 break; |
|
1074 |
|
1075 case CAspListItemData::ETypeAutoSyncContent: |
|
1076 ret = EditSettingItemContentL(aItem); |
|
1077 break; |
|
1078 |
|
1079 case CAspListItemData::ETypeAutoSyncDays: |
|
1080 ret = EditSettingItemWeekdaysL(aItem); |
|
1081 break; |
|
1082 |
|
1083 case CAspListItemData::ETypeListYesNo: |
|
1084 ret = EditSettingItemYesNoL(aItem); |
|
1085 break; |
|
1086 |
|
1087 default: |
|
1088 break; |
|
1089 } |
|
1090 |
|
1091 return ret; |
|
1092 } |
|
1093 |
|
1094 |
|
1095 //------------------------------------------------------------------------------ |
|
1096 // CAspScheduleDialog::EditSettingItemYesNoL |
|
1097 // |
|
1098 // Change Yes/No value without showing radio button editor. |
|
1099 //------------------------------------------------------------------------------ |
|
1100 // |
|
1101 TBool CAspScheduleDialog::EditSettingItemYesNoL(CAspListItemData& aItem) |
|
1102 { |
|
1103 CDesCArray* arr = iResHandler->ReadDesArrayLC(aItem.iResource); |
|
1104 |
|
1105 if (aItem.iNumberData == EAspSettingDisabled) |
|
1106 { |
|
1107 aItem.iNumberData = EAspSettingEnabled; |
|
1108 } |
|
1109 else |
|
1110 { |
|
1111 aItem.iNumberData = EAspSettingDisabled; |
|
1112 } |
|
1113 |
|
1114 |
|
1115 // store localized setting text (Yes/No) |
|
1116 aItem.SetValueL( (*arr)[aItem.iNumberData] ); |
|
1117 |
|
1118 CleanupStack::PopAndDestroy(arr); |
|
1119 return ETrue; |
|
1120 } |
|
1121 |
|
1122 |
|
1123 //------------------------------------------------------------------------------ |
|
1124 // CAspScheduleDialog::EditSettingItemNumberL |
|
1125 // |
|
1126 //------------------------------------------------------------------------------ |
|
1127 // |
|
1128 TBool CAspScheduleDialog::EditSettingItemNumberL(CAspListItemData& aItem) |
|
1129 { |
|
1130 TBool ret = TDialogUtil::ShowIntegerEditorL(aItem.iNumberData, aItem.Header(), |
|
1131 aItem.iMinValue, aItem.iMaxValue, aItem.iLatinInput); |
|
1132 |
|
1133 if (ret) |
|
1134 { |
|
1135 aItem.SetValueL(aItem.iNumberData); |
|
1136 } |
|
1137 |
|
1138 return ret; |
|
1139 } |
|
1140 |
|
1141 |
|
1142 //------------------------------------------------------------------------------ |
|
1143 // CAspScheduleDialog::EditSettingItemTextL |
|
1144 // |
|
1145 // Edit text setting item. |
|
1146 //------------------------------------------------------------------------------ |
|
1147 // |
|
1148 TBool CAspScheduleDialog::EditSettingItemTextL(CAspListItemData& aItem) |
|
1149 { |
|
1150 TUtil::StrCopy(iBuf, aItem.Value()); |
|
1151 |
|
1152 TBool ret = TDialogUtil::ShowTextEditorL(iBuf, aItem.Header(), |
|
1153 aItem.iMandatory, aItem.iLatinInput, aItem.iMaxLength); |
|
1154 if (ret) |
|
1155 { |
|
1156 aItem.SetValueL(iBuf); |
|
1157 } |
|
1158 |
|
1159 return ret; |
|
1160 } |
|
1161 |
|
1162 //------------------------------------------------------------------------------ |
|
1163 // CAspScheduleDialog::EditSettingItemSyncFrequencyL |
|
1164 // |
|
1165 //------------------------------------------------------------------------------ |
|
1166 // |
|
1167 TBool CAspScheduleDialog::EditSettingItemSyncFrequencyL(CAspListItemData& aItem) |
|
1168 { |
|
1169 CDesCArray* arr = GetSyncFrequencyListLC(); |
|
1170 TInt curSelection = GetSyncFrequencyPositionL(arr, aItem.iNumberData); |
|
1171 TBool ret = TDialogUtil::ShowListEditorL(arr, aItem.Header(), curSelection); |
|
1172 if (ret) |
|
1173 { |
|
1174 aItem.iNumberData = SyncFrequencyL((*arr)[curSelection]); |
|
1175 aItem.SetValueL((*arr)[curSelection]); |
|
1176 } |
|
1177 |
|
1178 if (iSchedule->IntervalType(aItem.iNumberData) == EDaily |
|
1179 || aItem.iNumberData == CAspSchedule::EIntervalManual) |
|
1180 { |
|
1181 Item(EAspAutoSyncPeakSchedule)->iNumberData = CAspSchedule::EIntervalManual; |
|
1182 GetPeakScheduleValueL(CAspSchedule::EIntervalManual, iBuf); |
|
1183 Item(EAspAutoSyncPeakSchedule)->SetValueL(iBuf); |
|
1184 Item(EAspAutoSyncOffPeakSchedule)->iNumberData = CAspSchedule::EIntervalManual; |
|
1185 GetPeakScheduleValueL(CAspSchedule::EIntervalManual, iBuf); |
|
1186 Item(EAspAutoSyncOffPeakSchedule)->SetValueL(iBuf); |
|
1187 } |
|
1188 |
|
1189 CleanupStack::PopAndDestroy(arr); |
|
1190 return ret; |
|
1191 } |
|
1192 |
|
1193 |
|
1194 |
|
1195 //------------------------------------------------------------------------------ |
|
1196 // CAspScheduleDialog::EditSettingItemPeakScheduleL |
|
1197 // |
|
1198 //------------------------------------------------------------------------------ |
|
1199 // |
|
1200 TBool CAspScheduleDialog::EditSettingItemPeakScheduleL(CAspListItemData& aItem) |
|
1201 { |
|
1202 |
|
1203 CDesCArray* arr = GetPeakScheduleListLC(); |
|
1204 |
|
1205 TInt curSelection = GetPeakPositionL(arr, aItem.iNumberData); |
|
1206 TBool ret = TDialogUtil::ShowListEditorL(arr, aItem.Header(), curSelection); |
|
1207 if (ret) |
|
1208 { |
|
1209 aItem.iNumberData = PeakScheduleL((*arr)[curSelection]); |
|
1210 aItem.SetValueL((*arr)[curSelection]); |
|
1211 } |
|
1212 |
|
1213 CleanupStack::PopAndDestroy(arr); |
|
1214 return ret; |
|
1215 } |
|
1216 |
|
1217 //------------------------------------------------------------------------------ |
|
1218 // CAspScheduleDialog::EditSettingItemOffPeakScheduleL |
|
1219 // |
|
1220 //------------------------------------------------------------------------------ |
|
1221 // |
|
1222 TBool CAspScheduleDialog::EditSettingItemOffPeakScheduleL(CAspListItemData& aItem) |
|
1223 { |
|
1224 |
|
1225 CDesCArray* arr = GetOffPeakScheduleListLC(); |
|
1226 |
|
1227 TInt curSelection = GetOffPeakPositionL(arr, aItem.iNumberData); |
|
1228 TBool ret = TDialogUtil::ShowListEditorL(arr, aItem.Header(), curSelection); |
|
1229 if (ret) |
|
1230 { |
|
1231 aItem.iNumberData = OffPeakScheduleL((*arr)[curSelection]); ; |
|
1232 aItem.SetValueL((*arr)[curSelection]); |
|
1233 } |
|
1234 |
|
1235 CleanupStack::PopAndDestroy(arr); |
|
1236 return ret; |
|
1237 } |
|
1238 |
|
1239 |
|
1240 //------------------------------------------------------------------------------ |
|
1241 // CAspScheduleDialog::EditSettingItemProfileL |
|
1242 // |
|
1243 //------------------------------------------------------------------------------ |
|
1244 // |
|
1245 TBool CAspScheduleDialog::EditSettingItemProfileL(CAspListItemData& aItem) |
|
1246 { |
|
1247 |
|
1248 TAspFilterInfo info; |
|
1249 info.iFilterType = TAspFilterInfo::EIncludeRemoteProfile; |
|
1250 CAspProfileList* remoteProfList = iProfileList->FilteredListL(info); |
|
1251 CleanupStack::PushL(remoteProfList); |
|
1252 |
|
1253 TInt asProfileId = iSchedule->AutoSyncProfileId(); |
|
1254 if(asProfileId != KErrNotFound) |
|
1255 { |
|
1256 remoteProfList->Remove(asProfileId); |
|
1257 } |
|
1258 TInt curSelection = remoteProfList->ListIndex(aItem.iNumberData); |
|
1259 TInt count = remoteProfList->Count(); |
|
1260 |
|
1261 CDesCArray* profileNames = new (ELeave) CDesCArrayFlat(KMaxProfileCount); |
|
1262 CleanupStack::PushL(profileNames); |
|
1263 for(TInt index = 0; index < count; ++index) |
|
1264 { |
|
1265 TAspProfileItem& item = remoteProfList->Item(index); |
|
1266 GetProfileName(item.iProfileId ,iBuf); |
|
1267 profileNames->AppendL(iBuf); |
|
1268 } |
|
1269 |
|
1270 TBool ret = TDialogUtil::ShowListEditorL(profileNames, aItem.Header(), curSelection); |
|
1271 |
|
1272 if (ret) |
|
1273 { |
|
1274 TAspProfileItem& item = remoteProfList->Item(curSelection); |
|
1275 aItem.iNumberData = item.iProfileId; |
|
1276 GetProfileName(item.iProfileId, iBuf); |
|
1277 aItem.SetValueL(iBuf); |
|
1278 |
|
1279 if (aItem.iNumberData != KErrNotFound) |
|
1280 { |
|
1281 CheckAccessPointSelectionL(aItem.iNumberData); |
|
1282 } |
|
1283 } |
|
1284 CleanupStack::PopAndDestroy(profileNames); |
|
1285 CleanupStack::PopAndDestroy(remoteProfList); |
|
1286 return ret; // ETrue or EFalse |
|
1287 } |
|
1288 |
|
1289 |
|
1290 //------------------------------------------------------------------------------ |
|
1291 // CAspScheduleDialog::EditSettingItemWeekdaysL |
|
1292 // |
|
1293 //------------------------------------------------------------------------------ |
|
1294 // |
|
1295 TBool CAspScheduleDialog::EditSettingItemWeekdaysL(CAspListItemData& aItem) |
|
1296 { |
|
1297 CAspSelectionItemList* list = new (ELeave) CAspSelectionItemList(1); |
|
1298 CleanupStack::PushL(TCleanupItem(CAspSelectionItemList::Cleanup, list)); |
|
1299 |
|
1300 GetWeekdaySelectionL(list); |
|
1301 |
|
1302 CAknCheckBoxSettingPage* dlg = new (ELeave) CAknCheckBoxSettingPage( |
|
1303 R_ASP_MULTI_SELECTION_LIST, list); |
|
1304 |
|
1305 CleanupStack::PushL(dlg); |
|
1306 dlg->SetSettingTextL(aItem.Header()); |
|
1307 CleanupStack::Pop(dlg); |
|
1308 |
|
1309 TBool ret = dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged); |
|
1310 |
|
1311 if (ret) |
|
1312 { |
|
1313 SetWeekdaySelectionL(list); |
|
1314 GetWeekdayNameL(iBuf); |
|
1315 aItem.SetValueL(iBuf); |
|
1316 } |
|
1317 |
|
1318 CleanupStack::PopAndDestroy(list); |
|
1319 |
|
1320 return ret; |
|
1321 } |
|
1322 |
|
1323 |
|
1324 //------------------------------------------------------------------------------ |
|
1325 // CAspScheduleDialog::EditSettingItemTimeL |
|
1326 // |
|
1327 //------------------------------------------------------------------------------ |
|
1328 // |
|
1329 // |
|
1330 TBool CAspScheduleDialog::EditSettingItemTimeL(CAspListItemData& aItem) |
|
1331 { |
|
1332 |
|
1333 TBool ret = TDialogUtil::ShowTimeEditorL(aItem.iTime, aItem.Header()); |
|
1334 |
|
1335 if (ret) |
|
1336 { |
|
1337 GetTimeTextL(iBuf, aItem.iTime); |
|
1338 aItem.SetValueL(iBuf); |
|
1339 } |
|
1340 |
|
1341 return ret; |
|
1342 } |
|
1343 |
|
1344 //------------------------------------------------------------------------------ |
|
1345 // CAspScheduleDialog::EditSettingItemContentL |
|
1346 // |
|
1347 //------------------------------------------------------------------------------ |
|
1348 // |
|
1349 // |
|
1350 TBool CAspScheduleDialog::EditSettingItemContentL(CAspListItemData& aItem) |
|
1351 { |
|
1352 |
|
1353 CAspSelectionItemList* list = new (ELeave) CAspSelectionItemList(1); |
|
1354 CleanupStack::PushL(TCleanupItem(CAspSelectionItemList::Cleanup, list)); |
|
1355 |
|
1356 TInt emailIndex = iContentList->FindProviderIndex(KUidNSmlAdapterEMail.iUid); |
|
1357 if (!iSchedule->MailboxExistL()) |
|
1358 { |
|
1359 iSchedule->SetContentEnabled(emailIndex, EFalse); |
|
1360 } |
|
1361 |
|
1362 TInt profileId = Item(EAspAutoSyncProfile)->iNumberData; |
|
1363 if (profileId != KErrNotFound) |
|
1364 { |
|
1365 TAspParam param(iApplicationId, iSyncSession); |
|
1366 |
|
1367 CAspProfile* profile = CAspProfile::NewLC(param); |
|
1368 profile->OpenL(profileId, CAspProfile::EOpenRead, |
|
1369 CAspProfile::EBaseProperties); |
|
1370 TInt protocol = profile->ProtocolVersion(); |
|
1371 CleanupStack::PopAndDestroy(profile); |
|
1372 if (protocol == EAspProtocol_1_1) |
|
1373 { |
|
1374 iSchedule->SetContentEnabled(emailIndex, EFalse); |
|
1375 } |
|
1376 } |
|
1377 GetContentSelectionL(list); |
|
1378 |
|
1379 //CAknCheckBoxSettingPage* dlg = new (ELeave) CAknCheckBoxSettingPage( |
|
1380 // R_ASP_MULTI_SELECTION_LIST, list); |
|
1381 |
|
1382 TAutoSyncSettingPageParam param; |
|
1383 param.iCommandId = EAknSoftkeyUnmark; |
|
1384 |
|
1385 param.iObserver = this; |
|
1386 |
|
1387 |
|
1388 CAutoSyncCheckBoxSettingPage* dlg = new (ELeave) CAutoSyncCheckBoxSettingPage( |
|
1389 R_ASP_MULTI_SELECTION_LIST, list, param); |
|
1390 |
|
1391 |
|
1392 CleanupStack::PushL(dlg); |
|
1393 dlg->SetSettingTextL(aItem.Header()); |
|
1394 |
|
1395 CleanupStack::Pop(dlg); |
|
1396 |
|
1397 TBool ret = dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged); |
|
1398 |
|
1399 if (ret) |
|
1400 { |
|
1401 SetContentSelectionL(list); |
|
1402 GetContentsNameL(iBuf); |
|
1403 aItem.SetValueL(iBuf); |
|
1404 } |
|
1405 |
|
1406 CleanupStack::PopAndDestroy(list); |
|
1407 |
|
1408 return ret; |
|
1409 |
|
1410 } |
|
1411 |
|
1412 |
|
1413 //------------------------------------------------------------------------------ |
|
1414 // CAspScheduleDialog::CheckAccessPointSelection |
|
1415 // Check if the selected profile has valid access point |
|
1416 //------------------------------------------------------------------------------ |
|
1417 // |
|
1418 void CAspScheduleDialog::CheckAccessPointSelectionL(TInt aProfileId) |
|
1419 { |
|
1420 |
|
1421 CAspProfile* profile = NULL; |
|
1422 TAspParam param(iApplicationId, iSyncSession); |
|
1423 TBool doCleanUp = EFalse; |
|
1424 |
|
1425 if (iProfile && aProfileId == iProfile->ProfileId())//setting view opened & selected same profile |
|
1426 { |
|
1427 profile = iProfile; |
|
1428 } |
|
1429 else |
|
1430 { |
|
1431 profile = CAspProfile::NewLC(param);//Automatic sync menu opened |
|
1432 TRAPD(err, profile->OpenL(aProfileId, CAspProfile::EOpenReadWrite, |
|
1433 CAspProfile::EAllProperties)); |
|
1434 if (err == KErrLocked) |
|
1435 { |
|
1436 CleanupStack::PopAndDestroy(profile); |
|
1437 TDialogUtil::ShowErrorNoteL(R_ASP_LOCKED_PROFILE); |
|
1438 return; |
|
1439 } |
|
1440 doCleanUp = ETrue; |
|
1441 } |
|
1442 |
|
1443 TInt accessPoint = profile->AccessPointL(); |
|
1444 TAspAccessPointItem item; |
|
1445 item.iUid = accessPoint; |
|
1446 CAspAccessPointHandler* apHandler = CAspAccessPointHandler::NewL(param); |
|
1447 CleanupStack::PushL(apHandler); |
|
1448 |
|
1449 TInt ret = apHandler->GetInternetApInfo(item); |
|
1450 if (ret == KErrNone) |
|
1451 { |
|
1452 CleanupStack::PopAndDestroy(apHandler); |
|
1453 if (doCleanUp) |
|
1454 { |
|
1455 CleanupStack::PopAndDestroy(profile); |
|
1456 } |
|
1457 return; |
|
1458 } |
|
1459 RCmManager cmmgr; |
|
1460 cmmgr.OpenL(); |
|
1461 TCmDefConnValue defConnValue; |
|
1462 cmmgr.ReadDefConnL(defConnValue); |
|
1463 cmmgr.Close(); |
|
1464 if(defConnValue.iType == ECmDefConnDestination) |
|
1465 { |
|
1466 CleanupStack::PopAndDestroy(apHandler); |
|
1467 if (doCleanUp) |
|
1468 { |
|
1469 CleanupStack::PopAndDestroy(profile); |
|
1470 } |
|
1471 return; |
|
1472 } |
|
1473 |
|
1474 HBufC* hBuf = CAspResHandler::ReadLC(R_ASP_QUERY_IAP_NO_ASK_ALWAYS); |
|
1475 if (!TDialogUtil::ShowConfirmationQueryL(hBuf->Des())) |
|
1476 { |
|
1477 CleanupStack::PopAndDestroy(hBuf); |
|
1478 CleanupStack::PopAndDestroy(apHandler); |
|
1479 if (doCleanUp) |
|
1480 { |
|
1481 CleanupStack::PopAndDestroy(profile); |
|
1482 } |
|
1483 return ;// user selected "Always ask" option |
|
1484 } |
|
1485 else |
|
1486 { |
|
1487 item.iUid2 = accessPoint; |
|
1488 TInt ret = apHandler->ShowApSelectDialogL(item); |
|
1489 |
|
1490 if (ret == CAspAccessPointHandler::EAspDialogSelect) |
|
1491 { |
|
1492 profile->SetAccessPointL(item.iUid); |
|
1493 profile->Save(); |
|
1494 } |
|
1495 } |
|
1496 |
|
1497 CleanupStack::PopAndDestroy(hBuf); |
|
1498 CleanupStack::PopAndDestroy(apHandler); |
|
1499 |
|
1500 if (doCleanUp) |
|
1501 { |
|
1502 CleanupStack::PopAndDestroy(profile); |
|
1503 } |
|
1504 return; |
|
1505 } |
|
1506 |
|
1507 |
|
1508 //------------------------------------------------------------------------------ |
|
1509 // CAspScheduleDialog::GetProfileName |
|
1510 // |
|
1511 //------------------------------------------------------------------------------ |
|
1512 // |
|
1513 void CAspScheduleDialog::GetProfileName(TInt& aProfileId, TDes& aText) |
|
1514 { |
|
1515 aText = KNullDesC; |
|
1516 |
|
1517 TInt index = iProfileList->ListIndex(aProfileId); |
|
1518 |
|
1519 if (index == KErrNotFound) |
|
1520 { |
|
1521 aProfileId = KErrNotFound; |
|
1522 return; // profile does not exist |
|
1523 } |
|
1524 |
|
1525 TAspProfileItem& item = iProfileList->Item(index); |
|
1526 aText = item.iProfileName; |
|
1527 } |
|
1528 |
|
1529 |
|
1530 //------------------------------------------------------------------------------ |
|
1531 // CAspScheduleDialog::GetWeekdayNameL |
|
1532 // |
|
1533 //------------------------------------------------------------------------------ |
|
1534 // |
|
1535 void CAspScheduleDialog::GetWeekdayNameL(TDes& aText) |
|
1536 { |
|
1537 const TInt KWeekdayCount = ESunday + 1; |
|
1538 |
|
1539 aText = KNullDesC; |
|
1540 |
|
1541 TInt selectedDayCount = 0; |
|
1542 TInt selectedDayIndex = 0; |
|
1543 |
|
1544 iSchedule->SelectedDayInfo(selectedDayCount, selectedDayIndex); |
|
1545 |
|
1546 if (selectedDayCount == 1) |
|
1547 { |
|
1548 aText = (*iWeekdayList)[selectedDayIndex]; |
|
1549 } |
|
1550 else if (selectedDayCount == KWeekdayCount) |
|
1551 { |
|
1552 CAspResHandler::ReadL(aText, R_ASP_SETT_AUTO_SYNC_ALL_DAYS); |
|
1553 } |
|
1554 else if (selectedDayCount > 1) |
|
1555 { |
|
1556 CAspResHandler::ReadL(aText, R_ASP_SETT_AUTO_SYNC_SEL_DAYS); |
|
1557 } |
|
1558 } |
|
1559 |
|
1560 |
|
1561 //------------------------------------------------------------------------------ |
|
1562 // CAspScheduleDialog::GetWeekdaySelectionL |
|
1563 // |
|
1564 //------------------------------------------------------------------------------ |
|
1565 // |
|
1566 void CAspScheduleDialog::GetWeekdaySelectionL(CSelectionItemList* aList) |
|
1567 { |
|
1568 for (TInt i=EMonday; i<=ESunday; i++) |
|
1569 { |
|
1570 TBuf<KBufSize> buf((*iWeekdayList)[i]); |
|
1571 TBool enabled = iSchedule->WeekdayEnabled(i); |
|
1572 |
|
1573 CSelectableItem* selectableItem = |
|
1574 new (ELeave) CSelectableItem(buf, enabled); |
|
1575 |
|
1576 CleanupStack::PushL(selectableItem); |
|
1577 selectableItem->ConstructL(); |
|
1578 aList->AppendL(selectableItem); |
|
1579 CleanupStack::Pop(selectableItem); |
|
1580 } |
|
1581 } |
|
1582 |
|
1583 |
|
1584 //------------------------------------------------------------------------------ |
|
1585 // CAspScheduleDialog::SetWeekdaySelectionL |
|
1586 // |
|
1587 //------------------------------------------------------------------------------ |
|
1588 // |
|
1589 void CAspScheduleDialog::SetWeekdaySelectionL(CSelectionItemList* aList) |
|
1590 { |
|
1591 TInt count = aList->Count(); |
|
1592 |
|
1593 __ASSERT_DEBUG(count == ESunday + 1, TUtil::Panic(KErrGeneral)); |
|
1594 |
|
1595 for (TInt i=0; i<count; i++) |
|
1596 { |
|
1597 CSelectableItem* selectableItem = (*aList)[i]; |
|
1598 TBool selected = selectableItem->SelectionStatus(); |
|
1599 iSchedule->SetWeekdayEnabled(i, selected); |
|
1600 } |
|
1601 } |
|
1602 |
|
1603 //------------------------------------------------------------------------------ |
|
1604 // CAspScheduleDialog::SetDefaultdaySelectionL |
|
1605 // |
|
1606 //------------------------------------------------------------------------------ |
|
1607 // |
|
1608 void CAspScheduleDialog::SetDefaultdaySelectionL() |
|
1609 { |
|
1610 iSchedule->SetWeekdayEnabled(EMonday, ETrue); |
|
1611 iSchedule->SetWeekdayEnabled(ETuesday, ETrue); |
|
1612 iSchedule->SetWeekdayEnabled(EWednesday, ETrue); |
|
1613 iSchedule->SetWeekdayEnabled(EThursday, ETrue); |
|
1614 iSchedule->SetWeekdayEnabled(EFriday, ETrue); |
|
1615 iSchedule->SetWeekdayEnabled(ESaturday, EFalse); |
|
1616 iSchedule->SetWeekdayEnabled(ESunday, EFalse); |
|
1617 } |
|
1618 |
|
1619 //----------------------------------------------------------------------------- |
|
1620 // CAspScheduleDialog::GetItemForIndex |
|
1621 // |
|
1622 // Find item in list position aIndex. |
|
1623 //----------------------------------------------------------------------------- |
|
1624 // |
|
1625 CAspListItemData* CAspScheduleDialog::GetItemForIndex(TInt aIndex) |
|
1626 { |
|
1627 CAspListItemData* item = NULL; |
|
1628 |
|
1629 TInt count = iSettingList->Count(); |
|
1630 for (TInt i=0; i<count; i++) |
|
1631 { |
|
1632 CAspListItemData* temp = (*iSettingList)[i]; |
|
1633 if (temp->iIndex == aIndex) |
|
1634 { |
|
1635 item = temp; |
|
1636 break; |
|
1637 } |
|
1638 } |
|
1639 |
|
1640 __ASSERT_ALWAYS(item, TUtil::Panic(KErrGeneral)); |
|
1641 |
|
1642 return item; |
|
1643 } |
|
1644 |
|
1645 |
|
1646 //----------------------------------------------------------------------------- |
|
1647 // CAspScheduleDialog::Item |
|
1648 // |
|
1649 // Find item with aItemId (TAspConnectionSettingItem). |
|
1650 //----------------------------------------------------------------------------- |
|
1651 // |
|
1652 CAspListItemData* CAspScheduleDialog::Item(TInt aItemId) |
|
1653 { |
|
1654 CAspListItemData* item = NULL; |
|
1655 |
|
1656 TInt count = iSettingList->Count(); |
|
1657 for (TInt i=0; i<count; i++) |
|
1658 { |
|
1659 CAspListItemData* temp = (*iSettingList)[i]; |
|
1660 if (temp->iItemId == aItemId) |
|
1661 { |
|
1662 item = temp; |
|
1663 break; |
|
1664 } |
|
1665 } |
|
1666 |
|
1667 __ASSERT_ALWAYS(item, TUtil::Panic(KErrGeneral)); |
|
1668 |
|
1669 return item; |
|
1670 } |
|
1671 |
|
1672 |
|
1673 // ----------------------------------------------------------------------------- |
|
1674 // CAspScheduleDialog::GetTimeTextL |
|
1675 // |
|
1676 // ----------------------------------------------------------------------------- |
|
1677 // |
|
1678 void CAspScheduleDialog::GetTimeTextL(TDes& aText, TTime aTime) |
|
1679 { |
|
1680 HBufC* hBuf = CAspResHandler::ReadLC(R_QTN_TIME_USUAL_WITH_ZERO); |
|
1681 aTime.FormatL(aText, *hBuf); |
|
1682 CleanupStack::PopAndDestroy(hBuf); |
|
1683 } |
|
1684 |
|
1685 //------------------------------------------------------------------------------ |
|
1686 // CAspScheduleDialog::GetContentsNameL |
|
1687 // |
|
1688 //------------------------------------------------------------------------------ |
|
1689 // |
|
1690 void CAspScheduleDialog::GetContentsNameL(TDes& aText) |
|
1691 { |
|
1692 |
|
1693 TInt contentCount = iContentList->ProviderCount(); |
|
1694 |
|
1695 aText = KNullDesC; |
|
1696 |
|
1697 TInt selectedContentCnt = 0; |
|
1698 TInt selectedContentIndex = 0; |
|
1699 |
|
1700 iSchedule->ContentSelectionInfo(selectedContentCnt, selectedContentIndex); |
|
1701 |
|
1702 if (selectedContentCnt == contentCount) |
|
1703 { |
|
1704 CAspResHandler::ReadL(aText, R_ASP_SETT_VALUE_ALL_CONTENTS); |
|
1705 } |
|
1706 else if (selectedContentCnt > 0) |
|
1707 { |
|
1708 CAspResHandler::ReadL(aText, R_ASP_SETT_VALUE_SELECTED_CONTENTS); |
|
1709 } |
|
1710 } |
|
1711 |
|
1712 |
|
1713 |
|
1714 //------------------------------------------------------------------------------ |
|
1715 // CAspScheduleDialog::GetContentSelectionL |
|
1716 // Get selected contents |
|
1717 //------------------------------------------------------------------------------ |
|
1718 // |
|
1719 |
|
1720 void CAspScheduleDialog::GetContentSelectionL(CSelectionItemList* aList) |
|
1721 { |
|
1722 |
|
1723 TInt providerCount = iContentList->ProviderCount(); |
|
1724 |
|
1725 CreateContentListL(); |
|
1726 for (TInt index = 0; index < providerCount; index++) |
|
1727 { |
|
1728 TBuf<KBufSize> buf((*iContentsList)[index]); |
|
1729 TBool enabled = iSchedule->ContentEnabled(index); |
|
1730 |
|
1731 CSelectableItem* selectableItem = |
|
1732 new (ELeave) CSelectableItem(buf, enabled); |
|
1733 |
|
1734 CleanupStack::PushL(selectableItem); |
|
1735 selectableItem->ConstructL(); |
|
1736 aList->AppendL(selectableItem); |
|
1737 CleanupStack::Pop(selectableItem); |
|
1738 } |
|
1739 } |
|
1740 |
|
1741 //------------------------------------------------------------------------------ |
|
1742 // CAspScheduleDialog::CreateContentList |
|
1743 // |
|
1744 //------------------------------------------------------------------------------ |
|
1745 // |
|
1746 void CAspScheduleDialog::CreateContentListL() |
|
1747 { |
|
1748 |
|
1749 TInt providerCount = iContentList->ProviderCount(); |
|
1750 |
|
1751 for (TInt index = 0; index < providerCount; index++) |
|
1752 { |
|
1753 HBufC* name = NULL; |
|
1754 TAspProviderItem& provider = iContentList->ProviderItem(index); |
|
1755 name = CAspResHandler::GetContentNameLC( |
|
1756 provider.iDataProviderId, provider.iDisplayName); |
|
1757 //iContentsList->AppendL(provider.iDisplayName); |
|
1758 iContentsList->AppendL(*name); |
|
1759 CleanupStack::PopAndDestroy();//name |
|
1760 } |
|
1761 } |
|
1762 |
|
1763 |
|
1764 //------------------------------------------------------------------------------ |
|
1765 // CAspScheduleDialog::SetDefaultContentL |
|
1766 // Set default content selection |
|
1767 //------------------------------------------------------------------------------ |
|
1768 // |
|
1769 void CAspScheduleDialog::SetDefaultContentL() |
|
1770 { |
|
1771 |
|
1772 TInt providerCount = iContentList->ProviderCount(); |
|
1773 |
|
1774 for (TInt index = 0; index < providerCount; index++) |
|
1775 { |
|
1776 TAspProviderItem& provider = iContentList->ProviderItem(index); |
|
1777 |
|
1778 if (provider.iDataProviderId == KUidNSmlAdapterEMail.iUid) |
|
1779 { |
|
1780 if (iSchedule->MailboxExistL()) |
|
1781 { |
|
1782 iSchedule->SetContentEnabled(index, ETrue); |
|
1783 } |
|
1784 else |
|
1785 { |
|
1786 iSchedule->SetContentEnabled(index, EFalse); |
|
1787 } |
|
1788 |
|
1789 if (iSchedule->ProfileId() != KErrNotFound |
|
1790 && !iSchedule->ProtocolL()) |
|
1791 { |
|
1792 iSchedule->SetContentEnabled(index, EFalse); |
|
1793 } |
|
1794 } |
|
1795 else |
|
1796 { |
|
1797 iSchedule->SetContentEnabled(index, ETrue); |
|
1798 } |
|
1799 } |
|
1800 |
|
1801 } |
|
1802 |
|
1803 //------------------------------------------------------------------------------ |
|
1804 // CAspScheduleDialog::SetContentSelectionL |
|
1805 // Set selected contents |
|
1806 //------------------------------------------------------------------------------ |
|
1807 // |
|
1808 |
|
1809 void CAspScheduleDialog::SetContentSelectionL(CSelectionItemList* aList) |
|
1810 { |
|
1811 |
|
1812 TInt count = aList->Count(); |
|
1813 |
|
1814 for (TInt i=0; i<count; i++) |
|
1815 { |
|
1816 CSelectableItem* selectableItem = (*aList)[i]; |
|
1817 TBool selected = selectableItem->SelectionStatus(); |
|
1818 iSchedule->SetContentEnabled(i, selected); |
|
1819 } |
|
1820 |
|
1821 } |
|
1822 |
|
1823 //------------------------------------------------------------------------------ |
|
1824 // CAspScheduleDialog::GetSyncFrequencyListLC |
|
1825 // |
|
1826 //------------------------------------------------------------------------------ |
|
1827 // |
|
1828 |
|
1829 CDesCArray* CAspScheduleDialog::GetSyncFrequencyListLC() |
|
1830 { |
|
1831 const TInt KScheduleCount = 5; |
|
1832 CDesCArray* scheduleList = new (ELeave) CDesCArrayFlat(KScheduleCount); |
|
1833 CleanupStack::PushL(scheduleList); |
|
1834 |
|
1835 GetSyncFrequencyValueL(CAspSchedule::EIntervalManual, iBuf); |
|
1836 scheduleList->AppendL(iBuf); |
|
1837 |
|
1838 GetSyncFrequencyValueL(CAspSchedule::EManyTimesPerDay, iBuf); |
|
1839 scheduleList->AppendL(iBuf); |
|
1840 |
|
1841 GetSyncFrequencyValueL(CAspSchedule::EInterval24hours, iBuf); |
|
1842 scheduleList->AppendL(iBuf); |
|
1843 |
|
1844 TInt keyVal; |
|
1845 TRAPD (err ,ReadRepositoryL(EKeySyncFrequency, keyVal)); |
|
1846 if (err == KErrNone) |
|
1847 { |
|
1848 TUint mask = 1; |
|
1849 for(TInt schedule = 0; schedule < KScheduleCount; ++schedule) |
|
1850 { |
|
1851 TInt offsetSyncFreq = 10; |
|
1852 if (mask & keyVal) |
|
1853 { |
|
1854 offsetSyncFreq +=schedule; |
|
1855 GetSyncFrequencyValueL(offsetSyncFreq ,iBuf); |
|
1856 scheduleList->AppendL(iBuf); |
|
1857 } |
|
1858 mask = mask << 1; |
|
1859 } |
|
1860 } |
|
1861 else |
|
1862 { |
|
1863 //defualt items in the list |
|
1864 |
|
1865 GetSyncFrequencyValueL(CAspSchedule::EInterval2days, iBuf); |
|
1866 scheduleList->AppendL(iBuf); |
|
1867 |
|
1868 GetSyncFrequencyValueL(CAspSchedule::EInterval7days, iBuf); |
|
1869 scheduleList->AppendL(iBuf); |
|
1870 |
|
1871 GetSyncFrequencyValueL(CAspSchedule::EInterval30days, iBuf); |
|
1872 scheduleList->AppendL(iBuf); |
|
1873 |
|
1874 } |
|
1875 return scheduleList; |
|
1876 |
|
1877 } |
|
1878 |
|
1879 //------------------------------------------------------------------------------ |
|
1880 // CAspScheduleDialog::GetSyncFrequencyValueL |
|
1881 // |
|
1882 //------------------------------------------------------------------------------ |
|
1883 // |
|
1884 |
|
1885 void CAspScheduleDialog::GetSyncFrequencyValueL(TInt schedule, TDes& aBuf) |
|
1886 { |
|
1887 aBuf = KNullDesC; |
|
1888 |
|
1889 switch(schedule) |
|
1890 { |
|
1891 case CAspSchedule::EIntervalManual: |
|
1892 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_SYNC_FREQ_VALUE_MANUAL); |
|
1893 break; |
|
1894 case CAspSchedule::EInterval24hours: |
|
1895 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_24_HOURS); |
|
1896 break; |
|
1897 case CAspSchedule::EInterval2days: |
|
1898 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_2_DAYS); |
|
1899 break; |
|
1900 case CAspSchedule::EInterval4days: |
|
1901 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_4_DAYS); |
|
1902 break; |
|
1903 case CAspSchedule::EInterval7days: |
|
1904 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_7_DAYS); |
|
1905 break; |
|
1906 case CAspSchedule::EInterval14days: |
|
1907 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_14_DAYS); |
|
1908 break; |
|
1909 case CAspSchedule::EInterval30days: |
|
1910 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_30_DAYS); |
|
1911 break; |
|
1912 case CAspSchedule::EManyTimesPerDay: |
|
1913 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_SYNC_FREQ_MANY_A_DAY); |
|
1914 break; |
|
1915 |
|
1916 default: |
|
1917 break; |
|
1918 } |
|
1919 |
|
1920 } |
|
1921 |
|
1922 // ---------------------------------------------------------------------------- |
|
1923 // CAspScheduleDialog::PeakSchedule |
|
1924 // Get sync frequency number from string |
|
1925 // ---------------------------------------------------------------------------- |
|
1926 // |
|
1927 TInt CAspScheduleDialog::SyncFrequencyL(const TDesC& aBuf) |
|
1928 { |
|
1929 |
|
1930 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_SYNC_FREQ_VALUE_MANUAL); |
|
1931 if(iBuf.Compare(aBuf) == 0) |
|
1932 { |
|
1933 return CAspSchedule::EIntervalManual; |
|
1934 } |
|
1935 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_SYNC_FREQ_MANY_A_DAY); |
|
1936 if(iBuf.Compare(aBuf) == 0) |
|
1937 { |
|
1938 return CAspSchedule::EManyTimesPerDay; |
|
1939 } |
|
1940 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_24_HOURS); |
|
1941 if(iBuf.Compare(aBuf) == 0) |
|
1942 { |
|
1943 return CAspSchedule::EInterval24hours; |
|
1944 } |
|
1945 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_2_DAYS); |
|
1946 if(iBuf.Compare(aBuf) == 0) |
|
1947 { |
|
1948 return CAspSchedule::EInterval2days; |
|
1949 } |
|
1950 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_4_DAYS); |
|
1951 if(iBuf.Compare(aBuf) == 0) |
|
1952 { |
|
1953 return CAspSchedule::EInterval4days; |
|
1954 } |
|
1955 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_7_DAYS); |
|
1956 if(iBuf.Compare(aBuf) == 0) |
|
1957 { |
|
1958 return CAspSchedule::EInterval7days; |
|
1959 } |
|
1960 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_14_DAYS); |
|
1961 if(iBuf.Compare(aBuf) == 0) |
|
1962 { |
|
1963 return CAspSchedule::EInterval14days; |
|
1964 } |
|
1965 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_30_DAYS); |
|
1966 if(iBuf.Compare(aBuf) == 0) |
|
1967 { |
|
1968 return CAspSchedule::EInterval30days; |
|
1969 } |
|
1970 |
|
1971 |
|
1972 return KErrNotFound; |
|
1973 } |
|
1974 |
|
1975 // ---------------------------------------------------------------------------- |
|
1976 // CAspScheduleDialog::GetSyncFrequencyPositionL |
|
1977 // Get position of selected interval from the interval list |
|
1978 // ---------------------------------------------------------------------------- |
|
1979 // |
|
1980 TInt CAspScheduleDialog::GetSyncFrequencyPositionL(CDesCArray* arr, TInt aInterval) |
|
1981 { |
|
1982 const TInt KScheduleCount = 8; |
|
1983 for (TInt i=0; i < KScheduleCount; i++) |
|
1984 { |
|
1985 if(aInterval == SyncFrequencyL((*arr)[i])) |
|
1986 return i; |
|
1987 } |
|
1988 return KErrNotFound; |
|
1989 |
|
1990 } |
|
1991 |
|
1992 //------------------------------------------------------------------------------ |
|
1993 // CAspScheduleDialog::GetPeakScheduleListLC |
|
1994 // |
|
1995 //------------------------------------------------------------------------------ |
|
1996 // |
|
1997 |
|
1998 CDesCArray* CAspScheduleDialog::GetPeakScheduleListLC() |
|
1999 { |
|
2000 const TInt KScheduleCount = 7; |
|
2001 CDesCArray* scheduleList = new (ELeave) CDesCArrayFlat(KScheduleCount); |
|
2002 CleanupStack::PushL(scheduleList); |
|
2003 |
|
2004 GetPeakScheduleValueL(CAspSchedule::EIntervalManual, iBuf); |
|
2005 scheduleList->AppendL(iBuf); |
|
2006 |
|
2007 TInt keyVal; |
|
2008 TRAPD (err, ReadRepositoryL(EKeyPeakSyncInterval, keyVal)); |
|
2009 if (err == KErrNone) |
|
2010 { |
|
2011 TUint mask = 1; |
|
2012 for(TInt schedule = 1; schedule <= KScheduleCount; ++schedule) |
|
2013 { |
|
2014 if (mask & keyVal) |
|
2015 { |
|
2016 GetPeakScheduleValueL(schedule ,iBuf); |
|
2017 scheduleList->AppendL(iBuf); |
|
2018 } |
|
2019 mask = mask << 1; |
|
2020 } |
|
2021 } |
|
2022 else |
|
2023 { |
|
2024 GetPeakScheduleValueL(CAspSchedule::EInterval15Mins, iBuf); |
|
2025 scheduleList->AppendL(iBuf); |
|
2026 |
|
2027 GetPeakScheduleValueL(CAspSchedule::EInterval1hour, iBuf); |
|
2028 scheduleList->AppendL(iBuf); |
|
2029 |
|
2030 GetPeakScheduleValueL(CAspSchedule::EInterval2hours, iBuf); |
|
2031 scheduleList->AppendL(iBuf); |
|
2032 |
|
2033 GetPeakScheduleValueL(CAspSchedule::EInterval4hours, iBuf); |
|
2034 scheduleList->AppendL(iBuf); |
|
2035 |
|
2036 GetPeakScheduleValueL(CAspSchedule::EInterval12hours, iBuf); |
|
2037 scheduleList->AppendL(iBuf); |
|
2038 } |
|
2039 return scheduleList; |
|
2040 |
|
2041 } |
|
2042 //------------------------------------------------------------------------------ |
|
2043 // CAspScheduleDialog::GetPeakScheduleValueL |
|
2044 // |
|
2045 //------------------------------------------------------------------------------ |
|
2046 // |
|
2047 |
|
2048 void CAspScheduleDialog::GetPeakScheduleValueL(TInt schedule, TDes& aBuf) |
|
2049 { |
|
2050 aBuf = KNullDesC; |
|
2051 |
|
2052 switch(schedule) |
|
2053 { |
|
2054 case CAspSchedule::EIntervalManual: |
|
2055 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_MANUAL); |
|
2056 break; |
|
2057 case CAspSchedule::EInterval15Mins: |
|
2058 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_15_MINS); |
|
2059 break; |
|
2060 case CAspSchedule::EInterval30Mins: |
|
2061 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_30_MINS); |
|
2062 break; |
|
2063 case CAspSchedule::EInterval1hour: |
|
2064 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_1_HOUR); |
|
2065 break; |
|
2066 case CAspSchedule::EInterval2hours: |
|
2067 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_2_HOURS); |
|
2068 break; |
|
2069 case CAspSchedule::EInterval4hours: |
|
2070 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_4_HOURS); |
|
2071 break; |
|
2072 case CAspSchedule::EInterval8hours: |
|
2073 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_8_HOURS); |
|
2074 break; |
|
2075 case CAspSchedule::EInterval12hours: |
|
2076 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_12_HOURS); |
|
2077 break; |
|
2078 |
|
2079 default: |
|
2080 break; |
|
2081 } |
|
2082 |
|
2083 } |
|
2084 |
|
2085 //------------------------------------------------------------------------------ |
|
2086 // CAspScheduleDialog::GetOffPeakScheduleListLC |
|
2087 // |
|
2088 //------------------------------------------------------------------------------ |
|
2089 // |
|
2090 |
|
2091 CDesCArray* CAspScheduleDialog::GetOffPeakScheduleListLC() |
|
2092 { |
|
2093 const TInt KScheduleCount = 7; |
|
2094 CDesCArray* scheduleList = new (ELeave) CDesCArrayFlat(KScheduleCount); |
|
2095 CleanupStack::PushL(scheduleList); |
|
2096 |
|
2097 GetOffPeakScheduleValueL(CAspSchedule::EIntervalManual, iBuf); |
|
2098 scheduleList->AppendL(iBuf); |
|
2099 |
|
2100 TInt keyVal; |
|
2101 TRAPD (err, ReadRepositoryL(EKeyOffPeakSyncInterval, keyVal)); |
|
2102 if (err == KErrNone) |
|
2103 { |
|
2104 TUint mask = 1; |
|
2105 for(TInt schedule = 1; schedule <= KScheduleCount; ++schedule) |
|
2106 { |
|
2107 if (mask & keyVal) |
|
2108 { |
|
2109 GetOffPeakScheduleValueL(schedule ,iBuf); |
|
2110 scheduleList->AppendL(iBuf); |
|
2111 } |
|
2112 mask = mask << 1; |
|
2113 } |
|
2114 } |
|
2115 else |
|
2116 { |
|
2117 GetOffPeakScheduleValueL(CAspSchedule::EInterval15Mins, iBuf); |
|
2118 scheduleList->AppendL(iBuf); |
|
2119 |
|
2120 GetOffPeakScheduleValueL(CAspSchedule::EInterval1hour, iBuf); |
|
2121 scheduleList->AppendL(iBuf); |
|
2122 |
|
2123 GetOffPeakScheduleValueL(CAspSchedule::EInterval2hours, iBuf); |
|
2124 scheduleList->AppendL(iBuf); |
|
2125 |
|
2126 GetOffPeakScheduleValueL(CAspSchedule::EInterval4hours, iBuf); |
|
2127 scheduleList->AppendL(iBuf); |
|
2128 |
|
2129 GetOffPeakScheduleValueL(CAspSchedule::EInterval12hours, iBuf); |
|
2130 scheduleList->AppendL(iBuf); |
|
2131 } |
|
2132 |
|
2133 return scheduleList; |
|
2134 } |
|
2135 |
|
2136 //------------------------------------------------------------------------------ |
|
2137 // CAspScheduleDialog::GetOffPeakScheduleValueL |
|
2138 // |
|
2139 //------------------------------------------------------------------------------ |
|
2140 // |
|
2141 void CAspScheduleDialog::GetOffPeakScheduleValueL(TInt schedule, TDes& aBuf) |
|
2142 { |
|
2143 aBuf = KNullDesC; |
|
2144 |
|
2145 switch(schedule) |
|
2146 { |
|
2147 case CAspSchedule::EIntervalManual: |
|
2148 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_OFF_MANUAL); |
|
2149 break; |
|
2150 case CAspSchedule::EInterval15Mins: |
|
2151 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_OFF_15_MINS); |
|
2152 break; |
|
2153 case CAspSchedule::EInterval30Mins: |
|
2154 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_OFF_30_MINS); |
|
2155 break; |
|
2156 case CAspSchedule::EInterval1hour: |
|
2157 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_OFF_1_HOUR); |
|
2158 break; |
|
2159 case CAspSchedule::EInterval2hours: |
|
2160 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_OFF_2_HOURS); |
|
2161 break; |
|
2162 case CAspSchedule::EInterval4hours: |
|
2163 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_OFF_4_HOURS); |
|
2164 break; |
|
2165 case CAspSchedule::EInterval8hours: |
|
2166 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_OFF_8_HOURS); |
|
2167 break; |
|
2168 case CAspSchedule::EInterval12hours: |
|
2169 iResHandler->ReadL(aBuf, R_ASP_SETT_AUTO_VALUE_OFF_12_HOURS); |
|
2170 break; |
|
2171 |
|
2172 default: |
|
2173 break; |
|
2174 } |
|
2175 |
|
2176 } |
|
2177 |
|
2178 // ---------------------------------------------------------------------------- |
|
2179 // CAspScheduleDialog::PeakScheduleL |
|
2180 // Get peak schedule number from string |
|
2181 // ---------------------------------------------------------------------------- |
|
2182 // |
|
2183 TInt CAspScheduleDialog::PeakScheduleL(const TDesC& aBuf) |
|
2184 { |
|
2185 |
|
2186 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_MANUAL); |
|
2187 if(iBuf.Compare(aBuf) == 0) |
|
2188 { |
|
2189 return CAspSchedule::EIntervalManual; |
|
2190 } |
|
2191 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_15_MINS); |
|
2192 if(iBuf.Compare(aBuf) == 0) |
|
2193 { |
|
2194 return CAspSchedule::EInterval15Mins; |
|
2195 } |
|
2196 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_30_MINS); |
|
2197 if(iBuf.Compare(aBuf) == 0) |
|
2198 { |
|
2199 return CAspSchedule::EInterval30Mins; |
|
2200 } |
|
2201 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_1_HOUR); |
|
2202 if(iBuf.Compare(aBuf) == 0) |
|
2203 { |
|
2204 return CAspSchedule::EInterval1hour; |
|
2205 } |
|
2206 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_2_HOURS); |
|
2207 if(iBuf.Compare(aBuf) == 0) |
|
2208 { |
|
2209 return CAspSchedule::EInterval2hours; |
|
2210 } |
|
2211 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_4_HOURS); |
|
2212 if(iBuf.Compare(aBuf) == 0) |
|
2213 { |
|
2214 return CAspSchedule::EInterval4hours; |
|
2215 } |
|
2216 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_8_HOURS); |
|
2217 if(iBuf.Compare(aBuf) == 0) |
|
2218 { |
|
2219 return CAspSchedule::EInterval8hours; |
|
2220 } |
|
2221 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_12_HOURS); |
|
2222 if(iBuf.Compare(aBuf) == 0) |
|
2223 { |
|
2224 return CAspSchedule::EInterval12hours; |
|
2225 } |
|
2226 |
|
2227 |
|
2228 return KErrNotFound; |
|
2229 } |
|
2230 |
|
2231 // ---------------------------------------------------------------------------- |
|
2232 // CAspScheduleDialog::OffPeakScheduleL |
|
2233 // Get off-peak schedule number from string |
|
2234 // ---------------------------------------------------------------------------- |
|
2235 // |
|
2236 TInt CAspScheduleDialog::OffPeakScheduleL(const TDesC& aBuf) |
|
2237 { |
|
2238 |
|
2239 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_OFF_MANUAL); |
|
2240 if(iBuf.Compare(aBuf) == 0) |
|
2241 { |
|
2242 return CAspSchedule::EIntervalManual; |
|
2243 } |
|
2244 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_OFF_15_MINS); |
|
2245 if(iBuf.Compare(aBuf) == 0) |
|
2246 { |
|
2247 return CAspSchedule::EInterval15Mins; |
|
2248 } |
|
2249 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_OFF_30_MINS); |
|
2250 if(iBuf.Compare(aBuf) == 0) |
|
2251 { |
|
2252 return CAspSchedule::EInterval30Mins; |
|
2253 } |
|
2254 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_OFF_1_HOUR); |
|
2255 if(iBuf.Compare(aBuf) == 0) |
|
2256 { |
|
2257 return CAspSchedule::EInterval1hour; |
|
2258 } |
|
2259 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_OFF_2_HOURS); |
|
2260 if(iBuf.Compare(aBuf) == 0) |
|
2261 { |
|
2262 return CAspSchedule::EInterval2hours; |
|
2263 } |
|
2264 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_OFF_4_HOURS); |
|
2265 if(iBuf.Compare(aBuf) == 0) |
|
2266 { |
|
2267 return CAspSchedule::EInterval4hours; |
|
2268 } |
|
2269 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_OFF_8_HOURS); |
|
2270 if(iBuf.Compare(aBuf) == 0) |
|
2271 { |
|
2272 return CAspSchedule::EInterval8hours; |
|
2273 } |
|
2274 iResHandler->ReadL(iBuf, R_ASP_SETT_AUTO_VALUE_OFF_12_HOURS); |
|
2275 if(iBuf.Compare(aBuf) == 0) |
|
2276 { |
|
2277 return CAspSchedule::EInterval12hours; |
|
2278 } |
|
2279 |
|
2280 |
|
2281 return KErrNotFound; |
|
2282 } |
|
2283 |
|
2284 // ---------------------------------------------------------------------------- |
|
2285 // CAspScheduleDialog::GetPeakPositionL |
|
2286 // Get position of selected interval from the interval list |
|
2287 // ---------------------------------------------------------------------------- |
|
2288 // |
|
2289 TInt CAspScheduleDialog::GetPeakPositionL(CDesCArray* arr, TInt aInterval) |
|
2290 { |
|
2291 const TInt KScheduleCount = 6; |
|
2292 for (TInt i=0; i < KScheduleCount; i++) |
|
2293 { |
|
2294 if(aInterval == PeakScheduleL((*arr)[i])) |
|
2295 return i; |
|
2296 } |
|
2297 return KErrNotFound; |
|
2298 |
|
2299 } |
|
2300 |
|
2301 // ---------------------------------------------------------------------------- |
|
2302 // CAspScheduleDialog::GetOffPeakPositionL |
|
2303 // Get position of selected interval from the interval list |
|
2304 // ---------------------------------------------------------------------------- |
|
2305 // |
|
2306 TInt CAspScheduleDialog::GetOffPeakPositionL(CDesCArray* arr, TInt aInterval) |
|
2307 { |
|
2308 const TInt KScheduleCount = 6; |
|
2309 for (TInt i=0; i < KScheduleCount; i++) |
|
2310 { |
|
2311 if(aInterval == OffPeakScheduleL((*arr)[i])) |
|
2312 return i; |
|
2313 } |
|
2314 return KErrNotFound; |
|
2315 |
|
2316 } |
|
2317 |
|
2318 // ---------------------------------------------------------------------------- |
|
2319 // CAspScheduleDialog::CheckMandatoryDataL |
|
2320 // |
|
2321 // ---------------------------------------------------------------------------- |
|
2322 // |
|
2323 |
|
2324 void CAspScheduleDialog::CheckMandatoryDataL() |
|
2325 { |
|
2326 FLOG( _L("CAspScheduleDialog::CheckMandatoryDataL START") ); |
|
2327 |
|
2328 if (iSchedule->ProfileId() == KErrNotFound) |
|
2329 { |
|
2330 return; |
|
2331 } |
|
2332 if (!iSchedule->IsAutoSyncEnabled()) |
|
2333 { |
|
2334 return; |
|
2335 } |
|
2336 |
|
2337 TInt incompleteCount; |
|
2338 TInt firstItem; |
|
2339 |
|
2340 TBool ret = iSchedule->CheckMandatoryDataL(incompleteCount, firstItem); |
|
2341 if (!ret) |
|
2342 { |
|
2343 if (!TDialogUtil::ShowConfirmationQueryL(R_ASP_NOTE_AUTO_CONTENTS_MISSING_SETTINGS)) |
|
2344 { |
|
2345 return ; |
|
2346 } |
|
2347 |
|
2348 TAspParam param(iApplicationId, iSyncSession); |
|
2349 |
|
2350 TBool doCleanUp = EFalse; |
|
2351 |
|
2352 CAspProfile* profile = NULL; |
|
2353 TInt aProfileId = iSchedule->ProfileId(); |
|
2354 |
|
2355 if (iProfile && (aProfileId == iProfile->ProfileId()))//setting view opened & selected same profile |
|
2356 { |
|
2357 profile = iProfile; |
|
2358 } |
|
2359 else |
|
2360 { |
|
2361 profile = CAspProfile::NewLC(param);//Automatic sync menu opened |
|
2362 TRAPD(err, profile->OpenL(aProfileId, CAspProfile::EOpenReadWrite, |
|
2363 CAspProfile::EAllProperties)); |
|
2364 |
|
2365 if (err == KErrLocked) |
|
2366 { |
|
2367 CleanupStack::PopAndDestroy(profile); |
|
2368 TDialogUtil::ShowErrorNoteL(R_ASP_LOCKED_PROFILE); |
|
2369 return ; |
|
2370 } |
|
2371 doCleanUp = ETrue; |
|
2372 iContentList->SetProfile(profile); |
|
2373 } |
|
2374 |
|
2375 TAspProviderItem& provider = iContentList->ProviderItem(firstItem); |
|
2376 param.iProfile = profile; |
|
2377 param.iContentList = iContentList; |
|
2378 param.iDataProviderId = provider.iDataProviderId; |
|
2379 param.iProfileList = iProfileList; |
|
2380 param.iMode = iEditMode; |
|
2381 param.iSchedule = iSchedule; |
|
2382 if (incompleteCount == 1) |
|
2383 { |
|
2384 CAspContentDialog::ShowDialogL(param); |
|
2385 } |
|
2386 else if (incompleteCount >1) |
|
2387 { |
|
2388 CAspSettingViewDialog::ShowDialogL(param); |
|
2389 } |
|
2390 |
|
2391 if (doCleanUp) |
|
2392 { |
|
2393 iContentList->SetProfile(NULL); |
|
2394 CleanupStack::PopAndDestroy(profile); |
|
2395 } |
|
2396 |
|
2397 } |
|
2398 |
|
2399 if (!CheckBearerType()) |
|
2400 { |
|
2401 iSchedule->SetProfileId(KErrNotFound); |
|
2402 return; |
|
2403 } |
|
2404 if (!iSchedule->MailboxExistL() || !iSchedule->ProtocolL()) |
|
2405 { |
|
2406 TInt emailIndex = iContentList->FindProviderIndex(KUidNSmlAdapterEMail.iUid); |
|
2407 iSchedule->SetContentEnabled(emailIndex, EFalse); |
|
2408 } |
|
2409 |
|
2410 FLOG( _L("CAspScheduleDialog::CheckMandatoryDataL END") ); |
|
2411 |
|
2412 } |
|
2413 // ---------------------------------------------------------------------------- |
|
2414 // CAspScheduleDialog::ShowAutoSyncInfoL |
|
2415 // Show next auto sync time |
|
2416 // ---------------------------------------------------------------------------- |
|
2417 // |
|
2418 void CAspScheduleDialog::ShowAutoSyncInfoL() |
|
2419 { |
|
2420 FLOG( _L("CAspScheduleDialog::ShowAutoSyncInfoL START") ); |
|
2421 if (iSchedule->ProfileId() == KErrNotFound) |
|
2422 { |
|
2423 iSchedule->SetDailySyncEnabled(EFalse); |
|
2424 iSchedule->SetPeakSyncEnabled(EFalse); |
|
2425 iSchedule->SetOffPeakSyncEnabled(EFalse); |
|
2426 FLOG( _L("Profile Not Found") ); |
|
2427 return ; |
|
2428 } |
|
2429 |
|
2430 if (!iSchedule->IsAutoSyncEnabled()) |
|
2431 { |
|
2432 return; |
|
2433 } |
|
2434 |
|
2435 if (iSchedule->PeakSyncEnabled() && !iSchedule->OffPeakSyncEnabled()) |
|
2436 { |
|
2437 TInt dayCount = 0; |
|
2438 TInt dayIndex = 0; |
|
2439 iSchedule->SelectedDayInfo(dayCount, dayIndex); |
|
2440 if (dayCount == 0) |
|
2441 { |
|
2442 return; |
|
2443 } |
|
2444 } |
|
2445 if (iSchedule->PeakSyncEnabled() && (iSchedule->IsValidPeakScheduleL() == 0) |
|
2446 || iSchedule->OffPeakSyncEnabled() && (iSchedule->IsValidOffPeakScheduleL() == 0 )) |
|
2447 { |
|
2448 return; |
|
2449 } |
|
2450 |
|
2451 TTime currentTime; |
|
2452 currentTime.HomeTime(); |
|
2453 TDateTime today = currentTime.DateTime(); |
|
2454 |
|
2455 TDateTime startDay = iSchedule->AutoSyncScheduleTime().DateTime(); |
|
2456 |
|
2457 if (iSchedule->SyncFrequency() >= CAspSchedule::EInterval24hours) |
|
2458 { |
|
2459 if (startDay.Hour() == today.Hour() && startDay.Minute() <= today.Minute()) |
|
2460 { |
|
2461 return; |
|
2462 } |
|
2463 else if (startDay.Hour() < today.Hour()) |
|
2464 { |
|
2465 return; |
|
2466 } |
|
2467 } |
|
2468 |
|
2469 TTime nextSync; |
|
2470 iSchedule->GetStartTimeL(nextSync ,ETrue); |
|
2471 |
|
2472 TDateTime syncDay = nextSync.DateTime(); |
|
2473 |
|
2474 TBuf<KBufSize> aTimeString; |
|
2475 if(today.Day() == syncDay.Day() && today.Month() == syncDay.Month()) |
|
2476 { |
|
2477 //show next sync time |
|
2478 TBuf<KBufSize> timeFormat; |
|
2479 CAspResHandler::ReadL(timeFormat, R_QTN_TIME_USUAL_WITH_ZERO); |
|
2480 nextSync.FormatL(aTimeString, timeFormat); |
|
2481 } |
|
2482 else |
|
2483 { |
|
2484 //show sync day |
|
2485 TBuf<KBufSize> dateFormat; |
|
2486 CAspResHandler::ReadL(dateFormat, R_QTN_DATE_USUAL_WITH_ZERO); |
|
2487 nextSync.FormatL(aTimeString, dateFormat); |
|
2488 } |
|
2489 |
|
2490 HBufC* hBuf = CAspResHandler::ReadLC(R_ASP_SETT_AUTO_SYNC_DONE, aTimeString); |
|
2491 TDialogUtil::ShowInformationNoteL(hBuf->Des()); |
|
2492 |
|
2493 CleanupStack::PopAndDestroy(hBuf); |
|
2494 |
|
2495 FLOG( _L("CAspScheduleDialog::ShowAutoSyncInfoL END") ); |
|
2496 |
|
2497 |
|
2498 } |
|
2499 |
|
2500 |
|
2501 // ---------------------------------------------------------------------------- |
|
2502 // CAspScheduleDialog::CheckBearerType |
|
2503 // Return ETrue if bearer type of the selected profile is internet & EFalse otherwise |
|
2504 // ---------------------------------------------------------------------------- |
|
2505 // |
|
2506 TBool CAspScheduleDialog::CheckBearerType() |
|
2507 { |
|
2508 TAspParam param(iApplicationId, iSyncSession); |
|
2509 |
|
2510 CAspProfile* profile = CAspProfile::NewLC(param); |
|
2511 |
|
2512 TInt aProfileId = iSchedule->ProfileId(); |
|
2513 TRAPD(err, profile->OpenL(aProfileId, CAspProfile::EOpenRead, |
|
2514 CAspProfile::EAllProperties)); |
|
2515 User::LeaveIfError(err); |
|
2516 if (profile->BearerType() != EAspBearerInternet) |
|
2517 { |
|
2518 CleanupStack::PopAndDestroy(profile); |
|
2519 return EFalse; |
|
2520 } |
|
2521 CleanupStack::PopAndDestroy(profile); |
|
2522 return ETrue; |
|
2523 } |
|
2524 // ---------------------------------------------------------------------------- |
|
2525 // CAspScheduleDialog::CheckPeakTime |
|
2526 // Check peak time definition |
|
2527 // ---------------------------------------------------------------------------- |
|
2528 // |
|
2529 TBool CAspScheduleDialog::CheckPeakTime() |
|
2530 { |
|
2531 if (Item(EAspAutoSyncPeakSchedule)->iNumberData == CAspSchedule::EIntervalManual |
|
2532 && Item(EAspAutoSyncOffPeakSchedule)->iNumberData == CAspSchedule::EIntervalManual) |
|
2533 { |
|
2534 return ETrue; |
|
2535 } |
|
2536 if (Item(EAspAutoSyncPeakStartTime)->iTime >= Item(EAspAutoSyncPeakEndTime)->iTime) |
|
2537 { |
|
2538 return EFalse; |
|
2539 } |
|
2540 return ETrue; |
|
2541 } |
|
2542 |
|
2543 // ---------------------------------------------------------------------------- |
|
2544 // CAspScheduleDialog::CheckValidityL |
|
2545 // Check validity of content selected |
|
2546 // ---------------------------------------------------------------------------- |
|
2547 // |
|
2548 TBool CAspScheduleDialog::CheckValidityL() |
|
2549 { |
|
2550 TBool ret = ETrue; |
|
2551 TRAPD(err, ret = iSchedule->MailboxExistL()) |
|
2552 User::LeaveIfError(err); |
|
2553 if (!ret) |
|
2554 { |
|
2555 TDialogUtil::ShowErrorNoteL(R_ASP_NO_MAILBOXES); |
|
2556 TInt emailIndex = iContentList->FindProviderIndex(KUidNSmlAdapterEMail.iUid); |
|
2557 iSchedule->SetContentEnabled(emailIndex, EFalse); |
|
2558 return EFalse; // no syncml mailbox |
|
2559 } |
|
2560 TInt profileId = Item(EAspAutoSyncProfile)->iNumberData; |
|
2561 if (profileId != KErrNotFound) |
|
2562 { |
|
2563 TAspParam param(iApplicationId, iSyncSession); |
|
2564 |
|
2565 CAspProfile* profile = CAspProfile::NewLC(param); |
|
2566 profile->OpenL(profileId, CAspProfile::EOpenRead, |
|
2567 CAspProfile::EBaseProperties); |
|
2568 TInt protocol = profile->ProtocolVersion(); |
|
2569 CleanupStack::PopAndDestroy(profile); |
|
2570 |
|
2571 } |
|
2572 return ETrue; |
|
2573 } |
|
2574 // ---------------------------------------------------------------------------- |
|
2575 // CAspScheduleDialog::EmailIndex |
|
2576 // ---------------------------------------------------------------------------- |
|
2577 // |
|
2578 TInt CAspScheduleDialog::EmailIndex() |
|
2579 { |
|
2580 TInt index = iContentList->FindProviderIndex(KUidNSmlAdapterEMail.iUid); |
|
2581 return index; |
|
2582 |
|
2583 } |
|
2584 |
|
2585 // ----------------------------------------------------------------------------- |
|
2586 // CAspScheduleDialog::ReadRepositoryL |
|
2587 // |
|
2588 // ----------------------------------------------------------------------------- |
|
2589 // |
|
2590 void CAspScheduleDialog::ReadRepositoryL(TInt aKey, TInt& aValue) |
|
2591 { |
|
2592 const TUid KRepositoryId = KCRUidNSmlDSApp; |
|
2593 const TInt KSyncFrequencyCount = 3; |
|
2594 const TInt KSyncIntervalCount = 5; |
|
2595 |
|
2596 CRepository* rep = CRepository::NewLC(KRepositoryId); |
|
2597 TInt err = rep->Get(aKey, aValue); |
|
2598 User::LeaveIfError(err); |
|
2599 CleanupStack::PopAndDestroy(rep); |
|
2600 |
|
2601 |
|
2602 TInt keyVal = aValue; |
|
2603 if (aKey == EKeySyncFrequency) |
|
2604 { |
|
2605 TInt intervalCount = 0; |
|
2606 TUint mask = 1; |
|
2607 TInt maxSchedules = 5; |
|
2608 for (TInt i = 0 ;i < maxSchedules ;i++) |
|
2609 { |
|
2610 if (mask & keyVal) |
|
2611 { |
|
2612 intervalCount++; |
|
2613 } |
|
2614 mask = mask << 1; |
|
2615 } |
|
2616 if (keyVal >= 0x32 || intervalCount != KSyncFrequencyCount) |
|
2617 { |
|
2618 User::Leave(KErrGeneral); |
|
2619 } |
|
2620 } |
|
2621 else if (aKey == EKeyPeakSyncInterval || |
|
2622 aKey == EKeyOffPeakSyncInterval) |
|
2623 { |
|
2624 TInt intervalCount = 0; |
|
2625 TUint mask = 1; |
|
2626 TInt maxSchedules = 7; |
|
2627 for (TInt i = 0 ;i < maxSchedules ;i++) |
|
2628 { |
|
2629 if (mask & keyVal) |
|
2630 { |
|
2631 intervalCount++; |
|
2632 } |
|
2633 mask = mask << 1; |
|
2634 } |
|
2635 if (keyVal >= 0x128 || intervalCount != KSyncIntervalCount) |
|
2636 { |
|
2637 User::Leave(KErrGeneral); |
|
2638 } |
|
2639 } |
|
2640 } |
|
2641 |
|
2642 //------------------------------------------------------------------------------ |
|
2643 // CAutoSyncCheckBoxSettingPage::CAspCheckBoxSettingPage |
|
2644 // |
|
2645 //------------------------------------------------------------------------------ |
|
2646 // |
|
2647 CAutoSyncCheckBoxSettingPage::CAutoSyncCheckBoxSettingPage(TInt aResourceID, |
|
2648 CSelectionItemList* aItemArray, TAutoSyncSettingPageParam& aParam) |
|
2649 |
|
2650 : CAknCheckBoxSettingPage(aResourceID, aItemArray), iParam(aParam) |
|
2651 { |
|
2652 iSelectionItemList = aItemArray; |
|
2653 } |
|
2654 |
|
2655 |
|
2656 //------------------------------------------------------------------------------ |
|
2657 // Destructor |
|
2658 // |
|
2659 //------------------------------------------------------------------------------ |
|
2660 // |
|
2661 CAutoSyncCheckBoxSettingPage::~CAutoSyncCheckBoxSettingPage() |
|
2662 { |
|
2663 |
|
2664 } |
|
2665 |
|
2666 |
|
2667 //------------------------------------------------------------------------------ |
|
2668 // CAutoSyncCheckBoxSettingPage::ProcessCommandL |
|
2669 // |
|
2670 //------------------------------------------------------------------------------ |
|
2671 // |
|
2672 void CAutoSyncCheckBoxSettingPage::ProcessCommandL(TInt aCommandId) |
|
2673 { |
|
2674 if (aCommandId == EAknSoftkeyUnmark || aCommandId == EAknSoftkeyMark) |
|
2675 { |
|
2676 |
|
2677 CAknSetStyleListBox* listbox = ListBoxControl(); |
|
2678 TInt index = listbox->CurrentItemIndex(); |
|
2679 CSelectableItem* selectableItem = (*iSelectionItemList)[index]; |
|
2680 TBool ret = ETrue; |
|
2681 |
|
2682 UpdateCbaL(R_ASP_CBA_OK_CANCEL_MARK); |
|
2683 TInt emailIndex = iParam.iObserver->EmailIndex(); |
|
2684 if (index == emailIndex) |
|
2685 { |
|
2686 ret = iParam.iObserver->CheckValidityL(); |
|
2687 } |
|
2688 |
|
2689 TInt count = ListBoxControl()->SelectionIndexes()->Count(); |
|
2690 TInt selected = count - 1; |
|
2691 if (selectableItem->SelectionStatus()) |
|
2692 { |
|
2693 if (!selected)//all unselected |
|
2694 { |
|
2695 UpdateCbaL(R_ASP_CBA_EMPTY_CANCEL_MARK); |
|
2696 } |
|
2697 } |
|
2698 else |
|
2699 { |
|
2700 if (index == emailIndex && !ret && !count) |
|
2701 { |
|
2702 UpdateCbaL(R_ASP_CBA_EMPTY_CANCEL_MARK); |
|
2703 } |
|
2704 } |
|
2705 |
|
2706 if (ret) |
|
2707 { |
|
2708 CAknCheckBoxSettingPage::ProcessCommandL(aCommandId); |
|
2709 return; |
|
2710 } |
|
2711 else |
|
2712 { |
|
2713 return; |
|
2714 } |
|
2715 } |
|
2716 |
|
2717 |
|
2718 iParam.iCommandId = aCommandId; // return command id to caller |
|
2719 |
|
2720 CAknCheckBoxSettingPage::ProcessCommandL(aCommandId); |
|
2721 } |
|
2722 |
|
2723 |
|
2724 //------------------------------------------------------------------------------ |
|
2725 // CAutoSyncCheckBoxSettingPage::OfferKeyEventL |
|
2726 // |
|
2727 //------------------------------------------------------------------------------ |
|
2728 // |
|
2729 TKeyResponse CAutoSyncCheckBoxSettingPage::OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
2730 TEventCode aType) |
|
2731 { |
|
2732 if(EKeyEnter == aKeyEvent.iCode) |
|
2733 { |
|
2734 ProcessCommandL(EAknSoftkeyMark); |
|
2735 return EKeyWasConsumed; |
|
2736 } |
|
2737 return CAknCheckBoxSettingPage::OfferKeyEventL(aKeyEvent, aType); |
|
2738 } |
|
2739 |
|
2740 |
|
2741 // ----------------------------------------------------------------------------- |
|
2742 // CAutoSyncCheckBoxSettingPage::UpdateCbaL |
|
2743 // |
|
2744 // ----------------------------------------------------------------------------- |
|
2745 // |
|
2746 void CAutoSyncCheckBoxSettingPage::UpdateCbaL(TInt aResourceId) |
|
2747 { |
|
2748 CEikButtonGroupContainer* cba = Cba(); |
|
2749 cba->SetCommandSetL(aResourceId); |
|
2750 cba->DrawDeferred(); |
|
2751 } |
|
2752 // ----------------------------------------------------------------------------- |
|
2753 // CAutoSyncCheckBoxSettingPage::DynamicInitL |
|
2754 // |
|
2755 // ----------------------------------------------------------------------------- |
|
2756 // |
|
2757 void CAutoSyncCheckBoxSettingPage::DynamicInitL() |
|
2758 { |
|
2759 TInt count = iSelectionItemList->Count(); |
|
2760 for (TInt i=0; i<count; i++) |
|
2761 { |
|
2762 CSelectableItem* selectableItem = (*iSelectionItemList)[i]; |
|
2763 TBool selected = selectableItem->SelectionStatus(); |
|
2764 if (selected) |
|
2765 { |
|
2766 return; |
|
2767 } |
|
2768 } |
|
2769 UpdateCbaL(R_ASP_CBA_EMPTY_CANCEL_MARK); |
|
2770 } |
|
2771 |
|
2772 // ---------------------------------------------------------------------------- |
|
2773 // CAutoSyncCheckBoxSettingPage::HandleListBoxEventL |
|
2774 // |
|
2775 // ---------------------------------------------------------------------------- |
|
2776 // |
|
2777 |
|
2778 |
|
2779 void CAutoSyncCheckBoxSettingPage::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType) |
|
2780 { |
|
2781 TInt index = 0; |
|
2782 CSelectableItem* selectableItem; |
|
2783 if( AknLayoutUtils::PenEnabled() ) |
|
2784 { |
|
2785 switch(aEventType) |
|
2786 |
|
2787 { |
|
2788 case EEventItemSingleClicked: |
|
2789 index=aListBox->CurrentItemIndex(); |
|
2790 selectableItem = (*iSelectionItemList)[index]; |
|
2791 if(selectableItem->SelectionStatus()) |
|
2792 { |
|
2793 this->ProcessCommandL(EAknSoftkeyUnmark); |
|
2794 } |
|
2795 else |
|
2796 { |
|
2797 this->ProcessCommandL(EAknSoftkeyMark); |
|
2798 } |
|
2799 break; |
|
2800 default: |
|
2801 break; |
|
2802 } |
|
2803 } |
|
2804 |
|
2805 } |
|
2806 |
|
2807 // End of File |