imservices/searchfeatureplugin/srcsearchoperations/searchop/operationhandlesearchkeys.cpp
changeset 0 e6b17d312c8b
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Concrete handle search keys from protocol plugin operation
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include <badesca.h>
       
    20 #include <ximpprotocolconnection.h>
       
    21 #include <protocolsearchfeature.h>
       
    22 
       
    23 #include <ximppsccontext.h>
       
    24 
       
    25 #include "searchinfoimp.h"
       
    26 #include "operationhandlesearchkeys.h"
       
    27 #include "ximpoperationbase.h"
       
    28 
       
    29 #include "searchdatacacheimp.h"
       
    30 
       
    31 #include "ximpobjecthelpers.h"
       
    32 #include "ximprestrictedobjectcollectionimp.h"
       
    33 #include "ximpobjectcollectionimp.h"
       
    34 #include "ximphost.h"
       
    35 
       
    36 #include "protocolsearchdatahostimp.h"
       
    37 #include "searchlogutils.h"
       
    38 #include "searchdatacacheimp.h"
       
    39 
       
    40 #include "ximpsubscriptionitem.h"
       
    41 #include "searchkeyinfoimp.h"
       
    42 #include "searchkeyssubscriptionitem.h"
       
    43 
       
    44 
       
    45 // ======== MEMBER FUNCTIONS ========
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // COperationHandleSearchKeys::COperationHandleSearchKeys()
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 EXPORT_C COperationHandleSearchKeys::COperationHandleSearchKeys()
       
    52     {
       
    53     XSearchLogger::Log(_L("COperationHandleSearchKeys::COperationHandleSearchKeys Started"));
       
    54     XSearchLogger::Log(_L("COperationHandleSearchKeys::COperationHandleSearchKeys Completed"));
       
    55     }
       
    56 
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // COperationHandleSearchKeys::ConstructL()
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 void COperationHandleSearchKeys::ConstructL( const TDesC8& /*aParamPck */)
       
    63     {
       
    64     XSearchLogger::Log(_L("COperationHandleSearchKeys::ConstructL Started")); 
       
    65     iKeyInfoArray=new ( ELeave ) RSearchKeyInfoImpArray;  
       
    66     XSearchLogger::Log(_L("COperationHandleSearchKeys::ConstructL Completed"));
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // COperationHandleSearchKeys::~COperationHandleSearchKeys()
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 COperationHandleSearchKeys::~COperationHandleSearchKeys()
       
    74     {
       
    75     XSearchLogger::Log(_L("COperationHandleSearchKeys::~COperationHandleSearchKeys Started"));
       
    76    
       
    77     XSearchLogger::Log(_L("COperationHandleSearchKeys::~COperationHandleSearchKeys Completed"));
       
    78     }
       
    79 
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // COperationHandleSearchKeys::ProcessL()
       
    83 // ---------------------------------------------------------------------------
       
    84 //
       
    85 void COperationHandleSearchKeys::ProcessL()
       
    86     {
       
    87 	XSearchLogger::Log(_L("COperationHandleSearchKeys::ProcessL Started"));
       
    88 	CXIMPOperationBase::ProcessL();
       
    89 	MXIMPBase* object = NULL;
       
    90 	TBool force =  ETrue; 
       
    91 	CXIMPOperationBase::GetObjCollection()->GetByType( object, MXIMPObjectCollection::KInterfaceId );
       
    92 	
       
    93 	if( object )
       
    94 		{  
       
    95 		MXIMPObjectCollection* objectCollection = static_cast<MXIMPObjectCollection*>(object->GetInterface(MXIMPObjectCollection::KInterfaceId,MXIMPBase::EPanicIfUnknown)) ;
       
    96         
       
    97         CleanupStack::PushL( objectCollection );
       
    98        
       
    99         TLinearOrder< CSearchKeyInfoImp > order( ( CSearchKeyInfoImp::LinearOrder ));
       
   100         TXIMPObjectMover< MSearchKeyInfo, CSearchKeyInfoImp >::
       
   101                                    MoveFromCollectionToArrayL( *objectCollection, *iKeyInfoArray, order );
       
   102         CleanupStack::Pop( objectCollection ); 
       
   103         delete  objectCollection;
       
   104 		}
       
   105 	else
       
   106 		{
       
   107 		User::Leave( KErrArgument );
       
   108 		}
       
   109 		
       
   110     
       
   111  	CProtocolSearchDataHostImp* srchProtocolHost = 
       
   112 					static_cast <CProtocolSearchDataHostImp*> (iMyHost->GetProtocolHost(MProtocolSearchDataHost::KInterfaceId) );
       
   113 	
       
   114 	CSearchKeysSubscriptionItem& searchKeySubsItem = 
       
   115 			 srchProtocolHost->SearchDataCache().SearchKeysSubscriptionItemLC() ;
       
   116     			
       
   117 
       
   118 	searchKeySubsItem.SetKeyInfoArray( iKeyInfoArray ); // ownership trasferred	
       
   119 	iKeyInfoArray=NULL;
       
   120 
       
   121 	searchKeySubsItem.SynthesiseSubscriptionEventToL( CXIMPOperationBase::GetContext(), force  );
       
   122 	CleanupStack::PopAndDestroy(); // searchKeySubsItem 
       
   123 	iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone );
       
   124 	XSearchLogger::Log(_L("COperationHandleSearchKeys::ProcessL Completed"));
       
   125 	}
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 // COperationHandleSearchKeys::RequestCompleted()
       
   129 // ---------------------------------------------------------------------------
       
   130 //
       
   131 void COperationHandleSearchKeys::RequestCompletedL()
       
   132     {
       
   133     XSearchLogger::Log(_L("COperationHandleSearchKeys::RequestCompletedL Started"));
       
   134     CXIMPOperationBase::RequestCompletedL();
       
   135 	XSearchLogger::Log(_L("COperationHandleSearchKeys::RequestCompletedL Completed"));
       
   136     }
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // COperationHandleSearchKeys::Type()
       
   140 // ---------------------------------------------------------------------------
       
   141 //
       
   142 TInt COperationHandleSearchKeys::Type() const
       
   143     {
       
   144     return NSearchOps::EHandleSearchKeys;
       
   145     }
       
   146 
       
   147 
       
   148 // End of file