qcpix/src/platform/s60/src/qcpixsearcherprivate.cpp
changeset 15 cf5c74390b98
parent 10 afe194b6b1cd
child 18 3e1f76dd2722
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 "qcpixsearcherprivate.h"
       
    19 #include <qcpixsearcher.h>
       
    20 #include <CCPixSearcher.h>
       
    21 #include <qcpixcommon.h>
       
    22 
       
    23 #include "qcpixutils.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 QCPixSearcherPrivate::QCPixSearcherPrivate( QObject* aParent )
       
    31     {
       
    32     iSearchParent = reinterpret_cast<QCPixSearcher*>( aParent );
       
    33     }
       
    34 
       
    35 void QCPixSearcherPrivate::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 QCPixSearcherPrivate::~QCPixSearcherPrivate()
       
    45     {
       
    46     delete iSearcher;
       
    47     //iSearchSession.Close();
       
    48     }
       
    49 
       
    50 void QCPixSearcherPrivate::HandleSearchResultsL(TInt aError, TInt aEstimatedResultCount)
       
    51     {
       
    52     PERF_TIME_NOW("Async search complete");
       
    53     emit iSearchParent->handleSearchResults( aError, aEstimatedResultCount );
       
    54     }
       
    55 
       
    56 void QCPixSearcherPrivate::HandleDocumentL(TInt aError, CSearchDocument* aDocument)
       
    57     {
       
    58     PERF_TIME_NOW("Async get document complete")
       
    59     emit iSearchParent->handleDocument( aError, QCPixDocFromCPixDoc( aDocument ) );
       
    60     }
       
    61 
       
    62 void QCPixSearcherPrivate::HandleOpenDatabaseResultL( TInt aError )
       
    63     {
       
    64     emit iSearchParent->handleDatabaseSet( aError );
       
    65     }
       
    66 
       
    67 void QCPixSearcherPrivate::HandleSetAnalyzerResultL( TInt /*aError*/ )
       
    68     {
       
    69     //what is to be done here?
       
    70     }