|
1 /* |
|
2 * Copyright (c) 2007-2009 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: Implementation of the class CESMRFieldCommandEvent |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "emailtrace.h" |
|
19 #include "cesmrfieldcommandevent.h" |
|
20 |
|
21 namespace { // codescanner::namespace |
|
22 |
|
23 #ifdef _DEBUG |
|
24 |
|
25 enum TPanic |
|
26 { |
|
27 EInvalidParamIndex = 0 |
|
28 }; |
|
29 |
|
30 _LIT( KPanicCategory, "CESMRFieldCommandEvent" ); |
|
31 |
|
32 #endif //_DEBUG |
|
33 } |
|
34 |
|
35 // ======== MEMBER FUNCTIONS ======== |
|
36 |
|
37 // --------------------------------------------------------------------------- |
|
38 // CESMRFieldCommandEvent::CESMRFieldCommandEvent |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 CESMRFieldCommandEvent::CESMRFieldCommandEvent( |
|
42 MESMRFieldEventNotifier* aSource ) |
|
43 : iSource( aSource) |
|
44 { |
|
45 FUNC_LOG; |
|
46 // Do nothing |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CESMRFieldCommandEvent::~CESMRFieldCommandEvent |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 CESMRFieldCommandEvent::~CESMRFieldCommandEvent() |
|
54 { |
|
55 FUNC_LOG; |
|
56 delete iCommand; |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // CESMRFieldCommandEvent::NewL |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 EXPORT_C CESMRFieldCommandEvent* CESMRFieldCommandEvent::NewL( |
|
64 MESMRFieldEventNotifier* aSource, |
|
65 TInt aCommand ) |
|
66 { |
|
67 FUNC_LOG; |
|
68 CESMRFieldCommandEvent* self = CESMRFieldCommandEvent::NewLC( aSource, |
|
69 aCommand ); |
|
70 CleanupStack::Pop( self ); |
|
71 return self; |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // CESMRFieldCommandEvent::NewLC |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 EXPORT_C CESMRFieldCommandEvent* CESMRFieldCommandEvent::NewLC( |
|
79 MESMRFieldEventNotifier* aSource, |
|
80 TInt aCommand ) |
|
81 { |
|
82 FUNC_LOG; |
|
83 CESMRFieldCommandEvent* self = |
|
84 new( ELeave ) CESMRFieldCommandEvent( aSource ); |
|
85 self->ConstructL( aCommand ); |
|
86 CleanupStack::PushL( self ); |
|
87 return self; |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // CESMRFieldCommandEvent::ConstructL |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void CESMRFieldCommandEvent::ConstructL( TInt aCommand ) |
|
95 { |
|
96 FUNC_LOG; |
|
97 iCommand = new( ELeave ) TInt( aCommand ); |
|
98 } |
|
99 |
|
100 // --------------------------------------------------------------------------- |
|
101 // From class MESMRFieldEvent. |
|
102 // CESMRFieldCommandEvent::Type |
|
103 // Returns EESMRFieldCommandEvent |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 MESMRFieldEvent::TEventType CESMRFieldCommandEvent::Type() const |
|
107 { |
|
108 FUNC_LOG; |
|
109 return MESMRFieldEvent::EESMRFieldCommandEvent; |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // From class MESMRFieldEvent. |
|
114 // CESMRFieldCommandEvent::Source |
|
115 // Returns event source |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 MESMRFieldEventNotifier* CESMRFieldCommandEvent::Source() const |
|
119 { |
|
120 FUNC_LOG; |
|
121 return iSource; |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // From class MESMRFieldEvent. |
|
126 // CESMRFieldCommandEvent::ParamCount |
|
127 // Returns EESMRFieldCommandEvent |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 TInt CESMRFieldCommandEvent::ParamCount() const |
|
131 { |
|
132 FUNC_LOG; |
|
133 return 1; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // From class MESMRFieldEvent. |
|
138 // CESMRFieldCommandEvent::Param |
|
139 // Returns EESMRFieldCommandEvent |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 TAny* CESMRFieldCommandEvent::Param( TInt aIndex ) const |
|
143 { |
|
144 FUNC_LOG; |
|
145 if ( aIndex == 0 ) |
|
146 { |
|
147 return const_cast< TInt* >( iCommand ); |
|
148 } |
|
149 else |
|
150 { |
|
151 __ASSERT_DEBUG( EFalse, User::Panic( KPanicCategory, |
|
152 EInvalidParamIndex ) ); |
|
153 } |
|
154 return NULL; |
|
155 } |
|
156 |