|
1 /* |
|
2 * Copyright (c) 2007 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 "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: ESMR async command base class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "emailtrace.h" |
|
21 #include "cesmricalviewerasynccommand.h" |
|
22 #include <calsession.h> |
|
23 |
|
24 /// Unnamed namespace for local definitions |
|
25 namespace { |
|
26 |
|
27 /** |
|
28 * ASync callback method. |
|
29 * @param aParam Poiter to async command object |
|
30 */ |
|
31 TInt ASyncCallback( TAny* aParam ) |
|
32 { |
|
33 CESMRIcalViewerAsyncCommand* asyncCommand = |
|
34 static_cast<CESMRIcalViewerAsyncCommand*>( aParam ); |
|
35 |
|
36 TRAPD( err, asyncCommand->ExecuteAsyncCommandL() ); |
|
37 |
|
38 return err; |
|
39 } |
|
40 |
|
41 } // namespace |
|
42 |
|
43 // ======== MEMBER FUNCTIONS ======== |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CESMRIcalViewerAsyncCommand::CESMRIcalViewerAsyncCommand |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 CESMRIcalViewerAsyncCommand::CESMRIcalViewerAsyncCommand( |
|
50 TESMRIcalViewerOperationType aType, |
|
51 CCalSession& aCalSession ) |
|
52 : CESMRIcalViewerCommandBase( aType, aCalSession ) |
|
53 { |
|
54 FUNC_LOG; |
|
55 |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CESMRIcalViewerAsyncCommand::CESMRIcalViewerAsyncCommand |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 CESMRIcalViewerAsyncCommand::~CESMRIcalViewerAsyncCommand() |
|
63 { |
|
64 FUNC_LOG; |
|
65 delete iAsyncInvoker; |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CESMRIcalViewerAsyncCommand::CESMRIcalViewerAsyncCommand |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 void CESMRIcalViewerAsyncCommand::ExecuteCommandL( |
|
73 CFSMailMessage& aMessage, |
|
74 MESMRIcalViewerObserver& aObserver ) |
|
75 { |
|
76 FUNC_LOG; |
|
77 if ( !iAsyncInvoker ) |
|
78 { |
|
79 TCallBack callback( ASyncCallback, this ); |
|
80 iAsyncInvoker = new (ELeave) CAsyncCallBack( |
|
81 callback, EPriorityNormal ); |
|
82 } |
|
83 |
|
84 SetMessage( &aMessage ); |
|
85 SetObserver( &aObserver ); |
|
86 |
|
87 // Invoking async command |
|
88 iAsyncInvoker->CallBack(); |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CESMRIcalViewerAsyncCommand::CESMRIcalViewerAsyncCommand |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 void CESMRIcalViewerAsyncCommand::CancelCommand() |
|
96 { |
|
97 FUNC_LOG; |
|
98 if ( iAsyncInvoker ) |
|
99 { |
|
100 CancelAsyncCommand(); |
|
101 } |
|
102 |
|
103 delete iAsyncInvoker; iAsyncInvoker = NULL; |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CESMRIcalViewerAsyncCommand::CESMRIcalViewerAsyncCommand |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 void CESMRIcalViewerAsyncCommand::BaseConstructL() |
|
111 { |
|
112 FUNC_LOG; |
|
113 CESMRIcalViewerCommandBase::BaseConstructL(); |
|
114 } |
|
115 |
|
116 // EOF |
|
117 |