// ---------------------------------------------------------------------------
// HandleQueryCompleted
// From MMdEQueryObserver.
// ---------------------------------------------------------------------------
//
void CLocationRelationObserver::HandleQueryCompleted( CMdEQuery& aQuery, TInt /*aError*/ )
    {
    if ( aQuery.Count() == 0 )
        {
        WRITELOG( "CLocationObjectObserver::HandleQueryCompleted() - no items found" );
        }
    else 
    	{
	    TRAP_IGNORE(
	    const TInt count = aQuery.Count();
	    for ( TInt i = 0; i < count; i++ )
	    	{
	    	CMdERelation* relation = iSession->GetRelationL( aQuery.ResultId(i) );
	        if ( iComposer && relation )
	            {
	            iComposer->WriteGPSTagsL( relation->LeftObjectId(), relation->RightObjectId() );
	            }
	    	
	    	delete relation;
	    	relation = NULL;
	    	}
	    	)
    	}
    
   	TRAP_IGNORE( QueryRelationItemsL() );
    }
Exemplo n.º 2
0
void QMDEGalleryQueryResultSet::HandleQueryNewResults( CMdEQuery &aQuery,
    TInt firstNewItemIndex,
    TInt newItemCount )
{
    if (m_launchUpdateQuery) {
        if (aQuery.ResultMode() == EQueryResultModeItem) {
            int max = aQuery.Count();
            for ( TInt i = firstNewItemIndex; i < max; i++ ) {
                CMdEObject *item = static_cast<CMdEObject *>(aQuery.TakeOwnershipOfResult( i ));
                m_updatedItemArray.Append( item );
                m_updatedObjectIDs.Append( item->Id() );
            }
        }
    }
    else {
        if (aQuery.ResultMode() == EQueryResultModeItem) {
            int max = aQuery.Count();
            for ( TInt i = firstNewItemIndex; i < max; i++ ) {
                CMdEObject *item = static_cast<CMdEObject *>(aQuery.TakeOwnershipOfResult( i ));
                m_itemArray.Append( item );
                m_currentObjectIDs.Append( item->Id() );
            }
        }

        //Signals that items have been inserted into a result set at
        emit itemsInserted(firstNewItemIndex, newItemCount);

        emit progressChanged(aQuery.Count(), KMdEQueryDefaultMaxCount);
    }
}
Exemplo n.º 3
0
void QMDEGalleryQueryResultSet::HandleQueryCompleted( CMdEQuery &aQuery, TInt aError )
{
    m_query_running = false;

    if (m_launchUpdateQuery) {
        handleUpdatedResults();
        m_launchUpdateQuery = false;
    } else {
        emit progressChanged(aQuery.Count(), aQuery.Count());

        if (aError == KErrNone) {
            if (m_live) {
                TRAPD( err,
                    m_session->AddItemAddedObserverL(*this, aQuery.Conditions());
                    m_session->AddItemChangedObserverL(*this, m_currentObjectIDs);
                );
                if (err) {
                    m_live = false;
                }
            }
            finish(m_live);
        } else if (aError == KErrCancel) {
Exemplo n.º 4
0
void QMDEGalleryCategoryResultSet::HandleQueryNewResults(
    CMdEQuery &aQuery, TInt, TInt)
{
    const int insertIndex = m_count;
    const int currentIndex = m_currentIndex;

    m_count = qMax(aQuery.Count() - m_offset, 0);

    const int insertCount = m_count - insertIndex;

    if (insertCount > 0) {
        if (currentIndex >= insertIndex)
            m_currentIndex += insertCount;

        emit itemsInserted(insertIndex, insertCount);

        if (m_currentIndex != currentIndex)
            emit currentIndexChanged(m_currentIndex);
    }
}