qcpix/src/platform/s60/src/cpixsearcherprivate.cpp
changeset 15 cf5c74390b98
equal deleted inserted replaced
10:afe194b6b1cd 15:cf5c74390b98
       
     1 /*
       
     2 * Copyright (c) 2010 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cpixsearcherprivate.h"
       
    19 #include <cpixsearcher.h>
       
    20 #include <CCPixSearcher.h>
       
    21 #include <cpixcommon.h>
       
    22 
       
    23 #include "cpixutils.h"
       
    24 
       
    25 /**
       
    26  * Note: Code in this file should never throw OR leak symbian exceptions.
       
    27  * Convert all leaves to C++ exceptions.
       
    28  */
       
    29 
       
    30 CpixSearcherPrivate::CpixSearcherPrivate( QObject* aParent )
       
    31     {
       
    32     iSearchParent = reinterpret_cast<CpixSearcher*>( aParent );
       
    33     }
       
    34 
       
    35 void CpixSearcherPrivate::Construct( QString aDefaultSearchField )
       
    36     {
       
    37     qt_symbian_throwIfError( iSearchSession.Connect() );//throw exception on error.
       
    38     QT_TRAP_THROWING(
       
    39     TBuf<KMaxStringLength> defaultSearchField( aDefaultSearchField.utf16() );
       
    40     iSearcher = CCPixSearcher::NewL( iSearchSession, defaultSearchField  ) 
       
    41     ); //end of QT_TRAP_THROWING
       
    42     }
       
    43 
       
    44 CpixSearcherPrivate::~CpixSearcherPrivate()
       
    45     {
       
    46     delete iSearcher;
       
    47     //iSearchSession.Close();
       
    48     }
       
    49 
       
    50 void CpixSearcherPrivate::HandleSearchResultsL(TInt aError, TInt aEstimatedResultCount)
       
    51     {
       
    52     PERF_TIME_NOW("Async search complete");
       
    53     emit iSearchParent->handleSearchResults( aError, aEstimatedResultCount );
       
    54     }
       
    55 
       
    56 void CpixSearcherPrivate::HandleDocumentL(TInt aError, CSearchDocument* aDocument)
       
    57     {
       
    58     PERF_TIME_NOW("Async get document complete")
       
    59     emit iSearchParent->handleDocument( aError, CpixDocFromCSearchDocument( aDocument ) );
       
    60     }
       
    61 	
       
    62 void CpixSearcherPrivate::HandleBatchDocumentL(TInt aError,TInt aRetCount, CSearchDocument** aDocument)
       
    63     {
       
    64     PERF_TIME_NOW("Async get batch document complete")
       
    65     emit iSearchParent->handleBatchDocuments( aError, aRetCount,CpixBatchDocFromCSearchDocument( aRetCount, aDocument) );
       
    66     }
       
    67 
       
    68 void CpixSearcherPrivate::HandleOpenDatabaseResultL( TInt aError )
       
    69     {
       
    70     emit iSearchParent->handleDatabaseSet( aError );
       
    71     }
       
    72 
       
    73 void CpixSearcherPrivate::HandleSetAnalyzerResultL( TInt /*aError*/ )
       
    74     {
       
    75     //what is to be done here?
       
    76     }