|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Application Ui member definitions. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include "PushViewerMsgEdAppUi.h" |
|
23 #include "PushViewerDoc.h" |
|
24 #include "PushViewerDef.h" |
|
25 #include "PushViewerPanic.h" |
|
26 #include "PushMtmUtil.h" |
|
27 #include "PushViewer.hrh" |
|
28 #include "PushMtmLog.h" |
|
29 #include <push/CSIPushMsgEntry.h> |
|
30 #include <push/CSLPushMsgEntry.h> |
|
31 #include <PushViewer.rsg> |
|
32 #include <aknmessagequerydialog.h> |
|
33 #include <AknQueryDialog.h> |
|
34 #include <MsgEditorView.h> |
|
35 #include <MsgBodyControl.h> |
|
36 #include <txtrich.h> |
|
37 #include <txtfrmat.h> |
|
38 #include <txtfmlyr.h> |
|
39 #include <gdi.h> |
|
40 #include <bldvariant.hrh> |
|
41 #include <eikrted.h> |
|
42 #include <barsread.h> |
|
43 #include <AknNoteWrappers.h> |
|
44 #ifdef __SERIES60_HELP |
|
45 // Context-Sensitve Help File |
|
46 #include <hlplch.h> |
|
47 #include <csxhelp/wpush.hlp.hrh> |
|
48 #endif // __SERIES60_HELP |
|
49 |
|
50 #include "eikon.hrh" |
|
51 |
|
52 // ================= MEMBER FUNCTIONS ======================= |
|
53 |
|
54 // --------------------------------------------------------- |
|
55 // CPushViewerMsgEdAppUi::CPushViewerMsgEdAppUi |
|
56 // --------------------------------------------------------- |
|
57 // |
|
58 CPushViewerMsgEdAppUi::CPushViewerMsgEdAppUi() |
|
59 { |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------- |
|
63 // CPushViewerMsgEdAppUi::~CPushViewerMsgEdAppUi |
|
64 // --------------------------------------------------------- |
|
65 // |
|
66 CPushViewerMsgEdAppUi::~CPushViewerMsgEdAppUi() |
|
67 { |
|
68 PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::~CPushViewerMsgEdAppUi") |
|
69 delete iView; |
|
70 iView = NULL; |
|
71 delete iContext; |
|
72 iContext = NULL; |
|
73 PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::~CPushViewerMsgEdAppUi") |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------- |
|
77 // CPushViewerMsgEdAppUi::ConstructL |
|
78 // --------------------------------------------------------- |
|
79 // |
|
80 void CPushViewerMsgEdAppUi::ConstructL() |
|
81 { |
|
82 PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::ConstructL") |
|
83 |
|
84 CMsgEditorAppUi::ConstructL(); |
|
85 |
|
86 if ( !iEikonEnv->StartedAsServerApp( ) ) |
|
87 { |
|
88 // If the app was not started as server app, |
|
89 // we can call PrepareLaunchL |
|
90 Document()->PrepareToLaunchL( this ); |
|
91 } |
|
92 |
|
93 PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::ConstructL") |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------- |
|
97 // CPushViewerMsgEdAppUi::ConstructBodyTextL |
|
98 // --------------------------------------------------------- |
|
99 // |
|
100 TInt CPushViewerMsgEdAppUi::ConstructBodyTextL |
|
101 ( CMsgBodyControl& aBodyControl1, CMsgBodyControl& aBodyControl2 ) const |
|
102 { |
|
103 PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::ConstructBodyTextL"); |
|
104 |
|
105 HBufC* staticText = iEikonEnv->AllocReadResourceLC |
|
106 ( R_PUSHVIEWER_MAINPANE_TEXT ); |
|
107 |
|
108 TPtrC renderedTextPtr( *staticText ); // Static text by default. |
|
109 TPtrC renderedHrefPtr( KNullDesC ); |
|
110 |
|
111 if ( Model().PushMsgType() == KUidWapPushMsgSI.iUid ) |
|
112 { |
|
113 CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, &Model() ); |
|
114 |
|
115 const TPtrC text = si->Text(); |
|
116 if ( text.Length() ) |
|
117 { |
|
118 renderedTextPtr.Set( text ); |
|
119 } |
|
120 else |
|
121 { |
|
122 renderedTextPtr.Set( *staticText ); |
|
123 } |
|
124 |
|
125 const TPtrC url = si->Url(); |
|
126 if ( url.Length() ) |
|
127 { |
|
128 renderedHrefPtr.Set( url ); |
|
129 } |
|
130 } |
|
131 else if ( Model().PushMsgType() == KUidWapPushMsgSL.iUid ) |
|
132 { |
|
133 CSLPushMsgEntry* sl = STATIC_CAST( CSLPushMsgEntry*, &Model() ); |
|
134 |
|
135 const TPtrC url = sl->Url(); |
|
136 if ( url.Length() ) |
|
137 { |
|
138 renderedHrefPtr.Set( url ); |
|
139 } |
|
140 } |
|
141 else |
|
142 { |
|
143 User::Leave( KErrNotSupported ); |
|
144 } |
|
145 |
|
146 // The message goes to the first body control by default, but |
|
147 // if it does not fit into one screen, then first comes the href. |
|
148 |
|
149 aBodyControl1.InsertTextL( renderedTextPtr ); |
|
150 |
|
151 CMsgBodyControl* controlContainingTheUrl = NULL; |
|
152 TInt indexOfHrefControl = KErrNotFound; |
|
153 |
|
154 // Add the href |
|
155 if ( renderedHrefPtr.Length() == 0 ) |
|
156 { |
|
157 // No href. |
|
158 controlContainingTheUrl = NULL; |
|
159 iAvkonAppUi->Cba()->SetCommandSetL( R_PUSHVIEWER_SOFTKEYS ); |
|
160 iAvkonAppUi->Cba()->DrawNow(); |
|
161 } |
|
162 else |
|
163 { |
|
164 aBodyControl2.InsertTextL( renderedHrefPtr ); |
|
165 controlContainingTheUrl = &aBodyControl2; |
|
166 indexOfHrefControl = 1; // Zero based. |
|
167 } |
|
168 |
|
169 aBodyControl1.SetPlainTextMode( ETrue ); |
|
170 aBodyControl2.SetPlainTextMode( ETrue ); |
|
171 |
|
172 // Switch on URL highlighting. We use FindItem for it - |
|
173 // otherwise Find Item has no other role! |
|
174 if ( controlContainingTheUrl != NULL ) |
|
175 { |
|
176 if ( controlContainingTheUrl->ItemFinder() ) |
|
177 { |
|
178 controlContainingTheUrl-> |
|
179 ItemFinder()->SetFindModeL( CItemFinder::EUrlAddress ); |
|
180 controlContainingTheUrl-> |
|
181 SetupAutomaticFindAfterFocusChangeL( ETrue ); |
|
182 } |
|
183 controlContainingTheUrl->Editor().SetAlignment( EAknEditorAlignCenter ); |
|
184 } |
|
185 |
|
186 CleanupStack::PopAndDestroy( staticText ); // staticText |
|
187 |
|
188 PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::ConstructBodyTextL"); |
|
189 return indexOfHrefControl; |
|
190 } |
|
191 |
|
192 // --------------------------------------------------------- |
|
193 // CPushViewerMsgEdAppUi::ConstructViewL |
|
194 // --------------------------------------------------------- |
|
195 // |
|
196 void CPushViewerMsgEdAppUi::ConstructViewL() |
|
197 { |
|
198 CMsgEditorView* newView = CMsgEditorView::NewL |
|
199 ( *this, CMsgEditorView::EMsgReadOnly ); |
|
200 delete iView; |
|
201 iView = newView; |
|
202 |
|
203 // Let two body controls: one for the message text and one for the Href |
|
204 |
|
205 // There is already one by default - get a pointer to it. |
|
206 CMsgBodyControl* bodyControl1 = REINTERPRET_CAST( CMsgBodyControl*, |
|
207 iView->ControlById( EMsgComponentIdBody ) ); |
|
208 |
|
209 // Create the second: |
|
210 CMsgBodyControl* bodyControl2 = CMsgBodyControl::NewL( iView ); |
|
211 CleanupStack::PushL( bodyControl2 ); |
|
212 iView->AddControlL( bodyControl2, |
|
213 /*aControlId*/EMyMsgComponentIdBody, |
|
214 /*aIndex*/1, |
|
215 /*aFormComponent*/EMsgBody ); |
|
216 CleanupStack::Pop( bodyControl2 ); // bodyControl2 |
|
217 |
|
218 TInt indexOfHrefControl = ConstructBodyTextL( *bodyControl1, *bodyControl2 ); |
|
219 |
|
220 // Construct the view. |
|
221 TInt controlIdForFocus = indexOfHrefControl==1?EMyMsgComponentIdBody:EMsgComponentIdBody; |
|
222 iView->ExecuteL( ClientRect(), controlIdForFocus ); |
|
223 } |
|
224 |
|
225 // --------------------------------------------------------- |
|
226 // CPushViewerMsgEdAppUi::HandleKeyEventL |
|
227 // --------------------------------------------------------- |
|
228 // |
|
229 TKeyResponse CPushViewerMsgEdAppUi::HandleKeyEventL |
|
230 ( const TKeyEvent& aKeyEvent, |
|
231 TEventCode aType ) |
|
232 { |
|
233 PUSHLOG_WRITE_FORMAT |
|
234 ("CPushViewerMsgEdAppUi::HandleKeyEventL <%d>",aKeyEvent.iCode) |
|
235 // Check for iView and iContext objects are created before Handle |
|
236 if ( (NULL == iView) || (NULL == iContext) ) |
|
237 { |
|
238 return (EKeyWasConsumed); |
|
239 } |
|
240 |
|
241 if ( aType == EEventKey ) |
|
242 { |
|
243 switch ( aKeyEvent.iCode ) |
|
244 { |
|
245 |
|
246 case EKeyDevice3: |
|
247 { |
|
248 // Selection key pressed. Behave as "Load service" if there is |
|
249 // service to download. |
|
250 const TMsvEntry& context = Model().Entry(); |
|
251 if ( CPushMtmUtil::Attrs( context ) & EPushMtmAttrHasHref ) |
|
252 { |
|
253 HandleCommandL( EPushViewerCmdLoadService ); |
|
254 } |
|
255 break; |
|
256 } |
|
257 |
|
258 case EKeyLeftUpArrow: // Northwest |
|
259 case EStdKeyDevice10: // : Extra KeyEvent supports diagonal event simulator wedge |
|
260 case EKeyLeftArrow: // West |
|
261 case EKeyLeftDownArrow: // Southwest |
|
262 case EStdKeyDevice13: // : Extra KeyEvent supports diagonal event simulator wedge |
|
263 { |
|
264 HandleCommandL( EPushViewerCmdPreviousMessage ); |
|
265 break; |
|
266 } |
|
267 |
|
268 case EKeyRightUpArrow: // Northeast |
|
269 case EStdKeyDevice11: // : Extra KeyEvent supports diagonal event simulator wedge |
|
270 case EKeyRightArrow: // East |
|
271 case EKeyRightDownArrow: // Southeast |
|
272 case EStdKeyDevice12: // : Extra KeyEvent supports diagonal event simulator wedge |
|
273 { |
|
274 HandleCommandL( EPushViewerCmdNextMessage ); |
|
275 break; |
|
276 } |
|
277 |
|
278 case EKeyBackspace : |
|
279 { |
|
280 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
281 if ( dlg->ExecuteLD |
|
282 ( R_PUSHVIEWER_ENTRY_DELETE_CONFIRM ) == EAknSoftkeyYes ) |
|
283 { |
|
284 DeleteAndExitL(); |
|
285 } |
|
286 break; |
|
287 } |
|
288 |
|
289 default: |
|
290 { |
|
291 iView->OfferKeyEventL( aKeyEvent, aType ); |
|
292 break; |
|
293 } |
|
294 |
|
295 } |
|
296 } |
|
297 |
|
298 return EKeyWasConsumed; |
|
299 } |
|
300 |
|
301 // --------------------------------------------------------- |
|
302 // CPushViewerMsgEdAppUi::DynInitMenuPaneL |
|
303 // --------------------------------------------------------- |
|
304 // |
|
305 void CPushViewerMsgEdAppUi::DynInitMenuPaneL( TInt aMenuId, |
|
306 CEikMenuPane* aMenuPane ) |
|
307 { |
|
308 if ( aMenuId == R_PUSHVIEWER_OPTIONS_MENU_PANE ) |
|
309 { |
|
310 // Remove EPushViewerCmdLoadService if the current message |
|
311 // does not contain URL. |
|
312 CPushMsgEntryBase& modelBase = Model(); |
|
313 if ( Model().PushMsgType() == KUidWapPushMsgSI.iUid ) |
|
314 { |
|
315 CSIPushMsgEntry& si = (CSIPushMsgEntry&)modelBase; |
|
316 if ( !si.Url().Length() ) |
|
317 { |
|
318 aMenuPane->DeleteMenuItem( EPushViewerCmdLoadService ); |
|
319 Cba()->SetCommandSetL( R_PUSHVIEWER_SOFTKEYS ); |
|
320 } |
|
321 } |
|
322 else if ( Model().PushMsgType() == KUidWapPushMsgSL.iUid ) |
|
323 { |
|
324 CSLPushMsgEntry& sl = (CSLPushMsgEntry&)modelBase; |
|
325 __ASSERT_DEBUG( sl.Url().Length() != 0, |
|
326 ViewerPanic( EPushViewerPanSlEmptyHref ) ); |
|
327 if ( !sl.Url().Length() ) |
|
328 { |
|
329 aMenuPane->DeleteMenuItem( EPushViewerCmdLoadService ); |
|
330 Cba()->SetCommandSetL( R_PUSHVIEWER_SOFTKEYS ); |
|
331 } |
|
332 } |
|
333 } |
|
334 } |
|
335 |
|
336 // --------------------------------------------------------- |
|
337 // CPushViewerMsgEdAppUi::Model |
|
338 // --------------------------------------------------------- |
|
339 // |
|
340 CPushMsgEntryBase& CPushViewerMsgEdAppUi::Model() const |
|
341 { |
|
342 PUSHLOG_WRITE_FORMAT("CPushViewerMsgEdAppUi::Model <%x>",iContext) |
|
343 return *iContext; |
|
344 } |
|
345 |
|
346 // --------------------------------------------------------- |
|
347 // CPushViewerMsgEdAppUi::PushDoc |
|
348 // --------------------------------------------------------- |
|
349 // |
|
350 CPushViewerDocument& CPushViewerMsgEdAppUi::PushDoc() const |
|
351 { |
|
352 PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::PushDoc") |
|
353 return REINTERPRET_CAST( CPushViewerDocument&, *Document() ); |
|
354 PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::PushDoc") |
|
355 } |
|
356 |
|
357 // --------------------------------------------------------- |
|
358 // CPushViewerMsgEdAppUi::UpdateNaviPaneL |
|
359 // --------------------------------------------------------- |
|
360 // |
|
361 void CPushViewerMsgEdAppUi::UpdateNaviPaneL() |
|
362 { |
|
363 PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::UpdateNaviPaneL") |
|
364 |
|
365 CEikImage* image = new (ELeave) CEikImage; |
|
366 CleanupStack::PushL( image ); |
|
367 |
|
368 // Read image from resource. |
|
369 // |
|
370 TResourceReader reader; |
|
371 iCoeEnv->CreateResourceReaderLC( reader, R_PUSHVIEWER_NAVI_IMAGE ); |
|
372 image->ConstructFromResourceL( reader ); |
|
373 CleanupStack::PopAndDestroy(); // reader |
|
374 |
|
375 CMsgEditorAppUi::UpdateNaviPaneL( image->Bitmap(), image->Mask() ); |
|
376 image->SetPictureOwnedExternally( ETrue ); |
|
377 |
|
378 CleanupStack::PopAndDestroy(); // image |
|
379 |
|
380 PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::UpdateNaviPaneL") |
|
381 } |
|
382 |
|
383 // --------------------------------------------------------- |
|
384 // CPushViewerMsgEdAppUi::IsExpired |
|
385 // --------------------------------------------------------- |
|
386 // |
|
387 TBool CPushViewerMsgEdAppUi::IsExpired() |
|
388 { |
|
389 TBool ret( EFalse ); |
|
390 |
|
391 if ( Document()->Entry().iBioType == KUidWapPushMsgSI.iUid ) |
|
392 { |
|
393 CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, iContext ); |
|
394 // Check expiration if expiration time was set. |
|
395 if ( si->Expires() != Time::NullTTime() ) |
|
396 { |
|
397 TTime today; |
|
398 today.UniversalTime(); |
|
399 if ( si->Expires() < today ) |
|
400 { |
|
401 ret = ETrue; |
|
402 } |
|
403 } |
|
404 } |
|
405 |
|
406 return ret; |
|
407 } |
|
408 |
|
409 // --------------------------------------------------------- |
|
410 // CPushViewerMsgEdAppUi::DoMsgSaveExitL |
|
411 // --------------------------------------------------------- |
|
412 // |
|
413 void CPushViewerMsgEdAppUi::DoMsgSaveExitL() |
|
414 { |
|
415 PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::DoMsgSaveExitL"); |
|
416 |
|
417 Exit( EAknSoftkeyBack ); |
|
418 |
|
419 PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::DoMsgSaveExitL") |
|
420 }; |
|
421 |
|
422 // --------------------------------------------------------- |
|
423 // CPushViewerMsgEdAppUi::NotifyAndExitL |
|
424 // --------------------------------------------------------- |
|
425 // |
|
426 void CPushViewerMsgEdAppUi::NotifyAndExitL( TInt aResId ) |
|
427 { |
|
428 PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::NotifyAndExitL"); |
|
429 |
|
430 HBufC* noteText = iCoeEnv->AllocReadResourceLC( aResId ); |
|
431 CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue ); |
|
432 note->ExecuteLD( *noteText ); |
|
433 CleanupStack::PopAndDestroy( noteText ); // noteText |
|
434 |
|
435 // Close the application. |
|
436 if ( !IsAppShutterRunning() ) |
|
437 { |
|
438 PUSHLOG_WRITE(" RunAppShutter") |
|
439 RunAppShutter(); |
|
440 } |
|
441 |
|
442 PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::NotifyAndExitL"); |
|
443 } |
|
444 |
|
445 // --------------------------------------------------------- |
|
446 // CPushViewerMsgEdAppUi::LaunchViewL |
|
447 // --------------------------------------------------------- |
|
448 // |
|
449 void CPushViewerMsgEdAppUi::LaunchViewL() |
|
450 { |
|
451 __ASSERT_ALWAYS( Document()->Entry().iMtm == KUidMtmWapPush, |
|
452 ViewerPanic( EPushViewerPanBadMtmType ) ); |
|
453 |
|
454 // Construct model. |
|
455 CPushMsgEntryBase* newContext = NULL; |
|
456 const TInt32 bioType( Document()->Entry().iBioType ); |
|
457 |
|
458 if ( bioType == KUidWapPushMsgSI.iUid ) |
|
459 { |
|
460 newContext = CSIPushMsgEntry::NewL(); |
|
461 } |
|
462 else if ( bioType == KUidWapPushMsgSL.iUid ) |
|
463 { |
|
464 newContext = CSLPushMsgEntry::NewL(); |
|
465 } |
|
466 else if ( bioType == KUidWapPushMsgMultiPart.iUid ) |
|
467 { |
|
468 #ifdef __TEST_MULTIPART_SUPP |
|
469 newContext = CMultiPartPushMsgEntry::NewL(); |
|
470 #else // __TEST_MULTIPART_SUPP |
|
471 User::Leave( KErrNotSupported ); |
|
472 #endif // __TEST_MULTIPART_SUPP |
|
473 } |
|
474 else |
|
475 { |
|
476 __ASSERT_DEBUG( EFalse, ViewerPanic( EPushViewerPanBadPushType ) ); |
|
477 User::Leave( KErrNotSupported ); |
|
478 } |
|
479 |
|
480 CleanupStack::PushL( newContext ); |
|
481 newContext->RetrieveL( Document()->Session(), Document()->Entry().Id() ); |
|
482 delete iContext; |
|
483 iContext = NULL; |
|
484 iContext = newContext; |
|
485 CleanupStack::Pop( newContext ); // newContext |
|
486 |
|
487 // Construct view. |
|
488 UpdateNaviPaneL(); |
|
489 ConstructViewL(); |
|
490 } |
|
491 |
|
492 // --------------------------------------------------------- |
|
493 // CPushViewerMsgEdAppUi::HandleEntryChangeL |
|
494 // --------------------------------------------------------- |
|
495 // |
|
496 void CPushViewerMsgEdAppUi::HandleEntryChangeL() |
|
497 { |
|
498 PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::HandleEntryChangeL"); |
|
499 |
|
500 |
|
501 // We have to act only in case of such changes where the content |
|
502 // of the message changes, not only the unread/read flag. |
|
503 // The content handlers and the Push subsystem behave so that |
|
504 // the content is changed only when the entry becomes 'unread', |
|
505 // except one case where the CH changes the content, but the |
|
506 // message becomes 'read' (SL-execute-high). In this case |
|
507 // a flag indicates that the content was changed. |
|
508 |
|
509 // Get an up-to-date entry and check the necessary flags: |
|
510 TMsvEntry tEntry; |
|
511 TMsvId service; |
|
512 TMsvId entryId = Document()->Entry().Id(); |
|
513 CMsvSession& msvSession = Document()->Session(); |
|
514 User::LeaveIfError( msvSession.GetEntry( entryId, service, tEntry ) ); |
|
515 TBool isChangeToUnread = tEntry.Unread(); |
|
516 TBool contentChangedFlagSet = |
|
517 CPushMtmUtil::Attrs( tEntry ) & EPushMtmReadButContentChanged; |
|
518 |
|
519 if ( !isChangeToUnread && !contentChangedFlagSet ) |
|
520 { |
|
521 // Nothing to do. Somebody just set it as read. |
|
522 PUSHLOG_WRITE(" Content not changed"); |
|
523 } |
|
524 else |
|
525 { |
|
526 // Show note about the message changes & close the application. |
|
527 NotifyAndExitL( R_PUSHVIEWER_INFO_REPLACED ); |
|
528 } |
|
529 |
|
530 PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::HandleEntryChangeL") |
|
531 } |
|
532 |
|
533 // --------------------------------------------------------- |
|
534 // CPushViewerMsgEdAppUi::HandleEntryDeletedL |
|
535 // --------------------------------------------------------- |
|
536 // |
|
537 void CPushViewerMsgEdAppUi::HandleEntryDeletedL() |
|
538 { |
|
539 PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::HandleEntryDeletedL"); |
|
540 // Check for iView and iContext objects are created before Handle |
|
541 if ( (NULL == iView) || (NULL == iContext)) |
|
542 { |
|
543 return; |
|
544 } |
|
545 // Show note about the message deletion & close the application. |
|
546 NotifyAndExitL( R_PUSHVIEWER_INFO_DELETED ); |
|
547 |
|
548 PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::HandleEntryDeletedL") |
|
549 } |
|
550 |
|
551 // --------------------------------------------------------- |
|
552 // CPushViewerMsgEdAppUi::GetHelpContextForControl |
|
553 // --------------------------------------------------------- |
|
554 // |
|
555 void CPushViewerMsgEdAppUi::GetHelpContextForControl |
|
556 ( TCoeHelpContext& /*aContext*/ ) const |
|
557 { |
|
558 } |
|
559 |
|
560 // --------------------------------------------------------- |
|
561 // CPushViewerMsgEdAppUi::HandleCommandL |
|
562 // See DynInitMenuPaneL() to see which commands are valid |
|
563 // on a given type of item. |
|
564 // --------------------------------------------------------- |
|
565 // |
|
566 void CPushViewerMsgEdAppUi::HandleCommandL( TInt aCommand ) |
|
567 { |
|
568 PUSHLOG_WRITE_FORMAT("CPushViewerMsgEdAppUi::HandleCommandL <%d>",aCommand) |
|
569 // Check for iView and iContext objects are created before Handle |
|
570 if ( (NULL == iView) || (NULL == iContext)) |
|
571 { |
|
572 return; |
|
573 } |
|
574 switch ( aCommand ) |
|
575 { |
|
576 case EPushViewerCmdLoadService: |
|
577 { |
|
578 if ( IsExpired() ) |
|
579 { |
|
580 // The entry is expired. |
|
581 HBufC* value = |
|
582 iCoeEnv->AllocReadResourceLC( R_PUSHVIEWER_EXPIRED_NOTE ); |
|
583 CAknInformationNote* note = |
|
584 new (ELeave) CAknInformationNote( ETrue ); |
|
585 note->ExecuteLD( *value ); |
|
586 CleanupStack::PopAndDestroy( value ); // value |
|
587 |
|
588 // Delete the expired message and exit. |
|
589 DeleteAndExitL(); |
|
590 } |
|
591 else |
|
592 { |
|
593 PushDoc().IssueLoadServiceL(); |
|
594 } |
|
595 break; |
|
596 } |
|
597 |
|
598 case EPushViewerCmdDelete: |
|
599 { |
|
600 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
601 if ( dlg->ExecuteLD |
|
602 ( R_PUSHVIEWER_ENTRY_DELETE_CONFIRM ) == EAknSoftkeyYes ) |
|
603 { |
|
604 DeleteAndExitL(); |
|
605 } |
|
606 break; |
|
607 } |
|
608 |
|
609 case EPushViewerCmdMessageInfo: |
|
610 { |
|
611 PushDoc().IssueMessageInfoL(); |
|
612 break; |
|
613 } |
|
614 |
|
615 case EPushViewerCmdPreviousMessage: |
|
616 { |
|
617 if ( IsNextMessageAvailableL( EFalse ) ) |
|
618 { |
|
619 NextMessageL( EFalse ); |
|
620 } |
|
621 break; |
|
622 } |
|
623 |
|
624 case EPushViewerCmdNextMessage: |
|
625 { |
|
626 if ( IsNextMessageAvailableL( ETrue ) ) |
|
627 { |
|
628 NextMessageL( ETrue ); |
|
629 } |
|
630 break; |
|
631 } |
|
632 |
|
633 #ifdef __SERIES60_HELP |
|
634 |
|
635 case EPushViewerCmdHelp: |
|
636 { |
|
637 HlpLauncher::LaunchHelpApplicationL |
|
638 ( iEikonEnv->WsSession(), AppHelpContextL() ); |
|
639 break; |
|
640 } |
|
641 |
|
642 #endif //__SERIES60_HELP |
|
643 |
|
644 case EPushViewerCmdBack: |
|
645 case EPushViewerCmdExit: |
|
646 { |
|
647 DoMsgSaveExitL(); |
|
648 break; |
|
649 } |
|
650 |
|
651 default: |
|
652 { |
|
653 break; |
|
654 } |
|
655 } |
|
656 } |
|
657 |
|
658 #ifdef __SERIES60_HELP |
|
659 |
|
660 // --------------------------------------------------------- |
|
661 // CPushViewerMsgEdAppUi::HelpContextL |
|
662 // --------------------------------------------------------- |
|
663 // |
|
664 CArrayFix<TCoeHelpContext>* CPushViewerMsgEdAppUi::HelpContextL() const |
|
665 { |
|
666 CArrayFix<TCoeHelpContext>* contexts = new (ELeave) CArrayFixFlat<TCoeHelpContext>( 1 ); |
|
667 CleanupStack::PushL( contexts ); |
|
668 TCoeHelpContext help( TUid::Uid( EUidPushViewerApp ), KWPUSH_HLP_VIEWER ); |
|
669 contexts->AppendL( help ); |
|
670 CleanupStack::Pop(); // contexts |
|
671 return contexts; |
|
672 } |
|
673 |
|
674 #endif // __SERIES60_HELP |
|
675 |
|
676 // End of file. |
|
677 |