22 #include "PushViewMessageOp.h" |
22 #include "PushViewMessageOp.h" |
23 #include "PushMtmUiDef.h" |
23 #include "PushMtmUiDef.h" |
24 #include "PushMtmUiPanic.h" |
24 #include "PushMtmUiPanic.h" |
25 #include "PushMtmLog.h" |
25 #include "PushMtmLog.h" |
26 #include "PushMtmUtil.h" |
26 #include "PushMtmUtil.h" |
27 #include <CSIPushMsgEntry.h> |
27 #include <push/CSIPushMsgEntry.h> |
28 #include <eikenv.h> |
28 #include <eikenv.h> |
29 #include <aknappui.h> |
29 #include <aknappui.h> |
30 #include <uikon.hrh> |
30 #include <uikon.hrh> |
31 #include <apmstd.h> |
31 #include <apmstd.h> |
32 #include <DocumentHandler.h> |
32 #include <DocumentHandler.h> |
43 |
43 |
44 // --------------------------------------------------------- |
44 // --------------------------------------------------------- |
45 // CPushLoadServiceOp::NewL |
45 // CPushLoadServiceOp::NewL |
46 // --------------------------------------------------------- |
46 // --------------------------------------------------------- |
47 // |
47 // |
48 CPushViewMessageOp* CPushViewMessageOp::NewL( CMsvSession& aSession, |
48 CPushViewMessageOp* CPushViewMessageOp::NewL( CMsvSession& aSession, |
49 TMsvId aEntryId, |
49 TMsvId aEntryId, |
50 TRequestStatus& aObserverStatus ) |
50 TRequestStatus& aObserverStatus ) |
51 { |
51 { |
52 PUSHLOG_ENTERFN("CPushViewMessageOp::NewL") |
52 PUSHLOG_ENTERFN("CPushViewMessageOp::NewL") |
53 |
53 |
54 CPushViewMessageOp* self = |
54 CPushViewMessageOp* self = |
55 new (ELeave) CPushViewMessageOp( aSession, aEntryId, aObserverStatus ); |
55 new (ELeave) CPushViewMessageOp( aSession, aEntryId, aObserverStatus ); |
56 CleanupStack::PushL( self ); |
56 CleanupStack::PushL( self ); |
57 self->ConstructL(); |
57 self->ConstructL(); |
58 CleanupStack::Pop( self ); |
58 CleanupStack::Pop( self ); |
59 |
59 |
93 |
93 |
94 // --------------------------------------------------------- |
94 // --------------------------------------------------------- |
95 // CPushViewMessageOp::CPushViewMessageOp |
95 // CPushViewMessageOp::CPushViewMessageOp |
96 // --------------------------------------------------------- |
96 // --------------------------------------------------------- |
97 // |
97 // |
98 CPushViewMessageOp::CPushViewMessageOp( CMsvSession& aSession, |
98 CPushViewMessageOp::CPushViewMessageOp( CMsvSession& aSession, |
99 TMsvId aEntryId, |
99 TMsvId aEntryId, |
100 TRequestStatus& aObserverStatus ) |
100 TRequestStatus& aObserverStatus ) |
101 : CPushMtmUiOperation( aSession, aEntryId, aObserverStatus ), |
101 : CPushMtmUiOperation( aSession, aEntryId, aObserverStatus ), |
102 iIsCancelled( EFalse ) |
102 iIsCancelled( EFalse ) |
103 { |
103 { |
104 PUSHLOG_WRITE("CPushViewMessageOp constructing") |
104 PUSHLOG_WRITE("CPushViewMessageOp constructing") |
105 } |
105 } |
106 |
106 |
107 // --------------------------------------------------------- |
107 // --------------------------------------------------------- |
108 // CPushViewMessageOp::ConstructL |
108 // CPushViewMessageOp::ConstructL |
109 // --------------------------------------------------------- |
109 // --------------------------------------------------------- |
110 // |
110 // |
111 void CPushViewMessageOp::ConstructL() |
111 void CPushViewMessageOp::ConstructL() |
112 { |
112 { |
113 CPushMtmUiOperation::ConstructL(); |
113 CPushMtmUiOperation::ConstructL(); |
114 } |
114 } |
115 |
115 |
116 // --------------------------------------------------------- |
116 // --------------------------------------------------------- |
137 // Lauch the content handler. |
137 // Lauch the content handler. |
138 TMsvEntry tEntry; |
138 TMsvEntry tEntry; |
139 TMsvId service; |
139 TMsvId service; |
140 User::LeaveIfError( iMsvSession.GetEntry( iEntryId, service, tEntry ) ); |
140 User::LeaveIfError( iMsvSession.GetEntry( iEntryId, service, tEntry ) ); |
141 |
141 |
142 __ASSERT_ALWAYS( tEntry.iMtm == KUidMtmWapPush, |
142 __ASSERT_ALWAYS( tEntry.iMtm == KUidMtmWapPush, |
143 UiPanic( EPushMtmUiPanBadMtm ) ); |
143 UiPanic( EPushMtmUiPanBadMtm ) ); |
144 |
144 |
145 CSIPushMsgEntry* si = NULL; |
145 CSIPushMsgEntry* si = NULL; |
146 const TInt32 bioType( tEntry.iBioType ); |
146 const TInt32 bioType( tEntry.iBioType ); |
147 |
147 |
169 HBufC8* text8 = HBufC8::NewMaxLC( text.Length() ); |
169 HBufC8* text8 = HBufC8::NewMaxLC( text.Length() ); |
170 text8->Des().Copy( text ); |
170 text8->Des().Copy( text ); |
171 TDataType dataType( KTextPlainString ); |
171 TDataType dataType( KTextPlainString ); |
172 |
172 |
173 CAiwGenericParamList& paramList = iDocHandler->InParamListL(); |
173 CAiwGenericParamList& paramList = iDocHandler->InParamListL(); |
174 RFile tempFile; |
174 RFile tempFile; |
175 iDocHandler->SaveTempFileL |
175 iDocHandler->SaveTempFileL |
176 ( *text8, dataType, KNullDesC, tempFile ); |
176 ( *text8, dataType, KNullDesC, tempFile ); |
177 PUSHLOG_WRITE(" SaveTempFileL OK"); |
177 PUSHLOG_WRITE(" SaveTempFileL OK"); |
178 CleanupClosePushL( tempFile ); |
178 CleanupClosePushL( tempFile ); |
179 iDocHandler->OpenFileEmbeddedL( tempFile, dataType, paramList ); |
179 iDocHandler->OpenFileEmbeddedL( tempFile, dataType, paramList ); |
183 |
183 |
184 CleanupStack::PopAndDestroy( 2, si ); // text8, si |
184 CleanupStack::PopAndDestroy( 2, si ); // text8, si |
185 PUSHLOG_WRITE(" PopAndDestroy( 2, si ) OK"); |
185 PUSHLOG_WRITE(" PopAndDestroy( 2, si ) OK"); |
186 |
186 |
187 // Signal the observer when the viewer is terminated. |
187 // Signal the observer when the viewer is terminated. |
188 // Until then we are observeing the message |
188 // Until then we are observeing the message |
189 // (delete & replacement notification). |
189 // (delete & replacement notification). |
190 //ObserveEntryEventL(); // (2) |
190 //ObserveEntryEventL(); // (2) |
191 // Now we are observing two things: the viewer (1) and the entry (2). |
191 // Now we are observing two things: the viewer (1) and the entry (2). |
192 |
192 |
193 iStatus = KRequestPending; |
193 iStatus = KRequestPending; |
206 PUSHLOG_ENTERFN("CPushViewMessageOp::DoCancel"); |
206 PUSHLOG_ENTERFN("CPushViewMessageOp::DoCancel"); |
207 |
207 |
208 iIsCancelled = ETrue; |
208 iIsCancelled = ETrue; |
209 |
209 |
210 CancelObserveEntryEvent(); |
210 CancelObserveEntryEvent(); |
211 // If there is DocHandler, then it means that we are active and |
211 // If there is DocHandler, then it means that we are active and |
212 // waiting for NotifyExit to be called. |
212 // waiting for NotifyExit to be called. |
213 if ( iDocHandler ) |
213 if ( iDocHandler ) |
214 { |
214 { |
215 // Terminate the embedded viewer. TODO |
215 // Terminate the embedded viewer. TODO |
216 // Complete us. |
216 // Complete us. |
241 |
241 |
242 // --------------------------------------------------------- |
242 // --------------------------------------------------------- |
243 // CPushViewMessageOp::HandleEntryEventL |
243 // CPushViewMessageOp::HandleEntryEventL |
244 // --------------------------------------------------------- |
244 // --------------------------------------------------------- |
245 // |
245 // |
246 void CPushViewMessageOp::HandleEntryEventL( TMsvEntryEvent aEvent, |
246 void CPushViewMessageOp::HandleEntryEventL( TMsvEntryEvent aEvent, |
247 TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/ ) |
247 TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/ ) |
248 { |
248 { |
249 PUSHLOG_ENTERFN("CPushViewMessageOp::HandleEntryEventL"); |
249 PUSHLOG_ENTERFN("CPushViewMessageOp::HandleEntryEventL"); |
250 |
250 |
251 if ( aEvent == EMsvEntryChanged ) |
251 if ( aEvent == EMsvEntryChanged ) |
252 { |
252 { |
253 PUSHLOG_WRITE(" Changed"); |
253 PUSHLOG_WRITE(" Changed"); |
254 // We don't have to bother with such case that the |
254 // We don't have to bother with such case that the |
255 // content changes, but the entry is saved as 'read' in |
255 // content changes, but the entry is saved as 'read' in |
256 // this case, because this operation handles only SI messages. |
256 // this case, because this operation handles only SI messages. |
257 //TODO NotifyAndCancelL( R_PUSHMISC_INFO_REPLACED ); |
257 //TODO NotifyAndCancelL( R_PUSHMISC_INFO_REPLACED ); |
258 } |
258 } |
259 else if ( aEvent == EMsvEntryDeleted ) |
259 else if ( aEvent == EMsvEntryDeleted ) |
260 { |
260 { |
278 PUSHLOG_ENTERFN("CPushViewMessageOp::NotifyAndCancelL"); |
278 PUSHLOG_ENTERFN("CPushViewMessageOp::NotifyAndCancelL"); |
279 |
279 |
280 // Add resource file. |
280 // Add resource file. |
281 TParse* fileParser = new (ELeave) TParse; |
281 TParse* fileParser = new (ELeave) TParse; |
282 CleanupStack::PushL( fileParser ); |
282 CleanupStack::PushL( fileParser ); |
283 fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); |
283 fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); |
284 AssureResourceL( fileParser->FullName() ); |
284 AssureResourceL( fileParser->FullName() ); |
285 CleanupStack::PopAndDestroy( fileParser ); // fileParser |
285 CleanupStack::PopAndDestroy( fileParser ); // fileParser |
286 fileParser = NULL; |
286 fileParser = NULL; |
287 |
287 |
288 // Show note about the message deletion. |
288 // Show note about the message deletion. |