omads/omadsappui/AspSyncUtil/src/AspDialogUtil.cpp
branchRCL_3
changeset 52 4f0867e42d62
equal deleted inserted replaced
51:8e7494275d3a 52: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 // INCLUDE FILES
       
    20 
       
    21 #include "AspDialogUtil.h"
       
    22 #include "AspUtil.h"
       
    23 #include "AspSchedule.h"
       
    24 #include <aspsyncutil.mbg>  // for bitmap enumerations
       
    25 
       
    26 #include <aknnavilabel.h>
       
    27 #include <akntitle.h>           // CAknTitlePane
       
    28 #include <akncontext.h>         // CAknTitlePane
       
    29 #include <aknnotewrappers.h>    // CAknInformationNote
       
    30 #include <eikmenup.h>           // CEikMenuPane
       
    31 #include <aknlists.h>           // CAknSingleHeadingPopupMenuStyleListBox
       
    32 
       
    33 #include <aknmfnesettingpage.h>         // CAknDateSettingPage
       
    34 #include <aknradiobuttonsettingpage.h>  // CAknRadioButtonSettingPage
       
    35 #include <akntextsettingpage.h>         // CAknIntegerSettingPage
       
    36 #include <aknmessagequerydialog.h>      // CAknMessageQueryDialog
       
    37 #include <AknIndicatorContainer.h>
       
    38 
       
    39 #include <AknIconArray.h>   // for GulArray
       
    40 #include <gulicon.h>
       
    41 
       
    42 #include "AspSettingDialog.h"
       
    43 // ============================ MEMBER FUNCTIONS ===============================
       
    44 
       
    45 
       
    46 
       
    47 
       
    48 /*******************************************************************************
       
    49  * class TDialogUtil
       
    50  *******************************************************************************/
       
    51 
       
    52 
       
    53 //------------------------------------------------------------------------------
       
    54 // TDialogUtil::ShowTextQueryL
       
    55 //
       
    56 //------------------------------------------------------------------------------
       
    57 //
       
    58 void TDialogUtil::ShowTextQueryL(const TDesC& aTitle, TDes& aText, TInt aMaxLength)
       
    59 	{
       
    60 	CAknTextQueryDialog* query = CAknTextQueryDialog::NewL(aText);
       
    61 	CleanupStack::PushL(query);
       
    62 	query->SetPromptL(aTitle);
       
    63 	if (aMaxLength > 0)
       
    64 		{
       
    65 		query->SetMaxLength(aMaxLength);
       
    66 		}
       
    67     CleanupStack::Pop(query);		
       
    68 
       
    69 	query->ExecuteLD(R_ASP_TEXT_QUERY);
       
    70 	}
       
    71 
       
    72 
       
    73 //------------------------------------------------------------------------------
       
    74 // TDialogUtil::ShowMessageQueryL
       
    75 //
       
    76 //------------------------------------------------------------------------------
       
    77 //
       
    78 void TDialogUtil::ShowMessageQueryL(const TDesC& aTitle, const TDesC& aText)
       
    79 	{
       
    80 	TPtrC ptr = aText;
       
    81 	CAknMessageQueryDialog* query = CAknMessageQueryDialog::NewL(ptr);
       
    82 	query->PrepareLC(R_ASP_MESSAGE_QUERY);
       
    83 	_LIT(KEmpty, " ");
       
    84 	if (aTitle.Compare(KEmpty) != 0 )
       
    85 		{
       
    86 		CAknPopupHeadingPane* headingPane = query->Heading();
       
    87 		headingPane->SetTextL(aTitle);
       
    88 		}
       
    89 	query->RunLD();
       
    90 	}
       
    91 
       
    92 //------------------------------------------------------------------------------
       
    93 // TDialogUtil::ShowAutoSyncMessageQueryL
       
    94 //
       
    95 //------------------------------------------------------------------------------
       
    96 //
       
    97 void TDialogUtil::ShowAutoSyncMessageQueryL(const TDesC& aText)
       
    98 	{
       
    99 	TPtrC ptr = aText;
       
   100 	HBufC* hBuf = CAspResHandler::ReadLC(R_ASP_MAIN_AUTO_ERROR_LOG_LINK);
       
   101 	CAknMessageQueryDialog* query = CAknMessageQueryDialog::NewL(ptr);
       
   102 	CleanupStack::PushL(query);
       
   103 
       
   104 	TCallBack LogView(TDialogUtil::ShowAutoSyncLogL);
       
   105 	query->SetLink(LogView);
       
   106     query->SetLinkTextL(hBuf->Des());
       
   107 	
       
   108 	//CAknPopupHeadingPane* headingPane = query->Heading();
       
   109 	//headingPane->SetTextL(aTitle);
       
   110 
       
   111 	CleanupStack::Pop(query);
       
   112 	query->ExecuteLD(R_ASP_MESSAGE_QUERY);
       
   113 
       
   114 	CleanupStack::PopAndDestroy(hBuf);
       
   115 	}
       
   116 
       
   117 //------------------------------------------------------------------------------
       
   118 // TDialogUtil::ShowMessageQueryL
       
   119 //
       
   120 //------------------------------------------------------------------------------
       
   121 //
       
   122 void TDialogUtil::ShowMessageQueryL(const TDesC& aTitle, TInt aResource)
       
   123 	{
       
   124 	HBufC* hBuf = CAspResHandler::ReadLC(aResource);
       
   125 	ShowMessageQueryL(aTitle, hBuf->Des());
       
   126 	CleanupStack::PopAndDestroy(hBuf);
       
   127 	}
       
   128 
       
   129 	
       
   130 //------------------------------------------------------------------------------
       
   131 // TDialogUtil::ShowConfirmationQueryL
       
   132 //
       
   133 //------------------------------------------------------------------------------
       
   134 //
       
   135 TBool TDialogUtil::ShowConfirmationQueryL(const TDesC& aText)
       
   136 	{
       
   137 	CAknQueryDialog* queryDialog = new (ELeave) CAknQueryDialog;
       
   138 	TBool ret = queryDialog->ExecuteLD(R_ASP_CONFIRMATION_QUERY, aText);
       
   139 	return ret;
       
   140 	}
       
   141 
       
   142 //------------------------------------------------------------------------------
       
   143 // TDialogUtil::ShowRoamingConfirmationQueryL
       
   144 //
       
   145 //------------------------------------------------------------------------------
       
   146 //
       
   147 TBool TDialogUtil::ShowRoamingConfirmationQueryL(const TDesC& aText)
       
   148     {
       
   149     CAknQueryDialog* queryDialog = new (ELeave) CAknQueryDialog;
       
   150     TBool ret = queryDialog->ExecuteLD(R_ASP_ROAMING_CONFIRMATION_QUERY, aText);
       
   151     return ret;
       
   152     }
       
   153 
       
   154 //------------------------------------------------------------------------------
       
   155 // TDialogUtil::ShowRoamingConfirmationQueryL
       
   156 //
       
   157 //------------------------------------------------------------------------------
       
   158 //
       
   159 TBool TDialogUtil::ShowRoamingConfirmationQueryL(TInt aResource)
       
   160     {
       
   161     HBufC* hBuf = CAspResHandler::ReadLC(aResource);
       
   162     TBool ret = ShowRoamingConfirmationQueryL(hBuf->Des());
       
   163     CleanupStack::PopAndDestroy(hBuf);
       
   164     return ret;
       
   165     }
       
   166 
       
   167 
       
   168 //------------------------------------------------------------------------------
       
   169 // TDialogUtil::ShowConfirmationQueryL
       
   170 //
       
   171 //------------------------------------------------------------------------------
       
   172 //
       
   173 TBool TDialogUtil::ShowConfirmationQueryL(TInt aResource)
       
   174 	{
       
   175 	HBufC* hBuf = CAspResHandler::ReadLC(aResource);
       
   176 	TBool ret = ShowConfirmationQueryL(hBuf->Des());
       
   177 	CleanupStack::PopAndDestroy(hBuf);
       
   178 	return ret;
       
   179 	}
       
   180 
       
   181 
       
   182 //------------------------------------------------------------------------------
       
   183 // TDialogUtil::ShowInformationQueryL
       
   184 //
       
   185 //------------------------------------------------------------------------------
       
   186 //
       
   187 void TDialogUtil::ShowInformationQueryL(const TDesC& aText)
       
   188 	{
       
   189 	CAknQueryDialog* queryDialog = new (ELeave) CAknQueryDialog;
       
   190 	queryDialog->ExecuteLD(R_ASP_INFORMATION_QUERY, aText);
       
   191 	}
       
   192 
       
   193 
       
   194 //------------------------------------------------------------------------------
       
   195 // TDialogUtil::ShowInformationQueryL
       
   196 //
       
   197 //------------------------------------------------------------------------------
       
   198 //
       
   199 void TDialogUtil::ShowInformationQueryL(TInt aResource)
       
   200 	{
       
   201 	HBufC* hBuf = CAspResHandler::ReadLC(aResource);
       
   202 	ShowInformationQueryL(hBuf->Des());
       
   203 	CleanupStack::PopAndDestroy(hBuf);
       
   204 	}
       
   205 
       
   206 
       
   207 //------------------------------------------------------------------------------
       
   208 // TDialogUtil::ShowInformationNoteL
       
   209 //
       
   210 //------------------------------------------------------------------------------
       
   211 //
       
   212 void TDialogUtil::ShowInformationNoteL(TInt aResource)
       
   213 	{
       
   214 	HBufC* hBuf = CAspResHandler::ReadLC(aResource);
       
   215     ShowInformationNoteL(hBuf->Des());
       
   216 	CleanupStack::PopAndDestroy(hBuf);
       
   217 	}
       
   218 
       
   219 
       
   220 //------------------------------------------------------------------------------
       
   221 // TDialogUtil::ShowInformationNoteL
       
   222 //
       
   223 //------------------------------------------------------------------------------
       
   224 //
       
   225 void TDialogUtil::ShowInformationNoteL(const TDesC& aText)
       
   226 	{
       
   227 	CAknInformationNote* queryDialog = new (ELeave) CAknInformationNote(ETrue);
       
   228 	queryDialog->ExecuteLD(aText);
       
   229 	}
       
   230 
       
   231 
       
   232 //------------------------------------------------------------------------------
       
   233 // TDialogUtil::ShowErrorNoteL
       
   234 //
       
   235 //------------------------------------------------------------------------------
       
   236 //
       
   237 void TDialogUtil::ShowErrorNoteL(TInt aResource)
       
   238 	{
       
   239 	HBufC* hBuf = CAspResHandler::ReadLC(aResource);
       
   240 	ShowErrorNoteL(hBuf->Des());
       
   241 	CleanupStack::PopAndDestroy(hBuf);
       
   242 	}
       
   243 
       
   244 
       
   245 //------------------------------------------------------------------------------
       
   246 // TDialogUtil::ShowErrorNoteL
       
   247 //
       
   248 //------------------------------------------------------------------------------
       
   249 //
       
   250 void TDialogUtil::ShowErrorNoteL(const TDesC& aText)
       
   251 	{
       
   252 	CAknErrorNote* errorNote = new (ELeave) CAknErrorNote(ETrue);
       
   253 	errorNote->ExecuteLD(aText);
       
   254 	}
       
   255 
       
   256 
       
   257 //------------------------------------------------------------------------------
       
   258 // TDialogUtil::ShowErrorQueryL
       
   259 //
       
   260 //------------------------------------------------------------------------------
       
   261 //
       
   262 void TDialogUtil::ShowErrorQueryL(TInt aResource)
       
   263 	{
       
   264 	HBufC* hBuf = CAspResHandler::ReadLC(aResource);
       
   265 	ShowErrorQueryL(hBuf->Des());
       
   266 	CleanupStack::PopAndDestroy(hBuf);
       
   267 	}
       
   268 
       
   269 
       
   270 //------------------------------------------------------------------------------
       
   271 // TDialogUtil::ShowErrorQueryL
       
   272 //
       
   273 //------------------------------------------------------------------------------
       
   274 //
       
   275 void TDialogUtil::ShowErrorQueryL(const TDesC& aText)
       
   276 	{
       
   277 	CAknQueryDialog* queryDialog = new (ELeave) CAknQueryDialog;
       
   278 	queryDialog->ExecuteLD(R_ASP_ERROR_QUERY, aText);
       
   279 	}
       
   280 
       
   281 
       
   282 // -----------------------------------------------------------------------------
       
   283 // TDialogUtil::ShowListQueryL
       
   284 // 
       
   285 // -----------------------------------------------------------------------------
       
   286 TBool TDialogUtil::ShowListQueryL(const TDesC& aTitle, CDesCArray* aList, TInt* aSelectedIndex)
       
   287 	{
       
   288 	CAknListQueryDialog* query = new (ELeave) CAknListQueryDialog(aSelectedIndex);
       
   289 	CleanupStack::PushL(query);
       
   290 
       
   291 	query->PrepareLC(R_ASP_LIST_QUERY);
       
   292 	query->SetItemTextArray(aList);
       
   293 	query->SetOwnershipType(ELbmDoesNotOwnItemArray);
       
   294 	CAknPopupHeadingPane* headingPane = query->QueryHeading();
       
   295 	headingPane->SetTextL(aTitle);
       
   296 	
       
   297 	CleanupStack::Pop(query);
       
   298 
       
   299 	return query->RunLD();
       
   300 	}
       
   301 
       
   302 //------------------------------------------------------------------------------
       
   303 // TDialogUtil::ShowListQueryIconL
       
   304 //
       
   305 //------------------------------------------------------------------------------
       
   306 TBool TDialogUtil::ShowListQueryIconL(const TDesC& aTitle, CDesCArray* aList, TInt* aSelectedIndex)
       
   307 	{
       
   308 	  
       
   309 	 CAknListQueryDialog* query = new (ELeave) CAknListQueryDialog(aSelectedIndex);
       
   310 	 CleanupStack::PushL(query);
       
   311 	 query->PrepareLC(R_ASP_LIST_APP_QUERY);
       
   312 	 
       
   313 	 
       
   314 	 query->SetItemTextArray(aList);
       
   315 	 query->SetOwnershipType(ELbmOwnsItemArray);
       
   316 	 
       
   317 	 CArrayPtr<CGulIcon>* iconList = new (ELeave) CAknIconArray(1);
       
   318 	 CleanupStack::PushL(iconList);
       
   319 	 
       
   320  	 TFileName bitmapName;
       
   321  	 CAspResHandler::GetBitmapFileName(bitmapName);
       
   322  	 //renders Qgn_Prop_Sml_New icon
       
   323 	 iconList->AppendL(CreateIconL(KAknsIIDQgnPropSmlNew, bitmapName, 
       
   324 	                     EMbmAspsyncutilQgn_prop_sml_new,
       
   325 	                     EMbmAspsyncutilQgn_prop_sml_new_mask) );
       
   326 	 query->SetIconArrayL(iconList);
       
   327 	 CAknPopupHeadingPane* headingPane = query->QueryHeading();
       
   328  	 headingPane->SetTextL(aTitle);
       
   329  	  
       
   330 	 CleanupStack::Pop(iconList);
       
   331 	 CleanupStack::Pop(query);
       
   332 	 return query->RunLD();
       
   333 	}
       
   334 
       
   335 // -----------------------------------------------------------------------------
       
   336 // TDialogUtil::ShowListQueryL
       
   337 // 
       
   338 // -----------------------------------------------------------------------------
       
   339 TBool TDialogUtil::ShowListQueryL(TInt aTitle, CDesCArray* aList, TInt* aSelectedIndex)
       
   340 	{
       
   341 	HBufC* hBuf = CAspResHandler::ReadLC(aTitle);
       
   342 
       
   343     TBool ret = ShowListQueryL(hBuf->Des(), aList, aSelectedIndex);
       
   344    	CleanupStack::PopAndDestroy(hBuf);
       
   345    	
       
   346    	return ret;
       
   347 	}
       
   348 
       
   349 //------------------------------------------------------------------------------
       
   350 //TDialogUtil::ShowListQueryIconL
       
   351 //
       
   352 //------------------------------------------------------------------------------
       
   353 TBool TDialogUtil::ShowListQueryIconL(TInt aTitle, CDesCArray* aList, TInt* aSelectedIndex)
       
   354 	{
       
   355 	HBufC* hBuf = CAspResHandler::ReadLC(aTitle);
       
   356 
       
   357     TBool ret = ShowListQueryIconL(hBuf->Des(), aList, aSelectedIndex);
       
   358    	CleanupStack::PopAndDestroy(hBuf);
       
   359    	
       
   360    	return ret;
       
   361 	}
       
   362 // -----------------------------------------------------------------------------
       
   363 // TDialogUtil::ShowProfileQueryL
       
   364 // 
       
   365 // -----------------------------------------------------------------------------
       
   366 TBool TDialogUtil::ShowProfileQueryL(CAspProfileList* aList, TInt& aId, TInt aResource)
       
   367 	{
       
   368 	aId = KErrNotFound;
       
   369 	
       
   370 	CDesCArray* arr = new (ELeave) CDesCArrayFlat(KDefaultArraySize);
       
   371 	CleanupStack::PushL(arr);
       
   372 
       
   373 	TInt count = aList->Count();
       
   374 	for (TInt i=0; i<count; i++)
       
   375 		{
       
   376 		TAspProfileItem& profile = aList->Item(i);
       
   377 		arr->AppendL(profile.iProfileName);
       
   378 		}
       
   379 
       
   380     TInt index=KErrNotFound;
       
   381 	TBool ret = ShowListQueryL(aResource, arr, &index);
       
   382 	
       
   383 	if (ret)
       
   384 		{
       
   385 	    TAspProfileItem& profile = aList->Item(index);
       
   386 	    aId = profile.iProfileId;
       
   387 		}
       
   388 
       
   389 	CleanupStack::PopAndDestroy(arr);
       
   390 	return ret;
       
   391 	}
       
   392 //------------------------------------------------------------------------------
       
   393 //TDialogUtil::ShowProfileQueryAppL
       
   394 //
       
   395 //-----------------------------------------------------------------------------
       
   396 
       
   397 TBool TDialogUtil::ShowProfileQueryAppL(CAspProfileList* aList, TInt& aId, TInt aResource,TInt &index1)
       
   398 {
       
   399 	aId = KErrNotFound;
       
   400 	
       
   401 	CDesCArray* arr = new (ELeave) CDesCArrayFlat(KDefaultArraySize);
       
   402 	CleanupStack::PushL(arr);
       
   403       
       
   404     
       
   405 	HBufC* hBuf = CAspResHandler::ReadLC(R_ASP_SELECT_PROFILE_CREATE_NEW);
       
   406     TPtr ptr = hBuf->Des();
       
   407   
       
   408     //"%d\t%S" for formatting the icon and text data in the query dialog 
       
   409    	 _LIT(KListItemFormat,"%d\t%S");
       
   410 	 TBuf<KBufSize> item;
       
   411      item.Format(KListItemFormat,0 , &ptr);
       
   412 	 arr->AppendL(item);
       
   413    	 CleanupStack::PopAndDestroy(hBuf);
       
   414        
       
   415     
       
   416 	 TInt count = aList->Count();
       
   417 	 for (TInt i=0; i< count; i++)
       
   418 		{
       
   419 		TAspProfileItem& profile = aList->Item(i);
       
   420 		//"\t%S" no need of keeping icon for profile list
       
   421 		_LIT(KListItemFormat,"\t%S");
       
   422 		HBufC* hBuf1=TUtil::StrConversion(profile.iProfileName);
       
   423 		TPtr ptr1=hBuf1->Des();
       
   424 		item.Format(KListItemFormat,&ptr1);
       
   425 		CleanupStack::PopAndDestroy(hBuf1);
       
   426 	    arr->AppendL(item);
       
   427 		}
       
   428 		
       
   429 	
       
   430 	TInt index=KErrNotFound;
       
   431 	TBool ret = ShowListQueryIconL(aResource, arr, &index);
       
   432 
       
   433 	if (ret)
       
   434 		{
       
   435 		
       
   436 		  if(index==0) //to check if R_ASP_SELECT_PROFILE_CREATE_NEW is selected
       
   437 				{
       
   438 	   				 ret=EFalse;
       
   439 	   				 index1=1;
       
   440 	    			 CleanupStack::Pop(arr);
       
   441 					 return ret;
       
   442 				}
       
   443 		
       
   444 	    TAspProfileItem& profile = aList->Item(index-1);
       
   445 	    aId = profile.iProfileId;
       
   446 	    
       
   447 		}
       
   448 
       
   449 	CleanupStack::Pop(arr);
       
   450 	return ret;
       
   451 }
       
   452 
       
   453 
       
   454 // -----------------------------------------------------------------------------
       
   455 // TDialogUtil::DeleteMenuItem
       
   456 //
       
   457 // -----------------------------------------------------------------------------
       
   458 //
       
   459 void TDialogUtil::DeleteMenuItem(CEikMenuPane* aMenuPane, TInt aCommandId)
       
   460 	{
       
   461 	TInt pos=KErrNotFound;
       
   462     if (aMenuPane->MenuItemExists(aCommandId, pos))
       
   463 		{
       
   464 		aMenuPane->DeleteMenuItem(aCommandId);
       
   465 		}
       
   466 	}
       
   467 
       
   468 
       
   469 // -----------------------------------------------------------------------------
       
   470 // TDialogUtil::CreateIconL
       
   471 //
       
   472 // Constructs an independent CGulIcon object with fallback support.
       
   473 // If no matching item (aId) is found in the currently active skin,
       
   474 // attempts to construct the item using the given file (last 3 parameters).
       
   475 // -----------------------------------------------------------------------------
       
   476 //
       
   477 CGulIcon* TDialogUtil::CreateIconL(TAknsItemID aId, const TDesC& aFileName, TInt aFileBitmapId, TInt aFileMaskId)
       
   478 	{
       
   479     CGulIcon* icon = AknsUtils::CreateGulIconL(AknsUtils::SkinInstance(), aId, aFileName, aFileBitmapId, aFileMaskId);
       
   480 	return icon;
       
   481 	}
       
   482 
       
   483 
       
   484 // -----------------------------------------------------------------------------
       
   485 // TDialogUtil::CreateImageL
       
   486 //
       
   487 // -----------------------------------------------------------------------------
       
   488 //
       
   489 CEikImage* TDialogUtil::CreateImageLC(TAknsItemID aId, const TDesC& aFileName, TInt aFileBitmapId, TInt aFileMaskId)
       
   490 	{
       
   491 	CFbsBitmap* bitmap1 = NULL;
       
   492 	CFbsBitmap* bitmap2 = NULL;
       
   493 	
       
   494 	CEikImage* image = new (ELeave) CEikImage;
       
   495 	CleanupStack::PushL(image);
       
   496 
       
   497 	AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), aId, bitmap1, bitmap2, aFileName, aFileBitmapId, aFileMaskId);
       
   498 	image->SetPicture(bitmap1, bitmap2);
       
   499 	CleanupStack::Pop(2); // bitmap1 bitmap2
       
   500 
       
   501 	return image;
       
   502 	}
       
   503 
       
   504 
       
   505 // -----------------------------------------------------------------------------
       
   506 // TDialogUtil::ConstructListBoxItemL
       
   507 //
       
   508 // -----------------------------------------------------------------------------
       
   509 //
       
   510 HBufC* TDialogUtil::ConstructListBoxItemLC(const TDesC& aFirstLine, const TDesC& aSecondLine, TInt /*aIndex*/)
       
   511 	{
       
   512     _LIT(KFormat, "%d\t%S\t%S");
       
   513 	
       
   514 	TInt len = aFirstLine.Length() + aSecondLine.Length() + KBufSize16;
       
   515 	
       
   516 	HBufC* hBuf = HBufC::NewLC(len);
       
   517 	TPtr ptr = hBuf->Des();
       
   518 	
       
   519 	ptr.Format(KFormat, 1, &aFirstLine, &aSecondLine);
       
   520 	
       
   521 	
       
   522 	return hBuf;
       
   523 	}
       
   524 
       
   525 
       
   526 // -----------------------------------------------------------------------------
       
   527 // TDialogUtil::ShowTimeEditorL
       
   528 //
       
   529 // -----------------------------------------------------------------------------
       
   530 //
       
   531 TBool TDialogUtil::ShowTimeEditorL(TTime& aTime, const TDesC& aTitle)
       
   532 	{
       
   533     CAknTimeSettingPage* dlg = new (ELeave) CAknTimeSettingPage(R_ASP_SETTING_TIME, aTime);
       
   534     
       
   535    	CleanupStack::PushL(dlg);
       
   536 	dlg->ConstructL();
       
   537 	dlg->SetSettingTextL(aTitle);
       
   538 	CleanupStack::Pop(dlg);
       
   539 
       
   540     
       
   541     if (dlg->ExecuteLD(CAknSettingPage::EUpdateWhenAccepted))
       
   542         {
       
   543         return ETrue;
       
   544         }
       
   545         
       
   546     return EFalse;
       
   547 	}
       
   548 
       
   549 
       
   550 // -----------------------------------------------------------------------------
       
   551 // TDialogUtil::ShowDateEditorL
       
   552 //
       
   553 // -----------------------------------------------------------------------------
       
   554 //
       
   555 TBool TDialogUtil::ShowDateEditorL(TTime& aTime, const TDesC& aTitle)
       
   556 	{
       
   557     CAknDateSettingPage* dlg = new (ELeave) CAknDateSettingPage(R_ASP_SETTING_DATE, aTime);
       
   558     
       
   559    	CleanupStack::PushL(dlg);
       
   560 	dlg->ConstructL();
       
   561 	dlg->SetSettingTextL(aTitle);
       
   562 	CleanupStack::Pop(dlg);
       
   563 
       
   564     if (dlg->ExecuteLD(CAknSettingPage::EUpdateWhenAccepted))
       
   565         {
       
   566         return ETrue;
       
   567         }
       
   568         
       
   569     return EFalse;
       
   570 	}
       
   571 
       
   572 
       
   573 //------------------------------------------------------------------------------
       
   574 // TDialogUtil::ShowListEditorL
       
   575 //
       
   576 //------------------------------------------------------------------------------
       
   577 //
       
   578 TBool TDialogUtil::ShowListEditorL(CDesCArray* aList, const TDesC& aTitle, TInt& aCurrent)
       
   579 	{
       
   580 
       
   581 	CAknRadioButtonSettingPage* dlg = new (ELeave) CAknRadioButtonSettingPage(
       
   582 	                                       R_ASP_SETTING_RADIO, aCurrent, aList);
       
   583 	CleanupStack::PushL(dlg);
       
   584 	dlg->SetSettingTextL(aTitle); 
       
   585 	CleanupStack::Pop(dlg);
       
   586 
       
   587 	return dlg->ExecuteLD();
       
   588 	}
       
   589 
       
   590 //------------------------------------------------------------------------------
       
   591 // TDialogUtil::ShowListEditorL
       
   592 //
       
   593 //------------------------------------------------------------------------------
       
   594 //
       
   595 TBool TDialogUtil::ShowListEditorL(TInt aResourceId, CDesCArray* aList, const TDesC& aTitle, TInt& aCurrent)
       
   596 	{
       
   597 	CAspRadioButtonSettingPageEditor* dlg = new (ELeave) CAspRadioButtonSettingPageEditor(
       
   598 	                                       aResourceId, aCurrent, aList);
       
   599 	CleanupStack::PushL(dlg);
       
   600 	dlg->SetSettingTextL(aTitle); 
       
   601 	CleanupStack::Pop(dlg);
       
   602 
       
   603 	return dlg->ExecuteLD();
       
   604 	}
       
   605 
       
   606 
       
   607 //------------------------------------------------------------------------------
       
   608 // TDialogUtil::ShowTextEditorL
       
   609 //
       
   610 //------------------------------------------------------------------------------
       
   611 //
       
   612 TBool TDialogUtil::ShowTextEditorL(TInt aResourceId, TDes& aText, const TDesC& aTitle, TBool aMandatory, TBool aLatinInput, TInt aMaxLength)
       
   613 	{
       
   614 	TInt flags(CAknTextSettingPage::EZeroLengthAllowed);
       
   615 
       
   616 	if (aMandatory)
       
   617 		{
       
   618 		flags = CAknTextSettingPage::EZeroLengthNotOffered;
       
   619 		}
       
   620 
       
   621 	CAspTextSettingPageEditor * dlg = new (ELeave) CAspTextSettingPageEditor(aResourceId, aText, flags);
       
   622 	CleanupStack::PushL(dlg);
       
   623 
       
   624 	dlg->SetSettingTextL(aTitle); 
       
   625 	dlg->ConstructL();
       
   626 	dlg->TextControl()->SetTextLimit(aMaxLength);
       
   627 
       
   628 	if (aLatinInput)
       
   629 		{		
       
   630 		dlg->TextControl()->SetAvkonWrap(ETrue);
       
   631 		dlg->TextControl()->SetAknEditorCase(EAknEditorLowerCase);
       
   632 		dlg->TextControl()->SetAknEditorFlags(EAknEditorFlagNoT9 | EAknEditorFlagLatinInputModesOnly);
       
   633 		}
       
   634 	
       
   635 	CleanupStack::Pop(dlg);
       
   636 
       
   637 	// CAknTextSettingPage::ExecuteLD only return boolean. See CAknSettingPage::ProcessCommandL
       
   638 	// what softkey values map to ETrue and EFalse.
       
   639 	TInt ret = dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
       
   640 	if (ret)
       
   641 		{
       
   642     	return ETrue;
       
   643 		}
       
   644 
       
   645 	return EFalse;
       
   646 	}
       
   647 
       
   648 
       
   649 //------------------------------------------------------------------------------
       
   650 // TDialogUtil::ShowTextEditorL
       
   651 //
       
   652 //------------------------------------------------------------------------------
       
   653 //
       
   654 TBool TDialogUtil::ShowTextEditorL(TDes& aText, const TDesC& aTitle, TBool aMandatory, TBool aLatinInput, TInt aMaxLength)
       
   655 	{
       
   656 	return ShowTextEditorL(R_ASP_SETTING_TEXT, aText, aTitle, aMandatory, aLatinInput, aMaxLength);
       
   657 	}
       
   658 
       
   659 
       
   660 //------------------------------------------------------------------------------
       
   661 // TDialogUtil::ShowIntegerEditorL
       
   662 //
       
   663 //------------------------------------------------------------------------------
       
   664 //
       
   665 TBool TDialogUtil::ShowIntegerEditorL(TInt& aNumber, const TDesC& aTitle, TInt aMin, TInt aMax, TBool aLatinInput)
       
   666 	{
       
   667 	CAspIntegerSettingPageEditor* dlg = new (ELeave) CAspIntegerSettingPageEditor(
       
   668 	                              R_ASP_SETTING_NUMBER, aNumber,
       
   669 	                              CAknIntegerSettingPage::EInvalidValueNotOffered);
       
   670 	CleanupStack::PushL(dlg);
       
   671 	dlg->ConstructL();
       
   672 	dlg->SetSettingTextL(aTitle);
       
   673 	CleanupStack::Pop(dlg);
       
   674 	
       
   675 	CAknIntegerEdwin* editor = dlg->IntegerEditorControl();
       
   676 	if (aMin != KErrNotFound)
       
   677 		{
       
   678 		editor->SetMinimumIntegerValue(aMin);
       
   679 		}
       
   680 	if (aMax != KErrNotFound)
       
   681 		{
       
   682 		editor->SetMaximumIntegerValue(aMax);
       
   683 		}
       
   684 
       
   685 	editor->SetAknEditorNumericKeymap(EAknEditorPlainNumberModeKeymap);
       
   686 	
       
   687 	if (aLatinInput)
       
   688 		{
       
   689 		editor->SetAknEditorFlags(EAknEditorFlagLatinInputModesOnly);
       
   690 		editor->SetValueL(aNumber);
       
   691 		}
       
   692 
       
   693 	if (dlg->ExecuteLD(CAknIntegerSettingPage::EUpdateWhenChanged))
       
   694 		{
       
   695 		return ETrue;
       
   696 		}
       
   697 
       
   698 	return EFalse;
       
   699 	}
       
   700 
       
   701 
       
   702 // -----------------------------------------------------------------------------
       
   703 // TDialogUtil::ShowPopupDialogL
       
   704 // 
       
   705 // -----------------------------------------------------------------------------
       
   706 void TDialogUtil::ShowPopupDialogL(const TDesC& aText, CDesCArray* aArray)
       
   707 	{
       
   708 	CAknSingleHeadingPopupMenuStyleListBox* listBox = new (ELeave) CAknSingleHeadingPopupMenuStyleListBox;
       
   709 	CleanupStack::PushL(listBox);
       
   710 
       
   711 
       
   712 	CAknPopupList* popupList = CAknPopupList::NewL(listBox, R_AVKON_SOFTKEYS_OK_EMPTY, AknPopupLayouts::EMenuWindow);
       
   713 	CleanupStack::PushL(popupList);
       
   714 
       
   715 	listBox->ConstructL(popupList, EAknListBoxViewerFlags);
       
   716 	
       
   717 	CDesCArray* array = (CDesCArray*) listBox->Model()->ItemTextArray();
       
   718 	listBox->CreateScrollBarFrameL(ETrue); 
       
   719 	listBox->ScrollBarFrame()->	SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
       
   720     
       
   721 	TInt count = aArray->Count();
       
   722 	for (TInt i=0; i<count; i++)
       
   723 		{
       
   724 		TPtrC ptr = (*aArray)[i];
       
   725 		array->AppendL(ptr);
       
   726 		}
       
   727 	
       
   728 	popupList->SetTitleL(aText);
       
   729 
       
   730 	popupList->ExecuteLD();
       
   731 
       
   732 	CleanupStack::Pop(popupList);
       
   733 	CleanupStack::PopAndDestroy(listBox);
       
   734 	}
       
   735 
       
   736 
       
   737 // -----------------------------------------------------------------------------
       
   738 // TDialogUtil::ShowPopupDialog2L
       
   739 // 
       
   740 // -----------------------------------------------------------------------------
       
   741 void TDialogUtil::ShowPopupDialog2L(const TDesC& aText, CDesCArray* aArray)
       
   742 	{
       
   743     CAknDoublePopupMenuStyleListBox* listBox = new(ELeave) CAknDoublePopupMenuStyleListBox;
       
   744     
       
   745     CleanupStack::PushL(listBox);
       
   746 
       
   747     // Avkon popup list with heading
       
   748     CAknPopupList* popupList = CAknPopupList::NewL(listBox, R_AVKON_SOFTKEYS_OK_EMPTY, AknPopupLayouts::EMenuDoubleWindow);
       
   749     CleanupStack::PushL(popupList);
       
   750     
       
   751     // Set listbox properties and create item array
       
   752     listBox->ConstructL(popupList, EAknListBoxViewerFlags);
       
   753     listBox->CreateScrollBarFrameL(ETrue);
       
   754     listBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
       
   755     
       
   756    	CDesCArray* array = (CDesCArray*) listBox->Model()->ItemTextArray();
       
   757 	TInt count = aArray->Count();
       
   758 	for (TInt i=0; i<count; i++)
       
   759 		{
       
   760 		TPtrC ptr = (*aArray)[i];
       
   761 		array->AppendL(ptr);
       
   762 		}
       
   763     popupList->SetTitleL(aText);
       
   764     	
       
   765     popupList->ExecuteLD();
       
   766 
       
   767     CleanupStack::Pop(popupList);
       
   768     CleanupStack::PopAndDestroy(listBox);
       
   769 	}
       
   770 
       
   771 // -----------------------------------------------------------------------------
       
   772 // TDialogUtil::ShowAutoSyncLogL
       
   773 // 
       
   774 // -----------------------------------------------------------------------------
       
   775 TInt TDialogUtil::ShowAutoSyncLogL(TAny* /*aAny*/)
       
   776 	{
       
   777 
       
   778 	CAspSchedule* schedule = CAspSchedule::NewLC();
       
   779 	TRAPD (err,schedule->ShowAutoSyncLogL());
       
   780 	CleanupStack::PopAndDestroy(schedule);
       
   781 
       
   782 	if (err == KErrNone)
       
   783 		{
       
   784 		return ETrue;
       
   785 		}
       
   786 	return EFalse;
       
   787 	}
       
   788 
       
   789 //-----------------------------------------------------------------------------
       
   790 //
       
   791 //Does Descriptor contain string "PC Suite"
       
   792 //Its NOT case sensitive
       
   793 //
       
   794 //-----------------------------------------------------------------------------
       
   795 TBool TDialogUtil::IsPCSuiteDesC(const TDesC& des)
       
   796 {
       
   797 	_LIT(KPCSuite, "pc suite");
       
   798 	TPtrC pcSuitePtr(KPCSuite);
       
   799 	
       
   800 	TBuf<KBufSize64> buf;
       
   801 	TUtil::StrCopy(buf,des);
       
   802 	buf.LowerCase();
       
   803 	if (buf.Match(pcSuitePtr) == 0)
       
   804 	{
       
   805 		return ETrue;
       
   806 	}
       
   807 		
       
   808 	return EFalse;
       
   809 }
       
   810 	    		
       
   811 
       
   812 /*******************************************************************************
       
   813  * class CAspIndicatorHandler
       
   814  *******************************************************************************/
       
   815 
       
   816 
       
   817 // -----------------------------------------------------------------------------
       
   818 // Destructor
       
   819 //
       
   820 // -----------------------------------------------------------------------------
       
   821 //
       
   822 CAspIndicatorHandler::~CAspIndicatorHandler()
       
   823     {
       
   824     if (iIndicator && iIndicatorContainer && iIndicatorModified)
       
   825     	{
       
   826         if (iPreviousIndicatorType == EAknNaviPaneEditorIndicatorMessageLength)
       
   827         	{
       
   828         	TRAP_IGNORE( iIndicatorContainer->SetIndicatorValueL(
       
   829                       TUid::Uid(EAknNaviPaneEditorIndicatorMessageLength), KNullDesC) );
       
   830             }
       
   831 
       
   832         iIndicatorContainer->SetIndicatorState(TUid::Uid(iIndicatorType), EAknIndicatorStateOff);
       
   833         }
       
   834     }
       
   835 
       
   836 
       
   837 // -----------------------------------------------------------------------------
       
   838 // CAspIndicatorHandler::CAspIndicatorHandler
       
   839 //
       
   840 // -----------------------------------------------------------------------------
       
   841 //
       
   842 CAspIndicatorHandler::CAspIndicatorHandler(MAknEditingStateIndicator* aIndicator) : iIndicator(aIndicator)
       
   843 	{
       
   844 	iIndicatorContainer = iIndicator->IndicatorContainer();
       
   845     iIndicatorModified = EFalse;
       
   846     iPreviousIndicatorType = KErrNotFound;
       
   847 	}
       
   848 
       
   849 
       
   850 // ----------------------------------------------------------------------------
       
   851 // CAspIndicatorHandler::SetIndicatorStateL
       
   852 // 
       
   853 // ----------------------------------------------------------------------------
       
   854 //
       
   855 void CAspIndicatorHandler::SetIndicatorStateL(TInt aIndicatorType, const TDesC& aText)
       
   856 	{
       
   857     if (iIndicator && iIndicatorContainer)
       
   858     	{
       
   859    	
       
   860         if (iPreviousIndicatorType == EAknNaviPaneEditorIndicatorMessageLength)
       
   861         	{
       
   862         	iIndicatorContainer->SetIndicatorValueL(
       
   863                       TUid::Uid(EAknNaviPaneEditorIndicatorMessageLength), KNullDesC);
       
   864             }
       
   865 
       
   866     	iIndicatorContainer->SetIndicatorState(TUid::Uid(aIndicatorType),
       
   867                                                EAknIndicatorStateOn);
       
   868                                                
       
   869         iIndicatorModified = ETrue;
       
   870         iPreviousIndicatorType = aIndicatorType;
       
   871         
       
   872                                                
       
   873         if (aIndicatorType == EAknNaviPaneEditorIndicatorMessageLength)
       
   874         	{
       
   875         	iIndicatorContainer->SetIndicatorValueL(
       
   876                                  TUid::Uid(EAknNaviPaneEditorIndicatorMessageLength), aText);
       
   877             iPreviousIndicatorType = aIndicatorType;
       
   878             }
       
   879     	}
       
   880 	
       
   881 	}
       
   882 
       
   883 
       
   884 
       
   885 /*******************************************************************************
       
   886  * class CAspNaviPaneHandler
       
   887  *******************************************************************************/
       
   888 
       
   889 
       
   890 // -----------------------------------------------------------------------------
       
   891 // Destructor
       
   892 //
       
   893 // -----------------------------------------------------------------------------
       
   894 //
       
   895 CAspNaviPaneHandler::~CAspNaviPaneHandler()
       
   896     {
       
   897    	if (iNaviDecorator)
       
   898 		{
       
   899 		if (iNaviPane && iNavidecoratorPushed)
       
   900 			{
       
   901 			iNaviPane->Pop(iNaviDecorator);
       
   902 			}
       
   903 	
       
   904 		delete iNaviDecorator;
       
   905 		}
       
   906 		
       
   907 	if (iNaviPane && iNavipanePushed)
       
   908 		{
       
   909 		iNaviPane->Pop(); // restore previous navi pane
       
   910 		}
       
   911     }
       
   912 
       
   913 
       
   914 // -----------------------------------------------------------------------------
       
   915 // CAspNaviPaneHandler::CAspNaviPaneHandler
       
   916 //
       
   917 // -----------------------------------------------------------------------------
       
   918 //
       
   919 CAspNaviPaneHandler::CAspNaviPaneHandler(CEikStatusPane* aStatusPane) : iStatusPane(aStatusPane)
       
   920 	{
       
   921 	iNavidecoratorPushed = EFalse;
       
   922 	iNavipanePushed = EFalse;
       
   923 	
       
   924 	if (iStatusPane)
       
   925 		{
       
   926 		TRAP_IGNORE( iNaviPane = (CAknNavigationControlContainer*)iStatusPane->ControlL(TUid::Uid(EEikStatusPaneUidNavi)) );
       
   927 		}
       
   928 	}
       
   929 
       
   930 
       
   931 // ----------------------------------------------------------------------------
       
   932 // CAspNaviPaneHandler::SetNaviPaneTitleL
       
   933 // 
       
   934 // ----------------------------------------------------------------------------
       
   935 //
       
   936 void CAspNaviPaneHandler::SetNaviPaneTitleL(const TDesC& aTitle)
       
   937 	{
       
   938 	if (!iStatusPane || !iNaviPane)
       
   939 		{
       
   940 		return;
       
   941 		}
       
   942 
       
   943     if (iNaviDecorator)
       
   944         {
       
   945         CAknNaviLabel* naviLabel = static_cast<CAknNaviLabel*>(iNaviDecorator->DecoratedControl());
       
   946         if (naviLabel)
       
   947         	{
       
   948         	naviLabel->SetTextL(aTitle);
       
   949         	iNaviDecorator->DrawDeferred();
       
   950         	}
       
   951         }
       
   952      else
       
   953     	{
       
   954     	iNaviDecorator = iNaviPane->CreateNavigationLabelL(aTitle);
       
   955     	iNaviPane->PushL(*iNaviDecorator); // activate navi label in navi pane
       
   956     	iNavidecoratorPushed = ETrue;
       
   957     	}
       
   958     	
       
   959     //CFbsBitmap* bitmap = NULL;
       
   960     //CFbsBitmap* bitmapMask = NULL;
       
   961     //AknsUtils::CreateIconL(AknsUtils::SkinInstance(), KAknsIIDQgnPropSmlHttp,
       
   962     //                       bitmap, bitmapMask, bitmapName,
       
   963     //                       EMbmAspsyncutilQgn_prop_sml_http, EMbmAspsyncutilQgn_prop_sml_http_mask);
       
   964     //iNaviDecorator = naviPane->CreateNavigationImageL(bitmap, bitmapMask);
       
   965     //naviPane->PushL(*iNaviDecorator);
       
   966     	
       
   967 	}
       
   968 
       
   969 
       
   970 // ----------------------------------------------------------------------------
       
   971 // CAspNaviPaneHandler::StoreNavipaneL
       
   972 // 
       
   973 // ----------------------------------------------------------------------------
       
   974 //
       
   975 void CAspNaviPaneHandler::StoreNavipaneL()
       
   976 	{
       
   977 	if (!iNaviPane || !iStatusPane || iNavipanePushed)
       
   978 		{
       
   979 		return;
       
   980 		}
       
   981 
       
   982 	if (iStatusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidTitle)).IsPresent())
       
   983 		{
       
   984 		iNaviPane->PushDefaultL();
       
   985 		iNavipanePushed = ETrue;
       
   986 		}
       
   987 	}
       
   988 
       
   989 #ifdef RD_DSUI_TIMEDSYNC
       
   990 
       
   991 /*******************************************************************************
       
   992  * class CAspTabbedNaviPaneHandler
       
   993  *******************************************************************************/
       
   994 
       
   995 
       
   996 // -----------------------------------------------------------------------------
       
   997 // Destructor
       
   998 //
       
   999 // -----------------------------------------------------------------------------
       
  1000 //
       
  1001 CAspTabbedNaviPaneHandler::~CAspTabbedNaviPaneHandler()
       
  1002     {
       
  1003    	if (iNaviDecorator)
       
  1004 		{
       
  1005 		if (iNaviPane && iNavidecoratorPushed)
       
  1006 			{
       
  1007 			iNaviPane->Pop(iNaviDecorator);
       
  1008 			}
       
  1009 	
       
  1010 		delete iNaviDecorator;
       
  1011 		}
       
  1012 		
       
  1013 	if (iNaviPane && iNavipanePushed)
       
  1014 		{
       
  1015 		iNaviPane->Pop(); // restore previous navi pane
       
  1016 		}
       
  1017     }
       
  1018 
       
  1019 
       
  1020 // -----------------------------------------------------------------------------
       
  1021 // CAspTabbedNaviPaneHandler::CAspTabbedNaviPaneHandler
       
  1022 //
       
  1023 // -----------------------------------------------------------------------------
       
  1024 //
       
  1025 CAspTabbedNaviPaneHandler::CAspTabbedNaviPaneHandler(CEikStatusPane* aStatusPane ,CAspSettingDialog *aDialog) 
       
  1026 						  : iStatusPane(aStatusPane)
       
  1027 	{
       
  1028 	iNavidecoratorPushed = EFalse;
       
  1029 	iNavipanePushed = EFalse;
       
  1030 	
       
  1031 	iDialog = aDialog;
       
  1032 	
       
  1033 	if (iStatusPane)
       
  1034 		{
       
  1035 		TRAP_IGNORE( iNaviPane = (CAknNavigationControlContainer*)iStatusPane->ControlL(TUid::Uid(EEikStatusPaneUidNavi)) );
       
  1036 		}
       
  1037 		
       
  1038     if (iNaviPane)
       
  1039         {
       
  1040         TRAP_IGNORE(iNaviDecorator = iNaviPane->CreateTabGroupL(this));    
       
  1041         if (iNaviDecorator)
       
  1042             {
       
  1043             TRAP_IGNORE(iNaviPane->PushL(*iNaviDecorator));
       
  1044             iNavidecoratorPushed = ETrue;
       
  1045     
       
  1046             iTabGroup = static_cast<CAknTabGroup*>( iNaviDecorator->DecoratedControl() );
       
  1047             }
       
  1048         }
       
  1049     }
       
  1050 
       
  1051 // -----------------------------------------------------------------------------
       
  1052 // CAspTabbedNaviPaneHandler::SetTabWidthL
       
  1053 //
       
  1054 // -----------------------------------------------------------------------------
       
  1055 //
       
  1056 void CAspTabbedNaviPaneHandler::SetTabWidthL()
       
  1057 {
       
  1058 	
       
  1059 	if (iTabGroup)
       
  1060 	    {
       
  1061 	     if (iTabGroup->TabCount() == 1)
       
  1062 	         {
       
  1063 	         iTabGroup->SetTabFixedWidthL(KTabWidthWithOneTab);     	
       
  1064 	         }
       
  1065 	     else if (iTabGroup->TabCount() == 2)
       
  1066 	         {
       
  1067 	         iTabGroup->SetTabFixedWidthL(KTabWidthWithTwoLongTabs);     	
       
  1068 	         }
       
  1069 	     else
       
  1070 	         {
       
  1071 	         iTabGroup->SetTabFixedWidthL(KTabWidthWithThreeLongTabs);     		
       
  1072 	         }
       
  1073 	      }
       
  1074 }
       
  1075 // -----------------------------------------------------------------------------
       
  1076 // CAspTabbedNaviPaneHandler::SetTabTextL
       
  1077 //
       
  1078 // -----------------------------------------------------------------------------
       
  1079 //
       
  1080 void CAspTabbedNaviPaneHandler::SetTabTextL(const TDesC& aText, TInt aTabId)
       
  1081 	{
       
  1082 	if (iTabGroup)
       
  1083 	    {
       
  1084 	    iTabGroup->ReplaceTabTextL(aTabId, aText);
       
  1085 	    }
       
  1086 	}
       
  1087 
       
  1088 
       
  1089 // -----------------------------------------------------------------------------
       
  1090 // CAspTabbedNaviPaneHandler::AddTabL
       
  1091 //
       
  1092 // -----------------------------------------------------------------------------
       
  1093 //
       
  1094 void CAspTabbedNaviPaneHandler::AddTabL(const TDesC& aText, TInt aTabId)
       
  1095 	{
       
  1096 	if (iTabGroup)
       
  1097 	    {
       
  1098 	    iTabGroup->AddTabL(aTabId, aText);
       
  1099 	    }
       
  1100 	}
       
  1101 
       
  1102 
       
  1103 // -----------------------------------------------------------------------------
       
  1104 // CAspTabbedNaviPaneHandler::DeleteTabsL
       
  1105 //
       
  1106 // -----------------------------------------------------------------------------
       
  1107 //
       
  1108 void CAspTabbedNaviPaneHandler::DeleteTabsL()
       
  1109 	{
       
  1110 	if (iTabGroup)
       
  1111 	    {
       
  1112 	    TInt count = iTabGroup->TabCount();
       
  1113 	    for (TInt i=0; i<count; i++)
       
  1114 	        {
       
  1115 	        TInt id = iTabGroup->TabIdFromIndex(0);
       
  1116 	        iTabGroup->DeleteTabL(id);
       
  1117 	        }
       
  1118 	    }
       
  1119 	}
       
  1120 
       
  1121 
       
  1122 // -----------------------------------------------------------------------------
       
  1123 // CAspTabbedNaviPaneHandler::SetActiveTabL
       
  1124 //
       
  1125 // -----------------------------------------------------------------------------
       
  1126 //
       
  1127 void CAspTabbedNaviPaneHandler::SetActiveTabL(TInt aTabId)
       
  1128 	{
       
  1129 	if (iTabGroup)
       
  1130 	    {
       
  1131 	    TInt index = iTabGroup->TabIndexFromId(aTabId);
       
  1132 	    if (index != KErrNotFound)
       
  1133 	        {
       
  1134 	        iTabGroup->SetActiveTabById(aTabId);    
       
  1135 	        }
       
  1136 	    }
       
  1137 	}
       
  1138 
       
  1139 
       
  1140 // ----------------------------------------------------------------------------
       
  1141 // CAspTabbedNaviPaneHandler::StoreNavipaneL
       
  1142 // 
       
  1143 // ----------------------------------------------------------------------------
       
  1144 //
       
  1145 void CAspTabbedNaviPaneHandler::StoreNavipaneL()
       
  1146 	{
       
  1147 	if (!iNaviPane || !iStatusPane || iNavipanePushed)
       
  1148 		{
       
  1149 		return;
       
  1150 		}
       
  1151 
       
  1152 	if (iStatusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidTitle)).IsPresent())
       
  1153 		{
       
  1154 		iNaviPane->PushDefaultL();
       
  1155 		iNavipanePushed = ETrue;
       
  1156 		}
       
  1157 	}
       
  1158 
       
  1159 // ----------------------------------------------------------------------------
       
  1160 // CAspTabbedNaviPaneHandler::TabIndex
       
  1161 // 
       
  1162 // ----------------------------------------------------------------------------
       
  1163 //
       
  1164 TInt CAspTabbedNaviPaneHandler::TabIndex(TInt aTabId)
       
  1165 	{
       
  1166 	return iTabGroup->TabIndexFromId(aTabId);
       
  1167 	}
       
  1168 
       
  1169 // ----------------------------------------------------------------------------
       
  1170 // CAspTabbedNaviPaneHandler::TabChangedL (from MAknTabObserver)
       
  1171 // 
       
  1172 // ----------------------------------------------------------------------------
       
  1173 //
       
  1174 void CAspTabbedNaviPaneHandler::TabChangedL(TInt aIndex)
       
  1175 	{
       
  1176 	TInt profileId = iTabGroup->TabIdFromIndex(aIndex );
       
  1177 	iDialog->SetCurrentProfile(profileId);
       
  1178 	iDialog->UpdateTabsL();
       
  1179 	iDialog->UpdateListBoxL();
       
  1180 	}
       
  1181 
       
  1182 #endif
       
  1183 
       
  1184 
       
  1185 
       
  1186 
       
  1187 /*******************************************************************************
       
  1188  * class CStatusPaneHandler
       
  1189  *******************************************************************************/
       
  1190 
       
  1191 // -----------------------------------------------------------------------------
       
  1192 // CStatusPaneHandler::NewL
       
  1193 //
       
  1194 // Two-phased constructor.
       
  1195 // -----------------------------------------------------------------------------
       
  1196 //
       
  1197 CStatusPaneHandler* CStatusPaneHandler::NewL(CAknAppUi* aAppUi)
       
  1198     {
       
  1199     CStatusPaneHandler* self = new (ELeave) CStatusPaneHandler(aAppUi);
       
  1200 	CleanupStack::PushL(self);
       
  1201 	self->ConstructL();
       
  1202 	CleanupStack::Pop(self);
       
  1203 	return self;
       
  1204     }
       
  1205 
       
  1206 
       
  1207 // -----------------------------------------------------------------------------
       
  1208 // Destructor
       
  1209 //
       
  1210 // -----------------------------------------------------------------------------
       
  1211 //
       
  1212 CStatusPaneHandler::~CStatusPaneHandler()
       
  1213     {
       
  1214 	TRAP_IGNORE(RestoreOriginalTitleL());
       
  1215 	TRAP_IGNORE(RestoreOriginalImageL());
       
  1216 	
       
  1217 	delete iNaviPaneHandler;
       
  1218     }
       
  1219 
       
  1220 
       
  1221 // -----------------------------------------------------------------------------
       
  1222 // CStatusPaneHandler::ConstructL
       
  1223 //
       
  1224 // Symbian 2nd phase constructor can leave.
       
  1225 // -----------------------------------------------------------------------------
       
  1226 //
       
  1227 void CStatusPaneHandler::ConstructL(void)
       
  1228     {
       
  1229     iNaviPaneHandler = new (ELeave) CAspNaviPaneHandler(iAppUi->StatusPane());
       
  1230     }
       
  1231 
       
  1232 
       
  1233 // -----------------------------------------------------------------------------
       
  1234 // CStatusPaneHandler::CStatusPaneHandler
       
  1235 //
       
  1236 // -----------------------------------------------------------------------------
       
  1237 //
       
  1238 CStatusPaneHandler::CStatusPaneHandler(CAknAppUi* aAppUi) : iAppUi(aAppUi)
       
  1239 	{
       
  1240 	__ASSERT_ALWAYS(iAppUi, TUtil::Panic(KErrGeneral));
       
  1241 
       
  1242 	iOriginalTitleStored = EFalse;
       
  1243 	iOriginalTitle = KNullDesC;
       
  1244 	}
       
  1245 
       
  1246 
       
  1247 // ----------------------------------------------------------------------------
       
  1248 // CStatusPaneHandler::GetTitleL
       
  1249 // 
       
  1250 // ----------------------------------------------------------------------------
       
  1251 //
       
  1252 TBool CStatusPaneHandler::GetTitleL(CAknAppUi* aAppUi, TDes& aTitle)
       
  1253 	{
       
  1254 	aTitle = KNullDesC;
       
  1255 
       
  1256 	CEikStatusPane* statusPane = aAppUi->StatusPane();
       
  1257     if (statusPane && statusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidTitle)).IsPresent())
       
  1258 		{
       
  1259         CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
       
  1260             (statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle)));
       
  1261         if (titlePane->Text()) 
       
  1262 			{
       
  1263 		    TUtil::StrCopy(aTitle, *titlePane->Text());
       
  1264 			return ETrue;
       
  1265     		}
       
  1266 		}
       
  1267 
       
  1268 	return EFalse;
       
  1269 	}
       
  1270 
       
  1271 
       
  1272 // ----------------------------------------------------------------------------
       
  1273 // CStatusPaneHandler::SetTitleL
       
  1274 // 
       
  1275 // ----------------------------------------------------------------------------
       
  1276 //
       
  1277 TBool CStatusPaneHandler::SetTitleL(CAknAppUi* aAppUi, const TDesC& aTitle)
       
  1278 	{
       
  1279 	CEikStatusPane* statusPane = aAppUi->StatusPane();
       
  1280     if (statusPane && statusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidTitle)).IsPresent())
       
  1281 		{
       
  1282         CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
       
  1283             (statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle)));
       
  1284         if (titlePane->Text()) 
       
  1285 			{
       
  1286 	   		titlePane->SetTextL(aTitle);
       
  1287 			return ETrue;
       
  1288 			}
       
  1289 		}
       
  1290 	return EFalse;
       
  1291 	}
       
  1292 
       
  1293 
       
  1294 // ----------------------------------------------------------------------------
       
  1295 // CStatusPaneHandler::SetNaviPaneTitleL
       
  1296 // 
       
  1297 // ----------------------------------------------------------------------------
       
  1298 //
       
  1299 void CStatusPaneHandler::SetNaviPaneTitleL(const TDesC& aTitle)
       
  1300 	{
       
  1301 	iNaviPaneHandler->SetNaviPaneTitleL(aTitle);
       
  1302 	}
       
  1303 
       
  1304 
       
  1305 // ----------------------------------------------------------------------------
       
  1306 // CStatusPaneHandler::SetNaviPaneTitle
       
  1307 // 
       
  1308 // ----------------------------------------------------------------------------
       
  1309 //
       
  1310 void CStatusPaneHandler::SetNaviPaneTitle(const TDesC& aTitle)
       
  1311 	{
       
  1312 	TRAP_IGNORE(iNaviPaneHandler->SetNaviPaneTitleL(aTitle));
       
  1313 	}
       
  1314 
       
  1315 
       
  1316 // ----------------------------------------------------------------------------
       
  1317 // CStatusPaneHandler::SetNaviPaneTitleL
       
  1318 // 
       
  1319 // ----------------------------------------------------------------------------
       
  1320 //
       
  1321 void CStatusPaneHandler::SetNaviPaneTitleL(TInt aResource)
       
  1322 	{
       
  1323 	HBufC* hBuf = CAspResHandler::ReadLC(aResource);
       
  1324     SetNaviPaneTitleL(hBuf->Des());
       
  1325 	CleanupStack::PopAndDestroy(hBuf);
       
  1326 	}
       
  1327 
       
  1328 
       
  1329 // ----------------------------------------------------------------------------
       
  1330 // CStatusPaneHandler::StoreNavipaneL
       
  1331 // 
       
  1332 // ----------------------------------------------------------------------------
       
  1333 //
       
  1334 void CStatusPaneHandler::StoreNavipaneL()
       
  1335 	{
       
  1336 	iNaviPaneHandler->StoreNavipaneL();
       
  1337 	}
       
  1338 
       
  1339 
       
  1340 // ----------------------------------------------------------------------------
       
  1341 // CStatusPaneHandler::StoreOriginalTitleL
       
  1342 // 
       
  1343 // ----------------------------------------------------------------------------
       
  1344 //
       
  1345 void CStatusPaneHandler::StoreOriginalTitleL()
       
  1346 	{
       
  1347 	TBool ret = GetTitleL(iAppUi, iOriginalTitle);
       
  1348 	
       
  1349 	if (ret)
       
  1350 		{
       
  1351 		iOriginalTitleStored = ETrue;
       
  1352 		}
       
  1353 	}
       
  1354 
       
  1355 
       
  1356 // ----------------------------------------------------------------------------
       
  1357 // CStatusPaneHandler::RestoreOriginalTitleL
       
  1358 // 
       
  1359 // ----------------------------------------------------------------------------
       
  1360 //
       
  1361 void CStatusPaneHandler::RestoreOriginalTitleL()
       
  1362 	{
       
  1363 	if (iOriginalTitleStored)
       
  1364 		{
       
  1365 		SetTitleL(iAppUi, iOriginalTitle);
       
  1366 		}
       
  1367 	}
       
  1368 
       
  1369 
       
  1370 // ----------------------------------------------------------------------------
       
  1371 // CStatusPaneHandler::SetTitleL
       
  1372 // 
       
  1373 // ----------------------------------------------------------------------------
       
  1374 //
       
  1375 void CStatusPaneHandler::SetTitleL(const TDesC& aText)
       
  1376 	{
       
  1377 	if (iOriginalTitleStored)
       
  1378 		{
       
  1379 		SetTitleL(iAppUi, aText);
       
  1380 		}
       
  1381 	}
       
  1382 
       
  1383 
       
  1384 // ----------------------------------------------------------------------------
       
  1385 // CStatusPaneHandler::SetTitleL
       
  1386 // 
       
  1387 // ----------------------------------------------------------------------------
       
  1388 //
       
  1389 void CStatusPaneHandler::SetTitleL(TInt aResourceId)
       
  1390 	{
       
  1391 	HBufC* hBuf = CAspResHandler::ReadLC(aResourceId);
       
  1392 	SetTitleL(hBuf->Des());
       
  1393 	CleanupStack::PopAndDestroy(hBuf);
       
  1394 	}
       
  1395 
       
  1396 
       
  1397 // ----------------------------------------------------------------------------
       
  1398 // CStatusPaneHandler::SetNewImageL
       
  1399 // 
       
  1400 // ----------------------------------------------------------------------------
       
  1401 //
       
  1402 void CStatusPaneHandler::SetNewImageL(const TDesC& aFilename,TInt aMainId,TInt aMaskId)
       
  1403 	{
       
  1404 	__ASSERT_DEBUG(!iOriginalImage, TUtil::Panic(KErrGeneral)); // can set image only once
       
  1405 
       
  1406 	CEikImage* image = new (ELeave) CEikImage;
       
  1407 	CleanupStack::PushL(image);
       
  1408 	
       
  1409 	image->CreatePictureFromFileL(aFilename, aMainId, aMaskId);
       
  1410 
       
  1411 	iOriginalImage = SetImageL(iAppUi, image);
       
  1412 
       
  1413 	if (iOriginalImage)
       
  1414 		{
       
  1415         CleanupStack::Pop(image); // ownership transferred to context pane
       
  1416 		return;
       
  1417 		}
       
  1418 
       
  1419 	CleanupStack::PopAndDestroy(image);
       
  1420 	}
       
  1421 
       
  1422 
       
  1423 // ----------------------------------------------------------------------------
       
  1424 // CStatusPaneHandler::RestoreOriginalImageL
       
  1425 // 
       
  1426 // ----------------------------------------------------------------------------
       
  1427 //
       
  1428 void CStatusPaneHandler::RestoreOriginalImageL()
       
  1429 	{
       
  1430 	if (!iOriginalImage)
       
  1431 		{
       
  1432 		return; // image has not been replaced
       
  1433 		}
       
  1434 
       
  1435 	CEikImage* image = NULL;
       
  1436 	TRAPD(err, image = SetImageL(iAppUi, iOriginalImage));
       
  1437 
       
  1438 	if (err == KErrNone && image)
       
  1439 		{
       
  1440 		delete image; // delete our own image
       
  1441 		}
       
  1442 	else
       
  1443 		{
       
  1444 		delete iOriginalImage; // delete original image (could not restore it)
       
  1445 		iOriginalImage = NULL;
       
  1446 		}
       
  1447 	}
       
  1448 
       
  1449 
       
  1450 // ----------------------------------------------------------------------------
       
  1451 // CStatusPaneHandler::SetImageL
       
  1452 // 
       
  1453 // ----------------------------------------------------------------------------
       
  1454 //
       
  1455 CEikImage* CStatusPaneHandler::SetImageL(CAknAppUi* aAppUi, CEikImage* aIcon)
       
  1456 	{
       
  1457 	CEikStatusPane* statusPane = aAppUi->StatusPane();
       
  1458     if (statusPane && statusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidContext)).IsPresent())
       
  1459 		{
       
  1460         CAknContextPane* contextPane = static_cast<CAknContextPane*>
       
  1461             (statusPane->ControlL(TUid::Uid(EEikStatusPaneUidContext)));
       
  1462         if (contextPane) 
       
  1463 			{
       
  1464 	   		return contextPane->SwapPicture(aIcon);
       
  1465 			}
       
  1466 		}
       
  1467 
       
  1468 	return NULL;
       
  1469 	}
       
  1470 
       
  1471 
       
  1472 
       
  1473 
       
  1474 /*******************************************************************************
       
  1475  * class CAspSelectionItemList
       
  1476  *******************************************************************************/
       
  1477 
       
  1478 
       
  1479 // -----------------------------------------------------------------------------
       
  1480 // CAspSelectionItemList::Cleanup
       
  1481 //
       
  1482 // -----------------------------------------------------------------------------
       
  1483 //
       
  1484 void CAspSelectionItemList::Cleanup(TAny* aObj)
       
  1485     {
       
  1486     CAspSelectionItemList* list = static_cast<CAspSelectionItemList*>(aObj);
       
  1487 	list->ResetAndDestroy();
       
  1488 	delete list;
       
  1489 	list = NULL;
       
  1490     }
       
  1491 
       
  1492 
       
  1493 // -----------------------------------------------------------------------------
       
  1494 // CAspSelectionItemList::CAspSelectionItemList
       
  1495 //
       
  1496 // -----------------------------------------------------------------------------
       
  1497 //
       
  1498 CAspSelectionItemList::CAspSelectionItemList(TInt aGranularity) 
       
  1499 : CSelectionItemList(aGranularity)
       
  1500 	{
       
  1501 	}
       
  1502 
       
  1503 
       
  1504 
       
  1505 /*******************************************************************************
       
  1506  * class CAspListItemData
       
  1507  *******************************************************************************/
       
  1508 
       
  1509 
       
  1510 
       
  1511 //------------------------------------------------------------------------------
       
  1512 // CAspListItemData::NewLC
       
  1513 // 
       
  1514 //------------------------------------------------------------------------------
       
  1515 //
       
  1516 CAspListItemData* CAspListItemData::NewLC()
       
  1517 	{
       
  1518 	CAspListItemData* self = new (ELeave) CAspListItemData;
       
  1519 	CleanupStack::PushL( self);
       
  1520 	self->ConstructL();
       
  1521 	return self;
       
  1522 	}
       
  1523 
       
  1524 
       
  1525 //------------------------------------------------------------------------------
       
  1526 // CAspListItemData::ConstructL
       
  1527 //
       
  1528 //------------------------------------------------------------------------------
       
  1529 //
       
  1530 void CAspListItemData::ConstructL()
       
  1531 	{
       
  1532 	Init();
       
  1533 	
       
  1534     iHeader  = HBufC::NewL(0);
       
  1535 	iDisplayValue = HBufC::NewL(0);
       
  1536 	iValue = HBufC::NewL(0);
       
  1537     }
       
  1538 
       
  1539 
       
  1540 // -----------------------------------------------------------------------------
       
  1541 // CAspListItemData::CAspListItemData
       
  1542 // -----------------------------------------------------------------------------
       
  1543 //
       
  1544 CAspListItemData::CAspListItemData()
       
  1545 	{
       
  1546 	}
       
  1547 
       
  1548 
       
  1549 //------------------------------------------------------------------------------
       
  1550 // Destructor
       
  1551 //
       
  1552 //------------------------------------------------------------------------------
       
  1553 //
       
  1554 CAspListItemData::~CAspListItemData()
       
  1555 	{
       
  1556 	delete iHeader;
       
  1557 	delete iDisplayValue;
       
  1558 	delete iValue;
       
  1559 	}
       
  1560 
       
  1561 
       
  1562 //------------------------------------------------------------------------------
       
  1563 // CAspListItemData::Header
       
  1564 //
       
  1565 //------------------------------------------------------------------------------
       
  1566 //
       
  1567 const TDesC& CAspListItemData::Header()
       
  1568 	{
       
  1569 	__ASSERT_ALWAYS(iHeader, TUtil::Panic(KErrGeneral));
       
  1570 	
       
  1571 	return *iHeader;
       
  1572     }
       
  1573 
       
  1574 
       
  1575 //------------------------------------------------------------------------------
       
  1576 // CAspListItemData::SetHeaderL
       
  1577 // 
       
  1578 //------------------------------------------------------------------------------
       
  1579 //
       
  1580 void CAspListItemData::SetHeaderL(const TDesC& aText)
       
  1581 	{
       
  1582 	delete iHeader;
       
  1583 	iHeader = NULL;
       
  1584 	iHeader = aText.AllocL();
       
  1585 	}
       
  1586 
       
  1587 
       
  1588 //------------------------------------------------------------------------------
       
  1589 // CAspListItemData::SetHeaderL
       
  1590 // 
       
  1591 //------------------------------------------------------------------------------
       
  1592 //
       
  1593 void CAspListItemData::SetHeaderL(TInt aResourceId)
       
  1594 	{
       
  1595 	HBufC* hBuf = CAspResHandler::ReadLC(aResourceId);
       
  1596     SetHeaderL(hBuf->Des());
       
  1597 	CleanupStack::PopAndDestroy(hBuf);
       
  1598 	}
       
  1599 
       
  1600 
       
  1601 //------------------------------------------------------------------------------
       
  1602 // CAspListItemData::Value
       
  1603 // 
       
  1604 //------------------------------------------------------------------------------
       
  1605 //
       
  1606 const TDesC& CAspListItemData::Value()
       
  1607 	{
       
  1608 	__ASSERT_ALWAYS(iValue, TUtil::Panic(KErrGeneral));
       
  1609 	
       
  1610 	return *iValue;
       
  1611 	}
       
  1612 
       
  1613 
       
  1614 //------------------------------------------------------------------------------
       
  1615 // CAspListItemData::SetValue
       
  1616 // 
       
  1617 //------------------------------------------------------------------------------
       
  1618 //
       
  1619 void CAspListItemData::SetValueL(const TDesC& aText)
       
  1620 	{
       
  1621     delete iValue;
       
  1622     iValue = NULL;
       
  1623 	iValue = aText.AllocL();
       
  1624 	}
       
  1625 
       
  1626 
       
  1627 //------------------------------------------------------------------------------
       
  1628 // CAspListItemData::SetValueL
       
  1629 // 
       
  1630 //------------------------------------------------------------------------------
       
  1631 //
       
  1632 void CAspListItemData::SetValueL(TInt aNumber)
       
  1633 	{
       
  1634 	TBuf<KBufSize32> buf;
       
  1635 	buf.Num(aNumber);
       
  1636 	SetValueL(buf);
       
  1637 	}
       
  1638 
       
  1639 
       
  1640 //------------------------------------------------------------------------------
       
  1641 // CAspListItemData::SetDisplayValue
       
  1642 // 
       
  1643 //------------------------------------------------------------------------------
       
  1644 //
       
  1645 void CAspListItemData::SetDisplayValueL(const TDesC& aText)
       
  1646 	{
       
  1647 	delete iDisplayValue;
       
  1648 	iDisplayValue = NULL;
       
  1649 	iDisplayValue = aText.AllocL();
       
  1650     }
       
  1651 
       
  1652 
       
  1653 //------------------------------------------------------------------------------
       
  1654 // CAspListItemData::SetDisplayValue
       
  1655 // 
       
  1656 //------------------------------------------------------------------------------
       
  1657 //
       
  1658 void CAspListItemData::SetDisplayValueL(TInt aResource)
       
  1659 	{
       
  1660 	delete iDisplayValue;
       
  1661 	iDisplayValue = NULL;
       
  1662 	
       
  1663 	iDisplayValue = StringLoader::LoadL(aResource);
       
  1664 	}
       
  1665 
       
  1666 
       
  1667 //------------------------------------------------------------------------------
       
  1668 // CAspListItemData::IsEmpty
       
  1669 // 
       
  1670 //------------------------------------------------------------------------------
       
  1671 //
       
  1672 TBool CAspListItemData::IsEmpty()
       
  1673 	{
       
  1674 	if (!iValue)
       
  1675 		{
       
  1676 		return ETrue;
       
  1677 		}
       
  1678 		
       
  1679 	if (TUtil::IsEmpty(iValue->Des()))
       
  1680 		{
       
  1681 		return ETrue;
       
  1682 		}
       
  1683 		
       
  1684 	return EFalse;
       
  1685 	}
       
  1686 
       
  1687 
       
  1688 //------------------------------------------------------------------------------
       
  1689 // CAspListItemData::ListItemTextL
       
  1690 //
       
  1691 // Constructs header and value suitable for listbox.
       
  1692 // List item syntax:
       
  1693 // "\t<header>\t\t<value>\t<mandatorychar>\t\t<readonlyicon>"
       
  1694 //------------------------------------------------------------------------------
       
  1695 //
       
  1696 HBufC* CAspListItemData::ListItemTextL(TBool aConvert)
       
  1697 	{
       
  1698 	_LIT(KTab, "\t");
       
  1699 	_LIT(KMandatoryChar, "*");
       
  1700 	_LIT(KReadOnlyIconIndex, "0");
       
  1701 	
       
  1702 	HBufC* hBuf = HBufC::NewL(KBufSize255);
       
  1703 	TPtr ptr = hBuf->Des();
       
  1704 	
       
  1705 	ptr.Append(KTab);
       
  1706 	ptr.Append(iHeader->Des());
       
  1707 	ptr.Append(KTab);
       
  1708 	ptr.Append(KTab);
       
  1709 	                                              //"PC Suite" string in Host address field and server id should be displayed as chinese
       
  1710 	if (IsEmpty() || iItemType == ETypeSecret || (TDialogUtil::IsPCSuiteDesC(iValue->Des()) && (iItemId == EAspHostAddress || iItemId == EAspServerId)))
       
  1711 		{
       
  1712 		ptr.Append(iDisplayValue->Des());
       
  1713 		}
       
  1714 	else
       
  1715 		{
       
  1716 		ptr.Append(iValue->Des());
       
  1717 		}
       
  1718 
       
  1719 	ptr.Append(KTab);
       
  1720 	
       
  1721 	if (iMandatory)
       
  1722 		{
       
  1723 		ptr.Append(KMandatoryChar);
       
  1724 		}
       
  1725 	
       
  1726 	ptr.Append(KTab);
       
  1727 	ptr.Append(KTab);
       
  1728 	
       
  1729 	if (iHidden == EVisibilityReadOnly)
       
  1730 		{
       
  1731 		ptr.Append(KReadOnlyIconIndex);
       
  1732 		}
       
  1733 
       
  1734 	if (aConvert)
       
  1735 		{
       
  1736 		AknTextUtils::DisplayTextLanguageSpecificNumberConversion(ptr);
       
  1737 		}
       
  1738 
       
  1739 	return hBuf;
       
  1740 	}
       
  1741 
       
  1742 
       
  1743 //------------------------------------------------------------------------------
       
  1744 // CAspListItemData::Init
       
  1745 // 
       
  1746 //------------------------------------------------------------------------------
       
  1747 //
       
  1748 void CAspListItemData::Init()
       
  1749 	{
       
  1750 	iNumberData = KErrNotFound;
       
  1751 	iDate = 0;
       
  1752 	iTime = 0;
       
  1753 	
       
  1754 	iItemType = KErrNotFound;
       
  1755 	iHidden = EVisibilityNormal;
       
  1756 	iMaxLength = KBufSize;
       
  1757 	iResource = KErrNotFound;
       
  1758 	iIndex = KErrNotFound;
       
  1759 	iItemId = KErrNotFound;
       
  1760 	
       
  1761 	iMandatory = EFalse;
       
  1762 	iLatinInput = EFalse;
       
  1763 	
       
  1764 	iMinValue = KErrNotFound;
       
  1765 	iMaxValue = KErrNotFound;
       
  1766 	
       
  1767 	//iFilter = 0;
       
  1768 	iSelectKeyPressed = EFalse;
       
  1769 	
       
  1770 	iValue = NULL;
       
  1771 	iDisplayValue = NULL;
       
  1772 	iHeader = NULL;
       
  1773     }
       
  1774 
       
  1775 
       
  1776 		
       
  1777 /*******************************************************************************
       
  1778  * class CAspRadioButtonSettingPageEditor
       
  1779  *******************************************************************************/
       
  1780 
       
  1781 
       
  1782 //------------------------------------------------------------------------------
       
  1783 // CAspRadioButtonSettingPageEditor::CAspRadioButtonSettingPage
       
  1784 // 
       
  1785 //------------------------------------------------------------------------------
       
  1786 //
       
  1787 CAspRadioButtonSettingPageEditor::CAspRadioButtonSettingPageEditor(TInt aResourceID,
       
  1788                             TInt& aCurrentSelectionIndex,
       
  1789                             const MDesCArray* aItemArray
       
  1790                             )
       
  1791                             
       
  1792  : CAknRadioButtonSettingPage(aResourceID, aCurrentSelectionIndex, aItemArray)
       
  1793 	{
       
  1794 	}
       
  1795 	
       
  1796 	
       
  1797 // ----------------------------------------------------------------------------
       
  1798 // CAspRadioButtonSettingPageEditor::OfferKeyEventL
       
  1799 //
       
  1800 // ----------------------------------------------------------------------------
       
  1801 //
       
  1802 TKeyResponse CAspRadioButtonSettingPageEditor::OfferKeyEventL(const TKeyEvent& aKeyEvent, 
       
  1803                                                  TEventCode aType)
       
  1804     {
       
  1805 		    if(EKeyEnter == aKeyEvent.iCode)
       
  1806 		    {
       
  1807 		    	ProcessCommandL(EAknSoftkeyOk);
       
  1808 		    	return EKeyWasConsumed;
       
  1809 		    }
       
  1810 		    return CAknRadioButtonSettingPage::OfferKeyEventL(aKeyEvent, aType);
       
  1811     }
       
  1812 
       
  1813 //------------------------------------------------------------------------------
       
  1814 // Destructor
       
  1815 // 
       
  1816 //------------------------------------------------------------------------------
       
  1817 //
       
  1818 CAspRadioButtonSettingPageEditor::~CAspRadioButtonSettingPageEditor()
       
  1819 	{
       
  1820 	}
       
  1821 
       
  1822 		
       
  1823 /*******************************************************************************
       
  1824  * class CAspTextSettingPageEditor
       
  1825  *******************************************************************************/
       
  1826 
       
  1827 
       
  1828 //------------------------------------------------------------------------------
       
  1829 // CAspTextSettingPageEditor::CAspTextSettingPageEditor
       
  1830 // 
       
  1831 //------------------------------------------------------------------------------
       
  1832 //
       
  1833 CAspTextSettingPageEditor::CAspTextSettingPageEditor(TInt aResourceID, 
       
  1834                                                      TDes& aText, 
       
  1835                                                      TInt aTextSettingPageFlags)                      
       
  1836  : CAknTextSettingPage(aResourceID, aText, aTextSettingPageFlags)
       
  1837 	{
       
  1838 	}
       
  1839 	
       
  1840 	
       
  1841 // ----------------------------------------------------------------------------
       
  1842 // CAspTextSettingPageEditor::OfferKeyEventL
       
  1843 //
       
  1844 // ----------------------------------------------------------------------------
       
  1845 //
       
  1846 TKeyResponse CAspTextSettingPageEditor::OfferKeyEventL(const TKeyEvent& aKeyEvent, 
       
  1847                                                  TEventCode aType)
       
  1848     {
       
  1849 		    if(EKeyEnter == aKeyEvent.iCode)
       
  1850 		    {
       
  1851 		    	ProcessCommandL(EAknSoftkeyOk);
       
  1852 		    	return EKeyWasConsumed;
       
  1853 		    }
       
  1854 		    return CAknTextSettingPage::OfferKeyEventL(aKeyEvent, aType);
       
  1855     }
       
  1856 
       
  1857 //------------------------------------------------------------------------------
       
  1858 // Destructor
       
  1859 // 
       
  1860 //------------------------------------------------------------------------------
       
  1861 //
       
  1862 CAspTextSettingPageEditor::~CAspTextSettingPageEditor()
       
  1863 	{
       
  1864 	}
       
  1865 
       
  1866 		
       
  1867 /*******************************************************************************
       
  1868  * class CAspAlphaPasswordSettingPageEditor
       
  1869  *******************************************************************************/
       
  1870 
       
  1871 
       
  1872 //------------------------------------------------------------------------------
       
  1873 // CAspAlphaPasswordSettingPageEditor::CAspAlphaPasswordSettingPageEditor
       
  1874 // 
       
  1875 //------------------------------------------------------------------------------
       
  1876 //
       
  1877 CAspAlphaPasswordSettingPageEditor::CAspAlphaPasswordSettingPageEditor(TInt aResourceID, 
       
  1878                                                      TDes& aNewPassword, 
       
  1879                                                      const TDesC& aOldPassword)                      
       
  1880  : CAknAlphaPasswordSettingPage(aResourceID,aNewPassword,aOldPassword)
       
  1881 	{
       
  1882 	}
       
  1883 	
       
  1884 	
       
  1885 // ----------------------------------------------------------------------------
       
  1886 // CAspAlphaPasswordSettingPageEditor::OfferKeyEventL
       
  1887 //
       
  1888 // ----------------------------------------------------------------------------
       
  1889 //
       
  1890 TKeyResponse CAspAlphaPasswordSettingPageEditor::OfferKeyEventL(const TKeyEvent& aKeyEvent, 
       
  1891                                                  TEventCode aType)
       
  1892     {
       
  1893 		    if(EKeyEnter == aKeyEvent.iCode)
       
  1894 		    {
       
  1895 		    	ProcessCommandL(EAknSoftkeyOk);
       
  1896 		    	return EKeyWasConsumed;
       
  1897 		    }
       
  1898 		    return CAknAlphaPasswordSettingPage::OfferKeyEventL(aKeyEvent, aType);
       
  1899     }
       
  1900 
       
  1901 //------------------------------------------------------------------------------
       
  1902 // Destructor
       
  1903 // 
       
  1904 //------------------------------------------------------------------------------
       
  1905 //
       
  1906 CAspAlphaPasswordSettingPageEditor::~CAspAlphaPasswordSettingPageEditor()
       
  1907 	{
       
  1908 	}
       
  1909 
       
  1910 /*******************************************************************************
       
  1911  * class CAspIntegerSettingPageEditor
       
  1912  *******************************************************************************/
       
  1913 
       
  1914 
       
  1915 //------------------------------------------------------------------------------
       
  1916 // CAspIntegerSettingPageEditor::CAspIntegerSettingPageEditor
       
  1917 // 
       
  1918 //------------------------------------------------------------------------------
       
  1919 //
       
  1920 CAspIntegerSettingPageEditor::CAspIntegerSettingPageEditor(TInt aResourceID, 
       
  1921 												TInt& aValue, 
       
  1922 												TInt aTextSettingPageFlags)
       
  1923  : CAknIntegerSettingPage(aResourceID,aValue,aTextSettingPageFlags)
       
  1924 	{
       
  1925 	}
       
  1926 	
       
  1927 	
       
  1928 // ----------------------------------------------------------------------------
       
  1929 // CAspIntegerSettingPageEditor::OfferKeyEventL
       
  1930 //
       
  1931 // ----------------------------------------------------------------------------
       
  1932 //
       
  1933 TKeyResponse CAspIntegerSettingPageEditor::OfferKeyEventL(const TKeyEvent& aKeyEvent, 
       
  1934                                                  TEventCode aType)
       
  1935     {
       
  1936 		    if(EKeyEnter == aKeyEvent.iCode)
       
  1937 		    {
       
  1938 		    	ProcessCommandL(EAknSoftkeyOk);
       
  1939 		    	return EKeyWasConsumed;
       
  1940 		    }
       
  1941 		    return CAknIntegerSettingPage::OfferKeyEventL(aKeyEvent, aType);
       
  1942     }
       
  1943 
       
  1944 //------------------------------------------------------------------------------
       
  1945 // Destructor
       
  1946 // 
       
  1947 //------------------------------------------------------------------------------
       
  1948 //
       
  1949 CAspIntegerSettingPageEditor::~CAspIntegerSettingPageEditor()
       
  1950 	{
       
  1951 	}
       
  1952 
       
  1953 
       
  1954 //  End of File