|
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: THIS FILE IS NOT INCLUDED INTO ECLIPSE CVS DELIVERY |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <browserdialogsprovider.h> // DOMAIN API |
|
21 #include <browserdialogsproviderobserver.h> // DOMAIN API |
|
22 #include "swtbrowserdialogsproviderobserver.h" |
|
23 #include "swtbrowserdialogsproviderobserverproxyprivate.h" |
|
24 #include "swtbrowserdialogsproviderproxy.h" |
|
25 |
|
26 |
|
27 // ======== MEMBER FUNCTIONS ======== |
|
28 |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // CSwtBrowserDialogsProviderProxy::NewL |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 EXPORT_C CSwtBrowserDialogsProviderProxy* CSwtBrowserDialogsProviderProxy::NewL( |
|
35 MSwtBrowserDialogsProviderObserver* aObserver) |
|
36 { |
|
37 CSwtBrowserDialogsProviderProxy* self = |
|
38 new(ELeave) CSwtBrowserDialogsProviderProxy(aObserver); |
|
39 CleanupStack::PushL(self); |
|
40 self->ConstructL(); |
|
41 CleanupStack::Pop(self); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // CSwtBrowserDialogsProviderProxy::~CSwtBrowserDialogsProviderProxy |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C CSwtBrowserDialogsProviderProxy::~CSwtBrowserDialogsProviderProxy() |
|
50 { |
|
51 // Not own |
|
52 iObserver = NULL; |
|
53 |
|
54 // Own |
|
55 delete iDelegate; |
|
56 iDelegate = NULL; |
|
57 delete iDelegateObserver; |
|
58 iDelegateObserver = NULL; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CSwtBrowserDialogsProviderProxy::DialogNotifyErrorL |
|
63 // From MBrCtlDialogsProvider |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 EXPORT_C void CSwtBrowserDialogsProviderProxy::DialogNotifyErrorL(TInt aErrCode) |
|
67 { |
|
68 iDelegate->DialogNotifyErrorL(aErrCode); |
|
69 if (iObserver) |
|
70 { |
|
71 iObserver->ReportDialogEventL( |
|
72 MSwtBrowserDialogsProviderObserver::ENotifyError, |
|
73 aErrCode); |
|
74 } |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // CSwtBrowserDialogsProviderProxy::DialogNotifyHttpErrorL |
|
79 // From MBrCtlDialogsProvider |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 EXPORT_C void CSwtBrowserDialogsProviderProxy::DialogNotifyHttpErrorL( |
|
83 TInt aErrCode, const TDesC& aUri) |
|
84 { |
|
85 iDelegate->DialogNotifyHttpErrorL(aErrCode, aUri); |
|
86 if (iObserver) |
|
87 { |
|
88 iObserver->ReportDialogEventL( |
|
89 MSwtBrowserDialogsProviderObserver::ENotifyHttpError, |
|
90 aErrCode); |
|
91 } |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // CSwtBrowserDialogsProviderProxy::DialogFileSelectLC |
|
96 // From MBrCtlDialogsProvider |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 EXPORT_C TBool CSwtBrowserDialogsProviderProxy::DialogFileSelectLC( |
|
100 const TDesC& aStartPath, const TDesC& aRootPath, HBufC*& aSelectedFileName) |
|
101 { |
|
102 TBool res = iDelegate->DialogFileSelectLC(aStartPath, aRootPath, aSelectedFileName); |
|
103 if (iObserver) |
|
104 { |
|
105 iObserver->ReportDialogEventL( |
|
106 MSwtBrowserDialogsProviderObserver::EFileSelect, |
|
107 static_cast<TInt>(res)); |
|
108 } |
|
109 return res; |
|
110 } |
|
111 // --------------------------------------------------------------------------- |
|
112 // CSwtBrowserDialogsProviderProxy::DialogSelectOptionL |
|
113 // From MBrCtlDialogsProvider |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 EXPORT_C TBool CSwtBrowserDialogsProviderProxy::DialogSelectOptionL( |
|
117 const TDesC& aTitle, TBrCtlSelectOptionType aSelectOptionType, |
|
118 CArrayFix<TBrCtlSelectOptionData>& aOptions) |
|
119 { |
|
120 TBool res = iDelegate->DialogSelectOptionL(aTitle, aSelectOptionType, aOptions); |
|
121 if (iObserver) |
|
122 { |
|
123 iObserver->ReportDialogEventL( |
|
124 MSwtBrowserDialogsProviderObserver::ESelectOption, |
|
125 static_cast<TInt>(res)); |
|
126 } |
|
127 return res; |
|
128 } |
|
129 |
|
130 // --------------------------------------------------------------------------- |
|
131 // CSwtBrowserDialogsProviderProxy::DialogUserAuthenticationLC |
|
132 // From MBrCtlDialogsProvider |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 EXPORT_C TBool CSwtBrowserDialogsProviderProxy::DialogUserAuthenticationLC( |
|
136 const TDesC& aUrl, const TDesC& aRealm, const TDesC& aDefaultUserName, |
|
137 HBufC*& aReturnedUserName, HBufC*& aReturnedPasswd, |
|
138 TBool aBasicAuthentication /*= EFalse*/) |
|
139 { |
|
140 TBool res = iDelegate->DialogUserAuthenticationLC(aUrl, aRealm, aDefaultUserName, |
|
141 aReturnedUserName, aReturnedPasswd, aBasicAuthentication); |
|
142 if (iObserver) |
|
143 { |
|
144 iObserver->ReportDialogEventL( |
|
145 MSwtBrowserDialogsProviderObserver::EUserAuthentication, |
|
146 static_cast<TInt>(res)); |
|
147 } |
|
148 return res; |
|
149 } |
|
150 |
|
151 // --------------------------------------------------------------------------- |
|
152 // CSwtBrowserDialogsProviderProxy::DialogNoteL |
|
153 // From MBrCtlDialogsProvider |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 EXPORT_C void CSwtBrowserDialogsProviderProxy::DialogNoteL(const TDesC& aMessage) |
|
157 { |
|
158 iDelegate->DialogNoteL(aMessage); |
|
159 if (iObserver) |
|
160 { |
|
161 iObserver->ReportDialogEventL( |
|
162 MSwtBrowserDialogsProviderObserver::ENote, 0); |
|
163 } |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------------------------- |
|
167 // CSwtBrowserDialogsProviderProxy::DialogAlertL |
|
168 // From MBrCtlDialogsProvider |
|
169 // --------------------------------------------------------------------------- |
|
170 // |
|
171 EXPORT_C void CSwtBrowserDialogsProviderProxy::DialogAlertL(const TDesC& aTitle, |
|
172 const TDesC& aMessage) |
|
173 { |
|
174 iDelegate->DialogAlertL(aTitle, aMessage); |
|
175 if (iObserver) |
|
176 { |
|
177 iObserver->ReportDialogEventL( |
|
178 MSwtBrowserDialogsProviderObserver::EAlert, 0); |
|
179 } |
|
180 } |
|
181 |
|
182 // --------------------------------------------------------------------------- |
|
183 // CSwtBrowserDialogsProviderProxy::DialogConfirmL |
|
184 // From MBrCtlDialogsProvider |
|
185 // --------------------------------------------------------------------------- |
|
186 // |
|
187 EXPORT_C TBool CSwtBrowserDialogsProviderProxy::DialogConfirmL(const TDesC& aTitle, |
|
188 const TDesC& aMessage, const TDesC& aYesMessage, const TDesC& aNoMessage) |
|
189 { |
|
190 TBool res = iDelegate->DialogConfirmL(aTitle, aMessage, aYesMessage, aNoMessage); |
|
191 if (iObserver) |
|
192 { |
|
193 iObserver->ReportDialogEventL( |
|
194 MSwtBrowserDialogsProviderObserver::EConfirm, |
|
195 static_cast<TInt>(res)); |
|
196 } |
|
197 return res; |
|
198 } |
|
199 |
|
200 // --------------------------------------------------------------------------- |
|
201 // CSwtBrowserDialogsProviderProxy::DialogPromptLC |
|
202 // From MBrCtlDialogsProvider |
|
203 // --------------------------------------------------------------------------- |
|
204 // |
|
205 EXPORT_C TBool CSwtBrowserDialogsProviderProxy::DialogPromptLC(const TDesC& aTitle, |
|
206 const TDesC& aMessage, const TDesC& aDefaultInput, HBufC*& aReturnedInput) |
|
207 { |
|
208 TBool res = iDelegate->DialogPromptLC(aTitle, aMessage, aDefaultInput, aReturnedInput); |
|
209 if (iObserver) |
|
210 { |
|
211 iObserver->ReportDialogEventL( |
|
212 MSwtBrowserDialogsProviderObserver::EPrompt, |
|
213 static_cast<TInt>(res)); |
|
214 } |
|
215 return res; |
|
216 } |
|
217 |
|
218 // --------------------------------------------------------------------------- |
|
219 // CSwtBrowserDialogsProviderProxy::DialogDownloadObjectL |
|
220 // From MBrCtlDialogsProvider |
|
221 // --------------------------------------------------------------------------- |
|
222 // |
|
223 EXPORT_C TBool CSwtBrowserDialogsProviderProxy::DialogDownloadObjectL( |
|
224 CBrCtlObjectInfo* aBrCtlObjectInfo) |
|
225 { |
|
226 TBool res = iDelegate->DialogDownloadObjectL(aBrCtlObjectInfo); |
|
227 if (iObserver) |
|
228 { |
|
229 iObserver->ReportDialogEventL( |
|
230 MSwtBrowserDialogsProviderObserver::EDownloadObject, |
|
231 static_cast<TInt>(res)); |
|
232 } |
|
233 return res; |
|
234 } |
|
235 |
|
236 // --------------------------------------------------------------------------- |
|
237 // CSwtBrowserDialogsProviderProxy::DialogDisplayPageImagesL |
|
238 // From MBrCtlDialogsProvider |
|
239 // --------------------------------------------------------------------------- |
|
240 // |
|
241 EXPORT_C void CSwtBrowserDialogsProviderProxy::DialogDisplayPageImagesL( |
|
242 CArrayFixFlat<TBrCtlImageCarrier>& aPageImages) |
|
243 { |
|
244 iDelegate->DialogDisplayPageImagesL(aPageImages); |
|
245 if (iObserver) |
|
246 { |
|
247 iObserver->ReportDialogEventL( |
|
248 MSwtBrowserDialogsProviderObserver::EDisplayPageImages, 0); |
|
249 } |
|
250 } |
|
251 |
|
252 // --------------------------------------------------------------------------- |
|
253 // CSwtBrowserDialogsProviderProxy::CancelAll |
|
254 // From MBrCtlDialogsProvider |
|
255 // --------------------------------------------------------------------------- |
|
256 // |
|
257 EXPORT_C void CSwtBrowserDialogsProviderProxy::CancelAll() |
|
258 { |
|
259 iDelegate->CancelAll(); |
|
260 if (iObserver) |
|
261 { |
|
262 TRAP_IGNORE(iObserver->ReportDialogEventL( |
|
263 MSwtBrowserDialogsProviderObserver::ECancelAll, 0)); |
|
264 } |
|
265 } |
|
266 |
|
267 // --------------------------------------------------------------------------- |
|
268 // CSwtBrowserDialogsProviderProxy::DialogFindL |
|
269 // From MBrCtlDialogsProvider |
|
270 // --------------------------------------------------------------------------- |
|
271 // |
|
272 EXPORT_C void CSwtBrowserDialogsProviderProxy::DialogFindL() |
|
273 { |
|
274 iDelegate->DialogFindL(); |
|
275 } |
|
276 |
|
277 // --------------------------------------------------------------------------- |
|
278 // CSwtBrowserDialogsProviderProxy::CSwtBrowserDialogsProviderProxy |
|
279 // --------------------------------------------------------------------------- |
|
280 // |
|
281 CSwtBrowserDialogsProviderProxy::CSwtBrowserDialogsProviderProxy( |
|
282 MSwtBrowserDialogsProviderObserver* aObserver) |
|
283 : CBase() |
|
284 , iObserver(aObserver) |
|
285 { |
|
286 } |
|
287 |
|
288 // --------------------------------------------------------------------------- |
|
289 // CSwtBrowserDialogsProviderProxy::ConstructL |
|
290 // --------------------------------------------------------------------------- |
|
291 // |
|
292 void CSwtBrowserDialogsProviderProxy::ConstructL() |
|
293 { |
|
294 iDelegateObserver = new(ELeave) CSwtBrowserDialogsProviderObserverProxyPrivate(iObserver); |
|
295 iDelegate = CBrowserDialogsProvider::NewL(iDelegateObserver); |
|
296 } |