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