20 #include "caclientnotifier.h" |
20 #include "caclientnotifier.h" |
21 #include "cainnernotifierfilter.h" |
21 #include "cainnernotifierfilter.h" |
22 #include "casrvdef.h" |
22 #include "casrvdef.h" |
23 #include "cainnerentry.h" |
23 #include "cainnerentry.h" |
24 #include "caclientproxy.h" |
24 #include "caclientproxy.h" |
25 #include "caclientnotifierproxy.h" |
25 #include "caobserver.h" |
26 #include "cautils.h" |
26 #include "cautils.h" |
27 |
27 |
28 // ----------------------------------------------------------------------------- |
28 // ----------------------------------------------------------------------------- |
29 // |
29 // |
30 // ----------------------------------------------------------------------------- |
30 // ----------------------------------------------------------------------------- |
32 const RCaClientNotifierSession* aSession, |
32 const RCaClientNotifierSession* aSession, |
33 const IDataObserver* aObserver, |
33 const IDataObserver* aObserver, |
34 const CCaInnerNotifierFilter *aInnerNotifierFilter ) : |
34 const CCaInnerNotifierFilter *aInnerNotifierFilter ) : |
35 RSubSessionBase(), iSession( aSession ), iObserver( aObserver ), |
35 RSubSessionBase(), iSession( aSession ), iObserver( aObserver ), |
36 iInnerNotifierFilter( aInnerNotifierFilter ), |
36 iInnerNotifierFilter( aInnerNotifierFilter ), |
37 iNotifier( NULL ), iMessageSize( NULL ) |
37 iNotifier( NULL ), iMessageSize( NULL ), iChangedEntry( NULL ), |
|
38 iChangedEntryType( EAddChangeType ) |
38 { |
39 { |
39 |
40 |
40 } |
41 } |
41 |
42 |
42 // ----------------------------------------------------------------------------- |
43 // ----------------------------------------------------------------------------- |
43 // |
44 // |
44 // ----------------------------------------------------------------------------- |
45 // ----------------------------------------------------------------------------- |
45 void RCaClientSubSession::CreateL() |
46 void RCaClientSubSession::CreateL() |
46 { |
47 { |
|
48 if( iNotifier ) |
|
49 { |
|
50 delete iNotifier; |
|
51 iNotifier = NULL; |
|
52 } |
|
53 if( iMessageSize ) |
|
54 { |
|
55 delete iMessageSize; |
|
56 iMessageSize = NULL; |
|
57 } |
47 iMessageSize = new ( ELeave ) TPckgBuf<TInt> (); |
58 iMessageSize = new ( ELeave ) TPckgBuf<TInt> (); |
48 User::LeaveIfError( CreateSubSession( *iSession, |
59 User::LeaveIfError( CreateSubSession( *iSession, |
49 static_cast<TInt>( EContentArsenalNotifierOpen ) ) ); |
60 static_cast<TInt>( EContentArsenalNotifierOpen ) ) ); |
50 iNotifier = CCaClientNotifier::NewL( this ); |
61 iNotifier = CCaClientNotifier::NewL( this ); |
|
62 iChangedEntry = CCaInnerEntry::NewL(); |
51 } |
63 } |
52 |
64 |
53 // ----------------------------------------------------------------------------- |
65 // ----------------------------------------------------------------------------- |
54 // |
66 // |
55 // ----------------------------------------------------------------------------- |
67 // ----------------------------------------------------------------------------- |
56 void RCaClientSubSession::Close() |
68 void RCaClientSubSession::Close() |
57 { |
69 { |
|
70 delete iChangedEntry; |
|
71 iChangedEntry = NULL; |
58 delete iMessageSize; |
72 delete iMessageSize; |
59 iMessageSize = NULL; |
73 iMessageSize = NULL; |
60 delete iNotifier; |
74 delete iNotifier; |
61 iNotifier = NULL; |
75 iNotifier = NULL; |
62 CloseSubSession( EContentArsenalNotifierClose ); |
76 CloseSubSession( EContentArsenalNotifierClose ); |
86 } |
100 } |
87 |
101 |
88 // ----------------------------------------------------------------------------- |
102 // ----------------------------------------------------------------------------- |
89 // |
103 // |
90 // ----------------------------------------------------------------------------- |
104 // ----------------------------------------------------------------------------- |
91 void RCaClientSubSession::NotifyObserver( |
105 void RCaClientSubSession::NotifyObserver() const |
92 CCaInnerEntry* aEntry, |
|
93 TChangeType aChangeType ) const |
|
94 { |
106 { |
95 switch( iInnerNotifierFilter->GetNotifierType() ) |
107 switch( iInnerNotifierFilter->GetNotifierType() ) |
96 { |
108 { |
97 case CCaInnerNotifierFilter::EEntryChangedWithId: |
109 case CCaInnerNotifierFilter::EEntryChangedWithId: |
98 { |
110 { |
99 iObserver->entryChanged( aEntry->GetId(), aChangeType ); |
111 iObserver->entryChanged( iChangedEntry->GetId(), iChangedEntryType ); |
100 break; |
112 break; |
101 } |
113 } |
102 case CCaInnerNotifierFilter::EEntryChangedWithEntry: |
114 case CCaInnerNotifierFilter::EEntryChangedWithEntry: |
103 { |
115 { |
104 iObserver->entryChanged( *aEntry, aChangeType ); |
116 iObserver->entryChanged( *iChangedEntry, iChangedEntryType ); |
105 break; |
117 break; |
106 } |
118 } |
107 case CCaInnerNotifierFilter::EEntryTouched: |
119 case CCaInnerNotifierFilter::EEntryTouched: |
108 { |
120 { |
109 iObserver->entryTouched( aEntry->GetId() ); |
121 iObserver->entryTouched( iChangedEntry->GetId() ); |
110 break; |
122 break; |
111 } |
123 } |
112 case CCaInnerNotifierFilter::EGroupContentChanged: |
124 case CCaInnerNotifierFilter::EGroupContentChanged: |
113 { |
125 { |
114 iObserver->groupContentChanged( aEntry->GetId() ); |
126 iObserver->groupContentChanged( iChangedEntry->GetId() ); |
115 break; |
127 break; |
116 } |
128 } |
117 default: |
129 default: |
118 { |
130 { |
119 break; |
131 break; |
122 } |
134 } |
123 |
135 |
124 // ----------------------------------------------------------------------------- |
136 // ----------------------------------------------------------------------------- |
125 // |
137 // |
126 // ----------------------------------------------------------------------------- |
138 // ----------------------------------------------------------------------------- |
127 void RCaClientSubSession::GetChangeInfoAndNotifyObserverL() const |
139 void RCaClientSubSession::GetChangeInfoL() const |
128 { |
140 { |
129 TIpcArgs args; |
141 TIpcArgs args; |
130 RBuf8 outbuf; |
142 RBuf8 outbuf; |
131 outbuf.CleanupClosePushL(); |
143 outbuf.CleanupClosePushL(); |
132 outbuf.CreateL( ( *iMessageSize )() ); |
144 outbuf.CreateL( ( *iMessageSize )() ); |
135 args.Set( KInputPosition2, &changeTypePckg ); |
147 args.Set( KInputPosition2, &changeTypePckg ); |
136 TInt error = RSubSessionBase::SendReceive( |
148 TInt error = RSubSessionBase::SendReceive( |
137 EContentArsenalGetChangeInfo, args ); |
149 EContentArsenalGetChangeInfo, args ); |
138 if( error == KErrNone ) |
150 if( error == KErrNone ) |
139 { |
151 { |
140 CCaInnerEntry* entry = CCaInnerEntry::NewLC(); |
|
141 RDesReadStream stream( outbuf ); |
152 RDesReadStream stream( outbuf ); |
142 CleanupClosePushL( stream ); |
153 CleanupClosePushL( stream ); |
143 entry->InternalizeL( stream ); |
154 iChangedEntry->InternalizeL( stream ); |
144 CleanupStack::PopAndDestroy( &stream ); |
155 CleanupStack::PopAndDestroy( &stream ); |
145 TChangeType changeType = changeTypePckg(); |
156 iChangedEntryType = changeTypePckg(); |
146 NotifyObserver( entry, changeType ); |
|
147 CleanupStack::PopAndDestroy( entry ); |
|
148 } |
157 } |
149 CleanupStack::PopAndDestroy( &outbuf ); |
158 CleanupStack::PopAndDestroy( &outbuf ); |
150 } |
159 } |