omads/omadsappui/AspSyncUtil/src/AspSettingViewDialog.cpp
branchRCL_3
changeset 25 4f0867e42d62
equal deleted inserted replaced
24:8e7494275d3a 25:4f0867e42d62
       
     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 "AspSettingViewDialog.h"
       
    23 #include "AspProfileDialog.h"
       
    24 #include "AspContentDialog.h"
       
    25 #include "AspScheduleDialog.h"
       
    26 
       
    27 #include "AspSyncUtil.rh"
       
    28 #include "AspDebug.h"
       
    29 #include <csxhelp/ds.hlp.hrh>
       
    30 
       
    31 #include <aspsyncutil.mbg>  // for bitmap enumerations
       
    32 #include <AknIconArray.h>   // for GulArray
       
    33 
       
    34 #include "AspSchedule.h"
       
    35 
       
    36 
       
    37 // ============================ MEMBER FUNCTIONS ===============================
       
    38 
       
    39 
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CAspSettingViewDialog::ShowDialogL
       
    43 // 
       
    44 // -----------------------------------------------------------------------------
       
    45 TBool CAspSettingViewDialog::ShowDialogL(const TAspParam& aParam)
       
    46 	{
       
    47     CAspSettingViewDialog* dialog = CAspSettingViewDialog::NewL(aParam);
       
    48 
       
    49 	TBool ret = dialog->ExecuteLD(R_ASP_SETTING_VIEW_DIALOG);
       
    50 
       
    51     return ret;
       
    52 	}
       
    53 
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CAspSettingViewDialog::NewL
       
    57 //
       
    58 // -----------------------------------------------------------------------------
       
    59 CAspSettingViewDialog* CAspSettingViewDialog::NewL(const TAspParam& aParam)
       
    60     {
       
    61     FLOG( _L("CAspSettingViewDialog::NewL START") );
       
    62 
       
    63     CAspSettingViewDialog* self = new ( ELeave )CAspSettingViewDialog (aParam);
       
    64     CleanupStack::PushL(self);
       
    65     self->ConstructL();
       
    66     CleanupStack::Pop(self);
       
    67 
       
    68     FLOG( _L("CAspSettingViewDialog::NewL END") );
       
    69     return self;
       
    70     }
       
    71 
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CAspSettingViewDialog::CAspSettingViewDialog
       
    75 // 
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 CAspSettingViewDialog::CAspSettingViewDialog(const TAspParam& aParam)
       
    79 	{
       
    80     iSyncSession = aParam.iSyncSession;
       
    81     iApplicationId = aParam.iApplicationId;
       
    82     iProfile = aParam.iProfile;
       
    83     iContentList = aParam.iContentList;
       
    84     iProfileList = aParam.iProfileList;
       
    85     iEditMode = aParam.iMode;
       
    86 	iDataProviderId =aParam.iDataProviderId;
       
    87 	iSchedule = aParam.iSchedule;
       
    88     
       
    89        
       
    90 	__ASSERT_ALWAYS(iProfile, TUtil::Panic(KErrGeneral));
       
    91 	__ASSERT_ALWAYS(iContentList, TUtil::Panic(KErrGeneral));
       
    92 	__ASSERT_ALWAYS(iSyncSession, TUtil::Panic(KErrGeneral));
       
    93     }
       
    94 
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CAspSettingViewDialog::ConstructL
       
    98 //
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 void CAspSettingViewDialog::ConstructL()
       
   102     {
       
   103     FLOG( _L("CAspSettingViewDialog::ConstructL START") );
       
   104 	
       
   105 	// contruct menu for our dialog
       
   106 	CAknDialog::ConstructL(R_ASP_SETTING_VIEW_DIALOG_MENU);
       
   107 
       
   108 	iSettingList = new (ELeave) CArrayPtrFlat<CAspListItemData>(1);
       
   109 
       
   110 	TAspParam param(KErrNotFound, iSyncSession);
       
   111 		
       
   112 	// get previous title so it can be restored
       
   113 	iStatusPaneHandler = CStatusPaneHandler::NewL(iAvkonAppUi);
       
   114 	iStatusPaneHandler->StoreOriginalTitleL();
       
   115 	
       
   116 	FLOG( _L("CAspSettingViewDialog::ConstructL END") );
       
   117     } 
       
   118 
       
   119 
       
   120 // ----------------------------------------------------------------------------
       
   121 // Destructor
       
   122 //
       
   123 // ----------------------------------------------------------------------------
       
   124 //
       
   125 CAspSettingViewDialog::~CAspSettingViewDialog()
       
   126     {
       
   127     FLOG( _L("CAspSettingViewDialog::~CAspSettingViewDialog START") );
       
   128 
       
   129 	if (iSettingList)
       
   130 		{
       
   131 		iSettingList->ResetAndDestroy();
       
   132 	    delete iSettingList;
       
   133 		}
       
   134 
       
   135 	delete iStatusPaneHandler;
       
   136 	
       
   137 	
       
   138     if (iAvkonAppUi)
       
   139     	{
       
   140     	iAvkonAppUi->RemoveFromStack(this);
       
   141     	}
       
   142 
       
   143 	FLOG( _L("~CAspSettingViewDialog::~~CAspSettingViewDialog END") );
       
   144     }
       
   145 
       
   146 
       
   147 //------------------------------------------------------------------------------
       
   148 // CAspSettingViewDialog::ActivateL
       
   149 //
       
   150 // Called by system when dialog is activated.
       
   151 //------------------------------------------------------------------------------
       
   152 //
       
   153 void CAspSettingViewDialog::ActivateL()
       
   154 	{
       
   155     CAknDialog::ActivateL();
       
   156 
       
   157 	// this cannot be in ConstructL which is executed before dialog is launched
       
   158 	iAvkonAppUi->AddToStackL(this);
       
   159     }
       
   160 
       
   161 
       
   162 //------------------------------------------------------------------------------
       
   163 // CAspContentListDialog::GetHelpContext
       
   164 //
       
   165 //------------------------------------------------------------------------------
       
   166 //
       
   167 void CAspSettingViewDialog::GetHelpContext(TCoeHelpContext& aContext) const
       
   168 	{
       
   169 	aContext.iMajor = KUidSmlSyncApp;
       
   170 	aContext.iContext = KDS_HLP_SETTINGS;    
       
   171 	}
       
   172 
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CAspSettingViewDialog::HandleListBoxEventL
       
   176 // 
       
   177 // -----------------------------------------------------------------------------
       
   178 void CAspSettingViewDialog::HandleListBoxEventL(CEikListBox* /*aListBox*/,
       
   179                                             TListBoxEvent aEventType)
       
   180 	{
       
   181     switch ( aEventType )
       
   182         {
       
   183         case EEventEnterKeyPressed:
       
   184         case EEventItemSingleClicked:
       
   185             HandleOKL();
       
   186             break;
       
   187         default:
       
   188            break;
       
   189         }
       
   190 	}
       
   191 
       
   192 
       
   193 // -----------------------------------------------------------------------------
       
   194 // CAspSettingViewDialog::PreLayoutDynInitL
       
   195 // 
       
   196 // -----------------------------------------------------------------------------
       
   197 //
       
   198 void CAspSettingViewDialog::PreLayoutDynInitL()
       
   199     {
       
   200     iSettingListBox = (CAknSettingStyleListBox*) ControlOrNull (EAspSettingViewDialogList);
       
   201     
       
   202    	__ASSERT_ALWAYS(iSettingListBox, TUtil::Panic(KErrGeneral));
       
   203     
       
   204 	iSettingListBox->SetListBoxObserver(this);
       
   205 	iSettingListBox->CreateScrollBarFrameL(ETrue);
       
   206 	iSettingListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
       
   207 	                 CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);
       
   208 	
       
   209 	SetIconsL();
       
   210 	
       
   211 	// create array of setting items (iSettingList)
       
   212 	CreateSettingsListL();
       
   213 
       
   214 	// add setting headers into listbox
       
   215 	UpdateListBoxL(iSettingListBox, iSettingList);
       
   216 
       
   217 	if (iDataProviderId)
       
   218 		{
       
   219 		iSettingListBox->SetCurrentItemIndex(GetIndexFromProvider(iDataProviderId));
       
   220 		}
       
   221     iProfile->GetName(iBuf);
       
   222 	iStatusPaneHandler->SetTitleL(iBuf);
       
   223 	iStatusPaneHandler->SetNaviPaneTitleL(KNullDesC);
       
   224     }
       
   225 
       
   226 
       
   227 // ----------------------------------------------------------------------------
       
   228 // CAspSettingViewDialog::SetIconsL
       
   229 //
       
   230 // ----------------------------------------------------------------------------
       
   231 //
       
   232 void CAspSettingViewDialog::SetIconsL()
       
   233     {
       
   234     if (!iSettingListBox)
       
   235     	{
       
   236     	return;
       
   237     	}
       
   238  
       
   239  	TFileName bitmapName;
       
   240 	CAspResHandler::GetBitmapFileName(bitmapName);
       
   241 	CArrayPtr<CGulIcon>* icons = new (ELeave) CAknIconArray(KDefaultArraySize);
       
   242 	CleanupStack::PushL(icons);
       
   243 	
       
   244 	icons->AppendL(IconL(KAknsIIDQgnIndiSettProtectedAdd, bitmapName,
       
   245 	                     EMbmAspsyncutilQgn_indi_sett_protected_add,
       
   246 	                     EMbmAspsyncutilQgn_indi_sett_protected_add_mask));
       
   247 	
       
   248     // delete old icons
       
   249     CArrayPtr<CGulIcon>* arr =
       
   250     iSettingListBox->ItemDrawer()->FormattedCellData()->IconArray();
       
   251     
       
   252     if (arr)
       
   253     	{
       
   254     	arr->ResetAndDestroy();
       
   255 	    delete arr;
       
   256 	    arr = NULL;
       
   257     	}
       
   258 
       
   259 	iSettingListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
       
   260 	CleanupStack::Pop(icons);
       
   261     }
       
   262 
       
   263 
       
   264 // -----------------------------------------------------------------------------
       
   265 // CAspSettingViewDialog::IconL
       
   266 // 
       
   267 // -----------------------------------------------------------------------------
       
   268 //
       
   269 CGulIcon* CAspSettingViewDialog::IconL(TAknsItemID aId, const TDesC& aFileName, TInt aFileIndex, TInt aFileMaskIndex)
       
   270 	{
       
   271     return TDialogUtil::CreateIconL(aId, aFileName, aFileIndex, aFileMaskIndex);
       
   272 	}
       
   273 
       
   274 
       
   275 //------------------------------------------------------------------------------
       
   276 // CAspSettingViewDialog::ProcessCommandL
       
   277 //
       
   278 // Handle commands from menu.
       
   279 //------------------------------------------------------------------------------
       
   280 //
       
   281 void CAspSettingViewDialog::ProcessCommandL(TInt aCommandId)
       
   282 	{
       
   283 	HideMenu();
       
   284 
       
   285 	switch (aCommandId)
       
   286 		{
       
   287 		case EAknCmdHelp:
       
   288 			{
       
   289 			TUtil::LaunchHelpAppL(iEikonEnv);
       
   290             break;
       
   291 			}
       
   292 
       
   293 		case EAspMenuCmdChange:
       
   294 		case EAspMenuCmdOpen:
       
   295 			{				
       
   296 			HandleOKL();
       
   297 			break;
       
   298 			}
       
   299 		    
       
   300         case EAspMenuCmdExit:
       
   301         case EAknCmdExit:
       
   302         case EEikCmdExit:
       
   303 			{
       
   304 			// close dialog and exit calling application
       
   305 			iAvkonAppUi->ProcessCommandL(EAknCmdExit);
       
   306 			break;
       
   307 			}
       
   308 
       
   309 		default:			
       
   310 		    break;
       
   311 		}
       
   312 	}
       
   313 
       
   314 
       
   315 //------------------------------------------------------------------------------
       
   316 // CAspSettingViewDialog::OkToExitL
       
   317 //
       
   318 //------------------------------------------------------------------------------
       
   319 //
       
   320 TBool CAspSettingViewDialog::OkToExitL(TInt aButtonId)
       
   321 	{
       
   322 	if (aButtonId == EEikBidCancel || aButtonId == EAknSoftkeyBack)
       
   323 		{
       
   324 		return ETrue; // close dialog
       
   325 		}
       
   326 
       
   327 	if (aButtonId == EAknSoftkeyOpen)  // MSK
       
   328         {
       
   329 	    HandleOKL();
       
   330 		return EFalse;  // leave dialog open
       
   331 		}
       
   332 
       
   333 	return CAknDialog::OkToExitL(aButtonId);
       
   334 	}
       
   335 
       
   336 
       
   337 
       
   338 
       
   339 // ----------------------------------------------------------------------------
       
   340 // CAspSettingViewDialog::OfferKeyEventL
       
   341 // 
       
   342 // ----------------------------------------------------------------------------
       
   343 //
       
   344 TKeyResponse CAspSettingViewDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
       
   345 	{
       
   346 	if (aType == EEventKey)
       
   347 		{
       
   348 		switch (aKeyEvent.iCode)
       
   349 			{
       
   350 			case EKeyEscape:  // framework calls this when dialog must shut down
       
   351 				{
       
   352 				return CAknDialog::OfferKeyEventL(aKeyEvent, aType);
       
   353         		}
       
   354 
       
   355 			default:
       
   356 				{
       
   357 			    break;
       
   358 				}
       
   359 			}
       
   360 		}
       
   361 
       
   362 	return CAknDialog::OfferKeyEventL( aKeyEvent, aType);
       
   363 	}
       
   364 
       
   365 // ----------------------------------------------------------------------------
       
   366 // CAspSettingViewDialog::HandleResourceChange
       
   367 // 
       
   368 // ----------------------------------------------------------------------------
       
   369 //
       
   370 void CAspSettingViewDialog::HandleResourceChange(TInt aType)
       
   371     {   
       
   372     if (aType == KEikDynamicLayoutVariantSwitch) //Handle change in layout orientation
       
   373         {
       
   374         TRect mainPaneRect;
       
   375         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
       
   376         SetRect(mainPaneRect);
       
   377         iSettingListBox->SetSize(mainPaneRect.Size());
       
   378         CCoeControl::HandleResourceChange(aType);
       
   379 		DrawDeferred();
       
   380 	    return;
       
   381 		}
       
   382 		
       
   383     if (aType == KAknsMessageSkinChange)
       
   384         {
       
   385         TRAP_IGNORE(SetIconsL());
       
   386         }
       
   387 		
       
   388     CCoeControl::HandleResourceChange(aType);
       
   389     }
       
   390 
       
   391 //------------------------------------------------------------------------------
       
   392 // CAspSettingViewDialog::HandleOKL
       
   393 //
       
   394 //------------------------------------------------------------------------------
       
   395 //
       
   396 void CAspSettingViewDialog::HandleOKL()
       
   397 	{
       
   398 	CAspListItemData* item = GetItemForIndex(ListBox()->CurrentItemIndex());
       
   399 
       
   400 	EditSettingItemL(*item);
       
   401 	SetVisibility();
       
   402 	UpdateListBoxL(iSettingListBox, iSettingList);
       
   403 	
       
   404 	}
       
   405 
       
   406 
       
   407 // ----------------------------------------------------------------------------
       
   408 // CAspSettingViewDialog::CreateSettingsListL
       
   409 // 
       
   410 // Function creates setting list array (iSettingsList).
       
   411 // ----------------------------------------------------------------------------
       
   412 //
       
   413 void CAspSettingViewDialog::CreateSettingsListL()
       
   414 	{
       
   415 	
       
   416 	AddProfileSettingItemL();
       
   417 #ifdef RD_DSUI_TIMEDSYNC
       
   418 
       
   419 	AddSchedulingSettingItemL();
       
   420 	
       
   421 #endif
       
   422 	AddContentItemsL();
       
   423 	SetVisibility();
       
   424 	UpdateListBoxL(iSettingListBox, iSettingList);
       
   425 	
       
   426 	}
       
   427 
       
   428 // ----------------------------------------------------------------------------
       
   429 // CAspSettingViewDialog::AddProfileSettingItemL
       
   430 // 
       
   431 // 
       
   432 // ----------------------------------------------------------------------------
       
   433 //
       
   434 void CAspSettingViewDialog::AddProfileSettingItemL()
       
   435 	{
       
   436 	
       
   437 	CAspListItemData* item = CAspListItemData::NewLC();
       
   438 	item->SetHeaderL(R_ASP_SETTING_FOLDER_PROFILE);
       
   439 	item->iItemId = EAspProfileSetting;
       
   440 	item->iItemType = CAspListItemData::ETypeProfileSetting;
       
   441 	item->iNumberData = KErrNotFound;
       
   442 	iSettingList->AppendL(item);
       
   443 	CleanupStack::Pop(item);
       
   444 		
       
   445 	}
       
   446 
       
   447 // ----------------------------------------------------------------------------
       
   448 // CAspSettingViewDialog::AddSchedulingSettingItemL
       
   449 // 
       
   450 // ----------------------------------------------------------------------------
       
   451 //
       
   452 void CAspSettingViewDialog::AddSchedulingSettingItemL()
       
   453 	{
       
   454     CAspListItemData* item = CAspListItemData::NewLC();
       
   455 	item->SetHeaderL(R_ASP_SETTING_FOLDER_SCHEDULE);
       
   456 	item->iItemId = EAspSchedulingSetting;
       
   457 	item->iItemType = CAspListItemData::ETypeSchedulingSetting;
       
   458 	item->iNumberData = KErrNotFound;
       
   459 	iSettingList->AppendL(item);
       
   460 	CleanupStack::Pop(item);
       
   461 	}
       
   462 
       
   463 	
       
   464 // ----------------------------------------------------------------------------
       
   465 // CAspSettingViewDialog::AddContentItemsL
       
   466 // 
       
   467 // ----------------------------------------------------------------------------
       
   468 //
       
   469 void CAspSettingViewDialog::AddContentItemsL()
       
   470 	{
       
   471    	TInt count = iContentList->ProviderCount();
       
   472 
       
   473 	for (TInt i=0; i<count; i++)
       
   474 		{
       
   475 		TAspProviderItem& providerItem = iContentList->ProviderItem(i);
       
   476 		TInt appId = TUtil::AppIdFromProviderId(providerItem.iDataProviderId);
       
   477 		if (iApplicationId != EApplicationIdSync && iApplicationId != appId)
       
   478 			{
       
   479 			continue;
       
   480 			}
       
   481 				
       
   482 		HBufC* firstLine = CAspResHandler::GetContentSettingLC(
       
   483 		                                   providerItem.iDataProviderId,
       
   484 		                                   providerItem.iDisplayName);
       
   485 		
       
   486 	    CAspListItemData* item = CAspListItemData::NewLC();
       
   487     
       
   488     	item->SetHeaderL(firstLine->Des());
       
   489 	    item->iItemId = EAspSyncContent;
       
   490 	    item->iItemType = CAspListItemData::ETypeSyncContent;
       
   491 	    item->iNumberData = providerItem.iDataProviderId;
       
   492 	    iSettingList->AppendL(item);
       
   493 	    CleanupStack::Pop(item);
       
   494 	    
       
   495 	    CleanupStack::PopAndDestroy(firstLine);
       
   496     	}
       
   497 	}
       
   498 
       
   499 
       
   500 // ----------------------------------------------------------------------------
       
   501 // CAspSettingViewDialog::UpdateListBoxL
       
   502 // 
       
   503 // Add settings headers into listbox.
       
   504 // ----------------------------------------------------------------------------
       
   505 //
       
   506 void CAspSettingViewDialog::UpdateListBoxL(CEikTextListBox* aListBox,
       
   507                                        CAspSettingList* aItemList)
       
   508 	{
       
   509 		
       
   510 	CDesCArray* arr = (CDesCArray*)aListBox->Model()->ItemTextArray();
       
   511 	arr->Reset();
       
   512 
       
   513 	TInt count = aItemList->Count();
       
   514 	for (TInt i=0; i<count; i++ )
       
   515 		{	
       
   516 		CAspListItemData* item = (*aItemList)[i];
       
   517 			
       
   518 		TBool convert = ETrue;
       
   519 		if (item->iHidden != EVisibilityHidden)
       
   520 			{
       
   521 			HBufC* hBuf = item->ListItemTextL(convert);
       
   522 			CleanupStack::PushL(hBuf);
       
   523 			
       
   524 			arr->AppendL(hBuf->Des());
       
   525 			
       
   526 			// store listbox index (from zero up) into setting item 
       
   527 			item->iIndex = arr->Count() - 1;
       
   528 
       
   529 			CleanupStack::PopAndDestroy(hBuf);
       
   530 			}
       
   531 		else
       
   532 			{
       
   533 			item->iIndex = KErrNotFound;
       
   534 			}
       
   535 		}
       
   536 
       
   537 	ListBox()->HandleItemAdditionL();
       
   538 	}
       
   539 
       
   540 
       
   541 //------------------------------------------------------------------------------
       
   542 // CAspSettingViewDialog::EditSettingItemL
       
   543 //
       
   544 // Calls setting editing functions. 
       
   545 //------------------------------------------------------------------------------
       
   546 //
       
   547 void CAspSettingViewDialog::EditSettingItemL(CAspListItemData& aItem)
       
   548 	{
       
   549 	TBool ret = KErrNone;
       
   550 	switch (aItem.iItemType)
       
   551 		{
       
   552     	case CAspListItemData::ETypeProfileSetting:
       
   553     	ret = EditSettingItemProfileSettingL();
       
   554 			break;
       
   555 
       
   556 		case CAspListItemData::ETypeSchedulingSetting:
       
   557     	ret = EditSettingItemSchedulingSettingL();
       
   558 			break;
       
   559 
       
   560 		case CAspListItemData::ETypeSyncContent:
       
   561 			ret = EditSettingItemSyncContentL(aItem);
       
   562 			break;
       
   563 
       
   564 		default:
       
   565 		    break;
       
   566 		}
       
   567 	
       
   568 		User::LeaveIfError(ret);
       
   569 	
       
   570 	
       
   571 	}
       
   572 
       
   573 // -----------------------------------------------------------------------------
       
   574 // CAspContentListDialog::EditSettingItemProfileSettingL
       
   575 //
       
   576 // -----------------------------------------------------------------------------
       
   577 //
       
   578 TInt CAspSettingViewDialog::EditSettingItemProfileSettingL()
       
   579 	{
       
   580  	TAspParam param(iApplicationId, iSyncSession);
       
   581     param.iProfile = iProfile;
       
   582     param.iProfileList = iProfileList;
       
   583     param.iMode = iEditMode;
       
   584     param.iContentList = iContentList;
       
   585     
       
   586     CAspProfileDialog::ShowDialogL(param);
       
   587     
       
   588     //Update profile name in navi pane ,to reflect any name change during profile editing
       
   589     iProfile->GetName(iBuf);
       
   590 	iStatusPaneHandler->SetTitleL(iBuf);
       
   591 	iStatusPaneHandler->SetNaviPaneTitleL(KNullDesC);
       
   592      
       
   593     return KErrNone;
       
   594 	}
       
   595 	
       
   596 // -----------------------------------------------------------------------------
       
   597 // CAspContentListDialog::EditSettingItemSchedulingSettingL
       
   598 //
       
   599 // -----------------------------------------------------------------------------
       
   600 //
       
   601 TInt CAspSettingViewDialog::EditSettingItemSchedulingSettingL()
       
   602 	{
       
   603  	TAspParam param(iApplicationId, iSyncSession);
       
   604     param.iProfileList = iProfileList;
       
   605     param.iProfile = iProfile;
       
   606 	param.iContentList = iContentList;
       
   607 	param.iSchedule = iSchedule;
       
   608 
       
   609 	TBool settingEnforcement = TUtil::SettingEnforcementState();
       
   610 	
       
   611 	CAspSchedule* schedule = CAspSchedule::NewLC();
       
   612 	if (schedule->IsAutoSyncEnabled() && !settingEnforcement)
       
   613 		{
       
   614 		TInt profileId = schedule->ProfileId();
       
   615 		if(profileId != iProfile->ProfileId() && profileId != KErrNotFound)
       
   616 			{
       
   617 			if(!TDialogUtil::ShowConfirmationQueryL(R_ASP_QUERY_AUTO_SYNC_ON))
       
   618 				{
       
   619 				CleanupStack::PopAndDestroy(schedule);
       
   620 				return KErrNone;
       
   621 				}
       
   622 			}
       
   623 		}
       
   624     CleanupStack::PopAndDestroy(schedule);
       
   625 
       
   626     CAspScheduleDialog::ShowDialogL(param);
       
   627 
       
   628     return KErrNone;
       
   629 	}
       
   630 
       
   631 // -----------------------------------------------------------------------------
       
   632 // CAspContentListDialog::EditSettingItemSyncContentL
       
   633 //
       
   634 // -----------------------------------------------------------------------------
       
   635 //
       
   636 TInt CAspSettingViewDialog::EditSettingItemSyncContentL(CAspListItemData& aItem)
       
   637 	{
       
   638 
       
   639 	TAspParam param(iApplicationId, iSyncSession);
       
   640     param.iProfile = iProfile;
       
   641     param.iDataProviderId = aItem.iNumberData;
       
   642     param.iSyncTaskId = KErrNotFound;
       
   643     param.iContentList = iContentList;
       
   644 
       
   645     CAspContentDialog::ShowDialogL(param);
       
   646 
       
   647 	    
       
   648     return KErrNone;
       
   649 	}
       
   650 
       
   651    
       
   652 //-----------------------------------------------------------------------------
       
   653 // CAspSettingViewDialog::GetItemForIndex
       
   654 // 
       
   655 // Find item in list position aIndex.
       
   656 //-----------------------------------------------------------------------------
       
   657 //
       
   658 CAspListItemData* CAspSettingViewDialog::GetItemForIndex(TInt aIndex)
       
   659 	{
       
   660 	CAspListItemData* item = NULL;
       
   661 	
       
   662 	TInt count = iSettingList->Count();
       
   663 	for (TInt i=0; i<count; i++)
       
   664 		{
       
   665 		CAspListItemData* temp = (*iSettingList)[i];
       
   666 		if (temp->iIndex == aIndex)
       
   667 			{
       
   668 			item = temp;
       
   669 			break;
       
   670 			}
       
   671 		}
       
   672 
       
   673 	__ASSERT_ALWAYS(item, TUtil::Panic(KErrGeneral));
       
   674 
       
   675     return item;
       
   676 	}
       
   677 
       
   678 //-----------------------------------------------------------------------------
       
   679 // CAspSettingViewDialog::SetVisibility
       
   680 // 
       
   681 // -----------------------------------------------------------------------------
       
   682 //
       
   683 void CAspSettingViewDialog::SetVisibility()
       
   684 	{
       
   685 	
       
   686 	if (iProfile->BearerType() == EAspBearerInternet)
       
   687 		{
       
   688 		Item(EAspSchedulingSetting)->iHidden = EVisibilityNormal;
       
   689 		}
       
   690 	else
       
   691 		{
       
   692 		Item(EAspSchedulingSetting)->iHidden = EVisibilityHidden;
       
   693 		}
       
   694 	}
       
   695 //-----------------------------------------------------------------------------
       
   696 // CAspSettingViewDialog::GetIndexFromProvider
       
   697 // 
       
   698 // Find index for a provider
       
   699 //-----------------------------------------------------------------------------
       
   700 //
       
   701 TInt CAspSettingViewDialog::GetIndexFromProvider(TInt aDataProvider)
       
   702 	{
       
   703 	
       
   704 	TInt count = iSettingList->Count();
       
   705 	TInt index;
       
   706 	for (index=0; index<count; index++)
       
   707 		{
       
   708 		CAspListItemData* temp = (*iSettingList)[index];
       
   709 		if (temp->iNumberData == aDataProvider)
       
   710 			{
       
   711 			break;
       
   712 			}
       
   713 		}
       
   714 	return index;
       
   715 	}
       
   716 	
       
   717 
       
   718 //-----------------------------------------------------------------------------
       
   719 // CAspSettingViewDialog::Item
       
   720 // 
       
   721 // Find item with aItemId.
       
   722 //-----------------------------------------------------------------------------
       
   723 //
       
   724 CAspListItemData* CAspSettingViewDialog::Item(TInt aItemId)
       
   725 	{
       
   726 	CAspListItemData* item = NULL;
       
   727 
       
   728 	TInt count = iSettingList->Count();
       
   729 	for (TInt i=0; i<count; i++)
       
   730 		{
       
   731 		CAspListItemData* temp = (*iSettingList)[i];
       
   732 		if (temp->iItemId == aItemId)
       
   733 			{
       
   734 			item = temp;
       
   735 			break;
       
   736 			}
       
   737 		}
       
   738 	
       
   739 	__ASSERT_ALWAYS(item, TUtil::Panic(KErrGeneral));
       
   740 
       
   741     return item;
       
   742 	}
       
   743 
       
   744 
       
   745 // -----------------------------------------------------------------------------
       
   746 // CAspSettingViewDialog::ListBox
       
   747 // 
       
   748 // -----------------------------------------------------------------------------
       
   749 //
       
   750 CAknSettingStyleListBox* CAspSettingViewDialog::ListBox()
       
   751 	{
       
   752 	return iSettingListBox;
       
   753 	}
       
   754 
       
   755 
       
   756 //  End of File