uiservicetab/vimpstui/src/cvimpstuiextensionservice.cpp
branchRCL_3
changeset 28 3104fc151679
parent 27 2b7283837edb
child 29 9a48e301e94b
equal deleted inserted replaced
27:2b7283837edb 28:3104fc151679
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Extension service for CVIMPSTUI
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cvimpstuiextensionservice.h"
       
    21 
       
    22 #include <MPbk2AppUi.h>
       
    23 
       
    24 // Edit view
       
    25 #include <MPbk2ApplicationServices.h>
       
    26 #include <MPbk2CommandHandler.h>
       
    27 #include <Pbk2Commands.hrh>
       
    28 
       
    29 #include "cvimpstuisearchfieldaray.h"
       
    30 #include "mvimpstuisearchfield.h"
       
    31 #include "cvimpstuisearchquerydialog.h"
       
    32 
       
    33 #include "cvimpstuitabbedview.h"
       
    34 #include "cvimpstuisearchview.h"
       
    35 #include "cvimpstuiextensionviewinfo.h"
       
    36 #include "cvimpstcmdhandler.h"
       
    37 
       
    38 #include "mvimpstengine.h"
       
    39 #include "vimpstutils.h"
       
    40 
       
    41 #include "cvimpstuibranddata.h"
       
    42 #include "tvimpstconsts.h"
       
    43 #include "cvimpstuiblockview.h"
       
    44 #include <vimpstui.mbg>
       
    45 #include <vimpst_servicetab_default.mbg>
       
    46 #include <vimpstuires.rsg>
       
    47 #include <eikenv.h>
       
    48 #include "cvimpstuimenuextension.h"
       
    49 #include "uiservicetabtracer.h"
       
    50 
       
    51 const TInt KDefaultIconId = EMbmVimpstuiExample_msn_tab;
       
    52 const TInt KDefaultMaskId = EMbmVimpstuiExample_msn_tab_mask;
       
    53 
       
    54 const TInt KBrandTabIconId = EMbmVimpst_servicetab_defaultQgn_prop_im_imsg ;
       
    55 const TInt KBrandTabMaskId = EMbmVimpst_servicetab_defaultQgn_prop_im_imsg_mask;
       
    56 
       
    57 _LIT(KDefaultFileLocation,"\\resource\\");
       
    58 _LIT(KBrandFileLocation,"C:\\resource\\");
       
    59 _LIT(KBrandFileNameDefault_C,"C:\\resource\\vimpst_servicetab_default.mif");
       
    60 _LIT(KBrandFileNameDefault_Z,"Z:\\resource\\apps\\vimpst_servicetab_default.mif");
       
    61 _LIT(KBrandFileNameHalf, "vimpst_servicetab_");
       
    62 _LIT(KBrandFileNameExt, ".mif");
       
    63 _LIT(KDefaultFileName, "vimpst_servicetab_default.mif");
       
    64 // ================= MEMBER FUNCTIONS =======================
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // CVIMPSTUIExtensionService::CVIMPSTUIExtensionService
       
    68 // ---------------------------------------------------------------------------
       
    69 // 
       
    70 CVIMPSTUIExtensionService::CVIMPSTUIExtensionService(
       
    71     TUint aServiceId,
       
    72     TInt aTabbedViewId,   
       
    73     TInt aSearchViewId, 
       
    74     TInt aBlockedViewId,  
       
    75     CVIMPSTUIMenuExtension& aMenuExtension,
       
    76     MVIMPSTEngine& aEngine ):
       
    77     iServiceId( aServiceId ),
       
    78     iTabbedViewId( aTabbedViewId ),        
       
    79     iSearchViewId( aSearchViewId ), 
       
    80     iBlockedViewId( aBlockedViewId ),
       
    81     iMenuExtension(aMenuExtension),
       
    82     iEngine( aEngine )
       
    83     {
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CVIMPSTUIExtensionService::ConstructL
       
    88 // ---------------------------------------------------------------------------
       
    89 // 
       
    90 void CVIMPSTUIExtensionService::ConstructL(const TDesC& aServiceName)
       
    91     {      
       
    92 	TRACER_AUTO;
       
    93     TFileName path;    
       
    94     Dll::FileName(path); //get the location of the dll
       
    95     
       
    96     TDriveName drive( TParsePtrC( path ).Drive( ) ); // solve drive
       
    97     TBuf<KMaxResourcePathLength> serviceName(iEngine.ServiceName());
       
    98     HBufC* brandFileName = HBufC::NewLC( KMaxResourcePathLength );
       
    99     TPtr brandFileNamePtr( brandFileName->Des() );
       
   100     brandFileNamePtr.Append( KBrandFileNameHalf() );
       
   101     brandFileNamePtr.Append( serviceName );
       
   102     brandFileNamePtr.Append( KBrandFileNameExt() );
       
   103 
       
   104     RFs& session = CEikonEnv::Static()->FsSession();
       
   105     session.AddFileSystem( brandFileNamePtr );    
       
   106     TFindFile file_finder(session);
       
   107     CDir* file_list;
       
   108     path.Zero();
       
   109     TInt err = file_finder.FindWildByDir( brandFileNamePtr,KBrandFileLocation(),file_list);
       
   110     if( err == KErrNone )
       
   111         {
       
   112         brandFileNamePtr.Insert( 0, KBrandFileLocation());
       
   113         }
       
   114     else 
       
   115         {
       
   116         err = file_finder.FindWildByDir( KDefaultFileName(), KDefaultFileLocation(), file_list );
       
   117         brandFileNamePtr.Zero();
       
   118         if( err == KErrNone )
       
   119             {
       
   120             brandFileNamePtr.Insert( 0, KBrandFileNameDefault_C());
       
   121             }
       
   122         else
       
   123             {
       
   124             brandFileNamePtr.Insert( 0, KBrandFileNameDefault_Z());
       
   125             }
       
   126         }
       
   127     path.Append( brandFileNamePtr );
       
   128     iServiceName = aServiceName.AllocL();
       
   129     // View info's must be created in initial contruct phase
       
   130     iTabbedViewInfo = CVIMPSTUIExtensionViewInfo::NewL( 
       
   131         iTabbedViewId, ETrue, path, KBrandTabIconId, KBrandTabMaskId, *iServiceName );
       
   132     HBufC* resourceFilePath = HBufC::NewLC( KMaxResourcePathLength );
       
   133     TPtr ptr( resourceFilePath->Des() );
       
   134     ptr.Append( KDefaultIconFile() ); // without drive
       
   135     ptr.Insert( 0, drive ); // insert drive
       
   136 
       
   137     // NearestLanguageFile takes only TFileName
       
   138     path.Zero();
       
   139     path.Append( *resourceFilePath );
       
   140 
       
   141 
       
   142     
       
   143       
       
   144 	iSearchViewInfo = CVIMPSTUIExtensionViewInfo::NewL(
       
   145         iSearchViewId, EFalse, path, KDefaultIconId, 
       
   146         KDefaultMaskId, *iServiceName  );    
       
   147         
       
   148     iBlockViewInfo = CVIMPSTUIExtensionViewInfo::NewL(
       
   149         iBlockedViewId, EFalse, path, KDefaultIconId, 
       
   150         KDefaultMaskId, *iServiceName  );    
       
   151 
       
   152 	iCommandHandler = CVIMPSTCmdHandler::NewL(iEngine); 
       
   153 
       
   154 	iUiFieldsArray = CVIMPSTUiSearchFieldArray::NewL();
       
   155     CleanupStack::PopAndDestroy(2,brandFileName); //resourceFilePath,brandTabIconFilePath
       
   156 	delete file_list;
       
   157     }
       
   158 
       
   159 // ---------------------------------------------------------------------------
       
   160 // CVIMPSTUIExtensionService::NewL
       
   161 // ---------------------------------------------------------------------------
       
   162 // 
       
   163 CVIMPSTUIExtensionService* CVIMPSTUIExtensionService::NewL(
       
   164     TUint aServiceId,
       
   165     TInt aTabbedViewId,
       
   166     TInt aSearchViewId,
       
   167     TInt aBlockedViewId, 
       
   168     const TDesC& aServiceName,    
       
   169     CVIMPSTUIMenuExtension& aMenuExtension,
       
   170     MVIMPSTEngine& aEngine )
       
   171     {
       
   172     CVIMPSTUIExtensionService* self = NewLC( 
       
   173         aServiceId, aTabbedViewId, aSearchViewId, aBlockedViewId, aServiceName, aMenuExtension, aEngine );
       
   174     CleanupStack::Pop(self);
       
   175     return self;
       
   176     }
       
   177 
       
   178 // ---------------------------------------------------------------------------
       
   179 // CVIMPSTUIExtensionService::NewLC
       
   180 // ---------------------------------------------------------------------------
       
   181 // 
       
   182 CVIMPSTUIExtensionService* CVIMPSTUIExtensionService::NewLC(
       
   183     TUint aServiceId,
       
   184     TInt aTabbedViewId,    
       
   185     TInt aSearchViewId, 
       
   186     TInt aBlockedViewId,  
       
   187     const TDesC& aServiceName,    
       
   188     CVIMPSTUIMenuExtension& aMenuExtension,
       
   189     MVIMPSTEngine& aEngine )
       
   190     {
       
   191     CVIMPSTUIExtensionService* self =
       
   192         new (ELeave) CVIMPSTUIExtensionService( 
       
   193             aServiceId, aTabbedViewId, aSearchViewId, aBlockedViewId, aMenuExtension, aEngine );
       
   194     CleanupStack::PushL(self);
       
   195     self->ConstructL(aServiceName);
       
   196     return self;
       
   197     }
       
   198 
       
   199 // ---------------------------------------------------------------------------
       
   200 // CVIMPSTUIExtensionService::~CVIMPSTUIExtensionService
       
   201 // ---------------------------------------------------------------------------
       
   202 // 
       
   203 CVIMPSTUIExtensionService::~CVIMPSTUIExtensionService()
       
   204     {
       
   205     delete iUiFieldsArray;
       
   206 
       
   207     delete iCommandHandler;
       
   208     iCommandHandler = NULL;
       
   209     
       
   210     delete iServiceName;
       
   211     iServiceName = NULL;
       
   212     
       
   213     delete iSearchString;
       
   214 	iSearchString = NULL;
       
   215 
       
   216     //delete iBrandHandler;
       
   217     
       
   218     delete iTabbedViewInfo;
       
   219     iTabbedViewInfo = NULL;      
       
   220     delete iSearchViewInfo;
       
   221     iSearchViewInfo = NULL;       
       
   222     
       
   223     delete iBlockViewInfo;
       
   224     iBlockViewInfo = NULL;  
       
   225     }
       
   226 
       
   227   
       
   228 // ---------------------------------------------------------------------------
       
   229 // CVIMPSTUIExtensionService::TabbedViewL
       
   230 // ---------------------------------------------------------------------------
       
   231 // 
       
   232 CVIMPSTUiTabbedView* 
       
   233     CVIMPSTUIExtensionService::TabbedViewL( 
       
   234         MxSPViewMapper& aMapper, 
       
   235         MxSPContactManager& aContactManager, 
       
   236         CPbk2UIExtensionView& aView,
       
   237         TInt aTabbedViewId,
       
   238         TUid aId,
       
   239         MVIMPSTEngine& aEngine ) 
       
   240     {
       
   241 	TRACER_AUTO;
       
   242     if ( !iTabbedView )
       
   243         {
       
   244         iTabbedView = CVIMPSTUiTabbedView::NewL( 
       
   245             aMapper,
       
   246             aContactManager,
       
   247             aTabbedViewId,
       
   248             iServiceId,
       
   249             aView,
       
   250             aId,
       
   251             *this,
       
   252             aEngine,
       
   253             *iCommandHandler,
       
   254             iMenuExtension);        
       
   255         }
       
   256     return iTabbedView;
       
   257     }    
       
   258     
       
   259 // ---------------------------------------------------------------------------
       
   260 // CVIMPSTUIExtensionService::BlockViewL
       
   261 // ---------------------------------------------------------------------------
       
   262 // 
       
   263 CVIMPSTUiBlockView* 
       
   264     CVIMPSTUIExtensionService::BlockViewL( 
       
   265         MxSPViewMapper& aMapper, 
       
   266         MxSPContactManager& aContactManager, 
       
   267         CPbk2UIExtensionView& aView,
       
   268         TInt aBlockedViewId,
       
   269         MVIMPSTEngine& aEngine ) 
       
   270     {
       
   271 	TRACER_AUTO;
       
   272     if ( !iBlockedView )
       
   273         {
       
   274         iBlockedView = CVIMPSTUiBlockView::NewL( 
       
   275             aMapper,
       
   276             aContactManager,
       
   277             aBlockedViewId,
       
   278             aView,
       
   279             *this ,
       
   280             aEngine,
       
   281             *iCommandHandler ); 
       
   282         }
       
   283     return iBlockedView;
       
   284     }    
       
   285     
       
   286 // ---------------------------------------------------------------------------
       
   287 // CVIMPSTUIExtensionService::SearchViewL
       
   288 // ---------------------------------------------------------------------------
       
   289 // 
       
   290 CVIMPSTUiSearchView* 
       
   291     CVIMPSTUIExtensionService::SearchViewL( 
       
   292         MxSPViewMapper& aMapper, 
       
   293         MxSPContactManager& aContactManager, 
       
   294         CPbk2UIExtensionView& aView,
       
   295         TInt aSearchViewId,
       
   296         TUid aId,
       
   297         MVIMPSTEngine& aEngine )
       
   298     {
       
   299 	TRACER_AUTO;
       
   300     if ( !iSearchView )
       
   301         {
       
   302         iSearchView = CVIMPSTUiSearchView::NewL( 
       
   303             aMapper,
       
   304             aContactManager,
       
   305             aSearchViewId,
       
   306             iServiceId,
       
   307             aView,        
       
   308             aId,
       
   309             *this,
       
   310             aEngine,
       
   311             *iCommandHandler ); 
       
   312         }
       
   313     return iSearchView;
       
   314     }      
       
   315   
       
   316 // ---------------------------------------------------------------------------
       
   317 // CVIMPSTUIExtensionService::TabbedViewId
       
   318 // ---------------------------------------------------------------------------
       
   319 // 
       
   320 TInt CVIMPSTUIExtensionService::TabbedViewId()
       
   321     {
       
   322     return iTabbedViewId;
       
   323     }
       
   324 // ---------------------------------------------------------------------------
       
   325 // CVIMPSTUIExtensionService::SearchViewId
       
   326 // ---------------------------------------------------------------------------
       
   327 // 
       
   328 TInt CVIMPSTUIExtensionService::SearchViewId()
       
   329     {
       
   330     return iSearchViewId;
       
   331     }    
       
   332     
       
   333 // ---------------------------------------------------------------------------
       
   334 // CVIMPSTUIExtensionService::BlockViewId
       
   335 // ---------------------------------------------------------------------------
       
   336 // 
       
   337 TInt CVIMPSTUIExtensionService::BlockViewId()
       
   338     {
       
   339     return iBlockedViewId;
       
   340     }      
       
   341 
       
   342 // ---------------------------------------------------------------------------
       
   343 // CVIMPSTUIExtensionService::ServiceId
       
   344 // ---------------------------------------------------------------------------
       
   345 // 
       
   346 TUint32 CVIMPSTUIExtensionService::ServiceId()
       
   347     {
       
   348     return iServiceId;
       
   349     }
       
   350     
       
   351     
       
   352 // ---------------------------------------------------------------------------
       
   353 // CVIMPSTUIExtensionService::ServiceName
       
   354 // ---------------------------------------------------------------------------
       
   355 // 
       
   356 const TDesC& CVIMPSTUIExtensionService::ServiceName()
       
   357     {
       
   358     return *iServiceName;
       
   359     }             
       
   360 
       
   361 // ---------------------------------------------------------------------------
       
   362 // CVIMPSTUIExtensionService::SearchString
       
   363 // ---------------------------------------------------------------------------
       
   364 // 
       
   365 const TDesC& CVIMPSTUIExtensionService::SearchString()
       
   366     {
       
   367     return *iSearchString;
       
   368     } 
       
   369     
       
   370 
       
   371 // ---------------------------------------------------------------------------
       
   372 // CVIMPSTUIExtensionService::SetSearchStringL
       
   373 // ---------------------------------------------------------------------------
       
   374 // 
       
   375 void CVIMPSTUIExtensionService::SetSearchStringL( const TDesC& aSearchString )
       
   376     {
       
   377     if( iSearchString )
       
   378 	    {
       
   379 	    delete iSearchString;
       
   380 	    iSearchString = NULL;
       
   381 	    }
       
   382     iSearchString = aSearchString.AllocL();
       
   383     }                       
       
   384 
       
   385 // ---------------------------------------------------------------------------
       
   386 // CVIMPSTUIExtensionService::TabbedViewInfoL
       
   387 // ---------------------------------------------------------------------------
       
   388 //    
       
   389 CVIMPSTUIExtensionViewInfo* 
       
   390     CVIMPSTUIExtensionService::TabbedViewInfoL()
       
   391     {
       
   392     return iTabbedViewInfo;
       
   393     }
       
   394 
       
   395 // ---------------------------------------------------------------------------
       
   396 // CVIMPSTUIExtensionService::SearchViewInfo
       
   397 // ---------------------------------------------------------------------------
       
   398 //    
       
   399 CVIMPSTUIExtensionViewInfo* 
       
   400     CVIMPSTUIExtensionService::SearchViewInfo()
       
   401     {
       
   402     return iSearchViewInfo;
       
   403     } 
       
   404     
       
   405 // ---------------------------------------------------------------------------
       
   406 // CVIMPSTUIExtensionService::BlockedViewInfo
       
   407 // ---------------------------------------------------------------------------
       
   408 //    
       
   409 CVIMPSTUIExtensionViewInfo* 
       
   410     CVIMPSTUIExtensionService::BlockedViewInfo()
       
   411     {
       
   412     return iBlockViewInfo;
       
   413     }     
       
   414         
       
   415 // ---------------------------------------------------------------------------
       
   416 // CVIMPSTUIExtensionService::HasViewId()
       
   417 // ---------------------------------------------------------------------------
       
   418 // 
       
   419 TBool CVIMPSTUIExtensionService::HasViewId( TInt aViewId )
       
   420     {
       
   421     return ( iTabbedViewId == aViewId || iSearchViewId == aViewId ||iBlockedViewId == aViewId  );
       
   422     }     
       
   423 
       
   424 
       
   425 // ---------------------------------------------------------------------------
       
   426 // CVIMPSTUIExtensionService::ServiceEngine()
       
   427 // ---------------------------------------------------------------------------
       
   428 // 
       
   429 
       
   430 MVIMPSTEngine& CVIMPSTUIExtensionService::ServiceEngine ()
       
   431 	{
       
   432 	return iEngine;
       
   433 	}
       
   434    
       
   435 // ---------------------------------------------------------------------------
       
   436 // CVIMPSTUIExtensionService::SetSearchFieldsDataL
       
   437 // ---------------------------------------------------------------------------
       
   438 // 
       
   439 void CVIMPSTUIExtensionService::SetSearchFieldsDataL( RArray<TInt>& aEnumKeysArray, RPointerArray<HBufC>& aLebelKeysArray )
       
   440     {
       
   441 	TRACER_AUTO;
       
   442     // reset all old fields and create new fields
       
   443     if( iUiFieldsArray )
       
   444 	    {
       
   445 	    delete iUiFieldsArray;
       
   446 	   	iUiFieldsArray = NULL;	
       
   447 	    }
       
   448 	iUiFieldsArray = CVIMPSTUiSearchFieldArray::NewL();
       
   449 	 	    
       
   450     TInt enumCount = aEnumKeysArray.Count();
       
   451     TInt labelCount = aLebelKeysArray.Count();
       
   452     
       
   453     TBool isBasicField = EFalse ;
       
   454     TInt basicFieldIndex = 0;   
       
   455       
       
   456     if( !enumCount && !labelCount )
       
   457 	    {
       
   458 	    return;	
       
   459 	    }
       
   460     for( TInt i =0; i< enumCount; i++ ) 
       
   461 	    {
       
   462 	    TVIMPSTEnums::TVIMPSTSearchKey enumKey = static_cast<TVIMPSTEnums::TVIMPSTSearchKey>( aEnumKeysArray[i] );
       
   463 	    // get the data associaed with key ,
       
   464 	    // also check if basic field
       
   465 	    HBufC* akeyValue = GetSearchKeyLabelL( enumKey, isBasicField );
       
   466 	    if( akeyValue )
       
   467 			{
       
   468 			if( isBasicField )
       
   469 				{
       
   470 				if( enumKey == TVIMPSTEnums::EVIMPSTFirstName )
       
   471 					{
       
   472 					basicFieldIndex = 0 ; // always on top 1st element	
       
   473 					}
       
   474 			
       
   475 				iUiFieldsArray->InsertFieldsL(basicFieldIndex , *akeyValue, EVIMPSTEdwinText,EIMBasicSearch ,enumKey);
       
   476 			
       
   477 				basicFieldIndex++ ; 
       
   478 				
       
   479 				}
       
   480 			else
       
   481 				{
       
   482 				iUiFieldsArray->CreateFieldsL( *akeyValue, EVIMPSTEdwinText ,EIMAdvancedSearch, enumKey);	
       
   483 				}
       
   484 			delete akeyValue;
       
   485 			akeyValue = NULL;
       
   486 			}
       
   487 	    	
       
   488 	    }
       
   489     
       
   490      for( TInt i =0; i< labelCount; i++ ) 
       
   491 	    {
       
   492 	    // not owns akeyValue 
       
   493 	    HBufC* akeyValue = aLebelKeysArray[i];
       
   494 	    if( akeyValue )
       
   495 			{
       
   496 			iUiFieldsArray->CreateFieldsL( *akeyValue, EVIMPSTEdwinText );
       
   497 			}
       
   498 	    	
       
   499 	    }
       
   500 	// this will sort only basic fields
       
   501 	SortBasicFields();
       
   502     }                       
       
   503 // ---------------------------------------------------------------------------
       
   504 // CVIMPSTUIExtensionService::SetSearchFieldsDataL
       
   505 // ---------------------------------------------------------------------------
       
   506 // 
       
   507 CVIMPSTUiSearchFieldArray& CVIMPSTUIExtensionService::GetSearchFieldArray()  
       
   508     {
       
   509    	return *iUiFieldsArray;
       
   510     } 
       
   511         
       
   512 // ---------------------------------------------------------------------------
       
   513 // CVIMPSTUIExtensionService::GetSearchKeyLabelL
       
   514 // ---------------------------------------------------------------------------
       
   515 // 
       
   516 HBufC* CVIMPSTUIExtensionService::GetSearchKeyLabelL(TVIMPSTEnums::TVIMPSTSearchKey aSearchKey ,TBool& aBasicField )  
       
   517     {
       
   518 	TRACER_AUTO;
       
   519     HBufC* keyText = NULL;
       
   520     aBasicField = EFalse;
       
   521     
       
   522     switch( aSearchKey )
       
   523 	    {
       
   524 	    case TVIMPSTEnums::EVIMPSTMiddleName :
       
   525 			{
       
   526 		    keyText =  VIMPSTUtils::LoadResourceL( R_QTN_SERVTAB_SEARCH_MIDDLENAME ); 		
       
   527 			break;		
       
   528 			}
       
   529 		case TVIMPSTEnums::EVIMPSTLastName :
       
   530 			{
       
   531 			keyText =  VIMPSTUtils::LoadResourceL( R_QTN_SERVTAB_SEARCH_LASTNAME ); 
       
   532 			aBasicField = ETrue;	 	        		
       
   533 			break;		
       
   534 			}
       
   535 		case TVIMPSTEnums::EVIMPSTFullName :
       
   536 			{
       
   537 		    keyText =  VIMPSTUtils::LoadResourceL( R_QTN_SERVTAB_SEARCH_FULLNAME );    		
       
   538 			break;		
       
   539 			}
       
   540 		case TVIMPSTEnums::EVIMPSTCountry :
       
   541 			{
       
   542 		    keyText =  VIMPSTUtils::LoadResourceL( R_QTN_SERVTAB_SEARCH_COUNTRY );     		
       
   543 			break;		
       
   544 			}
       
   545 		case TVIMPSTEnums::EVIMPSTCity :
       
   546 			{
       
   547 			keyText =  VIMPSTUtils::LoadResourceL( R_QTN_SERVTAB_SEARCH_CITY ); 	        		
       
   548 			break;		
       
   549 			}
       
   550 	
       
   551 		case TVIMPSTEnums::EVIMPSTNickName :
       
   552 			{
       
   553 		    keyText =  VIMPSTUtils::LoadResourceL( R_QTN_SERVTAB_SEARCH_NICKNAME ); 		
       
   554 			break;		
       
   555 			}
       
   556 		case TVIMPSTEnums::EVIMPSTState :
       
   557 			{
       
   558 			keyText =  VIMPSTUtils::LoadResourceL( R_QTN_SERVTAB_SEARCH_STATE ); 	 	        		
       
   559 			break;		
       
   560 			}
       
   561 		case TVIMPSTEnums::EVIMPSTOrganisationUnit :
       
   562 			{
       
   563 		    keyText =  VIMPSTUtils::LoadResourceL( R_QTN_SERVTAB_SEARCH_ORGUNIT );    		
       
   564 			break;		
       
   565 			}
       
   566 		case TVIMPSTEnums::EVIMPSTBirthday :
       
   567 			{
       
   568 		    keyText =  VIMPSTUtils::LoadResourceL( R_QTN_SERVTAB_SEARCH_BIRTHDAY );     		
       
   569 			break;		
       
   570 			}
       
   571 			
       
   572 		case TVIMPSTEnums::EVIMPSTEmailAddress :
       
   573 			{
       
   574 		    keyText =  VIMPSTUtils::LoadResourceL( R_QTN_SERVTAB_SEARCH_EMAIL );     		
       
   575 			break;		
       
   576 			}
       
   577 		case TVIMPSTEnums::EVIMPSTUser :
       
   578 			{
       
   579 			aBasicField = ETrue;	
       
   580 		    keyText =  VIMPSTUtils::LoadResourceL( R_QTN_SERVTAB_SEARCH_USER ); 		
       
   581 			break;		
       
   582 			}
       
   583 		case TVIMPSTEnums::EVIMPSTOrganisation :
       
   584 			{
       
   585 		    keyText =  VIMPSTUtils::LoadResourceL( R_QTN_SERVTAB_SEARCH_ORG );    		
       
   586 			break;		
       
   587 			}
       
   588 		case TVIMPSTEnums::EVIMPSTFirstName:
       
   589 		default:
       
   590 			{
       
   591 			aBasicField = ETrue;
       
   592 		   	keyText =  VIMPSTUtils::LoadResourceL( R_QTN_SERVTAB_SEARCH_FIRSTNAME );
       
   593 	     	break; 
       
   594 			}	
       
   595 	    }
       
   596 	
       
   597 	return 	keyText;
       
   598 	
       
   599     } 
       
   600  
       
   601  // ---------------------------------------------------------------------------
       
   602 // CVIMPSTUIExtensionService::SortBasicFields
       
   603 // ---------------------------------------------------------------------------
       
   604 // 
       
   605 void CVIMPSTUIExtensionService::SortBasicFields()  
       
   606 	{
       
   607 	TRACER_AUTO;
       
   608 	TInt count = iUiFieldsArray->Count();
       
   609 	TInt index = 0;
       
   610 	if( count >2 ) // atleast there has to be 3 item for sort , first name is already on top
       
   611 		{
       
   612 		MVIMPSTUiSearchField& field = iUiFieldsArray->At(1);
       
   613 		if( field.GetSearchKey() != TVIMPSTEnums::EVIMPSTLastName )
       
   614 			{
       
   615 			for(index =2; index < count; index++ )
       
   616 				{
       
   617 				field = iUiFieldsArray->At(index);
       
   618 				if( field.GetSearchKey() == TVIMPSTEnums::EVIMPSTLastName )	
       
   619 					{
       
   620 					iUiFieldsArray->RemoveField(index);
       
   621 					iUiFieldsArray->InsertField(&field, 1); // insert at 1st number;	
       
   622 					return;
       
   623 					}
       
   624 				}
       
   625 				
       
   626 			}
       
   627 		}
       
   628 	
       
   629 	}
       
   630 	
       
   631 // End of file