author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:35:16 +0300 | |
branch | RCL_3 |
changeset 71 | a45dccb283c5 |
parent 65 | 8e6fa1719340 |
permissions | -rw-r--r-- |
65 | 1 |
/* |
2 |
* Copyright (c) 2002 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: |
|
15 |
* Implementation of CBrowserAppUi |
|
16 |
* |
|
17 |
* |
|
18 |
*/ |
|
19 |
||
20 |
// INCLUDES |
|
21 |
#include <browser_platform_variant.hrh> |
|
22 |
#include <BrowserNG.rsg> |
|
23 |
#include <uri16.h> |
|
24 |
#include <uri8.h> |
|
25 |
#include <uriutils.h> |
|
26 |
#include <ApUtils.h> |
|
27 |
#include <StringLoader.h> |
|
28 |
#include <e32def.h> |
|
29 |
#include <aplistitemlist.h> |
|
30 |
#include <aplistitem.h> |
|
31 |
#include <apparc.h> |
|
32 |
#include <favouritesfile.h> |
|
33 |
#include <aknmessagequerydialog.h> |
|
34 |
#include <FeatMgr.h> |
|
35 |
#include <internetconnectionmanager.h> |
|
36 |
#include <APSettingsHandlerUi.h> |
|
37 |
#include <UriUtilsCommon.h> |
|
38 |
#include <aknnavi.h> |
|
39 |
#include <AiwGenericParam.h> |
|
40 |
#include <AknDef.h> |
|
41 |
#include <DocumentHandler.h> |
|
42 |
#include <SysUtil.h> |
|
43 |
||
44 |
#ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
|
45 |
#include <MGXFileManagerFactory.h> |
|
46 |
#include <CMGXFileManager.h> |
|
47 |
#endif |
|
48 |
||
49 |
#include <browserplugininterface.h> |
|
50 |
#include <oommonitorplugin.h> |
|
51 |
||
52 |
#include <browseroverriddensettings.h> |
|
53 |
#include "BrowserLauncherService.h" |
|
54 |
||
55 |
#include "cookiemanagerclient.h" |
|
56 |
||
57 |
#ifdef __SERIES60_HELP |
|
58 |
#include <hlplch.h> |
|
59 |
#endif //__SERIES60_HELP |
|
60 |
||
61 |
#include "BrowserAppDocument.h" |
|
62 |
#include <downloadedcontenthandler.h> |
|
63 |
#include "BrowserBmOTABinSender.h" |
|
64 |
#include "BrowserCommandLineParser.h" |
|
65 |
#include "BrowserApplication.h" |
|
66 |
#include "BrowserContentView.h" |
|
67 |
#include "BrowserContentViewContainer.h" |
|
68 |
#include "BrowserContentViewToolbar.h" |
|
69 |
#include "BrowserBookmarksView.h" |
|
70 |
#include "SettingsView.h" |
|
71 |
#include "BrowserWindowSelectionView.h" |
|
72 |
#include "BrowserInitialView.h" |
|
73 |
#include "CommonConstants.h" |
|
74 |
#include "BrowserDialogs.h" |
|
75 |
#include "BrowserDisplay.h" |
|
76 |
#include "BrowserCommsModel.h" |
|
77 |
#include "BrowserUtil.h" |
|
78 |
#include "BrowserPreferences.h" |
|
79 |
#include "SessionAndSecurity.h" |
|
80 |
#include "BrowserUIVariant.hrh" |
|
81 |
#include "BrowserWindowQueue.h" |
|
82 |
#include "Logger.h" |
|
83 |
#include <data_caging_path_literals.hrh> |
|
84 |
||
85 |
#include <brctldefs.h> |
|
86 |
#include <browserdialogsprovider.h> |
|
87 |
#include "BrowserSoftkeysObserver.h" |
|
88 |
#include "BrowserLoadObserver.h" |
|
89 |
#include "BrowserSpecialLoadObserver.h" |
|
90 |
#include "BrowserAsyncExit.h" |
|
91 |
#include "CommonConstants.h" |
|
92 |
||
93 |
||
94 |
// Dialogs Provider |
|
95 |
#include <browserdialogsproviderobserver.h> |
|
96 |
#include <brctlinterface.h> |
|
97 |
#include <browserdialogsprovider.h> |
|
98 |
||
99 |
// Multiple Windows |
|
100 |
#include "BrowserPopupEngine.h" |
|
101 |
#include "BrowserDialogsProviderProxy.h" |
|
102 |
#include "BrowserWindow.h" |
|
103 |
#include "BrowserWindowManager.h" |
|
104 |
#include "AknInfoPopupNoteController.h" |
|
105 |
||
106 |
#include "BrowserAppUi.h" |
|
107 |
||
108 |
#include "BrowserPushMtmObserver.h" |
|
109 |
||
110 |
#ifdef BRDO_IAD_UPDATE_ENABLED_FF |
|
111 |
#include <iaupdate.h> |
|
112 |
#include <iaupdateparameters.h> |
|
113 |
#include <iaupdateresult.h> |
|
114 |
#endif |
|
115 |
||
116 |
//CONSTANTS |
|
117 |
const TUint KBookmarkId = 1; |
|
118 |
const TUint KUrlId = 4; |
|
119 |
_LIT8 ( KLongZeroIdString, "5" ); |
|
120 |
const TUint KFolderId = 6; |
|
121 |
const TUint KLaunchFeeds = 7; |
|
122 |
||
123 |
const TInt KMaxNumOfOpenedWindows = 5; |
|
124 |
const TInt KMinNumOfOpenedWindows = 2; // must allow at least 2 windows for most use cases |
|
125 |
||
126 |
const TUint KDot('.'); |
|
127 |
const TUint KSlash('/'); |
|
128 |
_LIT( KDefaultSchema, "http://" ); |
|
129 |
const TInt KDefaultSchemaLength = 7; |
|
130 |
||
131 |
const TInt KMinimumCDriveDiskSpace = 512 * 1024; |
|
132 |
||
133 |
const TInt KRetryConnectivityTimeout( 2*1000*1000 ); // 2 seconds |
|
134 |
||
135 |
#ifdef BRDO_IAD_UPDATE_ENABLED_FF |
|
136 |
const TUint KBrowser8xUID = 0x200267CC; |
|
137 |
_LIT( KUpdateFileName, "lastupdatechecked.txt" ); |
|
138 |
const TInt64 KMaxTimeToPostponeUpdate = 604800000000; |
|
139 |
#endif |
|
140 |
||
141 |
//Following array stores Uids for external applications. |
|
142 |
//This can be appended. This is used in HandleMessageL to enable Single Window browsing. |
|
143 |
static TInt mArrayOfExternalAppUid[] = { 0x2001f3a9, 0x200159D0}; |
|
144 |
// ================= MEMBER FUNCTIONS ======================= |
|
145 |
||
146 |
// ----------------------------------------------------------------------------- |
|
147 |
// CBrowserAppUi::CBrowserAppUi() |
|
148 |
// ----------------------------------------------------------------------------- |
|
149 |
// |
|
150 |
CBrowserAppUi::CBrowserAppUi(): |
|
151 |
iCalledFromAnotherApp( EFalse ), |
|
152 |
iIsForeground( EFalse ), |
|
153 |
iLastViewId( KUidBrowserNullViewId ), |
|
154 |
iExitInProgress( EFalse ), |
|
155 |
iShutdownRequested( EFalse ), |
|
156 |
iParametrizedLaunchInProgress( 0 ), |
|
157 |
iExitFromEmbeddedMode( EFalse ), |
|
158 |
iLongZeroPressed( EFalse ), |
|
159 |
iStartedUp( EFalse ), |
|
160 |
iFeatureManager( EFalse ), |
|
161 |
iUserExit( EFalse ), |
|
162 |
iPgNotFound( EFalse ), |
|
163 |
iOverriddenLaunchContextId( EBrowserContextIdNormal ), |
|
164 |
iBrowserAlreadyRunning (EFalse), |
|
165 |
iSameWinApp( EFalse ), |
|
166 |
iFeedsClientUtilities( 0 ) |
|
71
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
167 |
#ifdef BRDO_OCC_ENABLED_FF |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
168 |
, |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
169 |
iNewConnFlag( EFalse ) |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
170 |
#endif |
65 | 171 |
{ |
172 |
iViewToBeActivatedIfNeeded.iUid = 0; |
|
173 |
iViewToReturnOnClose.iUid = 0; |
|
174 |
} |
|
175 |
||
176 |
// ----------------------------------------------------------------------------- |
|
177 |
// CBrowserAppUi::~CBrowserAppUi() |
|
178 |
// ----------------------------------------------------------------------------- |
|
179 |
// |
|
180 |
CBrowserAppUi::~CBrowserAppUi() |
|
181 |
{ |
|
182 |
LOG_ENTERFN("CBrowserAppUi::~CBrowserAppUi"); |
|
183 |
||
184 |
#ifdef BRDO_IAD_UPDATE_ENABLED_FF |
|
185 |
delete iDelayedUpdate; |
|
186 |
iFs.Close(); |
|
187 |
#endif |
|
188 |
||
189 |
SetExitInProgress( ETrue ); |
|
190 |
if(iBrowserAsyncExit) |
|
191 |
{ |
|
192 |
iBrowserAsyncExit->Cancel(); |
|
193 |
} |
|
194 |
if(iIdle) |
|
195 |
{ |
|
196 |
iIdle->Cancel(); |
|
197 |
} |
|
198 |
||
199 |
||
200 |
if( iFeatureManager ) |
|
201 |
{ |
|
202 |
FeatureManager::UnInitializeLib(); |
|
203 |
iFeatureManager = EFalse; |
|
204 |
} |
|
205 |
||
206 |
// |
|
207 |
delete iPushMtmObserver; |
|
208 |
||
209 |
#ifdef __RSS_FEEDS |
|
210 |
delete iFeedsClientUtilities; |
|
211 |
LOG_WRITE( "iFeedsClientUtilities deleted" ); |
|
212 |
#endif //__RSS_FEEDS |
|
213 |
||
214 |
delete iPopupEngine; |
|
215 |
LOG_WRITE(" iPopupEngine deleted."); |
|
216 |
||
217 |
// set user exit for 'save launch param' command handling |
|
218 |
if ( iWindowManager ) |
|
219 |
{ |
|
220 |
iWindowManager->SetUserExit( iUserExit ); |
|
221 |
} |
|
222 |
delete iWindowManager; |
|
223 |
LOG_WRITE( " iWindowManager deleted" ); |
|
224 |
||
225 |
#ifdef BRDO_OCC_ENABLED_FF |
|
226 |
if(iRetryConnectivity) |
|
227 |
iRetryConnectivity->Cancel(); |
|
228 |
||
229 |
delete iRetryConnectivity; |
|
230 |
iRetryConnectivity = NULL; |
|
231 |
#endif |
|
232 |
||
233 |
// Delete the inetconman after deleting window manager |
|
234 |
CInternetConnectionManager* inetconman = (CInternetConnectionManager*)iConnection; |
|
235 |
delete inetconman; |
|
236 |
LOG_WRITE( " inetconman deleted" ); |
|
237 |
delete iConnStageNotifier; |
|
238 |
LOG_WRITE( " iConnStageNotifier deleted" ); |
|
239 |
||
240 |
delete iPreferences; |
|
241 |
LOG_WRITE( " iPreferences deleted" ); |
|
242 |
delete iCommsModel; |
|
243 |
LOG_WRITE( " iCommsModel deleted" ); |
|
244 |
||
245 |
delete iLateSendUi; |
|
246 |
LOG_WRITE( " iLateSendUi deleted" ); |
|
247 |
||
248 |
delete iSender; |
|
249 |
LOG_WRITE( " iSender deleted" ); |
|
250 |
||
251 |
delete iIdle; |
|
252 |
LOG_WRITE( " iIdle deleted" ); |
|
253 |
||
254 |
delete iRecentUrlStore; |
|
255 |
LOG_WRITE( " iRecentUrlStore deleted" ); |
|
256 |
||
257 |
if ( iDoorObserver ) |
|
258 |
{ |
|
259 |
iDoorObserver->NotifyExit(MApaEmbeddedDocObserver::ENoChanges); |
|
260 |
LOG_WRITE( " NotifyExit deleted" ); |
|
261 |
} |
|
262 |
delete iDialogsProvider; |
|
263 |
LOG_WRITE( " iDialogsProvider deleted" ); |
|
264 |
||
265 |
TBool isStandAlone = !IsEmbeddedModeOn(); |
|
266 |
LOG_WRITE_FORMAT( " isStandAlone: %d", isStandAlone ); |
|
267 |
||
268 |
delete iBrowserAsyncExit; |
|
269 |
LOG_WRITE( " iBrowserAsyncExit deleted" ); |
|
270 |
||
271 |
iFavouritesSess.Close(); |
|
272 |
LOG_WRITE( " iFavouritesSess.Close() deleted" ); |
|
273 |
#ifdef BRDO_IAD_UPDATE_ENABLED_FF |
|
274 |
CleanUpdateParams(); |
|
275 |
#endif |
|
276 |
} |
|
277 |
||
278 |
// ----------------------------------------------------------------------------- |
|
279 |
// CBrowserAppUi::ConstructL() |
|
280 |
// ----------------------------------------------------------------------------- |
|
281 |
// |
|
282 |
void CBrowserAppUi::ConstructL() |
|
283 |
{ |
|
284 |
LOG_CREATE; |
|
285 |
LOG_ENTERFN( "CBrowserAppUi::ConstructL" ); |
|
286 |
PERFLOG_CREATE; |
|
287 |
PERFLOG_LOCAL_INIT; |
|
288 |
PERFLOG_STOPWATCH_START; |
|
289 |
||
290 |
||
291 |
#ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
71
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
292 |
EnableLocalScreenClearer( EFalse ); |
65 | 293 |
BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible); |
294 |
#else |
|
295 |
BaseConstructL( EAknEnableSkin | EAknEnableMSK ); |
|
296 |
#endif |
|
297 |
||
298 |
||
299 |
if ( !IsEmbeddedModeOn( ) ) |
|
300 |
{ |
|
301 |
// This is for handling low phone memory (c:) condition. Just leave in case phone memory is not sufficient. |
|
302 |
TBool lowdisk = SysUtil::DiskSpaceBelowCriticalLevelL(&(CCoeEnv::Static()->FsSession()), KMinimumCDriveDiskSpace, EDriveC ); |
|
303 |
if (lowdisk) User::Leave(KErrDiskFull); |
|
304 |
||
305 |
#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF |
|
306 |
InitBookmarksL(); |
|
307 |
#else |
|
308 |
InitBrowserL(); |
|
309 |
#endif |
|
310 |
LOG_WRITE( "Browser started standalone" ); |
|
311 |
} |
|
312 |
else |
|
313 |
{ |
|
314 |
iStartedUp = EFalse; |
|
315 |
LOG_WRITE( "Browser started embedded" ); |
|
316 |
} |
|
317 |
PERFLOG_STOP_WRITE("BrowserUI::ConstructL"); |
|
318 |
||
319 |
} |
|
320 |
#ifdef BRDO_IAD_UPDATE_ENABLED_FF |
|
321 |
// --------------------------------------------------------- |
|
322 |
// CBrowserAppUi::CheckUpdatesL |
|
323 |
// --------------------------------------------------------- |
|
324 |
void CBrowserAppUi::CheckUpdatesL() |
|
325 |
{ |
|
326 |
LOG_ENTERFN("CBrowserAppUi::CheckUpdatesL"); |
|
327 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() entering" ); |
|
328 |
User::LeaveIfError(iFs.Connect()); |
|
329 |
if ( FeatureManager::FeatureSupported( KFeatureIdIAUpdate ) ) |
|
330 |
{ |
|
331 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() IAD Update supported" ); |
|
332 |
TRAP_IGNORE( iUpdate = CIAUpdate::NewL( *this ) ); |
|
333 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() IAD Update Client Created" ); |
|
334 |
if ( iUpdate ) |
|
335 |
{ |
|
336 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() creating IAD Update paramentes" ); |
|
337 |
iParameters = CIAUpdateParameters::NewL(); |
|
338 |
// Search for updates using SIS package UID |
|
339 |
iParameters->SetUid( TUid::Uid( KBrowser8xUID ) ); |
|
340 |
//check the updates |
|
341 |
iUpdate->CheckUpdates( *iParameters ); |
|
342 |
} |
|
343 |
} |
|
344 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() exiting" ); |
|
345 |
} |
|
346 |
||
347 |
// --------------------------------------------------------- |
|
348 |
// CBrowserAppUi::CheckUpdatesComplete |
|
349 |
// rest of the details commented in the header |
|
350 |
// --------------------------------------------------------- |
|
351 |
// |
|
352 |
void CBrowserAppUi::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ) |
|
353 |
{ |
|
354 |
LOG_ENTERFN("CBrowserAppUi::CheckUpdatesComplete"); |
|
355 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - Entry" ); |
|
356 |
||
357 |
TBool result = EFalse; |
|
358 |
TBool showDialog = EFalse; |
|
359 |
||
360 |
if ( aErrorCode == KErrNone ) |
|
361 |
{ |
|
362 |
if ( aAvailableUpdates > 0 ) |
|
363 |
{ |
|
364 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - update available" ); |
|
365 |
//Check if the file is available in folder or not |
|
366 |
if(CheckUpdateFileAvailable()) |
|
367 |
{ |
|
368 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - update file available" ); |
|
369 |
TTime timenow; |
|
370 |
timenow.HomeTime(); |
|
371 |
TInt64 time = timenow.Int64(); |
|
372 |
TInt64 dataValue = ReadUpdateFile(); |
|
373 |
//If the diference of the current time and the Previous Check time is more than 1 Week |
|
374 |
//then show the dialog |
|
375 |
if((time - dataValue)>KMaxTimeToPostponeUpdate) |
|
376 |
{ |
|
377 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - diference of the current time and the time available in th file is more than 7 days" ); |
|
378 |
showDialog = ETrue; |
|
379 |
} |
|
380 |
} |
|
381 |
else |
|
382 |
{ |
|
383 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - update file is not available" ); |
|
384 |
showDialog = ETrue; |
|
385 |
} |
|
386 |
||
387 |
if(showDialog) |
|
388 |
{ |
|
389 |
HBufC* message = StringLoader::LoadLC(R_INSTALL_ADDON_BROWSER); |
|
390 |
HBufC* lsc_now = StringLoader::LoadLC(R_INSTALL_BROWSER_NOW); |
|
391 |
HBufC* rsc_later = StringLoader::LoadLC(R_INSTALL_BROWSER_LATER); |
|
392 |
||
393 |
TRAPD(err, result = iDialogsProvider->DialogConfirmL(_L(""), |
|
394 |
*message, |
|
395 |
*lsc_now, |
|
396 |
*rsc_later)); |
|
397 |
||
398 |
CleanupStack::PopAndDestroy(3); //message, lsc_now, rsc_later |
|
399 |
||
400 |
if (err != KErrNone) |
|
401 |
{ |
|
402 |
return ; |
|
403 |
} |
|
404 |
if ( result ) // user selected NOW |
|
405 |
{ |
|
406 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - if file exists, just delete it." ); |
|
407 |
// if file exists, just delete it. |
|
408 |
DeleteUpdateFile(); |
|
409 |
iUpdate->ShowUpdates( *iParameters ); |
|
410 |
} |
|
411 |
if ( !result ) // user selected LATER |
|
412 |
{ |
|
413 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - create the file and store the current time." ); |
|
414 |
//create the file and store the current time. |
|
415 |
WriteUpdateFile(); |
|
416 |
} |
|
417 |
} |
|
418 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - update available" ); |
|
419 |
} |
|
420 |
else |
|
421 |
{ |
|
422 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - no update available" ); |
|
423 |
// The answer was 'Later'. CIAUpdate object could be deleted |
|
424 |
CleanUpdateParams(); |
|
425 |
} |
|
426 |
} |
|
427 |
LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - Exit" ); |
|
428 |
} |
|
429 |
||
430 |
// ----------------------------------------------------------------------------- |
|
431 |
// CBrowserAppUi::CleanUpdateParams |
|
432 |
// ----------------------------------------------------------------------------- |
|
433 |
// |
|
434 |
void CBrowserAppUi::CleanUpdateParams() |
|
435 |
{ |
|
436 |
LOG_ENTERFN("CBrowserAppUi::CleanUpdateParams"); |
|
437 |
LOG_WRITE( "CBrowserAppUi::CleanUpdateParams() entering" ); |
|
438 |
if(iUpdate) |
|
439 |
{ |
|
440 |
delete iUpdate; |
|
441 |
iUpdate = NULL; |
|
442 |
} |
|
443 |
if(iParameters) |
|
444 |
{ |
|
445 |
delete iParameters; |
|
446 |
iParameters = NULL; |
|
447 |
} |
|
448 |
LOG_WRITE( "CBrowserAppUi::CleanUpdateParams() exiting" ); |
|
449 |
} |
|
450 |
||
451 |
// --------------------------------------------------------- |
|
452 |
// CBrowserAppUi::UpdateComplete |
|
453 |
// rest of the details commented in the header |
|
454 |
// --------------------------------------------------------- |
|
455 |
// |
|
456 |
void CBrowserAppUi::UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResult ) |
|
457 |
{ |
|
458 |
LOG_ENTERFN("CBrowserAppUi::UpdateComplete"); |
|
459 |
LOG_WRITE( "CBrowserAppUi::UpdateComplete - Entry" ); |
|
460 |
delete aResult; // Ownership was transferred, so this must be deleted by the client |
|
461 |
CleanUpdateParams(); |
|
462 |
LOG_WRITE( "CBrowserAppUi::UpdateComplete - Exit" ); |
|
463 |
} |
|
464 |
#endif |
|
465 |
||
466 |
||
467 |
// ----------------------------------------------------------------------------- |
|
468 |
// CBrowserAppUi::InitBookmarksL() |
|
469 |
// Initialize only bookmarks view related dependencies here. |
|
470 |
// Note - Do not add unnecessary code here, it increases startup time for bookmarks view. |
|
471 |
// ----------------------------------------------------------------------------- |
|
472 |
// |
|
473 |
void CBrowserAppUi::InitBookmarksL() |
|
474 |
{ |
|
475 |
//New constructor that just replaces the default primary storage size with this one. |
|
476 |
iRecentUrlStore = CRecentUrlStore::NewL(); |
|
477 |
||
478 |
// Init CommsModel |
|
479 |
iCommsModel = CBrowserCommsModel::NewL(); |
|
480 |
||
481 |
// check if it can be delayed ?? |
|
482 |
#ifdef BRDO_OCC_ENABLED_FF |
|
483 |
iConnection = CInternetConnectionManager::NewL( &iCommsModel->CommsDb(), ETrue ); |
|
484 |
#else |
|
485 |
iConnection = CInternetConnectionManager::NewL( &iCommsModel->CommsDb(), EFalse ); |
|
486 |
#endif |
|
487 |
||
488 |
// Creating object to hold application settings |
|
489 |
CBrowserAppDocument* doc = STATIC_CAST(CBrowserAppDocument*, Document()); |
|
490 |
iPreferences = CBrowserPreferences::NewL( *iCommsModel, *this, doc->GetOverriddenSettings()); |
|
491 |
||
492 |
// Create bookmarkview |
|
493 |
CBrowserBookmarksView* bookmarksView = NULL; |
|
494 |
TInt folderUid = doc->GetFolderToOpen(); |
|
495 |
if ( IsEmbeddedModeOn() && folderUid!= KFavouritesRootUid) |
|
496 |
{ |
|
497 |
bookmarksView = CBrowserBookmarksView::NewLC( *this, *iRecentUrlStore, folderUid ); |
|
498 |
} |
|
499 |
else |
|
500 |
{ |
|
501 |
bookmarksView = CBrowserBookmarksView::NewLC( *this, *iRecentUrlStore ); |
|
502 |
} |
|
503 |
||
504 |
iBookmarksView = bookmarksView; |
|
505 |
AddViewL( bookmarksView ); // transfer ownership to CAknViewAppUi |
|
506 |
CleanupStack::Pop(); // bookmarksView |
|
507 |
} |
|
508 |
||
509 |
||
510 |
// ----------------------------------------------------------------------------- |
|
511 |
// CBrowserAppUi::CompleteDelayedInit() |
|
512 |
// Delayed (async) init callback. This method can be invoked explicitly in case |
|
513 |
// some early startup cases fail if Browser has not initialized fully. No harm |
|
514 |
// if called multiple times since there is check in the beginning of thsi function. |
|
515 |
// ----------------------------------------------------------------------------- |
|
516 |
// |
|
517 |
TBool CBrowserAppUi::CompleteDelayedInit() |
|
518 |
{ |
|
519 |
// Should not be called for other that 9.2 onward devices |
|
520 |
#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF |
|
521 |
if ( iStartedUp ) |
|
522 |
return EFalse; // no need to re-invoke automatically |
|
523 |
// complete initialization |
|
524 |
TRAP_IGNORE(DelayedInitL()); |
|
525 |
||
526 |
#ifdef BRDO_IAD_UPDATE_ENABLED_FF |
|
527 |
// complete the IAD check asynchronously |
|
528 |
iDelayedUpdate = CIdle::NewL( CActive::EPriorityIdle ); |
|
529 |
iDelayedUpdate->Start(TCallBack( CompleteIADUpdateCallback, this )); |
|
530 |
#endif |
|
531 |
#endif |
|
532 |
||
533 |
return EFalse; // no need to re-invoke automatically |
|
534 |
} |
|
535 |
||
536 |
// ----------------------------------------------------------------------------- |
|
537 |
// CBrowserAppUi::DelayedInitL() |
|
538 |
// Delayed (Async) initialization - whatever remains after InitBookmarksL(), do it here. |
|
539 |
// Note: - Do not add unnecessary code here, it increases startup time for contenview. |
|
540 |
// ----------------------------------------------------------------------------- |
|
541 |
// |
|
542 |
void CBrowserAppUi::DelayedInitL() |
|
543 |
{ |
|
544 |
LOG_ENTERFN("CBrowserAppUi::DelayedInitL"); |
|
545 |
||
546 |
// Create Favengine session |
|
547 |
User::LeaveIfError( iFavouritesSess.Connect() ); |
|
548 |
||
549 |
// Init FeatureManager |
|
550 |
FeatureManager::InitializeLibL(); |
|
551 |
iFeatureManager = ETrue; |
|
552 |
||
553 |
// check flash present |
|
554 |
iFlashPresent = CheckFlashPresent(); |
|
555 |
||
556 |
// this is required, browser's connection oberver should be hit first. |
|
557 |
// (incase of netscape plgins, transactions will be closed.) |
|
558 |
iConnStageNotifier = CConnectionStageNotifierWCB::NewL(); |
|
559 |
iConnStageNotifier->SetPriority(CActive::EPriorityHigh); |
|
560 |
||
561 |
// Starts a background processing, so it must be started early, to get |
|
562 |
// finished before the first send operation! Or it must be synchronized! |
|
563 |
iLateSendUi = CIdle::NewL( CActive::EPriorityIdle ); |
|
564 |
iLateSendUi ->Start( TCallBack( DelayedSendUiConstructL, this ) ); |
|
565 |
||
566 |
iHTTPSecurityIndicatorSupressed = iPreferences->HttpSecurityWarningsStatSupressed(); |
|
567 |
||
568 |
// set AP to be a default one (for Push messages) |
|
569 |
SetRequestedAP( Preferences().DefaultAccessPoint() ); |
|
570 |
||
571 |
// Create ContentView |
|
572 |
TRect rect = ClientRect(); |
|
573 |
CBrowserContentView* contentView = CBrowserContentView::NewLC( *this, rect ); |
|
574 |
AddViewL( contentView ); // transfer ownership to CAknViewAppUi |
|
575 |
CleanupStack::Pop(); // contentView |
|
576 |
||
577 |
// proxy will handle dialog events through load observer |
|
578 |
iDialogsProvider = CBrowserDialogsProvider::NewL( NULL); |
|
579 |
||
580 |
#ifdef __RSS_FEEDS |
|
581 |
iFeedsClientUtilities = CFeedsClientUtilities::NewL( *this, *this ); |
|
582 |
BROWSER_LOG( ( _L("Feeds up.") ) ); |
|
583 |
#endif //__RSS_FEEDS |
|
584 |
||
585 |
// Is Multiple Window feature suported? |
|
586 |
if ( Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) ) |
|
587 |
{ |
|
588 |
if (Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows ))//midrange |
|
589 |
{ |
|
590 |
iWindowManager = CBrowserWindowManager::NewL( *this, *contentView, KMinNumOfOpenedWindows ); |
|
591 |
} |
|
592 |
else |
|
593 |
{ |
|
594 |
iWindowManager = CBrowserWindowManager::NewL( *this, *contentView, KMaxNumOfOpenedWindows ); |
|
595 |
} |
|
596 |
LOG_WRITE_FORMAT("WindowManager Up. Max windows number. %d", KMaxNumOfOpenedWindows ); |
|
597 |
} |
|
598 |
else |
|
599 |
{ |
|
600 |
iWindowManager = CBrowserWindowManager::NewL( *this, *contentView, KMinNumOfOpenedWindows ); |
|
601 |
BROWSER_LOG( ( _L( "WindowManager Up. MWs not supported." ) ) ); |
|
602 |
} |
|
603 |
||
604 |
contentView->SetZoomLevelL(); |
|
605 |
BrCtlInterface().AddLoadEventObserverL(iBookmarksView); |
|
606 |
||
607 |
// create settings view |
|
608 |
CBrowserSettingsView* settingsView = CBrowserSettingsView::NewLC( *this ); |
|
609 |
AddViewL( settingsView ); // transfer ownership to CAknViewAppUi |
|
610 |
CleanupStack::Pop(); // settingsView |
|
611 |
BROWSER_LOG( ( _L( "SettingsView up" ) ) ); |
|
612 |
||
613 |
// window selection view |
|
614 |
CBrowserWindowSelectionView* windowSelectionView = CBrowserWindowSelectionView::NewLC( *this ); |
|
615 |
AddViewL( windowSelectionView ); // transfer ownership to CAknViewAppUi |
|
616 |
CleanupStack::Pop(); // windowSelectionView |
|
617 |
BROWSER_LOG( ( _L( "windowSelectionView up" ) ) ); |
|
618 |
||
619 |
// Create asyncronous object to call when exit requires it. |
|
620 |
iBrowserAsyncExit = CBrowserAsyncExit::NewL( this ); |
|
621 |
iIdle = CIdle::NewL( CActive::EPriorityIdle ); |
|
622 |
||
623 |
iPushMtmObserver = CBrowserPushMtmObserver::NewL( this ); |
|
624 |
iPushMtmObserver->StartObserver(); |
|
625 |
||
626 |
#ifdef BRDO_OCC_ENABLED_FF |
|
627 |
iRetryConnectivity = CPeriodic::NewL(CActive::EPriorityStandard); |
|
628 |
#endif |
|
629 |
||
630 |
// Create two Panes of CBrowserContentViewContainer |
|
631 |
CBrowserGotoPane* gotoPane = CBrowserGotoPane::NewL( contentView->Container(), |
|
632 |
EMbmAvkonQgn_indi_find_goto, |
|
633 |
EMbmAvkonQgn_indi_find_goto_mask, |
|
634 |
ETrue, |
|
635 |
contentView ); |
|
636 |
||
637 |
// Create the find pane with magnifier glass icon, and |
|
638 |
// without adaptive popup list... |
|
639 |
CBrowserGotoPane* findKeywordPane = CBrowserGotoPane::NewL( contentView->Container(), |
|
640 |
EMbmAvkonQgn_indi_find_glass, |
|
641 |
EMbmAvkonQgn_indi_find_glass_mask, |
|
642 |
EFalse, |
|
643 |
contentView, |
|
644 |
ETrue ); |
|
645 |
contentView->Container()->SetGotoPane(gotoPane); |
|
646 |
contentView->Container()->SetFindKeywordPane(findKeywordPane); |
|
647 |
//contentView->Container()->SetRect( rect ); // causes suncRepaint |
|
648 |
contentView->Container()->GotoPane()->SetGPObserver(contentView); |
|
649 |
contentView->Container()->FindKeywordPane()->SetGPObserver(contentView); |
|
650 |
contentView->Container()->FindKeywordPane()->SetOrdinalPosition( 0 ); |
|
651 |
contentView->Container()->GotoPane()->SetOrdinalPosition( 0 ); |
|
652 |
||
653 |
iStartedUp = ETrue; |
|
654 |
iSecureSiteVisited = EFalse; |
|
655 |
||
656 |
#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF |
|
657 |
if(LastActiveViewId() == KUidBrowserBookmarksViewId) |
|
658 |
{ |
|
659 |
iBookmarksView->CheckForDownloads(); |
|
660 |
iBookmarksView->UpdateFavIconsL(); |
|
661 |
} |
|
662 |
#endif |
|
663 |
} |
|
664 |
||
665 |
// ----------------------------------------------------------------------------- |
|
666 |
// CBrowserAppUi::InitBrowserL() - THIS METHOD IS NOT USED FOR NORMAL STARTUP |
|
667 |
// This method is just for supporting Browser initialization if launched in Embedded mode |
|
668 |
// Normal initialization if split in BookmarksInit() and DelayedInit(). iStartedUp is FALSE |
|
669 |
// if BRowser has not initialized or partially initialized. |
|
670 |
// NOTE: DO NOT ADD ANY CODE HERE. IT IS JUST A WRAPPER. |
|
671 |
// ----------------------------------------------------------------------------- |
|
672 |
// |
|
673 |
void CBrowserAppUi::InitBrowserL() |
|
674 |
{ |
|
675 |
// Bookmarks initialization |
|
676 |
InitBookmarksL(); |
|
677 |
||
678 |
// 2nd part of initialization |
|
679 |
DelayedInitL(); |
|
680 |
||
681 |
#ifdef BRDO_IAD_UPDATE_ENABLED_FF |
|
682 |
// complete the IAD check asynchronously |
|
683 |
if(!IsEmbeddedModeOn()) |
|
684 |
{ |
|
685 |
iDelayedUpdate = CIdle::NewL( CActive::EPriorityIdle ); |
|
686 |
iDelayedUpdate->Start(TCallBack( CompleteIADUpdateCallback, this )); |
|
687 |
} |
|
688 |
#endif |
|
689 |
} |
|
690 |
||
691 |
||
692 |
// ----------------------------------------------------------------------------- |
|
693 |
// CBrowserAppUi::ProcessCommandL(TInt aCommand) |
|
694 |
// ----------------------------------------------------------------------------- |
|
695 |
// |
|
696 |
void CBrowserAppUi::ProcessCommandL(TInt aCommand) |
|
697 |
{ |
|
698 |
MEikAppUiFactory* appUiFactory = (iEikonEnv)->AppUiFactory(); |
|
699 |
if (appUiFactory->MenuBar()) |
|
700 |
{ |
|
701 |
StopDisplayingMenuBar(); |
|
702 |
} |
|
703 |
CAknViewAppUi::ProcessCommandL(aCommand); |
|
704 |
} |
|
705 |
||
706 |
// ----------------------------------------------------------------------------- |
|
707 |
// CBrowserAppUi::HandleCommandL() |
|
708 |
// ----------------------------------------------------------------------------- |
|
709 |
// |
|
710 |
void CBrowserAppUi::HandleCommandL(TInt aCommand) |
|
711 |
{ |
|
712 |
// Default handling for all the thingies. |
|
713 |
switch (aCommand) |
|
714 |
{ |
|
715 |
case EEikCmdExit: |
|
716 |
{ |
|
717 |
ExitBrowser ( IsAppShutterActive() ); |
|
718 |
break; |
|
719 |
} |
|
720 |
case EAknSoftkeyExit:// closes the whole application chain if embedded browser |
|
721 |
case EAknCmdExit: |
|
722 |
{ |
|
723 |
if ( IsEmbeddedModeOn() ) |
|
724 |
{ |
|
725 |
CAknEnv::RunAppShutter(); |
|
726 |
break; |
|
727 |
} |
|
728 |
else |
|
729 |
{ |
|
730 |
ExitBrowser ( ETrue ) ; |
|
731 |
break; |
|
732 |
} |
|
733 |
} |
|
734 |
//Fix for TSW error ICHV-75UFKZ |
|
735 |
case EWmlCmdUserExit://closes the current browser instance only |
|
736 |
case EWmlCmdCloseBrowser: |
|
737 |
{ |
|
738 |
ExitBrowser ( ETrue ); |
|
739 |
break; |
|
740 |
} |
|
741 |
case EWmlCmdChangeConnection : |
|
742 |
{ |
|
743 |
ChangeConnectionL(); |
|
744 |
break; |
|
745 |
} |
|
746 |
case EWmlCmdPreferences: |
|
747 |
{ |
|
748 |
SetViewToBeActivatedIfNeededL( KUidBrowserSettingsViewId ); |
|
749 |
break; |
|
750 |
} |
|
751 |
case EWmlCmdPreferencesToolbar: |
|
752 |
{ |
|
753 |
SetViewToBeActivatedIfNeededL( KUidBrowserSettingsViewId, KUidSettingsGotoToolbarGroup.iUid ); |
|
754 |
break; |
|
755 |
} |
|
756 |
case EWmlCmdFavourites: |
|
757 |
{ |
|
758 |
SetViewToBeActivatedIfNeededL( KUidBrowserBookmarksViewId ); |
|
759 |
break; |
|
760 |
} |
|
761 |
case EWmlCmdSearchWeb: |
|
762 |
{ |
|
763 |
LoadSearchPageL(); |
|
764 |
break; |
|
765 |
} |
|
766 |
case EWmlCmdReload: |
|
767 |
{ |
|
768 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandReload + |
|
769 |
(TInt)TBrCtlDefs::ECommandIdBase ); |
|
770 |
break; |
|
771 |
} |
|
772 |
#ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
773 |
case EWmlCmdSetAsHomePage: |
|
774 |
{ |
|
775 |
ContentView()->HandleCommandL(EWmlCmdSetAsHomePage); |
|
776 |
break; |
|
777 |
} |
|
778 |
#endif |
|
779 |
case EAknSoftkeyBack: |
|
780 |
case EWmlCmdBack: |
|
781 |
{ |
|
782 |
HistoryLoadPrevious(); |
|
783 |
break; |
|
784 |
} |
|
785 |
case EWmlCmdBackToFeedsView: |
|
786 |
{ |
|
787 |
//Note: iPreviousView in this case will always be one of the Feeds view. |
|
788 |
//In general iPreviousView holds the UID of the previous view. |
|
789 |
SetViewToBeActivatedIfNeededL( iPreviousView ); |
|
790 |
break; |
|
791 |
} |
|
792 |
case EWmlCmdClearTheCache: |
|
793 |
{ |
|
794 |
ClearTheCacheL(ETrue, ETrue); |
|
795 |
break; |
|
796 |
} |
|
797 |
case EWmlCmdDeleteCookies: |
|
798 |
{ |
|
799 |
DeleteCookiesL(); |
|
800 |
TBrowserDialogs::InfoNoteL( |
|
801 |
R_BROWSER_OK_NOTE, R_QTN_BROWSER_NOTE_COOKIES_DELETED ); |
|
802 |
break; |
|
803 |
} |
|
804 |
||
805 |
case EWmlCmdClearAllPrivacy: |
|
806 |
{ |
|
807 |
ClearAllPrivacyL(); |
|
808 |
break; |
|
809 |
} |
|
810 |
||
811 |
case EWmlCmdClearHistory: |
|
812 |
{ |
|
813 |
ClearHistoryWithPromptL(); |
|
814 |
break; |
|
815 |
} |
|
816 |
||
817 |
case EWmlCmdClearFormAndPasswd: |
|
818 |
{ |
|
819 |
ClearFormAndPasswdDataL(ETrue); |
|
820 |
break; |
|
821 |
} |
|
822 |
||
823 |
case EWmlCmdLaunchHomePage: |
|
824 |
{ |
|
825 |
if (!IsLaunchHomePageDimmedL()) |
|
826 |
{ |
|
827 |
LaunchHomePageL( /* EFalse */ ); |
|
828 |
} |
|
829 |
break; |
|
830 |
} |
|
831 |
case EWmlCmdDisconnect : |
|
832 |
{ |
|
833 |
DisconnectL(); |
|
834 |
TBrowserDialogs::InfoNoteL( |
|
835 |
R_BROWSER_INFO_NOTE, R_WML_DISCONNECT ); |
|
836 |
break; |
|
837 |
} |
|
838 |
case EWmlCmdCancelFetch: |
|
839 |
{ |
|
840 |
if (SpecialLoadObserver().IsConnectionStarted()) // If Connection request is in processing |
|
841 |
{ // try to Cancel. |
|
842 |
SpecialLoadObserver().CancelConnection(); |
|
843 |
Connection().Disconnect(); |
|
844 |
} |
|
845 |
else |
|
846 |
{ |
|
847 |
CancelFetch( ETrue ); |
|
848 |
} |
|
849 |
break; |
|
850 |
} |
|
851 |
case EWmlCmdPageInfo: |
|
852 |
{ |
|
853 |
CSessionAndSecurity* security = CSessionAndSecurity::NewLC(*this); |
|
854 |
security->ShowPageInfoL(); |
|
855 |
CleanupStack::PopAndDestroy(); // security |
|
856 |
break; |
|
857 |
} |
|
858 |
case EWmlCmdInfoSession: |
|
859 |
{ |
|
860 |
CSessionAndSecurity* session = CSessionAndSecurity::NewLC(*this); |
|
861 |
session->ShowSessionInfoL(); |
|
862 |
CleanupStack::PopAndDestroy(); // session |
|
863 |
break; |
|
864 |
} |
|
865 |
case EWmlCmdInfoSecurity: |
|
866 |
{ |
|
867 |
CSessionAndSecurity* security = CSessionAndSecurity::NewLC(*this); |
|
868 |
security->ShowSecurityInfoL(); |
|
869 |
CleanupStack::PopAndDestroy(); // security |
|
870 |
break; |
|
871 |
} |
|
872 |
// browser engine specific command |
|
873 |
#ifdef __SERIES60_HELP |
|
874 |
||
875 |
case EAknCmdHelp: |
|
876 |
{ |
|
877 |
HlpLauncher::LaunchHelpApplicationL |
|
878 |
( iEikonEnv->WsSession(), AppHelpContextL() ); |
|
879 |
break; |
|
880 |
} |
|
881 |
||
882 |
#endif //__SERIES60_HELP |
|
883 |
||
884 |
case EWmlCmdForward: |
|
885 |
{ |
|
886 |
HistoryLoadNext(); |
|
887 |
break; |
|
888 |
} |
|
889 |
||
890 |
case EWmlCmdRotateDisplay: |
|
891 |
{ |
|
892 |
if ( Orientation() == EAppUiOrientationPortrait ) |
|
893 |
{ |
|
894 |
SetOrientationL(EAppUiOrientationLandscape); |
|
895 |
} |
|
896 |
else if (Orientation() == EAppUiOrientationLandscape) |
|
897 |
{ |
|
898 |
SetOrientationL(EAppUiOrientationPortrait); |
|
899 |
} |
|
900 |
else // EAppUiOrientationUnspecified |
|
901 |
{ |
|
902 |
TRect rect = ApplicationRect(); |
|
903 |
TInt width = rect.Width(); |
|
904 |
TInt height = rect.Height(); |
|
905 |
||
906 |
if (width > height) |
|
907 |
{ |
|
908 |
SetOrientationL(EAppUiOrientationPortrait); |
|
909 |
} |
|
910 |
else |
|
911 |
{ |
|
912 |
SetOrientationL(EAppUiOrientationLandscape); |
|
913 |
} |
|
914 |
} |
|
915 |
if(ContentView()->KeymapIsUp()) |
|
916 |
{ |
|
917 |
ContentView()->RedrawKeymap(); |
|
918 |
} |
|
919 |
break; |
|
920 |
} |
|
921 |
||
922 |
case EWmlCmdAboutProduct: |
|
923 |
{ |
|
924 |
// get version info from browser control and display it |
|
925 |
ShowNameAndVersionL(); |
|
926 |
break; |
|
927 |
} |
|
928 |
case EWmlCmdProductUpdate: |
|
929 |
{ |
|
930 |
/*if(!iAppUpdate) |
|
931 |
{ |
|
932 |
iAppUpdate = CBrowserAppUpdate::NewL(); |
|
933 |
} |
|
934 |
iAppUpdate->CheckUpdates();*/ |
|
935 |
break; |
|
936 |
} |
|
937 |
||
938 |
//===================================================================== |
|
939 |
// Multiple Windows Support |
|
940 |
// |
|
941 |
case EWmlCmdSwitchWindow: |
|
942 |
{ |
|
943 |
if(WindowMgr().WindowCount() > 1) |
|
944 |
{ |
|
945 |
#ifdef BRDO_MULTITOUCH_ENABLED_FF |
|
946 |
// use switch window tab view if pageoverview bitmaps are available |
|
947 |
if (Preferences().UiLocalFeatureSupported( KBrowserGraphicalPage ) |
|
948 |
|| Preferences().UiLocalFeatureSupported( KBrowserGraphicalHistory )) |
|
949 |
#else |
|
950 |
// use switch window tab view if pageoverview bitmaps are available |
|
951 |
if (Preferences().UiLocalFeatureSupported( KBrowserGraphicalPage )) |
|
952 |
#endif |
|
953 |
{ |
|
954 |
SetViewToBeActivatedIfNeededL( KUidBrowserWindowSelectionViewId ); |
|
955 |
} |
|
956 |
else |
|
957 |
{ |
|
958 |
SwitchWindowL(); |
|
959 |
} |
|
960 |
} |
|
961 |
break; |
|
962 |
} |
|
963 |
case EWmlCmdCloseWindow: |
|
964 |
{ |
|
965 |
if ( IsEmbeddedInOperatorMenu() ) |
|
966 |
{ |
|
967 |
ExitBrowser( ETrue ); |
|
968 |
} |
|
969 |
else |
|
970 |
{ |
|
971 |
CloseWindowL(); |
|
972 |
} |
|
973 |
break; |
|
974 |
} |
|
975 |
case EWmlCmdAllowPopups: |
|
976 |
{ |
|
977 |
// Add url to whitelist |
|
978 |
HBufC* url( WindowMgr().CurrentWindow()->BrCtlInterface(). |
|
979 |
PageInfoLC( TBrCtlDefs::EPageInfoUrl ) ); |
|
980 |
PopupEngine().AddUrlToWhiteListL( *url ); |
|
981 |
CleanupStack::PopAndDestroy( url ); |
|
982 |
break; |
|
983 |
} |
|
984 |
case EWmlCmdBlockPopups: |
|
985 |
{ |
|
986 |
// Remove from whitelist |
|
987 |
HBufC* url( WindowMgr().CurrentWindow()->BrCtlInterface(). |
|
988 |
PageInfoLC( TBrCtlDefs::EPageInfoUrl ) ); |
|
989 |
PopupEngine().RemoveUrlFromWhiteListL( *url ); |
|
990 |
CleanupStack::PopAndDestroy( url ); |
|
991 |
break; |
|
992 |
} |
|
993 |
case EWmlCmdShowAnchorHref: |
|
994 |
{ |
|
995 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandShowAnchorHref ); |
|
996 |
break; |
|
997 |
} |
|
998 |
case EWmlCmdSaveToGallery: |
|
999 |
{ |
|
1000 |
SaveFocusedImageToGalleryL(); |
|
1001 |
break; |
|
1002 |
} |
|
1003 |
case EWmlCmdOpenToViewer: |
|
1004 |
{ |
|
1005 |
TBrCtlImageCarrier* imageCarrier = BrCtlInterface().FocusedImageLC(); |
|
1006 |
if (imageCarrier) |
|
1007 |
{ |
|
1008 |
CArrayFixFlat<TBrCtlImageCarrier>* imageArray = new( ELeave ) CArrayFixFlat<TBrCtlImageCarrier>(1); |
|
1009 |
CleanupStack::PushL(imageArray); |
|
1010 |
imageArray->AppendL(*imageCarrier); |
|
1011 |
iDialogsProvider->DialogDisplayPageImagesL( *imageArray ); |
|
1012 |
CleanupStack::PopAndDestroy(2); // imageArray, imageCarrier |
|
1013 |
} |
|
1014 |
break; |
|
1015 |
} |
|
1016 |
case EWmlCmdSaveUrlAsBookmark: |
|
1017 |
{ |
|
1018 |
HBufC* url = BrCtlInterface().PageInfoLC(TBrCtlDefs::EPageInfoFocusedNodeUrl); |
|
1019 |
ContentView()->AddNewBookmarkL(EFalse, url); |
|
1020 |
CleanupStack::PopAndDestroy(); // url |
|
1021 |
break; |
|
1022 |
} |
|
1023 |
case EWmlCmdSmartLinkMakeCall: |
|
1024 |
{ |
|
1025 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandSmartLinkMakeCall ); |
|
1026 |
break; |
|
1027 |
} |
|
1028 |
case EWmlCmdSmartLinkSendEmail: |
|
1029 |
{ |
|
1030 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandSmartLinkSendEmail ); |
|
1031 |
break; |
|
1032 |
} |
|
1033 |
case EWmlCmdSmartLinkSendSms: |
|
1034 |
{ |
|
1035 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandSmartLinkSendMessage ); |
|
1036 |
break; |
|
1037 |
} |
|
1038 |
case EWmlCmdSmartLinkAddToContacts: |
|
1039 |
{ |
|
1040 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandSmartLinkAddToPhoneBook ); |
|
1041 |
break; |
|
1042 |
} |
|
1043 |
case EWmlCmdLoadFocusedImage: |
|
1044 |
{ |
|
1045 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandLoadFocusedImage ); |
|
1046 |
break; |
|
1047 |
} |
|
1048 |
case EWmlCmdLoadImagesOnly: |
|
1049 |
{ |
|
1050 |
iPreferences->SetAutoLoadContentL(EWmlSettingsAutoloadImagesNoFlash); |
|
1051 |
break; |
|
1052 |
} |
|
1053 |
case EWmlCmdLoadImagesAndFlash: |
|
1054 |
{ |
|
1055 |
iPreferences->SetAutoLoadContentL(EWmlSettingsAutoloadAll); |
|
1056 |
break; |
|
1057 |
} |
|
1058 |
case EWmlCmdOneStepBack: |
|
1059 |
{ |
|
1060 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandOneStepBack ); |
|
1061 |
break; |
|
1062 |
} |
|
1063 |
case EEikCmdEditPaste: |
|
1064 |
{ |
|
1065 |
TKeyEvent keyEvent; |
|
1066 |
keyEvent.iCode = EKeyF18; //member of TKeyCode |
|
1067 |
keyEvent.iScanCode = EEikCmdEditPaste; |
|
1068 |
keyEvent.iModifiers = EModifierCtrl; |
|
1069 |
keyEvent.iRepeats = 0; |
|
1070 |
TRAP_IGNORE( BrCtlInterface().OfferKeyEventL(keyEvent, EEventKey)); |
|
1071 |
} |
|
1072 |
break; |
|
1073 |
//===================================================================== |
|
1074 |
default: |
|
1075 |
{ |
|
1076 |
if( iStartedUp ) |
|
1077 |
{ |
|
1078 |
// pass to Browser Control |
|
1079 |
BrCtlInterface().HandleCommandL( aCommand ); |
|
1080 |
} |
|
1081 |
break; |
|
1082 |
} |
|
1083 |
} |
|
1084 |
} |
|
1085 |
||
1086 |
// ----------------------------------------------------------------------------- |
|
1087 |
// CBrowserAppUi::ActiveView() |
|
1088 |
// ----------------------------------------------------------------------------- |
|
1089 |
// |
|
1090 |
CBrowserViewBase* CBrowserAppUi::ActiveView() |
|
1091 |
{ |
|
1092 |
TVwsViewId activeViewId; |
|
1093 |
TInt err = GetActiveViewId( activeViewId ); |
|
1094 |
||
1095 |
if ( !err ) |
|
1096 |
{ |
|
1097 |
return STATIC_CAST( CBrowserViewBase*, View(activeViewId.iViewUid) ); |
|
1098 |
} |
|
1099 |
else |
|
1100 |
{ |
|
1101 |
//We should not panic |
|
1102 |
//On 3.0 wk40 it was observed that GetActiveViewId returned with KErrNotFound |
|
1103 |
//in case Browser was in the background |
|
1104 |
//Symbian error? |
|
1105 |
return NULL; |
|
1106 |
} |
|
1107 |
} |
|
1108 |
||
1109 |
// ----------------------------------------------------------------------------- |
|
1110 |
// CBrowserAppUi::SetRequestedAP() |
|
1111 |
// ----------------------------------------------------------------------------- |
|
1112 |
// |
|
1113 |
void CBrowserAppUi::SetRequestedAP( TInt aAp ) |
|
1114 |
{ |
|
1115 |
iRequestedAp = aAp; |
|
1116 |
} |
|
1117 |
||
1118 |
// ----------------------------------------------------------------------------- |
|
1119 |
// CBrowserAppUi::IsPageLoaded() |
|
1120 |
// ----------------------------------------------------------------------------- |
|
1121 |
// |
|
1122 |
TBool CBrowserAppUi::IsPageLoaded() |
|
1123 |
{ |
|
1124 |
#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF |
|
1125 |
if(!iStartedUp) // ContentView/WindowMgr is not yet up => no page loaded |
|
1126 |
return EFalse; |
|
1127 |
#endif |
|
1128 |
||
1129 |
TBool ret( EFalse ); |
|
1130 |
TInt winCount( WindowMgr().WindowCount() ); |
|
1131 |
||
1132 |
// at least 2 window -> there is a page loaded |
|
1133 |
if( winCount > 1 ) |
|
1134 |
{ |
|
1135 |
ret = ETrue; |
|
1136 |
} |
|
1137 |
// 1 window with a loaded content |
|
1138 |
else if( winCount == 1 ) |
|
1139 |
{ |
|
1140 |
// This checks to see if a dialog is launched and if that is the case, then |
|
1141 |
// the current window is being used, hence returning true. |
|
1142 |
if( iDialogsProvider->IsDialogLaunched() ) |
|
1143 |
{ |
|
1144 |
ret = ETrue; |
|
1145 |
} |
|
1146 |
else |
|
1147 |
{ |
|
1148 |
ret = WindowMgr().IsContentExist(); |
|
1149 |
} |
|
1150 |
} |
|
1151 |
// else (winCount == 0), no content view -> no page loaded |
|
1152 |
return ret; |
|
1153 |
} |
|
1154 |
||
1155 |
// ----------------------------------------------------------------------------- |
|
1156 |
// CBrowserAppUi::Fetching() |
|
1157 |
// ----------------------------------------------------------------------------- |
|
1158 |
// |
|
1159 |
TBool CBrowserAppUi::Fetching() const |
|
1160 |
{ |
|
1161 |
// TO DO: |
|
1162 |
// use load obs., remove ifetchstate from this class and use from loadobs. |
|
1163 |
// iLoadState |
|
1164 |
//return ( iFetchState == MFetchObserver::ELoadStart ); |
|
1165 |
#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF |
|
1166 |
if (!iStartedUp) // ContentView is not yet started up, so we are not fetching |
|
1167 |
return EFalse; |
|
1168 |
else |
|
1169 |
#endif |
|
1170 |
return ( LoadObserver().LoadState() != CBrowserLoadObserver::ELoadStateIdle ); |
|
1171 |
} |
|
1172 |
// ----------------------------------------------------------------------------- |
|
1173 |
// CBrowserAppUi::ContentDisplayed() |
|
1174 |
// ----------------------------------------------------------------------------- |
|
1175 |
// |
|
1176 |
TBool CBrowserAppUi::ContentDisplayed() const |
|
1177 |
{ |
|
1178 |
return ( LoadObserver().ContentDisplayed() ); |
|
1179 |
} |
|
1180 |
||
1181 |
// ----------------------------------------------------------------------------- |
|
1182 |
// CBrowserAppUi::SetContentDisplayed() |
|
1183 |
// ----------------------------------------------------------------------------- |
|
1184 |
// |
|
1185 |
void CBrowserAppUi::SetContentDisplayed(TBool aValue) |
|
1186 |
{ |
|
1187 |
LoadObserver().SetContentDisplayed( aValue ); |
|
1188 |
} |
|
1189 |
// ----------------------------------------------------------------------------- |
|
1190 |
// CBrowserAppUi::FetchBookmarkL |
|
1191 |
// ----------------------------------------------------------------------------- |
|
1192 |
// |
|
1193 |
void CBrowserAppUi::FetchBookmarkL( TInt aBookmarkUid ) |
|
1194 |
{ |
|
1195 |
// complete initialization if not done yet, can happen if user selects |
|
1196 |
// a bookmark quickly after launch (within 1 second) |
|
1197 |
if ( !iStartedUp ) |
|
1198 |
CompleteDelayedInit(); |
|
1199 |
||
1200 |
SetViewToReturnOnClose( KUidBrowserBookmarksViewId ); |
|
1201 |
if ( aBookmarkUid == KFavouritesStartPageUid ) |
|
1202 |
{ |
|
1203 |
TUint defaultAp = Preferences().DefaultAccessPoint(); |
|
1204 |
if ( defaultAp != KWmlNoDefaultAccessPoint ) // There is no access point defined |
|
1205 |
{ |
|
1206 |
CApAccessPointItem* apItem = Preferences().AllPreferencesL().iDefaultAPDetails; |
|
1207 |
if ( apItem ) |
|
1208 |
{ |
|
1209 |
const HBufC* currentHP = apItem->ReadConstLongTextL( EApWapStartPage ); |
|
1210 |
//TPtrC currentHP(apItem->StartPage()); // Get the start page of the access point. |
|
1211 |
TFavouritesWapAp accessPoint; |
|
1212 |
||
1213 |
FetchL( *currentHP, KNullDesC, KNullDesC, accessPoint, |
|
1214 |
CBrowserLoadObserver::ELoadUrlTypeStartPage ); // Fetch the start page. |
|
1215 |
} |
|
1216 |
} |
|
1217 |
} |
|
1218 |
else |
|
1219 |
{ |
|
1220 |
RFavouritesDb db; |
|
1221 |
User::LeaveIfError( db.Open( iFavouritesSess, KBrowserBookmarks ) ); |
|
1222 |
CleanupClosePushL<RFavouritesDb>( db ); |
|
1223 |
||
1224 |
CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1225 |
User::LeaveIfError( db.Get( aBookmarkUid, *item ) ); |
|
1226 |
||
1227 |
FetchBookmarkL( *item ); |
|
1228 |
CleanupStack::PopAndDestroy( 2 ); // item, db |
|
1229 |
} |
|
1230 |
} |
|
1231 |
||
1232 |
// ----------------------------------------------------------------------------- |
|
1233 |
// CBrowserAppUi::FetchBookmarkL |
|
1234 |
// ----------------------------------------------------------------------------- |
|
1235 |
// |
|
1236 |
void CBrowserAppUi::FetchBookmarkL( const CFavouritesItem& aBookmarkItem ) |
|
1237 |
{ |
|
1238 |
// complete initialization if not done yet, can happen if user selects |
|
1239 |
// a bookmark quickly after launch (within 1 second) |
|
1240 |
if ( !iStartedUp ) |
|
1241 |
CompleteDelayedInit(); |
|
1242 |
||
1243 |
SetViewToReturnOnClose( KUidBrowserBookmarksViewId ); |
|
1244 |
if ( Util::CheckBookmarkApL( *this, aBookmarkItem.WapAp()) ) |
|
1245 |
FetchL |
|
1246 |
( |
|
1247 |
aBookmarkItem.Url() , |
|
1248 |
aBookmarkItem.UserName(), |
|
1249 |
aBookmarkItem.Password(), |
|
1250 |
aBookmarkItem.WapAp(), |
|
1251 |
CBrowserLoadObserver::ELoadUrlTypeOther |
|
1252 |
); |
|
1253 |
else |
|
1254 |
TBrowserDialogs::ErrorNoteL( R_WML_INVALID_AP ); |
|
1255 |
} |
|
1256 |
||
1257 |
// ----------------------------------------------------------------------------- |
|
1258 |
// CBrowserAppUi::SetViewToBeActivatedIfNeededL |
|
1259 |
// ----------------------------------------------------------------------------- |
|
1260 |
// |
|
1261 |
void CBrowserAppUi::SetViewToBeActivatedIfNeededL( TUid aUid, TInt aMessageId ) |
|
1262 |
{ |
|
1263 |
CBrowserAppDocument* doc = STATIC_CAST(CBrowserAppDocument*, Document()); |
|
1264 |
||
1265 |
if((iCurrentView != aUid) && (aUid != KUidBrowserSettingsViewId)) |
|
1266 |
{ |
|
1267 |
iPreviousView = iCurrentView; |
|
1268 |
iCurrentView = aUid; |
|
1269 |
} |
|
1270 |
||
1271 |
//Check view id validity first |
|
1272 |
if ( aUid == KUidBrowserNullViewId ) |
|
1273 |
{ |
|
1274 |
SetLastActiveViewId( KUidBrowserBookmarksViewId ); |
|
1275 |
SetViewToBeActivatedIfNeededL( LastActiveViewId() ); |
|
1276 |
return; |
|
1277 |
} |
|
1278 |
||
1279 |
if ( ( aUid != KUidBrowserContentViewId ) && |
|
1280 |
( LastActiveViewId() == KUidBrowserContentViewId ) ) |
|
1281 |
{ |
|
1282 |
ContentView()->SetFullScreenOffL(); |
|
1283 |
} |
|
1284 |
||
1285 |
if ( iWindowManager && iWindowManager->ContentView()->FullScreenMode() ) |
|
1286 |
{ |
|
1287 |
if ( aUid == KUidBrowserFeedsFeedViewId ) |
|
1288 |
{ |
|
1289 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + |
|
1290 |
(TInt)TBrCtlDefs::ECommandLeaveFullscreenBrowsing ); |
|
1291 |
} |
|
1292 |
||
1293 |
else if ( aUid != KUidBrowserFeedsTopicViewId && |
|
1294 |
aUid != KUidBrowserFeedsFolderViewId && |
|
1295 |
aUid != KUidBrowserBookmarksViewId ) |
|
1296 |
{ |
|
1297 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + |
|
1298 |
(TInt)TBrCtlDefs::ECommandEnterFullscreenBrowsing ); |
|
1299 |
} |
|
1300 |
} |
|
1301 |
||
1302 |
||
1303 |
if ( iIsForeground ) |
|
1304 |
{ |
|
1305 |
if ( aUid == KUidBrowserSettingsViewId ) |
|
1306 |
{ |
|
1307 |
//complete initialisation |
|
1308 |
if( !iStartedUp ) |
|
1309 |
CompleteDelayedInit(); |
|
1310 |
||
1311 |
CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, |
|
1312 |
CEikonEnv::Static()->EikAppUi() ) |
|
1313 |
->StatusPane(); |
|
1314 |
sp->DrawNow(); |
|
1315 |
} |
|
1316 |
||
1317 |
ActivateLocalViewL( aUid, TUid::Uid( aMessageId ), KNullDesC8 ); |
|
1318 |
} |
|
1319 |
else |
|
1320 |
{ |
|
1321 |
iViewToBeActivatedIfNeeded = aUid; |
|
1322 |
} |
|
1323 |
} |
|
1324 |
||
1325 |
// ----------------------------------------------------------------------------- |
|
1326 |
// CBrowserAppUi::LastActiveViewId |
|
1327 |
// ----------------------------------------------------------------------------- |
|
1328 |
// |
|
1329 |
TUid CBrowserAppUi::LastActiveViewId() const |
|
1330 |
{ |
|
1331 |
return iLastViewId; |
|
1332 |
} |
|
1333 |
||
1334 |
// ----------------------------------------------------------------------------- |
|
1335 |
// CBrowserAppUi::SetLastActiveViewId |
|
1336 |
// ----------------------------------------------------------------------------- |
|
1337 |
// |
|
1338 |
void CBrowserAppUi::SetLastActiveViewId( TUid aUid ) |
|
1339 |
{ |
|
1340 |
LOG_ENTERFN("CBrowserAppUi::SetLastActiveViewId"); |
|
1341 |
LOG_WRITE_FORMAT(" SetLastActiveViewId: %d", aUid); |
|
1342 |
iLastViewId = aUid; |
|
1343 |
} |
|
1344 |
||
1345 |
// ----------------------------------------------------------------------------- |
|
1346 |
// CBrowserAppUi::ExitInProgress |
|
1347 |
// ----------------------------------------------------------------------------- |
|
1348 |
// |
|
1349 |
TBool CBrowserAppUi::ExitInProgress() const |
|
1350 |
{ |
|
1351 |
return iExitInProgress; |
|
1352 |
} |
|
1353 |
||
1354 |
// ----------------------------------------------------------------------------- |
|
1355 |
// CBrowserAppUi::ExitInProgress |
|
1356 |
// ----------------------------------------------------------------------------- |
|
1357 |
// |
|
1358 |
void CBrowserAppUi::SetExitInProgress( TBool aValue ) |
|
1359 |
{ |
|
1360 |
iExitInProgress = aValue; |
|
1361 |
} |
|
1362 |
||
1363 |
// ----------------------------------------------------------------------------- |
|
1364 |
// CBrowserAppUi::IsConnecting |
|
1365 |
// ----------------------------------------------------------------------------- |
|
1366 |
// |
|
1367 |
TBool CBrowserAppUi::IsConnecting() const |
|
1368 |
{ |
|
1369 |
return ( LoadObserver().LoadState() != CBrowserLoadObserver::ELoadStateIdle ); |
|
1370 |
} |
|
1371 |
||
1372 |
// ----------------------------------------------------------------------------- |
|
1373 |
// CBrowserAppUi::HandleForegroundEventL |
|
1374 |
// ----------------------------------------------------------------------------- |
|
1375 |
// |
|
1376 |
void CBrowserAppUi::HandleForegroundEventL( TBool aForeground ) |
|
1377 |
{ |
|
1378 |
// Handle this event only if the browser is started up |
|
1379 |
iIsForeground = IsForeground(); |
|
1380 |
if (!iStartedUp) |
|
1381 |
return; |
|
1382 |
||
1383 |
if( iIsForeground ) |
|
1384 |
{ |
|
1385 |
if (iViewToBeActivatedIfNeeded.iUid) |
|
1386 |
{ |
|
1387 |
ActivateLocalViewL( iViewToBeActivatedIfNeeded ); |
|
1388 |
} |
|
1389 |
else |
|
1390 |
{ |
|
1391 |
TVwsViewId activeViewId; |
|
1392 |
if( ( GetActiveViewId( activeViewId ) == KErrNone ) && |
|
1393 |
( LastActiveViewId() != activeViewId.iViewUid ) ) |
|
1394 |
{ |
|
1395 |
// LastActiveViewId() might return with 0! |
|
1396 |
TRAP_IGNORE( ActivateLocalViewL( LastActiveViewId() ) ); |
|
1397 |
} |
|
1398 |
} |
|
1399 |
} |
|
1400 |
iViewToBeActivatedIfNeeded.iUid = 0; |
|
1401 |
CAknViewAppUi::HandleForegroundEventL( aForeground ); |
|
1402 |
||
1403 |
if( iIsForeground ) |
|
1404 |
{ |
|
1405 |
if ( Preferences().FullScreen() == EWmlSettingsFullScreenFullScreen ) |
|
1406 |
{ |
|
1407 |
ContentView()->UpdateFullScreenL(); |
|
1408 |
} |
|
1409 |
||
1410 |
if( !Fetching() ) |
|
1411 |
{ |
|
1412 |
Display().StopProgressAnimationL(); |
|
1413 |
} |
|
1414 |
} |
|
1415 |
||
1416 |
if (iWindowManager) |
|
1417 |
{ |
|
1418 |
iWindowManager->SendCommandToAllWindowsL( iIsForeground |
|
1419 |
? (TInt)TBrCtlDefs::ECommandAppForeground + (TInt)TBrCtlDefs::ECommandIdBase |
|
1420 |
: (TInt)TBrCtlDefs::ECommandAppBackground + (TInt)TBrCtlDefs::ECommandIdBase); |
|
1421 |
} |
|
1422 |
||
1423 |
// if browser comes to foreground and exit is requested, |
|
1424 |
// asyncronous exit is started |
|
1425 |
if( iIsForeground && iExitFromEmbeddedMode && !IsEmbeddedInOperatorMenu() ) |
|
1426 |
{ |
|
1427 |
iBrowserAsyncExit->Start(); |
|
1428 |
} |
|
1429 |
} |
|
1430 |
||
1431 |
// ----------------------------------------------------------------------------- |
|
1432 |
// CBrowserAppUi::FetchL |
|
1433 |
// ----------------------------------------------------------------------------- |
|
1434 |
// |
|
1435 |
void CBrowserAppUi::FetchL( |
|
1436 |
const TDesC& aUrl, |
|
1437 |
const TDesC& aUsername, |
|
1438 |
const TDesC& aPassword, |
|
1439 |
const TFavouritesWapAp& aAccessPoint, |
|
1440 |
CBrowserLoadObserver::TBrowserLoadUrlType aUrlType ) |
|
1441 |
{ |
|
1442 |
LOG_ENTERFN("CBrowserAppUi::FetchL"); |
|
1443 |
||
1444 |
// complete the initialization if not done yet |
|
1445 |
if(!iStartedUp) |
|
1446 |
CompleteDelayedInit(); |
|
1447 |
||
1448 |
// Let's cancel the previous fetch if any |
|
1449 |
if ( Fetching() ) |
|
1450 |
{ |
|
1451 |
CancelFetch(); |
|
1452 |
} |
|
1453 |
#ifndef __WINS__ |
|
1454 |
//Fix for bookmark specific access point |
|
1455 |
if( iConnection && iConnection->Connected() ) |
|
1456 |
{ |
|
1457 |
TUint32 passedIap( 0 ); |
|
1458 |
if ( aAccessPoint.ApId() != KWmlNoDefaultAccessPoint ) |
|
1459 |
{ |
|
1460 |
passedIap = Util::IapIdFromWapIdL( *this, aAccessPoint.ApId()); |
|
1461 |
BROWSER_LOG((_L("CBrowserAppUi::FetchL Passed Iap: %d"), passedIap)); |
|
1462 |
TUint32 connectedAp = iConnection->CurrentAPId(); |
|
1463 |
BROWSER_LOG((_L("CBrowserAppUi::FetchL Existing connected Iap: %d"), connectedAp)); |
|
1464 |
if(passedIap != connectedAp) |
|
1465 |
{ |
|
1466 |
StopConnectionObserving(); |
|
1467 |
BROWSER_LOG((_L("CBrowserAppUi::FetchL Stopped the connection observation."))); |
|
1468 |
DisconnectL(); |
|
1469 |
BROWSER_LOG((_L("CBrowserAppUi::FetchL Given iap and Connected iap are not same. Disconnected the existing connection."))); |
|
1470 |
} |
|
1471 |
} |
|
1472 |
||
1473 |
} |
|
1474 |
#endif // __WINS__ |
|
1475 |
// iDoNotRestoreContentFlag = EFalse; |
|
1476 |
||
1477 |
TInt toPop = 0; |
|
1478 |
TUriParser uriParser; |
|
1479 |
TInt err = uriParser.Parse(aUrl); |
|
1480 |
if ( !err && aUrl.Length() ) |
|
1481 |
{ |
|
1482 |
// check url for missing scheme and add default scheme if needed |
|
1483 |
HBufC* url = NULL; |
|
1484 |
HBufC* resultUrlBuf = NULL; |
|
1485 |
//find :// |
|
1486 |
TPtrC scheme = uriParser.Extract( EUriScheme ); |
|
1487 |
// add http:// scheme as default if it is missing |
|
1488 |
if( scheme.Length() == 0 ) |
|
1489 |
{ |
|
1490 |
//put the "http://" schema before the string |
|
1491 |
url = HBufC::NewLC( aUrl.Length() + KDefaultSchemaLength ); |
|
1492 |
url->Des().Copy( KDefaultSchema ); |
|
1493 |
url->Des().Append( aUrl ); |
|
1494 |
++toPop; // url |
|
1495 |
resultUrlBuf = CreateFullUrlLC( url->Des(), aUsername, aPassword ); |
|
1496 |
LogRequestedPageToRecentUrlL( url->Des() ); |
|
1497 |
} |
|
1498 |
else |
|
1499 |
{ |
|
1500 |
resultUrlBuf = CreateFullUrlLC( aUrl, aUsername, aPassword ); |
|
1501 |
LogRequestedPageToRecentUrlL( aUrl ); |
|
1502 |
} |
|
1503 |
++toPop; // resultUrlBuf |
|
1504 |
||
1505 |
||
1506 |
if ( aAccessPoint.IsNull() || aAccessPoint.IsDefault() || (!Util::IsValidAPFromParamL( *this, aAccessPoint.ApId() )) ) |
|
1507 |
{ |
|
1508 |
if ( (Preferences().AccessPointSelectionMode() == EConnectionMethod) || |
|
1509 |
(Preferences().AccessPointSelectionMode() == EAlwaysAsk) ) |
|
1510 |
{ |
|
1511 |
iRequestedAp = Preferences().DefaultAccessPoint(); |
|
1512 |
} |
|
1513 |
else if ( Preferences().AccessPointSelectionMode() == EDestination ) |
|
1514 |
{ |
|
1515 |
// for bug fix MLAN-7EKFV4 |
|
1516 |
iRequestedAp = KWmlNoDefaultAccessPoint; |
|
1517 |
} |
|
1518 |
} |
|
1519 |
else |
|
1520 |
{ |
|
1521 |
iRequestedAp = aAccessPoint.ApId(); |
|
1522 |
} |
|
1523 |
#ifndef __WINSCW__ //On WINS we don't want this dlg to come up |
|
1524 |
//as the ConnMan will present us with a selection |
|
1525 |
BROWSER_LOG( ( _L( "requestedAp: %d" ), iRequestedAp ) ); |
|
1526 |
// it's ok to assign in the case of EDest, since CBrCtl doesn't use the apId passed in LoadUrlL() |
|
1527 |
TUint32 IAPid = iRequestedAp; |
|
1528 |
TUint32 defaultSnap = iPreferences->DefaultSnapId(); |
|
1529 |
#ifndef BRDO_OCC_ENABLED_FF |
|
1530 |
// if no AP or SNAP is defined, define it |
|
1531 |
if( (iRequestedAp == KWmlNoDefaultAccessPoint && iPreferences->AccessPointSelectionMode() == EConnectionMethod) || |
|
1532 |
(defaultSnap == KWmlNoDefaultSnapId && iPreferences->AccessPointSelectionMode() == EDestination) ) |
|
1533 |
{ |
|
1534 |
StartPreferencesViewL( EShowAlwaysAsk | EShowDestinations | EShowConnectionMethods ); |
|
1535 |
} |
|
1536 |
//Check AP and snap if it is still not defined, set always ask mode this case |
|
1537 |
if ( (iRequestedAp == KWmlNoDefaultAccessPoint && iPreferences->AccessPointSelectionMode() == EConnectionMethod) || |
|
1538 |
(defaultSnap == KWmlNoDefaultSnapId && iPreferences->AccessPointSelectionMode() == EDestination) ) |
|
1539 |
{ |
|
1540 |
BROWSER_LOG( ( _L( "AP or SNAP was not added set to Always ask mode" ) ) ); |
|
1541 |
iPreferences->SetAccessPointSelectionModeL(EAlwaysAsk ); |
|
1542 |
} |
|
1543 |
if ( iRequestedAp != KWmlNoDefaultAccessPoint ) |
|
1544 |
{ |
|
1545 |
BROWSER_LOG( ( _L( "AP added" ) ) ); |
|
1546 |
IAPid = Util::IapIdFromWapIdL( *this, iRequestedAp ); // Get currently active ap |
|
1547 |
BROWSER_LOG( ( _L( "Access point: %d" ), IAPid ) ); |
|
1548 |
} |
|
1549 |
||
1550 |
#endif // BRDO_OCC_ENABLED_FF |
|
1551 |
#else //we can use any numbers here |
|
1552 |
// alr: snap on emulator should not exist; use cm mode instead? |
|
1553 |
iRequestedAp = 2; |
|
1554 |
TUint32 IAPid = 2; |
|
1555 |
#endif //__WINSCW__ |
|
1556 |
||
1557 |
err = KErrNone; |
|
1558 |
BROWSER_LOG( ( _L( "Load the URL" ) ) ); |
|
1559 |
||
1560 |
if ( iPreferences->SearchFeature() || iPreferences->ServiceFeature()) |
|
1561 |
{ |
|
1562 |
iSpecialSchemeinAddress = EFalse; |
|
1563 |
||
1564 |
HBufC* searchScheme = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack |
|
1565 |
TPtr searchSchemePtr( searchScheme->Des() ); |
|
1566 |
++toPop; |
|
1567 |
||
1568 |
HBufC* serviceScheme = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack |
|
1569 |
TPtr serviceSchemePtr( serviceScheme->Des() ); |
|
1570 |
++toPop; |
|
1571 |
||
1572 |
iPreferences->GetStringValueL( KBrowserSearchProviderUrl, KMaxHomePgUrlLength, searchSchemePtr ); |
|
1573 |
iPreferences->GetStringValueL( KBrowserServiceUrl, KMaxHomePgUrlLength, serviceSchemePtr ); |
|
1574 |
||
1575 |
TInt err = uriParser.Parse(searchSchemePtr); |
|
1576 |
if (!err) |
|
1577 |
searchSchemePtr = uriParser.Extract( EUriScheme ); |
|
1578 |
||
1579 |
err = uriParser.Parse(serviceSchemePtr); |
|
1580 |
if (!err) |
|
1581 |
serviceSchemePtr = uriParser.Extract( EUriScheme ); |
|
1582 |
||
1583 |
||
1584 |
if( scheme.Length() != 0 && (!scheme.Compare(serviceSchemePtr) || !scheme.Compare(searchSchemePtr)) ) |
|
1585 |
{ |
|
1586 |
iSpecialSchemeinAddress = ETrue; |
|
1587 |
TRAP( err, BrCtlInterface().LoadUrlL( resultUrlBuf->Des(), IAPid ) ); |
|
1588 |
} |
|
1589 |
else |
|
1590 |
{ |
|
1591 |
LoadObserver().DoStartLoad( aUrlType ); |
|
1592 |
TRAP( err, BrCtlInterface().LoadUrlL( resultUrlBuf->Des(), IAPid ) ); |
|
1593 |
} |
|
1594 |
} |
|
1595 |
else |
|
1596 |
{ |
|
1597 |
LoadObserver().DoStartLoad( aUrlType ); |
|
1598 |
BROWSER_LOG( ( _L( "PASSED IAP: %d" ), IAPid ) ); |
|
1599 |
TRAP( err, BrCtlInterface().LoadUrlL( resultUrlBuf->Des(), IAPid ) ); |
|
1600 |
} |
|
1601 |
||
1602 |
CleanupStack::PopAndDestroy(toPop); //resultUrlBuf and url if needed |
|
1603 |
BROWSER_LOG( ( _L( "No AP 4 %d" ), err ) ); |
|
1604 |
if ( err != KErrNone ) |
|
1605 |
{ |
|
1606 |
CancelFetch(); |
|
1607 |
} |
|
1608 |
} |
|
1609 |
||
1610 |
BROWSER_LOG( ( _L( "Check the result" ) ) ); |
|
1611 |
switch ( err ) |
|
1612 |
{ |
|
1613 |
case KErrNotFound: |
|
1614 |
{ |
|
1615 |
(*(CBrowserBookmarksView*)View( KUidBrowserBookmarksViewId )).UpdateGotoPaneL(); |
|
1616 |
iCoeEnv->HandleError( KBrsrMalformedUrl ); |
|
1617 |
BROWSER_LOG( ( _L( "KErrNotFound" ) ) ); |
|
1618 |
break; |
|
1619 |
} |
|
1620 |
case KUriUtilsErrInvalidUri: // return value of TUriParser::Parse |
|
1621 |
{ |
|
1622 |
(*(CBrowserBookmarksView*)View( KUidBrowserBookmarksViewId )).UpdateGotoPaneL(); |
|
1623 |
iCoeEnv->HandleError( KBrsrUnknownScheme ); |
|
1624 |
BROWSER_LOG( ( _L( "KUriUtilsErrInvalidUri" ) ) ); |
|
1625 |
break; |
|
1626 |
} |
|
1627 |
case KErrNone: |
|
1628 |
{ |
|
1629 |
BROWSER_LOG( ( _L( "KErrNone" ) ) ); |
|
1630 |
ContentView()->ResetPreviousViewFlag(); |
|
1631 |
break; |
|
1632 |
} |
|
1633 |
case KErrCancel: |
|
1634 |
{ |
|
1635 |
BROWSER_LOG( ( _L( "KErrCancel" ) ) ); |
|
1636 |
// do nothing, it is already cancelled by CancelFetch(). |
|
1637 |
break; |
|
1638 |
} |
|
1639 |
default: |
|
1640 |
{ |
|
1641 |
BROWSER_LOG( ( _L( "default" ) ) ); |
|
1642 |
User::Leave( err ); // pass error code to caller |
|
1643 |
break; |
|
1644 |
} |
|
1645 |
} |
|
1646 |
} |
|
1647 |
||
1648 |
// ----------------------------------------------------------------------------- |
|
1649 |
// CBrowserAppUi::ExitBrowser() |
|
1650 |
// ----------------------------------------------------------------------------- |
|
1651 |
// |
|
1652 |
void CBrowserAppUi::ExitBrowser( TBool aUserInitiated ) |
|
1653 |
{ |
|
1654 |
LOG_ENTERFN("CBrowserAppUi::ExitBrowser"); |
|
1655 |
||
1656 |
TInt err( KErrNone ); |
|
1657 |
TBool isStandAlone = !IsEmbeddedModeOn(); |
|
1658 |
BROWSER_LOG( ( _L( " isStandAlone: %d" ), isStandAlone ) ); |
|
1659 |
||
1660 |
if(isStandAlone && aUserInitiated ) |
|
1661 |
{ |
|
1662 |
if( iStartedUp && !BrCtlInterface().OkToExit() ) |
|
1663 |
{ |
|
1664 |
return; |
|
1665 |
} |
|
1666 |
} |
|
1667 |
||
1668 |
//If launch with parameters is in progress, do not exit now |
|
1669 |
//as it can lead to synchronisation problems in embedded mode |
|
1670 |
if ( iParametrizedLaunchInProgress == 1 ) |
|
1671 |
{ |
|
1672 |
BROWSER_LOG( ( _L( " iParametrizedLaunchInProgress" ) ) ); |
|
1673 |
return; |
|
1674 |
} |
|
1675 |
||
1676 |
// Operator feature - Display confirmation note on exit only if exit is initiated by user. |
|
1677 |
// Skip displaying exit confirmation if exit is initiated from fast swap window. |
|
1678 |
BROWSER_LOG( ( _L( " iPreferences: %d" ), iPreferences ) ); |
|
1679 |
if ( iPreferences->QueryOnExit() && aUserInitiated ) |
|
1680 |
{ |
|
1681 |
BROWSER_LOG( ( _L( " iPreferences->QueryOnExit()" ) ) ); |
|
1682 |
TBool confirmdialog( EFalse ); |
|
1683 |
TRAP( err, confirmdialog = TBrowserDialogs::ConfirmQueryYesNoL( R_TEXT_WML_EXIT_CONFIRM ) ); |
|
1684 |
if ( !confirmdialog ) |
|
1685 |
{ |
|
1686 |
return; |
|
1687 |
} |
|
1688 |
} |
|
1689 |
||
1690 |
//delete attacment from mailer if existing |
|
1691 |
CCoeEnv::Static()->FsSession().Delete( KAttachment() ); |
|
1692 |
||
1693 |
BROWSER_LOG( ( _L(" iConnection: %d"), iConnection ) ); |
|
1694 |
BROWSER_LOG( ( _L(" iExitFromEmbeddedMode: %d"), iExitFromEmbeddedMode ) ); |
|
1695 |
// if browser is embedded, should not call Exit(), |
|
1696 |
// just delete the object, otherwise leave occurs. |
|
1697 |
if( ( IsEmbeddedInOperatorMenu() || IsEmbeddedModeOn() ) && |
|
1698 |
!ExitInProgress() && iStartedUp && |
|
1699 |
((LoadObserver().LoadUrlType() == CBrowserLoadObserver::ELoadUrlTypeEmbeddedBrowserWithUrl) || |
|
1700 |
(LoadObserver().LoadUrlType() == CBrowserLoadObserver::ELoadUrlTypeOther) ) ) |
|
1701 |
// ELoadUrlTypeEmbeddedBrowserWithUrl is typical for load via Phonebook, MMS, OperatorMenu |
|
1702 |
// ELoadUrlTypeOther is typical via Media download since those are via GotoPane entered urls |
|
1703 |
{ |
|
1704 |
// Simulate an escape key event in order to close any open resources (for example an open dialog) |
|
1705 |
TKeyEvent keyEvent; |
|
1706 |
keyEvent.iModifiers = 0; |
|
1707 |
keyEvent.iRepeats = 0; |
|
1708 |
keyEvent.iCode = EKeyEscape; |
|
1709 |
keyEvent.iScanCode = EStdKeyEscape; |
|
1710 |
TRAP_IGNORE(iCoeEnv->SimulateKeyEventL( keyEvent, EEventKey )); |
|
1711 |
||
1712 |
// force not to load Exit() when next time call this function, |
|
1713 |
// just delete the object |
|
1714 |
SetExitFromEmbeddedMode( ETrue ); |
|
1715 |
SetExitInProgress( ETrue ); |
|
1716 |
BROWSER_LOG( ( _L( " iBrowserAsyncExit->Start()" ) ) ); |
|
1717 |
iBrowserAsyncExit->Start(); |
|
1718 |
} |
|
1719 |
else if( iExitFromEmbeddedMode ) |
|
1720 |
{ |
|
1721 |
BROWSER_LOG( ( _L( " delete this;" ) ) ); |
|
1722 |
if ( iConnection ) |
|
1723 |
{ |
|
1724 |
TRAP_IGNORE( SendDisconnectEventL() ); |
|
1725 |
iConnection->Disconnect(); |
|
1726 |
#ifdef __RSS_FEEDS |
|
1727 |
BROWSER_LOG( ( _L( " iFeedsClientUtilities->DisconnectFeedsViewL()" ) ) ); |
|
1728 |
if ( iFeedsClientUtilities ) |
|
1729 |
{ |
|
1730 |
TRAP_IGNORE( iFeedsClientUtilities->DisconnectFeedsViewL() ); |
|
1731 |
//notify feeds engine to close the connection |
|
1732 |
TRAP_IGNORE( iFeedsClientUtilities->DisconnectManualUpdateConnectionL() ); |
|
1733 |
} |
|
1734 |
#endif |
|
1735 |
} |
|
1736 |
if (iStartedUp && SpecialLoadObserver().IsConnectionStarted()) |
|
1737 |
{ |
|
1738 |
BROWSER_LOG( ( _L( " iWindowManager->SetUserExit( iUserExit )" ) ) ); |
|
1739 |
iWindowManager->SetUserExit( iUserExit ); |
|
1740 |
delete iWindowManager; |
|
1741 |
BROWSER_LOG( ( _L( " User::Exit(KErrNone)" ) ) ); |
|
1742 |
User::Exit(KErrNone); |
|
1743 |
} |
|
1744 |
else |
|
1745 |
{ |
|
1746 |
PrepareToExit(); |
|
1747 |
Exit(); |
|
1748 |
} |
|
1749 |
} |
|
1750 |
else |
|
1751 |
{ |
|
1752 |
BROWSER_LOG( ( _L( " Exit()" ) ) ); |
|
1753 |
if ( iConnection ) |
|
1754 |
{ |
|
1755 |
TRAP_IGNORE( SendDisconnectEventL() ); |
|
1756 |
iConnection->Disconnect(); |
|
1757 |
#ifdef __RSS_FEEDS |
|
1758 |
if ( iFeedsClientUtilities ) |
|
1759 |
{ |
|
1760 |
BROWSER_LOG( ( _L( " iFeedsClientUtilities->DisconnectFeedsViewL()" ) ) ); |
|
1761 |
TRAP_IGNORE( iFeedsClientUtilities->DisconnectFeedsViewL() ); |
|
1762 |
//notify feeds engine to close the connection |
|
1763 |
TRAP_IGNORE( iFeedsClientUtilities->DisconnectManualUpdateConnectionL() ); |
|
1764 |
} |
|
1765 |
#endif |
|
1766 |
} |
|
1767 |
if (iStartedUp && SpecialLoadObserver().IsConnectionStarted()) // If Connection request is in processing calling CAknAppUI::Exit() causes crash (JSAA-84RG9R) |
|
1768 |
{ |
|
1769 |
//ensure that the params are saved in BrCtl |
|
1770 |
if ( iWindowManager ) |
|
1771 |
{ |
|
1772 |
BROWSER_LOG( ( _L( " iWindowManager->SetUserExit( iUserExit )" ) ) ); |
|
1773 |
iWindowManager->SetUserExit( iUserExit ); |
|
1774 |
} |
|
1775 |
delete iWindowManager; |
|
1776 |
BROWSER_LOG( ( _L( " User::Exit(KErrNone)" ) ) ); |
|
1777 |
User::Exit(KErrNone); |
|
1778 |
} |
|
1779 |
else |
|
1780 |
{ |
|
1781 |
// normal exit |
|
1782 |
Exit(); |
|
1783 |
} |
|
1784 |
} |
|
1785 |
} |
|
1786 |
||
1787 |
// ----------------------------------------------------------------------------- |
|
1788 |
// CBrowserAppUi::Display |
|
1789 |
// ----------------------------------------------------------------------------- |
|
1790 |
// |
|
1791 |
MDisplay& CBrowserAppUi::Display() const |
|
1792 |
{ |
|
1793 |
CBrowserWindow *window = iWindowManager->CurrentWindow(); |
|
1794 |
__ASSERT_DEBUG( window, Util::Panic( Util::EUninitializedData ) ); |
|
1795 |
return window->Display(); |
|
1796 |
} |
|
1797 |
||
1798 |
// ----------------------------------------------------------------------------- |
|
1799 |
// CBrowserAppUi::SoftkeysObserver() |
|
1800 |
// ----------------------------------------------------------------------------- |
|
1801 |
// |
|
1802 |
CBrowserSoftkeysObserver& CBrowserAppUi::SoftkeysObserver() const |
|
1803 |
{ |
|
1804 |
CBrowserWindow *window = iWindowManager->CurrentWindow(); |
|
1805 |
__ASSERT_DEBUG( window, Util::Panic( Util::EUninitializedData ) ); |
|
1806 |
return window->SoftkeysObserver(); |
|
1807 |
} |
|
1808 |
||
1809 |
// ----------------------------------------------------------------------------- |
|
1810 |
// CBrowserAppUi::CommsModel |
|
1811 |
// ----------------------------------------------------------------------------- |
|
1812 |
// |
|
1813 |
MCommsModel& CBrowserAppUi::CommsModel() const |
|
1814 |
{ |
|
1815 |
__ASSERT_DEBUG( iCommsModel, |
|
1816 |
Util::Panic( Util::EUninitializedData ) ); |
|
1817 |
return *iCommsModel; |
|
1818 |
} |
|
1819 |
||
1820 |
// ----------------------------------------------------------------------------- |
|
1821 |
// CBrowserAppUi::Preferences |
|
1822 |
// ----------------------------------------------------------------------------- |
|
1823 |
// |
|
1824 |
MPreferences& CBrowserAppUi::Preferences() const |
|
1825 |
{ |
|
1826 |
__ASSERT_DEBUG( iPreferences, |
|
1827 |
Util::Panic( Util::EUninitializedData ) ); |
|
1828 |
return *iPreferences; |
|
1829 |
} |
|
1830 |
||
1831 |
// ----------------------------------------------------------------------------- |
|
1832 |
// CBrowserAppUi::Connection |
|
1833 |
// ----------------------------------------------------------------------------- |
|
1834 |
// |
|
1835 |
MConnection& CBrowserAppUi::Connection() const |
|
1836 |
{ |
|
1837 |
__ASSERT_DEBUG( iConnection, |
|
1838 |
Util::Panic( Util::EUninitializedData ) ); |
|
1839 |
return *iConnection; |
|
1840 |
} |
|
1841 |
||
1842 |
// ----------------------------------------------------------------------------- |
|
1843 |
// CBrowserAppUi::BrCtlInterface |
|
1844 |
// ----------------------------------------------------------------------------- |
|
1845 |
CBrCtlInterface& CBrowserAppUi::BrCtlInterface() const |
|
1846 |
{ |
|
1847 |
CBrowserWindow *window = iWindowManager->CurrentWindow(); |
|
1848 |
__ASSERT_DEBUG( window, Util::Panic( Util::EUninitializedData ) ); |
|
1849 |
return window->BrCtlInterface(); |
|
1850 |
} |
|
1851 |
||
1852 |
// ----------------------------------------------------------------------------- |
|
1853 |
// CBrowserAppUi::LoadObserver |
|
1854 |
// ----------------------------------------------------------------------------- |
|
1855 |
// |
|
1856 |
CBrowserLoadObserver& CBrowserAppUi::LoadObserver() const |
|
1857 |
{ |
|
1858 |
CBrowserWindow *window = iWindowManager->CurrentWindow(); |
|
1859 |
__ASSERT_DEBUG( window, Util::Panic( Util::EUninitializedData ) ); |
|
1860 |
return window->LoadObserver(); |
|
1861 |
} |
|
1862 |
||
1863 |
// ----------------------------------------------------------------------------- |
|
1864 |
// CBrowserAppUi::SpecialLoadObserver |
|
1865 |
// ----------------------------------------------------------------------------- |
|
1866 |
// |
|
1867 |
CBrowserSpecialLoadObserver& CBrowserAppUi::SpecialLoadObserver() const |
|
1868 |
{ |
|
1869 |
CBrowserWindow *window = iWindowManager->CurrentWindow(); |
|
1870 |
__ASSERT_DEBUG( window, Util::Panic( Util::EUninitializedData ) ); |
|
1871 |
return window->SpecialLoadObserver(); |
|
1872 |
} |
|
1873 |
||
1874 |
// ----------------------------------------------------------------------------- |
|
1875 |
// CBrowserAppUi::DialogsProvider |
|
1876 |
// ----------------------------------------------------------------------------- |
|
1877 |
// |
|
1878 |
CBrowserDialogsProvider& CBrowserAppUi::DialogsProvider() const |
|
1879 |
{ |
|
1880 |
return *iDialogsProvider; |
|
1881 |
} |
|
1882 |
||
1883 |
// ----------------------------------------------------------------------------- |
|
1884 |
// CBrowserAppUi::PopupEngine |
|
1885 |
// ----------------------------------------------------------------------------- |
|
1886 |
// |
|
1887 |
CBrowserPopupEngine& CBrowserAppUi::PopupEngine() const |
|
1888 |
{ |
|
1889 |
LOG_ENTERFN("CBrowserAppUi::PopupEngine"); |
|
1890 |
if(!iPopupEngine) |
|
1891 |
{ |
|
1892 |
if ( Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) ) |
|
1893 |
{ |
|
1894 |
iPopupEngine = CBrowserPopupEngine::NewL(); |
|
1895 |
BROWSER_LOG( ( _L( "PopupEngine up" ) ) ); |
|
1896 |
} |
|
1897 |
} |
|
1898 |
return *iPopupEngine; |
|
1899 |
} |
|
1900 |
||
1901 |
// ----------------------------------------------------------------------------- |
|
1902 |
// CBrowserAppUi::WindowMgr() |
|
1903 |
// ----------------------------------------------------------------------------- |
|
1904 |
// |
|
1905 |
CBrowserWindowManager& CBrowserAppUi::WindowMgr() const |
|
1906 |
{ |
|
1907 |
return *iWindowManager; |
|
1908 |
} |
|
1909 |
||
1910 |
// ----------------------------------------------------------------------------- |
|
1911 |
// CBrowserAppUi::IsCancelFetchAllowed |
|
1912 |
// ----------------------------------------------------------------------------- |
|
1913 |
// |
|
1914 |
TBool CBrowserAppUi::IsCancelFetchAllowed() const |
|
1915 |
{ |
|
1916 |
return ETrue; |
|
1917 |
} |
|
1918 |
||
1919 |
// ----------------------------------------------------------------------------- |
|
1920 |
// CBrowserAppUi::UpdateCbaL() |
|
1921 |
// ----------------------------------------------------------------------------- |
|
1922 |
// |
|
1923 |
void CBrowserAppUi::UpdateCbaL() |
|
1924 |
{ |
|
1925 |
if( ActiveView() ) |
|
1926 |
{ |
|
1927 |
ActiveView()->UpdateCbaL(); |
|
1928 |
} |
|
1929 |
} |
|
1930 |
||
1931 |
void CBrowserAppUi::LogAccessToRecentUrlL( CBrCtlInterface& aBrCtlInterface ) |
|
1932 |
{ |
|
1933 |
if ((ADAPTIVEBOOKMARKS)&&(!(Preferences().AdaptiveBookmarks()==EWmlSettingsAdaptiveBookmarksOff ))) |
|
1934 |
{ |
|
1935 |
HBufC* url = aBrCtlInterface.PageInfoLC( TBrCtlDefs::EPageInfoUrl ); |
|
1936 |
HBufC* name = aBrCtlInterface.PageInfoLC( TBrCtlDefs::EPageInfoTitle ); |
|
1937 |
if( url && url->Length() ) |
|
1938 |
{ |
|
1939 |
// If url is same as the one in the store delete it because the url will be rewritten |
|
1940 |
// along with the name |
|
1941 |
iRecentUrlStore->DeleteData(*url); |
|
1942 |
||
1943 |
TInt index; |
|
1944 |
index = url->Des().LocateReverse(KSlash); |
|
1945 |
// If the only difference between the url in the store and the one we are writing is a "/" |
|
1946 |
// at the end of the url, delete the one in the store because it will be rewritten along |
|
1947 |
// with the name |
|
1948 |
if (index == url->Length()-1) |
|
1949 |
{ |
|
1950 |
HBufC* urlwoslash = HBufC::NewLC( url->Length() ); |
|
1951 |
urlwoslash->Des().Copy( *url ); |
|
1952 |
urlwoslash->Des().Delete(url->Length() -1, 2); |
|
1953 |
||
1954 |
iRecentUrlStore->DeleteData(*urlwoslash); |
|
1955 |
||
1956 |
CleanupStack::PopAndDestroy(); //urlwoslash |
|
1957 |
} |
|
1958 |
||
1959 |
if (name && name->Length()) |
|
1960 |
{ |
|
1961 |
iRecentUrlStore->SaveDataL(*url,*name); |
|
1962 |
} |
|
1963 |
else |
|
1964 |
{ |
|
1965 |
if (url->Length() > KFavouritesMaxName) |
|
1966 |
{ |
|
1967 |
// name will be the url but it needs to be compressed to fit max name length |
|
1968 |
HBufC* cname = HBufC::NewLC(KFavouritesMaxName); |
|
1969 |
TInt edgeStringLen = ((KFavouritesMaxName / 2) - 3); |
|
1970 |
TPtrC cnameRight( url->Right( edgeStringLen ) ); |
|
1971 |
TPtrC cnameLeft( url->Left( edgeStringLen )); |
|
1972 |
TPtr cnameDes = cname->Des(); |
|
1973 |
||
1974 |
cnameDes.Append( cnameLeft ); |
|
1975 |
cnameDes.AppendFill( TChar(KDot),5 ); // '.....' |
|
1976 |
cnameDes.Append( cnameRight ); |
|
1977 |
iRecentUrlStore->SaveDataL(*url,*cname); |
|
1978 |
CleanupStack::PopAndDestroy();//cname |
|
1979 |
} |
|
1980 |
else |
|
1981 |
{ |
|
1982 |
iRecentUrlStore->SaveDataL(*url,*url); |
|
1983 |
} |
|
1984 |
} |
|
1985 |
} |
|
1986 |
CleanupStack().PopAndDestroy(2); // url, name |
|
1987 |
} |
|
1988 |
} |
|
1989 |
||
1990 |
void CBrowserAppUi::LogRequestedPageToRecentUrlL( const TDesC& aUrl ) |
|
1991 |
{ |
|
1992 |
if ((ADAPTIVEBOOKMARKS)&&(!(Preferences().AdaptiveBookmarks()==EWmlSettingsAdaptiveBookmarksOff ))) |
|
1993 |
{ |
|
1994 |
HBufC *url = HBufC::NewLC( aUrl.Length() ); |
|
1995 |
url->Des().Copy( aUrl ); |
|
1996 |
||
1997 |
if( url && url->Length() ) |
|
1998 |
{ |
|
1999 |
if (url->Length() > KFavouritesMaxName) |
|
2000 |
{ |
|
2001 |
// name will be the url but it needs to be compressed to fit max name length |
|
2002 |
HBufC* cname = HBufC::NewLC(KFavouritesMaxName); |
|
2003 |
TInt edgeStringLen = ((KFavouritesMaxName / 2) - 3); |
|
2004 |
TPtrC cnameRight( url->Right( edgeStringLen ) ); |
|
2005 |
TPtrC cnameLeft( url->Left( edgeStringLen )); |
|
2006 |
TPtr cnameDes = cname->Des(); |
|
2007 |
||
2008 |
cnameDes.Append( cnameLeft ); |
|
2009 |
cnameDes.AppendFill( TChar(KDot),5 ); // '.....' |
|
2010 |
cnameDes.Append( cnameRight ); |
|
2011 |
iRecentUrlStore->SaveDataL(*url,*cname); |
|
2012 |
CleanupStack::PopAndDestroy();//cname |
|
2013 |
} |
|
2014 |
else |
|
2015 |
{ |
|
2016 |
iRecentUrlStore->SaveDataL(*url,*url); |
|
2017 |
} |
|
2018 |
} |
|
2019 |
CleanupStack().PopAndDestroy(); // url |
|
2020 |
} |
|
2021 |
} |
|
2022 |
||
2023 |
// ----------------------------------------------------------------------------- |
|
2024 |
// CBrowserAppUi::SwitchWindowL() |
|
2025 |
// ----------------------------------------------------------------------------- |
|
2026 |
// |
|
2027 |
void CBrowserAppUi::SwitchWindowL() |
|
2028 |
{ |
|
2029 |
LOG_ENTERFN("CBrowserAppUi::SwitchWindowL"); |
|
2030 |
CArrayFixFlat<CWindowInfo*>* windowBuf = iWindowManager->GetWindowInfoL( this ); |
|
2031 |
CleanupStack::PushL( windowBuf ); |
|
2032 |
||
2033 |
// Open 'Switch Window' selection dialog |
|
2034 |
HBufC* title = StringLoader::LoadLC( R_BROWSER_SWITCH_WINDOW_HEADER ); |
|
2035 |
||
2036 |
CArrayFixFlat<TBrCtlSelectOptionData>* optDataArray = new ( ELeave ) |
|
2037 |
CArrayFixFlat<TBrCtlSelectOptionData>( KGranularityMedium ); |
|
2038 |
CleanupStack::PushL( optDataArray ); |
|
2039 |
||
2040 |
TInt i( 0 ); |
|
2041 |
TInt numWindows = windowBuf->Count(); |
|
2042 |
||
2043 |
LOG_WRITE_FORMAT("Window's count: %d", numWindows ); |
|
2044 |
for ( i = 0; i < numWindows; ++i ) |
|
2045 |
{ |
|
2046 |
TBrCtlSelectOptionData optData( *((*windowBuf)[i]->iWindowText), |
|
2047 |
(*windowBuf)[i]->iCurrent, |
|
2048 |
EFalse, |
|
2049 |
EFalse ); |
|
2050 |
optDataArray->AppendL( optData ); |
|
2051 |
} |
|
2052 |
||
2053 |
TBool ret = DialogsProvider().DialogSelectOptionL( *title, |
|
2054 |
ESelectTypeSingle, |
|
2055 |
*optDataArray ); |
|
2056 |
if ( ret ) |
|
2057 |
{ |
|
2058 |
for( i = 0; i < numWindows; ++i) |
|
2059 |
{ |
|
2060 |
if( (*optDataArray)[i].IsSelected() ) |
|
2061 |
{ |
|
2062 |
LOG_WRITE_FORMAT("Selected window: %d", (*windowBuf)[i]->iWindowId ); |
|
2063 |
iWindowManager->SwitchWindowL( (*windowBuf)[i]->iWindowId ); |
|
2064 |
break; |
|
2065 |
} |
|
2066 |
} |
|
2067 |
} |
|
2068 |
CleanupStack::PopAndDestroy( 3 ); // optDataArray, title, windowBuf |
|
2069 |
} |
|
2070 |
||
2071 |
// ----------------------------------------------------------------------------- |
|
2072 |
// CBrowserAppUi::SetCalledFromAnotherApp |
|
2073 |
// ----------------------------------------------------------------------------- |
|
2074 |
// |
|
2075 |
void CBrowserAppUi::SetCalledFromAnotherApp( TBool aValue ) |
|
2076 |
{ |
|
2077 |
iCalledFromAnotherApp = aValue; |
|
2078 |
} |
|
2079 |
||
2080 |
// ----------------------------------------------------------------------------- |
|
2081 |
// CBrowserAppUi::CalledFromAnotherApp |
|
2082 |
// ----------------------------------------------------------------------------- |
|
2083 |
// |
|
2084 |
TBool CBrowserAppUi::CalledFromAnotherApp() |
|
2085 |
{ |
|
2086 |
return iCalledFromAnotherApp; |
|
2087 |
} |
|
2088 |
||
2089 |
// ----------------------------------------------------------------------------- |
|
2090 |
// CBrowserAppUi::NoHomePageToBeLaunchedL |
|
2091 |
// ----------------------------------------------------------------------------- |
|
2092 |
// |
|
2093 |
TBool CBrowserAppUi::NoHomePageToBeLaunchedL() |
|
2094 |
{ |
|
2095 |
LOG_ENTERFN("CBrowserAppUi::NoHomePageToBeLaunchedL"); |
|
2096 |
TWmlSettingsHomePage pgtype = iPreferences->HomePageType(); |
|
2097 |
TBool alwaysAskCase = (( Preferences().AccessPointSelectionMode() == EAlwaysAsk ) && |
|
2098 |
( EWmlSettingsHomePageAccessPoint == pgtype )); |
|
2099 |
BROWSER_LOG( ( _L( "pgtype: %d, alwaysAsk: %d" ), pgtype, alwaysAskCase ) ); |
|
2100 |
||
2101 |
if( ( pgtype == EWmlSettingsHomePageBookmarks ) || alwaysAskCase ) |
|
2102 |
{ // Can't load home page since set to Bookmarks or (AlwaysAsk AP and homepage set to AP homepage) |
|
2103 |
return ETrue; |
|
2104 |
} |
|
2105 |
else |
|
2106 |
{ |
|
2107 |
// now check for other cases where homepage string might be defined and will be used |
|
2108 |
HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack |
|
2109 |
TPtr ptr( buf->Des() ); |
|
2110 |
TInt pgFound = Preferences().HomePageUrlL( ptr ); |
|
2111 |
CleanupStack::PopAndDestroy( buf ); |
|
2112 |
if (pgFound != KErrNone) |
|
2113 |
{ // no homepage string found |
|
2114 |
return ETrue; |
|
2115 |
} |
|
2116 |
else |
|
2117 |
{ // homepage string was found |
|
2118 |
return EFalse; |
|
2119 |
} |
|
2120 |
} |
|
2121 |
} |
|
2122 |
||
2123 |
// CBrowserAppUi::ProcessCommandParametersL() |
|
2124 |
// ----------------------------------------------------------------------------- |
|
2125 |
// |
|
2126 |
TBool CBrowserAppUi::ProcessCommandParametersL( TApaCommand aCommand, |
|
2127 |
TFileName& /*aDocumentName*/ , |
|
2128 |
const TDesC8& /*aTail*/ ) |
|
2129 |
{ |
|
2130 |
LOG_ENTERFN("CBrowserAppUi::ProcessCommandParametersL"); |
|
2131 |
LOG_WRITE_FORMAT(" aCommand: %d", aCommand); |
|
2132 |
||
2133 |
// The browser is in embedded mode and it is not initialized yet |
|
2134 |
if ( IsEmbeddedModeOn() && !iStartedUp) |
|
2135 |
{ |
|
2136 |
EnableLocalScreenClearer( EFalse ); |
|
2137 |
return EFalse; |
|
2138 |
} |
|
2139 |
||
2140 |
if ( aCommand == EApaCommandOpen ) |
|
2141 |
{ |
|
2142 |
//Startup parameters are given to browser at CBrowserAppDocument::OpenFileL(). |
|
2143 |
//- a part of shell starting (ConstructAppFromCommandLineL calls OpenFileL) |
|
2144 |
} |
|
2145 |
||
2146 |
else if ( aCommand == EApaCommandRun ) |
|
2147 |
{ |
|
2148 |
||
2149 |
if ( LastActiveViewId() == KUidBrowserNullViewId ) |
|
2150 |
{ |
|
2151 |
TBool specialSchemeInHomePageAddress = EFalse; |
|
2152 |
||
2153 |
if (NoHomePageToBeLaunchedL()) |
|
2154 |
{ |
|
2155 |
// No homepage to be launched so start browser in bookmarks view |
|
2156 |
SetLastActiveViewId(KUidBrowserBookmarksViewId); |
|
2157 |
} |
|
2158 |
else if ( iPreferences->SearchFeature() || iPreferences->ServiceFeature()) |
|
2159 |
{ |
|
2160 |
||
2161 |
HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack |
|
2162 |
TPtr ptr( buf->Des() ); |
|
2163 |
TInt pgFound( KErrNotFound ); |
|
2164 |
pgFound = Preferences().HomePageUrlL( ptr ); |
|
2165 |
HBufC* searchScheme = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack |
|
2166 |
TPtr searchSchemePtr( searchScheme->Des() ); |
|
2167 |
||
2168 |
HBufC* serviceScheme = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack |
|
2169 |
TPtr serviceSchemePtr( serviceScheme->Des() ); |
|
2170 |
||
2171 |
iPreferences->GetStringValueL( KBrowserSearchProviderUrl, KMaxHomePgUrlLength, searchSchemePtr ); |
|
2172 |
iPreferences->GetStringValueL( KBrowserServiceUrl, KMaxHomePgUrlLength, serviceSchemePtr ); |
|
2173 |
||
2174 |
||
2175 |
if( !ptr.Compare(serviceSchemePtr) || !ptr.Compare(searchSchemePtr) ) |
|
2176 |
{ |
|
2177 |
specialSchemeInHomePageAddress = ETrue; |
|
2178 |
SetLastActiveViewId(KUidBrowserBookmarksViewId); |
|
2179 |
SetViewToBeActivatedIfNeededL(KUidBrowserContentViewId, 0); |
|
2180 |
TRAPD( err, FetchL( ptr, CBrowserLoadObserver::ELoadUrlTypeOther ) ); |
|
2181 |
} |
|
2182 |
else |
|
2183 |
{ |
|
2184 |
SetViewToBeActivatedIfNeededL(KUidBrowserContentViewId, 0); |
|
2185 |
StartFetchHomePageL(); |
|
2186 |
} |
|
2187 |
CleanupStack::PopAndDestroy( 3,buf ); |
|
2188 |
} |
|
2189 |
else |
|
2190 |
{ |
|
2191 |
SetViewToBeActivatedIfNeededL(KUidBrowserContentViewId, 0); |
|
2192 |
StartFetchHomePageL(); |
|
2193 |
} |
|
2194 |
||
2195 |
if( !specialSchemeInHomePageAddress ) |
|
2196 |
{ |
|
2197 |
if( iCurrentView != iLastViewId ) |
|
2198 |
ActivateLocalViewL( LastActiveViewId() ); |
|
2199 |
} |
|
2200 |
} |
|
2201 |
} |
|
2202 |
else if ( aCommand == EApaCommandViewActivate ) |
|
2203 |
// Get when activated from soft notification (Downloads List). |
|
2204 |
// Must behave as in case of EApaCommandOpen, but no OpenFileL() is called. |
|
2205 |
{ |
|
2206 |
ParseAndProcessParametersL( KNullDesC8 ); |
|
2207 |
} |
|
2208 |
return EFalse; |
|
2209 |
} |
|
2210 |
||
2211 |
// ----------------------------------------------------------------------------- |
|
2212 |
// CBrowserAppUi::Static() |
|
2213 |
// ----------------------------------------------------------------------------- |
|
2214 |
// |
|
2215 |
CBrowserAppUi* CBrowserAppUi::Static() |
|
2216 |
{ |
|
2217 |
return REINTERPRET_CAST( CBrowserAppUi*, CEikonEnv::Static()->EikAppUi() ); |
|
2218 |
} |
|
2219 |
||
2220 |
// ----------------------------------------------------------------------------- |
|
2221 |
// CBrowserAppUi::ParseAndProcessParametersL |
|
2222 |
// ----------------------------------------------------------------------------- |
|
2223 |
// |
|
2224 |
void CBrowserAppUi::ParseAndProcessParametersL( const TDesC8& aDocumentName, TBool aDoFetch ) |
|
2225 |
{ |
|
2226 |
LOG_ENTERFN("CBrowserAppUi::ParseAndProcessParametersL"); |
|
2227 |
TInt err = KErrNone; |
|
2228 |
||
2229 |
TUid ViewToActivate = { 0 }; |
|
2230 |
||
2231 |
HBufC8* params = NULL; |
|
2232 |
TLex8 parameter(aDocumentName); |
|
2233 |
||
2234 |
// Here we check if the url contains control characters. |
|
2235 |
TBool urlError( EFalse ); // If there is a Control caracter in the url. |
|
2236 |
parameter.Mark(); // Save the start position in the string. |
|
2237 |
while ( !parameter.Eos() && !urlError ) |
|
2238 |
{ |
|
2239 |
if ( parameter.Get().IsControl() ) |
|
2240 |
{ |
|
2241 |
urlError = ETrue; |
|
2242 |
} |
|
2243 |
} |
|
2244 |
parameter.UnGetToMark(); // Now go back to the beginning of the string. |
|
2245 |
||
2246 |
//Check for parameter validity |
|
2247 |
if( !parameter.Peek().IsDigit() || urlError ) //First char of aDocumentName is NOT a digit |
|
2248 |
{ |
|
2249 |
if( ( aDocumentName.Locate( ':' ) > 0) && (!urlError) ) //There is a ":" character in aDocumentName (->probably a valid url) |
|
2250 |
{ |
|
2251 |
//Add "4" + <space> before the given parameter to make the parameter legal for url launch |
|
2252 |
_LIT8(KUrlId, "4 "); |
|
2253 |
params = HBufC8::NewL(aDocumentName.Length() + 2 + 1); |
|
2254 |
params->Des().Copy( KUrlId ); |
|
2255 |
params->Des().Append(aDocumentName); |
|
2256 |
params->Des().ZeroTerminate(); |
|
2257 |
ViewToActivate = KUidBrowserContentViewId; |
|
2258 |
} |
|
2259 |
else |
|
2260 |
{ |
|
2261 |
//Activate bookmarks view if parameters are invalid and browser is not embedded. |
|
2262 |
// In embedded mode bookmarks are not shown, so if there is an |
|
2263 |
// error in the url, we make the browser to pop up a |
|
2264 |
// "Page not found" note, by defining a not existing url. |
|
2265 |
if ( IsEmbeddedModeOn() ) |
|
2266 |
{ |
|
2267 |
params = HBufC8::NewL( 10 ); |
|
2268 |
params->Des().Copy(_L8("4 http://") ); |
|
2269 |
} |
|
2270 |
else |
|
2271 |
{ |
|
2272 |
params = HBufC8::NewL(aDocumentName.Length() + 1 ); |
|
2273 |
params->Des().Copy(aDocumentName); |
|
2274 |
} |
|
2275 |
params->Des().ZeroTerminate(); |
|
2276 |
ViewToActivate = KUidBrowserBookmarksViewId; |
|
2277 |
} |
|
2278 |
} |
|
2279 |
else |
|
2280 |
{ |
|
2281 |
params = HBufC8::NewL(aDocumentName.Length() + 1); |
|
2282 |
params->Des().Copy(aDocumentName); |
|
2283 |
params->Des().ZeroTerminate(); |
|
2284 |
ViewToActivate = KUidBrowserContentViewId; |
|
2285 |
} |
|
2286 |
CleanupStack::PushL( params ); |
|
2287 |
||
2288 |
//Set view to activate if no view yet activated |
|
2289 |
if ( LastActiveViewId() == KUidBrowserNullViewId ) |
|
2290 |
{ |
|
2291 |
SetLastActiveViewId(ViewToActivate); |
|
2292 |
} |
|
2293 |
||
2294 |
CBrowserCommandLineParser8* command = CBrowserCommandLineParser8::NewL( *params ); |
|
2295 |
CleanupStack::PopAndDestroy( params ); |
|
2296 |
CleanupStack::PushL( command ); |
|
2297 |
||
2298 |
||
2299 |
// complete the delayed initialization if bookmarks view is not the first view |
|
2300 |
if(ViewToActivate != KUidBrowserBookmarksViewId && !iStartedUp) |
|
2301 |
CompleteDelayedInit(); |
|
2302 |
||
2303 |
//wait a while, contentview initializing itself |
|
2304 |
WaitCVInit(); |
|
2305 |
switch ( command->Count() ) |
|
2306 |
{ |
|
2307 |
case 0: |
|
2308 |
{ |
|
2309 |
SetViewToBeActivatedIfNeededL( LastActiveViewId() ); |
|
2310 |
break; |
|
2311 |
} |
|
2312 |
case 1: |
|
2313 |
{ |
|
2314 |
if ( !aDocumentName.Compare( KLongZeroIdString ) ) |
|
2315 |
{ |
|
2316 |
// Long 0 is pressed and Browser is started up for the first time... |
|
2317 |
// if no AP or SNAP is defined, define it |
|
2318 |
TUint32 defaultAp = iPreferences->DefaultAccessPoint(); |
|
2319 |
TUint32 defaultSnap = iPreferences->DefaultSnapId(); |
|
2320 |
// AP or SNAP is not defined |
|
2321 |
if( (defaultAp == KWmlNoDefaultAccessPoint && iPreferences->AccessPointSelectionMode() == EConnectionMethod) || |
|
2322 |
(defaultSnap == KWmlNoDefaultSnapId && iPreferences->AccessPointSelectionMode() == EDestination) ) |
|
2323 |
{ |
|
2324 |
StartPreferencesViewL( EShowAlwaysAsk | EShowDestinations | EShowConnectionMethods ); |
|
2325 |
} |
|
2326 |
// If there is a homepage url then try to fetch it |
|
2327 |
if ( !NoHomePageToBeLaunchedL() ) |
|
2328 |
{ |
|
2329 |
iLongZeroPressed = ETrue; |
|
2330 |
FetchHomePageL(); |
|
2331 |
} |
|
2332 |
else |
|
2333 |
{ |
|
2334 |
if (iStartedUp) |
|
2335 |
ContentView()->SetFullScreenOffL(); |
|
2336 |
||
2337 |
if ( !IsEmbeddedModeOn() ) |
|
2338 |
{ |
|
2339 |
SetLastActiveViewId( KUidBrowserBookmarksViewId ); |
|
2340 |
} |
|
2341 |
} |
|
2342 |
} |
|
2343 |
SetViewToBeActivatedIfNeededL( LastActiveViewId() ); |
|
2344 |
break; |
|
2345 |
} |
|
2346 |
case 2: |
|
2347 |
case 3: |
|
2348 |
{ |
|
2349 |
// UID and wml adress and optional access point UID |
|
2350 |
||
2351 |
TUint typeId; |
|
2352 |
TInt dataId; |
|
2353 |
TLex8 param0( command->Param( 0 ) ); |
|
2354 |
TLex8 param1( command->Param( 1 ) ); |
|
2355 |
err = param0.Val( typeId ); |
|
2356 |
if ( !err ) |
|
2357 |
{ |
|
2358 |
BROWSER_LOG( ( _L( " typeId: %d" ), typeId ) ); |
|
2359 |
||
2360 |
if ( typeId == KUrlId ) |
|
2361 |
{ // FIX THIS! |
|
2362 |
TUriParser8 uri8; |
|
2363 |
err = uri8.Parse(command->Param(1)); // what if parsing fails? |
|
2364 |
User::LeaveIfError(err); |
|
2365 |
// Url decoding section was removed from here. |
|
2366 |
HBufC* url = HBufC::NewL(command->Param(1).Length()+1); |
|
2367 |
url->Des().Copy( command->Param(1) ); |
|
2368 |
CleanupStack::PushL(url); |
|
2369 |
BROWSER_LOG( ( _L( " url: %S" ), url ) ); |
|
2370 |
||
2371 |
TFavouritesWapAp accessPoint; // Initially "default". |
|
2372 |
BROWSER_LOG( ( _L( " Count: %d" ), command->Count() ) ); |
|
2373 |
if ( command->Count() == 3 ) |
|
2374 |
{ |
|
2375 |
// URL Typeid, url, ap |
|
2376 |
TUint ap; |
|
2377 |
TLex8 param2( command->Param( 2 ) ); |
|
2378 |
err = param2.Val( ap ); |
|
2379 |
if ( !err ) |
|
2380 |
{ |
|
2381 |
BROWSER_LOG( ( _L( " ap: %d" ), ap ) ); |
|
2382 |
if (iSuppressAlwaysAsk) |
|
2383 |
{ |
|
2384 |
// Always ask was temporarily disabled, enable it again |
|
2385 |
iPreferences->SetAccessPointSelectionModeL(EAlwaysAsk); |
|
2386 |
||
2387 |
iSuppressAlwaysAsk = EFalse; |
|
2388 |
} |
|
2389 |
||
2390 |
// Note: OTA Provisioning application requires the |
|
2391 |
// KBrowserAccessPointSelectionMode key value to be |
|
2392 |
// read directly from cenrep, rather than use the |
|
2393 |
// cached cenrep value taken at browser initialization |
|
2394 |
// time. |
|
2395 |
TInt selectionMode; |
|
2396 |
||
2397 |
CRepository* repository = CRepository::NewLC( KCRUidBrowser ); |
|
2398 |
User::LeaveIfError( repository->Get( KBrowserAccessPointSelectionMode, selectionMode ) ); |
|
2399 |
CleanupStack::PopAndDestroy( repository ); |
|
2400 |
||
2401 |
// If selectionMode cenrep value is always ask, then |
|
2402 |
// temporarily change selection mode |
|
2403 |
if ( EBrowserCenRepApSelModeAlwaysAsk == selectionMode ) |
|
2404 |
{ |
|
2405 |
iSuppressAlwaysAsk = ETrue; |
|
2406 |
iPreferences->SetAccessPointSelectionModeL(EConnectionMethod); |
|
2407 |
} |
|
2408 |
accessPoint.SetApId( ap ); |
|
2409 |
SetCalledFromAnotherApp( ETrue ); |
|
2410 |
CBrowserLoadObserver::TBrowserLoadUrlType urlType = |
|
2411 |
IsEmbeddedModeOn() ? |
|
2412 |
CBrowserLoadObserver::ELoadUrlTypeEmbeddedBrowserWithUrl : |
|
2413 |
CBrowserLoadObserver::ELoadUrlTypeOther; |
|
2414 |
if( IsPageLoaded() && |
|
2415 |
!(WindowMgr().CurrentWindow()->HasWMLContent(EFalse)) && |
|
2416 |
Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) && |
|
2417 |
!Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows )) |
|
2418 |
{ |
|
2419 |
// Cancel history view, mini map, toolbar or any other active control on the current window |
|
2420 |
BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase ); |
|
2421 |
// there is already a window, so create a new one |
|
2422 |
CBrowserWindow *win = WindowMgr().CreateWindowL( 0, &KNullDesC ); |
|
2423 |
if (win != NULL) |
|
2424 |
{ |
|
2425 |
||
2426 |
CleanupStack::PushL( win ); |
|
2427 |
WindowMgr().SwitchWindowL( win->WindowId() ); |
|
2428 |
TRAP( err, FetchL( *url, |
|
2429 |
KNullDesC, |
|
2430 |
KNullDesC, |
|
2431 |
accessPoint, |
|
2432 |
urlType ) ); |
|
2433 |
CleanupStack::Pop(); // win |
|
2434 |
SetLastActiveViewId( KUidBrowserContentViewId ); |
|
2435 |
} |
|
2436 |
} |
|
2437 |
else |
|
2438 |
{ |
|
2439 |
// Cancel history view, mini map, toolbar or any other active control on the current window |
|
2440 |
if (iStartedUp) |
|
2441 |
BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase ); |
|
2442 |
TRAP( err, FetchL( *url, |
|
2443 |
KNullDesC, |
|
2444 |
KNullDesC, |
|
2445 |
accessPoint, |
|
2446 |
urlType ) ); |
|
2447 |
SetLastActiveViewId( KUidBrowserContentViewId ); |
|
2448 |
} |
|
2449 |
} |
|
2450 |
} |
|
2451 |
else |
|
2452 |
{ |
|
2453 |
// URL Typeid, url |
|
2454 |
SetCalledFromAnotherApp( ETrue ); |
|
2455 |
||
2456 |
if ( aDoFetch ) |
|
2457 |
{ |
|
2458 |
CBrowserLoadObserver::TBrowserLoadUrlType urlType = |
|
2459 |
IsEmbeddedModeOn() ? |
|
2460 |
CBrowserLoadObserver::ELoadUrlTypeEmbeddedBrowserWithUrl : |
|
2461 |
CBrowserLoadObserver::ELoadUrlTypeOther; |
|
2462 |
if( IsPageLoaded() && |
|
2463 |
!(WindowMgr().CurrentWindow()->HasWMLContent(EFalse)) && |
|
2464 |
Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) && |
|
2465 |
!Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows )) |
|
2466 |
{ |
|
2467 |
// Cancel history view, mini map, toolbar or any other active control on the current window |
|
2468 |
BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase ); |
|
2469 |
// there is already a window, so create a new one |
|
2470 |
CBrowserWindow *win = NULL; |
|
2471 |
if(WindowMgr().CurrentWindow()) |
|
2472 |
{ |
|
2473 |
if(iSameWinApp) |
|
2474 |
{ |
|
2475 |
//We will be using same/already opened window if call is from external |
|
2476 |
//application. So no new windows will be opened. |
|
2477 |
win = WindowMgr().CurrentWindow(); |
|
2478 |
iWindowIdFromFromExternApp = win->WindowId(); |
|
2479 |
} |
|
2480 |
if(!win) |
|
2481 |
{ |
|
2482 |
//If not called from external app, then create window. |
|
2483 |
win = WindowMgr().CreateWindowL( (WindowMgr().CurrentWindow()->WindowId()) ? WindowMgr().CurrentWindow()->WindowId() : 0, &KNullDesC ); |
|
2484 |
} |
|
2485 |
} |
|
2486 |
else |
|
2487 |
win = WindowMgr().CreateWindowL( 0, &KNullDesC ); |
|
2488 |
if (win != NULL) |
|
2489 |
{ |
|
2490 |
||
2491 |
CleanupStack::PushL( win ); |
|
2492 |
WindowMgr().SwitchWindowL( win->WindowId() ); |
|
2493 |
TRAP( err, FetchL( *url, |
|
2494 |
KNullDesC, |
|
2495 |
KNullDesC, |
|
2496 |
accessPoint, |
|
2497 |
urlType ) ); |
|
2498 |
CleanupStack::Pop(); // win |
|
2499 |
} |
|
2500 |
} |
|
2501 |
else |
|
2502 |
{ |
|
2503 |
// Cancel history view, mini map, toolbar or any other active control on the current window |
|
2504 |
if (iStartedUp) |
|
2505 |
BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase ); |
|
2506 |
TRAP( err, FetchL( *url, |
|
2507 |
KNullDesC, |
|
2508 |
KNullDesC, |
|
2509 |
accessPoint, |
|
2510 |
urlType ) ); |
|
2511 |
} |
|
2512 |
} |
|
2513 |
if (err==KErrNone) |
|
2514 |
{ |
|
2515 |
SetLastActiveViewId(ViewToActivate); |
|
2516 |
} |
|
2517 |
} |
|
2518 |
CleanupStack::PopAndDestroy(); // url |
|
2519 |
} |
|
2520 |
else if( typeId == KLaunchFeeds ) |
|
2521 |
{ |
|
2522 |
// Special facility to launch non-embedded into the feeds view |
|
2523 |
if( !iBrowserAlreadyRunning ) |
|
2524 |
{ |
|
2525 |
SetOverriddenLaunchContextId(EBrowserContextIdFeeds); |
|
2526 |
SetLastActiveViewId( KUidBrowserFeedsFolderViewId ); |
|
2527 |
} |
|
2528 |
LaunchIntoFeedsL(); |
|
2529 |
} |
|
2530 |
else |
|
2531 |
{ |
|
2532 |
err = param1.Val( dataId ); |
|
2533 |
if ( !err ) |
|
2534 |
{ |
|
2535 |
switch ( typeId ) |
|
2536 |
{ |
|
2537 |
case KBookmarkId: |
|
2538 |
{ |
|
2539 |
// Bookmark typeid, uid |
|
2540 |
SetCalledFromAnotherApp( ETrue ); |
|
2541 |
||
2542 |
if( IsPageLoaded() && |
|
2543 |
!(WindowMgr().CurrentWindow()->HasWMLContent(EFalse)) && |
|
2544 |
Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) && |
|
2545 |
!Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows )) |
|
2546 |
{ |
|
2547 |
// Cancel history view, mini map, toolbar or any other active control on the current window |
|
2548 |
BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase ); |
|
2549 |
// there is already a window, so create a new one |
|
2550 |
CBrowserWindow *win = WindowMgr().CreateWindowL( 0, &KNullDesC ); |
|
2551 |
if (win != NULL) |
|
2552 |
{ |
|
2553 |
CleanupStack::PushL( win ); |
|
2554 |
WindowMgr().SwitchWindowL( win->WindowId() ); |
|
2555 |
TRAP( err, FetchBookmarkL( dataId ) ); |
|
2556 |
CleanupStack::Pop(); // win |
|
2557 |
} |
|
2558 |
} |
|
2559 |
else |
|
2560 |
{ |
|
2561 |
// Cancel history view, mini map, toolbar or any other active control on the current window |
|
2562 |
if (iStartedUp) |
|
2563 |
BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase ); |
|
2564 |
TRAP( err, FetchBookmarkL( dataId ) ); |
|
2565 |
} |
|
2566 |
||
2567 |
if ( err ) |
|
2568 |
{ |
|
2569 |
// Unable to fetch bookmark |
|
2570 |
TBrowserDialogs::InfoNoteL( |
|
2571 |
R_BROWSER_INFO_NOTE, R_WML_UNABLE_TO_FETCH_BOOKMARK ); |
|
2572 |
} |
|
2573 |
if (err==KErrNone) |
|
2574 |
{ |
|
2575 |
SetLastActiveViewId(ViewToActivate); |
|
2576 |
} |
|
2577 |
||
2578 |
break; |
|
2579 |
} |
|
2580 |
case KFolderId: |
|
2581 |
{ |
|
2582 |
SetCalledFromAnotherApp( EFalse ); |
|
2583 |
iIsForeground = IsForeground(); |
|
71
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2584 |
GetBookmarksView()->SetCurrentFolderId(dataId); |
65 | 2585 |
CloseContentViewL(); |
2586 |
break; |
|
2587 |
} |
|
2588 |
default: |
|
2589 |
{ |
|
2590 |
// Typeid was not readable |
|
2591 |
// TBD: error message! |
|
2592 |
break; |
|
2593 |
} |
|
2594 |
} |
|
2595 |
} |
|
2596 |
else |
|
2597 |
{ |
|
2598 |
// Dataid was not readable |
|
2599 |
User::Leave( err ); |
|
2600 |
} |
|
2601 |
} |
|
2602 |
} |
|
2603 |
else |
|
2604 |
{ |
|
2605 |
// Sender Uid was not readable |
|
2606 |
User::Leave( err ); |
|
2607 |
} |
|
2608 |
if( !iSpecialSchemeinAddress ) |
|
2609 |
{ |
|
2610 |
SetViewToBeActivatedIfNeededL( LastActiveViewId() ); |
|
2611 |
} |
|
2612 |
break; |
|
2613 |
} |
|
2614 |
||
2615 |
default: |
|
2616 |
{ |
|
2617 |
SendBrowserToBackground(); |
|
2618 |
break; |
|
2619 |
} |
|
2620 |
} |
|
2621 |
CleanupStack::PopAndDestroy(); // command |
|
2622 |
} |
|
2623 |
||
2624 |
// ----------------------------------------------------------------------------- |
|
2625 |
// CBrowserAppUi::WaitCVInit |
|
2626 |
// ----------------------------------------------------------------------------- |
|
2627 |
// |
|
2628 |
void CBrowserAppUi::WaitCVInit() |
|
2629 |
{ |
|
2630 |
if( iParametrizedLaunchInProgress == 0 && iStartedUp) |
|
2631 |
{ |
|
2632 |
iParametrizedLaunchInProgress = 1; |
|
2633 |
iIdle->Cancel(); |
|
2634 |
iIdle->Start( TCallBack( StopDelay, this ) ); |
|
2635 |
iWait.Start(); |
|
2636 |
iParametrizedLaunchInProgress = 2; |
|
2637 |
} |
|
2638 |
} |
|
2639 |
void CBrowserAppUi::StopConnectionObserving() |
|
2640 |
{ |
|
2641 |
LOG_ENTERFN("CBrowserAppUi::StopConnectionObserving"); |
|
2642 |
if ( iConnStageNotifier && iConnStageNotifier->IsActive() ) |
|
2643 |
{ |
|
2644 |
BROWSER_LOG( ( _L( " CBrowserAppUi::StopConnectionObserving Cancelling Observer" ) ) ); |
|
2645 |
iConnStageNotifier->Cancel(); |
|
2646 |
} |
|
2647 |
} |
|
2648 |
||
2649 |
// ----------------------------------------------------------------------------- |
|
2650 |
// CBrowserAppUi::ConnNeededStatusL |
|
2651 |
// ----------------------------------------------------------------------------- |
|
2652 |
// |
|
2653 |
void CBrowserAppUi::ConnNeededStatusL( TInt aErr ) |
|
2654 |
{ |
|
2655 |
LOG_ENTERFN("CBrowserAppUi::ConnNeededStatusL"); |
|
2656 |
UpdateSoftKeys(); |
|
2657 |
if (iSuppressAlwaysAsk) |
|
2658 |
{ |
|
2659 |
// Always ask was temporarily disabled, after creating the network connection, enable it again |
|
2660 |
iPreferences->SetAccessPointSelectionModeL(EAlwaysAsk); |
|
2661 |
iSuppressAlwaysAsk = EFalse; |
|
2662 |
} |
|
2663 |
if ( aErr != KErrNone ) |
|
2664 |
{ |
|
2665 |
if( iCalledFromAnotherApp ) |
|
2666 |
{ |
|
2667 |
// This function call should be replaced by ExitBrowser(ETrue) |
|
2668 |
// so that the blank content view is not displayed. |
|
2669 |
// SendBrowserToBackground(); |
|
2670 |
} |
|
2671 |
// if any error, return Cancel to Kimono. |
|
2672 |
return; |
|
2673 |
} |
|
2674 |
||
2675 |
BROWSER_LOG( ( _L( " CBrowserAppUi::ConnNeededStatusL First Stop Connection Observer" ) ) ); |
|
2676 |
StopConnectionObserving(); //Need to stop the connection observer first |
|
2677 |
||
2678 |
||
2679 |
if ( !iConnStageNotifier->IsActive() ) |
|
2680 |
{ |
|
2681 |
BROWSER_LOG( ( _L( " CBrowserAppUi::ConnNeededStatusL Starting Connection Observer" ) ) ); |
|
2682 |
TName* connectionName = Connection().ConnectionNameL(); |
|
2683 |
CleanupStack::PushL( connectionName ); |
|
2684 |
||
2685 |
iConnStageNotifier->StartNotificationL(connectionName, KLinkLayerClosed, this); |
|
2686 |
||
2687 |
CleanupStack::PopAndDestroy(); //connectionName |
|
2688 |
} |
|
2689 |
} |
|
2690 |
||
2691 |
||
2692 |
// ----------------------------------------------------------------------------- |
|
2693 |
// CBrowserAppUi::SendBrowserToBackground |
|
2694 |
// ----------------------------------------------------------------------------- |
|
2695 |
// |
|
2696 |
void CBrowserAppUi::SendBrowserToBackground() |
|
2697 |
{ |
|
2698 |
TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
|
2699 |
||
2700 |
// Browser might be embedded. |
|
2701 |
TUid appUid; |
|
2702 |
if ( iEmbeddingApplicationUid != KNullUid ) |
|
2703 |
{ |
|
2704 |
appUid = iEmbeddingApplicationUid; |
|
2705 |
} |
|
2706 |
else |
|
2707 |
{ |
|
2708 |
appUid = KUidBrowserApplication; |
|
2709 |
} |
|
2710 |
TApaTask task = taskList.FindApp( appUid ); |
|
2711 |
task.SendToBackground(); |
|
2712 |
} |
|
2713 |
||
2714 |
||
2715 |
// ----------------------------------------------------------------------------- |
|
2716 |
// CBrowserAppUi::CreateWindowInfoLC() |
|
2717 |
// ----------------------------------------------------------------------------- |
|
2718 |
// |
|
2719 |
HBufC* CBrowserAppUi::CreateWindowInfoLC( const CBrowserWindow& aWindow ) |
|
2720 |
{ |
|
2721 |
HBufC* buf = aWindow.BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoTitle ); |
|
2722 |
if( !buf || !buf->Length() ) |
|
2723 |
{ |
|
2724 |
CleanupStack::PopAndDestroy( buf ); |
|
2725 |
buf = aWindow.BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl ); |
|
2726 |
if( !buf ) |
|
2727 |
{ |
|
2728 |
||
2729 |
CleanupStack::PopAndDestroy( buf ); |
|
2730 |
buf = KNullDesC().AllocLC(); |
|
2731 |
} |
|
2732 |
} |
|
2733 |
return buf; |
|
2734 |
} |
|
2735 |
||
2736 |
#ifdef BRDO_OCC_ENABLED_FF |
|
2737 |
// ----------------------------------------------------------------------------- |
|
71
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2738 |
// CBrowserContentView::SetNewConnFlag |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2739 |
// ----------------------------------------------------------------------------- |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2740 |
// |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2741 |
void CBrowserAppUi::SetNewConnFlag(TBool flag) |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2742 |
{ |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2743 |
LOG_ENTERFN("CBrowserAppUi::SetNewConnFlag"); |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2744 |
iNewConnFlag = flag; |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2745 |
} |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2746 |
|
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2747 |
// ----------------------------------------------------------------------------- |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2748 |
// CBrowserContentView::GetNewConnFlag |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2749 |
// ----------------------------------------------------------------------------- |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2750 |
// |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2751 |
TBool CBrowserAppUi::GetNewConnFlag() |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2752 |
{ |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2753 |
LOG_ENTERFN("CBrowserAppUi::GetNewConnFlag"); |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2754 |
return iNewConnFlag; |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2755 |
} |
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2756 |
// ----------------------------------------------------------------------------- |
65 | 2757 |
// CBrowserContentView::SetRetryFlag |
2758 |
// ----------------------------------------------------------------------------- |
|
2759 |
// |
|
2760 |
void CBrowserAppUi::SetRetryFlag(TBool flag) |
|
2761 |
{ |
|
2762 |
LOG_ENTERFN("CBrowserAppUi::SetRetryFlag"); |
|
2763 |
BROWSER_LOG( ( _L(" CBrowserAppUi::SetRetryFlag flag: %d"), flag ) ); |
|
2764 |
reConnectivityFlag = flag; |
|
2765 |
} |
|
2766 |
||
2767 |
// ----------------------------------------------------------------------------- |
|
2768 |
// CBrowserContentView::GetRetryFlag |
|
2769 |
// ----------------------------------------------------------------------------- |
|
2770 |
// |
|
2771 |
TBool CBrowserAppUi::GetRetryFlag() |
|
2772 |
{ |
|
2773 |
LOG_ENTERFN("CBrowserAppUi::GetRetryFlag"); |
|
2774 |
BROWSER_LOG( ( _L(" CBrowserAppUi::GetRetryFlag flag: %d"), reConnectivityFlag ) ); |
|
2775 |
return reConnectivityFlag; |
|
2776 |
} |
|
2777 |
||
2778 |
// ----------------------------------------------------------------------------- |
|
2779 |
// CBrowserContentView::RetryConnectivity |
|
2780 |
// ----------------------------------------------------------------------------- |
|
2781 |
// |
|
2782 |
TInt CBrowserAppUi::RetryConnectivity(TAny* aCBrowserAppUi) |
|
2783 |
{ |
|
2784 |
LOG_ENTERFN("CBrowserAppUi::RetryConnectivity"); |
|
2785 |
__ASSERT_DEBUG(aCBrowserAppUi, Util::Panic( Util::EUninitializedData )); |
|
2786 |
||
2787 |
TInt err = ((CBrowserAppUi*)aCBrowserAppUi)->RetryInternetConnection(); |
|
2788 |
||
2789 |
BROWSER_LOG( ( _L(" CBrowserAppUi::RetryConnectivity Error: %d"), err ) ); |
|
2790 |
return err; |
|
2791 |
} |
|
2792 |
||
2793 |
TInt CBrowserAppUi::RetryInternetConnection() |
|
2794 |
{ |
|
2795 |
LOG_ENTERFN("CBrowserAppUi::RetryInternetConnection"); |
|
2796 |
//First cancel the timer |
|
2797 |
if ( iRetryConnectivity && iRetryConnectivity->IsActive() ) |
|
2798 |
{ |
|
2799 |
iRetryConnectivity->Cancel(); |
|
2800 |
BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection Timer Cancelled successfully " ) ) ); |
|
2801 |
} |
|
2802 |
TInt err = KErrNone; |
|
2803 |
if ( !iConnection->Connected() ) |
|
2804 |
{ |
|
2805 |
TRAP_IGNORE( err = iConnection->StartConnectionL( ETrue ) ); |
|
2806 |
} |
|
2807 |
if( err == KErrNone ) |
|
2808 |
{ |
|
2809 |
BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection Connection restablished successfully " ) ) ); |
|
2810 |
||
2811 |
BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection UNSET retry flags " ) ) ); |
|
2812 |
TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandUnSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
2813 |
SetRetryFlag(EFalse); |
|
71
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2814 |
BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection Setting new conn flag " ) ) ); |
65 | 2815 |
TRAP_IGNORE(ConnNeededStatusL(err)); //Start the observer again |
2816 |
TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandRetryTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
2817 |
//Let download manager knows about this new connection |
|
2818 |
TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandConnToDownloadManager + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
71
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2819 |
SetNewConnFlag(ETrue); |
65 | 2820 |
} |
2821 |
else |
|
2822 |
{ |
|
2823 |
BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection Connection failed " ) ) ); |
|
2824 |
BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection unset retry flags " ) ) ); |
|
2825 |
TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandUnSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
2826 |
SetRetryFlag(EFalse); |
|
2827 |
BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection clear queued transactions " ) ) ); |
|
2828 |
Display().StopProgressAnimationL(); //Stop Progress animation |
|
2829 |
if ( Fetching() ) |
|
2830 |
{ |
|
2831 |
BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection cancel fetch " ) ) ); |
|
2832 |
CancelFetch(); |
|
2833 |
} |
|
2834 |
iDialogsProvider->UploadProgressNoteL(0, 0, ETrue, (MBrowserDialogsProviderObserver *)this ); //Close the uploading dialog. |
|
2835 |
iDialogsProvider->CancelAll(); //connection has been lost, so cancel the authentication dialog. |
|
71
a45dccb283c5
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
65
diff
changeset
|
2836 |
TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandClearQuedTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
65 | 2837 |
} |
2838 |
||
2839 |
return err; |
|
2840 |
} |
|
2841 |
||
2842 |
void CBrowserAppUi::CheckOccConnectionStage() |
|
2843 |
{ |
|
2844 |
LOG_ENTERFN("CBrowserAppUi::CheckOccConnectionStage"); |
|
2845 |
||
2846 |
//Disconnect first |
|
2847 |
BROWSER_LOG( ( _L( "CBrowserAppUi::CheckOccConnectionStage Disconnecting..." ) ) ); |
|
2848 |
iConnection->Disconnect(); |
|
2849 |
||
2850 |
TNifProgressBuf buf = iConnStageNotifier->GetProgressBuffer(); |
|
2851 |
if( buf().iError == KErrDisconnected ) |
|
2852 |
{ |
|
2853 |
BROWSER_LOG( ( _L("CBrowserAppUi::CheckOccConnectionStage This is OCC roaming error : %d"), buf().iError ) ); |
|
2854 |
BROWSER_LOG( ( _L( "CBrowserAppUi::CheckOccConnectionStage Set retry flags " ) ) ); |
|
2855 |
TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
2856 |
SetRetryFlag(ETrue); |
|
2857 |
TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelQueuedTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
2858 |
||
2859 |
if( iRetryConnectivity && iRetryConnectivity->IsActive()) |
|
2860 |
{ |
|
2861 |
iRetryConnectivity->Cancel(); |
|
2862 |
} |
|
2863 |
iRetryConnectivity->Start(KRetryConnectivityTimeout, 0,TCallBack(RetryConnectivity,this)); |
|
2864 |
} |
|
2865 |
else |
|
2866 |
{ |
|
2867 |
BROWSER_LOG( ( _L("CBrowserAppUi::CheckOccConnectionStage This is NOT OCC roaming error : %d"), buf().iError ) ); |
|
2868 |
Display().StopProgressAnimationL(); |
|
2869 |
if ( Fetching() ) |
|
2870 |
{ |
|
2871 |
CancelFetch(); |
|
2872 |
} |
|
2873 |
iDialogsProvider->UploadProgressNoteL(0, 0, ETrue, (MBrowserDialogsProviderObserver *)this ); |
|
2874 |
iDialogsProvider->CancelAll(); |
|
2875 |
} |
|
2876 |
} |
|
2877 |
#endif |
|
2878 |
||
2879 |
// ----------------------------------------------------------------------------- |
|
2880 |
// CBrowserAppUi::ConnectionStageAchievedL() |
|
2881 |
// ----------------------------------------------------------------------------- |
|
2882 |
// |
|
2883 |
void CBrowserAppUi::ConnectionStageAchievedL() |
|
2884 |
{ |
|
2885 |
#ifdef BRDO_OCC_ENABLED_FF |
|
2886 |
LOG_ENTERFN("CBrowserAppUi::ConnectionStageAchievedL"); |
|
2887 |
CheckOccConnectionStage(); |
|
2888 |
#else |
|
2889 |
// this function is called only when network is lost |
|
2890 |
// because we set notifier for KAgentUnconnected only |
|
2891 |
Display().StopProgressAnimationL(); |
|
2892 |
if ( Fetching() ) |
|
2893 |
{ |
|
2894 |
CancelFetch(); |
|
2895 |
} |
|
2896 |
//Close the uploading dialog. |
|
2897 |
iDialogsProvider->UploadProgressNoteL( |
|
2898 |
0, 0, ETrue, (MBrowserDialogsProviderObserver *)this ); |
|
2899 |
//connection has been lost, so cancel the authentication dialog. |
|
2900 |
iDialogsProvider->CancelAll(); |
|
2901 |
// SendDisconnectEventL(); |
|
2902 |
// not needed as by that point HTTPSession was already shutdown by executing disconnect menu option |
|
2903 |
// will cause a crash when user tries to quickly reconnect right after disconnecting, as HTTP session |
|
2904 |
// is starting to initialize, while this call is trying to close it. |
|
2905 |
#endif |
|
2906 |
} |
|
2907 |
||
2908 |
||
2909 |
// ----------------------------------------------------------------------------- |
|
2910 |
// CBrowserAppUi::UpdateSoftKeys |
|
2911 |
// ----------------------------------------------------------------------------- |
|
2912 |
// |
|
2913 |
void CBrowserAppUi::UpdateSoftKeys() |
|
2914 |
{ |
|
2915 |
TRAP_IGNORE( UpdateCbaL() ); |
|
2916 |
} |
|
2917 |
||
2918 |
// ----------------------------------------------------------------------------- |
|
2919 |
// CBrowserAppUi::DeleteCookiesL |
|
2920 |
// ----------------------------------------------------------------------------- |
|
2921 |
// |
|
2922 |
void CBrowserAppUi::DeleteCookiesL() |
|
2923 |
{ |
|
2924 |
// stringPool is not needed to initialize |
|
2925 |
RStringPool stringPool; |
|
2926 |
RCookieManager cookieManager( stringPool ); |
|
2927 |
TInt num(0); |
|
2928 |
||
2929 |
User::LeaveIfError( cookieManager.Connect() ); |
|
2930 |
CleanupClosePushL( cookieManager ); |
|
2931 |
User::LeaveIfError( cookieManager.ClearCookies( num ) ); |
|
2932 |
CleanupStack::PopAndDestroy( &cookieManager ); |
|
2933 |
||
2934 |
stringPool.Close(); |
|
2935 |
} |
|
2936 |
||
2937 |
// ----------------------------------------------------------------------------- |
|
2938 |
// CBrowserAppUi::LaunchHomePageL |
|
2939 |
// ----------------------------------------------------------------------------- |
|
2940 |
// |
|
2941 |
void CBrowserAppUi::LaunchHomePageL() |
|
2942 |
{ |
|
2943 |
LOG_ENTERFN( "CBrowserAppUi::LaunchHomePageL" ); |
|
2944 |
TWmlSettingsHomePage pgtype = iPreferences->HomePageType(); |
|
2945 |
TBool alwaysAskCase = (( Preferences().AccessPointSelectionMode() == EAlwaysAsk ) && |
|
2946 |
( EWmlSettingsHomePageAccessPoint == pgtype )); |
|
2947 |
BROWSER_LOG( ( _L( "pgtype: %d, alwaysAsk: %d" ), pgtype, alwaysAskCase ) ); |
|
2948 |
||
2949 |
if( ( pgtype == EWmlSettingsHomePageBookmarks ) || alwaysAskCase ) |
|
2950 |
// Bookmarks is selected as HomePage |
|
2951 |
// has effect only for startup, otherwise 'Home' command is not shown |
|
2952 |
{ |
|
2953 |
ContentView()->SetFullScreenOffL(); |
|
2954 |
// view change will be done somewhere else |
|
2955 |
SetLastActiveViewId( KUidBrowserBookmarksViewId ); |
|
2956 |
SetViewToBeActivatedIfNeededL( LastActiveViewId() ); |
|
2957 |
return; |
|
2958 |
} |
|
2959 |
||
2960 |
HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack |
|
2961 |
TPtr ptr( buf->Des() ); |
|
2962 |
TInt pgFound( KErrNotFound ); |
|
2963 |
||
2964 |
pgFound = Preferences().HomePageUrlL( ptr ); |
|
2965 |
BROWSER_LOG( ( _L( "pgFound 1: %d" ), pgFound ) ); |
|
2966 |
||
2967 |
||
2968 |
if( pgFound == KErrNone ) // Home page url found, fetch the url |
|
2969 |
{ |
|
2970 |
SetLastActiveViewId( KUidBrowserContentViewId ); |
|
2971 |
FetchL( ptr ); |
|
2972 |
} |
|
2973 |
else // Home page not found, or not defined, go to BookMarksView |
|
2974 |
{ |
|
2975 |
TVwsViewId activeViewId; |
|
2976 |
if( ( GetActiveViewId( activeViewId ) != KErrNone ) || |
|
2977 |
( activeViewId.iViewUid == KUidBrowserContentViewId ) ) |
|
2978 |
{ |
|
2979 |
ContentView()->SetFullScreenOffL(); |
|
2980 |
} |
|
2981 |
SetLastActiveViewId( KUidBrowserBookmarksViewId ); |
|
2982 |
SetViewToBeActivatedIfNeededL( LastActiveViewId() ); |
|
2983 |
} |
|
2984 |
CleanupStack::PopAndDestroy( buf ); |
|
2985 |
} |
|
2986 |
||
2987 |
// ----------------------------------------------------------------------------- |
|
2988 |
// CBrowserAppUi::ClearTheCacheL |
|
2989 |
// ----------------------------------------------------------------------------- |
|
2990 |
// |
|
2991 |
void CBrowserAppUi::ClearTheCacheL(TBool afterQuery, TBool aShowDoneNote) |
|
2992 |
{ |
|
2993 |
TUint32 totalBytesFlushed = BrCtlInterface().ClearCache(); |
|
2994 |
if(afterQuery || totalBytesFlushed) |
|
2995 |
{ |
|
2996 |
||
2997 |
HBufC* resultText = NULL; |
|
2998 |
HBufC* tempText = NULL; |
|
2999 |
TBuf<12> totalText; |
|
3000 |
||
3001 |
totalText.Num ((TInt)totalBytesFlushed); |
|
3002 |
||
3003 |
resultText = StringLoader::LoadLC( R_TEXT_WML_CACHE_EMPTIED_NOTE); |
|
3004 |
//CleanupStack::PushL(resultText); |
|
3005 |
tempText = HBufC::NewLC( resultText->Length() + totalText.Length() ); |
|
3006 |
//CleanupStack::PushL(tempText); |
|
3007 |
||
3008 |
tempText->Des().AppendFormat( resultText->Des(), totalBytesFlushed ); |
|
3009 |
||
3010 |
||
3011 |
||
3012 |
if(aShowDoneNote) |
|
3013 |
{ |
|
3014 |
TBrowserDialogs::InfoNoteL ( R_BROWSER_OK_NOTE, tempText->Des() ); |
|
3015 |
} |
|
3016 |
CleanupStack::PopAndDestroy(2); //resultText, tempText |
|
3017 |
} |
|
3018 |
} |
|
3019 |
||
3020 |
// --------------------------------------------------------- |
|
3021 |
// CBrowserAppUi::ClearFormAndPasswdDataL |
|
3022 |
// --------------------------------------------------------- |
|
3023 |
// |
|
3024 |
void CBrowserAppUi::ClearFormAndPasswdDataL(TBool aShowPromptAndComplete) |
|
3025 |
{ |
|
3026 |
if (aShowPromptAndComplete) |
|
3027 |
{ |
|
3028 |
CAknQueryDialog* query = CAknQueryDialog::NewL(); |
|
3029 |
if ( query->ExecuteLD( R_BROWSER_CLEARFORMPASSWDDATA_QUERY ) ) |
|
3030 |
{ |
|
3031 |
// call brctl to clear form and password data |
|
3032 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandClearAutoFormFillData + |
|
3033 |
(TInt)TBrCtlDefs::ECommandIdBase ); |
|
3034 |
||
3035 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandClearAutoFormFillPasswordData + |
|
3036 |
(TInt)TBrCtlDefs::ECommandIdBase ); |
|
3037 |
||
3038 |
TBrowserDialogs::InfoNoteL( |
|
3039 |
R_BROWSER_OK_NOTE, R_QTN_BROWSER_NOTE_FORM_AND_PASSWD_DATA_CLEARED ); |
|
3040 |
} |
|
3041 |
||
3042 |
} |
|
3043 |
else |
|
3044 |
{ |
|
3045 |
// call brctl to clear form and password data |
|
3046 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandClearAutoFormFillData + |
|
3047 |
(TInt)TBrCtlDefs::ECommandIdBase ); |
|
3048 |
||
3049 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandClearAutoFormFillPasswordData + |
|
3050 |
(TInt)TBrCtlDefs::ECommandIdBase ); |
|
3051 |
||
3052 |
} |
|
3053 |
} |
|
3054 |
||
3055 |
||
3056 |
// --------------------------------------------------------- |
|
3057 |
// CBrowserAppUi::ClearHistoryWithPromptL |
|
3058 |
// --------------------------------------------------------- |
|
3059 |
// |
|
3060 |
void CBrowserAppUi::ClearHistoryWithPromptL() |
|
3061 |
{ |
|
3062 |
CAknQueryDialog* query = CAknQueryDialog::NewL(); |
|
3063 |
||
3064 |
if ( query->ExecuteLD( R_BROWSER_CLEARHISTORYDATA_QUERY ) ) |
|
3065 |
{ |
|
3066 |
ClearHistoryL(); |
|
3067 |
TBrowserDialogs::InfoNoteL( R_BROWSER_OK_NOTE, |
|
3068 |
R_QTN_BROWSER_NOTE_HISTORY_CLEARED ); |
|
3069 |
} |
|
3070 |
} |
|
3071 |
||
3072 |
// --------------------------------------------------------- |
|
3073 |
// CBrowserAppUi::ClearHistoryL |
|
3074 |
// --------------------------------------------------------- |
|
3075 |
// |
|
3076 |
void CBrowserAppUi::ClearHistoryL() |
|
3077 |
{ |
|
3078 |
if (iWindowManager) |
|
3079 |
{ |
|
3080 |
iWindowManager->SendCommandToAllWindowsL( |
|
3081 |
(TInt)TBrCtlDefs::ECommandClearHistory + (TInt)TBrCtlDefs::ECommandIdBase); |
|
3082 |
} |
|
3083 |
||
3084 |
if (!(Preferences().AdaptiveBookmarks()==EWmlSettingsAdaptiveBookmarksOff )) |
|
3085 |
{ |
|
3086 |
// This call will ensure that the bookmarks are cleared when we are |
|
3087 |
// outside the bookmarksview since the next call doesn't do anything in |
|
3088 |
// that case due to the unset Container pointer. |
|
3089 |
iRecentUrlStore->ClearData(); |
|
3090 |
||
3091 |
// Below will serve for when we are called from BookmarksView to ensure |
|
3092 |
// thorough clearing and view refresh after clearing adapt bookmarks |
|
3093 |
iBookmarksView->HandleCommandL(EWmlCmdClearAdaptiveBookmarksNoPrompt); |
|
3094 |
} |
|
3095 |
||
3096 |
UpdateCbaL(); |
|
3097 |
||
3098 |
} |
|
3099 |
||
3100 |
// --------------------------------------------------------- |
|
3101 |
// CBrowserAppUi::ClearAllPrivacyL |
|
3102 |
// --------------------------------------------------------- |
|
3103 |
// |
|
3104 |
void CBrowserAppUi::ClearAllPrivacyL() |
|
3105 |
{ |
|
3106 |
||
3107 |
CAknQueryDialog* query = CAknQueryDialog::NewL(); |
|
3108 |
if ( query->ExecuteLD( R_BROWSER_CLEARPRIVACYDATA_QUERY ) ) |
|
3109 |
{ |
|
3110 |
ClearTheCacheL(EFalse, EFalse); // false -> no prompt or info note after op |
|
3111 |
DeleteCookiesL(); |
|
3112 |
ClearHistoryL(); |
|
3113 |
ClearFormAndPasswdDataL(EFalse); // no prompt or completed info note |
|
3114 |
||
3115 |
TBrowserDialogs::InfoNoteL( |
|
3116 |
R_BROWSER_OK_NOTE, R_QTN_BROWSER_NOTE_CLEAR_ALL_PRIVACY_DONE ); |
|
3117 |
} |
|
3118 |
} |
|
3119 |
||
3120 |
||
3121 |
// ----------------------------------------------------------------------------- |
|
3122 |
// CBrowserAppUi::DisconnectL |
|
3123 |
// ----------------------------------------------------------------------------- |
|
3124 |
// |
|
3125 |
void CBrowserAppUi::DisconnectL() |
|
3126 |
{ |
|
3127 |
//#pragma message("TODO: inform LoadObserver?") |
|
3128 |
SendDisconnectEventL(); |
|
3129 |
Connection().Disconnect(); |
|
3130 |
||
3131 |
#ifdef __RSS_FEEDS |
|
3132 |
iFeedsClientUtilities->DisconnectFeedsViewL(); |
|
3133 |
//notify feeds engine to close the connection |
|
3134 |
iFeedsClientUtilities->DisconnectManualUpdateConnectionL(); |
|
3135 |
#endif |
|
3136 |
} |
|
3137 |
||
3138 |
||
3139 |
// ----------------------------------------------------------------------------- |
|
3140 |
// CBrowserAppUi::BmOTABinSenderL() |
|
3141 |
// ----------------------------------------------------------------------------- |
|
3142 |
// |
|
3143 |
MBmOTABinSender& CBrowserAppUi::BmOTABinSenderL() |
|
3144 |
{ |
|
3145 |
if (!iSender) |
|
3146 |
{ |
|
3147 |
iLateSendUi->Cancel(); |
|
3148 |
DoConstructSendUiL(); |
|
3149 |
} |
|
3150 |
return *iSender; |
|
3151 |
} |
|
3152 |
||
3153 |
||
3154 |
// ----------------------------------------------------------------------------- |
|
3155 |
// CBrowserAppUi::ContentView() |
|
3156 |
// ----------------------------------------------------------------------------- |
|
3157 |
// |
|
3158 |
CBrowserContentView* CBrowserAppUi::ContentView() const |
|
3159 |
{ |
|
3160 |
return (CBrowserContentView*)View( KUidBrowserContentViewId ); |
|
3161 |
} |
|
3162 |
||
3163 |
||
3164 |
// ----------------------------------------------------------------------------- |
|
3165 |
// CBrowserAppUi::FetchL |
|
3166 |
// ----------------------------------------------------------------------------- |
|
3167 |
// |
|
3168 |
void CBrowserAppUi::FetchL( const TDesC& aUrl, CBrowserLoadObserver::TBrowserLoadUrlType aUrlType ) |
|
3169 |
{ |
|
3170 |
TFavouritesWapAp ap; |
|
3171 |
ap.SetDefault(); |
|
3172 |
FetchL( aUrl, KNullDesC, KNullDesC, ap, aUrlType ); |
|
3173 |
} |
|
3174 |
||
3175 |
// TO DO: done by BaP |
|
3176 |
// ----------------------------------------------------------------------------- |
|
3177 |
// CBrowserAppUi::CancelFetch |
|
3178 |
// ----------------------------------------------------------------------------- |
|
3179 |
// |
|
3180 |
void CBrowserAppUi::CancelFetch( TBool aIsUserInitiated /*= EFalse*/ ) |
|
3181 |
{ |
|
3182 |
LoadObserver().DoEndLoad( aIsUserInitiated ); |
|
3183 |
TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
3184 |
SetContentDisplayed(ETrue); |
|
3185 |
} |
|
3186 |
||
3187 |
||
3188 |
// ---------------------------------------------------------------------------------------- |
|
3189 |
// CBrowserAppUi::HandleMessageL |
|
3190 |
// |
|
3191 |
// Changes the URL to another if WAP is running before Wap Url |
|
3192 |
// is started from Desk |
|
3193 |
// ---------------------------------------------------------------------------------------- |
|
3194 |
// |
|
3195 |
MCoeMessageObserver::TMessageResponse CBrowserAppUi::HandleMessageL( |
|
3196 |
TUint32 aClientHandleOfTargetWindowGroup, |
|
3197 |
TUid aMessageUid, |
|
3198 |
const TDesC8& aMessageParameters ) |
|
3199 |
{ |
|
3200 |
iBrowserAlreadyRunning = ETrue; |
|
3201 |
TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
|
3202 |
TUid wapUid = KUidBrowserApplication; |
|
3203 |
TApaTask task = taskList.FindApp( wapUid ); |
|
3204 |
task.BringToForeground(); |
|
3205 |
//Check for aMessageUid. If it is in array then set iSameWinApp = ETrue |
|
3206 |
iSameWinApp = IsSameWinApp(aMessageUid); |
|
3207 |
if ( aMessageParameters.Compare( KLongZeroIdString ) ) |
|
3208 |
{ |
|
3209 |
ParseAndProcessParametersL( aMessageParameters ); |
|
3210 |
} |
|
3211 |
return CAknViewAppUi::HandleMessageL( |
|
3212 |
aClientHandleOfTargetWindowGroup, |
|
3213 |
aMessageUid, |
|
3214 |
aMessageParameters); |
|
3215 |
} |
|
3216 |
||
3217 |
// ---------------------------------------------------------------------------------- |
|
3218 |
// CBrowserAppUi::UpdateNaviPaneL |
|
3219 |
// ---------------------------------------------------------------------------------- |
|
3220 |
// |
|
3221 |
void CBrowserAppUi::UpdateNaviPaneL( TDesC& aStatusMsg ) |
|
3222 |
{ |
|
3223 |
ContentView()->UpdateNaviPaneL( aStatusMsg ); |
|
3224 |
} |
|
3225 |
||
3226 |
// ---------------------------------------------------------------------------------- |
|
3227 |
// CBrowserAppUi::StopDelay |
|
3228 |
// ---------------------------------------------------------------------------------- |
|
3229 |
// |
|
3230 |
TInt CBrowserAppUi::StopDelay( TAny* aCBrowserAppUi ) |
|
3231 |
{ |
|
3232 |
__ASSERT_DEBUG(aCBrowserAppUi, Util::Panic( Util::EUninitializedData )); |
|
3233 |
||
3234 |
((CBrowserAppUi*)aCBrowserAppUi)->DoStopDelay(); |
|
3235 |
return 0; |
|
3236 |
} |
|
3237 |
||
3238 |
||
3239 |
// ---------------------------------------------------------------------------------- |
|
3240 |
// CBrowserAppUi::DoStopDelay |
|
3241 |
// ---------------------------------------------------------------------------------- |
|
3242 |
// |
|
3243 |
void CBrowserAppUi::DoStopDelay() |
|
3244 |
{ |
|
3245 |
iWait.AsyncStop(); |
|
3246 |
} |
|
3247 |
||
3248 |
// ---------------------------------------------------------------------------------- |
|
3249 |
// CBrowserAppUi::DelayedSendUiConstructL |
|
3250 |
// ---------------------------------------------------------------------------------- |
|
3251 |
// |
|
3252 |
/*static*/ TInt CBrowserAppUi::DelayedSendUiConstructL( TAny* aCBrowserAppUi ) |
|
3253 |
{ |
|
3254 |
__ASSERT_DEBUG(aCBrowserAppUi, Util::Panic( Util::EUninitializedData )); |
|
3255 |
TRAP_IGNORE( |
|
3256 |
((CBrowserAppUi*)aCBrowserAppUi)->DoConstructSendUiL(); |
|
3257 |
); |
|
3258 |
return KErrNone; |
|
3259 |
} |
|
3260 |
||
3261 |
||
3262 |
// ---------------------------------------------------------------------------------- |
|
3263 |
// CBrowserAppUi::DoConstructSendUiL |
|
3264 |
// ---------------------------------------------------------------------------------- |
|
3265 |
// |
|
3266 |
void CBrowserAppUi::DoConstructSendUiL() |
|
3267 |
{ |
|
3268 |
__ASSERT_DEBUG(!iSender, Util::Panic( Util::EUnExpected )); |
|
3269 |
iSender = CWmlBrowserBmOTABinSender::NewL(); |
|
3270 |
} |
|
3271 |
||
3272 |
// ----------------------------------------------------------------------------------- |
|
3273 |
// CBrowserAppUi::SetViewToReturnOnClose |
|
3274 |
// ----------------------------------------------------------------------------------- |
|
3275 |
// |
|
3276 |
void CBrowserAppUi::SetViewToReturnOnClose( TUid const &aUid ) |
|
3277 |
{ |
|
3278 |
iViewToReturnOnClose.iUid = aUid.iUid; |
|
3279 |
} |
|
3280 |
||
3281 |
// ----------------------------------------------------------------------------------- |
|
3282 |
// CBrowserAppUi::CloseContentViewL |
|
3283 |
// ----------------------------------------------------------------------------------- |
|
3284 |
// |
|
3285 |
void CBrowserAppUi::CloseContentViewL() |
|
3286 |
{ |
|
3287 |
LOG_ENTERFN("CBrowserAppUi::CloseContentViewL"); |
|
3288 |
CBrowserAppDocument* doc = STATIC_CAST(CBrowserAppDocument*, Document()); |
|
3289 |
||
3290 |
// Close should Exit asynchronously if called from another application |
|
3291 |
// & if not in feeds view |
|
3292 |
#ifdef __RSS_FEEDS |
|
3293 |
if(CalledFromAnotherApp() && (!IsEmbeddedModeOn()) |
|
3294 |
&& (GetPreviousViewFromViewHistory() != KUidBrowserFeedsFolderViewId) |
|
3295 |
&& (GetPreviousViewFromViewHistory() != KUidBrowserFeedsTopicViewId) |
|
3296 |
&& (GetPreviousViewFromViewHistory() != KUidBrowserFeedsFeedViewId )) |
|
3297 |
{ |
|
3298 |
SetExitInProgress( ETrue ); |
|
3299 |
BROWSER_LOG( ( _L( " iBrowserAsyncExit->Start()" ) ) ); |
|
3300 |
iBrowserAsyncExit->Start(); |
|
3301 |
} |
|
3302 |
#else |
|
3303 |
if(CalledFromAnotherApp() && !IsEmbeddedModeOn()) |
|
3304 |
{ |
|
3305 |
SetExitInProgress( ETrue ); |
|
3306 |
BROWSER_LOG( ( _L( " iBrowserAsyncExit->Start()" ) ) ); |
|
3307 |
iBrowserAsyncExit->Start(); |
|
3308 |
} |
|
3309 |
#endif // __RSS_FEEDS |
|
3310 |
||
3311 |
else |
|
3312 |
{ |
|
3313 |
if ( IsEmbeddedModeOn() && |
|
3314 |
doc->GetFolderToOpen() == KFavouritesRootUid ) |
|
3315 |
{ |
|
3316 |
ExitBrowser(ETrue); |
|
3317 |
} |
|
3318 |
else |
|
3319 |
{ |
|
3320 |
if ( iStartedUp && ContentView()->GetPreviousViewID() == KUidBrowserBookmarksViewId ) |
|
3321 |
{ |
|
3322 |
if ( GetBookmarksView()->GetAdaptiveBookmarksFolderWasActive() ) |
|
3323 |
{ |
|
3324 |
GetBookmarksView()->OpenAdaptiveBookmarksWhenActivated(); |
|
3325 |
} |
|
3326 |
SetViewToBeActivatedIfNeededL( KUidBrowserBookmarksViewId ); |
|
3327 |
} |
|
3328 |
else if ( IsEmbeddedModeOn()) |
|
3329 |
{ |
|
3330 |
if( !iExitInProgress ) |
|
3331 |
{ |
|
3332 |
ExitBrowser( ETrue ); |
|
3333 |
} |
|
3334 |
} |
|
3335 |
else |
|
3336 |
{ |
|
3337 |
if(CalledFromAnotherApp() && (!IsEmbeddedModeOn())) |
|
3338 |
{ |
|
3339 |
SetViewToBeActivatedIfNeededL( GetPreviousViewFromViewHistory()); |
|
3340 |
SetCalledFromAnotherApp(EFalse); |
|
3341 |
SendBrowserToBackground(); |
|
3342 |
} |
|
3343 |
else |
|
3344 |
{ |
|
3345 |
SetViewToBeActivatedIfNeededL( iViewToReturnOnClose ); |
|
3346 |
} |
|
3347 |
} |
|
3348 |
} |
|
3349 |
} |
|
3350 |
} |
|
3351 |
||
3352 |
// ----------------------------------------------------------------------------------- |
|
3353 |
// CBrowserAppUi::IsEmbeddedModeOn |
|
3354 |
// ----------------------------------------------------------------------------------- |
|
3355 |
// |
|
3356 |
TBool CBrowserAppUi::IsEmbeddedModeOn() const |
|
3357 |
{ |
|
3358 |
return iEikonEnv->StartedAsServerApp(); |
|
3359 |
} |
|
3360 |
||
3361 |
// ----------------------------------------------------------------------------------- |
|
3362 |
// CBrowserAppUi::HistoryLoadPrevious |
|
3363 |
// ----------------------------------------------------------------------------------- |
|
3364 |
// |
|
3365 |
void CBrowserAppUi::HistoryLoadPrevious() |
|
3366 |
{ |
|
3367 |
if( BrCtlInterface().NavigationAvailable( TBrCtlDefs::ENavigationBack ) ) |
|
3368 |
{ |
|
3369 |
TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandBack + |
|
3370 |
(TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
3371 |
} |
|
3372 |
} |
|
3373 |
||
3374 |
// ----------------------------------------------------------------------------------- |
|
3375 |
// CBrowserAppUi::HistoryLoadNext |
|
3376 |
// ----------------------------------------------------------------------------------- |
|
3377 |
// |
|
3378 |
void CBrowserAppUi::HistoryLoadNext() |
|
3379 |
{ |
|
3380 |
if( BrCtlInterface().NavigationAvailable( TBrCtlDefs::ENavigationForward ) ) |
|
3381 |
{ |
|
3382 |
LoadObserver().DoStartLoad( CBrowserLoadObserver::ELoadUrlTypeOther ); |
|
3383 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandForward + |
|
3384 |
(TInt)TBrCtlDefs::ECommandIdBase ); |
|
3385 |
} |
|
3386 |
} |
|
3387 |
||
3388 |
||
3389 |
// --------------------------------------------------------------------------- |
|
3390 |
// CBrowserAppUi::IsShutdownRequested |
|
3391 |
// --------------------------------------------------------------------------- |
|
3392 |
// |
|
3393 |
TBool CBrowserAppUi::IsShutdownRequested() const |
|
3394 |
{ |
|
3395 |
return iShutdownRequested; |
|
3396 |
} |
|
3397 |
||
3398 |
// --------------------------------------------------------------------------- |
|
3399 |
// CBrowserAppUi::IsEmbeddedInOperatorMenu |
|
3400 |
// --------------------------------------------------------------------------- |
|
3401 |
// |
|
3402 |
TBool CBrowserAppUi::IsEmbeddedInOperatorMenu() const |
|
3403 |
{ |
|
3404 |
const TUid KUidOperatorMenuApp = { 0x10008D5E }; |
|
3405 |
const TUid KUidVideoServicesApp = { 0x10281893 }; |
|
3406 |
||
3407 |
// If the embedding application is the Operator Menu or Video Services |
|
3408 |
if ( iEmbeddingApplicationUid == KUidOperatorMenuApp || iEmbeddingApplicationUid == KUidVideoServicesApp ) |
|
3409 |
{ |
|
3410 |
return ETrue; |
|
3411 |
} |
|
3412 |
else |
|
3413 |
{ |
|
3414 |
return EFalse; |
|
3415 |
} |
|
3416 |
} |
|
3417 |
||
3418 |
// --------------------------------------------------------------------------- |
|
3419 |
// CBrowserAppUi::IsAppShutterActive |
|
3420 |
// --------------------------------------------------------------------------- |
|
3421 |
// |
|
3422 |
TBool CBrowserAppUi::IsAppShutterActive() const |
|
3423 |
{ |
|
3424 |
CAknAppUi* shuttingApp = CAknEnv::AppWithShutterRunning(); |
|
3425 |
||
3426 |
if ( shuttingApp ) |
|
3427 |
{ |
|
3428 |
return ETrue; |
|
3429 |
} |
|
3430 |
else |
|
3431 |
{ |
|
3432 |
return EFalse; |
|
3433 |
} |
|
3434 |
} |
|
3435 |
||
3436 |
// --------------------------------------------------------------------------- |
|
3437 |
// CBrowserAppUi::FetchHomePage |
|
3438 |
// -------------------------------------------------------------------------- |
|
3439 |
// |
|
3440 |
void CBrowserAppUi::FetchHomePageL() |
|
3441 |
{ |
|
3442 |
LOG_ENTERFN( "CBrowserAppUi::FetchHomePageL" ); |
|
3443 |
if(!iStartedUp) // just in case, not done |
|
3444 |
CompleteDelayedInit(); |
|
3445 |
||
3446 |
if ( !Fetching() ) |
|
3447 |
{ |
|
3448 |
UpdateSoftKeys(); |
|
3449 |
||
3450 |
// If the last active view is content view, return to the bookmark view on close. |
|
3451 |
// Otherwise if the last active view is bookmark view and we return to the appropriate view on close. |
|
3452 |
TUid lastViewId = LastActiveViewId(); |
|
3453 |
if( lastViewId == KUidBrowserContentViewId || |
|
3454 |
lastViewId == KUidBrowserNullViewId ) |
|
3455 |
{ |
|
3456 |
lastViewId = KUidBrowserBookmarksViewId; |
|
3457 |
} |
|
3458 |
SetViewToReturnOnClose( lastViewId ); |
|
3459 |
||
3460 |
if( iLongZeroPressed ) |
|
3461 |
{ |
|
3462 |
BROWSER_LOG( ( _L( " LongZeroPressed." ) ) ); |
|
3463 |
||
3464 |
// There should only be one special load observer at startup |
|
3465 |
SpecialLoadObserver().SetLongZeroStartup( iLongZeroPressed ); |
|
3466 |
iLongZeroPressed = EFalse; |
|
3467 |
HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength ); |
|
3468 |
TPtr ptr( buf->Des() ); |
|
3469 |
TBool homePgFound( KErrNotFound ); |
|
3470 |
||
3471 |
// try to read Access Points homepage |
|
3472 |
TUint defaultAp( KWmlNoDefaultAccessPoint ); |
|
3473 |
// 'always ask' feature doesn't let to read the AP |
|
3474 |
if( Preferences().AccessPointSelectionMode() == EConnectionMethod ) |
|
3475 |
{ |
|
3476 |
defaultAp = Preferences().DefaultAccessPoint(); |
|
3477 |
} |
|
3478 |
if ( defaultAp != KWmlNoDefaultAccessPoint ) // There is an access point defined |
|
3479 |
{ |
|
3480 |
CApAccessPointItem* apItem = Preferences().AllPreferencesL().iDefaultAPDetails; |
|
3481 |
if ( apItem ) |
|
3482 |
{ |
|
3483 |
const HBufC* defaultHP = apItem->ReadConstLongTextL( EApWapStartPage ); |
|
3484 |
if ( defaultHP->Length() ) |
|
3485 |
{ |
|
3486 |
ptr.Zero(); |
|
3487 |
ptr.Append( *defaultHP ); |
|
3488 |
homePgFound = KErrNone; |
|
3489 |
} |
|
3490 |
} |
|
3491 |
} |
|
3492 |
// in case of error, read user defined home page from SD |
|
3493 |
TInt err( KErrNone ); |
|
3494 |
if( homePgFound == KErrNotFound ) |
|
3495 |
{ |
|
3496 |
// do not let leaving |
|
3497 |
if ((Preferences().HomePageType() == EWmlSettingsHomePageAddress) |
|
3498 |
||(Preferences().HomePageType() == EWmlSettingsHomePageUseCurrent)) |
|
3499 |
{ |
|
3500 |
TRAP( err, homePgFound = Preferences().HomePageUrlL( ptr, ETrue ) ); |
|
3501 |
} |
|
3502 |
} |
|
3503 |
// we have a url to load |
|
3504 |
if( err == KErrNone && |
|
3505 |
homePgFound == KErrNone && |
|
3506 |
ptr.Length() > 0 ) |
|
3507 |
{ |
|
3508 |
TRAP( err, FetchL( ptr, CBrowserLoadObserver::ELoadUrlTypeOther ) ); |
|
3509 |
// in case of any error switch back to BookmarksView |
|
3510 |
if( err != KErrNone ) |
|
3511 |
{ |
|
3512 |
ContentView()->SetFullScreenOffL(); |
|
3513 |
SetLastActiveViewId( KUidBrowserBookmarksViewId ); |
|
3514 |
} |
|
3515 |
} |
|
3516 |
else |
|
3517 |
{ |
|
3518 |
// we already switched to ContentView, so change the layout back |
|
3519 |
ContentView()->SetFullScreenOffL(); |
|
3520 |
SetLastActiveViewId( KUidBrowserBookmarksViewId ); |
|
3521 |
} |
|
3522 |
CleanupStack::PopAndDestroy( buf ); |
|
3523 |
} |
|
3524 |
else |
|
3525 |
{ |
|
3526 |
// it checks HomePageSettings |
|
3527 |
LaunchHomePageL( /* EFalse */ ); |
|
3528 |
} |
|
3529 |
} |
|
3530 |
} |
|
3531 |
||
3532 |
// --------------------------------------------------------------------------- |
|
3533 |
// CBrowserAppUi::StartPreferencesViewL |
|
3534 |
// --------------------------------------------------------------------------- |
|
3535 |
// |
|
3536 |
TBool CBrowserAppUi::StartPreferencesViewL( TUint aListItems ) |
|
3537 |
{ |
|
3538 |
TBool retVal( EFalse ); |
|
3539 |
TInt retUi( KErrNone ); |
|
3540 |
TInt err(KErrNone); |
|
3541 |
||
3542 |
//start the connection dialog |
|
3543 |
CCmApplicationSettingsUi* settings = CCmApplicationSettingsUi::NewL(); |
|
3544 |
CleanupStack::PushL( settings ); |
|
3545 |
TCmSettingSelection selection; |
|
3546 |
// empty filter array because no filtering is wanted |
|
3547 |
TBearerFilterArray filterArray; |
|
3548 |
TRAP ( err, retUi = settings->RunApplicationSettingsL( selection, aListItems, filterArray ) ); |
|
3549 |
CleanupStack::PopAndDestroy(); // settings |
|
3550 |
||
3551 |
//if something has been selected |
|
3552 |
if (retUi) |
|
3553 |
{ |
|
3554 |
//set the selection mode |
|
3555 |
iPreferences->SetAccessPointSelectionModeL( |
|
3556 |
STATIC_CAST( TCmSettingSelectionMode, selection.iResult ) ); |
|
3557 |
||
3558 |
//based on the chosen connection type, store the connection identifier(iapid, snap id, always ask) |
|
3559 |
//in the preferences list |
|
3560 |
switch ( iPreferences->AccessPointSelectionMode() ) |
|
3561 |
{ |
|
3562 |
case EConnectionMethod: |
|
3563 |
{ |
|
3564 |
TUint32 id = iPreferences->DefaultAccessPoint(); |
|
3565 |
// CMManager gives us IAPid, need to translate to WAPid |
|
3566 |
if (selection.iId != 0) |
|
3567 |
{ |
|
3568 |
id = Util::WapIdFromIapIdL( *this, selection.iId ); |
|
3569 |
} |
|
3570 |
iPreferences->SetDefaultAccessPointL( id ); |
|
3571 |
// Requested AP is preset for PushMtm |
|
3572 |
id = iPreferences->DefaultAccessPoint(); |
|
3573 |
if( id != KWmlNoDefaultAccessPoint ) |
|
3574 |
{ |
|
3575 |
SetRequestedAP( id ); |
|
3576 |
retVal = ETrue; |
|
3577 |
} |
|
3578 |
break; |
|
3579 |
} |
|
3580 |
||
3581 |
case EDestination: |
|
3582 |
{ |
|
3583 |
TUint32 snapId = iPreferences->DefaultSnapId(); |
|
3584 |
if (selection.iId != 0) |
|
3585 |
{ |
|
3586 |
snapId = selection.iId; |
|
3587 |
} |
|
3588 |
iPreferences->SetDefaultSnapId( snapId ); |
|
3589 |
if( snapId != KWmlNoDefaultSnapId ) |
|
3590 |
{ |
|
3591 |
retVal = ETrue; |
|
3592 |
} |
|
3593 |
break; |
|
3594 |
} |
|
3595 |
||
3596 |
case EAlwaysAsk: |
|
3597 |
default: |
|
3598 |
{ |
|
3599 |
break; |
|
3600 |
} |
|
3601 |
} |
|
3602 |
} |
|
3603 |
||
3604 |
// alr: is return val needed? should it be true or false in EAA and default? check how it's used |
|
3605 |
return retVal; |
|
3606 |
} |
|
3607 |
// --------------------------------------------------------------------------- |
|
3608 |
// CBrowserAppUi::AhleConnection |
|
3609 |
// --------------------------------------------------------------------------- |
|
3610 |
// |
|
3611 |
CRecentUrlStore* CBrowserAppUi::RecentUrlStore() |
|
3612 |
{ |
|
3613 |
return iRecentUrlStore; |
|
3614 |
} |
|
3615 |
||
3616 |
// --------------------------------------------------------------------------- |
|
3617 |
// CBrowserAppUi::SomeItemsNotSecure |
|
3618 |
// --------------------------------------------------------------------------- |
|
3619 |
// |
|
3620 |
TBool CBrowserAppUi::SomeItemsNotSecure() const |
|
3621 |
{ |
|
3622 |
return !( LoadObserver().LoadStatus( CBrowserLoadObserver::ELoadStatusAllItemIsSecure ) ); |
|
3623 |
} |
|
3624 |
||
3625 |
// ---------------------------------------------------- |
|
3626 |
// CBrowserAppUi::IsProgressShown |
|
3627 |
// ---------------------------------------------------- |
|
3628 |
// |
|
3629 |
TBool CBrowserAppUi::IsProgressShown() const |
|
3630 |
{ |
|
3631 |
return iShowProgress; |
|
3632 |
} |
|
3633 |
||
3634 |
// ---------------------------------------------------- |
|
3635 |
// CBrowserAppUi::SetProgressShown |
|
3636 |
// ---------------------------------------------------- |
|
3637 |
// |
|
3638 |
void CBrowserAppUi::SetProgressShown( TBool aProgressShown ) |
|
3639 |
{ |
|
3640 |
iShowProgress = aProgressShown; |
|
3641 |
} |
|
3642 |
||
3643 |
// ---------------------------------------------------- |
|
3644 |
// CBrowserAppUi::RecognizeUiFileL |
|
3645 |
// ---------------------------------------------------- |
|
3646 |
// |
|
3647 |
TBool CBrowserAppUi::RecognizeUiFileL( RFile& aFile, TBuf<KMaxDataTypeLength>& aDataTypeDes ) |
|
3648 |
{ |
|
3649 |
TBool recognized = EFalse; |
|
3650 |
HBufC8* buffer = NULL; |
|
3651 |
||
3652 |
TFileName fileName; |
|
3653 |
User::LeaveIfError(aFile.FullName(fileName)); |
|
3654 |
||
3655 |
TInt fileSize; |
|
3656 |
||
3657 |
// Read the file from the beginning into a buffer |
|
3658 |
User::LeaveIfError(aFile.Size(fileSize)); |
|
3659 |
buffer = HBufC8::NewLC(fileSize); |
|
3660 |
TPtr8 bufferPtr(buffer->Des()); |
|
3661 |
TInt startPos = 0; |
|
3662 |
User::LeaveIfError(aFile.Read(startPos, bufferPtr, fileSize)); |
|
3663 |
// move the seek position back to start |
|
3664 |
User::LeaveIfError(aFile.Seek(ESeekStart, startPos)); |
|
3665 |
||
3666 |
_LIT( KDotOPML, ".opml"); |
|
3667 |
_LIT( KDotXML, ".xml"); |
|
3668 |
||
3669 |
// First try the name extension |
|
3670 |
if ( fileName.Length() >= 3 ) |
|
3671 |
{ |
|
3672 |
TInt dotPos = fileName.LocateReverse( '.' ); |
|
3673 |
if ( dotPos != KErrNotFound ) |
|
3674 |
{ |
|
3675 |
TInt extLength = fileName.Length() - dotPos; |
|
3676 |
HBufC* ext = fileName.Right( extLength ).AllocL(); |
|
3677 |
CleanupStack::PushL( ext ); |
|
3678 |
||
3679 |
// if .opml return true |
|
3680 |
if ( ext->CompareF( KDotOPML ) == 0) |
|
3681 |
{ |
|
3682 |
aDataTypeDes = KOPMLMimeType; |
|
3683 |
recognized = ETrue; |
|
3684 |
} |
|
3685 |
else if (ext->CompareF( KDotXML ) == 0 ) |
|
3686 |
{ |
|
3687 |
_LIT8( dtd, "<opml" ); |
|
3688 |
if( bufferPtr.FindF( dtd ) != KErrNotFound ) |
|
3689 |
{ |
|
3690 |
aDataTypeDes = KOPMLMimeType; |
|
3691 |
recognized = ETrue; |
|
3692 |
} |
|
3693 |
} |
|
3694 |
CleanupStack::PopAndDestroy(); // ext |
|
3695 |
} |
|
3696 |
} |
|
3697 |
||
3698 |
if (!recognized) |
|
3699 |
{ |
|
3700 |
// just check content of buffer |
|
3701 |
_LIT8( dtd, "<opml" ); |
|
3702 |
if( (bufferPtr.Length() > 5) && |
|
3703 |
(bufferPtr.FindF( dtd ) != KErrNotFound )) |
|
3704 |
{ |
|
3705 |
aDataTypeDes = KOPMLMimeType; |
|
3706 |
recognized = ETrue; |
|
3707 |
} |
|
3708 |
} |
|
3709 |
||
3710 |
CleanupStack::PopAndDestroy(); //buffer |
|
3711 |
||
3712 |
return recognized; |
|
3713 |
} |
|
3714 |
||
3715 |
||
3716 |
// --------------------------------------------------------- |
|
3717 |
// CBrowserAppUi::ConfirmUiHandlingL |
|
3718 |
// --------------------------------------------------------- |
|
3719 |
// |
|
3720 |
TBool CBrowserAppUi::ConfirmUiHandlingL( TFileName& aFilename, TBuf<KMaxDataTypeLength>& aDataTypeDes ) |
|
3721 |
{ |
|
3722 |
// switch on data type desc and handle file accordingly |
|
3723 |
if(aDataTypeDes.Compare( KOPMLMimeType ) == 0) |
|
3724 |
{ |
|
3725 |
// Display confirmation dialog before activating feeds view |
|
3726 |
HBufC* message = StringLoader::LoadLC(R_FEEDS_QUERY_IMPORT_NOW, aFilename); |
|
3727 |
HBufC* lsc_yes = StringLoader::LoadLC(R_FEEDS_IMPORT_NOW_YES); |
|
3728 |
HBufC* rsc_no = StringLoader::LoadLC(R_FEEDS_IMPORT_NOW_NO); |
|
3729 |
||
3730 |
TBool ret(iDialogsProvider->DialogConfirmL( _L(""), *message, *lsc_yes, *rsc_no )); |
|
3731 |
||
3732 |
CleanupStack::PopAndDestroy(3); //message, lsc_yes, rsc_no |
|
3733 |
||
3734 |
if(ret) |
|
3735 |
{ |
|
3736 |
return ETrue; |
|
3737 |
} |
|
3738 |
} |
|
3739 |
||
3740 |
return EFalse; |
|
3741 |
} |
|
3742 |
||
3743 |
// --------------------------------------------------------- |
|
3744 |
// CBrowserAppUi::CopyUiRFileToFileL |
|
3745 |
// --------------------------------------------------------- |
|
3746 |
// |
|
3747 |
||
3748 |
void CBrowserAppUi::CopyUiRFileToFileL( RFile& aFile, const TDesC& aFilepath ) |
|
3749 |
{ |
|
3750 |
// |
|
3751 |
// copy r-file to a temporary file |
|
3752 |
// |
|
3753 |
RFs tempRFs; |
|
3754 |
RFile tempRFile; |
|
3755 |
TInt fileSize; |
|
3756 |
HBufC8* buffer = NULL; |
|
3757 |
||
3758 |
// Connect to file server |
|
3759 |
User::LeaveIfError(tempRFs.Connect()); |
|
3760 |
CleanupClosePushL(tempRFs); |
|
3761 |
||
3762 |
// Create the filepath to copy to |
|
3763 |
// Replace the file if it already exists |
|
3764 |
User::LeaveIfError(tempRFile.Replace(tempRFs, aFilepath, EFileWrite)); |
|
3765 |
CleanupClosePushL(tempRFile); |
|
3766 |
||
3767 |
// Copy the file |
|
3768 |
User::LeaveIfError(aFile.Size(fileSize)); |
|
3769 |
buffer = HBufC8::NewLC(fileSize); |
|
3770 |
TPtr8 bufferPtr(buffer->Des()); |
|
3771 |
||
3772 |
// Read from the start of the file |
|
3773 |
User::LeaveIfError(aFile.Read(0, bufferPtr, fileSize)); |
|
3774 |
User::LeaveIfError(tempRFile.Write(bufferPtr, fileSize)); |
|
3775 |
||
3776 |
tempRFile.Close(); |
|
3777 |
tempRFs.Close(); |
|
3778 |
||
3779 |
// Cleanup Buffer and file copy stuff |
|
3780 |
CleanupStack::PopAndDestroy(3); //buffer, tempRFile, tempRFs |
|
3781 |
} |
|
3782 |
||
3783 |
// --------------------------------------------------------- |
|
3784 |
// CBrowserAppUi::HandleUiFileL |
|
3785 |
// --------------------------------------------------------- |
|
3786 |
// |
|
3787 |
void CBrowserAppUi::HandleUiFileL( TFileName& aFilepath, TBuf<KMaxDataTypeLength>& aDataTypeDes ) |
|
3788 |
{ |
|
3789 |
// switch on data type desc and handle file accordingly |
|
3790 |
if(aDataTypeDes.Compare(KOPMLMimeType) == 0) |
|
3791 |
{ |
|
3792 |
// Activate Content view first in order to |
|
3793 |
// get it's BrowserControl instance ready to go |
|
3794 |
// (as opposed to Feeds' BC instance) to be used to render |
|
3795 |
// feeds content in case the user wants to read |
|
3796 |
// the feed in-page. |
|
3797 |
SetLastActiveViewId( KUidBrowserContentViewId ); |
|
3798 |
SetViewToBeActivatedIfNeededL( LastActiveViewId() ); |
|
3799 |
ActivateLocalViewL( LastActiveViewId() ); |
|
3800 |
||
3801 |
// Now activate bookmarks view |
|
3802 |
SetLastActiveViewId( KUidBrowserBookmarksViewId ); |
|
3803 |
SetViewToBeActivatedIfNeededL( LastActiveViewId() ); |
|
3804 |
ActivateLocalViewL( LastActiveViewId() ); |
|
3805 |
HandleForegroundEventL( ETrue ); |
|
3806 |
||
3807 |
// wait until the content view is completely ready |
|
3808 |
WaitCVInit(); |
|
3809 |
||
3810 |
// begin import, pass to feeds view |
|
3811 |
iFeedsClientUtilities->BeginImportOPMLFeedsFileL(aFilepath); |
|
3812 |
} |
|
3813 |
} |
|
3814 |
||
3815 |
// --------------------------------------------------------- |
|
3816 |
// CBrowserAppUi::HandleUiDownloadL |
|
3817 |
// --------------------------------------------------------- |
|
3818 |
// |
|
3819 |
void CBrowserAppUi::HandleUiDownloadL( TFileName& aFilepath, TBuf<KMaxDataTypeLength>& aDataTypeDes ) |
|
3820 |
{ |
|
3821 |
// switch on data type desc and handle file accordingly |
|
3822 |
if(aDataTypeDes.Compare(KOPMLMimeType) == 0) |
|
3823 |
{ |
|
3824 |
SetLastActiveViewId( KUidBrowserFeedsFolderViewId ); |
|
3825 |
// begin import |
|
3826 |
iFeedsClientUtilities->BeginImportOPMLFeedsFileL(aFilepath); |
|
3827 |
// switch back to FeedsView, so change layout |
|
3828 |
ContentView()->SetFullScreenOffL(); |
|
3829 |
} |
|
3830 |
} |
|
3831 |
||
3832 |
// --------------------------------------------------------- |
|
3833 |
// CBrowserAppUi::LaunchIntoFeedsL |
|
3834 |
// --------------------------------------------------------- |
|
3835 |
// |
|
3836 |
void CBrowserAppUi::LaunchIntoFeedsL() |
|
3837 |
{ |
|
3838 |
if(iBrowserAlreadyRunning && (LastActiveViewId() == KUidBrowserContentViewId)) |
|
3839 |
{ |
|
3840 |
iFeedsClientUtilities->ShowFolderViewL(KUidBrowserContentViewId); |
|
3841 |
} |
|
3842 |
else |
|
3843 |
{ |
|
3844 |
iFeedsClientUtilities->ShowFolderViewL(); |
|
3845 |
} |
|
3846 |
} |
|
3847 |
||
3848 |
// ---------------------------------------------------- |
|
3849 |
// CBrowserAppUi::CreateFullUrlLC |
|
3850 |
// ---------------------------------------------------- |
|
3851 |
// |
|
3852 |
HBufC* CBrowserAppUi::CreateFullUrlLC( |
|
3853 |
const TDesC& aUrl, |
|
3854 |
const TDesC& aUsername, |
|
3855 |
const TDesC& aPassword ) |
|
3856 |
{ |
|
3857 |
// username[:password]@server/document |
|
3858 |
TInt lPw = aPassword.Length(); |
|
3859 |
TInt lUn = aUsername.Length(); |
|
3860 |
_LIT( KBrowserScheme, "://" ); |
|
3861 |
TInt index = aUrl.Find( KBrowserScheme ); |
|
3862 |
if( index == KErrNotFound ) |
|
3863 |
{ |
|
3864 |
index = 0; // insert at first position |
|
3865 |
} |
|
3866 |
else |
|
3867 |
{ |
|
3868 |
index += 3; // insert after scheme |
|
3869 |
} |
|
3870 |
||
3871 |
HBufC *fullUrl = HBufC::NewLC( aUrl.Length() + lUn + lPw + 3 ); |
|
3872 |
fullUrl->Des().Copy( aUrl ); |
|
3873 |
if( lPw + lUn ) |
|
3874 |
{ |
|
3875 |
fullUrl->Des().Insert( index, _L( "@" ) ); |
|
3876 |
} |
|
3877 |
if( lPw ) |
|
3878 |
{ |
|
3879 |
fullUrl->Des().Insert( index, aPassword ); |
|
3880 |
fullUrl->Des().Insert( index, _L( ":" ) ); |
|
3881 |
} |
|
3882 |
if( lUn ) |
|
3883 |
{ |
|
3884 |
fullUrl->Des().Insert( index, aUsername ); |
|
3885 |
} |
|
3886 |
// insert scheme??? |
|
3887 |
fullUrl->Des().ZeroTerminate(); |
|
3888 |
||
3889 |
return fullUrl; |
|
3890 |
} |
|
3891 |
||
3892 |
// --------------------------------------------------------- |
|
3893 |
// CBrowserAppUi::HandleResourceChangeL( TInt aType ) |
|
3894 |
// --------------------------------------------------------- |
|
3895 |
// |
|
3896 |
void CBrowserAppUi::HandleResourceChangeL( TInt aType ) |
|
3897 |
{ |
|
3898 |
LOG_ENTERFN("CBrowserAppUi::HandleResourceChangeL"); |
|
3899 |
LOG_WRITE_FORMAT(" aType: %d", aType); |
|
3900 |
if( iExitInProgress ) |
|
3901 |
{ |
|
3902 |
BROWSER_LOG( ( _L(" iExitInProgress ETrue ") ) ); |
|
3903 |
return; |
|
3904 |
} |
|
3905 |
||
3906 |
CAknViewAppUi::HandleResourceChangeL( aType ); |
|
3907 |
if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
3908 |
{ |
|
3909 |
CBrowserViewBase* activeView = ActiveView( ); |
|
3910 |
if( activeView != NULL ) |
|
3911 |
{ |
|
3912 |
activeView->HandleClientRectChange(); |
|
3913 |
if ( ContentView() && (activeView != ContentView()) ) |
|
3914 |
{ |
|
3915 |
ContentView()->HandleClientRectChange(); |
|
3916 |
} |
|
3917 |
} |
|
3918 |
} |
|
3919 |
if (aType == KEikMessageFadeAllWindows) |
|
3920 |
{ |
|
3921 |
if (ContentView() && ContentView()->PenEnabled()) |
|
3922 |
{ |
|
3923 |
if (iCurrentView == KUidBrowserContentViewId) |
|
3924 |
{ |
|
3925 |
ContentView()->Toolbar()->DisableToolbarL(ETrue); |
|
3926 |
} |
|
3927 |
} |
|
3928 |
} |
|
3929 |
||
3930 |
if (aType == KEikMessageUnfadeWindows) |
|
3931 |
{ |
|
3932 |
if (ContentView()&& ContentView()->PenEnabled() && !ExitInProgress()) |
|
3933 |
{ |
|
3934 |
if (iCurrentView == KUidBrowserContentViewId) |
|
3935 |
{ |
|
3936 |
ContentView()->MakeZoomSliderVisibleL(EFalse); |
|
3937 |
ContentView()->Toolbar()->DisableToolbarL(EFalse); |
|
3938 |
} |
|
3939 |
} |
|
3940 |
} |
|
3941 |
} |
|
3942 |
||
3943 |
// --------------------------------------------------------- |
|
3944 |
// CBrowserAppUi::ChangeConnectionL() |
|
3945 |
// --------------------------------------------------------- |
|
3946 |
// |
|
3947 |
void CBrowserAppUi::ChangeConnectionL() |
|
3948 |
{ |
|
3949 |
TConManChangeConn change; |
|
3950 |
// This will contain the new IAP as well, but it needs to pass the old one |
|
3951 |
TUint32 newAp = Util::IapIdFromWapIdL( *this, RequestedAp() ); |
|
3952 |
iConnection->ChangeIapL( change, newAp ); |
|
3953 |
if( EConManDoNothing == change ) |
|
3954 |
{ |
|
3955 |
// Do nothing |
|
3956 |
} |
|
3957 |
else |
|
3958 |
{ |
|
3959 |
//cancel transaction |
|
3960 |
SendDisconnectEventL(); |
|
3961 |
/* start all */ |
|
3962 |
if( EConManCloseAndStart == change ) |
|
3963 |
{ |
|
3964 |
//close connection |
|
3965 |
iConnection->Disconnect(); |
|
3966 |
||
3967 |
#ifdef __RSS_FEEDS |
|
3968 |
//notify feeds engine to close the connection |
|
3969 |
iFeedsClientUtilities->DisconnectManualUpdateConnectionL(); |
|
3970 |
#endif |
|
3971 |
} |
|
3972 |
iConnection->SetRequestedAP( newAp ); |
|
3973 |
TInt err = iConnection->StartConnectionL( ETrue ); |
|
3974 |
if( err == KErrNone ) |
|
3975 |
{ |
|
3976 |
iConnection->ShowConnectionChangedDlg(); |
|
3977 |
} |
|
3978 |
} |
|
3979 |
} |
|
3980 |
||
3981 |
// --------------------------------------------------------- |
|
3982 |
// CBrowserAppUi::HandleContentL() |
|
3983 |
// --------------------------------------------------------- |
|
3984 |
// |
|
3985 |
TBool CBrowserAppUi::HandleContentL( const TDesC& aFileName, |
|
3986 |
const CAiwGenericParamList& aParamList, |
|
3987 |
TBool& aContinue ) |
|
3988 |
{ |
|
3989 |
// Put the file name to the generic parameter list, if it is not there yet |
|
3990 |
TInt index(0); |
|
3991 |
aParamList.FindFirst( index, EGenericParamFile, EVariantTypeDesC ); |
|
3992 |
if ( index == KErrNotFound ) |
|
3993 |
{ |
|
3994 |
TAiwVariant paramVariant( aFileName ); |
|
3995 |
TAiwGenericParam genericParam( EGenericParamFile, paramVariant ); |
|
3996 |
CAiwGenericParamList* paramList = (CAiwGenericParamList*)&aParamList; |
|
3997 |
paramList->AppendL( genericParam ); |
|
3998 |
} |
|
3999 |
||
4000 |
// Set EGenericParamAllowMove - we allow handlers to apply move instead |
|
4001 |
// of copy for the file. |
|
4002 |
aParamList.FindFirst( index, EGenericParamAllowMove, EVariantTypeAny ); |
|
4003 |
if ( index == KErrNotFound ) |
|
4004 |
{ |
|
4005 |
TBool allowMove( ETrue ); |
|
4006 |
TAiwVariant allowMoveVariant( allowMove ); |
|
4007 |
TAiwGenericParam genericParamAllowMove( EGenericParamAllowMove, allowMoveVariant ); |
|
4008 |
CAiwGenericParamList* paramList = (CAiwGenericParamList*)&aParamList; |
|
4009 |
paramList->AppendL( genericParamAllowMove ); |
|
4010 |
} |
|
4011 |
||
4012 |
BrowserLauncherService()->DownloadFinishedL( KErrNone, aParamList ); |
|
4013 |
||
4014 |
// Wait until the client sends two TBools (contentHandled & continueBrowsing). |
|
4015 |
iClientWantsToContinue = EFalse; |
|
4016 |
iWasContentHandled = EFalse; |
|
4017 |
||
4018 |
iLauncherServiceWait.Start(); |
|
4019 |
||
4020 |
// iClientWantsToContinue and iWasContentHandled contains the results |
|
4021 |
aContinue = iClientWantsToContinue; |
|
4022 |
return iWasContentHandled; |
|
4023 |
} |
|
4024 |
||
4025 |
// --------------------------------------------------------- |
|
4026 |
// CBrowserAppUi::DownloadedContentHandlerReserved1() |
|
4027 |
// --------------------------------------------------------- |
|
4028 |
// |
|
4029 |
TAny* CBrowserAppUi::DownloadedContentHandlerReserved1( TAny* /*aAnyParam*/ ) |
|
4030 |
{ |
|
4031 |
return 0; |
|
4032 |
} |
|
4033 |
||
4034 |
// --------------------------------------------------------- |
|
4035 |
// CBrowserAppUi::SetContentHandlingResult() |
|
4036 |
// --------------------------------------------------------- |
|
4037 |
// |
|
4038 |
void CBrowserAppUi::SetContentHandlingResult |
|
4039 |
( TBool aClientWantsToContinue, TBool aWasContentHandled ) |
|
4040 |
{ |
|
4041 |
iClientWantsToContinue = aClientWantsToContinue; |
|
4042 |
iWasContentHandled = aWasContentHandled; |
|
4043 |
||
4044 |
// continue handling the content |
|
4045 |
iLauncherServiceWait.AsyncStop(); |
|
4046 |
} |
|
4047 |
||
4048 |
// --------------------------------------------------------- |
|
4049 |
// CBrowserAppUi::LoadSearchPageL() |
|
4050 |
// --------------------------------------------------------- |
|
4051 |
// |
|
4052 |
void CBrowserAppUi::LoadSearchPageL() |
|
4053 |
{ |
|
4054 |
TPtrC url = iPreferences->SearchPageUrlL(); |
|
4055 |
||
4056 |
// url undefined |
|
4057 |
if ( !url.Length() ) |
|
4058 |
{ |
|
4059 |
HBufC* query = StringLoader::LoadLC( |
|
4060 |
R_BROWSER_QUERY_DEF_SEARCHPAGE ); |
|
4061 |
// Ask if user want to define the search web setting now |
|
4062 |
if ( |
|
4063 |
TBrowserDialogs::DialogQueryReqL( query->Des(), |
|
4064 |
KNullDesC, |
|
4065 |
KNullDesC ) |
|
4066 |
) |
|
4067 |
{ |
|
4068 |
HBufC* prompt = StringLoader::LoadLC( |
|
4069 |
R_BROWSER_PROMPT_SEARCH_URL ); |
|
4070 |
HBufC* retBuf = HBufC::NewLC( KMaxSearchPgUrlLength ); |
|
4071 |
TPtr retString = retBuf->Des(); |
|
4072 |
retString.Copy( KNullDesC ); |
|
4073 |
||
4074 |
TInt result = TBrowserDialogs::DialogPromptReqL( |
|
4075 |
prompt->Des(), |
|
4076 |
&retString, |
|
4077 |
ETrue, |
|
4078 |
KMaxSearchPgUrlLength |
|
4079 |
); |
|
4080 |
||
4081 |
if( result ) // URL was accepted |
|
4082 |
{ |
|
4083 |
Preferences().SetSearchPageUrlL( retString ); |
|
4084 |
url.Set( iPreferences->SearchPageUrlL() ); |
|
4085 |
} |
|
4086 |
CleanupStack::PopAndDestroy( 2 ); // retBuf, prompt |
|
4087 |
} |
|
4088 |
CleanupStack::PopAndDestroy( query ); |
|
4089 |
} |
|
4090 |
||
4091 |
FetchL( url ); |
|
4092 |
} |
|
4093 |
||
4094 |
// --------------------------------------------------------- |
|
4095 |
// CBrowserAppUi::CloseWindowL() |
|
4096 |
// --------------------------------------------------------- |
|
4097 |
// |
|
4098 |
void CBrowserAppUi::CloseWindowL( TInt aWindowId ) |
|
4099 |
{ |
|
4100 |
LOG_ENTERFN("AppUi::CloseWindowL"); |
|
4101 |
||
4102 |
//There are only two cases for closing window. One is user initialized and the |
|
4103 |
//other is script initialized. For both cases, the window should be deleted. |
|
4104 |
TBool forceDelete( ETrue ); |
|
4105 |
// this variable is useful to know if the window has a parent window which needs to be activated on closing current window |
|
4106 |
TBool parentPresent(EFalse); |
|
4107 |
if ( WindowMgr().CurrentWindowQue() && WindowMgr().CurrentWindowQue()->iParent ) |
|
4108 |
{ |
|
4109 |
parentPresent = ETrue; |
|
4110 |
} |
|
4111 |
// delete the current window by default |
|
4112 |
if( aWindowId == 0 ) |
|
4113 |
{ |
|
4114 |
aWindowId = WindowMgr().CurrentWindow()->WindowId(); |
|
4115 |
// scripts directly pass a real windowId, |
|
4116 |
// so if user initiated the process, we really delete the window |
|
4117 |
forceDelete = ETrue; |
|
4118 |
} |
|
4119 |
//If this window has been created from Search app |
|
4120 |
if(aWindowId == iWindowIdFromFromExternApp) |
|
4121 |
{ |
|
4122 |
//Make it false as window is going to close down |
|
4123 |
iSameWinApp = EFalse; |
|
4124 |
} |
|
4125 |
#ifdef __RSS_FEEDS |
|
4126 |
// If we are closing a Feeds Full Story then go back to feeds |
|
4127 |
TBool feedsWindow(EFalse); |
|
4128 |
CBrowserWindow* win; |
|
4129 |
TInt err = WindowMgr().Window(aWindowId, win); |
|
4130 |
if (err == KErrNone) |
|
4131 |
{ |
|
4132 |
feedsWindow = win->HasFeedsContent(); |
|
4133 |
win->SetHasFeedsContent(EFalse); |
|
4134 |
} |
|
4135 |
#endif |
|
4136 |
||
4137 |
TInt winId = WindowMgr().DeleteWindowL( aWindowId, forceDelete ); |
|
4138 |
||
4139 |
#ifdef __RSS_FEEDS |
|
4140 |
if (feedsWindow) |
|
4141 |
{ |
|
4142 |
SetViewToBeActivatedIfNeededL( KUidBrowserFeedsFeedViewId ); |
|
4143 |
return; |
|
4144 |
} |
|
4145 |
#endif |
|
4146 |
||
4147 |
if( winId > 0 ) // still remain a window to be activated |
|
4148 |
{ |
|
4149 |
WindowMgr().SwitchWindowL( winId ); |
|
4150 |
if(CalledFromAnotherApp() && (!IsEmbeddedModeOn()) && !parentPresent) |
|
4151 |
{ |
|
4152 |
SetCalledFromAnotherApp(EFalse); |
|
4153 |
SendBrowserToBackground(); |
|
4154 |
} |
|
4155 |
} |
|
4156 |
else if( winId == 0) // last window was closed |
|
4157 |
{ |
|
4158 |
if(CalledFromAnotherApp() && (!IsEmbeddedModeOn())) |
|
4159 |
{ |
|
4160 |
#ifdef __RSS_FEEDS |
|
4161 |
if ((GetPreviousViewFromViewHistory() == KUidBrowserFeedsFolderViewId) || |
|
4162 |
(GetPreviousViewFromViewHistory() == KUidBrowserFeedsTopicViewId) || |
|
4163 |
(GetPreviousViewFromViewHistory() == KUidBrowserFeedsFeedViewId)) |
|
4164 |
{ |
|
4165 |
SetViewToBeActivatedIfNeededL( GetPreviousViewFromViewHistory() ); |
|
4166 |
SetCalledFromAnotherApp(EFalse); |
|
4167 |
SendBrowserToBackground(); |
|
4168 |
} |
|
4169 |
else |
|
4170 |
{ |
|
4171 |
ExitBrowser(ETrue); |
|
4172 |
} |
|
4173 |
#else |
|
4174 |
ExitBrowser(ETrue); |
|
4175 |
#endif // __RSS_FEEDS |
|
4176 |
} |
|
4177 |
else |
|
4178 |
{ |
|
4179 |
ExitBrowser(ETrue); |
|
4180 |
} |
|
4181 |
} |
|
4182 |
// else a background window was closed |
|
4183 |
||
4184 |
} |
|
4185 |
||
4186 |
// --------------------------------------------------------- |
|
4187 |
// CBrowserAppUi::StartProgressAnimationL |
|
4188 |
// --------------------------------------------------------- |
|
4189 |
// |
|
4190 |
void CBrowserAppUi::StartProgressAnimationL() |
|
4191 |
{ |
|
4192 |
LOG_ENTERFN("AppUi::StartProgressAnimationL"); |
|
4193 |
} |
|
4194 |
||
4195 |
// --------------------------------------------------------- |
|
4196 |
// CBrowserAppUi::StopProgressAnimationL |
|
4197 |
// --------------------------------------------------------- |
|
4198 |
// |
|
4199 |
void CBrowserAppUi::StopProgressAnimationL() |
|
4200 |
{ |
|
4201 |
LOG_ENTERFN("AppUi::StopProgressAnimationL"); |
|
4202 |
} |
|
4203 |
||
4204 |
#ifdef __RSS_FEEDS |
|
4205 |
// --------------------------------------------------------- |
|
4206 |
// CBrowserAppUi::FeedsClientUtilities |
|
4207 |
// --------------------------------------------------------- |
|
4208 |
// |
|
4209 |
CFeedsClientUtilities& CBrowserAppUi::FeedsClientUtilities() const |
|
4210 |
{ |
|
4211 |
return *iFeedsClientUtilities; |
|
4212 |
} |
|
4213 |
#endif // __RSS_FEEDS |
|
4214 |
||
4215 |
// --------------------------------------------------------- |
|
4216 |
// CBrowserAppUi::OpenLinkInNewWindowL() |
|
4217 |
// --------------------------------------------------------- |
|
4218 |
// |
|
4219 |
void CBrowserAppUi::OpenLinkInNewWindowL( const CFavouritesItem& aBookmarkItem ) |
|
4220 |
{ |
|
4221 |
if( ( aBookmarkItem.IsItem() ) && |
|
4222 |
( aBookmarkItem.Uid() != KFavouritesRSSItemUid ) ) |
|
4223 |
{ |
|
4224 |
// Check if we should/can create a new window |
|
4225 |
// In most cases when the feature is not allowed option menu items have been dimmed. |
|
4226 |
// In the case where a long key press on a bookmark happens we fall through to this function |
|
4227 |
// and check the feature here. If a new window is not allowed we can open in the current window |
|
4228 |
if( IsPageLoaded() && |
|
4229 |
Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) && |
|
4230 |
!Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows )) |
|
4231 |
{ |
|
4232 |
// there is already a window, so create a new one |
|
4233 |
CBrowserWindow *win = WindowMgr().CreateWindowL( 0, &KNullDesC ); |
|
4234 |
if (win != NULL) |
|
4235 |
{ |
|
4236 |
CleanupStack::PushL( win ); |
|
4237 |
WindowMgr().SwitchWindowL( win->WindowId() ); |
|
4238 |
FetchBookmarkL( aBookmarkItem ); |
|
4239 |
CleanupStack::Pop(); // win |
|
4240 |
} |
|
4241 |
} |
|
4242 |
else |
|
4243 |
{ |
|
4244 |
// no page is loaded yet, so do not create new window |
|
4245 |
FetchBookmarkL( aBookmarkItem ); |
|
4246 |
} |
|
4247 |
} |
|
4248 |
} |
|
4249 |
||
4250 |
// --------------------------------------------------------- |
|
4251 |
// CBrowserAppUi::SendDisconnectEventL |
|
4252 |
// --------------------------------------------------------- |
|
4253 |
// |
|
4254 |
void CBrowserAppUi::SendDisconnectEventL() |
|
4255 |
{ |
|
4256 |
LOG_ENTERFN("CBrowserAppUi::SendDisconnectEventL"); |
|
4257 |
||
4258 |
if(!iStartedUp) |
|
4259 |
return; |
|
4260 |
||
4261 |
SpecialLoadObserver().CancelConnection(); |
|
4262 |
CArrayFixFlat<CWindowInfo*>* windows = iWindowManager->GetWindowInfoL( this ); |
|
4263 |
if( windows ) |
|
4264 |
{ |
|
4265 |
TInt i; |
|
4266 |
||
4267 |
for ( i = 0; i < windows->Count(); i++ ) |
|
4268 |
{ |
|
4269 |
CBrowserWindow* window = NULL; |
|
4270 |
iWindowManager->Window( windows->At( i )->iWindowId, window ); |
|
4271 |
if( window ) |
|
4272 |
{ |
|
4273 |
TInt err; |
|
4274 |
// BROWSER_LOG( ( _L( " iConnection Connected" ) ) ); |
|
4275 |
TRAP( err, window->BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
4276 |
// BROWSER_LOG( ( _L( " HandleCommandL: %d"), err ) ); |
|
4277 |
} |
|
4278 |
} |
|
4279 |
||
4280 |
CBrowserWindow* window = NULL; |
|
4281 |
iWindowManager->Window( windows->At( 0 )->iWindowId, window ); |
|
4282 |
||
4283 |
// delete the window items before deleting the array |
|
4284 |
for( i=0; i<windows->Count(); ++i ) |
|
4285 |
delete windows->At( i ); |
|
4286 |
||
4287 |
delete windows; |
|
4288 |
} |
|
4289 |
} |
|
4290 |
/* |
|
4291 |
||
4292 |
// ---------------------------------------------------- |
|
4293 |
// CBrowserAppUi::IsPgNotFound |
|
4294 |
// ---------------------------------------------------- |
|
4295 |
// |
|
4296 |
TBool CBrowserAppUi::IsPgNotFound() const |
|
4297 |
{ |
|
4298 |
return iPgNotFound; |
|
4299 |
} |
|
4300 |
*/ |
|
4301 |
// ---------------------------------------------------- |
|
4302 |
// CBrowserAppUi::HandleApplicationSpecificEventL |
|
4303 |
// ---------------------------------------------------- |
|
4304 |
// |
|
4305 |
void CBrowserAppUi::HandleApplicationSpecificEventL(TInt aEventType, const TWsEvent& aWsEvent) |
|
4306 |
{ |
|
4307 |
CAknAppUi::HandleApplicationSpecificEventL(aEventType, aWsEvent); |
|
4308 |
||
4309 |
/* |
|
4310 |
* Note: Even though we get these memory events from the system for handling OOM, and we pass them off |
|
4311 |
* to the command handler, there is no code further down the line that actually handles them (it would |
|
4312 |
* normally be in BrCtl). We totally ignore these events. This is because the system has too high of an OOM threshold. |
|
4313 |
* I.e. the system may only have 6m left and think it's out of memory, however, the browser can still render |
|
4314 |
* many pages in only 6m. So, these system events are ignored and the browser handles OOM with its own mechanism. |
|
4315 |
* (See OOMStopper and OOMHandler) |
|
4316 |
*/ |
|
4317 |
if(aEventType == KAppOomMonitor_FreeRam ) |
|
4318 |
{ |
|
4319 |
iWindowManager->CloseAllWindowsExceptCurrent(); |
|
4320 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandFreeMemory + (TInt)TBrCtlDefs::ECommandIdBase); |
|
4321 |
} |
|
4322 |
else if(aEventType == KAppOomMonitor_MemoryGood) |
|
4323 |
{ |
|
4324 |
BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandMemoryGood + (TInt)TBrCtlDefs::ECommandIdBase); |
|
4325 |
} |
|
4326 |
else if ( KAknFullOrPartialForegroundGained == aEventType ) |
|
4327 |
{ |
|
4328 |
if ( iViewToBeActivatedIfNeeded.iUid ) |
|
4329 |
{ |
|
4330 |
ActivateLocalViewL( iViewToBeActivatedIfNeeded ); |
|
4331 |
} |
|
4332 |
else |
|
4333 |
{ |
|
4334 |
// LastActiveViewId() might return with 0! |
|
4335 |
TRAP_IGNORE( ActivateLocalViewL( LastActiveViewId() ) ); |
|
4336 |
} |
|
4337 |
iViewToBeActivatedIfNeeded.iUid = 0; |
|
4338 |
} |
|
4339 |
} |
|
4340 |
||
4341 |
// ---------------------------------------------------- |
|
4342 |
// CBrowserAppUi::OfferApplicationSpecificKeyEventL |
|
4343 |
// |
|
4344 |
// Use this function to handle key events that are application wide and not specific to any view |
|
4345 |
// All views (containers) call this first and should return if key was consumed |
|
4346 |
// As a note for future reference the red end key shows up as iCode = EKeyNo...though you would |
|
4347 |
// think it would be EKeyEnd... |
|
4348 |
// ---------------------------------------------------- |
|
4349 |
// |
|
4350 |
TKeyResponse CBrowserAppUi::OfferApplicationSpecificKeyEventL(const TKeyEvent& /*aKeyEvent*/, |
|
4351 |
TEventCode /*aType*/) |
|
4352 |
{ |
|
4353 |
TKeyResponse result( EKeyWasNotConsumed ); |
|
4354 |
||
4355 |
return result; |
|
4356 |
} |
|
4357 |
||
4358 |
// ----------------------------------------------------------------------------- |
|
4359 |
// CBrowserAppUi::GetPreviousViewFromViewHistory |
|
4360 |
// ----------------------------------------------------------------------------- |
|
4361 |
// |
|
4362 |
TUid CBrowserAppUi::GetPreviousViewFromViewHistory() |
|
4363 |
{ |
|
4364 |
return iPreviousView; |
|
4365 |
} |
|
4366 |
||
4367 |
// ----------------------------------------------------------------------------- |
|
4368 |
// CBrowserAppUi::SaveFocusedImageToGalleryL |
|
4369 |
// ----------------------------------------------------------------------------- |
|
4370 |
// |
|
4371 |
void CBrowserAppUi::SaveFocusedImageToGalleryL() |
|
4372 |
{ |
|
4373 |
TBrCtlImageCarrier* imageCarrier = BrCtlInterface().FocusedImageLC(); |
|
4374 |
CDocumentHandler* docHandler = CDocumentHandler::NewLC(); |
|
4375 |
TUriParser uriParser; |
|
4376 |
User::LeaveIfError(uriParser.Parse(imageCarrier->Url())); |
|
4377 |
TPtrC path; |
|
4378 |
path.Set( uriParser.Extract( EUriPath ) ); |
|
4379 |
HBufC* fileName = NULL; |
|
4380 |
if( path.Length() ) |
|
4381 |
{ |
|
4382 |
TInt slash = path.LocateReverse( '/' ); |
|
4383 |
if( slash != KErrNotFound && slash != path.Length() ) |
|
4384 |
{ |
|
4385 |
TPtrC temp( path.Right( path.Length() - slash - 1 ) ); |
|
4386 |
if( temp.Length() ) |
|
4387 |
{ |
|
4388 |
fileName = HBufC::NewLC(temp.Length() + 4); // leave room for edding extenstion if needed |
|
4389 |
fileName->Des().Copy(temp); |
|
4390 |
} |
|
4391 |
} |
|
4392 |
} |
|
4393 |
HBufC8* dataType8 = NULL; |
|
4394 |
dataType8 = HBufC8::NewLC(imageCarrier->ContentType().Length()); |
|
4395 |
dataType8->Des().Copy(imageCarrier->ContentType()); |
|
4396 |
TDataType dataType(*dataType8); |
|
4397 |
if (fileName) |
|
4398 |
{ |
|
4399 |
TPtr fileNamePtr(fileName->Des()); |
|
4400 |
docHandler->CheckFileNameExtension(fileNamePtr, dataType); |
|
4401 |
docHandler->SaveL(imageCarrier->RawData(), dataType, *fileName, KEntryAttNormal); |
|
4402 |
} |
|
4403 |
else |
|
4404 |
{ |
|
4405 |
docHandler->SaveL(imageCarrier->RawData(), dataType, KEntryAttNormal); |
|
4406 |
} |
|
4407 |
if (fileName) |
|
4408 |
{ |
|
4409 |
CleanupStack::PopAndDestroy(2); // fileName, dataType8 |
|
4410 |
} |
|
4411 |
else |
|
4412 |
{ |
|
4413 |
CleanupStack::PopAndDestroy(dataType8); // dataType8 |
|
4414 |
} |
|
4415 |
||
4416 |
TFileName fName; |
|
4417 |
User::LeaveIfError(docHandler->GetPath(fName)); |
|
4418 |
||
4419 |
#ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
|
4420 |
||
4421 |
CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL(CEikonEnv::Static()->FsSession()); |
|
4422 |
CleanupStack::PushL(mgFileManager); |
|
4423 |
if( fName.Length() > 0 ) |
|
4424 |
{ |
|
4425 |
TRAP_IGNORE( mgFileManager->UpdateL( fName ) ); |
|
4426 |
} |
|
4427 |
else |
|
4428 |
{ |
|
4429 |
TRAP_IGNORE( mgFileManager->UpdateL() ); |
|
4430 |
} |
|
4431 |
CleanupStack::PopAndDestroy(1); // mgFileManager |
|
4432 |
||
4433 |
#endif |
|
4434 |
||
4435 |
CleanupStack::PopAndDestroy(1); // imageCarrier |
|
4436 |
} |
|
4437 |
||
4438 |
// --------------------------------------------------------- |
|
4439 |
// CBrowserAppUi::CheckFlashPresent |
|
4440 |
// --------------------------------------------------------- |
|
4441 |
// |
|
4442 |
TBool CBrowserAppUi::CheckFlashPresent() |
|
4443 |
{ |
|
4444 |
RImplInfoPtrArray animPluginList; |
|
4445 |
||
4446 |
TRAP_IGNORE( REComSession::ListImplementationsL( KBrowserPluginInterfaceUid, |
|
4447 |
animPluginList ) ); |
|
4448 |
||
4449 |
||
4450 |
_LIT8(KFlashMimeType, "application/x-shockwave-flash"); |
|
4451 |
||
4452 |
const TInt count = animPluginList.Count(); |
|
4453 |
TBool found = EFalse; |
|
4454 |
for ( TInt i = 0; i < count; i++ ) |
|
4455 |
{ |
|
4456 |
CImplementationInformation* implInfo = animPluginList[i]; |
|
4457 |
if (( implInfo->DataType( ) ).Find( KFlashMimeType) != KErrNotFound) |
|
4458 |
{ |
|
4459 |
found = ETrue; //flash plugin is present |
|
4460 |
break; |
|
4461 |
} |
|
4462 |
} |
|
4463 |
animPluginList.ResetAndDestroy(); |
|
4464 |
||
4465 |
return found; |
|
4466 |
||
4467 |
} |
|
4468 |
||
4469 |
// --------------------------------------------------------- |
|
4470 |
// CBrowserAppUi::FlashPresent |
|
4471 |
// --------------------------------------------------------- |
|
4472 |
// |
|
4473 |
TBool CBrowserAppUi::FlashPresent() |
|
4474 |
{ |
|
4475 |
return iFlashPresent; |
|
4476 |
} |
|
4477 |
||
4478 |
// --------------------------------------------------------- |
|
4479 |
// CBrowserAppUi::ShowNameAndVersionL |
|
4480 |
// --------------------------------------------------------- |
|
4481 |
// |
|
4482 |
void CBrowserAppUi::ShowNameAndVersionL() |
|
4483 |
{ |
|
4484 |
HBufC* header = StringLoader::LoadLC( R_BROWSER_QUERY_BROWSER_VERSION ); |
|
4485 |
HBufC* browserVersion = BrCtlInterface().VersionInfoLC(TBrCtlDefs::EBrowserVersion); |
|
4486 |
||
4487 |
// output browser version to dialog |
|
4488 |
CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *browserVersion ); |
|
4489 |
CleanupStack::PushL(dlg); |
|
4490 |
dlg->PrepareLC( R_BROWSER_PAGE_VERSION ); |
|
4491 |
CleanupStack::Pop(dlg); |
|
4492 |
CAknPopupHeadingPane* hPane = dlg->QueryHeading(); |
|
4493 |
if ( hPane ) |
|
4494 |
{ |
|
4495 |
CleanupStack::PushL(hPane); |
|
4496 |
hPane->SetTextL( *header ); |
|
4497 |
CleanupStack::Pop(hPane); |
|
4498 |
} |
|
4499 |
dlg->RunLD(); |
|
4500 |
CleanupStack::PopAndDestroy(2); // browserVersion, header |
|
4501 |
} |
|
4502 |
||
4503 |
||
4504 |
// --------------------------------------------------------- |
|
4505 |
// CBrowserAppUi::IsLaunchHomePageDimmedL |
|
4506 |
// --------------------------------------------------------- |
|
4507 |
// |
|
4508 |
TBool CBrowserAppUi::IsLaunchHomePageDimmedL() |
|
4509 |
{ |
|
4510 |
||
4511 |
// Set dimmed flag if shortcut key for launch home page is dimmed and was selected |
|
4512 |
TBool dimmed = EFalse; |
|
4513 |
TBool homepage = Preferences().UiLocalFeatureSupported( KBrowserUiHomePageSetting ); |
|
4514 |
if( homepage ) |
|
4515 |
{ |
|
4516 |
TWmlSettingsHomePage pgtype = Preferences().HomePageType(); |
|
4517 |
TBool alwaysAskCase = ((Preferences().AccessPointSelectionMode() == EAlwaysAsk ) && |
|
4518 |
( EWmlSettingsHomePageAccessPoint == pgtype )); |
|
4519 |
||
4520 |
if (alwaysAskCase || (pgtype == EWmlSettingsHomePageBookmarks)) |
|
4521 |
{ |
|
4522 |
dimmed = ETrue; |
|
4523 |
} |
|
4524 |
else if (pgtype == EWmlSettingsHomePageAccessPoint) |
|
4525 |
{ |
|
4526 |
// check to see if no home page defined on the access point |
|
4527 |
HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack |
|
4528 |
TPtr ptr( buf->Des() ); |
|
4529 |
TInt pgFound = Preferences().HomePageUrlL( ptr ); |
|
4530 |
if( pgFound != KErrNone ) |
|
4531 |
{ |
|
4532 |
dimmed = ETrue; |
|
4533 |
} |
|
4534 |
CleanupStack::PopAndDestroy( buf ); |
|
4535 |
} |
|
4536 |
} |
|
4537 |
else |
|
4538 |
{ |
|
4539 |
dimmed = ETrue; |
|
4540 |
} |
|
4541 |
||
4542 |
return(dimmed); |
|
4543 |
} |
|
4544 |
||
4545 |
// --------------------------------------------------------- |
|
4546 |
// CBrowserAppUi::IsDisplayingMenuOrDialog |
|
4547 |
// --------------------------------------------------------- |
|
4548 |
// |
|
4549 |
TBool CBrowserAppUi::IsDisplayingMenuOrDialog() |
|
4550 |
{ |
|
4551 |
return CCoeAppUi::IsDisplayingMenuOrDialog(); |
|
4552 |
} |
|
4553 |
// --------------------------------------------------------- |
|
4554 |
// CBrowserAppUi::HandleWsEventL |
|
4555 |
// --------------------------------------------------------- |
|
4556 |
void CBrowserAppUi::HandleWsEventL(const TWsEvent& aEvent, |
|
4557 |
CCoeControl* aDestination) |
|
4558 |
{ |
|
4559 |
/** |
|
4560 |
* We need a special handling for pointer events to handle the situation |
|
4561 |
* when the pointer is crossing the boundaries of plugin window. Browser |
|
4562 |
* scrolling id done using PointerMove events not a Drag. |
|
4563 |
* When PointerMoveBuffer is ready HandlePointerBufferReadyL() is called by |
|
4564 |
* Symbian framework. By default if Pointer Down event wasn't issued on the |
|
4565 |
* current CoeControl Pointer Move events are not sent to this control. |
|
4566 |
* The code below makes sure that when we entering the Content View window |
|
4567 |
* from pluging window we are still getting move events. |
|
4568 |
* When we are leaving Content window we are generating fake Pointer Up |
|
4569 |
* event in order to on-demand scrollbars disapear properly. The later is a |
|
4570 |
* hack and needs to be re-designed in such way that pluging will pass |
|
4571 |
* pointer event back to the browser. |
|
4572 |
*/ |
|
4573 |
if (aDestination != NULL) |
|
4574 |
{ |
|
4575 |
TInt type=aEvent.Type(); |
|
4576 |
||
4577 |
switch (type) |
|
4578 |
{ |
|
4579 |
case EEventPointerExit: |
|
4580 |
{ |
|
4581 |
||
4582 |
break; |
|
4583 |
} |
|
4584 |
||
4585 |
case EEventPointerEnter: |
|
4586 |
{ |
|
4587 |
if (iCurrentView == KUidBrowserContentViewId) |
|
4588 |
{ |
|
4589 |
CCoeControl* ctrl = &(BrCtlInterface()); |
|
4590 |
ctrl->DrawableWindow()->DiscardPointerMoveBuffer(); |
|
4591 |
const TInt count = ctrl->CountComponentControls(); |
|
4592 |
for (TInt i = 0; i < count; i++) |
|
4593 |
{ |
|
4594 |
CCoeControl* c = ctrl->ComponentControl(i); |
|
4595 |
if (c) |
|
4596 |
{ |
|
4597 |
c->ClaimPointerGrab(EFalse); |
|
4598 |
} |
|
4599 |
} |
|
4600 |
ctrl->ClaimPointerGrab(EFalse); |
|
4601 |
} |
|
4602 |
break; |
|
4603 |
} |
|
4604 |
||
4605 |
} |
|
4606 |
} |
|
4607 |
CAknViewAppUi::HandleWsEventL(aEvent, aDestination); |
|
4608 |
} |
|
4609 |
||
4610 |
// --------------------------------------------------------- |
|
4611 |
// CBrowserAppUi::HandleSystemEventL |
|
4612 |
// --------------------------------------------------------- |
|
4613 |
#if defined(__S60_50__) |
|
4614 |
void CBrowserAppUi::HandleSystemEventL(const TWsEvent& aEvent) |
|
4615 |
{ |
|
4616 |
||
4617 |
/** |
|
4618 |
* We need a special handling for System events to handle the situation |
|
4619 |
* like when the shut down is done while download is going on. |
|
4620 |
*/ |
|
4621 |
||
4622 |
switch (*(TApaSystemEvent*)(aEvent.EventData())) |
|
4623 |
{ |
|
4624 |
case EApaSystemEventShutdown: |
|
4625 |
// do things here |
|
4626 |
ExitBrowser ( IsAppShutterActive() ); |
|
4627 |
break; |
|
4628 |
default: |
|
4629 |
break; |
|
4630 |
} |
|
4631 |
// call base class implementation |
|
4632 |
CAknAppUi::HandleSystemEventL(aEvent); |
|
4633 |
} |
|
4634 |
#endif |
|
4635 |
// --------------------------------------------------------- |
|
4636 |
// CBrowserAppUi::StartFetchHomePageL |
|
4637 |
// --------------------------------------------------------- |
|
4638 |
void CBrowserAppUi::StartFetchHomePageL(void) |
|
4639 |
{ |
|
4640 |
if(!iStartedUp) |
|
4641 |
CompleteDelayedInit(); |
|
4642 |
||
4643 |
// There's a homepage to be launched so start in content view |
|
4644 |
SetLastActiveViewId(KUidBrowserContentViewId); |
|
4645 |
//wait for contentview to initialize itself |
|
4646 |
WaitCVInit(); |
|
4647 |
||
4648 |
TInt error( KErrNone ); |
|
4649 |
TRAP( error, FetchHomePageL() ); |
|
4650 |
if( error != KErrNone ) |
|
4651 |
{ |
|
4652 |
CloseContentViewL(); |
|
4653 |
} |
|
4654 |
} |
|
4655 |
||
4656 |
#ifdef BRDO_IAD_UPDATE_ENABLED_FF |
|
4657 |
// --------------------------------------------------------- |
|
4658 |
// CBrowserAppUi::CompleteIADUpdateCallback |
|
4659 |
// --------------------------------------------------------- |
|
4660 |
TInt CBrowserAppUi::CompleteIADUpdateCallback( TAny* aBrowserAppUi ) |
|
4661 |
{ |
|
4662 |
TRAP_IGNORE( ((CBrowserAppUi*)aBrowserAppUi)->CheckUpdatesL() ) |
|
4663 |
return KErrNone; |
|
4664 |
} |
|
4665 |
||
4666 |
||
4667 |
// --------------------------------------------------------- |
|
4668 |
// CBrowserAppUi::CheckUpdateFileAvailable |
|
4669 |
// --------------------------------------------------------- |
|
4670 |
TBool CBrowserAppUi::CheckUpdateFileAvailable() |
|
4671 |
{ |
|
4672 |
LOG_ENTERFN("CBrowserAppUi::CheckUpdateFileAvailable"); |
|
4673 |
TBuf<KMaxFileName> privatePath; |
|
4674 |
TBuf<KMaxFileName> updateFileName; |
|
4675 |
iFs.PrivatePath( privatePath ); |
|
4676 |
updateFileName.Copy( privatePath ); |
|
4677 |
updateFileName.Append( KUpdateFileName ); |
|
4678 |
RFile updatefile; |
|
4679 |
TInt err = updatefile.Open( iFs, updateFileName, EFileRead ); |
|
4680 |
if ( err == KErrNotFound ) |
|
4681 |
{ |
|
4682 |
LOG_WRITE( "CBrowserAppUi::CheckUpdateFileAvailable - update file not available" ); |
|
4683 |
return EFalse; |
|
4684 |
} |
|
4685 |
else |
|
4686 |
{ |
|
4687 |
LOG_WRITE( "CBrowserAppUi::CheckUpdateFileAvailable - update file available" ); |
|
4688 |
updatefile.Close(); |
|
4689 |
} |
|
4690 |
return ETrue; |
|
4691 |
} |
|
4692 |
||
4693 |
// --------------------------------------------------------- |
|
4694 |
// CBrowserAppUi::WriteUpdateFile |
|
4695 |
// --------------------------------------------------------- |
|
4696 |
void CBrowserAppUi::WriteUpdateFile() |
|
4697 |
{ |
|
4698 |
LOG_ENTERFN("CBrowserAppUi::WriteUpdateFile"); |
|
4699 |
TBuf<KMaxFileName> privatePath; |
|
4700 |
TBuf<KMaxFileName> updateFileName; |
|
4701 |
iFs.PrivatePath( privatePath ); |
|
4702 |
updateFileName.Copy( privatePath ); |
|
4703 |
updateFileName.Append( KUpdateFileName ); |
|
4704 |
RFile updatefile; |
|
4705 |
TInt err = updatefile.Open( iFs, updateFileName, EFileWrite | EFileShareExclusive ); |
|
4706 |
if(err == KErrNotFound) |
|
4707 |
{ |
|
4708 |
LOG_WRITE( "CBrowserAppUi::WriteUpdateFile - update file not available so create it" ); |
|
4709 |
err = updatefile.Create( iFs, updateFileName, EFileWrite | EFileShareExclusive ); |
|
4710 |
} |
|
4711 |
//Get the current time |
|
4712 |
TTime timenow; |
|
4713 |
timenow.HomeTime(); |
|
4714 |
TInt64 time = timenow.Int64(); |
|
4715 |
TBuf8<50> data; |
|
4716 |
data.AppendNum(time); |
|
4717 |
LOG_WRITE( "CBrowserAppUi::WriteUpdateFile - write the current time in update file" ); |
|
4718 |
updatefile.Write(data); |
|
4719 |
updatefile.Close(); |
|
4720 |
} |
|
4721 |
||
4722 |
// --------------------------------------------------------- |
|
4723 |
// CBrowserAppUi::DeleteUpdateFile |
|
4724 |
// --------------------------------------------------------- |
|
4725 |
void CBrowserAppUi::DeleteUpdateFile() |
|
4726 |
{ |
|
4727 |
TBuf<KMaxFileName> privatePath; |
|
4728 |
TBuf<KMaxFileName> updateFileName; |
|
4729 |
iFs.PrivatePath( privatePath ); |
|
4730 |
updateFileName.Copy( privatePath ); |
|
4731 |
updateFileName.Append( KUpdateFileName ); |
|
4732 |
iFs.Delete(updateFileName); |
|
4733 |
} |
|
4734 |
||
4735 |
// --------------------------------------------------------- |
|
4736 |
// CBrowserAppUi::ReadUpdateFile |
|
4737 |
// --------------------------------------------------------- |
|
4738 |
TInt64 CBrowserAppUi::ReadUpdateFile() |
|
4739 |
{ |
|
4740 |
TBuf<KMaxFileName> privatePath; |
|
4741 |
TBuf<KMaxFileName> updateFileName; |
|
4742 |
//Get the private path then append the filename |
|
4743 |
iFs.PrivatePath( privatePath ); |
|
4744 |
updateFileName.Copy( privatePath ); |
|
4745 |
updateFileName.Append( KUpdateFileName ); |
|
4746 |
RFile updatefile; |
|
4747 |
TInt err = updatefile.Open( iFs, updateFileName, EFileRead ); |
|
4748 |
TInt64 dataValue = 0; |
|
4749 |
//If file is found |
|
4750 |
if ( err != KErrNotFound ) |
|
4751 |
{ |
|
4752 |
TBuf8<50> readBuf; |
|
4753 |
err = updatefile.Read(readBuf); |
|
4754 |
updatefile.Close(); |
|
4755 |
if((err == KErrNone) && (readBuf.Length()>NULL)) |
|
4756 |
{ |
|
4757 |
//Convert from TBuf8 to TInt64 |
|
4758 |
TLex8 lex(readBuf); |
|
4759 |
lex.Val(dataValue); |
|
4760 |
} |
|
4761 |
} |
|
4762 |
return dataValue; |
|
4763 |
} |
|
4764 |
#endif |
|
4765 |
||
4766 |
TBool CBrowserAppUi::IsSameWinApp(TUid aMessageUid) |
|
4767 |
{ |
|
4768 |
TInt nElements = sizeof(mArrayOfExternalAppUid)/sizeof(TInt); |
|
4769 |
for(TInt nIndex = 0;nIndex < nElements; nIndex++) |
|
4770 |
{ |
|
4771 |
if(aMessageUid == TUid::Uid(mArrayOfExternalAppUid[nIndex])) |
|
4772 |
{ |
|
4773 |
return ETrue; |
|
4774 |
} |
|
4775 |
} |
|
4776 |
return EFalse; |
|
4777 |
} |
|
4778 |
// End of File |