Exemple #1
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);
    }
}
// ---------------------------------------------------------------------------
// CHarvesterMessagePluginAO::RemoveObjectL
// ---------------------------------------------------------------------------
//
void CMessageMonitorPlugin::RemoveObjectL( const TDesC& aUri )
	{
    WRITELOG( "CMessageMonitorPlugin::RemoveObjectL enter" );
	CMdEObject* mdeObject = iMdeSession->GetObjectL( aUri );

    // check if in mde
    if ( mdeObject )
    	{
    	TItemId objectId = mdeObject->Id();
	    delete mdeObject;
	    mdeObject = NULL;
	    
		TTime time( 0 );
		CMdENamespaceDef& nsDef = iMdeSession->GetDefaultNamespaceDefL();
		CMdEEventDef& eventDef = nsDef.GetEventDefL( MdeConstants::Events::KDeleted );
	
		iMdeSession->RemoveObjectL( aUri, &nsDef );
		WRITELOG1( "aUri: %S", &aUri );							
		time.UniversalTime();
		CMdEEvent* event =  iMdeSession->NewEventL( eventDef, objectId, time,NULL,NULL );
		
		iMdeSession->AddEventL( *event );
		delete event;
		event = NULL;
    	}
    
    WRITELOG( "CMessageMonitorPlugin::RemoveObjectL return" );
	}