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