uiservicetab/vimpstcmdprocess/src/cvimpstcmdsearch.cpp
branchRCL_3
changeset 29 9a48e301e94b
equal deleted inserted replaced
28:3104fc151679 29:9a48e301e94b
       
     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:  command process for search
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cvimpstcmdsearch.h"
       
    21 
       
    22 #include "vimpstcmd.hrh"
       
    23 #include "mvimpstcmdobserver.h"
       
    24 
       
    25 #include "uiservicetabtracer.h"
       
    26 
       
    27 #include <e32def.h>
       
    28 #include "mvimpstengine.h"
       
    29 #include "mvimpstenginesearchmgrextention.h"
       
    30 
       
    31 #include "mvimpstengineextentionfeatures.h"
       
    32 
       
    33 // --------------------------------------------------------------------------
       
    34 // CVIMPSTCmdSearch::CVIMPSTCmdSearch
       
    35 // --------------------------------------------------------------------------
       
    36 //
       
    37 CVIMPSTCmdSearch::CVIMPSTCmdSearch( 
       
    38 						        const TInt aCommandId ,
       
    39 						        RArray<TVIMPSTSearchKeyData>& aKeyDataArray,
       
    40 						        MVIMPSTEngine& aEngine) :            
       
    41             iCommandId( aCommandId ),
       
    42             iKeyDataArray( aKeyDataArray ),
       
    43             iEngine(aEngine)
       
    44     {
       
    45     
       
    46     }
       
    47 
       
    48 // --------------------------------------------------------------------------
       
    49 // CVIMPSTCmdSearch::~CVIMPSTCmdSearch
       
    50 // --------------------------------------------------------------------------
       
    51 //
       
    52 CVIMPSTCmdSearch::~CVIMPSTCmdSearch()
       
    53     {    
       
    54     
       
    55     }
       
    56 
       
    57 // --------------------------------------------------------------------------
       
    58 // CVIMPSTCmdSearch::NewL
       
    59 // --------------------------------------------------------------------------
       
    60 //
       
    61 CVIMPSTCmdSearch* CVIMPSTCmdSearch::NewL( 
       
    62 							        const TInt aCommandId,
       
    63 							        RArray<TVIMPSTSearchKeyData>& aKeyDataArray,
       
    64 							        MVIMPSTEngine& aEngine )
       
    65     {
       
    66     CVIMPSTCmdSearch* self = new (ELeave ) CVIMPSTCmdSearch( aCommandId ,aKeyDataArray, aEngine);
       
    67     self->ConstructL(); //use contsurctL if necessary
       
    68     return self;
       
    69     }
       
    70 // --------------------------------------------------------------------------
       
    71 // CVIMPSTCmdSearch::ConstructL
       
    72 // --------------------------------------------------------------------------
       
    73 //
       
    74 void CVIMPSTCmdSearch::ConstructL()
       
    75     {    
       
    76     iError = KErrNone;
       
    77     }
       
    78 
       
    79 // --------------------------------------------------------------------------
       
    80 // CVIMPSTCmdSearch::ExecuteLD
       
    81 // --------------------------------------------------------------------------
       
    82 //
       
    83 void CVIMPSTCmdSearch::ExecuteLD()
       
    84     {
       
    85    
       
    86     TRACER_AUTO;
       
    87     //push to the cleanupstack
       
    88     CleanupStack::PushL( this );   
       
    89 	
       
    90 	//make search request using search manager in engine 
       
    91 	MVIMPSTEngineExtentionFeatures* feature = iEngine.ExtentionFeatures(TVIMPSTEnums::ESearch);
       
    92 	if (feature)
       
    93 		{
       
    94 		MVIMPSTEngineSearchMgrExtention& searchMgr = 
       
    95 	   	   	MVIMPSTEngineSearchMgrExtention::Cast
       
    96 	   	   	(*feature);	
       
    97 	   	
       
    98 	   	iError = searchMgr.SearchContactsL( iKeyDataArray );   	
       
    99 		}	  	
       
   100    	
       
   101    
       
   102 
       
   103     if(iObserver)
       
   104 	    {
       
   105 	    iObserver->CommandFinishedL(*this);
       
   106 	    }
       
   107 	
       
   108 	CleanupStack::PopAndDestroy();	
       
   109 	
       
   110     }
       
   111 
       
   112 
       
   113 // --------------------------------------------------------------------------
       
   114 // CVIMPSTCmdSearch::AddObserver
       
   115 // --------------------------------------------------------------------------
       
   116 //
       
   117 void CVIMPSTCmdSearch::AddObserver( MVIMPSTCmdObserver& aObserver )
       
   118     {
       
   119     // store the observer to notify the command completion
       
   120     iObserver = &aObserver;
       
   121     }
       
   122 
       
   123 
       
   124 // --------------------------------------------------------------------------
       
   125 // CVIMPSTCmdSearch::CommandId
       
   126 // --------------------------------------------------------------------------
       
   127 //
       
   128 TInt CVIMPSTCmdSearch::CommandId() const
       
   129 	{
       
   130 	return iCommandId;	
       
   131 	}
       
   132 
       
   133 // --------------------------------------------------------------------------
       
   134 // CVIMPSTCmdSearch::Result
       
   135 // --------------------------------------------------------------------------
       
   136 //
       
   137 TInt CVIMPSTCmdSearch::Result() const
       
   138 	{
       
   139 	//return valid data regd the command operation
       
   140 	return iError;
       
   141 	}
       
   142 
       
   143 // End of File