equal
deleted
inserted
replaced
44 // Constructor. |
44 // Constructor. |
45 // ---------------------------------------------------------------------------- |
45 // ---------------------------------------------------------------------------- |
46 // |
46 // |
47 CMPXClientList::CMPXClientList(MMPXClientlistObserver* aObserver) |
47 CMPXClientList::CMPXClientList(MMPXClientlistObserver* aObserver) |
48 : iIdentity(CMPXClientList::ClientsMatch), |
48 : iIdentity(CMPXClientList::ClientsMatch), |
49 iObserver(aObserver) |
49 iObserver(aObserver), |
|
50 iPrimaryClient(NULL) |
50 {} |
51 {} |
51 |
52 |
52 // ---------------------------------------------------------------------------- |
53 // ---------------------------------------------------------------------------- |
53 // 2nd phase constructor. |
54 // 2nd phase constructor. |
54 // ---------------------------------------------------------------------------- |
55 // ---------------------------------------------------------------------------- |
153 // USER panic 130, if aIndex is negative or is greater than the number of |
154 // USER panic 130, if aIndex is negative or is greater than the number of |
154 // objects currently in the array. |
155 // objects currently in the array. |
155 CClientId* id( iClients[aIndex] ); |
156 CClientId* id( iClients[aIndex] ); |
156 iClients.Remove(aIndex); |
157 iClients.Remove(aIndex); |
157 |
158 |
158 CClientId removeId( id->iPid ); |
159 //set primary client to NULL if primary client is removed |
|
160 if (iPrimaryClient != NULL) |
|
161 { |
|
162 if (aIndex == Find(*iPrimaryClient)) |
|
163 { |
|
164 iPrimaryClient = NULL; |
|
165 } |
|
166 } |
|
167 CClientId removeId( id->iPid ); |
159 if ( iClients.Find( &removeId, iIdentity ) == KErrNotFound ) |
168 if ( iClients.Find( &removeId, iIdentity ) == KErrNotFound ) |
160 // |
169 // |
161 // There's no other client from the same process, so |
170 // There's no other client from the same process, so |
162 // remove it from the process list |
171 // remove it from the process list |
163 // |
172 // |
599 void CMPXClientList::CClientId::RemoveAllSubscriptionsL() |
608 void CMPXClientList::CClientId::RemoveAllSubscriptionsL() |
600 { |
609 { |
601 iSubscriptions.ResetAndDestroy(); |
610 iSubscriptions.ResetAndDestroy(); |
602 } |
611 } |
603 |
612 |
|
613 // ----------------------------------------------------------------------------- |
|
614 // CMPClientList::SetPrimaryClient |
|
615 // Set the primary client |
|
616 // ----------------------------------------------------------------------------- |
|
617 // |
|
618 EXPORT_C TInt CMPXClientList::SetPrimaryClient(CMPXMessageQueue& aMsgQueue) |
|
619 { |
|
620 MPX_FUNC("CMPXClientList::SetPrimaryClient"); |
|
621 TInt index = Find(aMsgQueue); |
|
622 MPX_DEBUG2("CMPXClientList::SetPrimaryClient, index = %d", index); |
|
623 if (index >= 0) |
|
624 { |
|
625 iPrimaryClient = &aMsgQueue; |
|
626 return KErrNone; |
|
627 } |
|
628 return index; |
|
629 } |
|
630 // ----------------------------------------------------------------------------- |
|
631 // CMPClientList::SendSyncMsg |
|
632 // Send a sync message to the primary client |
|
633 // ----------------------------------------------------------------------------- |
|
634 // |
|
635 EXPORT_C TInt CMPXClientList::SendSyncMsg(const CMPXMessage* aMsg) |
|
636 { |
|
637 MPX_FUNC("CMPXClientList::SendSyncMsg"); |
|
638 TInt err = KErrNone; |
|
639 if (iPrimaryClient == NULL) |
|
640 { |
|
641 return KErrNotFound; |
|
642 } |
|
643 TInt index = Find(*iPrimaryClient); |
|
644 MPX_DEBUG2("CMPXClientList::SendSyncMsg, index = %d", index); |
|
645 if (index >= 0) |
|
646 { |
|
647 err = iClients[index]->iMsgQueue->AddFirst(aMsg, KErrNone); |
|
648 } |
|
649 else |
|
650 { |
|
651 err = KErrNotFound; |
|
652 } |
|
653 return err; |
|
654 } |
604 // End of File |
655 // End of File |