qcpix/src/platform/s60/src/qcpixsearcherprivate.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 13:33:22 +0300
changeset 1 6f2c1c46032b
parent 0 671dee74050a
child 3 ae3f1779f6da
permissions -rw-r--r--
Revision: 201015 Kit: 201018

/*
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
*
*/

#include "qcpixsearcherprivate.h"
#include <qcpixsearcher.h>
#include <CCPixSearcher.h>
#include <qcpixcommon.h>

#include "qcpixutils.h"

/**
 * Note: Code in this file should never throw OR leak symbian exceptions.
 * Convert all leaves to C++ exceptions.
 */

QCPixSearcherPrivate::QCPixSearcherPrivate( QObject* aParent )
    {
    iSearchParent = reinterpret_cast<QCPixSearcher*>( aParent );
    }

void QCPixSearcherPrivate::Construct( QString aDefaultSearchField )
    {
    qt_symbian_throwIfError( iSearchSession.Connect() );//throw exception on error.
    TBuf<KMaxStringLength> defaultSearchField( aDefaultSearchField.utf16() );
    QT_TRAP_THROWING( iSearcher = CCPixSearcher::NewL( iSearchSession, defaultSearchField  ) );
    }

QCPixSearcherPrivate::~QCPixSearcherPrivate()
    {
    delete iSearcher;
    //iSearchSession.Close();
    }

void QCPixSearcherPrivate::HandleSearchResultsL(TInt aError, TInt aEstimatedResultCount)
    {
    PERF_TIME_NOW("Async search complete");
    emit iSearchParent->handleSearchResults( aError, aEstimatedResultCount );
    }

void QCPixSearcherPrivate::HandleDocumentL(TInt aError, CSearchDocument* aDocument)
    {
    PERF_TIME_NOW("Async get document complete")
    emit iSearchParent->handleDocument( aError, QCPixDocFromCPixDoc( aDocument ) );
    }

void QCPixSearcherPrivate::HandleOpenDatabaseResultL( TInt aError )
    {
    emit iSearchParent->handleDatabaseSet( aError );
    }

void QCPixSearcherPrivate::HandleSetAnalyzerResultL( TInt /*aError*/ )
    {
    //what is to be done here?
    }