|
1 /* |
|
2 * Copyright (c) 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: ESMR policy implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cesmrresponsedialog.h" |
|
19 #include "cmrresponsedialogview.h" |
|
20 #include "esmrgui.hrh" |
|
21 //<cmail> |
|
22 #include "esmrdef.h" |
|
23 //</cmail> |
|
24 #include "esmrinternaluid.h" |
|
25 |
|
26 #include <eikenv.h> |
|
27 #include <eikcolib.h> |
|
28 #include <eikappui.h> |
|
29 #include <avkon.hrh> |
|
30 #include <MAgnEntryUi.h> |
|
31 #include <eikedwin.h> |
|
32 #include <esmrgui.rsg> |
|
33 #include <calentry.h> |
|
34 #include <hlplch.h> |
|
35 #include <akntoolbar.h> |
|
36 |
|
37 // <cmail> custom sw help files not avilable in Cmail |
|
38 #include <csxhelp/cmail.hlp.hrh> |
|
39 // </cmail> |
|
40 |
|
41 // DEBUG |
|
42 #include "emailtrace.h" |
|
43 #include "FreestyleEmailUiConstants.h" |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // CESMRResponseDialog::CESMRResponseDialog |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CESMRResponseDialog::CESMRResponseDialog( HBufC*& aText ): iText(aText) |
|
50 { |
|
51 FUNC_LOG; |
|
52 // Do nothing |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // CESMRResponseDialog::~CESMRResponseDialog |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 CESMRResponseDialog::~CESMRResponseDialog() |
|
60 { |
|
61 FUNC_LOG; |
|
62 static_cast<CEikAppUiFactory*>( |
|
63 iEikonEnv->AppUiFactory() )->CurrentFixedToolbar()-> |
|
64 SetToolbarVisibility( iPreviousVisibility ); |
|
65 // iView is deleted by framework because it uses the |
|
66 // custom control mechanism. |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // CESMRResponseDialog::NewL |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 EXPORT_C CESMRResponseDialog* CESMRResponseDialog::NewL( HBufC*& aText ) |
|
74 { |
|
75 FUNC_LOG; |
|
76 CESMRResponseDialog* self = |
|
77 new (ELeave) CESMRResponseDialog( aText ); |
|
78 CleanupStack::PushL( self ); |
|
79 self->ConstructL(); |
|
80 CleanupStack::Pop( self ); |
|
81 return self; |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // CESMRResponseDialog::ConstructL |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 void CESMRResponseDialog::ConstructL() |
|
89 { |
|
90 FUNC_LOG; |
|
91 CAknDialog::ConstructL( R_RESPONSE_DIALOG_MENUBAR ); |
|
92 iPreviousVisibility = static_cast<CEikAppUiFactory*>( |
|
93 iEikonEnv->AppUiFactory() )->CurrentFixedToolbar()->IsShown(); |
|
94 static_cast<CEikAppUiFactory*>( |
|
95 iEikonEnv->AppUiFactory() )->CurrentFixedToolbar()->SetToolbarVisibility( EFalse ); |
|
96 TRect clientRect = iEikonEnv->EikAppUi()->ClientRect(); |
|
97 iView = CESMRResponseDialogView::NewL(); |
|
98 iView->SetRect( clientRect ); |
|
99 iView->SetSize(clientRect.Size()); |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // CESMRResponseDialog::ProcessCommandL |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 void CESMRResponseDialog::ProcessCommandL( TInt aCommand ) |
|
107 { |
|
108 FUNC_LOG; |
|
109 CAknDialog::ProcessCommandL( aCommand ); |
|
110 |
|
111 switch ( aCommand ) |
|
112 { |
|
113 case EAknCmdHelp: |
|
114 { |
|
115 CArrayFix<TCoeHelpContext>* cntx = |
|
116 new (ELeave) CArrayFixFlat<TCoeHelpContext>(1); |
|
117 CleanupStack::PushL( cntx ); |
|
118 cntx->AppendL( TCoeHelpContext( KFSEmailUiUid, KFSCA_HLP_RESPONSE_EDITOR ) ); |
|
119 CleanupStack::Pop( cntx ); |
|
120 HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), cntx ); |
|
121 break; |
|
122 } |
|
123 case EESMRCmdSendMR: // Fall through |
|
124 case EAknSoftkeyBack: // Fall through |
|
125 case EAknCmdExit: |
|
126 { |
|
127 TryExitL( aCommand ); |
|
128 break; |
|
129 } |
|
130 default: |
|
131 { |
|
132 break; |
|
133 } |
|
134 } |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // CESMRResponseDialog::OfferKeyEventL |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 TKeyResponse CESMRResponseDialog::OfferKeyEventL( |
|
142 const TKeyEvent& aEvent, |
|
143 TEventCode aType) |
|
144 { |
|
145 FUNC_LOG; |
|
146 TKeyResponse response( EKeyWasNotConsumed ); |
|
147 if ( !MenuShowing() ) |
|
148 { |
|
149 response = iView->OfferKeyEventL( aEvent, aType ); |
|
150 } |
|
151 |
|
152 if ( response == EKeyWasNotConsumed ) |
|
153 { |
|
154 response = CAknDialog::OfferKeyEventL( aEvent, aType ); |
|
155 } |
|
156 |
|
157 return response; |
|
158 } |
|
159 |
|
160 // --------------------------------------------------------------------------- |
|
161 // CESMRResponseDialog::OkToExitL |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 TBool CESMRResponseDialog::OkToExitL(TInt aButtonId) |
|
165 { |
|
166 FUNC_LOG; |
|
167 TBool res( EFalse ); |
|
168 // show options |
|
169 if ( aButtonId == EAknSoftkeyOptions ) |
|
170 { |
|
171 CAknDialog::DisplayMenuL(); |
|
172 } |
|
173 // exit dialog |
|
174 if ( aButtonId == EESMRCmdSendMR || |
|
175 aButtonId == EAknSoftkeyBack || |
|
176 aButtonId == EAknCmdExit ) |
|
177 { |
|
178 iText = iView->GetTextL(); |
|
179 res = ETrue; |
|
180 } |
|
181 |
|
182 return res; |
|
183 } |
|
184 |
|
185 // --------------------------------------------------------------------------- |
|
186 // CESMRResponseDialog::CreateCustomControlL |
|
187 // --------------------------------------------------------------------------- |
|
188 // |
|
189 SEikControlInfo CESMRResponseDialog::CreateCustomControlL( TInt aType ) |
|
190 { |
|
191 FUNC_LOG; |
|
192 SEikControlInfo controlInfo; |
|
193 controlInfo.iControl = NULL; |
|
194 controlInfo.iFlags = 0; |
|
195 controlInfo.iTrailerTextId = 0; |
|
196 |
|
197 if ( aType == EEsMrResponseDialogType ) |
|
198 { |
|
199 controlInfo.iControl = iView; |
|
200 } |
|
201 |
|
202 return controlInfo; |
|
203 } |
|
204 |
|
205 // --------------------------------------------------------------------------- |
|
206 // CESMRResponseDialog::ExecuteViewLD |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 EXPORT_C TInt CESMRResponseDialog::ExecuteDlgLD() |
|
210 { |
|
211 FUNC_LOG; |
|
212 return ExecuteLD( R_RESPONSE_DIALOG ); |
|
213 } |
|
214 |
|
215 // EOF |