466 CleanupClosePushL( matchingItemIdArray ); |
466 CleanupClosePushL( matchingItemIdArray ); |
467 |
467 |
468 aSerializedItems.PositionL( KNoOffset ); |
468 aSerializedItems.PositionL( KNoOffset ); |
469 aSerializedItemIds.PositionL( KNoOffset ); |
469 aSerializedItemIds.PositionL( KNoOffset ); |
470 |
470 |
471 TBool someMatches = iComparator->MatchL( e.NamespaceDefId(), e.iType, e.Condition(), |
471 const TBool someMatches = iComparator->MatchL( e.NamespaceDefId(), e.iType, e.Condition(), |
472 aSerializedItems, aSerializedItemIds, |
472 aSerializedItems, aSerializedItemIds, |
473 matchingItemIdArray, |
473 matchingItemIdArray, |
474 e.AllowConfidential() ); |
474 e.AllowConfidential() ); |
475 |
475 |
476 if( someMatches ) // check if there is some matches |
476 if( someMatches ) // check if there is some matches |
559 relationIdArray.Append( relationId ); |
559 relationIdArray.Append( relationId ); |
560 } |
560 } |
561 } |
561 } |
562 } |
562 } |
563 |
563 |
564 if( objectIdArray.Count() != 0 |
564 const TInt objectCount( objectIdArray.Count() ); |
565 || eventIdArray.Count() != 0 |
565 const TInt eventCount( eventIdArray.Count() ); |
566 || relationIdArray.Count() != 0 ) |
566 const TInt relationCount( relationIdArray.Count() ); |
|
567 if( objectCount != 0 |
|
568 || eventCount != 0 |
|
569 || relationCount != 0 ) |
567 { |
570 { |
568 const TInt entriesCount = iEntries.Count(); |
571 const TInt entriesCount = iEntries.Count(); |
569 for( TInt i=0; i < entriesCount; ++i ) |
572 for( TInt i=0; i < entriesCount; ++i ) |
570 { |
573 { |
571 TEntry& e = iEntries[i]; |
574 TEntry& e = iEntries[i]; |
579 if(aItemIsConfidential && !e.AllowConfidential()) |
582 if(aItemIsConfidential && !e.AllowConfidential()) |
580 { |
583 { |
581 continue; |
584 continue; |
582 } |
585 } |
583 |
586 |
584 if( e.iType & EObjectNotifyRemove && objectIdArray.Count() > 0 ) |
587 if( e.iType & EObjectNotifyRemove && objectCount > 0 ) |
585 { |
588 { |
586 // collect matching object IDs |
589 // collect matching object IDs |
587 RArray<TItemId> matchingObjectIdArray; |
590 RArray<TItemId> matchingObjectIdArray; |
588 CleanupClosePushL( matchingObjectIdArray ); |
591 CleanupClosePushL( matchingObjectIdArray ); |
589 |
592 |
590 TBool allMatches = iComparator->MatchObjectIdsL( e.Condition(), |
593 const TBool allMatches = iComparator->MatchObjectIdsL( e.Condition(), |
591 objectIdArray, matchingObjectIdArray ); |
594 objectIdArray, matchingObjectIdArray ); |
592 |
595 |
593 // check is there any matches |
596 // check is there any matches |
594 if( allMatches || matchingObjectIdArray.Count() > 0 ) |
597 if( allMatches || matchingObjectIdArray.Count() > 0 ) |
595 { |
598 { |
653 TRAP_IGNORE( e.CacheL( EEventNotifyRemove, |
656 TRAP_IGNORE( e.CacheL( EEventNotifyRemove, |
654 eventIdArray ) ); |
657 eventIdArray ) ); |
655 } |
658 } |
656 } |
659 } |
657 else if( ( e.iType & ERelationNotifyRemove ) |
660 else if( ( e.iType & ERelationNotifyRemove ) |
658 && relationIdArray.Count() > 0 ) |
661 && relationCount > 0 ) |
659 { |
662 { |
660 // relation condition can't contain ID conditions, |
663 // relation condition can't contain ID conditions, |
661 // so get all IDs |
664 // so get all IDs |
662 if(e.IsPending()) |
665 if(e.IsPending()) |
663 { |
666 { |
692 |
694 |
693 for( TInt i = 0; i < count; ++i ) |
695 for( TInt i = 0; i < count; ++i ) |
694 { |
696 { |
695 TEntry& e = iEntries[i]; |
697 TEntry& e = iEntries[i]; |
696 |
698 |
697 if ( ! (e.iType & ( EObjectNotifyModify | ERelationNotifyModify /*| ERelationItemNotifyModify*/ ) ) ) |
699 if ( ! (e.iType & ( EObjectNotifyModify | ERelationNotifyModify ) ) ) |
698 { |
700 { |
699 continue; |
701 continue; |
700 } |
702 } |
701 |
703 |
702 RArray<TItemId> matchingObjectIdArray; |
704 RArray<TItemId> matchingObjectIdArray; |
703 CleanupClosePushL( matchingObjectIdArray ); |
705 CleanupClosePushL( matchingObjectIdArray ); |
704 |
706 |
705 aSerializedItems.PositionL( KNoOffset ); |
707 aSerializedItems.PositionL( KNoOffset ); |
706 aSerializedItemIds.PositionL( KNoOffset ); |
708 aSerializedItemIds.PositionL( KNoOffset ); |
707 |
709 |
708 TBool someMatches = iComparator->MatchL( e.NamespaceDefId(), |
710 const TBool someMatches = iComparator->MatchL( e.NamespaceDefId(), |
709 e.iType, e.Condition(), aSerializedItems, aSerializedItemIds, |
711 e.iType, e.Condition(), aSerializedItems, aSerializedItemIds, |
710 matchingObjectIdArray, e.AllowConfidential() ); |
712 matchingObjectIdArray, e.AllowConfidential() ); |
711 |
713 |
712 if( someMatches ) // check if there is some matches |
714 if( someMatches ) // check if there is some matches |
713 { |
715 { |
714 if( e.IsPending() ) |
716 if( e.IsPending() ) |
715 { |
717 { |
716 // match found. trigger notifier entry ! |
718 // match found. trigger notifier entry ! |
717 TRAPD( err, e.TriggerL( EObjectNotifyModify | ERelationNotifyModify /*| ERelationItemNotifyModify*/, |
719 TRAPD( err, e.TriggerL( EObjectNotifyModify | ERelationNotifyModify, |
718 matchingObjectIdArray ) ); |
720 matchingObjectIdArray ) ); |
719 if( err != KErrNone ) |
721 if( err != KErrNone ) |
720 { |
722 { |
721 e.TriggerError( err ); |
723 e.TriggerError( err ); |
722 } |
724 } |
723 } |
725 } |
724 else |
726 else |
725 { |
727 { |
726 TRAP_IGNORE( e.CacheL( EObjectNotifyModify | ERelationNotifyModify /*| ERelationItemNotifyModify*/, |
728 TRAP_IGNORE( e.CacheL( EObjectNotifyModify | ERelationNotifyModify, |
727 matchingObjectIdArray ) ); |
729 matchingObjectIdArray ) ); |
728 } |
730 } |
729 } |
731 } |
730 |
732 |
731 CleanupStack::PopAndDestroy( &matchingObjectIdArray ); |
733 CleanupStack::PopAndDestroy( &matchingObjectIdArray ); |
753 { |
755 { |
754 // collect matching object IDs |
756 // collect matching object IDs |
755 RArray<TItemId> matchingObjectIdArray; |
757 RArray<TItemId> matchingObjectIdArray; |
756 CleanupClosePushL( matchingObjectIdArray ); |
758 CleanupClosePushL( matchingObjectIdArray ); |
757 |
759 |
758 TBool allMatches = iComparator->MatchObjectIdsL( e.Condition(), |
760 const TBool allMatches = iComparator->MatchObjectIdsL( e.Condition(), |
759 aObjectIds, matchingObjectIdArray ); |
761 aObjectIds, matchingObjectIdArray ); |
760 |
762 |
761 // check is there any matches |
763 // check is there any matches |
762 if( allMatches || matchingObjectIdArray.Count() > 0 ) |
764 if( allMatches || matchingObjectIdArray.Count() > 0 ) |
763 { |
765 { |
764 if(e.IsPending()) |
766 if(e.IsPending()) |
765 { |
767 { |
766 // Match found. Trigger notifier entry. |
768 // Match found. Trigger notifier entry. |
767 TInt err; |
769 TInt err( KErrNone ); |
768 |
770 |
769 if( allMatches ) |
771 if( allMatches ) |
770 { |
772 { |
771 // all matches so send whole object ID array |
773 // all matches so send whole object ID array |
772 TRAP( err, e.TriggerL( EObjectNotifyModify, |
774 TRAP( err, e.TriggerL( EObjectNotifyModify, |
808 // NotifyRemoved |
810 // NotifyRemoved |
809 // ------------------------------------------------ |
811 // ------------------------------------------------ |
810 // |
812 // |
811 void CMdSNotifier::NotifyRemovedL(const RArray<TItemId>& aItemIdArray) |
813 void CMdSNotifier::NotifyRemovedL(const RArray<TItemId>& aItemIdArray) |
812 { |
814 { |
813 for( TInt i=0; i<iEntries.Count(); ++i ) |
815 const TInt entriesCount( iEntries.Count() ); |
|
816 for( TInt i=0; i<entriesCount; ++i ) |
814 { |
817 { |
815 TEntry& e = iEntries[i]; |
818 TEntry& e = iEntries[i]; |
816 |
819 |
817 if( e.iType & EObjectNotifyRemove ) |
820 if( e.iType & EObjectNotifyRemove ) |
818 { |
821 { |