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